$wgExternalLinkTarget
* api.php now sends "Retry-After" and "X-Database-Lag" HTTP headers if the maxlag
check fails, just like index.php does
-* Configurable per-namespace and per-page header,
- respectively MediaWiki:Pageheader-# where # is the namespace number, and
+* Configurable per-namespace and per-page header, respectively
+ MediaWiki:Pageheader-# where # is the namespace number, and
MediaWiki:Pagenumber-#-PAGENAME where # is the page's namespace number and
- PAGENAME is the page name minus the namespace prefix. Can be disabled with the new magic word __NOHEADER__
-
+ PAGENAME is the page name minus the namespace prefix. Can be disabled with
+ the new magic word __NOHEADER__
+* Added "click" parameter to image links, to allow images to link to an
+ arbitrary title or URL. This should replace inaccessible and incomplete
+ solutions such as CSS-based overlays and ImageMap.
=== Bug fixes in 1.14 ===
* bottom, text-bottom)
* alt Alternate text for image (i.e. alt attribute). Plain text.
* caption HTML for image caption.
+ * click-url URL to link to
+ * click-title Title object to link to
+ * no-link Boolean, suppress description link
*
* @param array $handlerParams Associative array of media handler parameters, to be passed
* to transform(). Typical keys are "width" and "page".
if ( !$thumb ) {
$s = $this->makeBrokenImageLinkObj( $title, '', '', '', '', $time==true );
} else {
- $s = $thumb->toHtml( array(
- 'desc-link' => true,
- 'desc-query' => $query,
+ $params = array(
'alt' => $fp['alt'],
'valign' => isset( $fp['valign'] ) ? $fp['valign'] : false ,
- 'img-class' => isset( $fp['border'] ) ? 'thumbborder' : false ) );
+ 'img-class' => isset( $fp['border'] ) ? 'thumbborder' : false );
+ if ( !empty( $fp['click-url'] ) ) {
+ $params['custom-url-link'] = $fp['click-url'];
+ } elseif ( !empty( $fp['click-title'] ) ) {
+ $params['custom-title-link'] = $fp['click-title'];
+ } elseif ( !empty( $fp['no-link'] ) ) {
+ // No link
+ } else {
+ $params['desc-link'] = true;
+ $params['desc-query'] = $query;
+ }
+
+ $s = $thumb->toHtml( $params );
}
if ( '' != $fp['align'] ) {
$s = "<div class=\"float{$fp['align']}\">{$s}</div>";
* alt Alternate text or caption
* desc-link Boolean, show a description link
* file-link Boolean, show a file download link
+ * custom-url-link Custom URL to link to
+ * custom-title-link Custom Title object to link to
* valign vertical-align property, if the output is an inline element
* img-class Class applied to the <img> tag, if there is such a tag
*
* valign vertical-align property, if the output is an inline element
* img-class Class applied to the <img> tag, if there is such a tag
* desc-query String, description link query params
+ * custom-url-link Custom URL to link to
+ * custom-title-link Custom Title object to link to
*
* For images, desc-link and file-link are implemented as a click-through. For
* sounds and videos, they may be displayed in other ways.
$alt = empty( $options['alt'] ) ? '' : $options['alt'];
$query = empty($options['desc-query']) ? '' : $options['desc-query'];
- if ( !empty( $options['desc-link'] ) ) {
+ if ( !empty( $options['custom-url-link'] ) ) {
+ $linkAttribs = array( 'href' => $options['custom-url-link'] );
+ } elseif ( !empty( $options['custom-title-link'] ) ) {
+ $title = $options['custom-title-link'];
+ $linkAttribs = array( 'href' => $title->getLinkUrl(), 'title' => $title->getFullText() );
+ } elseif ( !empty( $options['desc-link'] ) ) {
$linkAttribs = $this->getDescLinkAttribs( $alt, $query );
} elseif ( !empty( $options['file-link'] ) ) {
$linkAttribs = array( 'href' => $this->file->getURL() );
'vertAlign' => array( 'baseline', 'sub', 'super', 'top', 'text-top', 'middle',
'bottom', 'text-bottom' ),
'frame' => array( 'thumbnail', 'manualthumb', 'framed', 'frameless',
- 'upright', 'border' ),
+ 'upright', 'border', 'click' ),
);
static $internalParamMap;
if ( !$internalParamMap ) {
/// downstream behavior seems odd with missing manual thumbs.
$validated = true;
break;
+ case 'click':
+ $chars = self::EXT_LINK_URL_CLASS;
+ $prots = $this->mUrlProtocols;
+ if ( $value === '' ) {
+ $paramName = 'no-link';
+ $value = true;
+ $validated = true;
+ } elseif ( preg_match( "/^$prots/", $value ) ) {
+ if ( preg_match( "/^($prots)$chars+$/", $value, $m ) ) {
+ $paramName = 'click-url';
+ $this->mOutput->addExternalLink( $value );
+ $validated = true;
+ }
+ } else {
+ $clickTitle = Title::newFromText( $value );
+ if ( $clickTitle ) {
+ $paramName = 'click-title';
+ $value = $clickTitle;
+ $this->mOutput->addLink( $clickTitle );
+ $validated = true;
+ }
+ }
+ break;
default:
// Most other things appear to be empty or numeric...
$validated = ( $value === false || is_numeric( trim( $value ) ) );
'img_middle' => array( 1, 'middle' ),
'img_bottom' => array( 1, 'bottom' ),
'img_text_bottom' => array( 1, 'text-bottom' ),
+ 'img_click' => array( 1, 'click=$1' ),
'int' => array( 0, 'INT:' ),
'sitename' => array( 1, 'SITENAME' ),
'ns' => array( 0, 'NS:' ),