From 376bf1794fe809cf3c3e7199f2bf288aa876ac2a Mon Sep 17 00:00:00 2001 From: Daniel Friesen Date: Sun, 3 Apr 2011 04:36:02 +0000 Subject: [PATCH] Start managing output and input context from special pages themselves instead of using globals. We already had a setContext, Special page implementations should be properly utalizing that data. --- includes/SpecialPage.php | 47 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/includes/SpecialPage.php b/includes/SpecialPage.php index bdccf2afb7..5da2ef7cbb 100644 --- a/includes/SpecialPage.php +++ b/includes/SpecialPage.php @@ -996,6 +996,53 @@ class SpecialPage { $this->mOutput = $output; $this->mFullTitle = $output->getTitle(); } + + /** + * Get the WebRequest being used for this instance + * + * @return WebRequest + */ + public function getRequest() { + if ( !isset($this->mRequest) ) { + wfDebug( __METHOD__ . " called and \$mRequest is null. Return \$wgRequest for sanity\n" ); + global $wgRequest; + return $wgRequest; + } + return $this->mRequest; + } + + /** + * Get the OutputPage being used for this instance + * + * @return OutputPage + */ + public function getOutput() { + if ( !isset($this->mOutput) ) { + wfDebug( __METHOD__ . " called and \$mOutput is null. Return \$wgOut for sanity\n" ); + global $wgOut; + return $wgOut; + } + return $this->mOutput; + } + + /** + * Shortcut to get the skin being used for this instance + * + * @return User + */ + public function getUser() { + return $this->getOutput()->getUser(); + } + + /** + * Shortcut to get the skin being used for this instance + * + * @return Skin + */ + public function getSkin() { + return $this->getOutput()->getSkin(); + } + /** * Wrapper around wfMessage that sets the current context. Currently this * is only the title. -- 2.20.1