* (bug 28719) Do not call mLinkHolders __destruct explicitly
[lhc/web/wiklou.git] / includes / parser / CoreParserFunctions.php
index b76c798..854676e 100644 (file)
  * @ingroup Parser
  */
 class CoreParserFunctions {
+       /**
+        * @param $parser Parser
+        * @return void
+        */
        static function register( $parser ) {
                global $wgAllowDisplayTitle, $wgAllowSlowParserFunctions;
 
@@ -83,11 +87,15 @@ class CoreParserFunctions {
                }
        }
 
+       /**
+        * @param $parser Parser
+        * @param string $part1
+        * @return array
+        */
        static function intFunction( $parser, $part1 = '' /*, ... */ ) {
                if ( strval( $part1 ) !== '' ) {
                        $args = array_slice( func_get_args(), 2 );
-                       $message = wfMsgGetKey( $part1, true, $parser->getOptions()->getUserLang(), false );
-                       $message = wfMsgReplaceArgs( $message, $args );
+                       $message = wfMessage( $part1, $args )->inLanguage( $parser->getOptions()->getUserLang() )->plain();
                        $message = $parser->replaceVariables( $message ); // like MessageCache::transform()
                        return $message;
                } else {
@@ -95,6 +103,12 @@ class CoreParserFunctions {
                }
        }
 
+       /**
+        * @param $parser Parser
+        * @param  $date
+        * @param null $defaultPref
+        * @return mixed|string
+        */
        static function formatDate( $parser, $date, $defaultPref = null ) {
                $df = DateFormatter::getInstance();
 
@@ -172,6 +186,11 @@ class CoreParserFunctions {
                return $wgContLang->ucfirst( $s );
        }
 
+       /**
+        * @param $parser Parser
+        * @param string $s
+        * @return
+        */
        static function lc( $parser, $s = '' ) {
                global $wgContLang;
                if ( is_callable( array( $parser, 'markerSkipCallback' ) ) ) {
@@ -181,6 +200,11 @@ class CoreParserFunctions {
                }
        }
 
+       /**
+        * @param $parser Parser
+        * @param string $s
+        * @return
+        */
        static function uc( $parser, $s = '' ) {
                global $wgContLang;
                if ( is_callable( array( $parser, 'markerSkipCallback' ) ) ) {
@@ -219,6 +243,12 @@ class CoreParserFunctions {
                }
        }
 
+       /**
+        * @param $parser Parser
+        * @param string $num
+        * @param null $raw
+        * @return
+        */
        static function formatNum( $parser, $num = '', $raw = null) {
                if ( self::israw( $raw ) ) {
                        return $parser->getFunctionLang()->parseFormattedNumber( $num );
@@ -227,10 +257,21 @@ class CoreParserFunctions {
                }
        }
 
+       /**
+        * @param $parser Parser
+        * @param string $case
+        * @param string $word
+        * @return
+        */
        static function grammar( $parser, $case = '', $word = '' ) {
                return $parser->getFunctionLang()->convertGrammar( $word, $case );
        }
 
+       /**
+        * @param $parser Parser
+        * @param $user User
+        * @return
+        */
        static function gender( $parser, $user ) {
                wfProfileIn( __METHOD__ );
                $forms = array_slice( func_get_args(), 2);
@@ -255,6 +296,12 @@ class CoreParserFunctions {
                wfProfileOut( __METHOD__ );
                return $ret;
        }
+
+       /**
+        * @param $parser Parser
+        * @param string $text
+        * @return
+        */
        static function plural( $parser, $text = '' ) {
                $forms = array_slice( func_get_args(), 2 );
                $text = $parser->getFunctionLang()->parseFormattedNumber( $text );
@@ -508,6 +555,7 @@ class CoreParserFunctions {
         *   to the link cache, so the local cache here should be unnecessary, but
         *   in fact calling getLength() repeatedly for the same $page does seem to
         *   run one query for each call?
+        * @param $parser Parser
         */
        static function pagesize( $parser, $page = '', $raw = null ) {
                static $cache = array();
@@ -585,12 +633,17 @@ class CoreParserFunctions {
                return self::pad( $string, $length, $padding );
        }
 
+       /**
+        * @param $parser Parser
+        * @param  $text
+        * @return string
+        */
        static function anchorencode( $parser, $text ) {
                return substr( $parser->guessSectionNameFromWikiText( $text ), 1);
        }
 
        static function special( $parser, $text ) {
-               list( $page, $subpage ) = SpecialPage::resolveAliasWithSubpage( $text );
+               list( $page, $subpage ) = SpecialPageFactory::resolveAlias( $text );
                if ( $page ) {
                        $title = SpecialPage::getTitleFor( $page, $subpage );
                        return $title;
@@ -599,6 +652,11 @@ class CoreParserFunctions {
                }
        }
 
+       /**
+        * @param $parser Parser
+        * @param  $text
+        * @return string
+        */
        public static function defaultsort( $parser, $text ) {
                $text = trim( $text );
                if( strlen( $text ) == 0 )
@@ -638,7 +696,7 @@ class CoreParserFunctions {
                }
 
                if ( $file ) {
-                       $url = $file->getUrl();
+                       $url = $file->getFullUrl();
 
                        // If a size is requested...                    
                        if ( is_integer( $size ) ) {