本文整理汇总了PHP中SimplePie::set_favicon_handler方法的典型用法代码示例。如果您正苦于以下问题:PHP SimplePie::set_favicon_handler方法的具体用法?PHP SimplePie::set_favicon_handler怎么用?PHP SimplePie::set_favicon_handler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimplePie
的用法示例。
在下文中一共展示了SimplePie::set_favicon_handler方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load
/**
* Create a new SimplePie object
*
* Creates an instance of SimplePie with Items::$feeds
*
* @since 1.0
*/
public function load()
{
global $lilina;
require_once LILINA_INCPATH . '/contrib/simplepie/simplepie.inc';
$feed = new SimplePie();
$feed->set_useragent('Lilina/' . $lilina['core-sys']['version'] . '; (' . get_option('baseurl') . '; http://getlilina.org/; Allow Like Gecko) SimplePie/' . SIMPLEPIE_BUILD);
$feed->set_stupidly_fast(true);
$feed->set_cache_location(get_option('cachedir'));
$feed->set_favicon_handler(get_option('baseurl') . '/lilina-favicon.php');
$feed = apply_filters('simplepie-config', $feed);
$feed->set_feed_url($this->feeds);
$feed->init();
/** We need this so we have something to work with. */
$feed->get_items();
if (!isset($feed->data['ordered_items'])) {
$feed->data['ordered_items'] = $feed->data['items'];
}
/** Let's force sorting */
usort($feed->data['ordered_items'], array(&$feed, 'sort_items'));
usort($feed->data['items'], array(&$feed, 'sort_items'));
$this->simplepie = $feed;
/** Free up memory just in case */
unset($feed);
}
示例2:
$feed->enable_xml_dump(isset($_GET['xmldump']) ? true : false);
}
// Allow us to change the input encoding from the URL string if we want to. (optional)
if (!empty($_GET['input'])) {
$feed->set_input_encoding($_GET['input']);
}
// Allow us to choose to not re-order the items by date. (optional)
if (!empty($_GET['orderbydate']) && $_GET['orderbydate'] == 'false') {
$feed->enable_order_by_date(false);
}
// Allow us to cache images in feeds. This will also bypass any hotlink blocking put in place by the website.
if (!empty($_GET['image']) && $_GET['image'] == 'true') {
$feed->set_image_handler('./handler_image.php');
}
// We'll enable the discovering and caching of favicons.
$feed->set_favicon_handler('./handler_image.php');
// Initialize the whole SimplePie object. Read the feed, process it, parse it, cache it, and
// all that other good stuff. The feed's information will not be available to SimplePie before
// this is called.
$success = $feed->init();
// We'll make sure that the right content type and character encoding gets set automatically.
// This function will grab the proper character encoding, as well as set the content type to text/html.
$feed->handle_content_type();
// When we end our PHP block, we want to make sure our DOCTYPE is on the top line to make
// sure that the browser snaps into Standards Mode.
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
<head>
<title>SimplePie: Demo</title>
示例3: upgrade_single
protected function upgrade_single($feed)
{
require_once LILINA_INCPATH . '/contrib/simplepie.class.php';
$sp = new SimplePie();
$sp->set_useragent(LILINA_USERAGENT . ' SimplePie/' . SIMPLEPIE_BUILD);
$sp->set_stupidly_fast(true);
$sp->set_cache_location(get_option('cachedir'));
$sp->set_favicon_handler(get_option('baseurl') . '/lilina-favicon.php');
$sp->set_feed_url($feed['feed']);
$sp->init();
if (!isset($feed['icon'])) {
$feed['icon'] = $sp->get_favicon();
}
return $feed;
}
示例4: execute
public function execute()
{
parent::execute();
if ($this->action == 'NewsreaderCache') {
$urls = preg_split('/\\r?\\n/', SPNRBOX_FEEDS);
$cache_location = WBB_DIR . 'lib/data/boxes/SimplePieNewsReader/cache';
// CHARSET
if (!defined('CHARSET')) {
define('CHARSET', 'UTF-8');
}
if (!defined('SPNRBOX_CHARSET')) {
define('SPNRBOX_CHARSET', 'UTF-8');
}
if (SPNRBOX_CHARSET == 'default') {
$charset = CHARSET;
} else {
$charset = SPNRBOX_CHARSET;
}
// FILTER?
if (SPNRBOX_FILTER && strlen(SPNRBOX_FILTERWORDS) >= 3) {
require_once WBB_DIR . 'lib/data/boxes/SimplePieNewsReader/simplepie_filter.php';
$feed = new SimplePie_Filter();
if (!defined('SPNRBOX_FILTERCLASS')) {
define('SPNRBOX_FILTERCLASS', 'hightlight');
}
define('SPNRBOX_FILTERON', 1);
} else {
$feed = new SimplePie();
define('SPNRBOX_FILTERON', 0);
}
$feed->set_feed_url($urls);
$feed->set_cache_location($cache_location);
$feed->set_autodiscovery_cache_duration(0);
$feed->set_cache_duration(0);
$feed->set_favicon_handler(RELATIVE_WBB_DIR . 'lib/data/boxes/SimplePieNewsReader/handler_image.php');
$feed->set_image_handler(RELATIVE_WBB_DIR . 'lib/data/boxes/SimplePieNewsReader/handler_image.php');
$feed->set_output_encoding($charset);
$feed->set_timeout(10);
$feed->init();
$feed->handle_content_type();
if (SPNRBOX_FILTERON) {
$feed->set_filter(SPNRBOX_FILTERWORDS, SPNRBOX_FILTERMODE);
}
header("Content-type: text/plain; charset=UTF-8");
foreach ($urls as $feeds) {
$feeds = trim($feeds);
if (empty($feeds)) {
continue;
}
$feed->set_feed_url($feeds);
$feed->init();
$items = $feed->get_items();
if (SPNRBOX_FILTERON) {
$items = $feed->filter($items);
}
echo $feed->get_title() . "\n";
if (!count($items)) {
echo "\tKeine Feeds gefunden.\n";
} else {
$i = 0;
foreach ($items as $item) {
if ($i >= SPNRBOX_NUMOFFEEDS) {
break;
}
SPNRBOX_FILTERON ? $this->highlight(SPNRBOX_FILTERWORDS, $item->get_content(), SPNRBOX_FILTERCLASS) : $item->get_content();
echo "\t\"" . $item->get_title() . "\" -> wurde geladen.\n";
$i++;
}
}
}
}
}
示例5: _setSimplePieModxPlaceholders
/**
* Processing the parameters into placeholders
* @param string $spie snippet parameters
* @return array placeholders
*/
private function _setSimplePieModxPlaceholders($spie) {
/**
* @link http://github.com/simplepie/simplepie/tree/one-dot-two
*/
if (!file_exists($spie['simplePieClassFile'])) {
return 'File ' . $spie['simplePieClassFile'] . ' does not exist.';
}
include_once $spie['simplePieClassFile'];
$feed = new SimplePie();
$joinKey = 0;
foreach ($spie['setFeedUrl'] as $setFeedUrl) {
$feed->set_cache_location($spie['setCacheLocation']);
$feed->set_feed_url($setFeedUrl);
if (isset($spie['setInputEncoding'])) {
$feed->set_input_encoding($spie['setInputEncoding']);
}
if (isset($spie['setOutputEncoding'])) {
$feed->set_output_encoding($spie['setOutputEncoding']);
}
// if no cURL, try fsockopen
if (isset($spie['forceFSockopen'])) {
$feed->force_fsockopen(true);
}
if (isset($spie['enableCache']))
$feed->enable_cache($spie['enableCache']);
if (isset($spie['enableOrderByDate']))
$feed->enable_order_by_date($spie['enableOrderByDate']);
if (isset($spie['setCacheDuration']))
$feed->set_cache_duration($spie['setCacheDuration']);
if (!empty($spie['setFaviconHandler']))
$feed->set_favicon_handler($spie['setFaviconHandler'][0], $spie['setFaviconHandler'][1]);
if (!empty($spie['setImageHandler'])) {
// handler_image.php?image=67d5fa9a87bad230fb03ea68b9f71090
$feed->set_image_handler($spie['setImageHandler'][0], $spie['setImageHandler'][1]);
}
// disabled since these are all splitted into a single fetching
// it's been used with different way, see below looping
// if (isset($spie['setItemLimit']))
// $feed->set_item_limit((int) $spie['setItemLimit']);
if (isset($spie['setJavascript']))
$feed->set_javascript($spie['setJavascript']);
if (isset($spie['stripAttributes']))
$feed->strip_attributes(array_merge($feed->strip_attributes, $spie['stripAttributes']));
if (isset($spie['stripComments']))
$feed->strip_comments($spie['stripComments']);
if (isset($spie['stripHtmlTags']))
$feed->strip_htmltags(array_merge($feed->strip_htmltags, $spie['stripHtmlTags']));
/**
* Initiating the Feeding.
* This always be placed AFTER all the settings above.
*/
if (!$feed->init()) {
echo $feed->error();
return FALSE;
}
$countItems = count($feed->get_items());
if (1 > $countItems) {
continue;
}
$feed->handle_content_type();
$countLimit = 0;
foreach ($feed->get_items($getItemStart, $getItemEnd) as $item) {
if (isset($spie['setItemLimit']) && $spie['setItemLimit'] == $countLimit)
continue;
$phArray[$joinKey]['favicon'] = $feed->get_favicon();
$phArray[$joinKey]['link'] = $item->get_link();
$phArray[$joinKey]['title'] = $item->get_title();
$phArray[$joinKey]['description'] = $item->get_description();
$phArray[$joinKey]['content'] = $item->get_content();
$phArray[$joinKey]['permalink'] = $item->get_permalink();
$parsedUrl = parse_url($phArray[$joinKey]['permalink']);
$implodedParsedUrl = $parsedUrl['scheme'] . '://' . $parsedUrl['host'];
$imageLink = $feed->get_image_link() != '' ? $feed->get_image_link() : $implodedParsedUrl;
$phArray[$joinKey]['imageLink'] = $imageLink;
$phArray[$joinKey]['imageTitle'] = $feed->get_image_title();
$phArray[$joinKey]['imageUrl'] = $feed->get_image_url();
$phArray[$joinKey]['imageWidth'] = $feed->get_image_width();
$phArray[$joinKey]['imageHeight'] = $feed->get_image_height();
$phArray[$joinKey]['date'] = $item->get_date($spie['dateFormat']);
$phArray[$joinKey]['localDate'] = $item->get_local_date($spie['localDateFormat']);
$phArray[$joinKey]['copyright'] = $item->get_copyright();
$phArray[$joinKey]['latitude'] = $feed->get_latitude();
//.........这里部分代码省略.........
示例6: fof_parse
function fof_parse($url)
{
$p =& FoF_Prefs::instance();
$admin_prefs = $p->admin_prefs;
$pie = new SimplePie();
$pie->set_cache_duration($admin_prefs["manualtimeout"] * 60);
$pie->set_favicon_handler("favicon.php");
$pie->set_feed_url($url);
$pie->set_javascript(false);
$pie->remove_div(false);
$pie->init();
return $pie;
}
示例7: __construct
public function __construct($data, $boxname = "")
{
$this->spnrbData['templatename'] = "simplePieNewsreaderBox";
$this->getBoxStatus($data);
$this->spnrbData['boxID'] = $data['boxID'];
if (SPNRBOX_BOXOPENED == true) {
$this->spnrbData['Status'] = 1;
}
if (WBBCore::getUser()->getPermission('user.board.canViewSimplePieNewsreaderBox')) {
require_once WBB_DIR . 'lib/data/boxes/SimplePieNewsReader/simplepie.inc';
require_once WBB_DIR . 'lib/data/boxes/SimplePieNewsReader/idna_convert.class.php';
// FILTER?
if (SPNRBOX_FILTER && strlen(SPNRBOX_FILTERWORDS) >= 3) {
require_once WBB_DIR . 'lib/data/boxes/SimplePieNewsReader/simplepie_filter.php';
$feed = new SimplePie_Filter();
if (!defined('SPNRBOX_FILTERCLASS')) {
define('SPNRBOX_FILTERCLASS', 'hightlight');
}
define('SPNRBOX_FILTERON', 1);
} else {
$feed = new SimplePie();
define('SPNRBOX_FILTERON', 0);
}
// CACHE
if (SPNRBOX_CACHEMAX != 0 && SPNRBOX_CACHEMIN != 0) {
$feed->set_autodiscovery_cache_duration(SPNRBOX_CACHEMAX);
$feed->set_cache_duration(SPNRBOX_CACHEMIN);
} else {
$feed->set_autodiscovery_cache_duration(9999999999);
$feed->set_cache_duration(9999999999);
}
// CHARSET
if (!defined('CHARSET')) {
define('CHARSET', 'UTF-8');
}
if (!defined('SPNRBOX_CHARSET')) {
define('SPNRBOX_CHARSET', 'UTF-8');
}
if (SPNRBOX_CHARSET == 'default') {
$charset = CHARSET;
} else {
$charset = SPNRBOX_CHARSET;
}
$feed->set_cache_location(WBB_DIR . 'lib/data/boxes/SimplePieNewsReader/cache');
$feed->set_favicon_handler(RELATIVE_WBB_DIR . 'lib/data/boxes/SimplePieNewsReader/handler_image.php');
$feed->set_image_handler(RELATIVE_WBB_DIR . 'lib/data/boxes/SimplePieNewsReader/handler_image.php');
$feed->set_output_encoding($charset);
// BOOKMARKS
$bookmarks = array();
if (SPNRBOX_SHOWSOCIALBOOKMARKS) {
$socialBookmarks = preg_split("/\r?\n/", SPNRBOX_SOCIALBOOKMARKS);
$cntBookmark = 0;
foreach ($socialBookmarks as $row) {
$row = trim($row);
if (preg_match("/\\|/", $row)) {
list($bookmarkTitle, $bookmarkUrl, $bookmarkImg, $bookmarkEncodeTitle, $bookmarkEncodeUrl) = preg_split("/\\|/", $row, 5);
$bookmarkTitle = trim($bookmarkTitle);
$bookmarkUrl = trim($bookmarkUrl);
$bookmarkImg = trim($bookmarkImg);
$bookmarkEncodeTitle = trim($bookmarkEncodeTitle);
$bookmarkEncodeUrl = trim($bookmarkEncodeUrl);
if (!empty($bookmarkTitle) && !empty($bookmarkUrl) && !empty($bookmarkImg) && isset($bookmarkEncodeTitle) && isset($bookmarkEncodeUrl)) {
$bookmarks[$cntBookmark]['bookmarkTitle'] = $bookmarkTitle;
$bookmarks[$cntBookmark]['bookmarkUrl'] = $bookmarkUrl;
$bookmarks[$cntBookmark]['bookmarkImg'] = $bookmarkImg;
$bookmarks[$cntBookmark]['bookmarkEncodeTitle'] = $bookmarkEncodeTitle == 1 ? 1 : 0;
$bookmarks[$cntBookmark]['bookmarkEncodeUrl'] = $bookmarkEncodeUrl == 1 ? 1 : 0;
$cntBookmark++;
}
}
}
}
// THEMA ZUM FEED
if (WCF::getUser()->getPermission('user.board.canViewThreadToFeed') && SPNRBOX_FEEDTOTHREAD) {
require_once WBB_DIR . 'lib/data/board/Board.class.php';
$accessibleBoards = explode(',', Board::getAccessibleBoards());
$selectiveBoards = explode(',', SPNRBOX_FEEDTOTHREADBOARDID);
$boardStructur = WCF::getCache()->get('board', 'boardStructure');
if (count($selectiveBoards) != 0) {
$this->spnrbData['boardsForm'] = count($selectiveBoards) == 1 ? 'button' : 'list';
$cntBoards = 0;
$prefix = '';
foreach ($selectiveBoards as $k => $v) {
$tmp = Board::getBoard($v);
if ($tmp->boardType < 2 && in_array($v, $accessibleBoards)) {
$this->spnrbData['boards'][$cntBoards]['id'] = $tmp->boardID;
$this->spnrbData['boards'][$cntBoards]['type'] = $tmp->boardType;
$prefix = '';
foreach ($boardStructur as $boardDepth => $boardKey) {
if (in_array($this->spnrbData['boards'][$cntBoards]['id'], $boardKey)) {
$prefix = str_repeat('--', $boardDepth);
break;
}
}
$this->spnrbData['boards'][$cntBoards]['title'] = ($prefix != '' ? $prefix : '') . ' ' . $tmp->title;
$cntBoards++;
}
}
} else {
$this->spnrbData['boardsForm'] = '';
//.........这里部分代码省略.........
示例8: SimplePie
/**
* Load and process a feed using SimplePie
*
* @param string $feed Feed detail array, as returned by Feeds::get()
* @return SimplePie
*/
public static function &load_feed($feed)
{
// This loads the useragent
class_exists('HTTPRequest');
global $lilina;
$sp = new SimplePie();
$sp->set_useragent(LILINA_USERAGENT . ' SimplePie/' . SIMPLEPIE_BUILD);
$sp->set_stupidly_fast(true);
$sp->set_cache_location(get_option('cachedir'));
//$sp->set_cache_duration(0);
$sp->set_favicon_handler(get_option('baseurl') . 'lilina-favicon.php');
$sp = apply_filters('simplepie-config', $sp);
$sp->set_feed_url($feed['feed']);
$sp->init();
/** We need this so we have something to work with. */
$sp->get_items();
if (!isset($sp->data['ordered_items'])) {
$sp->data['ordered_items'] = $sp->data['items'];
}
/** Let's force sorting */
usort($sp->data['ordered_items'], array(&$sp, 'sort_items'));
usort($sp->data['items'], array(&$sp, 'sort_items'));
do_action_ref_array('iu-load-feed', array(&$sp, $feed));
return $sp;
}