Index: trunk/extensions/SubPageList3/SubPageList3.php |
— | — | @@ -60,73 +60,56 @@ |
61 | 61 | class SubpageList3 { |
62 | 62 | |
63 | 63 | /** |
64 | | - * parser object |
65 | | - * @var object parser object |
66 | | - * @private |
| 64 | + * @var Parser |
67 | 65 | */ |
68 | | - var $parser; |
| 66 | + private $parser; |
69 | 67 | |
70 | 68 | |
71 | 69 | /** |
72 | | - * title object |
73 | | - * @var object title object |
74 | | - * @private |
| 70 | + * @var Title |
75 | 71 | */ |
76 | | - var $title; |
| 72 | + private $title; |
77 | 73 | |
78 | 74 | /** |
79 | 75 | * @var Title |
80 | | - * @private |
81 | 76 | */ |
82 | | - var $ptitle; |
| 77 | + private $ptitle; |
83 | 78 | |
84 | 79 | /** |
85 | | - * namespace string |
86 | | - * @var string namespace object |
87 | | - * @private |
| 80 | + * @var string |
88 | 81 | */ |
89 | | - var $namespace = ''; |
| 82 | + private $namespace = ''; |
90 | 83 | |
91 | 84 | /** |
92 | | - * token string |
93 | 85 | * @var string token object |
94 | | - * @private |
95 | 86 | */ |
96 | | - var $token = '*'; |
| 87 | + private $token = '*'; |
97 | 88 | |
98 | 89 | /** |
99 | | - * language object |
100 | | - * @var object language object |
101 | | - * @private |
| 90 | + * @var Language |
102 | 91 | */ |
103 | | - var $language; |
| 92 | + private $language; |
104 | 93 | |
105 | 94 | /** |
106 | | - * error display on or off |
107 | | - * @var mixed error display on or off |
108 | | - * @private |
| 95 | + * @var int error display on or off |
109 | 96 | * @default 0 hide errors |
110 | 97 | */ |
111 | | - var $debug = 0; |
| 98 | + private $debug = 0; |
112 | 99 | |
113 | 100 | /** |
114 | 101 | * contain the error messages |
115 | 102 | * @var array contain the errors messages |
116 | | - * @private |
117 | 103 | */ |
118 | | - var $errors = array(); |
| 104 | + private $errors = array(); |
119 | 105 | |
120 | | - |
121 | 106 | /** |
122 | 107 | * order type |
123 | 108 | * Can be: |
124 | 109 | * - asc |
125 | 110 | * - desc |
126 | 111 | * @var string order type |
127 | | - * @private |
128 | | - * @default asc |
129 | 112 | */ |
130 | | - var $order = 'asc'; |
| 113 | + private $order = 'asc'; |
131 | 114 | |
132 | 115 | /** |
133 | 116 | * column thats used as order method |
— | — | @@ -135,9 +118,8 @@ |
136 | 119 | * - lastedit: Timestamp numeric order of the last edit of a page |
137 | 120 | * @var string order method |
138 | 121 | * @private |
139 | | - * @default title |
140 | 122 | */ |
141 | | - var $ordermethod = 'title'; |
| 123 | + private $ordermethod = 'title'; |
142 | 124 | |
143 | 125 | /** |
144 | 126 | * mode of the output |
— | — | @@ -146,10 +128,9 @@ |
147 | 129 | * - ordered: OL list as output |
148 | 130 | * - bar: uses · as a delimiter producing a horizontal bar menu |
149 | 131 | * @var string mode of output |
150 | | - * @private |
151 | 132 | * @default unordered |
152 | 133 | */ |
153 | | - var $mode = 'unordered'; |
| 134 | + private $mode = 'unordered'; |
154 | 135 | |
155 | 136 | /** |
156 | 137 | * parent of the listed pages |
— | — | @@ -158,10 +139,9 @@ |
159 | 140 | * - string: title of the specific title |
160 | 141 | * e.g. if you are in Mainpage/ it will list all subpages of Mainpage/ |
161 | 142 | * @var mixed parent of listed pages |
162 | | - * @private |
163 | 143 | * @default -1 current |
164 | 144 | */ |
165 | | - var $parent = -1; |
| 145 | + private $parent = -1; |
166 | 146 | |
167 | 147 | /** |
168 | 148 | * style of the path (title) |
— | — | @@ -170,11 +150,10 @@ |
171 | 151 | * - notparent: the path without the $parent item, e.g. Entry/Sub |
172 | 152 | * - no: no path, only the page title, e.g. Sub |
173 | 153 | * @var string style of the path (title) |
174 | | - * @private |
175 | 154 | * @default normal |
176 | 155 | * @see $parent |
177 | 156 | */ |
178 | | - var $showpath = 'no'; |
| 157 | + private $showpath = 'no'; |
179 | 158 | |
180 | 159 | /** |
181 | 160 | * whether to show next sublevel only, or all sublevels |
— | — | @@ -182,11 +161,10 @@ |
183 | 162 | * - 0 / no / false |
184 | 163 | * - 1 / yes / true |
185 | 164 | * @var mixed show one sublevel only |
186 | | - * @private |
187 | 165 | * @default 0 |
188 | 166 | * @see $parent |
189 | 167 | */ |
190 | | - var $kidsonly = 0; |
| 168 | + private $kidsonly = 0; |
191 | 169 | |
192 | 170 | /** |
193 | 171 | * whether to show parent as the top item |
— | — | @@ -194,11 +172,10 @@ |
195 | 173 | * - 0 / no / false |
196 | 174 | * - 1 / yes / true |
197 | 175 | * @var mixed show one sublevel only |
198 | | - * @private |
199 | 176 | * @default 0 |
200 | 177 | * @see $parent |
201 | 178 | */ |
202 | | - var $showparent = 0; |
| 179 | + private $showparent = 0; |
203 | 180 | |
204 | 181 | /** |
205 | 182 | * Constructor function of the class |
— | — | @@ -209,13 +186,6 @@ |
210 | 187 | */ |
211 | 188 | function __construct( $parser ) { |
212 | 189 | global $wgContLang; |
213 | | - |
214 | | - /** |
215 | | - * assignment of the object to the classs vars |
216 | | - * @see $parser |
217 | | - * @see $title |
218 | | - * @see $language |
219 | | - */ |
220 | 190 | $this->parser = $parser; |
221 | 191 | $this->title = $parser->mTitle; |
222 | 192 | $this->language = $wgContLang; |
— | — | @@ -319,11 +289,7 @@ |
320 | 290 | if( isset( $options['showpath'] ) ) { |
321 | 291 | switch( strtolower( $options['showpath'] ) ) { |
322 | 292 | case 'no': |
323 | | - $this->showpath = 'no'; |
324 | | - break; |
325 | 293 | case '0': |
326 | | - $this->showpath = 'no'; |
327 | | - break; |
328 | 294 | case 'false': |
329 | 295 | $this->showpath = 'no'; |
330 | 296 | break; |
— | — | @@ -331,14 +297,8 @@ |
332 | 298 | $this->showpath = 'notparent'; |
333 | 299 | break; |
334 | 300 | case 'full': |
335 | | - $this->showpath = 'full'; |
336 | | - break; |
337 | 301 | case 'yes': |
338 | | - $this->showpath = 'full'; |
339 | | - break; |
340 | 302 | case '1': |
341 | | - $this->showpath = 'full'; |
342 | | - break; |
343 | 303 | case 'true': |
344 | 304 | $this->showpath = 'full'; |
345 | 305 | break; |
— | — | @@ -374,7 +334,7 @@ |
375 | 335 | function render() { |
376 | 336 | wfProfileIn( __METHOD__ ); |
377 | 337 | $pages = $this->getTitles(); |
378 | | - if($pages!=null && count( $pages ) > 0 ) { |
| 338 | + if( $pages != null && count( $pages ) > 0 ) { |
379 | 339 | $list = $this->makeList( $pages ); |
380 | 340 | $html = $this->parse( $list ); |
381 | 341 | } else { |
— | — | @@ -428,7 +388,7 @@ |
429 | 389 | } |
430 | 390 | |
431 | 391 | // don't let list cross namespaces |
432 | | - if (strlen($nsi)>0) { |
| 392 | + if ( strlen( $nsi ) > 0 ) { |
433 | 393 | $conditions['page_namespace'] = $nsi; |
434 | 394 | } |
435 | 395 | $conditions['page_is_redirect'] = 0; |
— | — | @@ -489,7 +449,9 @@ |
490 | 450 | # add parent item |
491 | 451 | if ($this->showparent) { |
492 | 452 | $pn = '[[' . $this->ptitle->getPrefixedText() .'|'. $this->ptitle->getText() .']]'; |
493 | | - if( $this->mode != 'bar' ) $pn = $this->token . $pn; |
| 453 | + if( $this->mode != 'bar' ) { |
| 454 | + $pn = $this->token . $pn; |
| 455 | + } |
494 | 456 | $ss = trim($pn); |
495 | 457 | $list[] = $ss; |
496 | 458 | $c++; // flag for bar token to be added on next item |
— | — | @@ -499,28 +461,33 @@ |
500 | 462 | $list = array(); |
501 | 463 | foreach( $titles as $title ) { |
502 | 464 | $lv = substr_count($title, '/') - $parlv; |
503 | | - if ($this->kidsonly!=1 || $lv<2) { |
504 | | - if ($this->showparent) $lv++; |
| 465 | + if ( $this->kidsonly!=1 || $lv < 2 ) { |
| 466 | + if ($this->showparent) { |
| 467 | + $lv++; |
| 468 | + } |
505 | 469 | $ss = ""; |
506 | 470 | if( $this->mode == 'bar' ) { |
507 | 471 | if( $c>0) { |
508 | 472 | $ss .= $this->token; |
509 | 473 | } |
510 | 474 | } else { |
511 | | - for ($i=0; $i<$lv; $i++) { |
| 475 | + for ( $i = 0; $i < $lv; $i++ ) { |
512 | 476 | $ss .= $this->token; |
513 | 477 | } |
514 | 478 | } |
515 | 479 | $ss .= $this->makeListItem( $title ); |
516 | | - $ss = trim($ss); // make sure we don't get any <pre></pre> tags |
| 480 | + $ss = trim( $ss ); // make sure we don't get any <pre></pre> tags |
517 | 481 | $list[] = $ss; |
518 | 482 | } |
519 | 483 | $c++; |
520 | | - if ($c>200) break; // safety |
| 484 | + if ( $c > 200 ) { |
| 485 | + break; |
| 486 | + } |
521 | 487 | } |
| 488 | + $retval = ''; |
522 | 489 | if( count( $list ) > 0 ) { |
523 | 490 | $retval = implode( "\n", $list ); |
524 | | - if ($this->mode == 'bar') { |
| 491 | + if ( $this->mode == 'bar' ) { |
525 | 492 | $retval = implode( "", $list ); |
526 | 493 | } |
527 | 494 | } |