Index: trunk/extensions/PatchOutputMobile/PatchOutputMobile.php |
— | — | @@ -2,8 +2,8 @@ |
3 | 3 | |
4 | 4 | # Needs to be called within MediaWiki; not standalone |
5 | 5 | if ( !defined('MEDIAWIKI') ) { |
6 | | - echo("This is an extension to the MediaWiki package and cannot be run standalone.\n" ); |
7 | | - die(-1); |
| 6 | + echo("This is an extension to the MediaWiki package and cannot be run standalone.\n" ); |
| 7 | + die(-1); |
8 | 8 | } |
9 | 9 | |
10 | 10 | # Define the extension; allows us make sure the extension is used correctly |
— | — | @@ -20,40 +20,40 @@ |
21 | 21 | $wgExtPatchOutputMobile = new ExtPatchOutputMobile(); |
22 | 22 | |
23 | 23 | $wgHooks['OutputPageBeforeHTML'][] = array(&$wgExtPatchOutputMobile, |
24 | | - 'onOutputPageBeforeHTML'); |
| 24 | + 'onOutputPageBeforeHTML'); |
25 | 25 | |
26 | 26 | class ExtPatchOutputMobile { |
27 | 27 | const VERSION = '0.2'; |
28 | 28 | |
29 | 29 | private $doc; |
30 | 30 | |
31 | | - public $items_to_remove = array("#contentSub", #redirection notice |
32 | | - "div.messagebox", #cleanup data |
33 | | - "#siteNotice", #site notice |
34 | | - "#siteSub", #"From Wikipedia..." |
35 | | - "#jump-to-nav", #jump-to-nav |
36 | | - "div.editsection", #edit blocks |
37 | | - "div.infobox", # Infoboxes in the article |
38 | | - "table.toc", #table of contents |
39 | | - "#catlinks", #category links |
40 | | - "div.stub", #stub warnings |
41 | | - "table.metadata", #ugly metadata |
42 | | - "form", |
43 | | - "div.sister-project", |
44 | | - "script", |
45 | | - "div.magnify", #stupid magnify thing |
46 | | - ".editsection", |
47 | | - "span.t", |
48 | | - 'sup[style*="help"]', |
49 | | - ".portal", |
50 | | - "#protected-icon", |
51 | | - ".printfooter", |
52 | | - ".boilerplate", |
53 | | - "#id-articulo-destacado", |
54 | | - "#coordinates", |
55 | | - "#top", |
56 | | - ".hiddenStructure", |
57 | | - ".noprint", |
| 31 | + public $items_to_remove = array("#contentSub", #redirection notice |
| 32 | + "div.messagebox", #cleanup data |
| 33 | + "#siteNotice", #site notice |
| 34 | + "#siteSub", #"From Wikipedia..." |
| 35 | + "#jump-to-nav", #jump-to-nav |
| 36 | + "div.editsection", #edit blocks |
| 37 | + "div.infobox", # Infoboxes in the article |
| 38 | + "table.toc", #table of contents |
| 39 | + "#catlinks", #category links |
| 40 | + "div.stub", #stub warnings |
| 41 | + "table.metadata", #ugly metadata |
| 42 | + "form", |
| 43 | + "div.sister-project", |
| 44 | + "script", |
| 45 | + "div.magnify", #stupid magnify thing |
| 46 | + ".editsection", |
| 47 | + "span.t", |
| 48 | + 'sup[style*="help"]', |
| 49 | + ".portal", |
| 50 | + "#protected-icon", |
| 51 | + ".printfooter", |
| 52 | + ".boilerplate", |
| 53 | + "#id-articulo-destacado", |
| 54 | + "#coordinates", |
| 55 | + "#top", |
| 56 | + ".hiddenStructure", |
| 57 | + ".noprint", |
58 | 58 | ".medialist", |
59 | 59 | ".mw-search-createlink"); |
60 | 60 | |
— | — | @@ -65,14 +65,14 @@ |
66 | 66 | private function _show_hide_callback($matches) { |
67 | 67 | static $headings = 0; |
68 | 68 | $show = "Show"; |
69 | | - $hide = "Hide"; |
70 | | - $back_to_top = "Jump Back A Section"; |
| 69 | + $hide = "Hide"; |
| 70 | + $back_to_top = "Jump Back A Section"; |
71 | 71 | ++$headings; |
72 | 72 | // Back to top link |
73 | | - $base = "<div class='section_anchors' id='anchor_" . intval($headings - 1) . "'><a href='#section_" . intval($headings - 1) . "' class='back_to_top'>↑ {$back_to_top}</a></div>"; |
74 | | - // generate the HTML we are going to inject |
75 | | - $buttons = "<button class='section_heading show' section_id='{$headings}'>{$show}</button><button class='section_heading hide' section_id='{$headings}'>{$hide}</button>"; |
76 | | - $base .= "<h2 class='section_heading' id='section_{$headings}'{$matches[1]}{$buttons} <span>{$matches[2]}</span></h2><div class='content_block' id='content_{$headings}'>"; |
| 73 | + $base = "<div class='section_anchors' id='anchor_" . intval($headings - 1) . "'><a href='#section_" . intval($headings - 1) . "' class='back_to_top'>↑ {$back_to_top}</a></div>"; |
| 74 | + // generate the HTML we are going to inject |
| 75 | + $buttons = "<button class='section_heading show' section_id='{$headings}'>{$show}</button><button class='section_heading hide' section_id='{$headings}'>{$hide}</button>"; |
| 76 | + $base .= "<h2 class='section_heading' id='section_{$headings}'{$matches[1]}{$buttons} <span>{$matches[2]}</span></h2><div class='content_block' id='content_{$headings}'>"; |
77 | 77 | |
78 | 78 | if ($headings > 1) { |
79 | 79 | // Close it up here |
— | — | @@ -98,7 +98,7 @@ |
99 | 99 | |
100 | 100 | public function parse($s) { |
101 | 101 | // foreach(self::$mTable as $from => $to) { |
102 | | - // $s =& str_replace( $from, $to, $s ); |
| 102 | + // $s =& str_replace( $from, $to, $s ); |
103 | 103 | // } |
104 | 104 | |
105 | 105 | return $this->DOMParse($s); |