* (bug 21364) External links using link= attribute on images now respect $wgExternalLinkTarget

This commit is contained in:
Alexandre Emsenhuber 2010-11-09 12:25:57 +00:00
parent 32d087efd6
commit 1a4957e0b4
4 changed files with 13 additions and 0 deletions

View file

@ -410,6 +410,8 @@ LocalSettings.php. The specific bugs are listed below in the general notes.
* (bug 13353) Diff3 version checks were too strict, did not detect working diff3
* (bug 25843) Links to special pages using link= attribute on images are now
normalised like normal links to special pages
* (bug 21364) External links using link= attribute on images now respect
$wgExternalLinkTarget
=== API changes in 1.17 ===
* (bug 22738) Allow filtering by action type on query=logevent.

View file

@ -428,6 +428,7 @@ class Linker {
* caption HTML for image caption.
* link-url URL to link to
* link-title Title object to link to
* link-target Value for the target attribue, only with link-url
* no-link Boolean, suppress description link
*
* @param $handlerParams Array: associative array of media handler parameters, to be passed
@ -552,6 +553,9 @@ class Linker {
$mtoParams = array();
if ( isset( $frameParams['link-url'] ) && $frameParams['link-url'] !== '' ) {
$mtoParams['custom-url-link'] = $frameParams['link-url'];
if ( isset( $frameParams['link-target'] ) ) {
$mtoParams['custom-target-link'] = $frameParams['link-target'];
}
} elseif ( isset( $frameParams['link-title'] ) && $frameParams['link-title'] !== '' ) {
$mtoParams['custom-title-link'] = $this->normaliseSpecialPage( $frameParams['link-title'] );
} elseif ( !empty( $frameParams['no-link'] ) ) {

View file

@ -144,6 +144,7 @@ class ThumbnailImage extends MediaTransformOutput {
* desc-query String, description link query params
* custom-url-link Custom URL to link to
* custom-title-link Custom Title object to link to
* custom target-link Value of the target attribute, for custom-target-link
*
* For images, desc-link and file-link are implemented as a click-through. For
* sounds and videos, they may be displayed in other ways.
@ -164,6 +165,9 @@ class ThumbnailImage extends MediaTransformOutput {
if ( !empty( $options['title'] ) ) {
$linkAttribs['title'] = $options['title'];
}
if ( !empty( $options['custom-target-link'] ) ) {
$linkAttribs['target'] = $options['custom-target-link'];
}
} elseif ( !empty( $options['custom-title-link'] ) ) {
$title = $options['custom-title-link'];
$linkAttribs = array(

View file

@ -4694,6 +4694,9 @@ class Parser {
if ( preg_match( "/^($prots)$chars+$/", $value, $m ) ) {
$paramName = 'link-url';
$this->mOutput->addExternalLink( $value );
if ( $this->mOptions->getExternalLinkTarget() ) {
$params[$type]['link-target'] = $this->mOptions->getExternalLinkTarget();
}
$validated = true;
}
} else {