protected function _init($key, $reset = false) { if (!is_array($this->{$key}) || $reset) { $this->{$key} = array(); if (!$reset && !empty($GLOBALS['config']['header'][$key])) { $this->{$key} = StringHelper::mixedToArray($GLOBALS['config']['header'][$key]); } } }
public function addAppReferrer($params = NULL) { $fc = FrontController::getInstance(); if (!empty($params)) { $params = StringHelper::mixedToArray($params); $arr = array(); foreach ($params as $p) { if (array_key_exists($p, $fc->request)) { $arr[$p] = $fc->request[$p]; } } $this->addReferrer($fc->thisUrl($arr)); } else { $this->addReferrer($fc->thisUrl()); } }
/** * check data before submitting */ public function check($fields = '') { if (empty($this->data)) { return false; } $arr = StringHelper::mixedToArray($fields); $ok = true; if (count($arr)) { foreach ($arr as $key) { if (empty($this->data[$key])) { $this->_error[$key] = 'compulsory_field'; $ok = false; } } } return $ok; }
/** * reset a session variable */ public function cleanSessionVariable($keys) { $keys = StringHelper::mixedToArray($keys); foreach ($keys as $key) { if (isset($_SESSION['appVariables'][$key])) { unset($_SESSION['appVariables'][$key]); } } }