本文整理汇总了PHP中SimplePie::set_javascript方法的典型用法代码示例。如果您正苦于以下问题:PHP SimplePie::set_javascript方法的具体用法?PHP SimplePie::set_javascript怎么用?PHP SimplePie::set_javascript使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimplePie
的用法示例。
在下文中一共展示了SimplePie::set_javascript方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _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();
//.........这里部分代码省略.........
示例2: 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;
}