芝麻web文件管理V1.00
编辑当前文件:/home/mgatv524/public_html/mctv/vendor/bin/picofeed
#!/usr/bin/env php discover($url); $parser = $reader->getParser( $resource->getUrl(), $resource->getContent(), $resource->getEncoding() ); if ($disable_filtering) { $parser->disableContentFiltering(); } return $parser->execute(); } catch (PicoFeedException $e) { echo 'Exception thrown ===> "'.$e->getMessage().'"'.PHP_EOL; return false; } } function get_item($feed, $item_id) { foreach ($feed->items as $item) { if ($item->getId() === $item_id) { echo $item; echo "============= CONTENT ================\n"; echo $item->getContent(); echo "\n============= CONTENT ================\n"; break; } } } function dump_feed($url) { $feed = get_feed($url); echo $feed; } function debug_feed($url) { get_feed($url); print_r(Logger::getMessages()); } function dump_item($url, $item_id) { $feed = get_feed($url); if ($feed !== false) { get_item($feed, $item_id); } } function nofilter_item($url, $item_id) { $feed = get_feed($url, true); if ($feed !== false) { get_item($feed, $item_id); } } function grabber($url) { $grabber = new Scraper(new Config); $grabber->setUrl($url); $grabber->execute(); print_r(Logger::getMessages()); echo "============= CONTENT ================\n"; echo $grabber->getRelevantContent().PHP_EOL; echo "============= FILTERED ================\n"; echo $grabber->getFilteredContent().PHP_EOL; } function fetch_favicon($url) { $favicon = new Favicon(); echo $favicon->find($url) . PHP_EOL; } // Parse command line arguments if ($argc === 4) { switch ($argv[1]) { case 'item': dump_item($argv[2], $argv[3]); die; case 'nofilter': nofilter_item($argv[2], $argv[3]); die; } } else if ($argc === 3) { switch ($argv[1]) { case 'feed': dump_feed($argv[2]); die; case 'debug': debug_feed($argv[2]); die; case 'grabber': grabber($argv[2]); die; case 'favicon': fetch_favicon($argv[2]); die; } } printf("Usage:\n"); printf("%s feed
\n", $argv[0]); printf("%s debug
\n", $argv[0]); printf("%s item
\n", $argv[0]); printf("%s nofilter
\n", $argv[0]); printf("%s grabber
\n", $argv[0]); printf("%s favicon
\n", $argv[0]);