r43036 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r43035‎ | r43036 | r43037 >
Date:21:58, 1 November 2008
Author:siebrand
Status:old
Tags:
Comment:
Update for uniwiki/CssHooks:
* complete extension credits
* update indentation, remove trailing whitespace, stylize.php
Modified paths:
  • /trunk/extensions/uniwiki/CssHooks/CssHooks.i18n.php (added) (history)
  • /trunk/extensions/uniwiki/CssHooks/CssHooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/uniwiki/CssHooks/CssHooks.i18n.php
@@ -0,0 +1,14 @@
 2+<?php
 3+/**
 4+ * Internationalisation for Uniwiki/CssHooks extension
 5+ *
 6+ * @file
 7+ * @ingroup Extensions
 8+ */
 9+
 10+$messages = array();
 11+
 12+/** English */
 13+$messages['en'] = array(
 14+ 'csshooks-desc' => 'Adds CSS to the HTML output of pages for better styling',
 15+);
Property changes on: trunk/extensions/uniwiki/CssHooks/CssHooks.i18n.php
___________________________________________________________________
Added: svn:eol-style
116 + native
Added: svn:keywords
217 + Id
Index: trunk/extensions/uniwiki/CssHooks/CssHooks.php
@@ -3,7 +3,7 @@
44 * http://www.mediawiki.org/wiki/Extension:Uniwiki_CSS_Hooks
55 * http://www.gnu.org/licenses/gpl-3.0.txt */
66
7 -if (!defined("MEDIAWIKI"))
 7+if ( !defined( "MEDIAWIKI" ) )
88 die();
99
1010 /* ---- CREDITS ---- */
@@ -12,36 +12,40 @@
1313 'name' => "Uniwiki CSS Hooks",
1414 'author' => "Merrick Schaefer, Mark Johnston, Evan Wheeler and Adam Mckaig (at UNICEF)",
1515 'description' => "Add some CSS hooks to the HTML output of articles, for better styling"
 16+ 'url' => 'http://www.mediawiki.org/wiki/Extension:Uniwiki_CSS_Hooks',
 17+ 'svn-date' => '$LastChangedDate$',
 18+ 'svn-revision' => '$LastChangedRevision$',
 19+ 'descriptionmsg' => 'csshooks-desc',
1620 );
1721
1822 /* ---- HOOKS ---- */
 23+$wgHooks['OutputPageBeforeHTML'][] = 'UW_CssHooks_AddHooks';
1924
20 -$wgHooks['OutputPageBeforeHTML'][] = 'UW_CssHooks_AddHooks';
21 -function UW_CssHooks_AddHooks (&$out, &$text) {
 25+function UW_CssHooks_AddHooks ( &$out, &$text ) {
2226 global $wgRequest;
2327
2428 // break the page into sections via their <h2>s
25 - $sections = preg_split ("/(<a name=\".+?\"><\/a><h2>.+?<\/h2>)/",
26 - $text, -1, PREG_SPLIT_DELIM_CAPTURE);
 29+ $sections = preg_split ( "/(<a name=\".+?\"><\/a><h2>.+?<\/h2>)/",
 30+ $text, -1, PREG_SPLIT_DELIM_CAPTURE );
2731
2832 // remove the first empty section
29 - if ($sections[0] == "")
30 - array_shift ($sections);
 33+ if ( $sections[0] == "" )
 34+ array_shift ( $sections );
3135
3236 $index = 0;
3337 $output = '';
3438 $div_open = false;
35 - for ($i=0; $i<count ($sections); $i++) {
 39+ for ( $i = 0; $i < count ( $sections ); $i++ ) {
3640
3741 /* is this block of text a header? (check for mw-headline
3842 * to only include actual section headers, and dodge toc) */
39 - if (substr ($sections[$i], 0, 7) == "<a name") {
40 - if (strstr ($sections[$i], "<span class=\"mw-headline\">") !== false) {
 43+ if ( substr ( $sections[$i], 0, 7 ) == "<a name" ) {
 44+ if ( strstr ( $sections[$i], "<span class=\"mw-headline\">" ) !== false ) {
4145 $index++;
4246
4347 /* close current section div, if one exists,
4448 * and always open a new one with hooks */
45 - if ($div_open) $output .= "</div>";
 49+ if ( $div_open ) $output .= "</div>";
4650 $output .= "<div class=\"uw-section sect-$index\">";
4751 $div_open = true;
4852 }
@@ -51,7 +55,7 @@
5256 $output .= $sections[$i];
5357
5458 // close the last section, if one is open
55 - if (($i==count ($sections)-1) && $div_open)
 59+ if ( ( $i == count ( $sections ) - 1 ) && $div_open )
5660 $output .= "</div>";
5761 }
5862
Property changes on: trunk/extensions/uniwiki/CssHooks/CssHooks.php
___________________________________________________________________
Added: svn:keywords
5963 + LastChangedDate LastChangedRevision

Status & tagging log