コード例 #1
0
 /**
  * Makes a negative recognition marking the template as a not-infobox one.
  * @return bool
  */
 public function markTemplateAsNotInfobox()
 {
     /**
      * First, validate the request.
      */
     $pageId = $this->getRequest()->getInt('pageId');
     if (!$this->isValidPostRequest() || $pageId === 0) {
         $this->response->setVal('status', false);
         return false;
     }
     /**
      * Then classify the template as not-infobox
      * (primary: unclassified, secondary: with logged data)
      */
     $tc = new TemplateClassificationController(Title::newFromID($pageId));
     $this->response->setVal('status', $tc->classifyTemplate(TemplateClassificationController::TEMPLATE_INFOBOX, false));
 }
コード例 #2
0
 public static function isInfoboxTemplate(Title $title)
 {
     $namespace = $title->getNamespace();
     if ($namespace === NS_TEMPLATE && class_exists('TemplateClassificationController')) {
         $tc = new TemplateClassificationController($title);
         return $tc->isType($tc::TEMPLATE_INFOBOX) || TemplateDraftHelper::isTitleDraft($title);
     }
     return false;
 }
コード例 #3
0
 /**
  * Checks if the template has already been classified.
  * We display the create module only if the type is empty (nobody classified it yet)
  * or is classified as an infobox one.
  * @param Title $title
  * @return bool
  */
 public function shouldDisplayCreateModule(Title $title)
 {
     $tc = new TemplateClassificationController($title);
     $type = $tc->getType();
     return (empty($type) || $type === $tc::TEMPLATE_INFOBOX) && !self::titleHasPortableInfobox($title);
 }