Ejemplo n.º 1
0
 /**
  * categoryIndexer --  indexer for blog listing page used only one time by indexing script
  *
  * @static
  * @access public
  *
  * @param CreateBlogListingPage $blogListing
  * @param $article
  *
  * @return bool
  */
 public static function categoryIndexer(&$blogListing, $article)
 {
     global $wgRequest;
     if ($wgRequest->getVal("makeindex", 0) != 1) {
         return true;
     }
     if ($article != null) {
         $blogListing->parseTag(urldecode($article));
         $cats = BlogTemplateClass::getCategoryNames();
         if (count($cats) > 0) {
             self::blogListingBuildRelation($article, $cats, array());
         }
     }
     return true;
 }
 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);
 }
Ejemplo n.º 3
0
 /**
  * @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);
     }
 }