// Query parameters added by redirects
protected $mAddedRedirectParams = array();
- public function execute( $par ) {
- $redirect = $this->getRedirect( $par );
+ /**
+ * @param string|null $subpage
+ */
+ public function execute( $subpage ) {
+ $redirect = $this->getRedirect( $subpage );
$query = $this->getRedirectQuery();
// Redirect to a page title with possible query parameters
if ( $redirect instanceof Title ) {
* If the special page is a redirect, then get the Title object it redirects to.
* False otherwise.
*
- * @param string $par Subpage string
+ * @param string|null $subpage
* @return Title|bool
*/
- abstract public function getRedirect( $par );
+ abstract public function getRedirect( $subpage );
/**
* Return part of the request string for a special redirect page
*/
public function getRedirectQuery() {
$params = array();
+ $request = $this->getRequest();
foreach ( $this->mAllowedRedirectParams as $arg ) {
- if ( $this->getRequest()->getVal( $arg, null ) !== null ) {
- $params[$arg] = $this->getRequest()->getVal( $arg );
+ if ( $request->getVal( $arg, null ) !== null ) {
+ $params[$arg] = $request->getVal( $arg );
+ } elseif ( $request->getArray( $arg, null ) !== null ) {
+ $params[$arg] = $request->getArray( $arg );
}
}
$this->mAddedRedirectParams = $addedRedirectParams;
}
+ /**
+ * @param string|null $subpage
+ * @return Title|bool
+ */
public function getRedirect( $subpage ) {
if ( $this->redirSubpage === false ) {
return SpecialPage::getTitleFor( $this->redirName, $subpage );
- } else {
- return SpecialPage::getTitleFor( $this->redirName, $this->redirSubpage );
}
+
+ return SpecialPage::getTitleFor( $this->redirName, $this->redirSubpage );
}
}
'action',
'redirect', 'rdfrom',
# Options for preloaded edits
- 'preload', 'editintro', 'preloadtitle', 'summary', 'nosummary',
+ 'preload', 'preloadparams', 'editintro', 'preloadtitle', 'summary', 'nosummary',
# Options for overriding user settings
'preview', 'minor', 'watchthis',
# Options for history/diffs
'ctype', 'maxage', 'smaxage',
);
- wfRunHooks( "RedirectSpecialArticleRedirectParams", array( &$redirectParams ) );
+ Hooks::run( "RedirectSpecialArticleRedirectParams", array( &$redirectParams ) );
$this->mAllowedRedirectParams = $redirectParams;
}
}