示例#1
0
 /**
  * @author Federico "Lox" Lucignano
  *
  * overrides TopListBase::_loadData
  */
 protected function _loadData($forceReload = false)
 {
     parent::_loadData($forceReload);
     if (!$this->mDataLoaded || $forceReload) {
         if ($this->exists()) {
             TopListParser::parse($this);
             $relatedArticle = TopListParser::getAttribute(TOPLIST_ATTRIBUTE_RELATED);
             if (!empty($relatedArticle)) {
                 $relatedArticle = Title::newFromText($relatedArticle);
             }
             $this->setRelatedArticle($relatedArticle);
             $picture = TopListParser::getAttribute(TOPLIST_ATTRIBUTE_PICTURE);
             if (!empty($picture)) {
                 $picture = Title::newFromText($picture);
             }
             $this->setPicture($picture);
             $description = TopListParser::getAttribute(TOPLIST_ATTRIBUTE_DESCRIPTION);
             if (!empty($description)) {
                 $this->setDescription($description);
             }
         }
         $this->mDataLoaded = true;
     }
 }
示例#2
0
 /**
  * @author Federico "Lox" Lucignano
  *
  * overrides TopListBase::checkForProcessing
  */
 public function checkForProcessing($mode = TOPLISTS_SAVE_AUTODETECT, User $user = null, $listMode = TOPLISTS_SAVE_UPDATE)
 {
     $errors = parent::checkForProcessing($mode, $user);
     if ($errors === true) {
         $errors = array();
     }
     $title = Title::newFromText($this->mTitle->getText(), NS_TOPLIST);
     if (!($title instanceof Title && $title->exists()) && $listMode == TOPLISTS_SAVE_UPDATE) {
         $errors[] = array('msg' => 'toplists-error-article-not-exists', 'params' => array($title->getSubpageText(), $title->getEditURL()));
     }
     return empty($errors) ? true : $errors;
 }