[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/includes/specials/ -> SpecialMyRedirectPages.php (source)

   1  <?php
   2  /**
   3   * Special pages that are used to get user independent links pointing to
   4   * current user's pages (user page, talk page, contributions, etc.).
   5   * This can let us cache a single copy of some generated content for all
   6   * users or be linked in wikitext help pages.
   7   *
   8   * This program is free software; you can redistribute it and/or modify
   9   * it under the terms of the GNU General Public License as published by
  10   * the Free Software Foundation; either version 2 of the License, or
  11   * (at your option) any later version.
  12   *
  13   * This program is distributed in the hope that it will be useful,
  14   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16   * GNU General Public License for more details.
  17   *
  18   * You should have received a copy of the GNU General Public License along
  19   * with this program; if not, write to the Free Software Foundation, Inc.,
  20   * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  21   * http://www.gnu.org/copyleft/gpl.html
  22   *
  23   * @file
  24   * @ingroup SpecialPage
  25   */
  26  
  27  /**
  28   * Special page pointing to current user's user page.
  29   *
  30   * @ingroup SpecialPage
  31   */
  32  class SpecialMypage extends RedirectSpecialArticle {
  33  	function __construct() {
  34          parent::__construct( 'Mypage' );
  35      }
  36  
  37  	function getRedirect( $subpage ) {
  38          if ( strval( $subpage ) !== '' ) {
  39              return Title::makeTitle( NS_USER, $this->getUser()->getName() . '/' . $subpage );
  40          } else {
  41              return Title::makeTitle( NS_USER, $this->getUser()->getName() );
  42          }
  43      }
  44  }
  45  
  46  /**
  47   * Special page pointing to current user's talk page.
  48   *
  49   * @ingroup SpecialPage
  50   */
  51  class SpecialMytalk extends RedirectSpecialArticle {
  52  	function __construct() {
  53          parent::__construct( 'Mytalk' );
  54      }
  55  
  56  	function getRedirect( $subpage ) {
  57          if ( strval( $subpage ) !== '' ) {
  58              return Title::makeTitle( NS_USER_TALK, $this->getUser()->getName() . '/' . $subpage );
  59          } else {
  60              return Title::makeTitle( NS_USER_TALK, $this->getUser()->getName() );
  61          }
  62      }
  63  }
  64  
  65  /**
  66   * Special page pointing to current user's contributions.
  67   *
  68   * @ingroup SpecialPage
  69   */
  70  class SpecialMycontributions extends RedirectSpecialPage {
  71  	function __construct() {
  72          parent::__construct( 'Mycontributions' );
  73          $this->mAllowedRedirectParams = array( 'limit', 'namespace', 'tagfilter',
  74              'offset', 'dir', 'year', 'month', 'feed' );
  75      }
  76  
  77  	function getRedirect( $subpage ) {
  78          return SpecialPage::getTitleFor( 'Contributions', $this->getUser()->getName() );
  79      }
  80  }
  81  
  82  /**
  83   * Special page pointing to current user's uploaded files.
  84   *
  85   * @ingroup SpecialPage
  86   */
  87  class SpecialMyuploads extends RedirectSpecialPage {
  88  	function __construct() {
  89          parent::__construct( 'Myuploads' );
  90          $this->mAllowedRedirectParams = array( 'limit', 'ilshowall', 'ilsearch' );
  91      }
  92  
  93  	function getRedirect( $subpage ) {
  94          return SpecialPage::getTitleFor( 'Listfiles', $this->getUser()->getName() );
  95      }
  96  }
  97  
  98  /**
  99   * Special page pointing to current user's uploaded files (including old versions).
 100   *
 101   * @ingroup SpecialPage
 102   */
 103  class SpecialAllMyUploads extends RedirectSpecialPage {
 104  	function __construct() {
 105          parent::__construct( 'AllMyUploads' );
 106          $this->mAllowedRedirectParams = array( 'limit', 'ilsearch' );
 107      }
 108  
 109  	function getRedirect( $subpage ) {
 110          $this->mAddedRedirectParams['ilshowall'] = 1;
 111  
 112          return SpecialPage::getTitleFor( 'Listfiles', $this->getUser()->getName() );
 113      }
 114  }


Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1