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 |
1 | 16 | + native |
Added: svn:keywords |
2 | 17 | + Id |
Index: trunk/extensions/uniwiki/CssHooks/CssHooks.php |
— | — | @@ -3,7 +3,7 @@ |
4 | 4 | * http://www.mediawiki.org/wiki/Extension:Uniwiki_CSS_Hooks |
5 | 5 | * http://www.gnu.org/licenses/gpl-3.0.txt */ |
6 | 6 | |
7 | | -if (!defined("MEDIAWIKI")) |
| 7 | +if ( !defined( "MEDIAWIKI" ) ) |
8 | 8 | die(); |
9 | 9 | |
10 | 10 | /* ---- CREDITS ---- */ |
— | — | @@ -12,36 +12,40 @@ |
13 | 13 | 'name' => "Uniwiki CSS Hooks", |
14 | 14 | 'author' => "Merrick Schaefer, Mark Johnston, Evan Wheeler and Adam Mckaig (at UNICEF)", |
15 | 15 | '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', |
16 | 20 | ); |
17 | 21 | |
18 | 22 | /* ---- HOOKS ---- */ |
| 23 | +$wgHooks['OutputPageBeforeHTML'][] = 'UW_CssHooks_AddHooks'; |
19 | 24 | |
20 | | -$wgHooks['OutputPageBeforeHTML'][] = 'UW_CssHooks_AddHooks'; |
21 | | -function UW_CssHooks_AddHooks (&$out, &$text) { |
| 25 | +function UW_CssHooks_AddHooks ( &$out, &$text ) { |
22 | 26 | global $wgRequest; |
23 | 27 | |
24 | 28 | // 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 ); |
27 | 31 | |
28 | 32 | // remove the first empty section |
29 | | - if ($sections[0] == "") |
30 | | - array_shift ($sections); |
| 33 | + if ( $sections[0] == "" ) |
| 34 | + array_shift ( $sections ); |
31 | 35 | |
32 | 36 | $index = 0; |
33 | 37 | $output = ''; |
34 | 38 | $div_open = false; |
35 | | - for ($i=0; $i<count ($sections); $i++) { |
| 39 | + for ( $i = 0; $i < count ( $sections ); $i++ ) { |
36 | 40 | |
37 | 41 | /* is this block of text a header? (check for mw-headline |
38 | 42 | * 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 ) { |
41 | 45 | $index++; |
42 | 46 | |
43 | 47 | /* close current section div, if one exists, |
44 | 48 | * and always open a new one with hooks */ |
45 | | - if ($div_open) $output .= "</div>"; |
| 49 | + if ( $div_open ) $output .= "</div>"; |
46 | 50 | $output .= "<div class=\"uw-section sect-$index\">"; |
47 | 51 | $div_open = true; |
48 | 52 | } |
— | — | @@ -51,7 +55,7 @@ |
52 | 56 | $output .= $sections[$i]; |
53 | 57 | |
54 | 58 | // close the last section, if one is open |
55 | | - if (($i==count ($sections)-1) && $div_open) |
| 59 | + if ( ( $i == count ( $sections ) - 1 ) && $div_open ) |
56 | 60 | $output .= "</div>"; |
57 | 61 | } |
58 | 62 | |
Property changes on: trunk/extensions/uniwiki/CssHooks/CssHooks.php |
___________________________________________________________________ |
Added: svn:keywords |
59 | 63 | + LastChangedDate LastChangedRevision |