public function charger() { // La variable n'existe pas ? La créer en y affectant la valeur par defaut if (!parent::charger($this->nom)) { $this->valeur = $this->defaut; $this->protege = 1; $this->cache = 1; $this->add(); } }
/** * Appeler dans les fichiers: ./tinymce4_admin_title.php ; ./filemanager/config.php * @return array * @see extract() */ public static function pre_config() { if (!isset($_SESSION['util'], $_SESSION[self::MODULE])) { die('ERROR 403'); } $urlsite = new Variable(); $urlsite->charger('urlsite'); $baseurl = rtrim('/' . preg_replace('/https?:\\/\\/[^\\/]+\\/?/', '', $urlsite->valeur), '/') . '/'; $style_chem = new Variable(); $style_chem->charger('style_chem'); return array('thelia_path' => '../client/plugins/' . self::MODULE . '/', 'thelia_urlsite' => $urlsite->valeur, 'thelia_baseurl' => $baseurl, 'thelia_utilisateur' => 'client/gfx/utilisateur/', 'thelia_styles' => $urlsite->valeur && $style_chem->valeur ? $urlsite->valeur . $style_chem->valeur : ''); }
private function maj_variable($nom, $valeur) { $variable = new Variable(); if ($variable->charger($nom)) { $variable->valeur = $valeur; $variable->maj(); } else { $variable->nom = $nom; $variable->valeur = $valeur; $variable->protege = 1; $variable->cache = 1; $variable->add(); } }
public static function ecrire($nom, $valeur, $creer_si_inexistante = false, $protege = 1, $cache = 1) { $var = new Variable($nom); if ($creer_si_inexistante && !$var->charger($nom)) { $var->nom = $nom; $var->valeur = $valeur; $var->protege = $protege; $var->cache = $cache; $var->add(); } else { $var->valeur = $valeur; $var->maj(); } }