'key', 'key' => 'longstring', 'value' => 'longstring', ); /** * Get all configurations from database OR session if it was yet loaded * This function is called at start of program and global var '$conf' is filled with response, so use global $conf instead of call this function. * #### Example * ```php * $confs = Configuration::getAll(); * var_dump($confs); * ```. * @return array Array of configurations */ public function getAll() { if (!isset($_SESSION['configuration'])) { $configurationManager = new self(); $configs = $configurationManager->loadAll(); $confTab = array(); foreach ($configs as $config) { $this->confTab[$config->key] = decrypt($config->value); } $_SESSION['configuration'] = serialize($this->confTab); } else { $this->confTab = unserialize($_SESSION['configuration']); } } //Définit / récupere un set de configurations générique public static function setting($name,$settings=null){ if(!isset($settings)) return isset($GLOBALS['setting'][$name]) ? $GLOBALS['setting'][$name] : array(); $GLOBALS['setting'][$name] = $settings; } //Met en page (tableau html) un set de configuration générique public static function html($name){ global $conf; $options = isset($GLOBALS['setting'][$name]) ? $GLOBALS['setting'][$name] : array(); ?>
- | get($key); $attributes['value'] = 'value="'.(isset($infos['default']) && empty($confValue) ? htmlentities($infos['default']) : htmlentities($confValue)).'"'; if(isset($infos['parameters'])){ foreach($infos['parameters'] as $attribute=>$parameter){ if(isset($attributes[$attribute])) continue; $attributes[$attribute] = $attribute.'="'.$parameter.'"'; } } switch($infos['type']){ case 'password': $attributes['type'] = 'data-type="password"'; $input = ''; break; case 'dictionnary': $attributes['type'] = 'data-type="dictionnary"'; $attributes['parameters'] = 'data-slug="'.$infos['slug'].'"'; $input = ' |
---|