public function PageLoad() { ob_clean(); $this->presenter->PageLoad(); $config = Configuration::Instance(); $feed = new FeedWriter(ATOM); $title = $config->GetKey(ConfigKeys::APP_TITLE); $feed->setTitle("{$title} Reservations"); $url = $config->GetScriptUrl(); $feed->setLink($url); $feed->setChannelElement('updated', date(DATE_ATOM, time())); $feed->setChannelElement('author', array('name' => $title)); foreach ($this->reservations as $reservation) { /** @var FeedItem $item */ $item = $feed->createNewItem(); $item->setTitle($reservation->Summary); $item->setLink($reservation->ReservationUrl); $item->setDate($reservation->DateCreated->Timestamp()); $item->setDescription(sprintf('<div><span>Start</span> %s</div> <div><span>End</span> %s</div> <div><span>Organizer</span> %s</div> <div><span>Description</span> %s</div>', $reservation->DateStart->ToString(), $reservation->DateEnd->ToString(), $reservation->Organizer, $reservation->Description)); $feed->addItem($item); } $feed->genarateFeed(); }
/** * Generate a enclosure element in the current feed * * @access public * @param $title string The title of the element * @param $link string The link to the element * @param $pubDate DateTime the date of the publication * @param $description string The description of the element * @param $enclosure array An array with the enclosure * @return void */ public function addEnclosureContent($title, $link, $pubDate, $description, $enclosure = array()) { $item = $this->_feed->createNewItem(); $item->setTitle($title); $item->setLink($link); $item->setDate($pubDate); $item->setDescription($description); $item->setEncloser($enclosure["url"], $enclosure["length"], $enclosure["type"]); $this->_feed->addItem($item); }
public function displayMain() { $postFeed = new FeedWriter(RSS2); $postFeed->setTitle(Configuration::get('TM_SHOP_NAME')); $postFeed->setLink(Configuration::get('TM_SHOP_URL')); $postFeed->setDescription('This is test of creating a RSS 2.0 feed Universal Feed Writer'); $postFeed->setImage('Testing the RSS writer class', 'http://www.ajaxray.com/projects/rss', 'http://www.rightbrainsolution.com/images/logo.gif'); $posts = CMSHelper::getNewCMS(50); foreach ($posts as $row) { $newItem = $postFeed->createNewItem(); $newItem->setTitle($row['title']); $newItem->setLink($row['link']); $newItem->setDate($row['add_date']); $newItem->setDescription($row['content']); $postFeed->addItem($newItem); } $postFeed->genarateFeed(); }
function rss() { global $REQUEST_ASSOC, $TPA; if ($node = $this->_tree->getNodeInfo($REQUEST_ASSOC['id'])) { Common::inc_module_factory('feedWriter', true); //Creating an instance of FeedWriter class. //The constant RSS2 is passed to mention the version $feed = new FeedWriter(); //Setting the channel elements //Use wrapper functions for common channel elements $feed->setTitle(CHOST . ' - ' . $node['basic']); $feed->setLink(CHOST); $feed->setDescription(CHOST); //Image title and link must match with the 'title' and 'link' channel elements for RSS 2.0 //$TestFeed->setImage('Testing the RSS writer class','http://www.ajaxray.com/projects/rss','http://www.rightbrainsolution.com/images/logo.gif'); //Use core setChannelElement() function for other optional channels $node['params']['lang'] = 'ru'; $feed->setChannelElement('language', $node['params']['lang']); if ($interval = $this->_common_obj->select_news_interval($node_id, 0, 10, '', '', false, $active = 1)) { foreach ($interval as $news) { //Create an empty FeedItem $newItem = $feed->createNewItem(); //Add elements to the feed item //Use wrapper functions to add common feed elements $newItem->setTitle($news['header']); $newItem->setLink($TPA->page_link . '/~shownews/' . $news['id']); //The parameter is a timestamp for setDate() function $date = strtotime($news['sortdate']); $newItem->setDate($date); $newItem->setDescription($news['news_short']); $newItem->addElement('author', '*****@*****.**'); //Attributes have to passed as array in 3rd parameter $newItem->addElement('guid', 'http://www.ajaxray.com', array('isPermaLink' => 'true')); //Now add the feed item $feed->addItem($newItem); } $feed->genarateFeed(); die; } } }
include "FeedWriter.php"; //Creating an instance of FeedWriter class. //The constant RSS1 is passed to mention the version $TestFeed = new FeedWriter(RSS1); //Setting the channel elements //Use wrapper functions for common elements //For other optional channel elements, use setChannelElement() function $TestFeed->setTitle('Testing the RSS writer class'); $TestFeed->setLink('http://www.ajaxray.com/rss2/channel/about'); $TestFeed->setDescription('This is test of creating a RSS 1.0 feed by Universal Feed Writer'); //It's important for RSS 1.0 $TestFeed->setChannelAbout('http://www.ajaxray.com/rss2/channel/about'); //Adding a feed. Genarally this protion will be in a loop and add all feeds. //Create an empty FeedItem $newItem = $TestFeed->createNewItem(); //Add elements to the feed item //Use wrapper functions to add common feed elements $newItem->setTitle('The first feed'); $newItem->setLink('http://www.yahoo.com'); //The parameter is a timestamp for setDate() function $newItem->setDate(time()); $newItem->setDescription('This is test of adding CDATA Encoded description by the php <b>Universal Feed Writer</b> class'); //Use core addElement() function for other supported optional elements $newItem->addElement('dc:subject', 'Nothing but test'); //Now add the feed item $TestFeed->addItem($newItem); //Adding multiple elements from array //Elements which have an attribute cannot be added by this way $newItem = $TestFeed->createNewItem(); $newItem->addElementArray(array('title' => 'The 2nd feed', 'link' => 'http://www.google.com', 'description' => 'This is test of feedwriter class'));
/** * Filter tickets by certain condition * */ public function actionFilterIssues($type, $id, $alias, $rss = null) { // Initiate Criteria $criteria = new CDbCriteria(); $pages = new CPagination(); $pages->route = '/issues/' . $type . '/' . $id . '/' . $alias; switch ($type) { case 'status': $criteria->condition = 't.ticketstatus=:status'; $criteria->params = array(':status' => $id); break; case 'type': $criteria->condition = 't.tickettype=:type'; $criteria->params = array(':type' => $id); break; case 'priority': $criteria->condition = 't.priority=:priority'; $criteria->params = array(':priority' => $id); break; case 'category': $criteria->condition = 't.ticketcategory=:category'; $criteria->params = array(':category' => $id); break; case 'version': $criteria->condition = 't.ticketversion=:version'; $criteria->params = array(':version' => $id); break; case 'fixedin': $criteria->condition = 't.fixedin=:fixedin'; $criteria->params = array(':fixedin' => $id); break; case 'milestone': $criteria->condition = 't.milestone=:milestone'; $criteria->params = array(':milestone' => $id); break; default: $this->redirect(array('/tickets')); break; } // Initiate Pager $count = Tickets::model()->count($criteria); $pages->pageSize = Yii::app()->params['ticketsPerPage']; $pages->applyLimit($criteria); // Load them $tickets = Tickets::model()->with(array('reporter', 'assigned', 'status', 'type', 'category', 'ticketpriority', 'version', 'fixed', 'ticketmilestone'))->byDate()->findAll($criteria); // Did we wanted to see the rss if ($rss && in_array($rss, array('rss', 'atom'))) { // Load the feed writer Yii::import('ext.FeedWriter.FeedWriter'); $feedWriter = new FeedWriter($rss == 'atom' ? ATOM : RSS2); $channelElems = array('title' => Yii::t('tickets', 'Tickets Feed'), 'link' => Yii::app()->createAbsoluteUrl('/tickets'), 'charset' => Yii::app()->charset, 'description' => Yii::t('tickets', 'Tickets Feed'), 'author' => Yii::app()->name, 'generator' => Yii::app()->name, 'language' => Yii::app()->language, 'ttl' => 10); // Set channel elements $feedWriter->setChannelElementsFromArray($channelElems); if ($tickets) { foreach ($tickets as $r) { $newItem = $feedWriter->createNewItem(); $itemElems = array('title' => htmlspecialchars($r->title), 'link' => Yii::app()->createAbsoluteUrl('/issue/' . $r->id . '/' . $r->alias), 'charset' => Yii::app()->charset, 'description' => htmlspecialchars(substr(strip_tags($r->content), 0, 100)), 'author' => $r->reporter ? $r->reporter->username : Yii::app()->name, 'generator' => Yii::app()->name, 'language' => Yii::app()->language, 'guid' => $r->id, 'content' => htmlspecialchars($r->content)); $newItem->addElementArray($itemElems); //Now add the feed item $feedWriter->addItem($newItem); } } // Display & end echo $feedWriter->genarateFeed(); exit; } // Load the quick moderation form $moderation = new TicketsQuickModeration(); // Title $this->pageTitle[] = Yii::t('tickets', 'Viewing Issues'); // Render $this->render('ticketslist', array('total' => $count, 'tickets' => $tickets, 'pages' => $pages, 'moderation' => $moderation)); }
<?php /** * Create a rss of the recorded programs. * * @license GPL * * @package MythWeb * @subpackage TV * **/ $Feed = new FeedWriter(RSS2); $Feed->setTitle('MythWeb - ' . t('Recorded Programs')); $Feed->setLink(root_url); $Feed->setDescription('MythWeb - ' . t('Recorded Programs')); foreach ($All_Shows as $show) { $item = $Feed->createNewItem(); $item->setTitle($show->title . (strlen($show->subtitle) > 0 ? ' - ' . $show->subtitle : '')); $item->setLink(root_url . 'tv/detail/' . $show->chanid . '/' . $show->recstartts); $item->setDate($show->starttime); $item->setDescription($show->description); $Feed->addItem($item); } $Feed->generateFeed();
usort($pages, '_sort_pages'); /** Start Feed Output **/ $last_updated_at = null; $feed = new FeedWriter(RSS2); $feed->setTitle(SITE_NAME); $feed->setLink(url_for("/", IS_ABSOLUTE_URL)); $feed->setDescription(SITE_DESC); $feed->setChannelElement('language', 'zh-cn'); // get flat pages foreach ($pages as $page) { $page_updated_at = $page->getLastUpdatedAt(); if (!$last_updated_at || $page_updated_at > $last_updated_at) { $last_updated_at = $page_updated_at; } $render = new SimpieView($page->getPageFilePath(), '../templates/layout/feed.php'); $feed_item = $feed->createNewItem(); $feed_item->setTitle($page->getAbsTitle()); $feed_item->setLink($page->getUrl(IS_ABSOLUTE_URL)); $feed_item->setDescription($page->getPageContent($render)); $feed_item->setDate($page_updated_at); $feed_item->addElement('author', 'TIPI-Team'); $feed->addItem($feed_item); } // set the last modify time $feed->setChannelElement('pubDate', date(DATE_RSS, $last_updated_at)); // fix html entriy problem in feedwriter ob_start(); $feed->genarateFeed(); $xml = ob_get_clean(); $xml = str_replace('»', '»', $xml); echo $xml;
$coddb = new sql_db($db_host, $db_user, $db_pass, $db_db, false); if (!$coddb->db_connect_id) { die("Could not connect to the database"); } //Detriving informations from database addin feeds $query = "SELECT {$t['b3_clients']}.name, {$t['b3_clients']}.time_edit, {$t['players']}.id, kills, deaths, ratio, skill, winstreak, losestreak, rounds, fixed_name, ip\n FROM {$t['b3_clients']}, {$t['players']}\n WHERE ({$t['b3_clients']}.id = {$t['players']}.client_id)\n AND (({$t['players']}.kills > {$minkills})\n OR ({$t['players']}.rounds > {$minrounds}))\n AND ({$t['players']}.hide = 0)\n AND ({$current_time} - {$t['b3_clients']}.time_edit < {$timelimit})"; if ($clan_name != "") { $query .= " AND ({$t['b3_clients']}.name like '%%{$clan_name}%%')"; } $query .= " ORDER BY {$sortby} {$direction} \n LIMIT 0, {$limit}"; $result = $coddb->sql_query($query); $timestamp = time(); $count = 1; while ($row = $coddb->sql_fetchrow($result)) { //Create an empty FeedItem $newItem = $XLRfeed->createNewItem(); if ($use_localtime == 1) { $time_edit = date("j F Y, G:i T", $row['time_edit'] + date("Z")); } else { $time_edit = date("j F Y, G:i", $row['time_edit']) . " GMT"; } $tname = $row['fixed_name'] ? $row['fixed_name'] : $row['name']; $name = "#" . $count . ": " . $tname; $link = httplink() . "?config=" . $currentconfignumber . "&func=player&playerid=" . $row['id']; //$time_edit = $row['time_edit']; if ($sortby == "kills") { $description = "<strong>[Kills: " . $row['kills'] . "]</strong> [Skill: " . $row['skill'] . "] [Ratio: " . $row['ratio'] . "] [Deaths: " . $row['deaths'] . "] [Last seen: " . $time_edit . " ]"; } elseif ($sortby == "ratio") { $description = "<strong>[Ratio: " . $row['ratio'] . "]</strong> [Skill: " . $row['skill'] . "] [Kills: " . $row['kills'] . "] [Deaths: " . $row['deaths'] . "] [Last seen: " . $time_edit . " ]"; } else { $description = "<strong>[Skill: " . $row['skill'] . "]</strong> [Ratio: " . $row['ratio'] . "] [Kills: " . $row['kills'] . "] [Deaths: " . $row['deaths'] . "] [Last seen: " . $time_edit . " ]";
function projects_rss() { global $clerk, $project; $feed = new FeedWriter(RSS2); $title = $clerk->getSetting("site", 1); $feed->setTitle($title . ' / Projects Feed'); $feed->setLink(linkToSite()); $feed->setDescription('Live feed of projects on ' . $title); $feed->setChannelElement('pubDate', date(DATE_RSS, time())); $projects = $clerk->query_select("projects", "", "WHERE publish= 1 ORDER BY id DESC"); while ($project = $clerk->query_fetchArray($projects)) { $newItem = $feed->createNewItem(); $newItem->setTitle($project['title']); $newItem->setLink(html_entity_decode(linkToProject($project['id']))); $newItem->setDate($project['date']); $desc = projectThumbnail(); $desc = call_anchor("projectsRssDescription", $desc); $newItem->setDescription('' . $desc . ''); $newItem->addElement('guid', linkToProject($project['id']), array('isPermaLink' => 'true')); $feed->addItem($newItem); $count = 0; $desc = ""; } $feed->genarateFeed(); }
function blog_rss() { global $clerk, $blog; $feed = new FeedWriter(RSS2); $title = $clerk->getSetting("site", 1); $feed->setTitle($title . ' / Blog Feed'); $feed->setLink(linkToSite()); $feed->setDescription('Live feed of blog posts on ' . $title); $feed->setChannelElement('pubDate', date(DATE_RSS, time())); $get = $clerk->query_select("secretary_blog", "", "ORDER BY date DESC"); while ($blog = $clerk->query_fetchArray($get)) { $newItem = $feed->createNewItem(); $newItem->setTitle($blog['title']); $newItem->setLink(html_entity_decode(linkToPost(false, $blog['id']))); $newItem->setDate($blog['date']); $desc = postImage() . '<br />' . postText(); $desc = call_anchor("blogRssDescription", $desc); $newItem->setDescription('' . $desc . ''); $newItem->addElement('guid', linkToPost(), array('isPermaLink' => 'true')); $feed->addItem($newItem); $count = 0; $desc = ""; } $feed->genarateFeed(); }
<?php $arrAllArticles = $ogArticleManager->pullTokens(0, "", "id", "DESC"); $oFeedWriter = new FeedWriter(RSS2); $oFeedWriter->setTitle($ogContentManager->getContent("RSSTitle", "Site RSS Feed")); $oFeedWriter->setLink($ogContentManager->getContent("RSSLink", $fusebox['urlBase'])); $oFeedWriter->setDescription("RSSDescription", "Site RSS Feed Description"); $oFeedWriter->setImage($ogContentManager->getContent("RSSTitle", "Site RSS Feed"), $ogContentManager->getContent("RSSLink", "Site RSS Link"), $fusebox['urlAssets'] . 'images/rss.png'); foreach ($arrAllArticles as $a) { $oItem = $oFeedWriter->createNewItem(); $oItem->setTitle($ogArticleManager->getTitle($a['token'])); $oItem->setLink($fusebox['urlBase'] . $a['token'] . ".page"); $oItem->setDate($ogArticleManager->getCreatedDate($a['token'])); $oItem->setDescription($ogArticleManager->getContent($a['token'])); $oFeedWriter->addItem($oItem); } $oFeedWriter->genarateFeed();
/** * Generate RSS feeds for current user * * @param $token * @param $user_id * @param $tag_id if $type is 'tag', the id of the tag to generate feed for * @param string $type the type of feed to generate * @param int $limit the maximum number of items (0 means all) */ public function generateFeeds($token, $user_id, $tag_id, $type = 'home', $limit = 0) { $allowed_types = array('home', 'fav', 'archive', 'tag'); $config = $this->store->getConfigUser($user_id); if ($config == null) { die(sprintf(_('User with this id (%d) does not exist.'), $user_id)); } if (!in_array($type, $allowed_types) || !isset($config['token']) || $token != $config['token']) { die(_('Uh, there is a problem while generating feed. Wrong token used?')); } $feed = new FeedWriter(RSS2); $feed->setTitle('wallabag — ' . $type . ' feed'); $feed->setLink(Tools::getPocheUrl()); $feed->setChannelElement('pubDate', date(DATE_RSS, time())); $feed->setChannelElement('generator', 'wallabag'); $feed->setDescription('wallabag ' . $type . ' elements'); if ($type == 'tag') { $entries = $this->store->retrieveEntriesByTag($tag_id, $user_id); } else { $entries = $this->store->getEntriesByView($type, $user_id); } // if $limit is set to zero, use all entries if (0 == $limit) { $limit = count($entries); } if (count($entries) > 0) { for ($i = 0; $i < min(count($entries), $limit); $i++) { $entry = $entries[$i]; $newItem = $feed->createNewItem(); $newItem->setTitle($entry['title']); $newItem->setSource(Tools::getPocheUrl() . '?view=view&id=' . $entry['id']); $newItem->setLink($entry['url']); $newItem->setDate(time()); $newItem->setDescription($entry['content']); $feed->addItem($newItem); } } $feed->genarateFeed(); exit; }
protected function rss() { global $onpub_disp_rss, $onpub_disp_updates_num, $onpub_disp_friendly_urls; if ($this->website && $onpub_disp_rss) { // See the following OnpubAPI tutorial for more info: // http://onpub.com/index.php?s=20&a=78 // This example is based on an example by Anis uddin Ahmad, the author of // Universal Feed Writer. //Creating an instance of FeedWriter class. //The constant RSS2 is passed to mention the version $feed = new FeedWriter(RSS2); //Setting the channel elements //Use wrapper functions for common channel elements $feed->setTitle($this->website->name); $feed->setLink(addTrailingSlash($this->website->url)); $feed->setDescription(''); //Image title and link must match with the 'title' and 'link' channel elements for RSS 2.0 if ($this->website->image) { $feed->setImage($this->website->name, addTrailingSlash($this->website->url), addTrailingSlash($this->website->imagesURL) . $this->website->image->fileName); } else { $feed->setImage($this->website->name, addTrailingSlash($this->website->url), null); } //Use core setChannelElement() function for other optional channels $feed->setChannelElement('language', 'en-us'); $feed->setChannelElement('pubDate', date(DATE_RSS, time())); $qo = new OnpubQueryOptions(); $qo->includeContent = true; $qo->includeAuthors = true; $qo->orderBy = 'created'; $qo->order = 'DESC'; $qo->rowLimit = $onpub_disp_updates_num; $articles = $this->articles->select($qo, null, $this->website->ID); //Adding a feed. Genarally this portion will be in a loop and add all feeds. foreach ($articles as $article) { // Get the article's authors. $authors = $article->authors; //Create an empty FeedItem $newItem = $feed->createNewItem(); //Add elements to the feed item //Use wrapper functions to add common feed elements // Use the OnpubArticle object to set the various properties of the FeedItem. $newItem->setTitle($article->title); $samaps = $this->samaps->select(null, null, $article->ID); if ($onpub_disp_friendly_urls) { $newItem->setLink(addTrailingSlash($this->website->url) . $this->generateFriendlyURL(NULL, $article, $samaps[0]->sectionID)); } else { $newItem->setLink(addTrailingSlash($this->website->url) . 'index.php?s=' . $samaps[0]->sectionID . '&a=' . $article->ID); } //The parameter is a timestamp for setDate() function $newItem->setDate($article->getCreated()->format('c')); $newItem->setDescription($this->friendlyURLs($article->content)); if (sizeof($authors)) { //Use core addElement() function for other supported optional elements $newItem->addElement('author', $authors[0]->displayAs); } //Now add the feed item $feed->addItem($newItem); } //OK. Everything is done. Now genarate the feed. $feed->genarateFeed(); } }
/** * RSS que mostra les activitats que vindran en 7 dies. * * */ public function executeRSS(sfWebRequest $request) { require_once '../lib/vendor/rss/FeedWriter.php'; require_once '../lib/vendor/rss/FeedItem.php'; $IDS = $request->getParameter('IDS', 0); $OS = SitesPeer::retrieveByPK($IDS); if ($OS instanceof Sites) { $Feed = new FeedWriter(ATOM); $Feed->setTitle('Canal RSS del site: ' . $OS->getNom()); $Feed->setLink($OS->getWeburl()); $Feed->setDescription('En aquest canal veurà les activitats a 7 dies vista del site: ' . $OS->getNom()); $temps = strtotime('+7 day', time()); $data = date('Y-m-d', $temps); $LACT = ActivitatsPeer::getActivitatsDia($IDS, $data, 1, "activitats"); foreach ($LACT->getResults() as $OA) { $newItem = $Feed->createNewItem(); //Mirem que sigui el primer horari... si ho és el mostrem... if ($OA->getPrimeraData() == $data) { $newItem->setTitle(html_entity_decode($OA->getTmig())); if ($IDS == 1) { $newItem->setLink('http://www.casadecultura.org/activitats/0/' . $OA->getActivitatid() . '/' . $OA->getNomForUrl()); } else { $newItem->setLink('http://www.hospici.cat/detall_activitat/' . $OA->getActivitatid() . '/' . $OA->getNomForUrl()); } $newItem->setDate(time()); //Regstrem els horaris que s'usaran $PH = $OA->getPrimerHorari(); $UH = $OA->getUltimHorari(); $horaris = "Del dia " . $PH->getDia('d/m') . ' al ' . $UH->getDia('d/m'); if ($PH->getDia() == $UH->getDia()) { $horaris = "El dia " . $PH->getDia('d/m'); } $A_E = $PH->getArrayEspais(); $horaris .= ' a ' . $A_E[0]; $image = '<p> <img class="center" src="http://www.hospici.cat/images/activitats/A-' . $OA->getActivitatid() . '-L.jpg" alt="Imatge"/> <br /><b>' . $horaris . '</b> </p>'; $D = $image . $OA->getDmig(); $newItem->setDescription($D); //Now add the feed item $Feed->addItem($newItem); } } $Feed->genarateFeed(); } return sfView::NONE; }
/** * Generate RSS feed */ public function generateRSS() { include 'FeedWriter.php'; include 'FeedItem.php'; $feed = new FeedWriter(RSS2); $wall = $this->getContent(); $title = !empty($this->domain) ? $this->domain : $this->owner_id; $feed->setTitle('vk.com/' . $title); $feed->setLink('http://vk.com/' . $title); $feed->setDescription('wall from vk.com/' . $title); $feed->setChannelElement('language', 'ru-ru'); $feed->setChannelElement('pubDate', date(DATE_RSS, time())); foreach (array_slice($wall->response, 1) as $post) { $newItem = $feed->createNewItem(); $newItem->setLink("http://vk.com/wall{$post->to_id}_{$post->id}"); $newItem->setDate($post->date); $description = $post->text; if (isset($post->copy_text)) { # additional content in re-posts $description .= (empty($description) ? '' : self::VERTICAL_DELIMITER) . $post->copy_text; } if (isset($post->attachment->photo->text) and !empty($post->attachment->photo->text)) { $description .= (empty($description) ? '' : self::VERTICAL_DELIMITER) . $post->attachment->photo->text; } if (isset($post->attachment->video->text) and !empty($post->attachment->video->text)) { $description .= (empty($description) ? '' : self::VERTICAL_DELIMITER) . $post->attachment->video->text; } if (isset($post->attachment->link)) { $description .= (empty($description) ? '' : self::VERTICAL_DELIMITER) . $post->attachment->link->title . '<br/>' . $post->attachment->link->description; } if (!is_null($this->include) && preg_match('/' . $this->include . '/iu', $description) !== 1) { continue; } if (!is_null($this->exclude) && preg_match('/' . $this->exclude . '/iu', $description) !== 0) { continue; } $hashTags = array(); $description = preg_replace('/\\[[^|]+\\|([^\\]]+)\\]/u', '$1', $description); // remove internal vk links preg_match_all('/#([\\d\\w_]+)/u', $description, $hashTags); if (isset($post->attachments)) { foreach ($post->attachments as $attachment) { switch ($attachment->type) { case 'photo': $description .= "<br><img src='{$attachment->photo->src_big}'/>"; break; /*case 'audio': { $description .= "<br><a href='http://vk.com/wall{$owner_id}_{$post->id}'>{$attachment->audio->performer} – {$attachment->audio->title}</a>"; break; }*/ /*case 'audio': { $description .= "<br><a href='http://vk.com/wall{$owner_id}_{$post->id}'>{$attachment->audio->performer} – {$attachment->audio->title}</a>"; break; }*/ case 'doc': $description .= "<br><a href='{$attachment->doc->url}'>{$attachment->doc->title}</a>"; break; case 'link': $description .= "<br><a href='{$attachment->link->url}'>{$attachment->link->title}</a>"; break; /*case 'video': { $description .= "<br><a href='http://vk.com/video{$attachment->video->owner_id}_{$attachment->video->vid}'><img src='{$attachment->video->image_big}'/></a>"; break; }*/ } } } $newItem->setDescription($description); $newItem->addElement('title', $this->getTitle($description)); $newItem->addElement('guid', $post->id); foreach ($hashTags[1] as $hashTag) { $newItem->addElement('category', $hashTag); } $feed->addItem($newItem); } $feed->generateFeed(); }
// count number of items added to full feed $item_count = 0; foreach ($items as $key => $item) { debug('--------'); $do_content_extraction = true; debug('Processing feed item ' . sprintf('%02d', $item_count + 1) . '.'); $extraction_successful = false; $text_sample = null; $permalink = $urls[$key]; debug("Item URL: {$permalink}"); $extracted_title = ''; $feed_item_title = $item->get_title(); if ($feed_item_title !== null) { $feed_item_title = strip_tags(htmlspecialchars_decode($feed_item_title)); } $newitem = $output->createNewItem(); $newitem->setTitle($feed_item_title); if (isset($permalink) && is_string($permalink)) { $newitem->setLink($permalink); } else { $permalink = $item->get_permalink(); $newitem->setLink($permalink); } if (isset($permalink) && is_string($permalink) && strlen($permalink) < 9) { continue; } //if ($permalink && ($response = $http->get($permalink, true)) && $response['status_code'] < 300) { // Allowing error codes - some sites return correct content with error status // e.g. prospectmagazine.co.uk returns 403 $cached_page = is_cached($permalink); if ($cached_page) {
$GetItemRequest = null; $GetItemRequest->ItemShape->BaseShape = "AllProperties"; $GetItemRequest->ItemIds->ItemId->Id = $appt->ItemId->Id; $GetItemRequest->ItemIds->ItemId->ChangeKey = $appt->ItemId->ChangeKey; if ($scriptdebug) { $debuglog .= "<hr><p>Appt used to build GetItem Request</p><pre>" . print_r($appt, true); $debuglog .= "</pre><hr><p>Appt Info</p><pre>"; $debuglog .= "ItemId - Id = [" . $appt->ItemId->Id . "]\n"; $debuglog .= "ItemId - ChangeKey = [" . $appt->ItemId->ChangeKey . "]\n"; $debuglog .= "</pre><hr><p></p>\n<p>GetItem pre-call</p><pre>"; $debuglog .= print_r($GetItemRequest, true); $debuglog .= "</pre>"; } $apptResult = $client->GetItem($GetItemRequest); $apptDetails = $apptResult->ResponseMessages->GetItemResponseMessage->Items->CalendarItem; $ApptItem = $CalFeed->createNewItem(); $itemDetails = $apptDetails->ItemId; $ApptItem->setTitle($apptDetails->Subject); if ($scriptdebug) { $debuglog .= "<hr><p>GetItem Appt Result</p><pre>" . print_r($appt, true); $debuglog .= "</pre><hr><p>Appt Info</p><pre>"; $debuglog .= "ItemId - Id = [" . $appt->ItemId->Id . "]\n"; $debuglog .= "ItemId - ChangeKey = [" . $appt->ItemId->ChangeKey . "]\n"; $debuglog .= "</pre><hr>\n<p>ApptResult</p><pre>"; $debuglog .= print_r($apptResult, true); $debuglog .= "</pre>"; } $ApptItem->setLink($cfg_option['urlpath'] . "/getappt/" . $userfeedtogen . "/" . rawurlencode($apptDetails->ItemId->Id)); $ApptItem->setDate($apptDetails->Start); $start = rtrim($apptDetails->Start, 'zZ'); $ApptSummary = "<em>When:</em><b> " . date("D M j Y g:ia", strtotime($apptDetails->Start)) . " to " . date("D M j Y g:ia", strtotime($apptDetails->End)) . "(" . date_default_timezone_get() . ")</b>\n<br>";