Phalcon Framework 5.1.2

PDOException: SQLSTATE[HY093]: Invalid parameter number

/var/www/html/discounts-n-coupons.com/src/app/Lib/Mvc/Model/UcmItem.php (462)
#0PDOStatement->execute
#1Phalcon\Db\Adapter\Pdo\AbstractPdo->executePrepared
#2Phalcon\Db\Adapter\Pdo\AbstractPdo->query
#3Phalcon\Mvc\Model\Query->executeSelect
#4Phalcon\Mvc\Model\Query->execute
#5Phalcon\Mvc\Model::find
/var/www/html/discounts-n-coupons.com/src/app/Lib/Mvc/Model/UcmItem.php (462)
<?php
 
namespace CLSystems\PhalCMS\Lib\Mvc\Model;
 
use Phalcon\Db\Adapter\Pdo\Mysql;
use CLSystems\PhalCMS\Lib\Helper\Event as EventHelper;
use CLSystems\PhalCMS\Lib\Helper\UcmItem as UcmItemHelper;
use CLSystems\PhalCMS\Lib\Helper\StringHelper;
use CLSystems\PhalCMS\Lib\Helper\Uri;
use CLSystems\PhalCMS\Lib\Helper\Language;
use CLSystems\PhalCMS\Lib\Form\FormsManager;
use CLSystems\PhalCMS\Lib\Form\Form;
use CLSystems\PhalCMS\Lib\Factory;
use CLSystems\Php\Registry;
use CLSystems\Php\Filter;
use Phalcon\Mvc\Model\ResultsetInterface;
 
class UcmItem extends ModelBase
{
  /**
   *
   * @var integer
   */
  public $id;
 
  /**
   *
   * @var integer
   */
  public $parentId;
 
  /**
   *
   * @var string
   */
  public $context;
 
  /**
   *
   * @var string
   */
  public $title;
 
  /**
   *
   * @var string
   */
  public $route;
 
  /**
   *
   * @var integer
   */
  public $state;
 
  /**
   *
   * @var string
   */
  public $image;
 
  /**
   *
   * @var string
   */
  public $summary;
 
  /**
   *
   * @var string
   */
  public $description;
 
  /**
   *
   * @var string
   */
  public $createdAt;
 
  /**
   *
   * @var integer
   */
  public $createdBy = 0;
 
  /**
   *
   * @var string
   */
  public $modifiedAt = null;
 
  /**
   *
   * @var integer
   */
  public $modifiedBy = 0;
 
  /**
   *
   * @var string
   */
  public $checkedAt = null;
 
  /**
   *
   * @var integer
   */
  public $checkedBy = 0;
 
  /**
   *
   * @var string
   */
  public $metaTitle = '';
 
  /**
   *
   * @var string
   */
  public $metaKeys = '';
 
  /**
   *
   * @var string
   */
  public $metaDesc = '';
 
  /**
   *
   * @var string
   */
  protected $params;
 
  /**
   *
   * @var integer
   */
  public $ordering;
 
  /**
   *
   * @var integer
   */
  public $lft = 0;
 
  /**
   *
   * @var integer
   */
  public $rgt = 1;
 
  /**
   *
   * @var integer
   */
  public $level = 0;
 
  /**
   * @var integer
   */
 
  public $hits = 0;
 
  /**
   * @var boolean
   */
 
  public $hasRoute = false;
 
  /**
   * @var string
   */
 
  protected $titleField = 'title';
 
  /**
   * @var boolean
   */
 
  protected $standardMetadata = true;
 
  /** @var array */
  protected $fieldsData = [];
 
  /** @var array */
  protected $translationsFieldsData = [];
 
  public function getParent()
  {
    return $this->getRelated('parent');
  }
 
  /**
   * Initialize method for model.
   */
 
  public function initialize()
  {
    $this->setSource('ucm_items');
  }
 
  public function getOrderFields()
  {
    return [
      ($this instanceof Nested ? 'lft' : 'ordering'),
      'id',
      'title',
      'description',
      'createdAt',
      'createdBy',
    ];
  }
 
  public function getFilterForm()
  {
    return new Form('FilterForm', __DIR__ . '/Form/UcmItem/Filter.php');
  }
 
  public function getFormsManager()
  {
    $formsManager = new FormsManager;
    $formsManager->set('general', new Form('FormData', __DIR__ . '/Form/UcmItem/General.php'));
    $formsManager->set('aside', new Form('FormData', __DIR__ . '/Form/UcmItem/Aside.php'));
    $formsManager->set('metadata', new Form('FormData', __DIR__ . '/Form/Metadata/Metadata.php'));
 
    return $formsManager;
  }
 
  public function isContextPrefix($prefix)
  {
    return preg_match('/^' . $prefix . '/', $this->context) ? true : false;
  }
 
  public function isContextSuffix($suffix)
  {
    return preg_match('/-' . $suffix . '$/', $this->context) ? true : false;
  }
 
  public function prepareFormsManager(FormsManager $formsManager)
  {
    $asideForm = $formsManager->get('aside');
 
    if ($this->id
      && $asideForm->has('tags')
      && ($tags = $this->getRelated('tags'))->count()
    )
    {
      $tagIds = [];
 
      /**
       * @var Tag $tag
       */
      foreach ($tags as $tag)
      {
        $tagIds[] = (int)$tag->id;
      }
 
      $asideForm->getField('tags')->setValue($tagIds);
    }
  }
 
  public function controllerDoBeforeSave(&$validData)
  {
    if ($this->id == $this->parentId)
    {
      $this->parentId = 0;
    }
 
    return parent::beforeSave();
  }
 
  public function beforeSave()
  {
    if (is_array($this->image))
    {
      $this->image = json_encode($this->image);
    }
 
    parent::beforeSave();
  }
 
  public function controllerDoAfterSave($validData)
  {
    $isCategory = $this->isContextSuffix('category');
    $modelsManager = $this->getModelsManager();
    $dbo = Factory::getService('db');
    $source = $this->getSource();
 
    if ($this->hasRoute && empty($this->route))
    {
      if ($this->parentId && ($parent = self::findFirst('id = ' . (int)$this->parentId)))
      {
        $route = Filter::toPath($parent->route . '/' . $this->title);
      }
      else
      {
        $prefix = $isCategory ? '' : $this->context . '/';
        $route = $prefix . Filter::toSlug($this->title);
      }
 
      // Don't use Phalcon Update or Save.
      // Because Phalcon has conflicts with array references (hasBelongsTo, hasMany...)
      $dbo->query('UPDATE `' . $source . '` SET `route` = :route WHERE `id` = :id', [
        'route' => $route,
        'id'    => (int)$this->id,
      ]);
    }
 
    $modelsManager->executeQuery(
      'DELETE FROM ' . UcmItemMap::class . ' WHERE itemId1 = :itemId1: AND context = :context:',
      [
        'itemId1' => $this->id,
        'context' => 'tag',
      ]
    );
 
    if (!empty($validData['tags']))
    {
      foreach (Filter::clean($validData['tags'], 'unique') as $tagId)
      {
        $tagId = (int)$tagId;
 
        if ($tagId > 0)
        {
          (new UcmItemMap)
            ->assign(
              [
                'itemId1' => $this->id,
                'itemId2' => $tagId,
                'context' => 'tag',
              ]
            )->save();
        }
      }
    }
 
    $context = UcmItemHelper::prepareContext($this->context);
    EventHelper::trigger('afterSaveUcm' . $context, [$this, $validData], ['Cms']);
  }
 
  public function delete() : bool
  {
    if ($result = parent::delete())
    {
      $context = UcmItemHelper::prepareContext($this->context);
      $previousData = $this->toArray();
      EventHelper::trigger('afterDeleteUcm' . $context, [$previousData], ['Cms']);
    }
 
    return $result;
  }
 
  public function hit($pk = null)
  {
    if (null === $pk)
    {
      $pk = $this->id;
    }
 
    $session = Factory::getService('session');
    $hitsKey = $this->context . '.hits';
    $hits = $session->get($hitsKey, []);
 
    if (!isset($hits[$pk]))
    {
      $hits[$pk] = 1;
      $session->set($hitsKey, $hits);
 
      /** @var Mysql $db */
      $db = $this->getDI()->get('db');
      $db->execute('UPDATE ' . $this->getSource() . ' SET hits = hits + 1 WHERE id = :id', [
        'id' => $pk,
      ]);
 
      if ($pk == $this->id)
      {
        $this->hits++;
      }
    }
 
    return $this;
  }
 
  public function t($field)
  {
    if (Uri::isClient('administrator'))
    {
      return $this->{$field};
    }
 
    static $translated = [];
    $k = $this->id . $field;
 
    if (!isset($translated[$k]))
    {
      $translationData = parent::getTranslations();
 
      if (isset($translationData[$field]))
      {
        $value = $translationData[$field];
 
        switch ($field)
        {
          case 'route':
            if (empty($value))
            {
              $value = $this->route;
            }
          break;
 
          case 'image':
            if (empty($value) || in_array($value, ['[]', '{}']))
            {
              $value = $this->image;
            }
          break;
 
          case 'params':
            $tranValue = $value;
            $value = new Registry($this->{$field});
            $value->merge($tranValue);
          break;
        }
      }
      else
      {
        $value = $this->{$field};
      }
 
      $translated[$k] = $value;
    }
 
    return $translated[$k];
  }
 
  public function getLink()
  {
    return Uri::route($this->t('route'));
  }
 
  public function summary($fallbackDescStrLen = 100)
  {
    $summary = trim($this->t('summary'));
 
    if (empty($summary))
    {
      $summary = StringHelper::truncate($this->t('description'), $fallbackDescStrLen);
    }
 
    return $summary;
  }
 
  public function vouchers()
  {
    $vouchers = [];
    if ((int)$this->parentId === 117) // Merken
    {
      $vouchers = $this->find([
        'conditions' => 'externalMerchantId = :external_merchant_id: AND sourceId = :source_id: AND externalId != :external_merchant_id:',
        'bind' => [
          'external_merchant_id' => $this->externalMerchantId,
          'source_id'            => $this->sourceId,
        ],
      ])->toArray();
 
//      $ads = Ad::find([
//        'conditions' => 'externalMerchantId = :external_merchant_id: AND sourceId = :source_id:',
//        'bind' => [
//          'external_merchant_id' => $this->externalMerchantId,
//          'source_id'            => $this->sourceId,
//        ],
//      ])->toArray();
 
//      $vouchers += $ads;
    }
 
    // Nothing found, set at least one if there is a prefUrl
    if (0 === count($vouchers) && (int)$this->parentId === 117 && 0 < strlen($this->prefUrl))
    {
      $vouchers = $this->find([
        'conditions' => 'externalId = :external_id: AND sourceId = :source_id:',
        'bind' => [
          'external_id' => $this->externalMerchantId,
          'source_id'   => $this->sourceId,
        ],
      ])->toArray();
    }
 
    if (false === empty($vouchers))
    {
      $voucherIds = array_column($vouchers, 'id', 'id');
      $vouchers = $this->find([
        'conditions' => 'id IN (' . implode(',', $voucherIds) . ')',
      ]);
    }
 
    return $vouchers;
  }
 
  public function getFieldsData()
  {
    if (empty($this->fieldsData) && $this->id)
    {
      /** @var \Phalcon\Mvc\Model\Resultset\Simple $values */
      $values = $this->getModelsManager()
        ->createBuilder()
        ->columns('name, fieldId, value')
        ->from(['fieldValue' => UcmFieldValue::class])
        ->innerJoin(UcmField::class, 'field.id = fieldValue.fieldId', 'field')
        ->where('field.context = :context:', ['context' => $this->context])
        ->andWhere('fieldValue.itemId = :thisId:', ['thisId' => $this->id])
        ->getQuery()
        ->execute();
 
      if (0 < $values->count())
      {
        $fields = [];
 
        foreach ($values as $value)
        {
          $this->fieldsData[$value->name] = $value->value;
          $fields[$value->fieldId] = $value->name;
        }
 
        if (Language::isMultilingual())
        {
          $language = Language::getLanguageQuery();
          $isSite = Uri::isClient('site');
 
          if (Uri::isClient('site') && '*' === $language)
          {
            return $this->fieldsData;
          }
 
          // Find translation fields values
          $query = $this->getModelsManager()
            ->createBuilder()
            ->from(Translation::class)
            ->columns('translationId, translatedValue')
            ->where('translationId LIKE :translationId:', [
              'translationId' => ($isSite ? $language : '%') . '.ucm_field_values.fieldId=%,itemId=' . $this->id . '%',
            ]);
 
          $trans = $query->getQuery()->execute();
 
          if ($trans->count())
          {
            foreach ($trans as $tran)
            {
              $parts = explode('.', $tran->translationId);
              $langCode = $parts[0];
              $refKey = explode(',', $parts[2], 2);
              $fieldId = str_replace('fieldId=', '', $refKey[0]);
 
              if (isset($fields[$fieldId]))
              {
                $fieldName = $fields[$fieldId];
 
                if ($isSite)
                {
                  $this->translationsFieldsData[$fieldName] = $tran->translatedValue;
                }
                else
                {
                  $this->translationsFieldsData[$fieldName][$langCode] = $tran->translatedValue;
                }
              }
            }
          }
        }
      }
    }
 
    return $this->fieldsData;
  }
 
  public function getTranslationsFieldsData()
  {
    return $this->translationsFieldsData;
  }
 
  public function getFieldValue($fieldName, $defaultValue = null)
  {
    $value = isset($this->translationsFieldsData[$fieldName])
      ? $this->translationsFieldsData[$fieldName]
      : (isset($this->fieldsData[$fieldName]) ? $this->fieldsData[$fieldName] : $defaultValue);
 
    if (strpos($value, '{') === 0 || strpos($value, '[') === 0)
    {
      $value = implode(', ', json_decode($value, true) ?: []);
    }
 
    return $value;
  }
 
  public function copy()
  {
    if ($result = parent::copy())
    {
      $fieldsValues = UcmFieldValue::find(
        [
          'conditions' => 'itemId = :itemId:',
          'bind'       => [
            'itemId' => $this->id,
          ],
        ]
      );
 
      if ($fieldsValues->count())
      {
        $values = '';
        $bind = [];
 
        foreach ($fieldsValues as $fieldsValue)
        {
          $values .= '(?, ?, ?),';
          $bind[] = $fieldsValue->fieldId;
          $bind[] = $result->id;
          $bind[] = $fieldsValue->value;
        }
 
        $source = $this->getModelsManager()->getModelPrefix() . 'ucm_field_values';
        $this->getDI()->get('db')->execute('INSERT INTO ' . $source . ' (fieldId, itemId, value) VALUES ' . rtrim($values, ','), $bind);
      }
    }
 
    return $result;
  }
 
  protected function afterDelete()
  {
    parent::afterDelete();
    $source = $this->getModelsManager()->getModelPrefix() . 'ucm_field_values';
    $this->getDI()->get('db')->execute('DELETE FROM ' . $source . ' WHERE itemId LIKE :itemId', [
      'itemId' => $this->id,
    ]);
  }
 
  public function getParams()
  {
    if (!($this->params instanceof Registry))
    {
      $this->params = new Registry($this->params);
    }
 
    return $this->params;
  }
}
#6CLSystems\PhalCMS\Lib\Mvc\Model\UcmItem->vouchers
/var/www/html/discounts-n-coupons.com/cache/volt/Tmpl_Site_PhalCMS_Post_Show.volt.php (17)
<div class="uk-container" itemscope itemtype="http://schema.org/Brand">
    <article class="uk-article">
        <div class="uk-text-center">
            <?= $this->partial('Breadcrumb/Breadcrumb') ?>
        </div>
        <h1 class="uk-article-title" itemprop="name">
            <?= html_entity_decode($post->t('title')) ?>
        </h1>
        <p class="uk-article-meta">
            <?= CLSystems\PhalCMS\Lib\Helper\Text::_('posted-in') . ' ' ?>
            <a href="<?= $post->category->link ?>">
                <?= $post->category->t('title') ?>
            </a>
            <?= ' | ' . CLSystems\PhalCMS\Lib\Helper\IconSvg::render('eye') . ' ' . CLSystems\PhalCMS\Lib\Helper\Text::plural('hits',$post->hits,['hits' => $post->hits]) ?>
        </p>
 
        <?php $vouchers = $post->vouchers(); ?>
        <?php if (!empty($vouchers)) { ?>
            <h2><?= CLSystems\PhalCMS\Lib\Helper\Text::_('discounts-at') ?> <?= $this->escaper->attributes($post->t('title')) ?></h2>
            <?= $this->partial('UcmItem/VouchersSlider') ?>
        <?php } ?>
 
        <h2><?= CLSystems\PhalCMS\Lib\Helper\Text::_('info-about') ?> <?= $this->escaper->attributes($post->t('title')) ?></h2>
 
        <?php $summary = trim($post->t('summary')); ?>
        <?php if (!empty($summary)) { ?>
            <div class="post-summary uk-text-lead uk-margin">
                <?= strip_tags(html_entity_decode($summary)) ?>
            </div>
        <?php } ?>
 
        <?php $images = CLSystems\PhalCMS\Lib\Helper\Image::loadImage($post->t('image'),false); ?>
        <?php if ($this->length($images) > 0) { ?>
            <?php if ($this->length($images) > 1) { ?>
                <div class="post-images">
                    <div class="uk-position-relative" uk-slideshow>
                        <ul class="uk-slideshow-items" uk-lightbox>
                            <?php $thumbNav = ''; ?>
                            <?php foreach ($images as $i => $image) { ?>
                                <li>
                                    <a href="<?= $image->getUri() ?>">
                                        <img data-src="<?= $image->getUri() ?>" alt="<?= $this->escaper->attributes($post->t('title')) ?>"
                                             uk-img uk-cover/>
                                    </a>
                                </li>
                                <?php $thumbNav = $thumbNav . '<li uk-slideshow-item="' . $i . '"><a href="#"><img src="' . $image->getResize(100) . '" width="100" alt=""></a></li>'; ?>
                            <?php } ?>
                        </ul>
                        <div class="uk-position-bottom-center uk-position-small">
                            <ul class="uk-thumbnav">
                                <?= $thumbNav ?>
                            </ul>
                        </div>
                    </div>
                </div>
            <?php } else { ?>
                <div class="post-image" uk-lightbox>
                    <a href="<?= $images[0]->getUri() ?>">
                        <img itemprop="logo" data-src="<?= $images[0]->getUri() ?>" alt="<?= $this->escaper->attributes($post->t('title')) ?>" uk-img/>
                    </a>
                </div>
            <?php } ?>
        <?php } ?>
 
        
        <span itemprop="description"><?= $this->partial('UcmItem/Description') ?></span>
 
    </article>
 
    
    <?= $this->partial('Comment/Comment') ?>
</div>
#7Phalcon\Mvc\View\Engine\Volt->render
#8Phalcon\Mvc\View->engineRender
#9Phalcon\Mvc\View->processRender
#10Phalcon\Mvc\View->render
#11Phalcon\Mvc\Application->handle
/var/www/html/discounts-n-coupons.com/src/app/Lib/CmsApplication.php (120)
<?php
 
namespace CLSystems\PhalCMS\Lib;
 
use Phalcon\Autoload\Loader;
use Phalcon\Http\Response;
use Phalcon\Events\Event;
use Phalcon\Mvc\Application;
use Phalcon\Mvc\Dispatcher;
use Phalcon\Mvc\View;
use CLSystems\PhalCMS\Lib\Helper\Asset;
use CLSystems\PhalCMS\Lib\Helper\Config;
use CLSystems\PhalCMS\Lib\Helper\Uri;
use CLSystems\PhalCMS\Lib\Helper\State;
use CLSystems\PhalCMS\Lib\Helper\User;
use CLSystems\PhalCMS\Lib\Helper\Event as EventHelper;
use CLSystems\PhalCMS\Lib\Mvc\View\ViewBase;
use CLSystems\Php\Registry;
use MatthiasMullie\Minify;
use Exception;
 
class CmsApplication extends Application
{
    public function execute()
    {
        try {
            $eventsManager = $this->di->getShared('eventsManager');
            $eventsManager->attach('application:beforeSendResponse', $this);
            $plugins = EventHelper::getPlugins();
            $systemEvents = [
                'application:beforeSendResponse',
                'dispatch:beforeExecuteRoute',
                'dispatch:beforeException',
                'dispatch:beforeDispatch',
                'dispatch:afterDispatch',
                'dispatch:afterInitialize',
            ];
 
            if(false === empty($plugins['System']))
      {
        foreach ($plugins['System'] as $className => $config) {
          $handler = EventHelper::getHandler($className, $config);
 
          foreach ($systemEvents as $systemEvent) {
            $eventsManager->attach($systemEvent, $handler);
          }
        }
      }
 
            // Update view dirs
            define('TPL_SITE_PATH', APP_PATH . '/Tmpl/Site/' . Config::get('siteTemplate', 'PhalCMS'));
            define('TPL_ADMINISTRATOR_PATH', APP_PATH . '/Tmpl/Administrator');
            define('TPL_SYSTEM_PATH', APP_PATH . '/Tmpl/System');
 
            if (Uri::isClient('site')) {
                $viewDirs = [
                    TPL_SITE_PATH . '/Tmpl/',
                    TPL_SITE_PATH . '/',
                ];
            } else {
                $viewDirs = [
                    TPL_ADMINISTRATOR_PATH . '/',
                ];
            }
 
            foreach (['System', 'Cms'] as $plgGroup) {
                if (isset($plugins[$plgGroup])) {
                    /**
                     * @var string $pluginClass
                     * @var Registry $pluginConfig
                     */
 
 
                    foreach ($plugins[$plgGroup] as $pluginClass => $pluginConfig) {
                        $pluginName = $pluginConfig->get('manifest.name');
                        $pluginPath = PLUGIN_PATH . '/' . $plgGroup . '/' . $pluginName;
                        $psrPaths = [];
 
                        if (is_dir($pluginPath . '/Tmpl')) {
                            $viewDirs[] = $pluginPath . '/Tmpl/';
                        }
 
                        if (is_dir($pluginPath . '/Lib')) {
                            $psrPaths['CLSystems\\PhalCMS\\Lib'] = $pluginPath . '/Lib';
                        }
 
                        if (is_dir($pluginPath . '/Widget')) {
                            $psrPaths['CLSystems\\PhalCMS\\Widget'] = $pluginPath . '/Widget';
                        }
 
                        if ($psrPaths) {
                            (new Loader)
                                ->setNamespaces($psrPaths, true)
                                ->register();
                        }
                    }
                }
            }
 
            $viewDirs[] = TPL_SYSTEM_PATH . '/';
 
            /** @var ViewBase $view */
            $view = $this->di->getShared('view');
            $requestUri = $_SERVER['REQUEST_URI'];
 
            if (Config::get('siteOffline') === 'Y'
                && !User::getInstance()->access('super')
            ) {
                $this->view->setMainView('Offline/Index');
 
                if (!str_starts_with($requestUri, '/user/')) {
                    $requestUri = '';
                }
            } else {
                $view->setMainView('Index');
            }
 
            $view->setViewsDir($viewDirs);
            $this->setEventsManager($eventsManager);
            $this->handle($requestUri)->send();
        } catch (Exception $e) {
            if (true === DEVELOPMENT_MODE) {
                // Let Phalcon Debug catch this
                throw $e;
            }
 
            try {
                if (User::getInstance()->access('super')) {
                    State::setMark('exception', $e);
                }
 
                /**
                 * @var Dispatcher $dispatcher
                 * @var View $view
                 */
                $dispatcher = $this->getDI()->getShared('dispatcher');
                $dispatcher->setControllerName(Uri::isClient('administrator') ? 'admin_error' : 'error');
                $dispatcher->setActionName('show');
                $dispatcher->setParams(
                    [
                        'code'    => $e->getCode(),
                        'message' => $e->getMessage(),
                    ]
                );
 
                $view = $this->getDI()->getShared('view');
                $view->start();
                $dispatcher->dispatch();
                $view->render(
                    $dispatcher->getControllerName(),
                    $dispatcher->getActionName(),
                    $dispatcher->getParams()
                );
                $view->finish();
                echo $view->getContent();
            } catch (Exception $e2) {
                debugVar($e2->getMessage());
            }
        }
    }
 
    protected function getCompressor($type)
    {
        if ('css' === $type) {
            $compressor = new Minify\CSS;
            $compressor->setImportExtensions(
                [
                    'gif' => 'data:image/gif',
                    'jpg' => 'data:image/jpg',
                    'png' => 'data:image/png',
                    'svg' => 'data:image/svg+xml',
                ]
            );
        } else {
            $compressor = new Minify\JS;
        }
 
        return $compressor;
    }
 
    protected function compressAssets()
    {
        $basePath = PUBLIC_PATH . '/assets';
        $assets = Factory::getService('assets');
 
        foreach (Asset::getFiles() as $type => $files) {
            $fileName = md5(implode(':', $files)) . '.' . $type;
            $filePath = $basePath . '/compressed/' . $fileName;
            $fileUri = DOMAIN . '/assets/compressed/' . $fileName . (DEVELOPMENT_MODE ? '?' . time() : '');
            $hasAsset = is_file($filePath);
            $ucType = ucfirst($type);
            $addFunc = 'add' . $ucType;
 
            if ($hasAsset && !DEVELOPMENT_MODE) {
                call_user_func_array([$assets, $addFunc], [$fileUri, false]);
                continue;
            }
 
            $compressor = self::getCompressor($type);
 
            foreach ($files as $file) {
                $compressor->add($file);
            }
 
            if (!is_dir($basePath . '/compressed/')) {
                mkdir($basePath . '/compressed/', 0777, true);
            }
 
            if ($compressor->minify($filePath)) {
                chmod($filePath, 0777);
                call_user_func_array([$assets, $addFunc], [$fileUri, false]);
            }
 
            unset($compressor);
        }
    }
 
    public function beforeSendResponse(Event $event, CmsApplication $app, Response $response)
    {
        $request = $this->di->getShared('request');
 
        if ($request->isAjax()) {
            return;
        }
 
        /** @var Asset $assets */
        $this->compressAssets();
        $assets = $this->di->getShared('assets');
 
        // Compress CSS
        ob_start();
        $assets->outputCss();
        $assets->outputInlineCss();
        $content = str_replace('</head>', ob_get_clean() . '</head>', $response->getContent());
 
        // Compress JS
        ob_start();
        $assets->outputJs();
        $assets->outputInlineJs();
        $code = Asset::getCode() . ob_get_clean();
 
        // Extra code (in the footer)
        $content = str_replace('</body>', $code . '</body>', $content);
        $response->setContent($content);
    }
}
#12CLSystems\PhalCMS\Lib\CmsApplication->execute
/var/www/html/discounts-n-coupons.com/public/index.php (14)
<?php
declare(strict_types=1);
 
error_reporting(E_ALL);
ini_set('display_errors', 'true');
 
use CLSystems\PhalCMS\Lib\Factory;
 
define('BASE_PATH', dirname(__DIR__));
 
require_once BASE_PATH . '/src/app/Lib/Factory.php';
 
// Execute application
Factory::getApplication()->execute();
KeyValue
_url/brands/linking-news
KeyValue
PATH/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
TEMP/var/www/clients/client1/web1/tmp
TMPDIR/var/www/clients/client1/web1/tmp
TMP/var/www/clients/client1/web1/tmp
HOSTNAME
USERweb1
HOME/var/www/clients/client1/web1
SCRIPT_NAME/index.php
REQUEST_URI/brands/linking-news
QUERY_STRING_url=/brands/linking-news
REQUEST_METHODGET
SERVER_PROTOCOLHTTP/1.1
GATEWAY_INTERFACECGI/1.1
REDIRECT_QUERY_STRING_url=/brands/linking-news
REDIRECT_URL/brands/linking-news
REMOTE_PORT37916
SCRIPT_FILENAME/var/www/clients/client1/web1/web/index.php
SERVER_ADMINwebmaster@discounts-n-coupons.com
CONTEXT_DOCUMENT_ROOT/var/www/clients/client1/web1/web
CONTEXT_PREFIX
REQUEST_SCHEMEhttps
DOCUMENT_ROOT/var/www/clients/client1/web1/web
REMOTE_ADDR44.200.145.223
SERVER_PORT443
SERVER_ADDR207.244.255.14
SERVER_NAMEdiscounts-n-coupons.com
SERVER_SOFTWAREApache
SERVER_SIGNATURE
HTTP_CONNECTIONKeep-Alive
HTTP_HOSTdiscounts-n-coupons.com
HTTP_ACCEPT_ENCODINGbr,gzip
HTTP_ACCEPT_LANGUAGEen-US,en;q=0.5
HTTP_ACCEPTtext/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_USER_AGENTCCBot/2.0 (https://commoncrawl.org/faq/)
proxy-nokeepalive1
SSL_TLS_SNIdiscounts-n-coupons.com
HTTPSon
REDIRECT_STATUS200
REDIRECT_SSL_TLS_SNIdiscounts-n-coupons.com
REDIRECT_HTTPSon
FCGI_ROLERESPONDER
PHP_SELF/index.php
REQUEST_TIME_FLOAT1685650084.6872
REQUEST_TIME1685650084
#Path
0/var/www/html/discounts-n-coupons.com/public/index.php
1/var/www/html/discounts-n-coupons.com/src/app/Lib/Factory.php
2/var/www/html/discounts-n-coupons.com/src/app/Config/Define.php
3/var/www/html/discounts-n-coupons.com/src/app/Config/Loader.php
4/var/www/html/discounts-n-coupons.com/vendor/autoload.php
5/var/www/html/discounts-n-coupons.com/vendor/composer/autoload_real.php
6/var/www/html/discounts-n-coupons.com/vendor/composer/platform_check.php
7/var/www/html/discounts-n-coupons.com/vendor/composer/ClassLoader.php
8/var/www/html/discounts-n-coupons.com/vendor/composer/autoload_static.php
9/var/www/html/discounts-n-coupons.com/vendor/phpunit/phpunit/src/Framework/Assert/Functions.php
10/var/www/html/discounts-n-coupons.com/vendor/symfony/polyfill-mbstring/bootstrap.php
11/var/www/html/discounts-n-coupons.com/vendor/symfony/polyfill-mbstring/bootstrap80.php
12/var/www/html/discounts-n-coupons.com/vendor/symfony/deprecation-contracts/function.php
13/var/www/html/discounts-n-coupons.com/vendor/ralouphie/getallheaders/src/getallheaders.php
14/var/www/html/discounts-n-coupons.com/vendor/symfony/polyfill-ctype/bootstrap.php
15/var/www/html/discounts-n-coupons.com/vendor/symfony/polyfill-ctype/bootstrap80.php
16/var/www/html/discounts-n-coupons.com/vendor/guzzlehttp/promises/src/functions_include.php
17/var/www/html/discounts-n-coupons.com/vendor/guzzlehttp/promises/src/functions.php
18/var/www/html/discounts-n-coupons.com/vendor/symfony/polyfill-intl-normalizer/bootstrap.php
19/var/www/html/discounts-n-coupons.com/vendor/symfony/polyfill-intl-normalizer/bootstrap80.php
20/var/www/html/discounts-n-coupons.com/vendor/symfony/polyfill-intl-grapheme/bootstrap.php
21/var/www/html/discounts-n-coupons.com/vendor/symfony/string/Resources/functions.php
22/var/www/html/discounts-n-coupons.com/vendor/guzzlehttp/guzzle/src/functions_include.php
23/var/www/html/discounts-n-coupons.com/vendor/guzzlehttp/guzzle/src/functions.php
24/var/www/html/discounts-n-coupons.com/vendor/symfony/var-dumper/Resources/functions/dump.php
25/var/www/html/discounts-n-coupons.com/vendor/phpseclib/phpseclib/phpseclib/bootstrap.php
26/var/www/html/discounts-n-coupons.com/vendor/psy/psysh/src/functions.php
27/var/www/html/discounts-n-coupons.com/vendor/myclabs/deep-copy/src/DeepCopy/deep_copy.php
28/var/www/html/discounts-n-coupons.com/vendor/google/apiclient-services/autoload.php
29/var/www/html/discounts-n-coupons.com/vendor/codeception/codeception/functions.php
30/var/www/html/discounts-n-coupons.com/vendor/google/apiclient/src/aliases.php
31/var/www/html/discounts-n-coupons.com/vendor/google/apiclient/src/Client.php
32/var/www/html/discounts-n-coupons.com/vendor/google/apiclient/src/Service.php
33/var/www/html/discounts-n-coupons.com/vendor/google/apiclient/src/AccessToken/Revoke.php
34/var/www/html/discounts-n-coupons.com/vendor/google/apiclient/src/AccessToken/Verify.php
35/var/www/html/discounts-n-coupons.com/vendor/google/apiclient/src/Model.php
36/var/www/html/discounts-n-coupons.com/vendor/google/apiclient/src/Utils/UriTemplate.php
37/var/www/html/discounts-n-coupons.com/vendor/google/apiclient/src/AuthHandler/Guzzle6AuthHandler.php
38/var/www/html/discounts-n-coupons.com/vendor/google/apiclient/src/AuthHandler/Guzzle7AuthHandler.php
39/var/www/html/discounts-n-coupons.com/vendor/google/apiclient/src/AuthHandler/Guzzle5AuthHandler.php
40/var/www/html/discounts-n-coupons.com/vendor/google/apiclient/src/AuthHandler/AuthHandlerFactory.php
41/var/www/html/discounts-n-coupons.com/vendor/google/apiclient/src/Http/Batch.php
42/var/www/html/discounts-n-coupons.com/vendor/google/apiclient/src/Http/MediaFileUpload.php
43/var/www/html/discounts-n-coupons.com/vendor/google/apiclient/src/Http/REST.php
44/var/www/html/discounts-n-coupons.com/vendor/google/apiclient/src/Task/Retryable.php
45/var/www/html/discounts-n-coupons.com/vendor/google/apiclient/src/Task/Exception.php
46/var/www/html/discounts-n-coupons.com/vendor/google/apiclient/src/Exception.php
47/var/www/html/discounts-n-coupons.com/vendor/google/apiclient/src/Task/Runner.php
48/var/www/html/discounts-n-coupons.com/vendor/google/apiclient/src/Collection.php
49/var/www/html/discounts-n-coupons.com/vendor/google/apiclient/src/Service/Exception.php
50/var/www/html/discounts-n-coupons.com/vendor/google/apiclient/src/Service/Resource.php
51/var/www/html/discounts-n-coupons.com/vendor/google/apiclient/src/Task/Composer.php
52/var/www/html/discounts-n-coupons.com/vendor/phalcon/dd/src/helper.php
53/var/www/html/discounts-n-coupons.com/vendor/clsystems/php-registry/src/Registry.php
54/var/www/html/discounts-n-coupons.com/src/app/Lib/Helper/Config.php
55/var/www/html/discounts-n-coupons.com/src/app/Lib/Helper/Asset.php
56/var/www/html/discounts-n-coupons.com/src/app/Lib/Mvc/View/ViewBase.php
57/var/www/html/discounts-n-coupons.com/src/app/Lib/Helper/Volt.php
58/var/www/html/discounts-n-coupons.com/src/app/Lib/CmsApplication.php
59/var/www/html/discounts-n-coupons.com/src/app/Lib/Helper/Language.php
60/var/www/html/discounts-n-coupons.com/src/app/Lib/Helper/FileSystem.php
61/var/www/html/discounts-n-coupons.com/src/app/Language/de-DE/Locale.php
62/var/www/html/discounts-n-coupons.com/src/app/Language/en-GB/Locale.php
63/var/www/html/discounts-n-coupons.com/src/app/Language/nl-NL/Locale.php
64/var/www/html/discounts-n-coupons.com/src/app/Lib/Helper/Uri.php
65/var/www/html/discounts-n-coupons.com/src/app/Language/en-GB/en-GB.php
66/var/www/html/discounts-n-coupons.com/src/app/Lib/Helper/Event.php
67/var/www/html/discounts-n-coupons.com/src/app/Lib/Mvc/Model/Config.php
68/var/www/html/discounts-n-coupons.com/src/app/Lib/Mvc/Model/ModelBase.php
69/var/www/html/discounts-n-coupons.com/src/app/Plugin/Cms/SiteMap/SiteMap.php
70/var/www/html/discounts-n-coupons.com/src/app/Lib/Plugin.php
71/var/www/html/discounts-n-coupons.com/src/app/Plugin/Cms/SiteMap/Language/en-GB.php
72/var/www/html/discounts-n-coupons.com/src/app/Plugin/Cms/SocialLogin/SocialLogin.php
73/var/www/html/discounts-n-coupons.com/src/app/Plugin/System/Backup/Backup.php
74/var/www/html/discounts-n-coupons.com/src/app/Plugin/System/Backup/Language/en-GB.php
75/var/www/html/discounts-n-coupons.com/src/app/Plugin/System/Cms/Cms.php
76/var/www/html/discounts-n-coupons.com/src/app/Config/Router.php
77/var/www/html/discounts-n-coupons.com/src/app/Config/Router/Site.php
78/var/www/html/discounts-n-coupons.com/src/app/Lib/Mvc/Controller/DisplayController.php
79/var/www/html/discounts-n-coupons.com/src/app/Lib/Mvc/Controller/ControllerBase.php
80/var/www/html/discounts-n-coupons.com/src/app/Lib/Helper/User.php
81/var/www/html/discounts-n-coupons.com/src/app/Lib/Helper/State.php
82/var/www/html/discounts-n-coupons.com/src/app/Lib/Mvc/Model/User.php
83/var/www/html/discounts-n-coupons.com/src/app/Lib/Mvc/Model/UcmItem.php
84/var/www/html/discounts-n-coupons.com/src/app/Lib/Helper/UcmItem.php
85/var/www/html/discounts-n-coupons.com/src/app/Lib/Mvc/Model/Post.php
86/var/www/html/discounts-n-coupons.com/src/app/Lib/Helper/Text.php
87/var/www/html/discounts-n-coupons.com/src/app/Lib/Mvc/Model/PostCategory.php
88/var/www/html/discounts-n-coupons.com/src/app/Lib/Mvc/Model/Nested.php
89/var/www/html/discounts-n-coupons.com/cache/volt/Tmpl_Site_PhalCMS_Post_Show.volt.php
90/var/www/html/discounts-n-coupons.com/cache/volt/Tmpl_System_Breadcrumb_Breadcrumb.volt.php
91/var/www/html/discounts-n-coupons.com/src/app/Lib/Helper/IconSvg.php
Memory
Usage2097152