* Add support for a version key in $wgExtensionCredits
authorÆvar Arnfjörð Bjarmason <avar@users.mediawiki.org>
Thu, 14 Jul 2005 00:37:01 +0000 (00:37 +0000)
committerÆvar Arnfjörð Bjarmason <avar@users.mediawiki.org>
Thu, 14 Jul 2005 00:37:01 +0000 (00:37 +0000)
includes/DefaultSettings.php
includes/SpecialVersion.php

index 520f8a4..7c9de9c 100644 (file)
@@ -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.
  *
  * <code>
  * $wgExtensionCredits[$type][] = array(
  *     'name' => 'Example extension',
+ *      'version' => 1.9,
  *     'author' => 'Foo Barstein',
  *     'url' => 'http://wwww.example.com/Example%20Extension/',
  * );
  * </code>
+ *
  * Where $type is 'specialpage', 'parserhook', or 'other'.
  */
 $wgExtensionCredits = array();
index 4423c7c..0f39124 100644 (file)
@@ -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;
+}
 ?>