public static function axBlogListingCheckMatches() { global $wgRequest, $wgParser; $oSpecialPage = new CreateBlogListingPage(); $oSpecialPage->setFormData('listingCategories', $wgRequest->getVal('categories')); $oSpecialPage->setFormData('listingAuthors', $wgRequest->getVal('authors')); $oSpecialPage->setFormData('listingType', 'count'); return (string) BlogTemplateClass::parseTag($oSpecialPage->buildTagContent(), array(), $wgParser); }
/** * @author Jakub Kurcek * @param format string 'rss' or 'atom' * */ private function FeedRecentBlogPosts($format) { global $wgParser, $wgUser, $wgServer, $wgOut, $wgExtensionsPath, $wgRequest, $wgEnableBlogArticles; if (empty($wgEnableBlogArticles)) { $this->showMenu(); } else { // local settings $maxNumberOfBlogPosts = 10; $postCharacterLimit = 293; $userAvatarSize = 48; // If blog listing does not exit treats parameter as empty; $sListing = $wgRequest->getVal('listing'); $title = Title::newFromText($sListing, NS_BLOG_LISTING); if (!empty($sListing) && ($title == null || !$title->exists())) { unset($sListing); } $oBlogListing = new CreateBlogListingPage(); $oBlogListing->setFormData('listingAuthors', ''); $oBlogListing->setFormData('tagContent', ''); if (!empty($sListing)) { $oBlogListing->parseTag(urldecode($sListing)); $subTitleName = wfMsg('blog-posts-from-listing', $sListing); } else { $oBlogListing->setFormData('listingCategories', ''); $subTitleName = wfMsg('all-blog-posts'); } $input = $oBlogListing->buildTagContent(); $db = wfGetDB(DB_SLAVE, 'dpl'); $params = array("summary" => true, "timestamp" => true, "count" => $maxNumberOfBlogPosts); $result = BlogTemplateClass::parseTag($input, $params, $wgParser, null, true); $feedArray = array(); foreach ($result as $val) { $oTitle = Title::newFromID($val['page']); $aValue = explode('/', $oTitle->getText()); $feedArray[] = array('title' => $aValue[1], 'description' => substr(str_replace(' ', ' ', strip_tags($val['text'])), 0, $postCharacterLimit), 'url' => $oTitle->getFullURL(), 'date' => $val['date'], 'author' => $val['username'], 'otherTags' => array('image' => AvatarService::getAvatarUrl($val['username'], $userAvatarSize))); } $this->showFeed($format, wfMsg('feed-title-blogposts') . ' - ' . $subTitleName, $feedArray); } }