r61905 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61904‎ | r61905 | r61906 >
Date:05:07, 3 February 2010
Author:tstarling
Status:ok
Tags:
Comment:
Remove <a> tag hook for now, pending resolution of implementation issues as discussed on CR r58717.
Modified paths:
  • /trunk/phase3/includes/parser/Parser.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/parser/Parser.php
@@ -129,7 +129,7 @@
130130 $this->mFunctionHooks = array();
131131 $this->mFunctionTagHooks = array();
132132 $this->mFunctionSynonyms = array( 0 => array(), 1 => array() );
133 - $this->mDefaultStripList = $this->mStripList = array( 'nowiki', 'gallery', 'a' );
 133+ $this->mDefaultStripList = $this->mStripList = array( 'nowiki', 'gallery' );
134134 $this->mUrlProtocols = wfUrlProtocols();
135135 $this->mExtLinkBracketedRegex = '/\[(\b(' . wfUrlProtocols() . ')'.
136136 '[^][<>"\\x00-\\x20\\x7F]+) *([^\]\\x0a\\x0d]*?)\]/S';
@@ -3308,9 +3308,6 @@
33093309 case 'gallery':
33103310 $output = $this->renderImageGallery( $content, $attributes );
33113311 break;
3312 - case 'a':
3313 - $output = $this->renderHyperlink( $content, $attributes, $frame );
3314 - break;
33153312 case 'math':
33163313 if ( $this->mOptions->getUseTeX() ) {
33173314 $output = $wgContLang->armourMath(
@@ -4358,35 +4355,6 @@
43594356 }
43604357
43614358 /**
4362 - * Tag hook handler for 'a'. Renders a HTML &lt;a&gt; tag, allowing most attributes, filtering href against
4363 - * allowed protocols and spam blacklist.
4364 - **/
4365 - function renderHyperlink( $text, $params, $frame = false ) {
4366 - foreach ( $params as $name => $value ) {
4367 - $params[ $name ] = $this->replaceVariables( $value, $frame );
4368 - }
4369 -
4370 - $whitelist = Sanitizer::attributeWhitelist( 'a' );
4371 - $params = Sanitizer::validateAttributes( $params, $whitelist );
4372 -
4373 - $content = $this->recursiveTagParse( trim( $text ), $frame );
4374 -
4375 - if ( isset( $params[ 'href' ] ) ) {
4376 - $href = $params[ 'href' ];
4377 - $this->mOutput->addExternalLink( $href );
4378 - unset( $params[ 'href' ] );
4379 - } else {
4380 - # Non-link <a> tag
4381 - return Xml::openElement( 'a', $params ) . $content . Xml::closeElement( 'a' );
4382 - }
4383 -
4384 - $sk = $this->mOptions->getSkin();
4385 - $html = $sk->makeExternalLink( $href, $content, false, '', $params );
4386 -
4387 - return $html;
4388 - }
4389 -
4390 - /**
43914359 * Renders an image gallery from a text with one line per image.
43924360 * text labels may be given by using |-style alternative text. E.g.
43934361 * Image:one.jpg|The number "1"

Follow-up revisions

RevisionCommit summaryAuthorDate
r61909Followup to r61905: remove parser tests for ex-feature.tstarling05:42, 3 February 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r58717adding support for <a> tags as a parser tag hook, in order to support rdfa ou...daniel16:46, 7 November 2009

Status & tagging log