r62975 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r62974‎ | r62975 | r62976 >
Date:22:03, 25 February 2010
Author:ialex
Status:ok
Tags:
Comment:
* Fixed some doxygen warnings
* Documented a bit
Modified paths:
  • /trunk/phase3/includes/SpecialPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialPage.php
@@ -254,6 +254,9 @@
255255 /**
256256 * Given a special page alias, return the special page name.
257257 * Returns false if there is no such alias.
 258+ *
 259+ * @param $alias String
 260+ * @return String or false
258261 */
259262 static function resolveAlias( $alias ) {
260263 global $wgContLang;
@@ -272,6 +275,9 @@
273276 * Given a special page name with a possible subpage, return an array
274277 * where the first element is the special page name and the second is the
275278 * subpage.
 279+ *
 280+ * @param $alias String
 281+ * @return Array
276282 */
277283 static function resolveAliasWithSubpage( $alias ) {
278284 $bits = explode( '/', $alias, 2 );
@@ -289,8 +295,7 @@
290296 * method for adding special pages in extensions. It's now suggested that you add
291297 * an associative record to $wgSpecialPages. This avoids autoloading SpecialPage.
292298 *
293 - * @param SpecialPage $page
294 - * @static
 299+ * @param $page SpecialPage
295300 */
296301 static function addPage( &$page ) {
297302 if ( !self::$mListInitialised ) {
@@ -302,9 +307,8 @@
303308 /**
304309 * Add a page to a certain display group for Special:SpecialPages
305310 *
306 - * @param mixed $page (SpecialPage or string)
307 - * @param string $group
308 - * @static
 311+ * @param $page Mixed: SpecialPage or string
 312+ * @param $group String
309313 */
310314 static function setGroup( $page, $group ) {
311315 global $wgSpecialPageGroups;
@@ -315,8 +319,7 @@
316320 /**
317321 * Add a page to a certain display group for Special:SpecialPages
318322 *
319 - * @param SpecialPage $page
320 - * @static
 323+ * @param $page SpecialPage
321324 */
322325 static function getGroup( &$page ) {
323326 global $wgSpecialPageGroups;
@@ -340,8 +343,6 @@
341344 * Remove a special page from the list
342345 * Formerly used to disable expensive or dangerous special pages. The
343346 * preferred method is now to add a SpecialPage_initList hook.
344 - *
345 - * @static
346347 */
347348 static function removePage( $name ) {
348349 if ( !self::$mListInitialised ) {
@@ -352,8 +353,9 @@
353354
354355 /**
355356 * Check if a given name exist as a special page or as a special page alias
356 - * @param $name string: name of a special page
357 - * @return boolean: true if a special page exists with this name
 357+ *
 358+ * @param $name String: name of a special page
 359+ * @return Boolean: true if a special page exists with this name
358360 */
359361 static function exists( $name ) {
360362 global $wgContLang;
@@ -376,8 +378,9 @@
377379
378380 /**
379381 * Find the object with a given name and return it (or NULL)
380 - * @static
381 - * @param string $name
 382+ *
 383+ * @param $name String
 384+ * @return SpecialPage object or null if the page doesn't exist
382385 */
383386 static function getPage( $name ) {
384387 if ( !self::$mListInitialised ) {
@@ -401,6 +404,8 @@
402405 /**
403406 * Get a special page with a given localised name, or NULL if there
404407 * is no such special page.
 408+ *
 409+ * @return SpecialPage object or null if the page doesn't exist
405410 */
406411 static function getPageByAlias( $alias ) {
407412 $realName = self::resolveAlias( $alias );
@@ -414,7 +419,8 @@
415420 /**
416421 * Return categorised listable special pages which are available
417422 * for the current user, and everyone.
418 - * @static
 423+ *
 424+ * @return Associative array mapping page's name to its SpecialPage object
419425 */
420426 static function getUsablePages() {
421427 global $wgUser;
@@ -439,7 +445,8 @@
440446
441447 /**
442448 * Return categorised listable special pages for all users
443 - * @static
 449+ *
 450+ * @return Associative array mapping page's name to its SpecialPage object
444451 */
445452 static function getRegularPages() {
446453 if ( !self::$mListInitialised ) {
@@ -459,7 +466,8 @@
460467 /**
461468 * Return categorised listable special pages which are available
462469 * for the current user, but not for everyone
463 - * @static
 470+ *
 471+ * @return Associative array mapping page's name to its SpecialPage object
464472 */
465473 static function getRestrictedPages() {
466474 global $wgUser;
@@ -566,7 +574,8 @@
567575 * Just like executePath() except it returns the HTML instead of outputting it
568576 * Returns false if there was no such special page, or a title object if it was
569577 * a redirect.
570 - * @static
 578+ *
 579+ * @return String: HTML fragment
571580 */
572581 static function capturePath( &$title ) {
573582 global $wgOut, $wgTitle;
@@ -588,10 +597,10 @@
589598 /**
590599 * Get the local name for a specified canonical name
591600 *
592 - * @param $name
593 - * @param mixed $subpage Boolean false, or string
 601+ * @param $name String
 602+ * @param $subpage Mixed: boolean false, or string
594603 *
595 - * @return string
 604+ * @return String
596605 */
597606 static function getLocalNameFor( $name, $subpage = false ) {
598607 global $wgContLang;
@@ -621,6 +630,8 @@
622631
623632 /**
624633 * Get a localised Title object for a specified special page name
 634+ *
 635+ * @return Title object
625636 */
626637 static function getTitleFor( $name, $subpage = false ) {
627638 $name = self::getLocalNameFor( $name, $subpage );
@@ -633,6 +644,8 @@
634645
635646 /**
636647 * Get a localised Title object for a page name with a possibly unvalidated subpage
 648+ *
 649+ * @return Title object or null if the page doesn't exist
637650 */
638651 static function getSafeTitleFor( $name, $subpage = false ) {
639652 $name = self::getLocalNameFor( $name, $subpage );
@@ -645,6 +658,7 @@
646659
647660 /**
648661 * Get a title for a given alias
 662+ *
649663 * @return Title or null if there is no such alias
650664 */
651665 static function getTitleForAlias( $alias ) {
@@ -666,11 +680,12 @@
667681 * If you override execute(), you can recover the default behaviour with userCanExecute()
668682 * and displayRestrictionError()
669683 *
670 - * @param string $name Name of the special page, as seen in links and URLs
671 - * @param string $restriction User right required, e.g. "block" or "delete"
672 - * @param boolean $listed Whether the page is listed in Special:Specialpages
673 - * @param string $function Function called by execute(). By default it is constructed from $name
674 - * @param string $file File which is included by execute(). It is also constructed from $name by default
 684+ * @param $name String: name of the special page, as seen in links and URLs
 685+ * @param $restriction String: user right required, e.g. "block" or "delete"
 686+ * @param $listed Boolean: whether the page is listed in Special:Specialpages
 687+ * @param $function Callback: function called by execute(). By default it is constructed from $name
 688+ * @param $file String: file which is included by execute(). It is also constructed from $name by default
 689+ * @param $includable Boolean: whether the page can be included in normal pages
675690 */
676691 function SpecialPage( $name = '', $restriction = '', $listed = true, $function = false, $file = 'default', $includable = false ) {
677692 $this->mName = $name;
@@ -731,7 +746,7 @@
732747 * Can be overridden by subclasses with more complicated permissions
733748 * schemes.
734749 *
735 - * @return bool Should the page be displayed with the restricted-access
 750+ * @return Boolean: should the page be displayed with the restricted-access
736751 * pages?
737752 */
738753 public function isRestricted() {
@@ -745,8 +760,8 @@
746761 * special page (as defined by $mRestriction). Can be overridden by sub-
747762 * classes with more complicated permissions schemes.
748763 *
749 - * @param User $user The user to check
750 - * @return bool Does the user have permission to view the page?
 764+ * @param $user User: the user to check
 765+ * @return Boolean: does the user have permission to view the page?
751766 */
752767 public function userCanExecute( $user ) {
753768 return $user->isAllowed( $this->mRestriction );
@@ -800,7 +815,7 @@
801816 * May be overriden, i.e. by extensions to stick with the naming conventions
802817 * for message keys: 'extensionname-xxx'
803818 *
804 - * @param string message key of the summary
 819+ * @param $summaryMessageKey String: message key of the summary
805820 */
806821 function outputHeader( $summaryMessageKey = '' ) {
807822 global $wgOut, $wgContLang;
@@ -817,17 +832,24 @@
818833
819834 }
820835
821 - # Returns the name that goes in the <h1> in the special page itself, and also the name that
822 - # will be listed in Special:Specialpages
823 - #
824 - # Derived classes can override this, but usually it is easier to keep the default behaviour.
825 - # Messages can be added at run-time, see MessageCache.php
 836+ /**
 837+ * Returns the name that goes in the \<h1\> in the special page itself, and
 838+ * also the name that will be listed in Special:Specialpages
 839+ *
 840+ * Derived classes can override this, but usually it is easier to keep the
 841+ * default behaviour. Messages can be added at run-time, see
 842+ * MessageCache.php.
 843+ *
 844+ * @return String
 845+ */
826846 function getDescription() {
827847 return wfMsg( strtolower( $this->mName ) );
828848 }
829849
830850 /**
831851 * Get a self-referential title object
 852+ *
 853+ * @return Title object
832854 */
833855 function getTitle( $subpage = false ) {
834856 return self::getTitleFor( $this->mName, $subpage );
@@ -852,7 +874,7 @@
853875 * Return part of the request string for a special redirect page
854876 * This allows passing, e.g. action=history to Special:Mypage, etc.
855877 *
856 - * @return string
 878+ * @return String
857879 */
858880 function getRedirectQuery() {
859881 global $wgRequest;

Status & tagging log