(bug 13701) {{NUMBEROFVIEWS}} magic word to show number of total views.
authorNicolas Dumazet <nicdumz@users.mediawiki.org>
Sun, 19 Oct 2008 04:11:02 +0000 (04:11 +0000)
committerNicolas Dumazet <nicdumz@users.mediawiki.org>
Sun, 19 Oct 2008 04:11:02 +0000 (04:11 +0000)
RELEASE-NOTES
includes/MagicWord.php
includes/parser/CoreParserFunctions.php
includes/parser/Parser.php
includes/parser/Parser_OldPP.php
includes/specials/SpecialDisambiguations.php
languages/messages/MessagesEn.php

index ce12fad..08902a9 100644 (file)
@@ -275,6 +275,7 @@ The following extensions are migrated into MediaWiki 1.14:
 * (bug 15717) Set $separatorTransformTable for language 'eu'
 * (bug 15605) Enabled $datePreferences for language 'hr'. Added standard date
   preferences.
+* (bug 13701) {{NUMBEROFVIEWS}} magic word to show number of total views.
 
 === API changes in 1.14 ===
 
index 594b2f4..5b5b77f 100644 (file)
@@ -103,6 +103,7 @@ class MagicWord {
                'contentlanguage',
                'pagesinnamespace',
                'numberofadmins',
+               'numberofviews',
                'defaultsort',
                'pagesincategory',
                'index',
@@ -146,6 +147,7 @@ class MagicWord {
                'localtimestamp' => 3600,
                'pagesinnamespace' => 3600,
                'numberofadmins' => 3600,
+               'numberofviews' => 3600,
                'numberingroup' => 3600,
                );
 
index c496544..e5fb65e 100644 (file)
@@ -215,6 +215,9 @@ class CoreParserFunctions {
        static function numberofedits( $parser, $raw = null ) {
                return self::formatRaw( SiteStats::edits(), $raw );
        }
+       static function numberofviews( $parser, $raw = null ) {
+               return self::formatRaw( SiteStats::views(), $raw );
+       }
        static function pagesinnamespace( $parser, $namespace = 0, $raw = null ) {
                return self::formatRaw( SiteStats::pagesInNs( intval( $namespace ) ), $raw );
        }
index 7b2f231..0d3d517 100644 (file)
@@ -2587,6 +2587,8 @@ class Parser
                                return $this->mVarCache[$index] = $wgContLang->formatNum( SiteStats::numberingroup('sysop') );
                        case 'numberofedits':
                                return $this->mVarCache[$index] = $wgContLang->formatNum( SiteStats::edits() );
+                       case 'numberofviews':
+                               return $this->mVarCache[$index] = $wgContLang->formatNum( SiteStats::views() );
                        case 'currenttimestamp':
                                return $this->mVarCache[$index] = wfTimestamp( TS_MW, $ts );
                        case 'localtimestamp':
index 177b989..907bba8 100644 (file)
@@ -121,6 +121,7 @@ class Parser_OldPP
                $this->setFunctionHook( 'numberoffiles',    array( 'CoreParserFunctions', 'numberoffiles'    ), SFH_NO_HASH );
                $this->setFunctionHook( 'numberofadmins',   array( 'CoreParserFunctions', 'numberofadmins'   ), SFH_NO_HASH );
                $this->setFunctionHook( 'numberofedits',    array( 'CoreParserFunctions', 'numberofedits'    ), SFH_NO_HASH );
+               $this->setFunctionHook( 'numberofviews',    array( 'CoreParserFunctions', 'numberofviews'    ), SFH_NO_HASH );
                $this->setFunctionHook( 'language',         array( 'CoreParserFunctions', 'language'         ), SFH_NO_HASH );
                $this->setFunctionHook( 'padleft',          array( 'CoreParserFunctions', 'padleft'          ), SFH_NO_HASH );
                $this->setFunctionHook( 'padright',         array( 'CoreParserFunctions', 'padright'         ), SFH_NO_HASH );
@@ -2565,6 +2566,8 @@ class Parser_OldPP
                                return $varCache[$index]  = $wgContLang->formatNum( SiteStats::numberingroup('sysop') );
                        case 'numberofedits':
                                return $varCache[$index]  = $wgContLang->formatNum( SiteStats::edits() );
+                       case 'numberofviews':
+                               return $varCache[$index]  = $wgContLang->formatNum( SiteStats::views() );
                        case 'currenttimestamp':
                                return $varCache[$index] = wfTimestampNow();
                        case 'localtimestamp':
index a29111c..0a728b6 100644 (file)
@@ -84,7 +84,7 @@ class DisambiguationsPage extends PageQueryPage {
 
        function formatResult( $skin, $result ) {
                global $wgContLang;
-               $title = Title::newFromId( $result->value );
+               $title = Title::newFromID( $result->value );
                $dp = Title::makeTitle( $result->namespace, $result->title );
 
                $from = $skin->link( $title );
index 5bf4a1c..6a49a07 100644 (file)
@@ -247,6 +247,7 @@ $magicWords = array(
        'numberoffiles'          => array( 1,    'NUMBEROFFILES'          ),
        'numberofusers'          => array( 1,    'NUMBEROFUSERS'          ),
        'numberofedits'          => array( 1,    'NUMBEROFEDITS'          ),
+       'numberofviews'          => array( 1,    'NUMBEROFVIEWS'          ),
        'pagename'               => array( 1,    'PAGENAME'               ),
        'pagenamee'              => array( 1,    'PAGENAMEE'              ),
        'namespace'              => array( 1,    'NAMESPACE'              ),