Index: CoreParserFunctions.php =================================================================== --- CoreParserFunctions.php (revision 64623) +++ CoreParserFunctions.php (working copy) @@ -49,6 +49,7 @@ $parser->setFunctionHook( 'pagesincategory', array( __CLASS__, 'pagesincategory' ), SFH_NO_HASH ); $parser->setFunctionHook( 'pagesize', array( __CLASS__, 'pagesize' ), SFH_NO_HASH ); $parser->setFunctionHook( 'protectionlevel', array( __CLASS__, 'protectionlevel' ), SFH_NO_HASH ); + $parser->setFunctionHook( 'protectionexpiry', array( __CLASS__, 'protectionexpiry' ), SFH_NO_HASH ); $parser->setFunctionHook( 'namespace', array( __CLASS__, 'mwnamespace' ), SFH_NO_HASH ); $parser->setFunctionHook( 'namespacee', array( __CLASS__, 'namespacee' ), SFH_NO_HASH ); $parser->setFunctionHook( 'talkspace', array( __CLASS__, 'talkspace' ), SFH_NO_HASH ); @@ -511,6 +512,21 @@ # multiple values in the future return implode( $restrictions, ',' ); } + + /** + * Returns the requested protection expiry time for the current page + * as a 14-character timestamp + */ + static function protectionexpiry ( $parser, $type = '' ) { + $expiry = $parser->mTitle->getRestrictionExpiry( strtolower( $type ) ); + + // getRestrictionExpiry() returns false on invalid type; trying to + // match protectionlevel() function that returns empty string instead + if ( $expiry === false) { + $expiry = ''; + } + return $expiry; + } static function language( $parser, $arg = '' ) { global $wgContLang;