/var/www/vhosts/primacleaning.nl/httpdocs/src/TypeWriter/Feature/Gallery.php
* {@inheritDoc}
* @author Bas Milius <bas@mili.us>
* @since 1.0.0
*/
protected function getSupportedPostTypes(): ?array
{
return [$this->postType];
}
/**
* Gets the given gallery by the given post.
*
* @param int $postId
* @param string $galleryId
*
* @return int[]
* @author Bas Milius <bas@mili.us>
* @since 1.0.0
*/
public static function get(int $postId, string $galleryId): array
{
$postType = get_post_type($postId);
$metaKey = "tw_{$postType}_{$galleryId}_gallery";
$metaValue = get_post_meta($postId, $metaKey, true);
if (!is_array($metaValue)) {
return [];
}
return $metaValue;
}
}
/var/www/vhosts/primacleaning.nl/httpdocs/src/TypeWriter/Facade/Post.php
if (empty($excerpt)) {
return null;
}
return self::applyMultipleFilters($excerpt, $filters);
}
/**
* Gets the gallery with the given id of the current post.
*
* @param string $id
*
* @return int[]
* @author Bas Milius <bas@mili.us>
* @since 1.0.0
*/
public static function gallery(string $id): array
{
return Gallery::get(self::id(), $id);
}
/**
* Gets the intro text of the current post.
*
* @return string[]
* @author Bas Milius <bas@mili.us>
* @since 1.0.0
* @see IntroTextMetaFields
*/
public static function intro(): array
{
return IntroTextMetaFields::get(self::id());
}
/**
* Gets the intro text heading of the current post.
*
* @return string|null
* @author Bas Milius <bas@mili.us>
/var/www/vhosts/primacleaning.nl/httpdocs/vendor/twig/twig/src/Extension/CoreExtension.php
if ($ignoreStrictCheck || !$env->isStrictVariables()) {
return;
}
throw new RuntimeError(sprintf('Neither the property "%1$s" nor one of the methods "%1$s()", "get%1$s()"/"is%1$s()"/"has%1$s()" or "__call()" exist and have public access in class "%2$s".', $item, $class), $lineno, $source);
}
if ($isDefinedTest) {
return true;
}
if ($sandboxed) {
$env->getExtension(SandboxExtension::class)->checkMethodAllowed($object, $method, $lineno, $source);
}
// Some objects throw exceptions when they have __call, and the method we try
// to call is not supported. If ignoreStrictCheck is true, we should return null.
try {
$ret = $object->$method(...$arguments);
} catch (\BadMethodCallException $e) {
if ($call && ($ignoreStrictCheck || !$env->isStrictVariables())) {
return;
}
throw $e;
}
return $ret;
}
/**
* Returns the values from a single column in the input array.
*
* <pre>
* {% set items = [{ 'fruit' : 'apple'}, {'fruit' : 'orange' }] %}
*
* {% set fruits = items|column('fruit') %}
*
* {# fruits now contains ['apple', 'orange'] #}
* </pre>
/var/www/vhosts/primacleaning.nl/httpdocs/cache/twig/57/574fa8fbc10bc29e7e66f53c6ea0ba67491213a1ec3864f12e3a01dbe538677e.php
protected function doDisplay(array $context, array $blocks = [])
{
$macros = $this->macros;
// line 1
$controller = new \TypeWriter\Twig\Controller\PostController();
$context = array_merge($context, $controller->getContext()); // line 2
echo "
<a href=\"https://wa.me/0648284575\" class=\"btn btn-phone d-none lg:d-flex\">
<span class=\"text\">
06 – 48 28 45 75
</span>
<span class=\"icon\">
<svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"fab\" data-icon=\"whatsapp\" class=\"svg-inline--fa fa-whatsapp fa-w-14\" role=\"img\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 448 512\"><path fill=\"currentColor\" d=\"M380.9 97.1C339 55.1 283.2 32 223.9 32c-122.4 0-222 99.6-222 222 0 39.1 10.2 77.3 29.6 111L0 480l117.7-30.9c32.4 17.7 68.9 27 106.1 27h.1c122.3 0 224.1-99.6 224.1-222 0-59.3-25.2-115-67.1-157zm-157 341.6c-33.2 0-65.7-8.9-94-25.7l-6.7-4-69.8 18.3L72 359.2l-4.4-7c-18.5-29.4-28.2-63.3-28.2-98.2 0-101.7 82.8-184.5 184.6-184.5 49.3 0 95.6 19.2 130.4 54.1 34.8 34.9 56.2 81.2 56.1 130.5 0 101.8-84.9 184.6-186.6 184.6zm101.2-138.2c-5.5-2.8-32.8-16.2-37.9-18-5.1-1.9-8.8-2.8-12.5 2.8-3.7 5.6-14.3 18-17.6 21.8-3.2 3.7-6.5 4.2-12 1.4-32.6-16.3-54-29.1-75.5-66-5.7-9.8 5.7-9.1 16.3-30.3 1.8-3.7.9-6.9-.5-9.7-1.4-2.8-12.5-30.1-17.1-41.2-4.5-10.8-9.1-9.3-12.5-9.5-3.2-.2-6.9-.2-10.6-.2-3.7 0-9.7 1.4-14.8 6.9-5.1 5.6-19.4 19-19.4 46.3 0 27.3 19.9 53.7 22.6 57.4 2.8 3.7 39.1 59.7 94.8 83.8 35.2 15.2 49 16.5 66.6 13.9 10.7-1.6 32.8-13.4 37.4-26.4 4.6-13 4.6-24.1 3.2-26.4-1.3-2.5-5-3.9-10.5-6.6z\"></path></svg>
</span>
</a>
";
// line 12
if (( !(null === twig_get_attribute($this->env, $this->source, ($context["post"] ?? null), "gallery", [0 => "header"], "method", false, false, false, 12)) && !twig_test_empty(twig_get_attribute($this->env, $this->source, ($context["post"] ?? null), "gallery", [0 => "header"], "method", false, false, false, 12)))) {
// line 13
echo " <section id=\"main-slider\">
";
// line 14
$context['_parent'] = $context;
$context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, ($context["post"] ?? null), "gallery", [0 => "header"], "method", false, false, false, 14));
foreach ($context['_seq'] as $context["_key"] => $context["image"]) {
// line 15
echo " <div class=\"image\" style=\"background-image: url(";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["attachment"] ?? null), "getImage", [0 => $context["image"]], "method", false, false, false, 15), "html", null, true);
echo ")\"></div>
";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['image'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 17
echo " </section>
<section id=\"main-slider-content\">
<div class=\"container\">
/var/www/vhosts/primacleaning.nl/httpdocs/vendor/twig/twig/src/Template.php
} else {
ob_start(function () { return ''; });
}
try {
$this->display($context);
} catch (\Throwable $e) {
while (ob_get_level() > $level) {
ob_end_clean();
}
throw $e;
}
return ob_get_clean();
}
protected function displayWithErrorHandling(array $context, array $blocks = [])
{
try {
$this->doDisplay($context, $blocks);
} catch (Error $e) {
if (!$e->getSourceContext()) {
$e->setSourceContext($this->getSourceContext());
}
// this is mostly useful for \Twig\Error\LoaderError exceptions
// see \Twig\Error\LoaderError
if (-1 === $e->getTemplateLine()) {
$e->guess();
}
throw $e;
} catch (\Exception $e) {
$e = new RuntimeError(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $this->getSourceContext(), $e);
$e->guess();
throw $e;
}
}
/var/www/vhosts/primacleaning.nl/httpdocs/vendor/twig/twig/src/Template.php
{
return $this;
}
/**
* Returns all blocks.
*
* This method is for internal use only and should never be called
* directly.
*
* @return array An array of blocks
*/
public function getBlocks()
{
return $this->blocks;
}
public function display(array $context, array $blocks = [])
{
$this->displayWithErrorHandling($this->env->mergeGlobals($context), array_merge($this->blocks, $blocks));
}
public function render(array $context)
{
$level = ob_get_level();
if ($this->env->isDebug()) {
ob_start();
} else {
ob_start(function () { return ''; });
}
try {
$this->display($context);
} catch (\Throwable $e) {
while (ob_get_level() > $level) {
ob_end_clean();
}
throw $e;
}
/var/www/vhosts/primacleaning.nl/httpdocs/vendor/twig/twig/src/Template.php
public function getBlocks()
{
return $this->blocks;
}
public function display(array $context, array $blocks = [])
{
$this->displayWithErrorHandling($this->env->mergeGlobals($context), array_merge($this->blocks, $blocks));
}
public function render(array $context)
{
$level = ob_get_level();
if ($this->env->isDebug()) {
ob_start();
} else {
ob_start(function () { return ''; });
}
try {
$this->display($context);
} catch (\Throwable $e) {
while (ob_get_level() > $level) {
ob_end_clean();
}
throw $e;
}
return ob_get_clean();
}
protected function displayWithErrorHandling(array $context, array $blocks = [])
{
try {
$this->doDisplay($context, $blocks);
} catch (Error $e) {
if (!$e->getSourceContext()) {
$e->setSourceContext($this->getSourceContext());
}
/var/www/vhosts/primacleaning.nl/httpdocs/vendor/twig/twig/src/TemplateWrapper.php
private $env;
private $template;
/**
* This method is for internal use only and should never be called
* directly (use Twig\Environment::load() instead).
*
* @internal
*/
public function __construct(Environment $env, Template $template)
{
$this->env = $env;
$this->template = $template;
}
public function render(array $context = []): string
{
// using func_get_args() allows to not expose the blocks argument
// as it should only be used by internal code
return $this->template->render($context, \func_get_args()[1] ?? []);
}
public function display(array $context = [])
{
// using func_get_args() allows to not expose the blocks argument
// as it should only be used by internal code
$this->template->display($context, \func_get_args()[1] ?? []);
}
public function hasBlock(string $name, array $context = []): bool
{
return $this->template->hasBlock($name, $context);
}
/**
* @return string[] An array of defined template block names
*/
public function getBlockNames(array $context = []): array
{
return $this->template->getBlockNames($context);
/var/www/vhosts/primacleaning.nl/httpdocs/vendor/twig/twig/src/Extension/CoreExtension.php
foreach ((\is_array($template) ? $template : [$template]) as $name) {
// if a Template instance is passed, it might have been instantiated outside of a sandbox, check security
if ($name instanceof TemplateWrapper || $name instanceof Template) {
$name->unwrap()->checkSecurity();
}
}
}
try {
$loaded = null;
try {
$loaded = $env->resolveTemplate($template);
} catch (LoaderError $e) {
if (!$ignoreMissing) {
throw $e;
}
}
return $loaded ? $loaded->render($variables) : '';
} finally {
if ($isSandboxed && !$alreadySandboxed) {
$sandbox->disableSandbox();
}
}
}
/**
* Returns a template content without rendering it.
*
* @param string $name The template name
* @param bool $ignoreMissing Whether to ignore missing templates or not
*
* @return string The template source
*/
function twig_source(Environment $env, $name, $ignoreMissing = false)
{
$loader = $env->getLoader();
try {
return $loader->getSourceContext($name)->getCode();
/var/www/vhosts/primacleaning.nl/httpdocs/cache/twig/26/26486b7f32a82ff94fc3121ff2d55d388bf2f3b5471b0085c43688c9ed4f4ca3.php
gtag('js', new Date());
gtag('config', 'G-EJ1VYXSLSZ');
</script>
</head>
<body class=\"";
// line 20
echo twig_escape_filter($this->env, twig_join_filter(call_user_func_array($this->env->getFunction('wp')->getCallable(), ["get_body_class"]), " "), "html", null, true);
echo "\">
<header id=\"main-header\">
";
// line 23
echo twig_include($this->env, $context, "@theme/mixin/menu-main.twig");
echo "
";
// line 26
echo " ";
echo twig_include($this->env, $context, "@theme/mixin/header-main.twig");
echo "
";
// line 28
echo "</header>
";
}
public function getTemplateName()
{
return "@theme/global/header.twig";
}
public function isTraitable()
{
return false;
}
public function getDebugInfo()
{
return array ( 85 => 28, 80 => 26, 75 => 23, 69 => 20, 58 => 11, 56 => 9, 49 => 5, 45 => 4, 40 => 2, 37 => 1,);
/var/www/vhosts/primacleaning.nl/httpdocs/vendor/twig/twig/src/Template.php
} else {
ob_start(function () { return ''; });
}
try {
$this->display($context);
} catch (\Throwable $e) {
while (ob_get_level() > $level) {
ob_end_clean();
}
throw $e;
}
return ob_get_clean();
}
protected function displayWithErrorHandling(array $context, array $blocks = [])
{
try {
$this->doDisplay($context, $blocks);
} catch (Error $e) {
if (!$e->getSourceContext()) {
$e->setSourceContext($this->getSourceContext());
}
// this is mostly useful for \Twig\Error\LoaderError exceptions
// see \Twig\Error\LoaderError
if (-1 === $e->getTemplateLine()) {
$e->guess();
}
throw $e;
} catch (\Exception $e) {
$e = new RuntimeError(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $this->getSourceContext(), $e);
$e->guess();
throw $e;
}
}
/var/www/vhosts/primacleaning.nl/httpdocs/vendor/twig/twig/src/Template.php
{
return $this;
}
/**
* Returns all blocks.
*
* This method is for internal use only and should never be called
* directly.
*
* @return array An array of blocks
*/
public function getBlocks()
{
return $this->blocks;
}
public function display(array $context, array $blocks = [])
{
$this->displayWithErrorHandling($this->env->mergeGlobals($context), array_merge($this->blocks, $blocks));
}
public function render(array $context)
{
$level = ob_get_level();
if ($this->env->isDebug()) {
ob_start();
} else {
ob_start(function () { return ''; });
}
try {
$this->display($context);
} catch (\Throwable $e) {
while (ob_get_level() > $level) {
ob_end_clean();
}
throw $e;
}
/var/www/vhosts/primacleaning.nl/httpdocs/vendor/twig/twig/src/Template.php
public function getBlocks()
{
return $this->blocks;
}
public function display(array $context, array $blocks = [])
{
$this->displayWithErrorHandling($this->env->mergeGlobals($context), array_merge($this->blocks, $blocks));
}
public function render(array $context)
{
$level = ob_get_level();
if ($this->env->isDebug()) {
ob_start();
} else {
ob_start(function () { return ''; });
}
try {
$this->display($context);
} catch (\Throwable $e) {
while (ob_get_level() > $level) {
ob_end_clean();
}
throw $e;
}
return ob_get_clean();
}
protected function displayWithErrorHandling(array $context, array $blocks = [])
{
try {
$this->doDisplay($context, $blocks);
} catch (Error $e) {
if (!$e->getSourceContext()) {
$e->setSourceContext($this->getSourceContext());
}
/var/www/vhosts/primacleaning.nl/httpdocs/vendor/twig/twig/src/TemplateWrapper.php
private $env;
private $template;
/**
* This method is for internal use only and should never be called
* directly (use Twig\Environment::load() instead).
*
* @internal
*/
public function __construct(Environment $env, Template $template)
{
$this->env = $env;
$this->template = $template;
}
public function render(array $context = []): string
{
// using func_get_args() allows to not expose the blocks argument
// as it should only be used by internal code
return $this->template->render($context, \func_get_args()[1] ?? []);
}
public function display(array $context = [])
{
// using func_get_args() allows to not expose the blocks argument
// as it should only be used by internal code
$this->template->display($context, \func_get_args()[1] ?? []);
}
public function hasBlock(string $name, array $context = []): bool
{
return $this->template->hasBlock($name, $context);
}
/**
* @return string[] An array of defined template block names
*/
public function getBlockNames(array $context = []): array
{
return $this->template->getBlockNames($context);
/var/www/vhosts/primacleaning.nl/httpdocs/vendor/twig/twig/src/Environment.php
*/
public function getTemplateClass(string $name, int $index = null): string
{
$key = $this->getLoader()->getCacheKey($name).$this->optionsHash;
return $this->templateClassPrefix.hash('sha256', $key).(null === $index ? '' : '___'.$index);
}
/**
* Renders a template.
*
* @param string|TemplateWrapper $name The template name
*
* @throws LoaderError When the template cannot be found
* @throws SyntaxError When an error occurred during compilation
* @throws RuntimeError When an error occurred during rendering
*/
public function render($name, array $context = []): string
{
return $this->load($name)->render($context);
}
/**
* Displays a template.
*
* @param string|TemplateWrapper $name The template name
*
* @throws LoaderError When the template cannot be found
* @throws SyntaxError When an error occurred during compilation
* @throws RuntimeError When an error occurred during rendering
*/
public function display($name, array $context = []): void
{
$this->load($name)->display($context);
}
/**
* Loads a template.
*
* @param string|TemplateWrapper $name The template name
/var/www/vhosts/primacleaning.nl/httpdocs/src/TypeWriter/Twig/TwigRenderer.php
* Gets the Twig instance.
*
* @return Twig
* @author Bas Milius <bas@mili.us>
* @since 1.0.0
*/
public final function getTwig(): Twig
{
return $this->twig;
}
/**
* {@inheritdoc}
* @author Bas Milius <bas@mili.us>
* @since 1.0.0
*/
public final function render(string $template, array $context = []): string
{
try {
return $this->twig->render($template, $context);
} catch (LoaderError | RuntimeError | SyntaxError $err) {
throw $this->error($err);
}
}
}
/var/www/vhosts/primacleaning.nl/httpdocs/src/TypeWriter/Facade/Template.php
} else if (is_file($footerPath = Dependencies::themePath('footer.php'))) {
return Sandbox::render($footerPath);
} else {
throw new TemplateException('The footer template was not found. Create a template/global/footer.twig or footer.php file in your theme.', TemplateException::ERR_TEMPLATE_FILE_NOT_FOUND);
}
}
/**
* Renders the header template.
*
* @return string
* @author Bas Milius <bas@mili.us>
* @since 1.0.0
*/
public static function renderHeader(): string
{
$twig = tw()->getTwig();
if ($twig->exists('@theme/global/header.twig')) {
return tw()->getTwig()->render('@theme/global/header.twig');
} else if (is_file($headerPath = Dependencies::themePath('header.php'))) {
return Sandbox::render($headerPath);
} else {
throw new TemplateException('The header template was not found. Create a template/global/header.twig or header.php file in your theme.', TemplateException::ERR_TEMPLATE_FILE_NOT_FOUND);
}
}
/**
* Renders the svg code of the given icon.
*
* @param string $style
* @param string $icon
*
* @return string
* @author Bas Milius <bas@mili.us>
* @since 1.0.0
*/
public static function renderIcon(string $style, string $icon): string
{
$key = "{$style}_{$icon}";
/var/www/vhosts/primacleaning.nl/httpdocs/cache/twig/12/124dfa4315ef746559d08b5ae2564976abb1e192a8eaeb3cc0b52c151e6c330d.php
private $macros = [];
public function __construct(Environment $env)
{
parent::__construct($env);
$this->source = $this->getSourceContext();
$this->parent = false;
$this->blocks = [
];
}
protected function doDisplay(array $context, array $blocks = [])
{
$macros = $this->macros;
// line 5
$controller = new \PrimaCleaning\Controller\NotFoundController();
$context = array_merge($context, $controller->getContext());echo TypeWriter\Facade\Template::renderHeader(); // line 8
echo "
<div id=\"main-content\" class=\"wrapper-top\">
<div class=\"container\">
<div class=\"row\">
<div class=\"col-12 text-center\">
<h2>Pagina niet gevonden..</h2>
<p>
Was dit een link vanuit onze website? Laat het ons dan weten!
</p>
<p>
<a href=\"";
// line 18
echo twig_escape_filter($this->env, call_user_func_array($this->env->getFunction('url')->getCallable(), ["contact"]), "html", null, true);
echo "\" class=\"btn btn-primary\">Neem contact op</a>
</p>
</div>
</div>
</div>
</div>";
echo TypeWriter\Facade\Template::renderFooter(); }
/var/www/vhosts/primacleaning.nl/httpdocs/vendor/twig/twig/src/Template.php
} else {
ob_start(function () { return ''; });
}
try {
$this->display($context);
} catch (\Throwable $e) {
while (ob_get_level() > $level) {
ob_end_clean();
}
throw $e;
}
return ob_get_clean();
}
protected function displayWithErrorHandling(array $context, array $blocks = [])
{
try {
$this->doDisplay($context, $blocks);
} catch (Error $e) {
if (!$e->getSourceContext()) {
$e->setSourceContext($this->getSourceContext());
}
// this is mostly useful for \Twig\Error\LoaderError exceptions
// see \Twig\Error\LoaderError
if (-1 === $e->getTemplateLine()) {
$e->guess();
}
throw $e;
} catch (\Exception $e) {
$e = new RuntimeError(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $this->getSourceContext(), $e);
$e->guess();
throw $e;
}
}
/var/www/vhosts/primacleaning.nl/httpdocs/vendor/twig/twig/src/Template.php
{
return $this;
}
/**
* Returns all blocks.
*
* This method is for internal use only and should never be called
* directly.
*
* @return array An array of blocks
*/
public function getBlocks()
{
return $this->blocks;
}
public function display(array $context, array $blocks = [])
{
$this->displayWithErrorHandling($this->env->mergeGlobals($context), array_merge($this->blocks, $blocks));
}
public function render(array $context)
{
$level = ob_get_level();
if ($this->env->isDebug()) {
ob_start();
} else {
ob_start(function () { return ''; });
}
try {
$this->display($context);
} catch (\Throwable $e) {
while (ob_get_level() > $level) {
ob_end_clean();
}
throw $e;
}
/var/www/vhosts/primacleaning.nl/httpdocs/vendor/twig/twig/src/Template.php
public function getBlocks()
{
return $this->blocks;
}
public function display(array $context, array $blocks = [])
{
$this->displayWithErrorHandling($this->env->mergeGlobals($context), array_merge($this->blocks, $blocks));
}
public function render(array $context)
{
$level = ob_get_level();
if ($this->env->isDebug()) {
ob_start();
} else {
ob_start(function () { return ''; });
}
try {
$this->display($context);
} catch (\Throwable $e) {
while (ob_get_level() > $level) {
ob_end_clean();
}
throw $e;
}
return ob_get_clean();
}
protected function displayWithErrorHandling(array $context, array $blocks = [])
{
try {
$this->doDisplay($context, $blocks);
} catch (Error $e) {
if (!$e->getSourceContext()) {
$e->setSourceContext($this->getSourceContext());
}
/var/www/vhosts/primacleaning.nl/httpdocs/vendor/twig/twig/src/TemplateWrapper.php
private $env;
private $template;
/**
* This method is for internal use only and should never be called
* directly (use Twig\Environment::load() instead).
*
* @internal
*/
public function __construct(Environment $env, Template $template)
{
$this->env = $env;
$this->template = $template;
}
public function render(array $context = []): string
{
// using func_get_args() allows to not expose the blocks argument
// as it should only be used by internal code
return $this->template->render($context, \func_get_args()[1] ?? []);
}
public function display(array $context = [])
{
// using func_get_args() allows to not expose the blocks argument
// as it should only be used by internal code
$this->template->display($context, \func_get_args()[1] ?? []);
}
public function hasBlock(string $name, array $context = []): bool
{
return $this->template->hasBlock($name, $context);
}
/**
* @return string[] An array of defined template block names
*/
public function getBlockNames(array $context = []): array
{
return $this->template->getBlockNames($context);
/var/www/vhosts/primacleaning.nl/httpdocs/vendor/twig/twig/src/Environment.php
*/
public function getTemplateClass(string $name, int $index = null): string
{
$key = $this->getLoader()->getCacheKey($name).$this->optionsHash;
return $this->templateClassPrefix.hash('sha256', $key).(null === $index ? '' : '___'.$index);
}
/**
* Renders a template.
*
* @param string|TemplateWrapper $name The template name
*
* @throws LoaderError When the template cannot be found
* @throws SyntaxError When an error occurred during compilation
* @throws RuntimeError When an error occurred during rendering
*/
public function render($name, array $context = []): string
{
return $this->load($name)->render($context);
}
/**
* Displays a template.
*
* @param string|TemplateWrapper $name The template name
*
* @throws LoaderError When the template cannot be found
* @throws SyntaxError When an error occurred during compilation
* @throws RuntimeError When an error occurred during rendering
*/
public function display($name, array $context = []): void
{
$this->load($name)->display($context);
}
/**
* Loads a template.
*
* @param string|TemplateWrapper $name The template name
/var/www/vhosts/primacleaning.nl/httpdocs/src/TypeWriter/Twig/TwigRenderer.php
* Gets the Twig instance.
*
* @return Twig
* @author Bas Milius <bas@mili.us>
* @since 1.0.0
*/
public final function getTwig(): Twig
{
return $this->twig;
}
/**
* {@inheritdoc}
* @author Bas Milius <bas@mili.us>
* @since 1.0.0
*/
public final function render(string $template, array $context = []): string
{
try {
return $this->twig->render($template, $context);
} catch (LoaderError | RuntimeError | SyntaxError $err) {
throw $this->error($err);
}
}
}
/var/www/vhosts/primacleaning.nl/httpdocs/src/TypeWriter/Module/Core/PostTemplatesResolverModule.php
/**
* Invoked on template_include filter hook.
* Checks if we need to enter Twig mode and otherwise gives control back to WordPress.
*
* @param string $template
*
* @return string|null
* @author Bas Milius <bas@mili.us>
* @since 1.0.0
* @internal
*/
public final function onTemplateInclude(string $template): ?string
{
if (substr($template, -5) !== '.twig') {
return $template;
}
tw()->getTwig()->addPath(dirname($template));
echo tw()->getTwig()->render(basename($template), []);
return null;
}
/**
* Finds a template within the theme directories based on {@see $tryFiles}.
*
* @param string $template
* @param array $tryFiles
*
* @return string
* @author Bas Milius <bas@mili.us>
* @since 1.0.0
*/
private function findPossibleTemplate(string $template, array $tryFiles): string
{
global $post;
if (!empty($template))
return $template;
/var/www/vhosts/primacleaning.nl/httpdocs/public/wp/wp-includes/class-wp-hook.php
$nesting_level = $this->nesting_level++;
$this->iterations[ $nesting_level ] = array_keys( $this->callbacks );
$num_args = count( $args );
do {
$this->current_priority[ $nesting_level ] = current( $this->iterations[ $nesting_level ] );
$priority = $this->current_priority[ $nesting_level ];
foreach ( $this->callbacks[ $priority ] as $the_ ) {
if ( ! $this->doing_action ) {
$args[0] = $value;
}
// Avoid the array_slice() if possible.
if ( 0 == $the_['accepted_args'] ) {
$value = call_user_func( $the_['function'] );
} elseif ( $the_['accepted_args'] >= $num_args ) {
$value = call_user_func_array( $the_['function'], $args );
} else {
$value = call_user_func_array( $the_['function'], array_slice( $args, 0, (int) $the_['accepted_args'] ) );
}
}
} while ( false !== next( $this->iterations[ $nesting_level ] ) );
unset( $this->iterations[ $nesting_level ] );
unset( $this->current_priority[ $nesting_level ] );
$this->nesting_level--;
return $value;
}
/**
* Calls the callback functions that have been added to an action hook.
*
* @since 4.7.0
*
* @param array $args Parameters to pass to the callback functions.
/var/www/vhosts/primacleaning.nl/httpdocs/public/wp/wp-includes/plugin.php
if ( isset( $wp_filter['all'] ) ) {
$wp_current_filter[] = $tag;
_wp_call_all_hook( $args );
}
if ( ! isset( $wp_filter[ $tag ] ) ) {
if ( isset( $wp_filter['all'] ) ) {
array_pop( $wp_current_filter );
}
return $value;
}
if ( ! isset( $wp_filter['all'] ) ) {
$wp_current_filter[] = $tag;
}
// Don't pass the tag name to WP_Hook.
array_shift( $args );
$filtered = $wp_filter[ $tag ]->apply_filters( $value, $args );
array_pop( $wp_current_filter );
return $filtered;
}
/**
* Calls the callback functions that have been added to a filter hook, specifying arguments in an array.
*
* @since 3.0.0
*
* @see apply_filters() This function is identical, but the arguments passed to the
* functions hooked to `$tag` are supplied using an array.
*
* @global WP_Hook[] $wp_filter Stores all of the filters and actions.
* @global string[] $wp_current_filter Stores the list of current filters with the current one last.
*
* @param string $tag The name of the filter hook.
* @param array $args The arguments supplied to the functions hooked to $tag.
* @return mixed The filtered value after all hooked functions are applied to it.
/var/www/vhosts/primacleaning.nl/httpdocs/public/wp/wp-includes/template-loader.php
if ( 'is_attachment' === $tag ) {
remove_filter( 'the_content', 'prepend_attachment' );
}
break;
}
}
if ( ! $template ) {
$template = get_index_template();
}
/**
* Filters the path of the current template before including it.
*
* @since 3.0.0
*
* @param string $template The path of the template to include.
*/
$template = apply_filters( 'template_include', $template );
if ( $template ) {
include $template;
} elseif ( current_user_can( 'switch_themes' ) ) {
$theme = wp_get_theme();
if ( $theme->errors() ) {
wp_die( $theme->errors() );
}
}
return;
}
/var/www/vhosts/primacleaning.nl/httpdocs/src/TypeWriter/TypeWriter.php
public final function run(): void
{
require_once(WP_DIR . '/wp-load.php');
Hooks::action('rest_api_init', fn() => $this->runRouter(
fn() => die
));
wp();
$this->state->set('tw.is-wp-initialized', true);
$this->state->set('tw.is-wp-used', false);
foreach ($this->modules as $module) {
$module->onRun();
}
$this->runRouter(
fn() => die,
fn() => require_once WP_DIR . '/wp-includes/template-loader.php'
);
}
/**
* Gets the database connection instance.
*
* @return Connection|null
* @author Bas Milius <bas@mili.us>
* @since 1.0.0
*/
public final function getDatabase(): ?Connection
{
return $this->database;
}
/**
* Gets the error reporter.
*
* @return ErrorReporter
* @author Bas Milius <bas@mili.us>
/var/www/vhosts/primacleaning.nl/httpdocs/src/TypeWriter/TypeWriter.php
private function runRouter(?callable $onUsed = null, ?callable $onNotUsed = null): void
{
$_SERVER['REQUEST_URI'] ??= '/';
$_SERVER['REQUEST_METHOD'] ??= RequestMethod::GET;
try {
$this->router->execute($_SERVER['REQUEST_URI'], $_SERVER['REQUEST_METHOD']);
if ($onUsed !== null) {
$onUsed();
}
} catch (RouterException $err) {
if ($err->getCode() !== $err::ERR_NOT_FOUND) {
throw $err;
}
$this->state->set('tw.is-wp-used', true);
if ($onNotUsed !== null) {
$onNotUsed();
}
}
}
}
/var/www/vhosts/primacleaning.nl/httpdocs/src/TypeWriter/TypeWriter.php
{
require_once(WP_DIR . '/wp-load.php');
Hooks::action('rest_api_init', fn() => $this->runRouter(
fn() => die
));
wp();
$this->state->set('tw.is-wp-initialized', true);
$this->state->set('tw.is-wp-used', false);
foreach ($this->modules as $module) {
$module->onRun();
}
$this->runRouter(
fn() => die,
fn() => require_once WP_DIR . '/wp-includes/template-loader.php'
);
}
/**
* Gets the database connection instance.
*
* @return Connection|null
* @author Bas Milius <bas@mili.us>
* @since 1.0.0
*/
public final function getDatabase(): ?Connection
{
return $this->database;
}
/**
* Gets the error reporter.
*
* @return ErrorReporter
* @author Bas Milius <bas@mili.us>
* @since 1.0.0
/var/www/vhosts/primacleaning.nl/httpdocs/public/index.php
<?php
/**
* Copyright (c) 2019 - Bas Milius <bas@mili.us>
*
* This file is part of TypeWriter, a base framework for WordPress.
*
* For the full copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
use function TypeWriter\tw;
require_once __DIR__ . '/../src/TypeWriter/boot.php';
define('WP_USE_THEMES', true);
tw()->run();