changeset 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 14959382c901
children 16c3ee204330
files filters.inc
diffstat 1 files changed, 7 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/filters.inc	Wed Dec 28 01:05:01 2022 +0100
+++ b/filters.inc	Wed Dec 28 01:05:33 2022 +0100
@@ -24,15 +24,13 @@
   $pattern = '/<li id="([^"]+)"\s?([^>]*)>(.*?)<\/li>/is';
   $replacement = "<li id=\"\$1\" \$2><a href=\"%URL-$1%\">\$3</a></li>";
 
-  $opt = repMapString($options->getUrlParams());
-
-  $baseUrl = $options->getBaseUrl();
-
   $output = preg_replace_callback($pattern,
-	create_function(
-	  '$matches',
-	  'return "<li id=\"$matches[1]\" $matches[2]><a href=\"' . $baseUrl . '" . genUrl(' . $opt . ', array("name" => $matches[1]), array("lang", "name") ) . "\">$matches[3]</a></li>";'
-	),
+	function($matches) use ($options){
+          $opt = $options->getUrlParams();
+          $baseUrl = $options->getBaseUrl();
+          $g=genUrl($opt, array("name" => $matches[1]), array("lang", "name") );
+	  return "<li id=\"$matches[1]\" $matches[2]><a href=\"$baseUrl" . $g . "\">$matches[3]</a></li>";
+	},
 	$output);
 
   return $output;
@@ -77,4 +75,4 @@
 
   return $output;
 }
-?>
\ No newline at end of file
+?>