r76385 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r76384‎ | r76385 | r76386 >
Date:12:25, 9 November 2010
Author:ialex
Status:ok (Comments)
Tags:
Comment:
* (bug 21364) External links using link= attribute on images now respect $wgExternalLinkTarget
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/Linker.php (modified) (history)
  • /trunk/phase3/includes/media/MediaTransformOutput.php (modified) (history)
  • /trunk/phase3/includes/parser/Parser.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/parser/Parser.php
@@ -4694,6 +4694,9 @@
46954695 if ( preg_match( "/^($prots)$chars+$/", $value, $m ) ) {
46964696 $paramName = 'link-url';
46974697 $this->mOutput->addExternalLink( $value );
 4698+ if ( $this->mOptions->getExternalLinkTarget() ) {
 4699+ $params[$type]['link-target'] = $this->mOptions->getExternalLinkTarget();
 4700+ }
46984701 $validated = true;
46994702 }
47004703 } else {
Index: trunk/phase3/includes/Linker.php
@@ -428,6 +428,7 @@
429429 * caption HTML for image caption.
430430 * link-url URL to link to
431431 * link-title Title object to link to
 432+ * link-target Value for the target attribue, only with link-url
432433 * no-link Boolean, suppress description link
433434 *
434435 * @param $handlerParams Array: associative array of media handler parameters, to be passed
@@ -552,6 +553,9 @@
553554 $mtoParams = array();
554555 if ( isset( $frameParams['link-url'] ) && $frameParams['link-url'] !== '' ) {
555556 $mtoParams['custom-url-link'] = $frameParams['link-url'];
 557+ if ( isset( $frameParams['link-target'] ) ) {
 558+ $mtoParams['custom-target-link'] = $frameParams['link-target'];
 559+ }
556560 } elseif ( isset( $frameParams['link-title'] ) && $frameParams['link-title'] !== '' ) {
557561 $mtoParams['custom-title-link'] = $this->normaliseSpecialPage( $frameParams['link-title'] );
558562 } elseif ( !empty( $frameParams['no-link'] ) ) {
Index: trunk/phase3/includes/media/MediaTransformOutput.php
@@ -144,6 +144,7 @@
145145 * desc-query String, description link query params
146146 * custom-url-link Custom URL to link to
147147 * custom-title-link Custom Title object to link to
 148+ * custom target-link Value of the target attribute, for custom-target-link
148149 *
149150 * For images, desc-link and file-link are implemented as a click-through. For
150151 * sounds and videos, they may be displayed in other ways.
@@ -164,6 +165,9 @@
165166 if ( !empty( $options['title'] ) ) {
166167 $linkAttribs['title'] = $options['title'];
167168 }
 169+ if ( !empty( $options['custom-target-link'] ) ) {
 170+ $linkAttribs['target'] = $options['custom-target-link'];
 171+ }
168172 } elseif ( !empty( $options['custom-title-link'] ) ) {
169173 $title = $options['custom-title-link'];
170174 $linkAttribs = array(
Index: trunk/phase3/RELEASE-NOTES
@@ -410,6 +410,8 @@
411411 * (bug 13353) Diff3 version checks were too strict, did not detect working diff3
412412 * (bug 25843) Links to special pages using link= attribute on images are now
413413 normalised like normal links to special pages
 414+* (bug 21364) External links using link= attribute on images now respect
 415+ $wgExternalLinkTarget
414416
415417 === API changes in 1.17 ===
416418 * (bug 22738) Allow filtering by action type on query=logevent.

Follow-up revisions

RevisionCommit summaryAuthorDate
r78580* re r76385 Add parser tests for $wgExternalLinkTarget on imagesmah21:45, 18 December 2010

Comments

#Comment by MarkAHershberger (talk | contribs)   21:46, 18 December 2010

fails one of those tests in an odd way

#Comment by IAlex (talk | contribs)   22:06, 18 December 2010

Can'r reproduce, both tests you added in r78580 pass for me.

#Comment by MarkAHershberger (talk | contribs)   23:19, 18 December 2010

I was about to come back and comment that I should have rolled back to this rev and tested. They work in this rev.

#Comment by Werdna (talk | contribs)   19:19, 19 January 2011

Looks OK, but I haven't tested it.

Status & tagging log