X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2FPlugin%2FSkel.php;h=093000d5bacd22f63108d1eb81679e94eb385d24;hb=d2cf8e2c70cdbd10213a5c123c278a7257d8e210;hp=7e8654675d506be156de6af1b2e27da8fcc0cc04;hpb=b2c16bf312cd037e252e568974a5523407e42099;p=diogenes.git diff --git a/include/Plugin/Skel.php b/include/Plugin/Skel.php index 7e86546..093000d 100644 --- a/include/Plugin/Skel.php +++ b/include/Plugin/Skel.php @@ -67,60 +67,22 @@ class Diogenes_Plugin_Skel { { return ($wperms != 'public'); } + - - /** Declare a plugin parameter. - */ - function declareParam($key, $val) - { - $this->params[$key] = $val; - } - - - /** Return an array of parameter names. - */ - function getParamNames() - { - return array_keys($this->params); - } - - - /** Return the value of a parameter of the plugin. - */ - function getParamValue($key) - { - return isset($this->params[$key]) ? $this->params[$key] : ''; - } - - - /** Set the value of a parameter of the plugin. - */ - function setParamValue($key, $val) - { - if (isset($this->params[$key])) { - //echo "$this->name : Calling setParamValue($key, $val)
\n"; - $this->params[$key] = $val; - } else { - //echo "$this->name : skipping setParamValue($key, $val)
\n"; - } - } - - /** Set plugin parameters. * * @param $params */ function setParams($params) { - $bits = explode("\0", $params); + $bits = explode("\0", $params); foreach ($bits as $bit) { $frags = explode("=", $bit, 2); $key = $frags[0]; - if (!empty($key)) - { - $val = isset($frags[1]) ? $frags[1] : ''; - $this->setParamValue($key, $val); + $val = isset($frags[1]) ? $frags[1] : ''; + if (isset($this->params[$key])) { + $this->params[$key] = $val; } } } @@ -135,15 +97,14 @@ class Diogenes_Plugin_Skel { { global $globals; - //echo $this->name . " : eraseParams($barrel, $page)
\n"; + //echo $this->name . " : deleteParams($barrel, $page)
\n"; $globals->db->query("delete from diogenes_plugin where plugin='{$this->name}' and barrel='$barrel' and page='$page'"); $this->active = 0; unset($this->pos); - foreach ($this->getParamNames() as $key) + foreach ($this->params as $key => $val) { - //echo "$this->name : erasing param
\n"; - $this->setParamValue($key, ''); + $this->params[$key] = ''; } } @@ -162,10 +123,9 @@ class Diogenes_Plugin_Skel { $this->active = 1; $params = ''; - foreach ($this->getParamNames() as $key) - { - $val = $this->getParamValue($key); - //echo "$this->name : $key = $val
\n"; + foreach ($this->params as $key => $val) + { + //echo $this->name . " $key=$val
"; $params .= "$key=$val\0"; } $globals->db->query("replace into diogenes_plugin set plugin='{$this->name}', barrel='$barrel', page='$page', pos='$pos', params='$params'");