Use preg_replace_callback instead of deprecated /e modifier

This causes deprecation warning in PHP 5.5
This commit is contained in:
Michal Čihař 2013-05-02 10:28:37 +02:00
parent bb597f7341
commit a00b2f99a5

View File

@ -244,9 +244,9 @@ class Advisor
);
// Replaces external Links with PMA_linkURL() generated links
$rule['recommendation'] = preg_replace(
'#href=("|\')(https?://[^\1]+)\1#ie',
'\'href="\' . PMA_linkURL("\2") . \'"\'',
$rule['recommendation'] = preg_replace_callback(
'#href=("|\')(https?://[^\1]+)\1#i',
array($this, '_replaceLinkURL'),
$rule['recommendation']
);
break;
@ -255,6 +255,18 @@ class Advisor
$this->runResult[$type][] = $rule;
}
/**
* Callback for wrapping links with PMA_linkURL
*
* @param array $matches List of matched elements form preg_replace_callback
*
* @return Replacement value
*/
private function _replaceLinkURL($matches)
{
return 'href="' . PMA_linkURL($matches[2]) . '"';
}
/**
* Callback for evaluating fired() condition.
*