Index: trunk/extensions/SemanticDrilldown/includes/SD_Utils.inc |
— | — | @@ -5,7 +5,7 @@ |
6 | 6 | * @author Yaron Koren |
7 | 7 | */ |
8 | 8 | |
9 | | -if (!defined('MEDIAWIKI')) die(); |
| 9 | +if ( !defined( 'MEDIAWIKI' ) ) die(); |
10 | 10 | |
11 | 11 | class SDUtils { |
12 | 12 | |
— | — | @@ -15,81 +15,81 @@ |
16 | 16 | * and excludes, categories that are manually set with |
17 | 17 | * 'SHOWINDRILLDOWN' and 'HIDEFROMDRILLDOWN', respectively. |
18 | 18 | */ |
19 | | - function getTopLevelCategories() { |
| 19 | + static function getTopLevelCategories() { |
20 | 20 | $categories = array(); |
21 | 21 | $dbr = wfGetDB( DB_SLAVE ); |
22 | | - extract($dbr->tableNames('page', 'categorylinks', 'page_props')); |
| 22 | + extract( $dbr->tableNames( 'page', 'categorylinks', 'page_props' ) ); |
23 | 23 | $cat_ns = NS_CATEGORY; |
24 | 24 | $sql = "SELECT page_title FROM $page p LEFT OUTER JOIN $categorylinks cl ON p.page_id = cl.cl_from WHERE p.page_namespace = $cat_ns AND cl.cl_to IS NULL"; |
25 | | - $res = $dbr->query($sql); |
26 | | - if ($dbr->numRows( $res ) > 0) { |
27 | | - while ($row = $dbr->fetchRow($res)) { |
28 | | - $categories[] = str_replace('_', ' ', $row[0]); |
| 25 | + $res = $dbr->query( $sql ); |
| 26 | + if ( $dbr->numRows( $res ) > 0 ) { |
| 27 | + while ( $row = $dbr->fetchRow( $res ) ) { |
| 28 | + $categories[] = str_replace( '_', ' ', $row[0] ); |
29 | 29 | } |
30 | 30 | } |
31 | | - $dbr->freeResult($res); |
| 31 | + $dbr->freeResult( $res ); |
32 | 32 | |
33 | 33 | // get 'hide' and 'show' categories |
34 | 34 | $hidden_cats = $shown_cats = array(); |
35 | 35 | $sql2 = "SELECT p.page_title, pp.pp_propname FROM $page p JOIN $page_props pp ON p.page_id = pp.pp_page WHERE p.page_namespace = $cat_ns AND (pp.pp_propname = 'hidefromdrilldown' OR pp.pp_propname = 'showindrilldown') AND pp.pp_value = 'y'"; |
36 | | - $res2 = $dbr->query($sql2); |
37 | | - if ($dbr->numRows( $res2 ) > 0) { |
38 | | - while ($row = $dbr->fetchRow($res2)) { |
39 | | - if ($row[1] == 'hidefromdrilldown') |
40 | | - $hidden_cats[] = str_replace('_', ' ', $row[0]); |
| 36 | + $res2 = $dbr->query( $sql2 ); |
| 37 | + if ( $dbr->numRows( $res2 ) > 0 ) { |
| 38 | + while ( $row = $dbr->fetchRow( $res2 ) ) { |
| 39 | + if ( $row[1] == 'hidefromdrilldown' ) |
| 40 | + $hidden_cats[] = str_replace( '_', ' ', $row[0] ); |
41 | 41 | else |
42 | | - $shown_cats[] = str_replace('_', ' ', $row[0]); |
| 42 | + $shown_cats[] = str_replace( '_', ' ', $row[0] ); |
43 | 43 | } |
44 | 44 | } |
45 | | - $dbr->freeResult($res2); |
46 | | - $categories = array_merge($categories, $shown_cats); |
47 | | - foreach ($hidden_cats as $hidden_cat) { |
48 | | - foreach ($categories as $i => $cat) { |
49 | | - if ($cat == $hidden_cat) { |
50 | | - unset($categories[$i]); |
| 45 | + $dbr->freeResult( $res2 ); |
| 46 | + $categories = array_merge( $categories, $shown_cats ); |
| 47 | + foreach ( $hidden_cats as $hidden_cat ) { |
| 48 | + foreach ( $categories as $i => $cat ) { |
| 49 | + if ( $cat == $hidden_cat ) { |
| 50 | + unset( $categories[$i] ); |
51 | 51 | } |
52 | 52 | } |
53 | 53 | } |
54 | | - sort($categories); |
| 54 | + sort( $categories ); |
55 | 55 | return $categories; |
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
59 | 59 | * Gets a list of the names of all properties in the wiki |
60 | 60 | */ |
61 | | - function getSemanticProperties() { |
| 61 | + static function getSemanticProperties() { |
62 | 62 | global $smwgContLang; |
63 | 63 | $smw_namespace_labels = $smwgContLang->getNamespaces(); |
64 | 64 | $all_properties = array(); |
65 | 65 | |
66 | | - //$options = new SMWRequestOptions(); |
67 | | - //$options->limit = 10000; |
68 | | - //$used_properties = smwfGetStore()->getPropertiesSpecial($options); |
| 66 | + // $options = new SMWRequestOptions(); |
| 67 | + // $options->limit = 10000; |
| 68 | + // $used_properties = smwfGetStore()->getPropertiesSpecial($options); |
69 | 69 | $used_properties = smwfGetStore()->getPropertiesSpecial(); |
70 | | - foreach ($used_properties as $property) { |
| 70 | + foreach ( $used_properties as $property ) { |
71 | 71 | $all_properties[] = $property[0]->getWikiValue(); |
72 | 72 | } |
73 | | - $unused_properties = smwfGetStore()->getUnusedPropertiesSpecial($options); |
74 | | - foreach ($unused_properties as $property) { |
| 73 | + $unused_properties = smwfGetStore()->getUnusedPropertiesSpecial( $options ); |
| 74 | + foreach ( $unused_properties as $property ) { |
75 | 75 | $all_properties[] = $property->getWikiValue(); |
76 | 76 | } |
77 | 77 | // remove the special properties of Semantic Drilldown from this list... |
78 | 78 | global $sdgContLang; |
79 | 79 | $sd_props = $sdgContLang->getPropertyLabels(); |
80 | 80 | $sd_prop_aliases = $sdgContLang->getPropertyAliases(); |
81 | | - foreach ($all_properties as $i => $prop_name) { |
82 | | - foreach ($sd_props as $prop => $label) { |
83 | | - if ($prop_name == $label) { |
84 | | - unset($all_properties[$i]); |
| 81 | + foreach ( $all_properties as $i => $prop_name ) { |
| 82 | + foreach ( $sd_props as $prop => $label ) { |
| 83 | + if ( $prop_name == $label ) { |
| 84 | + unset( $all_properties[$i] ); |
85 | 85 | } |
86 | 86 | } |
87 | | - foreach ($sd_prop_aliases as $alias => $cur_prop) { |
88 | | - if ($prop_name == $alias) { |
89 | | - unset($all_properties[$i]); |
| 87 | + foreach ( $sd_prop_aliases as $alias => $cur_prop ) { |
| 88 | + if ( $prop_name == $alias ) { |
| 89 | + unset( $all_properties[$i] ); |
90 | 90 | } |
91 | 91 | } |
92 | 92 | } |
93 | | - sort($all_properties); |
| 93 | + sort( $all_properties ); |
94 | 94 | return $all_properties; |
95 | 95 | } |
96 | 96 | |
— | — | @@ -97,31 +97,31 @@ |
98 | 98 | * Gets the names of all the filter pages, i.e. pages in the Filter |
99 | 99 | * namespace |
100 | 100 | */ |
101 | | - function getFilters() { |
| 101 | + static function getFilters() { |
102 | 102 | $dbr = wfGetDB( DB_SLAVE ); |
103 | | - $res = $dbr->select('page', 'page_title', array('page_namespace' => SD_NS_FILTER)); |
| 103 | + $res = $dbr->select( 'page', 'page_title', array( 'page_namespace' => SD_NS_FILTER ) ); |
104 | 104 | $filters = array(); |
105 | | - while ($row = $dbr->fetchRow($res)) { |
| 105 | + while ( $row = $dbr->fetchRow( $res ) ) { |
106 | 106 | $filters[] = $row[0]; |
107 | 107 | } |
108 | | - $dbr->freeResult($res); |
| 108 | + $dbr->freeResult( $res ); |
109 | 109 | return $filters; |
110 | 110 | } |
111 | 111 | |
112 | 112 | /** |
113 | | - * Generic function - gets all the values that a specific page |
| 113 | + * Generic static function - gets all the values that a specific page |
114 | 114 | * points to with a specific property |
115 | 115 | * ($special_prop and $prop represent the same value, depending on |
116 | 116 | * whether we're using SMW 1.4 or an earlier version) |
117 | 117 | */ |
118 | | - function getValuesForProperty($subject, $subject_namespace, $special_prop) { |
| 118 | + static function getValuesForProperty( $subject, $subject_namespace, $special_prop ) { |
119 | 119 | $store = smwfGetStore(); |
120 | | - $subject_title = Title::newFromText($subject, $subject_namespace); |
121 | | - $property = SMWPropertyValue::makeProperty($special_prop); |
122 | | - $res = $store->getPropertyValues($subject_title, $property); |
| 120 | + $subject_title = Title::newFromText( $subject, $subject_namespace ); |
| 121 | + $property = SMWPropertyValue::makeProperty( $special_prop ); |
| 122 | + $res = $store->getPropertyValues( $subject_title, $property ); |
123 | 123 | $values = array(); |
124 | | - foreach ($res as $prop_val) { |
125 | | - $values[] = html_entity_decode(str_replace('_', ' ', $prop_val->getXSDValue())); |
| 124 | + foreach ( $res as $prop_val ) { |
| 125 | + $values[] = html_entity_decode( str_replace( '_', ' ', $prop_val->getValueKey() ) ); |
126 | 126 | } |
127 | 127 | return $values; |
128 | 128 | } |
— | — | @@ -129,11 +129,11 @@ |
130 | 130 | /** |
131 | 131 | * Gets all the filters specified for a category. |
132 | 132 | */ |
133 | | - function loadFiltersForCategory($category) { |
| 133 | + static function loadFiltersForCategory( $category ) { |
134 | 134 | $filters = array(); |
135 | | - $filter_names = SDUtils::getValuesForProperty(str_replace(' ', '_', $category), NS_CATEGORY, '_SD_F'); |
136 | | - foreach ($filter_names as $filter_name) { |
137 | | - $filters[] = SDFilter::load($filter_name); |
| 135 | + $filter_names = SDUtils::getValuesForProperty( str_replace( ' ', '_', $category ), NS_CATEGORY, '_SD_F' ); |
| 136 | + foreach ( $filter_names as $filter_name ) { |
| 137 | + $filters[] = SDFilter::load( $filter_name ); |
138 | 138 | } |
139 | 139 | return $filters; |
140 | 140 | } |
— | — | @@ -141,122 +141,122 @@ |
142 | 142 | /** |
143 | 143 | * Gets all the display parameters defined for a category |
144 | 144 | */ |
145 | | - function getDisplayParamsForCategory($category) { |
146 | | - $all_display_params = SDUtils::getValuesForProperty(str_replace(' ', '_', $category), NS_CATEGORY, '_SD_DP'); |
| 145 | + static function getDisplayParamsForCategory( $category ) { |
| 146 | + $all_display_params = SDUtils::getValuesForProperty( str_replace( ' ', '_', $category ), NS_CATEGORY, '_SD_DP' ); |
147 | 147 | |
148 | 148 | $return_display_params = array(); |
149 | | - foreach ($all_display_params as $display_params) { |
150 | | - $return_display_params[] = explode(';', $display_params); |
| 149 | + foreach ( $all_display_params as $display_params ) { |
| 150 | + $return_display_params[] = explode( ';', $display_params ); |
151 | 151 | } |
152 | 152 | return $return_display_params; |
153 | 153 | } |
154 | 154 | |
155 | | - function getCategoryChildren($category_name, $get_categories, $levels) { |
156 | | - if ($levels == 0) { |
| 155 | + static function getCategoryChildren( $category_name, $get_categories, $levels ) { |
| 156 | + if ( $levels == 0 ) { |
157 | 157 | return array(); |
158 | 158 | } |
159 | 159 | $pages = array(); |
160 | 160 | $subcategories = array(); |
161 | 161 | $dbr = wfGetDB( DB_SLAVE ); |
162 | | - extract($dbr->tableNames('page', 'categorylinks')); |
| 162 | + extract( $dbr->tableNames( 'page', 'categorylinks' ) ); |
163 | 163 | $cat_ns = NS_CATEGORY; |
164 | | - $query_category = str_replace(' ', '_', $category_name); |
165 | | - $query_category = str_replace("'", "\'", $query_category); |
| 164 | + $query_category = str_replace( ' ', '_', $category_name ); |
| 165 | + $query_category = str_replace( "'", "\'", $query_category ); |
166 | 166 | $sql = "SELECT p.page_title, p.page_namespace FROM $categorylinks cl |
167 | 167 | JOIN $page p on cl.cl_from = p.page_id |
168 | 168 | WHERE cl.cl_to = '$query_category'\n"; |
169 | | - if ($get_categories) |
| 169 | + if ( $get_categories ) |
170 | 170 | $sql .= "AND p.page_namespace = $cat_ns\n"; |
171 | 171 | $sql .= "ORDER BY cl.cl_sortkey"; |
172 | | - $res = $dbr->query($sql); |
173 | | - while ($row = $dbr->fetchRow($res)) { |
174 | | - if ($get_categories) { |
| 172 | + $res = $dbr->query( $sql ); |
| 173 | + while ( $row = $dbr->fetchRow( $res ) ) { |
| 174 | + if ( $get_categories ) { |
175 | 175 | $subcategories[] = $row[0]; |
176 | 176 | $pages[] = $row[0]; |
177 | 177 | } else { |
178 | | - if ($row[1] == $cat_ns) |
| 178 | + if ( $row[1] == $cat_ns ) |
179 | 179 | $subcategories[] = $row[0]; |
180 | 180 | else |
181 | 181 | $pages[] = $row[0]; |
182 | 182 | } |
183 | 183 | } |
184 | | - $dbr->freeResult($res); |
185 | | - foreach ($subcategories as $subcategory) { |
186 | | - $pages = array_merge($pages, SDUtils::getCategoryChildren($subcategory, $get_categories, $levels - 1)); |
| 184 | + $dbr->freeResult( $res ); |
| 185 | + foreach ( $subcategories as $subcategory ) { |
| 186 | + $pages = array_merge( $pages, SDUtils::getCategoryChildren( $subcategory, $get_categories, $levels - 1 ) ); |
187 | 187 | } |
188 | 188 | return $pages; |
189 | 189 | } |
190 | 190 | |
191 | | - function monthToString($month) { |
192 | | - if ($month == 1) { |
193 | | - return wfMsg('january'); |
194 | | - } elseif ($month == 2) { |
195 | | - return wfMsg('february'); |
196 | | - } elseif ($month == 3) { |
197 | | - return wfMsg('march'); |
198 | | - } elseif ($month == 4) { |
199 | | - return wfMsg('april'); |
200 | | - } elseif ($month == 5) { |
201 | | - return wfMsg('may'); |
202 | | - } elseif ($month == 6) { |
203 | | - return wfMsg('june'); |
204 | | - } elseif ($month == 7) { |
205 | | - return wfMsg('july'); |
206 | | - } elseif ($month == 8) { |
207 | | - return wfMsg('august'); |
208 | | - } elseif ($month == 9) { |
209 | | - return wfMsg('september'); |
210 | | - } elseif ($month == 10) { |
211 | | - return wfMsg('october'); |
212 | | - } elseif ($month == 11) { |
213 | | - return wfMsg('november'); |
214 | | - } else { //if ($month == 12) { |
215 | | - return wfMsg('december'); |
| 191 | + static function monthToString( $month ) { |
| 192 | + if ( $month == 1 ) { |
| 193 | + return wfMsg( 'january' ); |
| 194 | + } elseif ( $month == 2 ) { |
| 195 | + return wfMsg( 'february' ); |
| 196 | + } elseif ( $month == 3 ) { |
| 197 | + return wfMsg( 'march' ); |
| 198 | + } elseif ( $month == 4 ) { |
| 199 | + return wfMsg( 'april' ); |
| 200 | + } elseif ( $month == 5 ) { |
| 201 | + return wfMsg( 'may' ); |
| 202 | + } elseif ( $month == 6 ) { |
| 203 | + return wfMsg( 'june' ); |
| 204 | + } elseif ( $month == 7 ) { |
| 205 | + return wfMsg( 'july' ); |
| 206 | + } elseif ( $month == 8 ) { |
| 207 | + return wfMsg( 'august' ); |
| 208 | + } elseif ( $month == 9 ) { |
| 209 | + return wfMsg( 'september' ); |
| 210 | + } elseif ( $month == 10 ) { |
| 211 | + return wfMsg( 'october' ); |
| 212 | + } elseif ( $month == 11 ) { |
| 213 | + return wfMsg( 'november' ); |
| 214 | + } else { // if ($month == 12) { |
| 215 | + return wfMsg( 'december' ); |
216 | 216 | } |
217 | 217 | } |
218 | 218 | |
219 | | - function stringToMonth($str) { |
220 | | - if ($str == wfMsg('january')) { |
| 219 | + static function stringToMonth( $str ) { |
| 220 | + if ( $str == wfMsg( 'january' ) ) { |
221 | 221 | return 1; |
222 | | - } elseif ($str == wfMsg('february')) { |
| 222 | + } elseif ( $str == wfMsg( 'february' ) ) { |
223 | 223 | return 2; |
224 | | - } elseif ($str == wfMsg('march')) { |
| 224 | + } elseif ( $str == wfMsg( 'march' ) ) { |
225 | 225 | return 3; |
226 | | - } elseif ($str == wfMsg('april')) { |
| 226 | + } elseif ( $str == wfMsg( 'april' ) ) { |
227 | 227 | return 4; |
228 | | - } elseif ($str == wfMsg('may')) { |
| 228 | + } elseif ( $str == wfMsg( 'may' ) ) { |
229 | 229 | return 5; |
230 | | - } elseif ($str == wfMsg('june')) { |
| 230 | + } elseif ( $str == wfMsg( 'june' ) ) { |
231 | 231 | return 6; |
232 | | - } elseif ($str == wfMsg('july')) { |
| 232 | + } elseif ( $str == wfMsg( 'july' ) ) { |
233 | 233 | return 7; |
234 | | - } elseif ($str == wfMsg('august')) { |
| 234 | + } elseif ( $str == wfMsg( 'august' ) ) { |
235 | 235 | return 8; |
236 | | - } elseif ($str == wfMsg('september')) { |
| 236 | + } elseif ( $str == wfMsg( 'september' ) ) { |
237 | 237 | return 9; |
238 | | - } elseif ($str == wfMsg('october')) { |
| 238 | + } elseif ( $str == wfMsg( 'october' ) ) { |
239 | 239 | return 10; |
240 | | - } elseif ($str == wfMsg('november')) { |
| 240 | + } elseif ( $str == wfMsg( 'november' ) ) { |
241 | 241 | return 11; |
242 | | - } else { //if ($strmonth == wfMsg('december')) { |
| 242 | + } else { // if ($strmonth == wfMsg('december')) { |
243 | 243 | return 12; |
244 | 244 | } |
245 | 245 | } |
246 | 246 | |
247 | | - function booleanToString($bool_value) { |
248 | | - wfLoadExtensionMessages('SemanticMediaWiki'); |
249 | | - $words_field_name = ($bool_value == true) ? 'smw_true_words' : 'smw_false_words'; |
250 | | - $words_array = explode(',', wfMsgForContent($words_field_name)); |
| 247 | + static function booleanToString( $bool_value ) { |
| 248 | + wfLoadExtensionMessages( 'SemanticMediaWiki' ); |
| 249 | + $words_field_name = ( $bool_value == true ) ? 'smw_true_words' : 'smw_false_words'; |
| 250 | + $words_array = explode( ',', wfMsgForContent( $words_field_name ) ); |
251 | 251 | // go with the value in the array that tends to be "yes" or |
252 | 252 | // "no", which is the 3rd |
253 | 253 | $index_of_word = 2; |
254 | 254 | // capitalize first letter of word |
255 | | - if (count($words_array) > $index_of_word) { |
256 | | - $string_value = ucwords($words_array[$index_of_word]); |
257 | | - } elseif (count($words_array) == 0) { |
| 255 | + if ( count( $words_array ) > $index_of_word ) { |
| 256 | + $string_value = ucwords( $words_array[$index_of_word] ); |
| 257 | + } elseif ( count( $words_array ) == 0 ) { |
258 | 258 | $string_value = $bool_value; // a safe value if no words are found |
259 | 259 | } else { |
260 | | - $string_value = ucwords($words_array[0]); |
| 260 | + $string_value = ucwords( $words_array[0] ); |
261 | 261 | } |
262 | 262 | return $string_value; |
263 | 263 | } |
— | — | @@ -266,25 +266,25 @@ |
267 | 267 | * allows pages to spoof a normal edit page, that can preview, save, |
268 | 268 | * etc. |
269 | 269 | */ |
270 | | - function printRedirectForm($title, $page_contents, $edit_summary, $is_save, $is_preview, $is_diff, $is_minor_edit, $watch_this) { |
271 | | - $article = new Article($title); |
272 | | - $new_url = $title->getLocalURL('action=submit'); |
| 270 | + static function printRedirectForm( $title, $page_contents, $edit_summary, $is_save, $is_preview, $is_diff, $is_minor_edit, $watch_this ) { |
| 271 | + $article = new Article( $title ); |
| 272 | + $new_url = $title->getLocalURL( 'action=submit' ); |
273 | 273 | $starttime = wfTimestampNow(); |
274 | 274 | $edittime = $article->getTimestamp(); |
275 | 275 | global $wgUser; |
276 | 276 | if ( $wgUser->isLoggedIn() ) |
277 | | - $token = htmlspecialchars($wgUser->editToken()); |
| 277 | + $token = htmlspecialchars( $wgUser->editToken() ); |
278 | 278 | else |
279 | 279 | $token = EDIT_TOKEN_SUFFIX; |
280 | 280 | |
281 | | - if ($is_save) |
| 281 | + if ( $is_save ) |
282 | 282 | $action = "wpSave"; |
283 | | - elseif ($is_preview) |
| 283 | + elseif ( $is_preview ) |
284 | 284 | $action = "wpPreview"; |
285 | 285 | else // $is_diff |
286 | 286 | $action = "wpDiff"; |
287 | 287 | |
288 | | - $text =<<<END |
| 288 | + $text = <<<END |
289 | 289 | <form id="editform" name="editform" method="post" action="$new_url"> |
290 | 290 | <input type="hidden" name="wpTextbox1" id="wpTextbox1" value="$page_contents" /> |
291 | 291 | <input type="hidden" name="wpSummary" value="$edit_summary" /> |
— | — | @@ -294,11 +294,11 @@ |
295 | 295 | <input type="hidden" name="$action" /> |
296 | 296 | |
297 | 297 | END; |
298 | | - if ($is_minor_edit) |
| 298 | + if ( $is_minor_edit ) |
299 | 299 | $text .= ' <input type="hidden" name="wpMinoredit">' . "\n"; |
300 | | - if ($watch_this) |
| 300 | + if ( $watch_this ) |
301 | 301 | $text .= ' <input type="hidden" name="wpWatchthis">' . "\n"; |
302 | | - $text .=<<<END |
| 302 | + $text .= <<<END |
303 | 303 | </form> |
304 | 304 | <script type="text/javascript"> |
305 | 305 | document.editform.submit(); |
— | — | @@ -311,7 +311,7 @@ |
312 | 312 | /** |
313 | 313 | * Register magic-word variable IDs |
314 | 314 | */ |
315 | | - function addMagicWordVariableIDs(&$magicWordVariableIDs) { |
| 315 | + static function addMagicWordVariableIDs( &$magicWordVariableIDs ) { |
316 | 316 | $magicWordVariableIDs[] = 'MAG_HIDEFROMDRILLDOWN'; |
317 | 317 | $magicWordVariableIDs[] = 'MAG_SHOWINDRILLDOWN'; |
318 | 318 | return true; |
— | — | @@ -320,11 +320,11 @@ |
321 | 321 | /** |
322 | 322 | * Set the actual value of the magic words |
323 | 323 | */ |
324 | | - function addMagicWordLanguage(&$magicWords, $langCode) { |
325 | | - switch($langCode) { |
| 324 | + static function addMagicWordLanguage( &$magicWords, $langCode ) { |
| 325 | + switch( $langCode ) { |
326 | 326 | default: |
327 | | - $magicWords['MAG_HIDEFROMDRILLDOWN'] = array(0, '__HIDEFROMDRILLDOWN__'); |
328 | | - $magicWords['MAG_SHOWINDRILLDOWN'] = array(0, '__SHOWINDRILLDOWN__'); |
| 327 | + $magicWords['MAG_HIDEFROMDRILLDOWN'] = array( 0, '__HIDEFROMDRILLDOWN__' ); |
| 328 | + $magicWords['MAG_SHOWINDRILLDOWN'] = array( 0, '__SHOWINDRILLDOWN__' ); |
329 | 329 | } |
330 | 330 | return true; |
331 | 331 | } |
— | — | @@ -333,14 +333,14 @@ |
334 | 334 | * Set values in the page_props table based on the presence of the |
335 | 335 | * 'HIDEFROMDRILLDOWN' and 'SHOWINDRILLDOWN' magic words in a page |
336 | 336 | */ |
337 | | - function handleShowAndHide(&$parser, &$text) { |
| 337 | + static function handleShowAndHide( &$parser, &$text ) { |
338 | 338 | global $wgOut, $wgAction; |
339 | | - $mw_hide = MagicWord::get('MAG_HIDEFROMDRILLDOWN'); |
340 | | - if ($mw_hide->matchAndRemove($text)) { |
| 339 | + $mw_hide = MagicWord::get( 'MAG_HIDEFROMDRILLDOWN' ); |
| 340 | + if ( $mw_hide->matchAndRemove( $text ) ) { |
341 | 341 | $parser->mOutput->setProperty( 'hidefromdrilldown', 'y' ); |
342 | 342 | } |
343 | | - $mw_show = MagicWord::get('MAG_SHOWINDRILLDOWN'); |
344 | | - if ($mw_show->matchAndRemove($text)) { |
| 343 | + $mw_show = MagicWord::get( 'MAG_SHOWINDRILLDOWN' ); |
| 344 | + if ( $mw_show->matchAndRemove( $text ) ) { |
345 | 345 | $parser->mOutput->setProperty( 'showindrilldown', 'y' ); |
346 | 346 | } |
347 | 347 | return true; |