in /home/jetsgroup/jetsgroup.forge-dev02.racerdev.no/vendor/craftcms/cms/src/base/FlysystemVolume.php at line 189
// catch any AssetException and rethrow as ImagerException try { // If a temp file already exists, something went wrong last time, let's delete it and not assume that the Volume will handle it if (file_exists($this->getTemporaryFilePath())) { @unlink($this->getTemporaryFilePath()); } $volume->saveFileLocally($this->asset->getPath(), $this->getTemporaryFilePath()); } catch (AssetException $e){ throw new ImagerException($e->getMessage(), $e->getCode(), $e); } if (file_exists($this->getTemporaryFilePath())) { copy($this->getTemporaryFilePath(), $this->getFilePath()); @unlink($this->getTemporaryFilePath()); } } if ($this->type === 'remoteurl') {
// Set save options $saveOptions = $this->getSaveOptions($targetModel->extension, $transform); // Do transform if transform doesn't exist, cache is disabled, or cache expired if (ImagerHelpers::shouldCreateTransform($targetModel, $transform)) { // Make sure that we have a local copy. $sourceModel->getLocalCopy(); // Check all the things that could go wrong(tm) if (!file_exists($sourceModel->getFilePath())) { $msg = Craft::t('imager-x', 'Requested image “{fileName}” does not exist in path “{sourcePath}”', ['fileName' => $sourceModel->filename, 'sourcePath' => $sourceModel->path]); Craft::error($msg, __METHOD__); throw new ImagerException($msg);
foreach ($transforms as $transform) { if ($config->getSetting('noop', $transform)) { $msg = Craft::t('imager-x', 'Noop activated, returning “{path}”.', ['path' => $sourceModel->url]); Craft::info($msg, __METHOD__); $transformedImages[] = new NoopImageModel($sourceModel, $transform); } else { $transformedImages[] = $this->getTransformedImage($sourceModel, $transform); } } $taskCreated = false; // Loop over transformed images and do post optimizations and upload to external storage
// Do we have a debug image? if (self::$transformConfig->mockImage !== null) { $image = ImagerHelpers::getTransformableFromConfigSetting(self::$transformConfig->mockImage); } try { $transformedImages = $transformer->transform($image, $transforms); } catch (ImagerException $e) { // If a fallback image is defined, try to transform that instead. if (self::$transformConfig->fallbackImage !== null) { $fallbackImage = ImagerHelpers::getTransformableFromConfigSetting(self::$transformConfig->fallbackImage); if ($fallbackImage) {
* @return mixed * * @throws ImagerException */ public function transformImage($file, $transforms, $transformDefaults = null, $configOverrides = null) { $image = Plugin::$plugin->imagerx->transformImage($file, $transforms, $transformDefaults, $configOverrides); return $image; } /** * Takes an array of models that supports getUrl() and getWidth(), and returns a srcset * and returns a srcset string
$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; }
// Add deprecated support for the old DateTime methods if ($object instanceof \DateTime && ($value = self::_dateTimeAttribute($object, $item, $type)) !== false) { return $value; } try { return \twig_get_attribute($env, $source, $object, $item, $arguments, $type, $isDefinedTest, $ignoreStrictCheck); } catch (UnknownMethodException $e) { // Copy twig_get_attribute()'s BadMethodCallException handling if ($ignoreStrictCheck || !$env->isStrictVariables()) { return null; } throw new RuntimeError($e->getMessage(), -1, $source);
{% set transformedImages = craft.imager.transformImage( image, sizes, { ratio: ratio, format: craft.imager.serverSupportsWebp() and craft.imager.clientSupportsWebp() ? 'webp' : image.extension, position: image.getFocalPoint(), jpegQuality: 85, }, { fillTransforms: false, } ) %}
} } throw new RuntimeError(sprintf('Macro "%s" is not defined in template "%s".', substr($method, \strlen('macro_')), $template->getTemplateName()), $lineno, $source); } return $template->$method(...$args); } /** * @internal */ function twig_ensure_traversable($seq)
{% embed "_partials/page-content/block" %} {% block content %} {% import "_partials/macros" as macros %} {% set buttonStyles = { 'blue': 'text-white bg-blue-dark', 'yellow': 'text-black bg-yellow'
if (null !== $template && !$template instanceof self) { throw new \LogicException('A block must be a method on a \Twig\Template instance.'); } if (null !== $template) { try { $template->$block($context, $blocks); } catch (Error $e) { if (!$e->getSourceContext()) { $e->setSourceContext($template->getSourceContext()); } // this is mostly useful for \Twig\Error\LoaderError exceptions
{% set spacing = spacings[block.spacingAbove.value ?? 'default'] %} <section {% if block.anchorLink|length%}id="{{ block.anchorLink }}"{% endif %} class="{% if hasSpacing%}{{ hasSameBackgroundAsNextBlock ? spacing['top'] : spacing['top'] ~ ' ' ~ spacing['bottom'] }}{% endif %} {{ theme.bg }}" > {% block content %}{% endblock %} </section>
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
{ 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()) {
{% embed "_partials/page-content/block" %} {% block content %} {% import "_partials/macros" as macros %} {% set buttonStyles = { 'blue': 'text-white bg-blue-dark', 'yellow': 'text-black bg-yellow'
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
{ 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()) {
{% embed "_partials/page-content/block" %} {% block content %} {% import "_partials/macros" as macros %} {% set buttonStyles = { 'blue': 'text-white bg-blue-dark', 'yellow': 'text-black bg-yellow'
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
{ 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()) {
{% include '_partials/page-content/blocks/' ~ block.type with { block, loop, hasPageHeader, hasSameBackgroundAsPreviousBlock, hasSameBackgroundAsNextBlock, } only %} {% set previousBlockBackground = block.backgroundColor|length ? block.backgroundColor.value : null %} {% endfor %} </div>
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
{ 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()) {
{% endif %} </div> </div> {% endif %} {% include "_partials/page-content" with { blocks: entry.pageContent.all(), } %}
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
{ 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()) {
{% extends '_layouts/generic-page-layout.twig' %} {% block content %} {% include "pages/_types/" ~ entry.type %} {% endblock %}
if (null !== $template && !$template instanceof self) { throw new \LogicException('A block must be a method on a \Twig\Template instance.'); } if (null !== $template) { try { $template->$block($context, $blocks); } catch (Error $e) { if (!$e->getSourceContext()) { $e->setSourceContext($template->getSourceContext()); } // this is mostly useful for \Twig\Error\LoaderError exceptions
<div class="text-grey-dark"> {# -- Global header, including _navbar.twig -- #} {% include "_partials/header.twig" %} <main> {# -- Primary content block -- #} {% block content %} {% endblock %} </main> {# -- Content that appears below the primary content block -- #} {% block subcontent %} {% endblock %}
if (null !== $template && !$template instanceof self) { throw new \LogicException('A block must be a method on a \Twig\Template instance.'); } if (null !== $template) { try { $template->$block($context, $blocks); } catch (Error $e) { if (!$e->getSourceContext()) { $e->setSourceContext($template->getSourceContext()); } // this is mostly useful for \Twig\Error\LoaderError exceptions
{% endblock headContent %} {# -- Page content that should be included in the <body> -- #} {% block bodyContent %} {# -- Page content that should be included in the <body> -- #} {% block bodyHtml %} {% endblock bodyHtml %} {#-- Site-wide JavaScript --#} {{ sprig.script }} <script src="{{ rev('/assets/main.js') }}"></script>
if (null !== $template && !$template instanceof self) { throw new \LogicException('A block must be a method on a \Twig\Template instance.'); } if (null !== $template) { try { $template->$block($context, $blocks); } catch (Error $e) { if (!$e->getSourceContext()) { $e->setSourceContext($template->getSourceContext()); } // this is mostly useful for \Twig\Error\LoaderError exceptions
<body> {% endblock bodyTag %} {# -- Hook for Cookie Consent Banner -- #} {# {% hook 'after-body-start' %} #} {# -- Page content that should be included in the <body> -- #} {% block bodyContent %} {% endblock bodyContent %} </body> </html> {%- endblock htmlPage -%}
if (null !== $template && !$template instanceof self) { throw new \LogicException('A block must be a method on a \Twig\Template instance.'); } if (null !== $template) { try { $template->$block($context, $blocks); } catch (Error $e) { if (!$e->getSourceContext()) { $e->setSourceContext($template->getSourceContext()); } // this is mostly useful for \Twig\Error\LoaderError exceptions
{# -- This allows for defining site-wide Twig variables as needed -- #} {% spaceless %} {# -- Twig output from the render; this must be in a block -- #} {% block htmlPage %} {% endblock %} {% endspaceless %}
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
{ 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()) {
{# -- Base web layout template that all web requests inherit from -- #} {% extends "_layouts/global-variables.twig" %} {%- block htmlPage -%} <!DOCTYPE html> {% block htmlTag %} <html lang="{{ craft.app.language|slice(0,2) }}"> {% endblock htmlTag %}
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
{ 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()) {
{# -- Base HTML layout template that all HTML requests inherit from -- #} {% extends craft.app.request.isAjax() and not craft.app.request.getIsPreview() ? "_boilerplate/_layouts/base-ajax-layout.twig" : "_boilerplate/_layouts/base-web-layout.twig" %} {% block htmlTag %} <html lang="{{ craft.app.language |slice(0,2) }}"> {% endblock htmlTag %}
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
{ 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()) {
{# -- Layout template for HTML pages -- #} {% extends "_boilerplate/_layouts/base-html-layout.twig" %} {# -- Any <meta> tags that should be included in the <head> #} {% block headMeta %} <meta name="msapplication-TileColor" content="#2d89ef"> <meta name="theme-color" content="#ffffff"> {% endblock headMeta %}
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
{ 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()) {
{% extends '_layouts/generic-page-layout.twig' %} {% block content %} {% include "pages/_types/" ~ entry.type %} {% endblock %}
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
{ 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()) {
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;
* @param array $context An array of parameters to pass to the 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] ?? []); } /** * Displays the template. * * @param array $context An array of parameters to pass to the template
* @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 = []) { return $this->load($name)->render($context); } /** * Displays a template. * * @param string|TemplateWrapper $name The template name
// Render and return $renderingTemplate = $this->_renderingTemplate; $this->_renderingTemplate = $template; try { $output = $this->getTwig()->render($template, $variables); } finally { $this->_renderingTemplate = $renderingTemplate; $this->setTemplateMode($oldTemplateMode); } $this->afterRenderTemplate($template, $variables, $templateMode, $output);
$isRenderingPageTemplate = $this->_isRenderingPageTemplate; $this->_isRenderingPageTemplate = true; try { $this->beginPage(); echo $this->renderTemplate($template, $variables); $this->endPage(); } finally { $this->_isRenderingPageTemplate = $isRenderingPageTemplate; $this->setTemplateMode($oldTemplateMode); $output = ob_get_clean(); }
} // Prevent a response formatter from overriding the content-type header $this->response->format = YiiResponse::FORMAT_RAW; // Render and return the template $this->response->data = $view->renderPageTemplate($template, $variables, $templateMode); $headers = $this->response->getHeaders(); if ($generalConfig->sendContentLengthHeader) { $headers->setDefault('content-length', strlen($this->response->data)); }
// Merge any additional route params $routeParams = Craft::$app->getUrlManager()->getRouteParams(); unset($routeParams['template'], $routeParams['template']); $variables = array_merge($variables, $routeParams); return $this->renderTemplate($template, $variables); } /** * Shows the 'offline' template. * * @return Response
$args = $this->controller->bindActionParams($this, $params); Yii::debug('Running action: ' . get_class($this->controller) . '::' . $this->actionMethod . '()', __METHOD__); if (Yii::$app->requestedParams === null) { Yii::$app->requestedParams = $args; } return call_user_func_array([$this->controller, $this->actionMethod], $args); } }
} $result = null; if ($runAction && $this->beforeAction($action)) { // run the action $result = $action->runWithParams($params); $result = $this->afterAction($action, $result); // call afterAction on modules foreach ($modules as $module) { /* @var $module Module */
$parts = $this->createController($route); if (is_array($parts)) { /* @var $controller Controller */ list($controller, $actionID) = $parts; $oldController = Yii::$app->controller; Yii::$app->controller = $controller; $result = $controller->runAction($actionID, $params); if ($oldController !== null) { Yii::$app->controller = $oldController; } return $result; }
* @param string $route * @param array $params * @return Response|null The result of the action, normalized into a Response object */ public function runAction($route, $params = []) { $result = parent::runAction($route, $params); if ($result !== null) { if ($result instanceof Response) { return $result; }
$params = $this->catchAll; unset($params[0]); } try { Yii::debug("Route requested: '$route'", __METHOD__); $this->requestedRoute = $route; $result = $this->runAction($route, $params); if ($result instanceof Response) { return $result; } $response = $this->getResponse(); if ($result !== null) {
if (($response = $this->_processActionRequest($request)) !== null) { return $response; } // If we're still here, finally let Yii do it's thing. try { return parent::handleRequest($request); } catch (\Throwable $e) { $this->_unregisterDebugModule(); throw $e; } }
{ try { $this->state = self::STATE_BEFORE_REQUEST; $this->trigger(self::EVENT_BEFORE_REQUEST); $this->state = self::STATE_HANDLING_REQUEST; $response = $this->handleRequest($this->getRequest()); $this->state = self::STATE_AFTER_REQUEST; $this->trigger(self::EVENT_AFTER_REQUEST); $this->state = self::STATE_SENDING_RESPONSE; $response->send();
(new Dotenv\Dotenv(CRAFT_BASE_PATH))->load(); } // Load and run Craft define('CRAFT_ENVIRONMENT', getenv('ENVIRONMENT') ?: 'production'); $app = require CRAFT_VENDOR_PATH.'/craftcms/cms/bootstrap/web.php'; $app->run();