From d22830fd296bd8e08ffc557140818ae3a145b398 Mon Sep 17 00:00:00 2001 From: Raimond Spekking Date: Tue, 11 Aug 2009 07:08:08 +0000 Subject: [PATCH] Recommit r54081 after general revert r54735: The description message in $wgExtensionCredits can be an array with parameters now This functionality is used by the 'Maps' and 'SemanticMaps' extensions --- RELEASE-NOTES | 1 + includes/DefaultSettings.php | 6 ++++-- includes/specials/SpecialVersion.php | 13 ++++++++++--- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 7cc621f8c0..ceb45bd4a9 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -196,6 +196,7 @@ this. Was used when mwEmbed was going to be an extension. ** If $wgWellFormedXml is set to false, some bytes will be shaved off of HTML output by omitting some things like quotation marks where HTML 5 allows. * Added crop for inline images. +* The description message in $wgExtensionCredits can be an array with parameters === Bug fixes in 1.16 === diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index f799f60ca1..440bd410a8 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -2790,8 +2790,8 @@ $wgDebugJavaScript = false; * * $wgExtensionCredits[$type][] = array( * 'name' => 'Example extension', - * 'version' => 1.9, - * 'path' => __FILE__, + * 'version' => 1.9, + * 'path' => __FILE__, * 'author' => 'Foo Barstein', * 'url' => 'http://wwww.example.com/Example%20Extension/', * 'description' => 'An example extension', @@ -2800,6 +2800,8 @@ $wgDebugJavaScript = false; * * * Where $type is 'specialpage', 'parserhook', 'variable', 'media' or 'other'. + * Where 'descriptionmsg' can be an array with message key and parameters: + * 'descriptionmsg' => array( 'exampleextension-desc', param1, param2, ... ), */ $wgExtensionCredits = array(); /* diff --git a/includes/specials/SpecialVersion.php b/includes/specials/SpecialVersion.php index 62cbac8d79..afbe0fb795 100644 --- a/includes/specials/SpecialVersion.php +++ b/includes/specials/SpecialVersion.php @@ -259,10 +259,17 @@ class SpecialVersion extends SpecialPage { # Look for a localized description if( isset( $descriptionMsg ) ) { - $msg = wfMsg( $descriptionMsg ); - if ( !wfEmptyMsg( $descriptionMsg, $msg ) && $msg != '' ) { - $description = $msg; + if( is_array( $descriptionMsg ) ) { + $descriptionMsgKey = $descriptionMsg[0]; // Get the message key + array_shift( $descriptionMsg ); // Shift out the message key to get the parameters only + array_map( "htmlspecialchars", $descriptionMsg ); // For sanity + $msg = wfMsg( $descriptionMsgKey, $descriptionMsg ); + } else { + $msg = wfMsg( $descriptionMsg ); } + if ( !wfEmptyMsg( $descriptionMsg, $msg ) && $msg != '' ) { + $description = $msg; + } } if ( $haveSubversion ) { -- 2.20.1