function merge_items($urls, $start = 0, $end = 0) { if (is_array($urls) && sizeof($urls) > 0) { $items = array(); foreach ($urls as $arg) { if (SimplePie_Misc::is_a($arg, 'SimplePie')) { $items = array_merge($items, $arg->get_items()); } else { trigger_error('Arguments must be SimplePie objects', E_USER_WARNING); } } $do_sort = true; foreach ($items as $item) { if (!$item->get_date('U')) { $do_sort = false; break; } } $item = null; if ($do_sort) { usort($items, array('SimplePie', 'sort_items')); } if ($end == 0) { return array_slice($items, $start); } else { return array_slice($items, $start, $end); } } else { trigger_error('Cannot merge zero SimplePie objects', E_USER_WARNING); return array(); } }
public static function autoDiscovery($url) { $parts = parse_url($url); if (empty($parts['path'])) { $url .= '/'; } $result = ''; $proxy = null; if (sfConfig::get('op_http_proxy')) { $proxy = sfConfig::get('op_http_proxy'); } $file = @new SimplePie_File($url, 10, 5, null, null, false, $proxy); $locator = new SimplePie_Locator($file, 10, null, 'SimplePie_File', 10, $proxy); $feedUrl = $locator->find(); if (SimplePie_Misc::is_a($feedUrl, 'SimplePie_File')) { $result = $feedUrl->url; } return $result; }
/** * RSS/Atom Auto-Discovery に対応したlinkタグからURLを抽出する(static) */ function auto_discovery($url) { // path 未指定の場合は「/」に設定する $parts = parse_url($url); if (empty($parts['path'])) { $url .= '/'; } $result = ''; if (OPENPNE_USE_HTTP_PROXY) { $proxy = OPENPNE_HTTP_PROXY_HOST . ":" . OPENPNE_HTTP_PROXY_PORT; } $file = @new SimplePie_File($url, 10, 5, null, null, false, $proxy); $locator = new SimplePie_Locator($file, 10, null, 'SimplePie_File', 10, $proxy); $feed_url = $locator->find(); if (SimplePie_Misc::is_a($feed_url, 'SimplePie_File')) { $result = $feed_url->url; } return $result; }