Index: trunk/extensions/SubpageFun/SFun_SubpageInfo.php |
— | — | @@ -192,11 +192,11 @@ |
193 | 193 | * name (without prefix) will be returned. |
194 | 194 | */ |
195 | 195 | static function getSubpageTitle( Title $page ) { |
196 | | - $parent = SubpageInfo::getParentPage( $page ); |
| 196 | + $parent = SubpageInfo::getParentPage( $page ); |
197 | 197 | //return the whole subpage name not like SUBPAGENAME only the last part after the last "/": |
198 | 198 | if( ! empty( $parent ) ) { |
199 | 199 | return substr( $page->getText(), strlen( $parent->getText() . '/' ) ); |
200 | | - } |
| 200 | + } |
201 | 201 | return $page->getText(); //return PAGENAME |
202 | 202 | } |
203 | 203 | } |
Index: trunk/extensions/SubpageFun/SubpageFun.php |
— | — | @@ -8,7 +8,7 @@ |
9 | 9 | * Support: http://www.mediawiki.org/wiki/Extension_talk:Subpage_Fun |
10 | 10 | * Source code: http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/SubpageFun |
11 | 11 | * |
12 | | - * @version: 0.5 |
| 12 | + * @version: 0.5.1 |
13 | 13 | * @license: ISC license |
14 | 14 | * @author: Daniel Werner < danweetz@web.de > |
15 | 15 | * |
— | — | @@ -48,7 +48,7 @@ |
49 | 49 | |
50 | 50 | class ExtSubpageFun { |
51 | 51 | |
52 | | - const VERSION = '0.5'; |
| 52 | + const VERSION = '0.5.1'; |
53 | 53 | |
54 | 54 | const MAG_SUBPAGETITLE = 'subpagetitle'; |
55 | 55 | const MAG_SUBPAGES = 'subpages'; |
— | — | @@ -142,10 +142,11 @@ |
143 | 143 | // return ''; |
144 | 144 | $out = array(); |
145 | 145 | foreach( $pages as $page ) { |
| 146 | + $text = wfEscapeWikiText( $page->getPrefixedText() ); |
146 | 147 | if( $link ) { |
147 | | - $out[] = '[[:' . $page->getPrefixedText() . ']]'; |
| 148 | + $out[] = "[[:{$text}]]"; |
148 | 149 | } else { |
149 | | - $out[] = $page->getPrefixedText(); |
| 150 | + $out[] = $text; |
150 | 151 | } |
151 | 152 | } |
152 | 153 | return implode( $sep, $out ); |
— | — | @@ -236,7 +237,7 @@ |
237 | 238 | if( $t === null ) { |
238 | 239 | return ''; // invalid title given |
239 | 240 | } |
240 | | - return SubpageInfo::getSubpageTitle( $t ); |
| 241 | + return wfEscapeWikiText( SubpageInfo::getSubpageTitle( $t ) ); |
241 | 242 | } |
242 | 243 | |
243 | 244 | static function subpages( &$parser ) { |
— | — | @@ -325,16 +326,22 @@ |
326 | 327 | //get all possible arguments: |
327 | 328 | $args = ExtSubpageFun::getFunctionArgsArray( func_get_args() ); |
328 | 329 | |
329 | | - $title = isset($args[1]) ? $args[1] : null; |
330 | | - $depth = isset( $args['depth'] ) ? self::valDepth( $args['depth'] ) : null; |
| 330 | + $title = isset($args[1]) ? $args[1] : null; |
| 331 | + $depth = isset( $args['depth'] ) ? self::valDepth( $args['depth'] ) : null; |
| 332 | + $filter = isset( $args['filter'] ) ? $args['filter'] : null; |
331 | 333 | |
332 | | - //function logic: |
| 334 | + // function logic: |
333 | 335 | $t = self::newTitleObject( $parser, $title ); |
334 | 336 | if( $t === null ) { |
335 | 337 | return ''; // invalid title given |
336 | 338 | } |
337 | 339 | |
| 340 | + // get subpages: |
338 | 341 | $subpages = SubpageInfo::getSubpages( $t, $depth ); |
| 342 | + |
| 343 | + // filter by filter criterion: |
| 344 | + $subpages = self::filterSiteList( $subpages, $filter ); |
| 345 | + |
339 | 346 | return count( $subpages ); |
340 | 347 | } |
341 | 348 | |
— | — | @@ -347,10 +354,13 @@ |
348 | 355 | //get all parents because the toplevel is the highest existing parent: |
349 | 356 | $parentpages = SubpageInfo::getAncestorPages( $t ); |
350 | 357 | |
351 | | - if( ! empty( $parentpages ) ) |
352 | | - return $parentpages[0]->getPrefixedText(); |
353 | | - else //no parent! The page itself is the top level: |
354 | | - return $t->getPrefixedText(); |
| 358 | + if( ! empty( $parentpages ) ) { |
| 359 | + return wfEscapeWikiText( $parentpages[0]->getPrefixedText() ); |
| 360 | + } |
| 361 | + else { |
| 362 | + ////no parent! The page itself is the top level: |
| 363 | + return wfEscapeWikiText( $t->getPrefixedText() ); |
| 364 | + } |
355 | 365 | } |
356 | 366 | |
357 | 367 | |
Index: trunk/extensions/SubpageFun/RELEASE-NOTES |
— | — | @@ -1,6 +1,11 @@ |
2 | 2 | 'Supage Fun' Changelog: |
3 | 3 | ======================= |
4 | 4 | |
| 5 | +* November 8, 2011 - Version 0.5.1: |
| 6 | + - All functions/variables returning page names in any way are using 'wfEscapeWikiText()' now like other variables like 'PAGENAME' |
| 7 | + for example. |
| 8 | + - 'filter' parameter can be used for 'NUMBEROFSUBPAGES'. |
| 9 | + |
5 | 10 | * November 7, 2011 -- Version 0.5: |
6 | 11 | - All magic words are case-sensitive now and must be written in UPPERCASE. |
7 | 12 | - Input of invalid page names (with forbidden characters) will output '' instead of raising a php error. This behavior is adopted |