X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FRequestContext.php;h=c0b49a1e8aafa9149b1c7177db3ee552982b18ea;hb=bbb0d379b9abfcd9a2f4573f1afbe2f85eb35155;hp=f26847e4529fe47178fb7cb37b92c6257ea47d47;hpb=c2710a9635b88503637aa8d5c6c4211b3b1d3b1d;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/RequestContext.php b/includes/RequestContext.php index f26847e452..c0b49a1e8a 100644 --- a/includes/RequestContext.php +++ b/includes/RequestContext.php @@ -1,15 +1,81 @@ context === null ) { + $class = get_class( $this ); + wfDebug( __METHOD__ . " ($class): called and \$context is null. Using RequestContext::getMain() for sanity\n" ); + $this->context = RequestContext::getMain(); + } return $this->context; } @@ -316,7 +339,7 @@ abstract class ContextSource implements IContextSource { * @return WebRequest */ public function getRequest() { - return $this->context->getRequest(); + return $this->getContext()->getRequest(); } /** @@ -325,7 +348,7 @@ abstract class ContextSource implements IContextSource { * @return Title */ public function getTitle() { - return $this->context->getTitle(); + return $this->getContext()->getTitle(); } /** @@ -334,7 +357,7 @@ abstract class ContextSource implements IContextSource { * @return OutputPage object */ public function getOutput() { - return $this->context->getOutput(); + return $this->getContext()->getOutput(); } /** @@ -343,7 +366,7 @@ abstract class ContextSource implements IContextSource { * @return User */ public function getUser() { - return $this->context->getUser(); + return $this->getContext()->getUser(); } /** @@ -352,7 +375,7 @@ abstract class ContextSource implements IContextSource { * @return Language */ public function getLang() { - return $this->context->getLang(); + return $this->getContext()->getLang(); } /** @@ -361,6 +384,16 @@ abstract class ContextSource implements IContextSource { * @return Skin */ public function getSkin() { - return $this->context->getSkin(); + return $this->getContext()->getSkin(); + } + + /** + * Get a Message object with context set + * Parameters are the same as wfMessage() + * + * @return Message object + */ + public function msg( /* $args */ ) { + return call_user_func_array( array( $this->getContext(), 'msg' ), func_get_args() ); } }