本文整理汇总了PHP中item::convert_from_rss方法的典型用法代码示例。如果您正苦于以下问题:PHP item::convert_from_rss方法的具体用法?PHP item::convert_from_rss怎么用?PHP item::convert_from_rss使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类item
的用法示例。
在下文中一共展示了item::convert_from_rss方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: nvweb_list_get_from_twitter
function nvweb_list_get_from_twitter($username, $cache_time = 3600, $offset, $items = 10, $permission, $order)
{
$url = 'https://api.twitter.com/1/statuses/user_timeline.rss?include_rts=true&contributor_details=false&screen_name=' . $username . '&count=' . $items;
$feed = new feed_parser();
$feed->set_cache($cache_time);
$feed->load($url);
list($channel, $articles) = $feed->parse('items', $offset, $order);
$items = item::convert_from_rss($articles);
return array($items, count($items));
}
示例2: run
function run()
{
global $user;
switch (@$_REQUEST['act']) {
case 'json':
switch ($_REQUEST['oper']) {
case 'settings_panels':
// save dashboard panels state
$dashboard_panels = $_REQUEST['dashboard_panels'];
$user->setting('dashboard-panels', json_encode($dashboard_panels));
echo json_encode(true);
core_terminate();
break;
case 'feed':
$feed = new feed_parser();
$feed->set_cache(4 * 3600);
// once update each 4 hours
$feed->load($_REQUEST['url']);
list($channel, $articles, $count) = $feed->parse(0, $_REQUEST['limit'], 'newest');
$items = item::convert_from_rss($articles);
$display_language = $_REQUEST['language'];
if (!empty($items)) {
$feed_html = '';
for ($c = 0; $c < count($items); $c++) {
if (empty($items[$c])) {
break;
}
if (!isset($items[$c]->dictionary[$display_language])) {
// requested language not available, get the first available in the feed
$feed_languages = array_keys($items[$c]->dictionary);
$display_language = $feed_languages[0];
}
$tmp = array('<div class="navigate-panel-body-title ui-corner-all">' . '<a href="' . $items[$c]->paths[$display_language] . '" target="_blank">' . core_ts2date($items[$c]->date_to_display, true) . ' ' . '<strong>' . $items[$c]->dictionary[$display_language]['title'] . '</strong>' . '</a>' . '</div>', '<div id="navigatecms-feed-item-' . $items[$c]->id . '" class="navigate-panel-recent-feed-element">' . $items[$c]->dictionary[$display_language]['section-main'] . '</div>');
$feed_html .= implode("\n", $tmp);
}
}
echo $feed_html;
core_terminate();
break;
default:
// list or search
}
break;
case 'recent_items':
$ri = users_log::recent_items(value_or_default($_REQUEST['limit']), 10);
if (!is_array($ri)) {
$ri = array();
}
for ($i = 0; $i < count($ri); $i++) {
$action = $ri[$i];
$ri[$i]->_url = '?fid=' . $action->function . '&wid=' . $action->website . '&act=load&id=' . $action->item;
$ri[$i]->_link = '<a href="' . $ri[$i]->_url . '" title="' . htmlspecialchars($action->item_title) . ' | ' . htmlspecialchars(t($action->function_title, $action->function_title)) . '"><img src="' . $action->function_icon . '" align="absmiddle" /> ' . core_string_cut($action->item_title, 33) . '</a>';
}
echo json_encode($ri);
core_terminate();
break;
default:
$out = dashboard_create();
}
return $out;
}