From 0ed9be373b57efe282025cc115a1ae581a7b89bb Mon Sep 17 00:00:00 2001
From: Pavel Selitskas
Date: Fri, 18 Jan 2013 22:03:01 +0300
Subject: [PATCH] (Bug 17970) {{PROTECTIONLEVEL}} should be able to return the
status for pages besides the one it's on
Change-Id: I4c60a5f25c739583eb087024c5e949ebcd2def72
---
includes/parser/CoreParserFunctions.php | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
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, ',' );
--
2.20.1