diff --git a/libraries/Advisor.class.php b/libraries/Advisor.class.php index 98e090e515..91c8bf2beb 100644 --- a/libraries/Advisor.class.php +++ b/libraries/Advisor.class.php @@ -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. *