user = $out->getUser(); $this->skin = $out->getSkin(); $this->action = $out->getContext()->getActionName(); $this->namespace = $out->getTitle()->getNamespace(); $this->contentModel = $out->getTitle()->getContentModel(); $this->withGadgetParam = $out->getRequest()->getRawVal( 'withgadget' ); } /** * @param Gadget $gadget * @return bool */ public function check( Gadget $gadget ) { $urlLoad = $this->withGadgetParam === $gadget->getName() && $gadget->supportsUrlLoad(); return ( $gadget->isEnabled( $this->user ) || $urlLoad ) && $gadget->isAllowed( $this->user ) && $gadget->isActionSupported( $this->action ) && $gadget->isSkinSupported( $this->skin ) && $gadget->isNamespaceSupported( $this->namespace ) && $gadget->isContentModelSupported( $this->contentModel ); } }