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.
$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
);
}
$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();
// CRM-7163 hack: we don’t display langSwitch on upgrades anyway
if (!CRM_Core_Config::isUpgradeMode()) {
- $this->assign('langSwitch', CRM_Core_I18n::languages(TRUE));
+ $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());
array_unshift($this->template_dir, $path);
}
else {
- $this->template_dir = array($path, $this->template_dir);
+ $this->template_dir = [$path, $this->template_dir];
}
}
*/
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;
}
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);
+ }
+
}