* (bug 17374) Special:Export no longer exports multiple copies of pages
* (bug 19818) Edits to user CSS/JS subpages can now be marked as patrolled by
users who can't edit them
-* (bug 15745) The edit summary link parser now handles mismatched brackets
- better
* (bug 19839) Comments in log items are no more double escaped
* (bug 18161) Fix inconsistent separators in watchlist link toolbars with
"enhanced recent changes"
public function formatLinksInComment( $comment, $title = null, $local = false ) {
$this->commentContextTitle = $title;
$this->commentLocal = $local;
- # Borrowed from Parser::replaceInternalLinks2
- $parts = StringUtils::explode( '[[', ' ' . $comment );
- $start = $parts->current();
- $parts->next();
- $line = $parts->current();
- $html = substr( $start, 1 );
- for ( ; $line !== false && $line !== null ; $parts->next(), $line = $parts->current() ) {
- $linked = preg_replace_callback(
- '/^:?(.*?)(\|(.*?))*\]\]([^[]*)/',
- array( $this, 'formatLinksInCommentCallback' ),
- $line, -1, $count );
- if( !$count ) { // No valid link found, put the brackets back
- $linked = '[[' . $linked;
- }
- $html .= $linked;
- }
+ $html = preg_replace_callback(
+ '/\[\[:?(.*?)(\|(.*?))*\]\]([^[]*)/',
+ array( $this, 'formatLinksInCommentCallback' ),
+ $comment );
unset( $this->commentContextTitle );
unset( $this->commentLocal );
return $html;
$thelink = null;
if( preg_match( '/^' . $medians . '(.*)$/i', $match[1], $submatch ) ) {
# Media link; trail not supported.
- $linkRegexp = '/^(.*?)\]\]/';
+ $linkRegexp = '/\[\[(.*?)\]\]/';
$title = Title::makeTitleSafe( NS_FILE, $submatch[1] );
$thelink = $this->makeMediaLinkObj( $title, $text );
} else {
} else {
$trail = "";
}
- $linkRegexp = '/^(.*?)\]\]' . preg_quote( $trail, '/' ) . '/';
+ $linkRegexp = '/\[\[(.*?)\]\]' . preg_quote( $trail, '/' ) . '/';
if (isset($match[1][0]) && $match[1][0] == ':')
$match[1] = substr($match[1], 1);
list( $inside, $trail ) = Linker::splitTrail( $trail );