]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
PCRE modifier /e is deprecated in favour of preg_replace_callback()
authorMikael Nordfeldth <mmn@hethane.se>
Sun, 6 Oct 2013 01:27:16 +0000 (03:27 +0200)
committerMikael Nordfeldth <mmn@hethane.se>
Sun, 6 Oct 2013 01:27:16 +0000 (03:27 +0200)
lib/util.php
plugins/TwitterBridge/lib/twitterimport.php

index abdd5c92070c9973b92dcdf83ab8d10f547b9e34..09d98f7055b04a0a9948e4ab594af546125ccca0 100644 (file)
@@ -585,8 +585,8 @@ function common_render_content($text, $notice)
     $r = common_render_text($text);
     $id = $notice->profile_id;
     $r = common_linkify_mentions($r, $notice);
-    $r = preg_replace('/(^|[\s\.\,\:\;]+)!(' . Nickname::DISPLAY_FMT . ')/e',
-                      "'\\1!'.common_group_link($id, '\\2')", $r);
+    $r = preg_replace_callback('/(^|[\s\.\,\:\;]+)!(' . Nickname::DISPLAY_FMT . ')/',
+                      function ($m) { return $m[1].common_group_link($id, $m[2]); }, $r);
     return $r;
 }
 
@@ -1980,10 +1980,10 @@ function common_markup_to_html($c, $args=null)
         $c = preg_replace('/%%arg.'.$name.'%%/', $value, $c);
     }
 
-    $c = preg_replace('/%%user.(\w+)%%/e', "common_user_property('\\1')", $c);
-    $c = preg_replace('/%%action.(\w+)%%/e', "common_local_url('\\1')", $c);
-    $c = preg_replace('/%%doc.(\w+)%%/e', "common_local_url('doc', array('title'=>'\\1'))", $c);
-    $c = preg_replace('/%%(\w+).(\w+)%%/e', 'common_config(\'\\1\', \'\\2\')', $c);
+    $c = preg_replace_callback('/%%user.(\w+)%%/', function ($m) { return common_user_property($m[1]); }, $c);
+    $c = preg_replace_callback('/%%action.(\w+)%%/', function ($m) { return common_local_url($m[1]); }, $c);
+    $c = preg_replace_callback('/%%doc.(\w+)%%/', function ($m) { return common_local_url('doc', array('title'=>$m[1])); }, $c);
+    $c = preg_replace_callback('/%%(\w+).(\w+)%%/', function ($m) { return common_config($m[1], $m[2]); }, $c);
     return Markdown($c);
 }
 
index 710aa7330ac8537c5ea73d9938a6bb3fdf86eb38..7f27818d89c0540cde856d61651ba5cd0c84a360 100644 (file)
@@ -428,8 +428,10 @@ class TwitterImport
             $statusId = twitter_id($status);
             common_log(LOG_WARNING, "No entities data for {$statusId}; trying to fake up links ourselves.");
             $text = common_replace_urls_callback($text, 'common_linkify');
-            $text = preg_replace('/(^|\&quot\;|\'|\(|\[|\{|\s+)#([\pL\pN_\-\.]{1,64})/e', "'\\1#'.TwitterStatusFetcher::tagLink('\\2')", $text);
-            $text = preg_replace('/(^|\s+)@([a-z0-9A-Z_]{1,64})/e', "'\\1@'.TwitterStatusFetcher::atLink('\\2')", $text);
+            $text = preg_replace_callback('/(^|\&quot\;|\'|\(|\[|\{|\s+)#([\pL\pN_\-\.]{1,64})/',
+                        function ($m) { return $m[1].'#'.TwitterStatusFetcher::tagLink($m[2]); }, $text);
+            $text = preg_replace_callback('/(^|\s+)@([a-z0-9A-Z_]{1,64})/',
+                        function ($m) { return $m[1].'@'.TwitterStatusFetcher::atLink($m[2]); }, $text);
             return $text;
         }