From e7266e7956d30af554e783f077d30a5b4df92f16 Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Sun, 7 Jan 2007 02:15:36 +0000 Subject: [PATCH] New way to display the extensions and hooks. Pending css tweaking. --- includes/SpecialVersion.php | 64 ++++++++++++++++++++++++------------- skins/monobook/main.css | 25 ++++++++++++++- 2 files changed, 66 insertions(+), 23 deletions(-) diff --git a/includes/SpecialVersion.php b/includes/SpecialVersion.php index 2634cf0b5b..9cdf757a47 100644 --- a/includes/SpecialVersion.php +++ b/includes/SpecialVersion.php @@ -21,6 +21,8 @@ function wfSpecialVersion() { } class SpecialVersion { + private $firstExtOpened = true; + /** * main() */ @@ -79,7 +81,7 @@ class SpecialVersion { * [http://www.php.net/ PHP]: " . phpversion() . " (" . php_sapi_name() . ") * " . $dbr->getSoftwareLink() . ": " . $dbr->getServerVersion(); - return str_replace( "\t\t", '', $ret ); + return str_replace( "\t\t", '', $ret ) . "\n"; } /** Return a string of the MediaWiki version with SVN revision if available */ @@ -104,10 +106,12 @@ class SpecialVersion { ); wfRunHooks( 'SpecialVersionExtensionTypes', array( &$this, &$extensionTypes ) ); - $out = "\n* Extensions:\n"; + $out = "

Extensions

\n"; + $out .= wfOpenElement('table', array('id' => 'sv-ext') ); + foreach ( $extensionTypes as $type => $text ) { if ( count( @$wgExtensionCredits[$type] ) ) { - $out .= "** $text:\n"; + $out .= $this->openExtType( $text ); usort( $wgExtensionCredits[$type], array( $this, 'compare' ) ); @@ -126,27 +130,27 @@ class SpecialVersion { } if ( count( $wgExtensionFunctions ) ) { - $out .= "** Extension functions:\n"; - $out .= '***' . $this->listToText( $wgExtensionFunctions ) . "\n"; + $out .= $this->openExtType('Extension functions'); + $out .= '' . $this->listToText( $wgExtensionFunctions ) . "\n"; } if ( $cnt = count( $tags = $wgParser->getTags() ) ) { for ( $i = 0; $i < $cnt; ++$i ) $tags[$i] = "<{$tags[$i]}>"; - $out .= "** Parser extension tags:\n"; - $out .= '***' . $this->listToText( $tags ). "\n"; + $out .= $this->openExtType('Parser extension tags'); + $out .= '' . $this->listToText( $tags ). "\n"; } if( $cnt = count( $fhooks = $wgParser->getFunctionHooks() ) ) { - $out .= "** Parser function hooks:\n"; - $out .= '***' . $this->listToText( $fhooks ) . "\n"; + $out .= $this->openExtType('Parser function hooks'); + $out .= '' . $this->listToText( $fhooks ) . "\n"; } if ( count( $wgSkinExtensionFunction ) ) { - $out .= "** Skin extension functions:\n"; - $out .= '***' . $this->listToText( $wgSkinExtensionFunction ) . "\n"; + $out .= $this->openExtType('Skin extension functions'); + $out .= '' . $this->listToText( $wgSkinExtensionFunction ) . "\n"; } - + $out .= wfCloseElement( 'table' ); return $out; } @@ -159,7 +163,7 @@ class SpecialVersion { } function formatCredits( $name, $version = null, $author = null, $url = null, $description = null) { - $ret = '*** '; + $ret = ''; if ( isset( $url ) ) $ret .= "[$url "; $ret .= "''$name"; @@ -168,13 +172,10 @@ class SpecialVersion { $ret .= "''"; if ( isset( $url ) ) $ret .= ']'; - if ( isset( $description ) ) - $ret .= ', ' . $description; - if ( isset( $description ) && isset( $author ) ) - $ret .= ', '; - if ( isset( $author ) ) - $ret .= ' by ' . $this->listToText( (array)$author ); - + $ret .= ''; + $ret .= "$description"; + $ret .= "" . $this->listToText( (array)$author ) . ""; + $ret .= ''; return "$ret\n"; } @@ -188,15 +189,34 @@ class SpecialVersion { $myWgHooks = $wgHooks; ksort( $myWgHooks ); - $ret = "* Hooks:\n"; + $ret = "

Hooks

\n" + . wfOpenElement('table', array('id' => 'sv-hooks') ) + . "Hook nameSubscribed by\n"; + foreach ($myWgHooks as $hook => $hooks) - $ret .= "** $hook: " . $this->listToText( $hooks ) . "\n"; + $ret .= "$hook" . $this->listToText( $hooks ) . "\n"; return $ret; } else return ''; } + private function openExtType($text, $name = null) { + $opt = array( 'colspan' => 3 ); + $out = ''; + + if(!$this->firstExtOpened) { + // Insert a spacing line + $out .= '' . wfElement( 'td', $opt ) . "\n"; + } + $this->firstExtOpened = false; + + if($name) { $opt['id'] = "sv-$name"; } + + $out .= "" . wfElement( 'th', $opt, $text) . "\n"; + return $out; + } + /** * @static * diff --git a/skins/monobook/main.css b/skins/monobook/main.css index 22058324c1..b63321fd6d 100644 --- a/skins/monobook/main.css +++ b/skins/monobook/main.css @@ -1513,6 +1513,29 @@ table.multipageimage td { text-align: center; } +/** Special:Version */ + +table#sv-ext, table#sv-hooks { + margin: 1em; + padding:0em; +} + +#sv-ext td, #sv-hooks td, +#sv-ext th, #sv-hooks th { + border: 1px solid #A0A0A0; + padding: 0 0.15em 0 0.15em; +} +#sv-ext th, #sv-hooks th { + background-color: #F0F0F0; + color: black; + padding: 0 0.15em 0 0.15em; +} +tr.sv-space{ + height: 0.8em; + border:none; +} +tr.sv-space td { display: none; } + /* Table pager (e.g. Special:Imagelist) - remove underlines from the navigation link @@ -1543,4 +1566,4 @@ table.multipageimage td { } #toolbar { clear: both; } -.mw-plusminus-null { color: #aaa; } \ No newline at end of file +.mw-plusminus-null { color: #aaa; } -- 2.20.1