PCRE modifier /e is deprecated in favour of preg_replace_callback()

This commit is contained in:
Mikael Nordfeldth
2013-10-06 03:27:16 +02:00
parent ac819e5738
commit 1c042028dc
2 changed files with 10 additions and 8 deletions

View 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;
}