From ce335a08902456a66726ab7ac092fa466e3918fc Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Thu, 14 Jul 2005 00:37:01 +0000 Subject: [PATCH] * Add support for a version key in $wgExtensionCredits --- includes/DefaultSettings.php | 6 ++++-- includes/SpecialVersion.php | 21 ++++++++++++++------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 520f8a4094..7c9de9c53e 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -1228,16 +1228,18 @@ $wgUseXMLparser = false ; $wgSkinExtensionFunctions = array(); $wgExtensionFunctions = array(); /** - * An array of extension names, their authors, and optionally, urls - * add to it from an extension like: + * An array of extension types and inside that their names, versions, authors + * and urls, note that the version and url key can be omitted. * * * $wgExtensionCredits[$type][] = array( * 'name' => 'Example extension', + * 'version' => 1.9, * 'author' => 'Foo Barstein', * 'url' => 'http://wwww.example.com/Example%20Extension/', * ); * + * * Where $type is 'specialpage', 'parserhook', or 'other'. */ $wgExtensionCredits = array(); diff --git a/includes/SpecialVersion.php b/includes/SpecialVersion.php index 4423c7cf92..0f39124a10 100644 --- a/includes/SpecialVersion.php +++ b/includes/SpecialVersion.php @@ -53,13 +53,7 @@ or [http://www.gnu.org/copyleft/gpl.html read it online] if ( count( @$wgExtensionCredits[$type] ) > 0 ) { $out .= "=== $text ===\n"; foreach ( $wgExtensionCredits[$type] as $extension ) { - if ( isset( $extension['url'] ) ) { - $out .= '* [' . $extension['url'] . ' ' . $extension['name'] . ']'; - } else { - $out .= '* ' . $extension['name']; - } - $out .= ' by ' . $extension['author'] . "\n"; - + $out .= formatExtensionCredits( $extension['name'], $extension['author'], @$extension['url'], @$extension['version'] ); } } @@ -67,4 +61,17 @@ or [http://www.gnu.org/copyleft/gpl.html read it online] } $wgOut->addWikiText( $out ); } + +function formatExtensionCredits( $name, $author, $url = null, $version = null ) { + $ret = '* '; + if ( isset( $url ) ) + $ret .= "[$url "; + $ret .= $name; + if ( isset( $url ) ) + $ret .= ']'; + if ( isset( $version ) ) + $ret .= " $version"; + $ret .= " by $author"; + return $ret; +} ?> -- 2.20.1