Skip to content

Commit

Permalink
move smarty constants out of exponent_constants.php to allow for bett…
Browse files Browse the repository at this point in the history
…er debugging
  • Loading branch information
dleffler committed Jun 24, 2021
1 parent c65758a commit f708c7c
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 24 deletions.
2 changes: 1 addition & 1 deletion exponent_constants.php
Expand Up @@ -613,7 +613,7 @@
define('SMARTY_VERSION', '3.1.39'); //note smarty v3.1.28+ won't work properly with php < v7.1+
}
define('SMARTY_PATH', BASE . 'external/smarty-' . SMARTY_VERSION . '/libs/');
define('SMARTY_DEVELOPMENT', false);
// define('SMARTY_DEVELOPMENT', false);
}

/**
Expand Down
2 changes: 2 additions & 0 deletions framework/conf/extensions/maint.defaults.php
Expand Up @@ -23,6 +23,8 @@
if (!defined('MAINTENANCE_RETURN_TIME')) define('MAINTENANCE_RETURN_TIME','0');

if (!defined('DEVELOPMENT')) define('DEVELOPMENT','0');
if (!defined('SMARTY_DEVELOPMENT')) define('SMARTY_DEVELOPMENT','0');
if (!defined('SMARTY_CACHING')) define('SMARTY_CACHING','0');
if (!defined('LOGGER')) define('LOGGER','0');
if (!defined('DEBUG_HISTORY')) define('DEBUG_HISTORY','0');
if (!defined('UPLOAD_LOGGER')) define('UPLOAD_LOGGER','0');
Expand Down
8 changes: 5 additions & 3 deletions framework/core/forms/basetemplate.php
Expand Up @@ -60,8 +60,10 @@ function __construct($item_type, $item_dir, $view = "Default")

$this->tpl->php_handling = SMARTY::PHP_REMOVE;

$this->tpl->setCaching(Smarty::CACHING_OFF);
// $this->tpl->setCaching(Smarty::CACHING_LIFETIME_CURRENT);
if (SMARTY_CACHING)
$this->tpl->setCaching(Smarty::CACHING_LIFETIME_CURRENT);
else
$this->tpl->setCaching(Smarty::CACHING_OFF);
$this->tpl->setCacheDir(BASE . 'tmp/cache');
$this->tpl->cache_id = md5($this->viewfile);

Expand Down Expand Up @@ -112,7 +114,7 @@ function __construct($item_type, $item_dir, $view = "Default")
BASE.'framework/plugins',
SMARTY_PATH.'plugins',
));
} elseif (framework() == 'jquery') {
} elseif (framework() === 'jquery') {
$this->tpl->setPluginsDir(array(
BASE.'themes/'.DISPLAY_THEME.'/plugins',
BASE.'framework/plugins/jquery',
Expand Down
12 changes: 7 additions & 5 deletions framework/core/forms/controllertemplate.php
Expand Up @@ -39,8 +39,10 @@ function __construct($controller, $viewfile) {

$this->tpl->php_handling = SMARTY::PHP_REMOVE;

$this->tpl->setCaching(Smarty::CACHING_OFF);
// $this->tpl->setCaching(Smarty::CACHING_LIFETIME_CURRENT);
if (SMARTY_CACHING)
$this->tpl->setCaching(Smarty::CACHING_LIFETIME_CURRENT);
else
$this->tpl->setCaching(Smarty::CACHING_OFF);
$this->tpl->setCacheDir(BASE.'tmp/cache');
$this->tpl->cache_id = md5($this->viewfile);

Expand Down Expand Up @@ -91,7 +93,7 @@ function __construct($controller, $viewfile) {
BASE.'framework/plugins',
SMARTY_PATH.'plugins',
));
} elseif (framework() == 'jquery') {
} elseif (framework() === 'jquery') {
$this->tpl->setPluginsDir(array(
BASE.'themes/'.DISPLAY_THEME.'/plugins',
BASE.'framework/plugins/jquery',
Expand All @@ -116,7 +118,7 @@ function __construct($controller, $viewfile) {
$this->module = $controller->baseclassname;

// strip file type
if (substr($viewfile, -7) == '.config') {
if (substr($viewfile, -7) === '.config') {
$this->file_is_a_config = true;
$this->view = substr(basename($this->viewfile),0,-7);
} else $this->view = substr(basename($this->viewfile),0,-4);
Expand All @@ -132,7 +134,7 @@ function __construct($controller, $viewfile) {
$this->tpl->assign("__loc",$controller->loc);
$this->tpl->assign("__name", $controller->baseclassname); //FIXME probably not used in 2.0?
$this->tpl->assign("controller", $controller->baseclassname);
if ($controller->baseclassname != 'common') {
if ($controller->baseclassname !== 'common') {
$this->tpl->assign("asset_path", $controller->asset_path);
$this->tpl->assign("model_name", $controller->basemodel_name);
$this->tpl->assign("model_table", $controller->model_table);
Expand Down
30 changes: 15 additions & 15 deletions framework/core/forms/form.php
Expand Up @@ -100,7 +100,7 @@ function register($name, $label, $control, $replace=true, $params=null) {
* @return boolean Returns true if the Control was unregistered.
*/
function unregister($name) {
if (in_array($name,$this->controlIdx)) {
if (in_array($name, $this->controlIdx)) {
$control = $this->controls[$name];
unset(
$this->controls[$name],
Expand All @@ -112,8 +112,8 @@ function unregister($name) {

// Regenerate indices
$this->controlIdx = array();
foreach ($tmp as $name=>$rank) {
$this->controlIdx[] = $name;
foreach ($tmp as $name2=>$rank) {
$this->controlIdx[] = $name2;
}
if (method_exists($control,'onUnRegister'))
$control->onUnregister($this);
Expand Down Expand Up @@ -141,8 +141,8 @@ function registerAfter($afterName, $name, $label, $control, $params=null) {
if ($this->horizontal)
$control->horizontal = true;
if (!empty($params)) {
foreach ($params as $name => $value) {
$control->$name = $value;
foreach ($params as $name2 => $value) {
$control->$name2 = $value;
}
}
$this->controls[$name] = $control;
Expand Down Expand Up @@ -180,8 +180,8 @@ function registerBefore($beforeName, $name, $label, $control, $params=null) {
if ($this->horizontal)
$control->horizontal = true;
if (!empty($params)) {
foreach ($params as $name => $value) {
$control->$name = $value;
foreach ($params as $name2 => $value) {
$control->$name2 = $value;
}
}
$this->controls[$name] = $control;
Expand Down Expand Up @@ -243,9 +243,9 @@ function toHTML($form_id = null) {
"corecss"=>"forms-bootstrap"
));
$btn_class = 'btn btn-primary';
if (BTN_SIZE == 'large') {
if (BTN_SIZE === 'large') {
$btn_size = ''; // actually default size, NOT true bootstrap large
} elseif (BTN_SIZE == 'small') {
} elseif (BTN_SIZE === 'small') {
$btn_size = 'btn-mini';
} else { // medium
$btn_size = 'btn-small';
Expand All @@ -258,11 +258,11 @@ function toHTML($form_id = null) {
"corecss"=>"forms-bootstrap3"
));
$btn_class = 'btn btn-primary';
if (BTN_SIZE == 'large') {
if (BTN_SIZE === 'large') {
$btn_size = 'btn-lg';
} elseif (BTN_SIZE == 'small') {
} elseif (BTN_SIZE === 'small') {
$btn_size = 'btn-sm';
} elseif (BTN_SIZE == 'extrasmall') {
} elseif (BTN_SIZE === 'extrasmall') {
$btn_size = 'btn-xs';
} else { // medium
$btn_size = '';
Expand All @@ -281,11 +281,11 @@ function toHTML($form_id = null) {
));
}
$btn_class = 'btn btn-primary';
if (BTN_SIZE == 'large') {
if (BTN_SIZE === 'large') {
$btn_size = 'btn-lg';
} elseif (BTN_SIZE == 'small') {
} elseif (BTN_SIZE === 'small') {
$btn_size = 'btn-sm';
} elseif (BTN_SIZE == 'extrasmall') {
} elseif (BTN_SIZE === 'extrasmall') {
$btn_size = 'btn-sm';
} else { // medium
$btn_size = '';
Expand Down

0 comments on commit f708c7c

Please sign in to comment.