From: Pavel Selitskas Date: Fri, 18 Jan 2013 19:03:01 +0000 (+0300) Subject: (Bug 17970) {{PROTECTIONLEVEL}} should be able to return the status for pages besides... X-Git-Tag: 1.31.0-rc.0~20983^2 X-Git-Url: http://git.cyclocoop.org/%7D%7Cconcat%7B?a=commitdiff_plain;h=0ed9be373b57efe282025cc115a1ae581a7b89bb;p=lhc%2Fweb%2Fwiklou.git (Bug 17970) {{PROTECTIONLEVEL}} should be able to return the status for pages besides the one it's on Change-Id: I4c60a5f25c739583eb087024c5e949ebcd2def72 --- diff --git a/includes/parser/CoreParserFunctions.php b/includes/parser/CoreParserFunctions.php index 8917b6d06b..fa934d789c 100644 --- a/includes/parser/CoreParserFunctions.php +++ b/includes/parser/CoreParserFunctions.php @@ -672,11 +672,20 @@ class CoreParserFunctions { } /** - * Returns the requested protection level for the current page + * Returns the requested protection level for the current page + * + * @param Parser $parser + * @param string $type + * @param string $title + * * @return string */ - static function protectionlevel( $parser, $type = '' ) { - $restrictions = $parser->mTitle->getRestrictions( strtolower( $type ) ); + static function protectionlevel( $parser, $type = '', $title = '' ) { + $titleObject = Title::newFromText( $title ); + if ( !( $titleObject instanceof Title ) ) { + $titleObject = $parser->mTitle; + } + $restrictions = $titleObject->getRestrictions( strtolower( $type ) ); # Title::getRestrictions returns an array, its possible it may have # multiple values in the future return implode( $restrictions, ',' );