Index: trunk/phase3/includes/parser/CoreParserFunctions.php |
— | — | @@ -38,6 +38,7 @@ |
39 | 39 | $parser->setFunctionHook( 'numberingroup', array( __CLASS__, 'numberingroup' ), SFH_NO_HASH ); |
40 | 40 | $parser->setFunctionHook( 'numberofedits', array( __CLASS__, 'numberofedits' ), SFH_NO_HASH ); |
41 | 41 | $parser->setFunctionHook( 'numberofviews', array( __CLASS__, 'numberofviews' ), SFH_NO_HASH ); |
| 42 | + $parser->setFunctionHook( 'numberofcontribs', array( __CLASS__, 'numberofcontribs' ), SFH_NO_HASH ); |
42 | 43 | $parser->setFunctionHook( 'language', array( __CLASS__, 'language' ), SFH_NO_HASH ); |
43 | 44 | $parser->setFunctionHook( 'padleft', array( __CLASS__, 'padleft' ), SFH_NO_HASH ); |
44 | 45 | $parser->setFunctionHook( 'padright', array( __CLASS__, 'padright' ), SFH_NO_HASH ); |
— | — | @@ -571,7 +572,7 @@ |
572 | 573 | $rev = Revision::newFromTitle($title); |
573 | 574 | $id = $rev ? $rev->getPage() : 0; |
574 | 575 | $length = $cache[$page] = $rev ? $rev->getSize() : 0; |
575 | | - |
| 576 | + |
576 | 577 | // Register dependency in templatelinks |
577 | 578 | $parser->mOutput->addTemplate( $title, $id, $rev ? $rev->getId() : 0 ); |
578 | 579 | } |
— | — | @@ -593,7 +594,20 @@ |
594 | 595 | $lang = $wgContLang->getLanguageName( strtolower( $arg ) ); |
595 | 596 | return $lang != '' ? $lang : $arg; |
596 | 597 | } |
| 598 | + |
| 599 | + /** |
| 600 | + * Returns the number of contributions by a certain user |
| 601 | + */ |
| 602 | + static function numberofcontribs( $parser, $user = null ) { |
| 603 | + if ( is_null($user) || !User::isValidUserName( $user ) ) |
| 604 | + return ''; |
| 605 | + |
| 606 | + $u = User::newFromName( $user ); |
| 607 | + $u->load(); |
597 | 608 | |
| 609 | + return wfEscapeWikiText( $u->edits( $u->mId ) ); |
| 610 | + } |
| 611 | + |
598 | 612 | /** |
599 | 613 | * Unicode-safe str_pad with the restriction that $length is forced to be <= 500 |
600 | 614 | */ |
Index: trunk/phase3/includes/MagicWord.php |
— | — | @@ -107,45 +107,46 @@ |
108 | 108 | |
109 | 109 | /* Array of caching hints for ParserCache */ |
110 | 110 | static public $mCacheTTLs = array ( |
111 | | - 'currentmonth' => 86400, |
112 | | - 'currentmonth1' => 86400, |
113 | | - 'currentmonthname' => 86400, |
114 | | - 'currentmonthnamegen' => 86400, |
115 | | - 'currentmonthabbrev' => 86400, |
116 | | - 'currentday' => 3600, |
117 | | - 'currentday2' => 3600, |
118 | | - 'currentdayname' => 3600, |
119 | | - 'currentyear' => 86400, |
120 | | - 'currenttime' => 3600, |
121 | | - 'currenthour' => 3600, |
122 | | - 'localmonth' => 86400, |
123 | | - 'localmonth1' => 86400, |
124 | | - 'localmonthname' => 86400, |
125 | | - 'localmonthnamegen' => 86400, |
126 | | - 'localmonthabbrev' => 86400, |
127 | | - 'localday' => 3600, |
128 | | - 'localday2' => 3600, |
129 | | - 'localdayname' => 3600, |
130 | | - 'localyear' => 86400, |
131 | | - 'localtime' => 3600, |
132 | | - 'localhour' => 3600, |
133 | | - 'numberofarticles' => 3600, |
134 | | - 'numberoffiles' => 3600, |
135 | | - 'numberofedits' => 3600, |
136 | | - 'currentweek' => 3600, |
137 | | - 'currentdow' => 3600, |
138 | | - 'localweek' => 3600, |
139 | | - 'localdow' => 3600, |
140 | | - 'numberofusers' => 3600, |
141 | | - 'numberofactiveusers' => 3600, |
142 | | - 'numberofpages' => 3600, |
143 | | - 'currentversion' => 86400, |
144 | | - 'currenttimestamp' => 3600, |
145 | | - 'localtimestamp' => 3600, |
146 | | - 'pagesinnamespace' => 3600, |
147 | | - 'numberofadmins' => 3600, |
148 | | - 'numberofviews' => 3600, |
149 | | - 'numberingroup' => 3600, |
| 111 | + 'currentmonth' => 86400, |
| 112 | + 'currentmonth1' => 86400, |
| 113 | + 'currentmonthname' => 86400, |
| 114 | + 'currentmonthnamegen' => 86400, |
| 115 | + 'currentmonthabbrev' => 86400, |
| 116 | + 'currentday' => 3600, |
| 117 | + 'currentday2' => 3600, |
| 118 | + 'currentdayname' => 3600, |
| 119 | + 'currentyear' => 86400, |
| 120 | + 'currenttime' => 3600, |
| 121 | + 'currenthour' => 3600, |
| 122 | + 'localmonth' => 86400, |
| 123 | + 'localmonth1' => 86400, |
| 124 | + 'localmonthname' => 86400, |
| 125 | + 'localmonthnamegen' => 86400, |
| 126 | + 'localmonthabbrev' => 86400, |
| 127 | + 'localday' => 3600, |
| 128 | + 'localday2' => 3600, |
| 129 | + 'localdayname' => 3600, |
| 130 | + 'localyear' => 86400, |
| 131 | + 'localtime' => 3600, |
| 132 | + 'localhour' => 3600, |
| 133 | + 'numberofarticles' => 3600, |
| 134 | + 'numberoffiles' => 3600, |
| 135 | + 'numberofedits' => 3600, |
| 136 | + 'currentweek' => 3600, |
| 137 | + 'currentdow' => 3600, |
| 138 | + 'localweek' => 3600, |
| 139 | + 'localdow' => 3600, |
| 140 | + 'numberofusers' => 3600, |
| 141 | + 'numberofactiveusers' => 3600, |
| 142 | + 'numberofpages' => 3600, |
| 143 | + 'currentversion' => 86400, |
| 144 | + 'currenttimestamp' => 3600, |
| 145 | + 'localtimestamp' => 3600, |
| 146 | + 'pagesinnamespace' => 3600, |
| 147 | + 'numberofadmins' => 3600, |
| 148 | + 'numberofviews' => 3600, |
| 149 | + 'numberingroup' => 3600, |
| 150 | + 'numberofcontribs' => 3600, |
150 | 151 | ); |
151 | 152 | |
152 | 153 | static public $mDoubleUnderscoreIDs = array( |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -340,6 +340,7 @@ |
341 | 341 | 'index' => array( 1, '__INDEX__' ), |
342 | 342 | 'noindex' => array( 1, '__NOINDEX__' ), |
343 | 343 | 'numberingroup' => array( 1, 'NUMBERINGROUP', 'NUMINGROUP' ), |
| 344 | + 'numberofcontribs' => array( 1, 'NUMBEROFCONTRIBS', 'USERCONTRIBS', 'NUMOFCONTRIBS' ), |
344 | 345 | 'staticredirect' => array( 1, '__STATICREDIRECT__' ), |
345 | 346 | 'protectionlevel' => array( 1, 'PROTECTIONLEVEL' ), |
346 | 347 | 'formatdate' => array( 0, 'formatdate', 'dateformat' ), |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -82,6 +82,8 @@ |
83 | 83 | * (bug 11484) Added ISO speed rating to default collapsed EXIF metadata view |
84 | 84 | * (bug 18958) Added ability to disable entire variant conversion engine |
85 | 85 | per user preferences |
| 86 | +* (bug 19012) Introduce {{NUMBEROFCONTRIBS}} variable to display the number |
| 87 | + of contributions a user has. |
86 | 88 | |
87 | 89 | === Bug fixes in 1.16 === |
88 | 90 | |