Added iterator interface to ResultWrapper. No support in Oracle yet. Updated document...
[lhc/web/wiklou.git] / includes / SpecialPage.php
index 4bcdf8a..89fd15b 100644 (file)
@@ -26,7 +26,8 @@
 
 /**
  * Parent special page class, also static functions for handling the special
- * page list
+ * page list.
+ * @addtogroup SpecialPage
  */
 class SpecialPage
 {
@@ -93,12 +94,14 @@ class SpecialPage
                'Uncategorizedpages'        => array( 'SpecialPage', 'Uncategorizedpages' ),
                'Uncategorizedcategories'   => array( 'SpecialPage', 'Uncategorizedcategories' ),
                'Uncategorizedimages'       => array( 'SpecialPage', 'Uncategorizedimages' ),
+               'Uncategorizedtemplates'        => array( 'SpecialPage', 'Uncategorizedtemplates' ),
                'Unusedcategories'          => array( 'SpecialPage', 'Unusedcategories' ),
                'Unusedimages'              => array( 'SpecialPage', 'Unusedimages' ),
                'Wantedpages'               => array( 'IncludableSpecialPage', 'Wantedpages' ),
                'Wantedcategories'          => array( 'SpecialPage', 'Wantedcategories' ),
                'Mostlinked'                => array( 'SpecialPage', 'Mostlinked' ),
                'Mostlinkedcategories'      => array( 'SpecialPage', 'Mostlinkedcategories' ),
+               'Mostlinkedtemplates'           => array( 'SpecialPage', 'Mostlinkedtemplates' ),
                'Mostcategories'            => array( 'SpecialPage', 'Mostcategories' ),
                'Mostimages'                => array( 'SpecialPage', 'Mostimages' ),
                'Mostrevisions'             => array( 'SpecialPage', 'Mostrevisions' ),
@@ -176,7 +179,7 @@ class SpecialPage
                }
 
                if( $wgEmailAuthentication ) {
-                       self::$mList['Confirmemail'] = array( 'UnlistedSpecialPage', 'Confirmemail' );
+                       self::$mList['Confirmemail'] = 'EmailConfirmation';
                }
 
                # Add extension special pages
@@ -273,6 +276,30 @@ class SpecialPage
                unset( self::$mList[$name] );
        }
 
+       /**
+        * Check if a given name exist as a special page or as a special page alias
+        * @param $name string: name of a special page
+        * @return boolean: true if a special page exists with this name
+        */
+       static function exists( $name ) {
+               global $wgContLang;
+               if ( !self::$mListInitialised ) {
+                       self::initList();
+               }
+               if( !self::$mAliases ) {
+                       self::initAliasList();
+               }
+
+               # Remove special pages inline parameters:
+               $bits = explode( '/', $name );
+               $name = $wgContLang->caseFold($bits[0]);
+
+               return
+                       array_key_exists( $name, self::$mList )
+                       or array_key_exists( $name, self::$mAliases )
+               ;
+       }
+
        /**
         * Find the object with a given name and return it (or NULL)
         * @static
@@ -692,6 +719,7 @@ class SpecialPage
 
 /**
  * Shortcut to construct a special page which is unlisted by default
+ * @addtogroup SpecialPage
  */
 class UnlistedSpecialPage extends SpecialPage
 {
@@ -702,6 +730,7 @@ class UnlistedSpecialPage extends SpecialPage
 
 /**
  * Shortcut to construct an includable special  page
+ * @addtogroup SpecialPage
  */
 class IncludableSpecialPage extends SpecialPage
 {
@@ -710,6 +739,10 @@ class IncludableSpecialPage extends SpecialPage
        }
 }
 
+/**
+ * Shortcut to construct a special page alias.
+ * @addtogroup SpecialPage
+ */
 class SpecialRedirectToSpecial extends UnlistedSpecialPage {
        var $redirName, $redirSubpage;
 
@@ -729,6 +762,17 @@ class SpecialRedirectToSpecial extends UnlistedSpecialPage {
        }
 }
 
+/** SpecialMypage, SpecialMytalk and SpecialMycontributions special pages
+ * are used to get user independant links pointing to the user page, talk
+ * page and list of contributions.
+ * This can let us cache a single copy of any generated content for all
+ * users.
+ */
+
+/**
+ * Shortcut to construct a special page pointing to current user user's page.
+ * @addtogroup SpecialPage
+ */
 class SpecialMypage extends UnlistedSpecialPage {
        function __construct() {
                parent::__construct( 'Mypage' );
@@ -745,6 +789,10 @@ class SpecialMypage extends UnlistedSpecialPage {
        }
 }
 
+/**
+ * Shortcut to construct a special page pointing to current user talk page.
+ * @addtogroup SpecialPage
+ */
 class SpecialMytalk extends UnlistedSpecialPage {
        function __construct() {
                parent::__construct( 'Mytalk' );
@@ -761,6 +809,10 @@ class SpecialMytalk extends UnlistedSpecialPage {
        }
 }
 
+/**
+ * Shortcut to construct a special page pointing to current user contributions.
+ * @addtogroup SpecialPage
+ */
 class SpecialMycontributions extends UnlistedSpecialPage {
        function __construct() {
                parent::__construct(  'Mycontributions' );
@@ -772,4 +824,4 @@ class SpecialMycontributions extends UnlistedSpecialPage {
        }
 }
 
-?>
+