4 * Plugin générique de configuration pour SPIP
10 * @copyright (c) toggg, marcimat 2007-2008
11 * @link http://www.spip-contrib.net/
12 * @version $Id: meta.php 36744 2010-03-29 02:31:19Z gilles.vincent@gmail.com $
15 if (!defined("_ECRIRE_INC_VERSION")) return;
18 * Retrouve et met a jour les donnees a plat dans spip_meta
25 * Les champs manipulés
28 var $champs = array();
31 * Si on passe par cfg_id, ça fait..
32 * Heu.. Quelque chose d'utile ?
35 var $champs_id = array();
38 * Les valeurs en dépôt
44 * Les différents paramètres : Tables, Colonnes, cfg_id, et Casier
50 * Pour gestion de l'affichage en succès ou échec
53 var $messages = array('message_ok'=>array(), 'message_erreur'=>array(), 'erreurs'=>array());
63 * @param Array $params
65 function cfg_depot_meta($params=array())
67 foreach ($params as $o=>$v) {
74 * recuperer les valeurs.
76 * unserialize : si la valeur est deserialisable, elle est retournee deserialisee
77 * permet a #CONFIG d'obtenir une valeur non deserialisee...
79 * @param boolean $unserialize
82 function lire($unserialize=true)
86 foreach ($this->champs
as $name => $def) {
87 // pour compat cfg, si la meta est deserialisable, la retourner deserialisee
88 if ($unserialize && ($a = @unserialize
($GLOBALS['meta'][$name])))
91 $val[$name] = $GLOBALS['meta'][$name];
94 // si pas d'argument, retourner comme le core serialize($GLOBALS['meta'])
96 $val = serialize($GLOBALS['meta']);
98 return array(true, $val);
103 * ecrit chaque enregistrement de meta pour chaque champ
109 foreach ($this->champs
as $name => $def) {
110 ecrire_meta($name, $this->val
[$name]);
112 if (defined('_COMPAT_CFG_192')) ecrire_metas();
113 return array(true, $this->val
);
118 * supprime chaque enregistrement de meta pour chaque champ
123 foreach ($this->champs
as $name => $def) {
124 if (!$this->val
[$name]) {
128 if (defined('_COMPAT_CFG_192')) ecrire_metas();
129 return array(true, $this->val
);
134 * charger les arguments de lire_config(meta::nom)
136 * @param string $args # $args = 'nom'; ici
139 function charger_args($args){
140 if ($args) $this->champs
= array($args=>true);