public function parseTag($sTitle) { global $wgParser; $oTitle = Title::newFromText($sTitle, NS_BLOG_LISTING); $oArticle = new Article($oTitle, 0); $sArticleBody = $oArticle->getContent(); $aMatches = null; preg_match('/<bloglist[^>]*>(.*)<\\/bloglist>/siU', $sArticleBody, $aMatches); if (isset($aMatches[1]) && !empty($aMatches)) { BlogTemplateClass::parseTag($aMatches[1], array(), $wgParser); $aOptions = BlogTemplateClass::getOptions(); //echo "<pre>"; print_r($aOptions); echo "</pre>"; $sPageCategories = ''; foreach (array_keys($oTitle->getParentCategories()) as $sCategoryFullName) { $aCategoryNameParts = explode(':', $sCategoryFullName); if (!empty($aCategoryNameParts[1])) { $sPageCategories .= (!empty($sPageCategories) ? "|" : "") . strtr($aCategoryNameParts[1], '_', ' '); } } $sListingCategories = ''; foreach (BlogTemplateClass::getCategoryNames() as $sCategoryName) { $sListingCategories .= (!empty($sListingCategories) ? "|" : "") . strtr($sCategoryName, '_', ' '); } $this->mFormData['listingTitle'] = $aOptions['title']; $this->mFormData['listingCategories'] = $sListingCategories; $this->mFormData['listingSortBy'] = array_search($aOptions['order'], BlogTemplateClass::$aBlogParams['order']['pattern']); $this->mFormData['listingType'] = $aOptions['type']; $this->mFormData['listingPageCategories'] = $sPageCategories; $this->mFormData['isExistingArticleEditAllowed'] = 1; } else { $this->mFormErrors[] = wfMsg('create-blog-listing-tag-format-not-recognized-on-page') . ": <a href=\"" . $oTitle->getFullUrl() . "\">" . $oTitle->getFullText() . "</a>"; } }
/** * categoryIndexer -- indexer for blog listing page used only one time by indexing script * * @static * @access public * * * @return bool */ public static function categoryIndexer(&$self, $article) { global $wgRequest; if ($wgRequest->getVal("makeindex", 0) != 1) { return true; } if ($article != null) { $self->parseTag(urldecode($article)); $cats = BlogTemplateClass::getCategoryNames(); if (count($cats) > 0) { self::blogListingBuildRelation($article, $cats, array()); } } return true; }