Mercurial > SimpleWebPresenter
comparison filters.inc @ 128:ef487503dded
Remove deprecated create_function, replace with closure.
| author | Tom Fredrik Blenning <bfg@bfgconsult.no> |
|---|---|
| date | Wed, 28 Dec 2022 01:05:33 +0100 |
| parents | ba11b1c1b881 |
| children |
comparison
equal
deleted
inserted
replaced
| 127:14959382c901 | 128:ef487503dded |
|---|---|
| 22 $output = preg_replace($pattern, $replacement, $input); | 22 $output = preg_replace($pattern, $replacement, $input); |
| 23 | 23 |
| 24 $pattern = '/<li id="([^"]+)"\s?([^>]*)>(.*?)<\/li>/is'; | 24 $pattern = '/<li id="([^"]+)"\s?([^>]*)>(.*?)<\/li>/is'; |
| 25 $replacement = "<li id=\"\$1\" \$2><a href=\"%URL-$1%\">\$3</a></li>"; | 25 $replacement = "<li id=\"\$1\" \$2><a href=\"%URL-$1%\">\$3</a></li>"; |
| 26 | 26 |
| 27 $opt = repMapString($options->getUrlParams()); | |
| 28 | |
| 29 $baseUrl = $options->getBaseUrl(); | |
| 30 | |
| 31 $output = preg_replace_callback($pattern, | 27 $output = preg_replace_callback($pattern, |
| 32 create_function( | 28 function($matches) use ($options){ |
| 33 '$matches', | 29 $opt = $options->getUrlParams(); |
| 34 'return "<li id=\"$matches[1]\" $matches[2]><a href=\"' . $baseUrl . '" . genUrl(' . $opt . ', array("name" => $matches[1]), array("lang", "name") ) . "\">$matches[3]</a></li>";' | 30 $baseUrl = $options->getBaseUrl(); |
| 35 ), | 31 $g=genUrl($opt, array("name" => $matches[1]), array("lang", "name") ); |
| 32 return "<li id=\"$matches[1]\" $matches[2]><a href=\"$baseUrl" . $g . "\">$matches[3]</a></li>"; | |
| 33 }, | |
| 36 $output); | 34 $output); |
| 37 | 35 |
| 38 return $output; | 36 return $output; |
| 39 } | 37 } |
| 40 | 38 |
