# HG changeset patch # User Tom Fredrik "BFG" Klaussen # Date 1349704168 -7200 # Node ID 15879e2aab65affbdd62d01db6e12076ba7cea16 # Parent 6c2c6acba30ce4b4e7c5d17b7615d658b1bc047f Function for converting a stringmap to EVALable function. diff -r 6c2c6acba30c -r 15879e2aab65 common-functions.inc --- a/common-functions.inc Mon Oct 08 02:02:09 2012 +0200 +++ b/common-functions.inc Mon Oct 08 15:49:28 2012 +0200 @@ -4,6 +4,24 @@ $cache = CacheTimeCheck::instance(__FILE__); $cache->includeOnce('http-response-status-codes.inc', dirname(__FILE__)); +function repMapString($map) +{ + $opt = 'array('; + $start = True; + + foreach($map as $param => $value) { + if ($start) { + $start = False; + $opt .= "\"${param}\" => \"${value}\""; + } + else { + $opt .= ", \"${param}\" => \"${value}\""; + } + } + $opt .= ')'; + return $opt; +} + function basePath() { $l = strrpos($_SERVER['SCRIPT_FILENAME'], $_SERVER['SCRIPT_NAME']); diff -r 6c2c6acba30c -r 15879e2aab65 filters.inc --- a/filters.inc Mon Oct 08 02:02:09 2012 +0200 +++ b/filters.inc Mon Oct 08 15:49:28 2012 +0200 @@ -12,19 +12,7 @@ $pattern = '/
  • ]*)>(.*?)<\/li>/is'; $replacement = "
  • \$3
  • "; - $opt = 'array('; - $start = True; - - foreach($options->getUrlParams() as $param => $value) { - if ($start) { - $start = False; - $opt .= "\"${param}\" => \"${value}\""; - } - else { - $opt .= ", \"${param}\" => \"${value}\""; - } - } - $opt .= ')'; + $opt = repMapString($options->getUrlParams()); $output = preg_replace_callback($pattern, create_function(