|
@@ 797-809 (lines=13) @@
|
| 794 |
|
* |
| 795 |
|
* @return string |
| 796 |
|
*/ |
| 797 |
|
public static function protectionlevel( $parser, $type = '', $title = '' ) { |
| 798 |
|
$titleObject = Title::newFromText( $title ); |
| 799 |
|
if ( !( $titleObject instanceof Title ) ) { |
| 800 |
|
$titleObject = $parser->mTitle; |
| 801 |
|
} |
| 802 |
|
if ( $titleObject->areRestrictionsLoaded() || $parser->incrementExpensiveFunctionCount() ) { |
| 803 |
|
$restrictions = $titleObject->getRestrictions( strtolower( $type ) ); |
| 804 |
|
# Title::getRestrictions returns an array, its possible it may have |
| 805 |
|
# multiple values in the future |
| 806 |
|
return implode( $restrictions, ',' ); |
| 807 |
|
} |
| 808 |
|
return ''; |
| 809 |
|
} |
| 810 |
|
|
| 811 |
|
/** |
| 812 |
|
* Returns the requested protection expiry for the current page. This |
|
@@ 823-838 (lines=16) @@
|
| 820 |
|
* |
| 821 |
|
* @return string |
| 822 |
|
*/ |
| 823 |
|
public static function protectionexpiry( $parser, $type = '', $title = '' ) { |
| 824 |
|
$titleObject = Title::newFromText( $title ); |
| 825 |
|
if ( !( $titleObject instanceof Title ) ) { |
| 826 |
|
$titleObject = $parser->mTitle; |
| 827 |
|
} |
| 828 |
|
if ( $titleObject->areRestrictionsLoaded() || $parser->incrementExpensiveFunctionCount() ) { |
| 829 |
|
$expiry = $titleObject->getRestrictionExpiry( strtolower( $type ) ); |
| 830 |
|
// getRestrictionExpiry() returns false on invalid type; trying to |
| 831 |
|
// match protectionlevel() function that returns empty string instead |
| 832 |
|
if ( $expiry === false ) { |
| 833 |
|
$expiry = ''; |
| 834 |
|
} |
| 835 |
|
return $expiry; |
| 836 |
|
} |
| 837 |
|
return ''; |
| 838 |
|
} |
| 839 |
|
|
| 840 |
|
/** |
| 841 |
|
* Gives language names. |