X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fxorg.plugin.inc.php;h=445e340eebd8589f03630d394bdede3ff98a3030;hb=27cb2301e3ba633ca355d1b5b5815d28ff8d84e8;hp=7a4a97c1a5afe77c6d8b5bf059fee2c482bc6cf7;hpb=50a40a33a496131e817df875607ea5542d096a64;p=platal.git diff --git a/include/xorg.plugin.inc.php b/include/xorg.plugin.inc.php index 7a4a97c..445e340 100644 --- a/include/xorg.plugin.inc.php +++ b/include/xorg.plugin.inc.php @@ -35,15 +35,15 @@ class XOrgPlugin { // {{{ properties - + /** have to override, contents the fields names used to drive the plugin */ - var $_get_vars = Array(); + var $_get_vars = array(); /** some polymorphism at low cost, may be used, or not */ var $_callback; // }}} // {{{ function XOrgPlugin() - + /** constructor. * the constructor override $_get_vars settings by prefixing the names with $prefix */ @@ -58,7 +58,7 @@ class XOrgPlugin // }}} // {{{ function get_value() - + /** transparent access to $_GET, wrt the right $prefix */ function get_value($key) @@ -68,7 +68,7 @@ class XOrgPlugin // }}} // {{{ function make_url() - + /** construct an url with the given parameters to drive the plugin. * leave all other GET params alone */ @@ -78,22 +78,21 @@ class XOrgPlugin $args = isset($params) ? $params : Array(); if (!is_array($args)) { - if (count($this->_get_vars)!=1) { - return "

params should be an array

"; - } else { - $args = Array($this->_get_vars[0]=>$params); - } + $args = array($this->_get_vars[0]=>$params); } foreach ($_GET as $key=>$val) { - if (in_array($key,$this->_get_vars) && array_key_exists($key,$args)) { + if ($key == 'p') { + continue; + } + if (in_array($key, $this->_get_vars) && array_key_exists($key, $args)) { continue; } $get[] = urlencode($key) . '=' . urlencode($val); } foreach ($this->_get_vars as $key) { - if (array_key_exists($key,$args)) { + if (array_key_exists($key, $args)) { if ($args[$key]) { $get[] = urlencode($key) . '=' . urlencode($args[$key]); } @@ -102,7 +101,7 @@ class XOrgPlugin } } - return $_SERVER['PHP_SELF'] . '?' . join('&',$get); + return pl_self() . '?' . join('&', $get); } // }}}