r83026 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r83025‎ | r83026 | r83027 >
Date:18:17, 1 March 2011
Author:mah
Status:ok
Tags:
Comment:
whitespace cleanup, 'svn diff -x-w' is clean.
Modified paths:
  • /trunk/extensions/SelectCategory/SelectCategoryFunctions.php (modified) (history)
  • /trunk/extensions/SelectCategory/jquery.treeview.css (modified) (history)
  • /trunk/extensions/SelectCategory/jquery.treeview.js (modified) (history)

Diff [purge]

Index: trunk/extensions/SelectCategory/jquery.treeview.css
@@ -1,4 +1,4 @@
2 -.treeview, .treeview ul {
 2+.treeview, .treeview ul {
33 padding: 0;
44 margin: 0;
55 list-style: none;
@@ -23,7 +23,7 @@
2424 float:none;
2525 }
2626
27 -.treeview li {
 27+.treeview li {
2828 margin: 0;
2929 padding: 3px 0pt 3px 16px;
3030 }
@@ -42,23 +42,23 @@
4343 .treeview .expandable-hitarea { background-position: -80px -3px; }
4444
4545 .treeview li.last { background-position: 0 -1766px }
46 -.treeview li.lastCollapsable, .treeview li.lastExpandable { background-image: url(images/treeview-default.gif); }
 46+.treeview li.lastCollapsable, .treeview li.lastExpandable { background-image: url(images/treeview-default.gif); }
4747 .treeview li.lastCollapsable { background-position: 0 -111px }
4848 .treeview li.lastExpandable { background-position: -32px -67px }
4949
5050 .treeview div.lastCollapsable-hitarea, .treeview div.lastExpandable-hitarea { background-position: 0; }
5151
5252 .treeview-red li { background-image: url(images/treeview-red-line.gif); }
53 -.treeview-red .hitarea, .treeview-red li.lastCollapsable, .treeview-red li.lastExpandable { background-image: url(images/treeview-red.gif); }
 53+.treeview-red .hitarea, .treeview-red li.lastCollapsable, .treeview-red li.lastExpandable { background-image: url(images/treeview-red.gif); }
5454
5555 .treeview-black li { background-image: url(images/treeview-black-line.gif); }
56 -.treeview-black .hitarea, .treeview-black li.lastCollapsable, .treeview-black li.lastExpandable { background-image: url(images/treeview-black.gif); }
 56+.treeview-black .hitarea, .treeview-black li.lastCollapsable, .treeview-black li.lastExpandable { background-image: url(images/treeview-black.gif); }
5757
5858 .treeview-gray li { background-image: url(images/treeview-gray-line.gif); }
59 -.treeview-gray .hitarea, .treeview-gray li.lastCollapsable, .treeview-gray li.lastExpandable { background-image: url(images/treeview-gray.gif); }
 59+.treeview-gray .hitarea, .treeview-gray li.lastCollapsable, .treeview-gray li.lastExpandable { background-image: url(images/treeview-gray.gif); }
6060
6161 .treeview-famfamfam li { background-image: url(images/treeview-famfamfam-line.gif); }
62 -.treeview-famfamfam .hitarea, .treeview-famfamfam li.lastCollapsable, .treeview-famfamfam li.lastExpandable { background-image: url(images/treeview-famfamfam.gif); }
 62+.treeview-famfamfam .hitarea, .treeview-famfamfam li.lastCollapsable, .treeview-famfamfam li.lastExpandable { background-image: url(images/treeview-famfamfam.gif); }
6363
6464 .treeview .placeholder {
6565 background: url(images/ajax-loader.gif) 0 0 no-repeat;
Index: trunk/extensions/SelectCategory/jquery.treeview.js
@@ -1,6 +1,6 @@
22 /*
33 * Treeview 1.4.1 - jQuery plugin to hide and show branches of a tree
4 - *
 4+ *
55 * http://bassistance.de/jquery-plugins/jquery-plugin-treeview/
66 * http://docs.jquery.com/Plugins/Treeview
77 *
@@ -50,7 +50,7 @@
5151 } else {
5252 this.hide();
5353 if (callback)
54 - this.each(callback);
 54+ this.each(callback);
5555 }
5656 },
5757 prepareBranches: function(settings) {
@@ -70,18 +70,18 @@
7171 if ( this == event.target )
7272 toggler.apply($j(this).next());
7373 }).add( $j("a", this) ).hoverClass();
74 -
 74+
7575 if (!settings.prerendered) {
7676 // handle closed ones first
7777 this.filter(":has(>ul:hidden)")
7878 .addClass(CLASSES.expandable)
7979 .replaceClass(CLASSES.last, CLASSES.lastExpandable);
80 -
 80+
8181 // handle open ones
8282 this.not(":has(>ul:hidden)")
8383 .addClass(CLASSES.collapsable)
8484 .replaceClass(CLASSES.last, CLASSES.lastCollapsable);
85 -
 85+
8686 // create hitarea if not present
8787 var hitarea = this.find("div." + CLASSES.hitarea);
8888 if (!hitarea.length)
@@ -94,23 +94,23 @@
9595 $j(this).addClass( classes );
9696 })
9797 }
98 -
 98+
9999 // apply event to hitarea
100100 this.find("div." + CLASSES.hitarea).click( toggler );
101101 },
102102 treeview: function(settings) {
103 -
 103+
104104 settings = $j.extend({
105105 cookieId: "treeview"
106106 }, settings);
107 -
 107+
108108 if ( settings.toggle ) {
109109 var callback = settings.toggle;
110110 settings.toggle = function() {
111111 return callback.apply($j(this).parent()[0], arguments);
112112 };
113113 }
114 -
 114+
115115 // factory for treecontroller
116116 function treeController(tree, control) {
117117 // factory for click handlers
@@ -130,9 +130,9 @@
131131 // click on second to expand tree
132132 $j("a:eq(1)", control).click( handler(CLASSES.expandable) );
133133 // click on third to toggle tree
134 - $j("a:eq(2)", control).click( handler() );
 134+ $j("a:eq(2)", control).click( handler() );
135135 }
136 -
 136+
137137 // handle toggle event
138138 function toggler() {
139139 $j(this)
@@ -164,7 +164,7 @@
165165 }
166166 }
167167 this.data("toggler", toggler);
168 -
 168+
169169 function serialize() {
170170 function binary(arg) {
171171 return arg ? 1 : 0;
@@ -175,7 +175,7 @@
176176 });
177177 $j.cookie(settings.cookieId, data.join(""), settings.cookieOptions );
178178 }
179 -
 179+
180180 function deserialize() {
181181 var stored = $j.cookie(settings.cookieId);
182182 if ( stored ) {
@@ -185,13 +185,13 @@
186186 });
187187 }
188188 }
189 -
 189+
190190 // add treeview class to activate styles
191191 this.addClass("treeview");
192 -
 192+
193193 // prepare branches and find all tree items with child lists
194194 var branches = this.find("li").prepareBranches(settings);
195 -
 195+
196196 switch(settings.persist) {
197197 case "cookie":
198198 var toggleCallback = settings.toggle;
@@ -222,19 +222,19 @@
223223 }
224224 break;
225225 }
226 -
 226+
227227 branches.applyClasses(settings, toggler);
228 -
 228+
229229 // if control option is set, create the treecontroller and show it
230230 if ( settings.control ) {
231231 treeController(this, settings.control);
232232 $j(settings.control).show();
233233 }
234 -
 234+
235235 return this;
236236 }
237237 });
238 -
 238+
239239 // classes used by the plugin
240240 // need to be styled via external stylesheet, see first example
241241 $j.treeview = {};
@@ -252,5 +252,5 @@
253253 last: "last",
254254 hitarea: "hitarea"
255255 });
256 -
257 -})(jQuery);
\ No newline at end of file
 256+
 257+})(jQuery);
Index: trunk/extensions/SelectCategory/SelectCategoryFunctions.php
@@ -22,100 +22,100 @@
2323
2424 # check if we should do anything or sleep
2525 if ( fnSelectCategoryCheckConditions( $m_isUpload, $m_pageObj ) ) {
26 - # Register CSS file for our select box:
27 - global $wgOut, $wgScriptPath, $wgUser, $wgTitle;
28 - global $wgSelectCategoryMaxLevel;
29 -
30 - $wgOut->addLink(
31 - array(
32 - 'rel' => 'stylesheet',
33 - 'type' => 'text/css',
34 - 'href' => $wgScriptPath.'/extensions/SelectCategory/SelectCategory.css'
35 - )
36 - );
37 - $wgOut->addLink(
38 - array(
39 - 'rel' => 'stylesheet',
40 - 'type' => 'text/css',
41 - 'href' => $wgScriptPath.'/extensions/SelectCategory/jquery.treeview.css'
42 - )
43 - );
44 - $wgOut->addScript( '<script src="'.$wgScriptPath.'/extensions/SelectCategory/jquery.treeview.js" type="text/javascript"></script>' );
45 - $wgOut->addScript( '<script src="'.$wgScriptPath.'/extensions/SelectCategory/SelectCategory.js" type="text/javascript"></script>' );
46 -
47 - $m_skin =& $wgUser->getSkin();
48 -
49 - # Get all categories from wiki:
50 - $m_allCats = fnSelectCategoryGetAllCategories();
51 - # Load system messages:
52 - wfLoadExtensionMessages( 'SelectCategory' );
53 - # Get the right member variables, depending on if we're on an upload form or not:
54 - if( !$m_isUpload ) {
55 - # Extract all categorylinks from page:
56 - $m_pageCats = fnSelectCategoryGetPageCategories( $m_pageObj );
 26+ # Register CSS file for our select box:
 27+ global $wgOut, $wgScriptPath, $wgUser, $wgTitle;
 28+ global $wgSelectCategoryMaxLevel;
5729
58 - # Never ever use editFormTextTop here as it resides outside the <form> so we will never get contents
59 - $m_place = 'editFormTextAfterWarn';
60 - # Print the localised title for the select box:
61 - $m_textBefore = '<b>'. wfMsg( 'selectcategory-title' ) . '</b>:';
62 - } else {
63 - # No need to get categories:
64 - $m_pageCats = array();
 30+ $wgOut->addLink(
 31+ array(
 32+ 'rel' => 'stylesheet',
 33+ 'type' => 'text/css',
 34+ 'href' => $wgScriptPath.'/extensions/SelectCategory/SelectCategory.css'
 35+ )
 36+ );
 37+ $wgOut->addLink(
 38+ array(
 39+ 'rel' => 'stylesheet',
 40+ 'type' => 'text/css',
 41+ 'href' => $wgScriptPath.'/extensions/SelectCategory/jquery.treeview.css'
 42+ )
 43+ );
 44+ $wgOut->addScript( '<script src="'.$wgScriptPath.'/extensions/SelectCategory/jquery.treeview.js" type="text/javascript"></script>' );
 45+ $wgOut->addScript( '<script src="'.$wgScriptPath.'/extensions/SelectCategory/SelectCategory.js" type="text/javascript"></script>' );
6546
66 - # Place output at the right place:
67 - $m_place = 'uploadFormTextAfterSummary';
68 - # Print the part of the table including the localised title for the select box:
69 - $m_textBefore = "\n</td></tr><tr><td align='right'><label for='wpSelectCategory'>" . wfMsg( 'selectcategory-title' ) .":</label></td><td align='left'>";
70 - }
71 - # Introduce the output:
72 - $m_pageObj->$m_place .= "<!-- SelectCategory begin -->\n";
73 - # Print the select box:
74 - $m_pageObj->$m_place .= "\n$m_textBefore";
 47+ $m_skin =& $wgUser->getSkin();
7548
76 - # Begin list output, use <div> to enable custom formatting
77 - $m_level = 0;
78 - $m_pageObj->$m_place .= '<ul id="SelectCategoryList">';
79 - foreach( $m_allCats as $m_cat => $m_depth ) {
80 - $checked = '';
81 - # See if the category was already added, so check it
82 - if( isset( $m_pageCats[$m_cat] ) ) {
83 - $checked = 'checked="checked"';
84 - }
85 - # Clean HTML Output:
86 - $category = htmlspecialchars( $m_cat );
 49+ # Get all categories from wiki:
 50+ $m_allCats = fnSelectCategoryGetAllCategories();
 51+ # Load system messages:
 52+ wfLoadExtensionMessages( 'SelectCategory' );
 53+ # Get the right member variables, depending on if we're on an upload form or not:
 54+ if( !$m_isUpload ) {
 55+ # Extract all categorylinks from page:
 56+ $m_pageCats = fnSelectCategoryGetPageCategories( $m_pageObj );
8757
88 - # iterate through levels and adjust divs accordingly
89 - while( $m_level < $m_depth ) {
90 - # Collapse subcategories after reaching the configured MaxLevel
91 - if( $m_level >= ( $wgSelectCategoryMaxLevel - 1 ) ) {
92 - $m_class = 'display:none;';
93 - } else {
94 - $m_class = 'display:block;';
95 - }
96 - $m_pageObj->$m_place .= '<ul style="'.$m_class.'">'."\n";
97 - $m_level++;
98 - }
99 - if( $m_level == $m_depth ) $m_pageObj->$m_place .= '</li>'."\n";
100 - while( $m_level > $m_depth ) {
101 - $m_pageObj->$m_place .= '</ul></li>'."\n";
102 - $m_level--;
103 - }
104 - # Clean names for text output
105 - $title = str_replace( '_', ' ', $category );
106 - $m_title = $wgTitle->newFromText( $category, NS_CATEGORY );
107 - # Output the actual checkboxes, indented
108 - $m_pageObj->$m_place .= '<li><input type="checkbox" name="SelectCategoryList[]" value="'.$category.'" class="checkbox" '.$checked.' />'.$m_skin->link( $m_title, $title )."\n";
109 - # set id for next level
110 - $m_level_id = 'sc_'.$m_cat;
111 - } # End walking through cats (foreach)
112 - # End of list output - close all remaining divs
113 - while( $m_level > -1 ) {
114 - $m_pageObj->$m_place .= '</li></ul>'."\n";
115 - $m_level--;
116 - }
 58+ # Never ever use editFormTextTop here as it resides outside the <form> so we will never get contents
 59+ $m_place = 'editFormTextAfterWarn';
 60+ # Print the localised title for the select box:
 61+ $m_textBefore = '<b>'. wfMsg( 'selectcategory-title' ) . '</b>:';
 62+ } else {
 63+ # No need to get categories:
 64+ $m_pageCats = array();
11765
118 - # Print localised help string:
119 - $m_pageObj->$m_place .= "<!-- SelectCategory end -->\n";
 66+ # Place output at the right place:
 67+ $m_place = 'uploadFormTextAfterSummary';
 68+ # Print the part of the table including the localised title for the select box:
 69+ $m_textBefore = "\n</td></tr><tr><td align='right'><label for='wpSelectCategory'>" . wfMsg( 'selectcategory-title' ) .":</label></td><td align='left'>";
 70+ }
 71+ # Introduce the output:
 72+ $m_pageObj->$m_place .= "<!-- SelectCategory begin -->\n";
 73+ # Print the select box:
 74+ $m_pageObj->$m_place .= "\n$m_textBefore";
 75+
 76+ # Begin list output, use <div> to enable custom formatting
 77+ $m_level = 0;
 78+ $m_pageObj->$m_place .= '<ul id="SelectCategoryList">';
 79+ foreach( $m_allCats as $m_cat => $m_depth ) {
 80+ $checked = '';
 81+ # See if the category was already added, so check it
 82+ if( isset( $m_pageCats[$m_cat] ) ) {
 83+ $checked = 'checked="checked"';
 84+ }
 85+ # Clean HTML Output:
 86+ $category = htmlspecialchars( $m_cat );
 87+
 88+ # iterate through levels and adjust divs accordingly
 89+ while( $m_level < $m_depth ) {
 90+ # Collapse subcategories after reaching the configured MaxLevel
 91+ if( $m_level >= ( $wgSelectCategoryMaxLevel - 1 ) ) {
 92+ $m_class = 'display:none;';
 93+ } else {
 94+ $m_class = 'display:block;';
 95+ }
 96+ $m_pageObj->$m_place .= '<ul style="'.$m_class.'">'."\n";
 97+ $m_level++;
 98+ }
 99+ if( $m_level == $m_depth ) $m_pageObj->$m_place .= '</li>'."\n";
 100+ while( $m_level > $m_depth ) {
 101+ $m_pageObj->$m_place .= '</ul></li>'."\n";
 102+ $m_level--;
 103+ }
 104+ # Clean names for text output
 105+ $title = str_replace( '_', ' ', $category );
 106+ $m_title = $wgTitle->newFromText( $category, NS_CATEGORY );
 107+ # Output the actual checkboxes, indented
 108+ $m_pageObj->$m_place .= '<li><input type="checkbox" name="SelectCategoryList[]" value="'.$category.'" class="checkbox" '.$checked.' />'.$m_skin->link( $m_title, $title )."\n";
 109+ # set id for next level
 110+ $m_level_id = 'sc_'.$m_cat;
 111+ } # End walking through cats (foreach)
 112+ # End of list output - close all remaining divs
 113+ while( $m_level > -1 ) {
 114+ $m_pageObj->$m_place .= '</li></ul>'."\n";
 115+ $m_level--;
 116+ }
 117+
 118+ # Print localised help string:
 119+ $m_pageObj->$m_place .= "<!-- SelectCategory end -->\n";
120120 }
121121
122122 # Return true to let the rest work:
@@ -130,32 +130,32 @@
131131 # check if we should do anything or sleep
132132 if ( fnSelectCategoryCheckConditions( $m_isUpload, $m_pageObj ) ) {
133133
134 - # Get localised namespace string:
135 - $m_catString = $wgContLang->getNsText( NS_CATEGORY );
 134+ # Get localised namespace string:
 135+ $m_catString = $wgContLang->getNsText( NS_CATEGORY );
136136
137 - # default sort key is page name with stripped namespace name,
138 - # otherwise sorting is ugly.
139 - if( $wgTitle->getNamespace() == NS_MAIN ) {
140 - $default_sortkey = "";
141 - } else {
142 - $default_sortkey = "|{{PAGENAME}}";
143 - }
 137+ # default sort key is page name with stripped namespace name,
 138+ # otherwise sorting is ugly.
 139+ if( $wgTitle->getNamespace() == NS_MAIN ) {
 140+ $default_sortkey = "";
 141+ } else {
 142+ $default_sortkey = "|{{PAGENAME}}";
 143+ }
144144
145 - # Get some distance from the rest of the content:
146 - $m_text = "\n";
 145+ # Get some distance from the rest of the content:
 146+ $m_text = "\n";
147147
148 - # Iterate through all selected category entries:
149 - if (array_key_exists('SelectCategoryList', $_POST)) {
150 - foreach( $_POST['SelectCategoryList'] as $m_cat ) {
151 - $m_text .= "\n[[$m_catString:$m_cat$default_sortkey]]";
152 - }
153 - }
154 - # If it is an upload we have to call a different method:
155 - if ( $m_isUpload ) {
156 - $m_pageObj->mUploadDescription .= $m_text;
157 - } else{
158 - $m_pageObj->textbox1 .= $m_text;
159 - }
 148+ # Iterate through all selected category entries:
 149+ if (array_key_exists('SelectCategoryList', $_POST)) {
 150+ foreach( $_POST['SelectCategoryList'] as $m_cat ) {
 151+ $m_text .= "\n[[$m_catString:$m_cat$default_sortkey]]";
 152+ }
 153+ }
 154+ # If it is an upload we have to call a different method:
 155+ if ( $m_isUpload ) {
 156+ $m_pageObj->mUploadDescription .= $m_text;
 157+ } else{
 158+ $m_pageObj->textbox1 .= $m_text;
 159+ }
160160 }
161161
162162 # Return to the let MediaWiki do the rest of the work:
@@ -175,33 +175,33 @@
176176 # Get current namespace (save duplicate call of method):
177177 $m_namespace = $wgTitle->getNamespace();
178178 if( $m_namespace >= 0 && $wgSelectCategoryRoot[$m_namespace] ) {
179 - # Include root and step into the recursion:
180 - $m_allCats = array_merge( array( $wgSelectCategoryRoot[$m_namespace] => 0 ), fnSelectCategoryGetChildren( $wgSelectCategoryRoot[$m_namespace] ) );
 179+ # Include root and step into the recursion:
 180+ $m_allCats = array_merge( array( $wgSelectCategoryRoot[$m_namespace] => 0 ), fnSelectCategoryGetChildren( $wgSelectCategoryRoot[$m_namespace] ) );
181181 } else {
182 - # Initialize return value:
183 - $m_allCats = array();
 182+ # Initialize return value:
 183+ $m_allCats = array();
184184
185 - # Get a database object:
186 - $m_dbObj = wfGetDB( DB_SLAVE );
187 - # Get table names to access them in SQL query:
188 - $m_tblCatLink = $m_dbObj->tableName( 'categorylinks' );
189 - $m_tblPage = $m_dbObj->tableName( 'page' );
 185+ # Get a database object:
 186+ $m_dbObj = wfGetDB( DB_SLAVE );
 187+ # Get table names to access them in SQL query:
 188+ $m_tblCatLink = $m_dbObj->tableName( 'categorylinks' );
 189+ $m_tblPage = $m_dbObj->tableName( 'page' );
190190
191 - # Automagically detect root categories:
192 - $m_sql = " SELECT tmpSelectCat1.cl_to AS title
193 - FROM $m_tblCatLink AS tmpSelectCat1
194 - LEFT JOIN $m_tblPage AS tmpSelectCatPage ON (tmpSelectCat1.cl_to = tmpSelectCatPage.page_title AND tmpSelectCatPage.page_namespace = 14)
195 - LEFT JOIN $m_tblCatLink AS tmpSelectCat2 ON tmpSelectCatPage.page_id = tmpSelectCat2.cl_from
196 - WHERE tmpSelectCat2.cl_from IS NULL GROUP BY tmpSelectCat1.cl_to";
197 - # Run the query:
198 - $m_res = $m_dbObj->query( $m_sql, __METHOD__ );
199 - # Process the resulting rows:
200 - while ( $m_row = $m_dbObj->fetchRow( $m_res ) ) {
201 - $m_allCats += array( $m_row['title'] => 0 );
202 - $m_allCats += fnSelectCategoryGetChildren( $m_row['title'] );
203 - }
204 - # Free result:
205 - $m_dbObj->freeResult( $m_res );
 191+ # Automagically detect root categories:
 192+ $m_sql = " SELECT tmpSelectCat1.cl_to AS title
 193+ FROM $m_tblCatLink AS tmpSelectCat1
 194+ LEFT JOIN $m_tblPage AS tmpSelectCatPage ON (tmpSelectCat1.cl_to = tmpSelectCatPage.page_title AND tmpSelectCatPage.page_namespace = 14)
 195+ LEFT JOIN $m_tblCatLink AS tmpSelectCat2 ON tmpSelectCatPage.page_id = tmpSelectCat2.cl_from
 196+ WHERE tmpSelectCat2.cl_from IS NULL GROUP BY tmpSelectCat1.cl_to";
 197+ # Run the query:
 198+ $m_res = $m_dbObj->query( $m_sql, __METHOD__ );
 199+ # Process the resulting rows:
 200+ while ( $m_row = $m_dbObj->fetchRow( $m_res ) ) {
 201+ $m_allCats += array( $m_row['title'] => 0 );
 202+ $m_allCats += fnSelectCategoryGetChildren( $m_row['title'] );
 203+ }
 204+ # Free result:
 205+ $m_dbObj->freeResult( $m_res );
206206 }
207207
208208 # Afterwards return the array to the caller:
@@ -220,24 +220,24 @@
221221
222222 # The normal query to get all children of a given root category:
223223 $m_sql = '
224 - SELECT tmpSelectCatPage.page_title AS title
225 - FROM '.$m_tblCatLink.' AS tmpSelectCat
226 - LEFT JOIN '.$m_tblPage.' AS tmpSelectCatPage
227 - ON tmpSelectCat.cl_from = tmpSelectCatPage.page_id
228 - WHERE tmpSelectCat.cl_to LIKE '.$m_dbObj->addQuotes( $m_root ).'
229 - AND tmpSelectCatPage.page_namespace = 14
230 - ORDER BY tmpSelectCatPage.page_title ASC;';
 224+ SELECT tmpSelectCatPage.page_title AS title
 225+ FROM '.$m_tblCatLink.' AS tmpSelectCat
 226+ LEFT JOIN '.$m_tblPage.' AS tmpSelectCatPage
 227+ ON tmpSelectCat.cl_from = tmpSelectCatPage.page_id
 228+ WHERE tmpSelectCat.cl_to LIKE '.$m_dbObj->addQuotes( $m_root ).'
 229+ AND tmpSelectCatPage.page_namespace = 14
 230+ ORDER BY tmpSelectCatPage.page_title ASC;';
231231 # Run the query:
232232 $m_res = $m_dbObj->query( $m_sql, __METHOD__ );
233233 # Process the resulting rows:
234234 while ( $m_row = $m_dbObj->fetchRow( $m_res ) ) {
235 - # Survive category link loops:
236 - if( $m_root == $m_row['title'] ) {
237 - continue;
238 - }
239 - # Add current entry to array:
240 - $m_allCats += array( $m_row['title'] => $m_depth );
241 - $m_allCats += fnSelectCategoryGetChildren( $m_row['title'], $m_depth + 1 );
 235+ # Survive category link loops:
 236+ if( $m_root == $m_row['title'] ) {
 237+ continue;
 238+ }
 239+ # Add current entry to array:
 240+ $m_allCats += array( $m_row['title'] => $m_depth );
 241+ $m_allCats += fnSelectCategoryGetChildren( $m_row['title'], $m_depth + 1 );
242242 }
243243 # Free result:
244244 $m_dbObj->freeResult( $m_res );
@@ -251,13 +251,13 @@
252252 function fnSelectCategoryGetPageCategories( $m_pageObj ) {
253253
254254 if (array_key_exists('SelectCategoryList', $_POST)) {
255 - # We have already extracted the categories, return them instead
256 - # of extracting zero categories from the page text.
257 - $m_catLinks = array();
258 - foreach( $_POST['SelectCategoryList'] as $m_cat ) {
259 - $m_catLinks[ $m_cat ] = true;
260 - }
261 - return $m_catLinks;
 255+ # We have already extracted the categories, return them instead
 256+ # of extracting zero categories from the page text.
 257+ $m_catLinks = array();
 258+ foreach( $_POST['SelectCategoryList'] as $m_cat ) {
 259+ $m_catLinks[ $m_cat ] = true;
 260+ }
 261+ return $m_catLinks;
262262 }
263263
264264 global $wgContLang;
@@ -276,12 +276,12 @@
277277
278278 # Check linewise for category links:
279279 foreach( explode( "\n", $m_pageText ) as $m_textLine ) {
280 - # Filter line through pattern and store the result:
281 - $m_cleanText .= preg_replace( "/{$m_pattern}/i", "", $m_textLine ) . "\n";
282 - # Check if we have found a category, else proceed with next line:
283 - if( !preg_match( "/{$m_pattern}/i", $m_textLine) ) continue;
284 - # Get the category link from the original text and store it in our list:
285 - $m_catLinks[ str_replace( ' ', '_', preg_replace( "/.*{$m_pattern}/i", $m_replace, $m_textLine ) ) ] = true;
 280+ # Filter line through pattern and store the result:
 281+ $m_cleanText .= preg_replace( "/{$m_pattern}/i", "", $m_textLine ) . "\n";
 282+ # Check if we have found a category, else proceed with next line:
 283+ if( !preg_match( "/{$m_pattern}/i", $m_textLine) ) continue;
 284+ # Get the category link from the original text and store it in our list:
 285+ $m_catLinks[ str_replace( ' ', '_', preg_replace( "/.*{$m_pattern}/i", $m_replace, $m_textLine ) ) ] = true;
286286 }
287287 # Place the cleaned text into the text box:
288288 $m_pageObj->textbox1 = trim( $m_cleanText );
@@ -302,23 +302,23 @@
303303 # implication in PHP) but not if we do a sectionedit:
304304
305305 if ($m_isUpload == true) {
306 - return true;
 306+ return true;
307307 }
308308
309309 $ns = $wgTitle->getNamespace();
310310 if( array_key_exists( $ns, $wgSelectCategoryNamespaces ) ) {
311 - $enabledForNamespace = $wgSelectCategoryNamespaces[$ns];
 311+ $enabledForNamespace = $wgSelectCategoryNamespaces[$ns];
312312 } else {
313 - $enabledForNamespace = false;
 313+ $enabledForNamespace = false;
314314 }
315315
316316 # Check if page is subpage once to save method calls below:
317317 $m_isSubpage = $wgTitle->isSubpage();
318318
319319 if ($enabledForNamespace
320 - && (!$m_isSubpage
321 - || $m_isSubpage && $wgSelectCategoryEnableSubpage)
322 - && $m_pageObj->section == false) {
323 - return true;
 320+ && (!$m_isSubpage
 321+ || $m_isSubpage && $wgSelectCategoryEnableSubpage)
 322+ && $m_pageObj->section == false) {
 323+ return true;
324324 }
325325 }

Status & tagging log