本文整理汇总了PHP中FeedItem::set_link方法的典型用法代码示例。如果您正苦于以下问题:PHP FeedItem::set_link方法的具体用法?PHP FeedItem::set_link怎么用?PHP FeedItem::set_link使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FeedItem
的用法示例。
在下文中一共展示了FeedItem::set_link方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load_file
/**
* @desc Loads a feed by its url
* @param string $url the feed url
*/
public function load_file($url)
{
if (($file = @file_get_contents($url)) !== false) {
$this->data = new FeedData();
if (preg_match('`<entry>(.*)</entry>`is', $file)) {
$expParsed = explode('<entry>', $file);
$nbItems = count($expParsed) - 1 > $nbItems ? $nbItems : count($expParsed) - 1;
$this->data->set_date(preg_match('`<updated>(.*)</updated>`is', $expParsed[0], $var) ? $var[1] : '');
$this->data->set_title(preg_match('`<title>(.*)</title>`is', $expParsed[0], $var) ? $var[1] : '');
$this->data->set_link(preg_match('`<link href="(.*)"/>`is', $expParsed[0], $var) ? $var[1] : '');
$this->data->set_host(preg_match('`<link href="(.*)"/>`is', $expParsed[0], $var) ? $var[1] : '');
for ($i = 1; $i <= $nbItems; $i++) {
$item = new FeedItem();
$item->set_title(preg_match('`<title>(.*)</title>`is', $expParsed[$i], $title) ? $title[1] : '');
$item->set_link(preg_match('`<link href="(.*)"/>`is', $expParsed[$i], $url) ? $url[1] : '');
$item->set_guid(preg_match('`<id>(.*)</id>`is', $expParsed[$i], $guid) ? $guid[1] : '');
$item->set_desc(preg_match('`<summary>(.*)</summary>`is', $expParsed[$i], $desc) ? $desc[1] : '');
$item->set_date(preg_match('`<updated>(.*)</updated>`is', $expParsed[$i], $date) ? new Date(strtotime($date[1]), Timezone::SERVER_TIMEZONE) : null);
$enclosure = preg_match('`<enclosure rel="enclosure" url="(.*)" length="(.*)" type="(.*)" />`is', $expParsed[$i]);
if ($enclosure) {
$enclosure_item = new FeedItemEnclosure();
$enclosure_item->set_lenght($enclosure[2]);
$enclosure_item->set_type($enclosure[3]);
$enclosure_item->set_url($enclosure[1]);
$item->set_enclosure($enclosure_item);
}
$this->data->add_item($item);
}
return true;
}
return false;
}
return false;
}
示例2: import
function get_feed_data_struct($idcat = 0, $name = '')
{
global $Cache, $Sql, $LANG, $CONFIG, $CONFIG_NEWS;
import('content/syndication/feed_data');
import('util/date');
import('util/url');
load_module_lang('news');
$data = new FeedData();
$data->set_title($LANG['xml_news_desc'] . ' ' . $CONFIG['server_name']);
$data->set_date(new Date());
$data->set_link(new Url('/syndication.php?m=news&cat=' . $idcat));
$data->set_host(HOST);
$data->set_desc($LANG['xml_news_desc'] . ' ' . $CONFIG['server_name']);
$data->set_lang($LANG['xml_lang']);
$Cache->load('news');
$result = $Sql->query_while("SELECT id, title, contents, timestamp, img\n FROM " . PREFIX . "news\n WHERE visible = 1\n ORDER BY timestamp DESC" . $Sql->limit(0, 2 * $CONFIG_NEWS['pagination_news']), __LINE__, __FILE__);
while ($row = $Sql->fetch_assoc($result)) {
$item = new FeedItem();
$item->set_title($row['title']);
$link = new Url('/news/news' . url('.php?id=' . $row['id'], '-0-' . $row['id'] . '+' . url_encode_rewrite($row['title']) . '.php'));
$item->set_link($link);
$item->set_guid($link);
$item->set_desc(second_parse($row['contents']));
$item->set_date(new Date(DATE_TIMESTAMP, TIMEZONE_SYSTEM, $row['timestamp']));
$item->set_image_url($row['img']);
$data->add_item($item);
}
$Sql->query_close($result);
return $data;
}
示例3: FeedData
function load_file($url)
{
if (($file = @file_get_contents_emulate($url)) !== false) {
$this->data = new FeedData();
if (preg_match('`<entry>(.*)</entry>`is', $file)) {
$expParsed = explode('<entry>', $file);
$nbItems = count($expParsed) - 1 > $nbItems ? $nbItems : count($expParsed) - 1;
$this->data->set_date(preg_match('`<updated>(.*)</updated>`is', $expParsed[0], $var) ? $var[1] : '');
$this->data->set_title(preg_match('`<title>(.*)</title>`is', $expParsed[0], $var) ? $var[1] : '');
$this->data->set_link(preg_match('`<link href="(.*)"/>`is', $expParsed[0], $var) ? $var[1] : '');
$this->data->set_host(preg_match('`<link href="(.*)"/>`is', $expParsed[0], $var) ? $var[1] : '');
for ($i = 1; $i <= $nbItems; $i++) {
$item = new FeedItem();
$item->set_title(preg_match('`<title>(.*)</title>`is', $expParsed[$i], $title) ? $title[1] : '');
$item->set_link(preg_match('`<link href="(.*)"/>`is', $expParsed[$i], $url) ? $url[1] : '');
$item->set_guid(preg_match('`<id>(.*)</id>`is', $expParsed[$i], $guid) ? $guid[1] : '');
$item->set_desc(preg_match('`<summary>(.*)</summary>`is', $expParsed[$i], $desc) ? $desc[1] : '');
$item->set_date_rfc3339(preg_match('`<updated>(.*)</updated>`is', $expParsed[$i], $date) ? gmdate_format('date_format_tiny', strtotime($date[1])) : '');
$this->data->add_item($item);
}
return true;
}
return false;
}
return false;
}
示例4: FeedData
function load_file($url)
{
if (($file = @file_get_contents_emulate($url)) !== false) {
$this->data = new FeedData();
if (preg_match('`<item>(.*)</item>`is', $file)) {
$expParsed = explode('<item>', $file);
$nbItems = count($expParsed) - 1 > $nbItems ? $nbItems : count($expParsed) - 1;
$this->data->set_date(preg_match('`<!-- RSS generated by PHPBoost on (.*) -->`is', $expParsed[0], $var) ? $var[1] : '');
$this->data->set_title(preg_match('`<title>(.*)</title>`is', $expParsed[0], $var) ? $var[1] : '');
$this->data->set_link(preg_match('`<atom:link href="(.*)" rel="self" type="application/rss+xml" />`is', $expParsed[0], $var) ? $var[1] : '');
$this->data->set_host(preg_match('`<link>(.*)</link>`is', $expParsed[0], $var) ? $var[1] : '');
$this->data->set_desc(preg_match('`<description>(.*)</description>`is', $expParsed[0], $var) ? $var[1] : '');
$this->data->set_lang(preg_match('`<language>(.*)</language>`is', $expParsed[0], $var) ? $var[1] : '');
for ($i = 1; $i <= $nbItems; $i++) {
$item = new FeedItem();
$item->set_title(preg_match('`<title>(.*)</title>`is', $expParsed[$i], $title) ? $title[1] : '');
$item->set_link(preg_match('`<link>(.*)</link>`is', $expParsed[$i], $url) ? $url[1] : '');
$item->set_guid(preg_match('`<guid>(.*)</guid>`is', $expParsed[$i], $guid) ? $guid[1] : '');
$item->set_desc(preg_match('`<desc>(.*)</desc>`is', $expParsed[$i], $desc) ? $desc[1] : '');
$item->set_date_rfc822(preg_match('`<pubDate>(.*)</pubDate>`is', $expParsed[$i], $date) ? gmdate_format('date_format_tiny', strtotime($date[1])) : '');
$this->data->add_item($item);
}
return true;
}
return false;
}
return false;
}
示例5: get_feed_data_struct
public function get_feed_data_struct($idcat = 0, $name = '')
{
if (CalendarService::get_categories_manager()->get_categories_cache()->category_exists($idcat)) {
$now = new Date();
$lang = LangLoader::get('common', 'calendar');
$querier = PersistenceContext::get_querier();
$category = CalendarService::get_categories_manager()->get_categories_cache()->get_category($idcat);
$site_name = GeneralConfig::load()->get_site_name();
$site_name = $idcat != Category::ROOT_CATEGORY ? $site_name . ' : ' . $category->get_name() : $site_name;
$feed_module_name = $lang['calendar.feed.name'];
$data = new FeedData();
$data->set_title($feed_module_name . ' - ' . $site_name);
$data->set_date(new Date());
$data->set_link(SyndicationUrlBuilder::rss('calendar', $idcat));
$data->set_host(HOST);
$data->set_desc($feed_module_name . ' - ' . $site_name);
$data->set_lang(LangLoader::get_message('xml_lang', 'main'));
$data->set_auth_bit(Category::READ_AUTHORIZATIONS);
$categories = CalendarService::get_categories_manager()->get_childrens($idcat, new SearchCategoryChildrensOptions(), true);
$ids_categories = array_keys($categories);
$result = $querier->select('SELECT *
FROM ' . CalendarSetup::$calendar_events_table . ' event
LEFT JOIN ' . CalendarSetup::$calendar_events_content_table . ' event_content ON event_content.id = event.content_id
LEFT JOIN ' . DB_TABLE_MEMBER . ' member ON member.user_id = event_content.author_id
LEFT JOIN ' . CalendarSetup::$calendar_cats_table . ' cat ON cat.id = event_content.id_category
WHERE approved = 1
AND id_category IN :cats_ids
ORDER BY start_date DESC', array('cats_ids' => $ids_categories));
while ($row = $result->fetch()) {
$event = new CalendarEvent();
$event->set_properties($row);
$category = $categories[$event->get_content()->get_category_id()];
$link = CalendarUrlBuilder::display_event($category->get_id(), $category->get_rewrited_name() ? $category->get_rewrited_name() : 'root', $event->get_id(), $event->get_content()->get_rewrited_title());
$item = new FeedItem();
$item->set_title($event->get_content()->get_title());
$item->set_link($link);
$item->set_guid($link);
$item->set_desc(FormatingHelper::second_parse($event->get_content()->get_contents()) . ($event->get_content()->get_location() ? '<br />' . $lang['calendar.labels.location'] . ' : ' . $event->get_content()->get_location() . '<br />' : '') . '<br />' . $lang['calendar.labels.start_date'] . ' : ' . $event->get_start_date()->format(Date::FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE) . '<br />' . $lang['calendar.labels.end_date'] . ' : ' . $event->get_end_date()->format(Date::FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE));
$item->set_date($event->get_start_date());
$item->set_auth(CalendarService::get_categories_manager()->get_heritated_authorizations($category->get_id(), Category::READ_AUTHORIZATIONS, Authorizations::AUTH_PARENT_PRIORITY));
$data->add_item($item);
}
$result->dispose();
return $data;
}
}
示例6: FeedData
function get_feed_data_struct($idcat = 0, $name = '')
{
if (MediaService::get_categories_manager()->get_categories_cache()->category_exists($idcat)) {
require_once PATH_TO_ROOT . '/media/media_constant.php';
$category = MediaService::get_categories_manager()->get_categories_cache()->get_category($idcat);
$site_name = GeneralConfig::load()->get_site_name();
$site_name = $idcat != Category::ROOT_CATEGORY ? $site_name . ' : ' . $category->get_name() : $site_name;
$feed_module_name = LangLoader::get_message('module_title', 'common', 'media');
$data = new FeedData();
$data->set_title($feed_module_name . ' - ' . $site_name);
$data->set_date(new Date());
$data->set_link(SyndicationUrlBuilder::rss('media', $idcat));
$data->set_host(HOST);
$data->set_desc($feed_module_name . ' - ' . $site_name);
$data->set_lang(LangLoader::get_message('xml_lang', 'main'));
$data->set_auth_bit(Category::READ_AUTHORIZATIONS);
$categories = MediaService::get_categories_manager()->get_childrens($idcat, new SearchCategoryChildrensOptions(), true);
$ids_categories = array_keys($categories);
$results = PersistenceContext::get_querier()->select('SELECT media.*, cat.image
FROM ' . MediaSetup::$media_table . ' media
LEFT JOIN ' . MediaSetup::$media_cats_table . ' cat ON cat.id = media.idcat
WHERE media.idcat IN :ids_categories
AND infos = :status_approved
ORDER BY timestamp DESC', array('ids_categories' => $ids_categories, 'status_approved' => MEDIA_STATUS_APROBED));
foreach ($results as $row) {
// Rewriting
$link = new Url('/media/media' . url('.php?id=' . $row['id'], '-' . $row['id'] . '+' . Url::encode_rewrite($row['name']) . '.php'));
$item = new FeedItem();
$item->set_title($row['name']);
$item->set_link($link);
$item->set_guid($link);
$item->set_desc(FormatingHelper::second_parse($row['contents']));
$item->set_date(new Date($row['timestamp'], Timezone::SERVER_TIMEZONE));
$item->set_image_url($row['image']);
$item->set_auth(MediaService::get_categories_manager()->get_heritated_authorizations($row['idcat'], Category::READ_AUTHORIZATIONS, Authorizations::AUTH_PARENT_PRIORITY));
$enclosure = new FeedItemEnclosure();
$enclosure->set_lenght(@filesize($row['url']));
$enclosure->set_type($row['mime_type']);
$enclosure->set_url($row['url']);
$item->set_enclosure($enclosure);
$data->add_item($item);
}
$results->dispose();
return $data;
}
}
示例7: get_feed_data_struct
public function get_feed_data_struct($idcat = 0, $name = '')
{
if (ArticlesService::get_categories_manager()->get_categories_cache()->category_exists($idcat)) {
$querier = PersistenceContext::get_querier();
$category = ArticlesService::get_categories_manager()->get_categories_cache()->get_category($idcat);
$site_name = GeneralConfig::load()->get_site_name();
$site_name = $idcat != Category::ROOT_CATEGORY ? $site_name . ' : ' . $category->get_name() : $site_name;
$feed_module_name = LangLoader::get_message('articles.feed_name', 'common', 'articles');
$data = new FeedData();
$data->set_title($feed_module_name . ' - ' . $site_name);
$data->set_date(new Date());
$data->set_link(SyndicationUrlBuilder::rss('articles', $idcat));
$data->set_host(HOST);
$data->set_desc($feed_module_name . ' - ' . $site_name);
$data->set_lang(LangLoader::get_message('xml_lang', 'main'));
$data->set_auth_bit(Category::READ_AUTHORIZATIONS);
$categories = ArticlesService::get_categories_manager()->get_childrens($idcat, new SearchCategoryChildrensOptions(), true);
$ids_categories = array_keys($categories);
$now = new Date();
$results = $querier->select('SELECT articles.id, articles.id_category, articles.title, articles.rewrited_title, articles.picture_url,
articles.contents, articles.description, articles.date_created, cat.rewrited_name AS rewrited_name_cat
FROM ' . ArticlesSetup::$articles_table . ' articles
LEFT JOIN ' . ArticlesSetup::$articles_cats_table . ' cat ON cat.id = articles.id_category
WHERE articles.id_category IN :cats_ids
AND (published = 1 OR (published = 2 AND publishing_start_date < :timestamp_now AND (publishing_end_date > :timestamp_now OR publishing_end_date = 0)))
ORDER BY articles.date_created DESC', array('cats_ids' => $ids_categories, 'timestamp_now' => $now->get_timestamp()));
foreach ($results as $row) {
$row['rewrited_name_cat'] = !empty($row['id_category']) ? $row['rewrited_name_cat'] : 'root';
$link = ArticlesUrlBuilder::display_article($row['id_category'], $row['rewrited_name_cat'], $row['id'], $row['rewrited_title']);
$item = new FeedItem();
$item->set_title($row['title']);
$item->set_link($link);
$item->set_guid($link);
$item->set_desc(FormatingHelper::second_parse($row['contents']));
$item->set_date(new Date($row['date_created'], Timezone::SERVER_TIMEZONE));
$item->set_image_url($row['picture_url']);
$item->set_auth(ArticlesService::get_categories_manager()->get_heritated_authorizations($row['id_category'], Category::READ_AUTHORIZATIONS, Authorizations::AUTH_PARENT_PRIORITY));
$data->add_item($item);
}
$results->dispose();
return $data;
}
}
示例8: get_feed_data_struct
public function get_feed_data_struct($idcat = 0, $name = '')
{
$querier = PersistenceContext::get_querier();
global $LANG;
load_module_lang('wiki');
$categories = WikiCategoriesCache::load()->get_categories();
$config = WikiConfig::load();
$parameters = array('limit' => 20);
if ($idcat > 0 && array_key_exists($idcat, $categories)) {
$desc = sprintf($LANG['wiki_rss_cat'], stripslashes($categories[$idcat]['title']));
$where = 'AND a.id_cat = :idcat';
$parameters['idcat'] = $idcat;
} else {
$desc = sprintf($LANG['wiki_rss_last_articles'], $config->get_wiki_name() ? $config->get_wiki_name() : $LANG['wiki']);
$where = '';
}
$data = new FeedData();
$data->set_title($config->get_wiki_name() ? $config->get_wiki_name() : $LANG['wiki']);
$data->set_date(new Date());
$data->set_link(SyndicationUrlBuilder::rss('wiki', $idcat));
$data->set_host(HOST);
$data->set_desc($desc);
$data->set_lang($LANG['xml_lang']);
// Last news
$results = $querier->select('SELECT a.title, a.encoded_title, c.content, c.timestamp
FROM ' . PREFIX . 'wiki_articles a
LEFT JOIN ' . PREFIX . 'wiki_contents c ON c.id_contents = a.id_contents
WHERE a.redirect = 0 ' . $where . '
ORDER BY c.timestamp DESC LIMIT :limit OFFSET 0', $parameters);
// Generation of the feed's items
foreach ($results as $row) {
$item = new FeedItem();
$item->set_title($row['title']);
$link = new Url('/wiki/' . url('wiki.php?title=' . $row['encoded_title'], $row['encoded_title']));
$item->set_link($link);
$item->set_guid($link);
$item->set_desc(FormatingHelper::second_parse($row['content']));
$item->set_date(new Date($row['timestamp'], Timezone::SERVER_TIMEZONE));
$data->add_item($item);
}
$results->dispose();
return $data;
}
示例9: get_feed_data_struct
public function get_feed_data_struct($idcat = 0, $name = '')
{
if (FaqService::get_categories_manager()->get_categories_cache()->category_exists($idcat)) {
$querier = PersistenceContext::get_querier();
$category = FaqService::get_categories_manager()->get_categories_cache()->get_category($idcat);
$site_name = GeneralConfig::load()->get_site_name();
$site_name = $idcat != Category::ROOT_CATEGORY ? $site_name . ' : ' . $category->get_name() : $site_name;
$feed_module_name = LangLoader::get_message('module_title', 'common', 'faq');
$data = new FeedData();
$data->set_title($feed_module_name . ' - ' . $site_name);
$data->set_date(new Date());
$data->set_link(SyndicationUrlBuilder::rss('faq', $idcat));
$data->set_host(HOST);
$data->set_desc($feed_module_name . ' - ' . $site_name);
$data->set_lang(LangLoader::get_message('xml_lang', 'main'));
$data->set_auth_bit(Category::READ_AUTHORIZATIONS);
$categories = FaqService::get_categories_manager()->get_childrens($idcat, new SearchCategoryChildrensOptions(), true);
$ids_categories = array_keys($categories);
$results = $querier->select('SELECT faq.id, faq.id_category, faq.question, faq.answer, faq.creation_date, cat.rewrited_name AS rewrited_name_cat
FROM ' . FaqSetup::$faq_table . ' faq
LEFT JOIN ' . FaqSetup::$faq_cats_table . ' cat ON cat.id = faq.id_category
WHERE approved = 1
AND faq.id_category IN :ids_categories
ORDER BY faq.creation_date DESC', array('ids_categories' => $ids_categories));
foreach ($results as $row) {
$row['rewrited_name_cat'] = !empty($row['id_category']) ? $row['rewrited_name_cat'] : 'root';
$link = FaqUrlBuilder::display($row['id_category'], $row['rewrited_name_cat'], $row['id']);
$item = new FeedItem();
$item->set_title($row['question']);
$item->set_link($link);
$item->set_guid($link);
$item->set_desc(FormatingHelper::second_parse($row['answer']));
$item->set_date(new Date($row['creation_date'], Timezone::SERVER_TIMEZONE));
$item->set_auth(FaqService::get_categories_manager()->get_heritated_authorizations($row['id_category'], Category::READ_AUTHORIZATIONS, Authorizations::AUTH_PARENT_PRIORITY));
$data->add_item($item);
}
$results->dispose();
return $data;
}
}
示例10: FeedData
function get_feed_data_struct($idcat = 0, $name = '')
{
if (GalleryService::get_categories_manager()->get_categories_cache()->category_exists($idcat)) {
$category = GalleryService::get_categories_manager()->get_categories_cache()->get_category($idcat);
$config = GalleryConfig::load();
$site_name = GeneralConfig::load()->get_site_name();
$site_name = $idcat != Category::ROOT_CATEGORY ? $site_name . ' : ' . $category->get_name() : $site_name;
$feed_module_name = LangLoader::get_message('module_title', 'common', 'gallery');
$data = new FeedData();
$data->set_title($feed_module_name . ' - ' . $site_name);
$data->set_date(new Date());
$data->set_link(SyndicationUrlBuilder::rss('gallery', $idcat));
$data->set_host(HOST);
$data->set_desc($feed_module_name . ' - ' . $site_name);
$data->set_lang(LangLoader::get_message('xml_lang', 'main'));
$data->set_auth_bit(Category::READ_AUTHORIZATIONS);
$categories = GalleryService::get_categories_manager()->get_childrens($idcat, new SearchCategoryChildrensOptions(), true);
$ids_categories = array_keys($categories);
$results = PersistenceContext::get_querier()->select('SELECT *
FROM ' . GallerySetup::$gallery_table . '
WHERE idcat IN :ids_categories
ORDER BY timestamp DESC
LIMIT :pics_number_per_page', array('ids_categories' => $ids_categories, 'pics_number_per_page' => $config->get_pics_number_per_page()));
foreach ($results as $row) {
$link = TextHelper::htmlentities(GalleryUrlBuilder::get_link_item($row['idcat'], $row['id']));
$item = new FeedItem();
$item->set_title($row['name']);
$item->set_link($link);
$item->set_guid($link);
$item->set_date(new Date($row['timestamp'], Timezone::SERVER_TIMEZONE));
$item->set_image_url(Url::to_rel('/gallery/pics/' . $row['path']));
$item->set_auth(GalleryService::get_categories_manager()->get_heritated_authorizations($row['idcat'], Category::READ_AUTHORIZATIONS, Authorizations::AUTH_PARENT_PRIORITY));
$data->add_item($item);
}
$results->dispose();
return $data;
}
}
示例11: load_file
/**
* @desc Loads a feed by its url
* @param string $url the feed url
*/
public function load_file($url)
{
if (($file = @file_get_contents($url)) !== false) {
$this->data = new FeedData();
if (preg_match('`<item>(.*)</item>`is', $file)) {
$expParsed = explode('<item>', $file);
$nbItems = count($expParsed) - 1 > $nbItems ? $nbItems : count($expParsed) - 1;
$this->data->set_date(preg_match('`<!-- RSS generated by PHPBoost on (.*) -->`is', $expParsed[0], $var) ? $var[1] : '');
$this->data->set_title(preg_match('`<title>(.*)</title>`is', $expParsed[0], $var) ? $var[1] : '');
$this->data->set_link(preg_match('`<atom:link href="(.*)" rel="self" type="application/rss+xml" />`is', $expParsed[0], $var) ? $var[1] : '');
$this->data->set_host(preg_match('`<link>(.*)</link>`is', $expParsed[0], $var) ? $var[1] : '');
$this->data->set_desc(preg_match('`<description>(.*)</description>`is', $expParsed[0], $var) ? $var[1] : '');
$this->data->set_lang(preg_match('`<language>(.*)</language>`is', $expParsed[0], $var) ? $var[1] : '');
for ($i = 1; $i <= $nbItems; $i++) {
$pubDate = strtotime($date[1]);
$item = new FeedItem();
$item->set_title(preg_match('`<title>(.*)</title>`is', $expParsed[$i], $title) ? $title[1] : '');
$item->set_link(preg_match('`<link>(.*)</link>`is', $expParsed[$i], $url) ? $url[1] : '');
$item->set_guid(preg_match('`<guid>(.*)</guid>`is', $expParsed[$i], $guid) ? $guid[1] : '');
$item->set_desc(preg_match('`<desc>(.*)</desc>`is', $expParsed[$i], $desc) ? $desc[1] : '');
$item->set_date(preg_match('`<pubDate>(.*)</pubDate>`is', $expParsed[$i], $date) ? new Date(strtotime($date[1]), Timezone::SERVER_TIMEZONE) : null);
$enclosure = preg_match('`<enclosure url="(.*)" length="(.*)" type="(.*)" />`is', $expParsed[$i]);
if ($enclosure) {
$enclosure_item = new FeedItemEnclosure();
$enclosure_item->set_lenght($enclosure[2]);
$enclosure_item->set_type($enclosure[3]);
$enclosure_item->set_url($enclosure[1]);
$item->set_enclosure($enclosure_item);
}
$this->data->add_item($item);
}
return true;
}
return false;
}
return false;
}
示例12: import
function get_feed_data_struct($idcat = 0)
{
global $Cache, $Sql, $LANG, $MEDIA_LANG, $CONFIG, $MEDIA_CONFIG, $MEDIA_CATS;
$Cache->load('media');
load_module_lang('media');
require_once PATH_TO_ROOT . '/media/media_constant.php';
require_once PATH_TO_ROOT . '/media/media_cats.class.php';
import('content/syndication/feed_data');
import('util/date');
import('util/url');
$data = new FeedData();
$data->set_title($MEDIA_LANG['xml_media_desc']);
$data->set_date(new Date());
$data->set_link(new Url('/syndication.php?m=media&cat=' . $idcat));
$data->set_host(HOST);
$data->set_desc($MEDIA_LANG['xml_media_desc']);
$data->set_lang($LANG['xml_lang']);
$data->set_auth_bit(MEDIA_AUTH_READ);
$cats = new MediaCats();
$children_cats = array();
$cats->build_children_id_list($idcat, $children_cats, RECURSIVE_EXPLORATION, ADD_THIS_CATEGORY_IN_LIST);
$result = $Sql->query_while("SELECT id, idcat, name, contents, timestamp FROM " . PREFIX . "media WHERE infos = '" . MEDIA_STATUS_APROBED . "' AND idcat IN (" . implode($children_cats, ',') . " ) ORDER BY timestamp DESC" . $Sql->limit(0, $MEDIA_CONFIG['pagin']), __LINE__, __FILE__);
while ($row = $Sql->fetch_assoc($result)) {
$item = new FeedItem();
$link = new Url('/media/media' . url('.php?id=' . $row['id'], '-' . $row['id'] . '+' . url_encode_rewrite($row['name']) . '.php'));
$item->set_title($row['name']);
$item->set_link($link);
$item->set_guid($link);
$item->set_desc(second_parse($row['contents']));
$item->set_date(new Date(DATE_TIMESTAMP, TIMEZONE_SYSTEM, $row['timestamp']));
$item->set_image_url($MEDIA_CATS[$row['idcat']]['image']);
$item->set_auth($cats->compute_heritated_auth($row['idcat'], MEDIA_AUTH_READ, AUTH_PARENT_PRIORITY));
$data->add_item($item);
}
$Sql->query_close($result);
return $data;
}
示例13: get_feed_data_struct
public function get_feed_data_struct($idcat = 0, $name = '')
{
$config = ForumConfig::load();
$category = ForumService::get_categories_manager()->get_categories_cache()->get_category($idcat);
$data = new FeedData();
$data->set_title(LangLoader::get_message('xml_forum_desc', 'common', 'forum'));
$data->set_date(new Date());
$data->set_link(DispatchManager::get_url('/syndication', '/rss/forum/' . $idcat . '/'));
$data->set_host(HOST);
$data->set_desc(LangLoader::get_message('xml_forum_desc', 'common', 'forum'));
$data->set_lang(LangLoader::get_message('xml_lang', 'main'));
$data->set_auth_bit(Category::READ_AUTHORIZATIONS);
$categories = ForumService::get_categories_manager()->get_childrens($idcat, new SearchCategoryChildrensOptions(), true);
$ids_categories = array_keys($categories);
$results = PersistenceContext::get_querier()->select('SELECT t.id, t.idcat, t.title, t.last_timestamp, t.last_msg_id, t.display_msg, t.nbr_msg AS t_nbr_msg, msg.id mid, msg.contents
FROM ' . PREFIX . 'forum_topics t
LEFT JOIN ' . PREFIX . 'forum_msg msg ON msg.id = t.last_msg_id
WHERE t.idcat IN :ids_categories
ORDER BY t.last_timestamp DESC LIMIT :limit OFFSET 0', array('ids_categories' => $ids_categories, 'limit' => 2 * $config->get_number_messages_per_page()));
foreach ($results as $row) {
$item = new FeedItem();
//Link
$last_page = ceil($row['t_nbr_msg'] / $config->get_number_messages_per_page());
$last_page_rewrite = $last_page > 1 ? '-' . $last_page : '';
$last_page = $last_page > 1 ? 'pt=' . $last_page . '&' : '';
$link = new Url('/forum/topic' . url('.php?' . $last_page . 'id=' . $row['id'], '-' . $row['id'] . $last_page_rewrite . '+' . Url::encode_rewrite($row['title']) . '.php') . '#m' . $row['last_msg_id']);
$item->set_title(($config->is_message_before_topic_title_displayed() && !empty($row['display_msg']) ? TextHelper::html_entity_decode($config->get_message_before_topic_title(), ENT_NOQUOTES) . ' ' : '') . stripslashes($row['title']));
$item->set_link($link);
$item->set_guid($link);
$item->set_desc(FormatingHelper::second_parse($row['contents']));
$item->set_date(new Date($row['last_timestamp'], Timezone::SERVER_TIMEZONE));
$item->set_auth(ForumService::get_categories_manager()->get_heritated_authorizations($row['idcat'], Category::READ_AUTHORIZATIONS, Authorizations::AUTH_PARENT_PRIORITY));
$data->add_item($item);
}
$results->dispose();
return $data;
}
示例14: FeedData
function get_feed_data_struct($idcat = 0, $name = '')
{
global $LANG;
$querier = PersistenceContext::get_querier();
$pages_config = PagesConfig::load();
if (!defined('READ_PAGE')) {
require_once PATH_TO_ROOT . '/pages/pages_defines.php';
}
load_module_lang('pages');
$data = new FeedData();
$data->set_title($LANG['pages_rss_desc']);
$data->set_date(new Date());
$data->set_link(SyndicationUrlBuilder::rss('pages', $idcat));
$data->set_host(HOST);
$data->set_desc($LANG['pages_rss_desc']);
$data->set_lang($LANG['xml_lang']);
$data->set_auth_bit(READ_PAGE);
$where_clause = !empty($idcat) ? ' WHERE p.id_cat = :idcat' : '';
$results = $querier->select('SELECT p.*
FROM ' . PREFIX . 'pages p ' . $where_clause . '
ORDER BY p.timestamp DESC LIMIT :limit OFFSET 0', array('idcat' => $idcat, 'limit' => 10));
// Generation of the feed's items
foreach ($results as $row) {
$item = new FeedItem();
$link = new Url(PagesUrlBuilder::get_link_item($row['encoded_title']));
$item->set_title(stripslashes($row['title']));
$item->set_link($link);
$item->set_guid($link);
$item->set_desc(preg_replace('`\\[page\\](.+)\\[/page\\]`U', '<br /><strong>$1</strong><hr />', FormatingHelper::second_parse($row['contents'])));
$item->set_date(new Date($row['timestamp'], Timezone::SERVER_TIMEZONE));
$item->set_auth(empty($row['auth']) ? $pages_config->get_authorizations() : unserialize($row['auth']));
$data->add_item($item);
}
$results->dispose();
return $data;
}
示例15: get_feed_data_struct
public function get_feed_data_struct($idcat = 0, $name = '')
{
$querier = PersistenceContext::get_querier();
$lang = LangLoader::get('common', 'bugtracker');
//Configuration load
$config = BugtrackerConfig::load();
$types = $config->get_types();
$categories = $config->get_categories();
$severities = $config->get_severities();
$priorities = $config->get_priorities();
$versions = $config->get_versions_detected();
$site_name = GeneralConfig::load()->get_site_name();
$feed_module_name = $idcat == 1 ? $lang['titles.solved'] : $lang['titles.unsolved'];
$data = new FeedData();
$data->set_title($feed_module_name . ' - ' . $site_name);
$data->set_date(new Date());
$data->set_link(SyndicationUrlBuilder::rss('bugtracker', $idcat));
$data->set_host(HOST);
$data->set_desc($feed_module_name . ' - ' . $site_name);
$data->set_lang(LangLoader::get_message('xml_lang', 'main'));
$data->set_auth_bit(BugtrackerAuthorizationsService::READ_AUTHORIZATIONS);
$results = $querier->select("SELECT bugtracker.*, author.*\r\n\t\tFROM " . BugtrackerSetup::$bugtracker_table . " bugtracker\r\n\t\tLEFT JOIN " . DB_TABLE_MEMBER . " author ON author.user_id = bugtracker.author_id\r\n\t\tWHERE " . ($idcat == 1 ? "(status = '" . Bug::FIXED . "' OR status = '" . Bug::REJECTED . "')" : "status <> '" . Bug::FIXED . "' AND status <> '" . Bug::REJECTED . "'") . "\r\n\t\tORDER BY " . ($idcat == 1 ? "fix_date" : "submit_date") . " DESC");
foreach ($results as $row) {
$bug = new Bug();
$bug->set_properties($row);
$link = BugtrackerUrlBuilder::detail($bug->get_id() . '-' . $bug->get_rewrited_title());
$description = FormatingHelper::second_parse($bug->get_contents());
$description .= '<br /><br />' . $lang['labels.fields.reproductible'] . ' : ' . ($bug->is_reproductible() ? LangLoader::get_message('yes', 'common') : LangLoader::get_message('no', 'common'));
if ($bug->is_reproductible()) {
$description .= '<br />' . FormatingHelper::second_parse($bug->get_reproduction_method()) . '<br />';
}
if ($types) {
$description .= '<br />' . $lang['labels.fields.type'] . ' : ' . (isset($types[$bug->get_type()]) ? stripslashes($types[$bug->get_type()]) : $lang['notice.none']);
}
if ($categories) {
$description .= '<br />' . $lang['labels.fields.category'] . ' : ' . (isset($categories[$bug->get_category()]) ? stripslashes($categories[$bug->get_category()]) : $lang['notice.none_e']);
}
if ($severities) {
$description .= '<br />' . $lang['labels.fields.severity'] . ' : ' . (isset($severities[$bug->get_severity()]) ? stripslashes($severities[$bug->get_severity()]['name']) : $lang['notice.none']);
}
if ($priorities) {
$description .= '<br />' . $lang['labels.fields.priority'] . ' : ' . (isset($priorities[$bug->get_priority()]) ? stripslashes($priorities[$bug->get_priority()]) : $lang['notice.none_e']);
}
if ($versions) {
$description .= '<br />' . $lang['labels.fields.version'] . ' : ' . (isset($versions[$bug->get_detected_in()]) ? stripslashes($versions[$bug->get_detected_in()]['name']) : $lang['notice.not_defined']);
}
$item = new FeedItem();
$item->set_title($bug->get_title());
$item->set_link($link);
$item->set_guid($link);
$item->set_desc($description);
$item->set_date($bug->get_submit_date());
$item->set_auth(BugtrackerAuthorizationsService::READ_AUTHORIZATIONS);
$data->add_item($item);
}
$results->dispose();
return $data;
}