X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FSmarty.php;h=bef5152c5770252d70a6d770d9e0591e5ae9a0a8;hb=0ec0ade49afd3efe02790123546e0084a59afe8e;hp=25615fc8a93736bbc77fdbc06e72a83b65783b01;hpb=558bcc42deda03e8e059c97a1007d5e1deaa2bd4;p=civicrm-core.git diff --git a/CRM/Core/Smarty.php b/CRM/Core/Smarty.php index 25615fc8a9..bef5152c57 100644 --- a/CRM/Core/Smarty.php +++ b/CRM/Core/Smarty.php @@ -73,9 +73,13 @@ class CRM_Core_Smarty extends Smarty { static private $_singleton = NULL; /** - * @var array (string $name => mixed $value) a list of variables ot save temporarily + * Backup frames. + * + * A list of variables ot save temporarily in format (string $name => mixed $value). + * + * @var array */ - private $backupFrames = array(); + private $backupFrames = []; /** * Class constructor. @@ -90,7 +94,7 @@ class CRM_Core_Smarty extends Smarty { $config = CRM_Core_Config::singleton(); if (isset($config->customTemplateDir) && $config->customTemplateDir) { - $this->template_dir = array_merge(array($config->customTemplateDir), + $this->template_dir = array_merge([$config->customTemplateDir], $config->templateDir ); } @@ -134,12 +138,14 @@ class CRM_Core_Smarty extends Smarty { $pluginsDir = __DIR__ . DIRECTORY_SEPARATOR . 'Smarty' . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR; if ($customPluginsDir) { - $this->plugins_dir = array($customPluginsDir, $smartyDir . 'plugins', $pluginsDir); + $this->plugins_dir = [$customPluginsDir, $smartyDir . 'plugins', $pluginsDir]; } else { - $this->plugins_dir = array($smartyDir . 'plugins', $pluginsDir); + $this->plugins_dir = [$smartyDir . 'plugins', $pluginsDir]; } + $this->compile_check = $this->isCheckSmartyIsCompiled(); + // add the session and the config here $session = CRM_Core_Session::singleton(); @@ -154,7 +160,7 @@ class CRM_Core_Smarty extends Smarty { $this->assign('langSwitch', CRM_Core_I18n::uiLanguages()); } - $this->register_function('crmURL', array('CRM_Utils_System', 'crmURL')); + $this->register_function('crmURL', ['CRM_Utils_System', 'crmURL']); $this->load_filter('pre', 'resetExtScope'); $this->assign('crmPermissions', new CRM_Core_Smarty_Permissions()); @@ -259,7 +265,7 @@ class CRM_Core_Smarty extends Smarty { array_unshift($this->template_dir, $path); } else { - $this->template_dir = array($path, $this->template_dir); + $this->template_dir = [$path, $this->template_dir]; } } @@ -283,7 +289,7 @@ class CRM_Core_Smarty extends Smarty { */ public function pushScope($vars) { $oldVars = $this->get_template_vars(); - $backupFrame = array(); + $backupFrame = []; foreach ($vars as $key => $value) { $backupFrame[$key] = isset($oldVars[$key]) ? $oldVars[$key] : NULL; } @@ -336,4 +342,14 @@ class CRM_Core_Smarty extends Smarty { return 'en_US'; } + /** + * Get the compile_check value. + * + * @return bool + */ + private function isCheckSmartyIsCompiled() { + // check for define in civicrm.settings.php as FALSE, otherwise returns TRUE + return CRM_Utils_Constant::value('CIVICRM_TEMPLATE_COMPILE_CHECK', TRUE); + } + }