| Index: trunk/phase3/includes/parser/CoreParserFunctions.php |
| — | — | @@ -45,6 +45,7 @@ |
| 46 | 46 | $parser->setFunctionHook( 'filepath', array( __CLASS__, 'filepath' ), SFH_NO_HASH ); |
| 47 | 47 | $parser->setFunctionHook( 'pagesincategory', array( __CLASS__, 'pagesincategory' ), SFH_NO_HASH ); |
| 48 | 48 | $parser->setFunctionHook( 'pagesize', array( __CLASS__, 'pagesize' ), SFH_NO_HASH ); |
| | 49 | + $parser->setFunctionHook( 'protectionlevel', array( __CLASS__, 'protectionlevel' ), SFH_NO_HASH ); |
| 49 | 50 | $parser->setFunctionHook( 'tag', array( __CLASS__, 'tagObj' ), SFH_OBJECT_ARGS ); |
| 50 | 51 | |
| 51 | 52 | if ( $wgAllowDisplayTitle ) { |
| — | — | @@ -292,6 +293,16 @@ |
| 293 | 294 | } |
| 294 | 295 | return self::formatRaw( $length, $raw ); |
| 295 | 296 | } |
| | 297 | + |
| | 298 | + /** |
| | 299 | + * Returns the requested protection level for the current page |
| | 300 | + */ |
| | 301 | + static function protectionlevel( $parser, $type = '' ) { |
| | 302 | + $restrictions = $parser->mTitle->getRestrictions( strtolower( $type ) ); |
| | 303 | + # Title::getRestrictions returns an array, its possible it may have |
| | 304 | + # multiple values in the future |
| | 305 | + return implode( $restrictions, ',' ); |
| | 306 | + } |
| 296 | 307 | |
| 297 | 308 | static function language( $parser, $arg = '' ) { |
| 298 | 309 | global $wgContLang; |
| Index: trunk/phase3/includes/MagicWord.php |
| — | — | @@ -109,6 +109,7 @@ |
| 110 | 110 | 'index', |
| 111 | 111 | 'noindex', |
| 112 | 112 | 'numberingroup', |
| | 113 | + 'protectionlevel', |
| 113 | 114 | ); |
| 114 | 115 | |
| 115 | 116 | /* Array of caching hints for ParserCache */ |
| Index: trunk/phase3/languages/messages/MessagesEn.php |
| — | — | @@ -333,6 +333,7 @@ |
| 334 | 334 | 'noindex' => array( 1, '__NOINDEX__' ), |
| 335 | 335 | 'numberingroup' => array( 1, 'NUMBERINGROUP', 'NUMINGROUP' ), |
| 336 | 336 | 'staticredirect' => array( 1, '__STATICREDIRECT__' ), |
| | 337 | + 'protectionlevel' => array( 1, 'PROTECTIONLEVEL' ), |
| 337 | 338 | ); |
| 338 | 339 | |
| 339 | 340 | /** |
| Index: trunk/phase3/RELEASE-NOTES |
| — | — | @@ -29,7 +29,9 @@ |
| 30 | 30 | * Added "Advanced search" link to the search form |
| 31 | 31 | * Special:Upload can now have a custom upload message instead of uploadtext by |
| 32 | 32 | passing "uploadmsg" parameter in the url |
| 33 | | - |
| | 33 | +* (bug 9947) Add PROTECTIONLEVEL parser funtion to return the protection level |
| | 34 | + for the current page for a given action |
| | 35 | + |
| 34 | 36 | === Bug fixes in 1.15 === |
| 35 | 37 | |
| 36 | 38 | |