Mercurial > SimpleWebPresenter
comparison filters.inc @ 35:aec57ed6f5f6
Remove globals from activeNav function.
| author | Tom Fredrik "BFG" Klaussen <bfg@blenning.no> |
|---|---|
| date | Thu, 04 Oct 2012 21:18:40 +0200 |
| parents | ca76d31b7d48 |
| children | da1726860524 |
comparison
equal
deleted
inserted
replaced
| 34:ca76d31b7d48 | 35:aec57ed6f5f6 |
|---|---|
| 1 <?php | 1 <?php |
| 2 function activeNav($input, $options) | 2 function activeNav($input, $options) |
| 3 { | 3 { |
| 4 $name = $GLOBALS['name']; | 4 $name = $options->getName(); |
| 5 $lang = $GLOBALS['lang']; | 5 $lang = $options->getLang(); |
| 6 $pattern = "/<li id=\"${name}\"\s?([^>]*)>/is"; | 6 $pattern = "/<li id=\"${name}\"\s?([^>]*)>/is"; |
| 7 $replacement = "<li id=\"${name}\" class=\"active\" $1>"; | 7 $replacement = "<li id=\"${name}\" class=\"active\" $1>"; |
| 8 $output = preg_replace($pattern, $replacement, $input); | 8 $output = preg_replace($pattern, $replacement, $input); |
| 9 | 9 |
| 10 $pattern = '/<li id="([^"]+)"\s?([^>]*)>(.*?)<\/li>/is'; | 10 $pattern = '/<li id="([^"]+)"\s?([^>]*)>(.*?)<\/li>/is'; |
| 11 $replacement = "<li id=\"\$1\" \$2><a href=\"%URL-$1%\">\$3</a></li>"; | 11 $replacement = "<li id=\"\$1\" \$2><a href=\"%URL-$1%\">\$3</a></li>"; |
| 12 | 12 |
| 13 $opt = 'array('; | 13 $opt = 'array('; |
| 14 $start = True; | 14 $start = True; |
| 15 | 15 |
| 16 foreach($options->getUrlParams() as $param) { | 16 foreach($options->getUrlParams() as $param => $value) { |
| 17 $value = $GLOBALS[$param]; | |
| 18 if ($start) { | 17 if ($start) { |
| 19 $start = False; | 18 $start = False; |
| 20 $opt .= "\"${param}\" => \"${value}\""; | 19 $opt .= "\"${param}\" => \"${value}\""; |
| 21 } | 20 } |
| 22 else { | 21 else { |
