Example #1
0
 /**
  * Get the IContextSource in use here
  * @return IContextSource
  */
 public final function getContext()
 {
     if ($this->context instanceof IContextSource) {
         return $this->context;
     }
     return $this->page->getContext();
 }
Example #2
0
	/**
	 * Get the IContextSource in use here
	 * @return IContextSource
	 */
	final public function getContext() {
		if ( $this->context instanceof IContextSource ) {
			return $this->context;
		} else if ( $this->page instanceof Article ) {
			// NOTE: $this->page can be a WikiPage, which does not have a context.
			wfDebug( __METHOD__ . ': no context known, falling back to Article\'s context.' );
			return $this->page->getContext();
		}

		wfWarn( __METHOD__ . ': no context known, falling back to RequestContext::getMain().' );
		return RequestContext::getMain();
	}