return $this->getResult()->getData();
}
+ /**
+ * Create a new RequestContext object to use e.g. for calls to other parts
+ * the software.
+ * The object will have the WebRequest and the User object set to the ones
+ * used in this instance.
+ *
+ * @return RequestContext
+ */
+ public function createContext() {
+ global $wgUser;
+
+ $context = new RequestContext;
+ $context->setRequest( $this->getMain()->getRequest() );
+ $context->setUser( $wgUser ); /// @todo FIXME: we should store the User object
+
+ return $context;
+ }
+
/**
* Set warning section for this module. Users should monitor this
* section to notice any changes in API. Multiple calls to this
}
private function categoriesHtml( $categories ) {
- global $wgOut, $wgUser;
- $wgOut->addCategoryLinks( $categories );
- return $wgUser->getSkin()->getCategories();
+ $context = $this->createContext();
+ $context->getOutput()->addCategoryLinks( $categories );
+ return $context->getSkin()->getCategories();
}
/**