user = $out->getUser(); $this->target = $out->getTarget() ?? 'desktop'; $this->skin = $out->getSkin(); $this->action = $out->getContext()->getActionName(); $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 ) && ( in_array( $this->target, $gadget->getTargets() ) ); } }