本文整理汇总了PHP中SimplePie::get_encoding方法的典型用法代码示例。如果您正苦于以下问题:PHP SimplePie::get_encoding方法的具体用法?PHP SimplePie::get_encoding怎么用?PHP SimplePie::get_encoding使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimplePie
的用法示例。
在下文中一共展示了SimplePie::get_encoding方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
/**
* MagpieFromSimplePie constructor
*
* @param SimplePie $pie The feed to convert to MagpieRSS format.
* @param mixed $item
*
* @uses SimplePie::get_items
* @uses MagpieFromSimplePie::processFeedData
* @uses MagpieFromSimplePie::processItemData
* @uses MagpieFromSimplePie::normalize
* @uses MagpieFromSimplePie::is_atom
*/
function __construct($pie, $item = true)
{
$this->pie = $pie;
// item in {NULL, true} = process channel data
if (!is_a($item, 'SimplePie_Item')) {
$this->originals = $this->pie->get_items();
$this->channel = $this->processFeedData($this->pie->data);
} else {
$this->originals = array($item);
$this->channel = NULL;
}
// item in {true, SimplePie_Item} = process item data
if (!is_null($item)) {
foreach ($this->originals as $key => $item) {
$this->items[$key] = $this->processItemData($item->data);
}
} else {
$this->items = NULL;
}
$this->normalize();
// In case anyone goes poking around our private members (uh...)
$this->feed_type = $this->is_atom() ? 'Atom' : 'RSS';
$this->feed_version = $this->feed_version();
$this->encoding = $pie->get_encoding();
}
示例2: MagpieFromSimplePie
/**
* MagpieFromSimplePie constructor
*
* @param SimplePie $pie The feed to convert to MagpieRSS format.
*
* @uses MagpieFromSimplePie::processItemData
* @uses MagpieFromSimplePie::normalize
*/
function MagpieFromSimplePie($pie)
{
$this->pie = $pie;
$this->originals = $this->pie->get_items();
$this->channel = $this->processFeedData($this->pie->data);
foreach ($this->originals as $key => $item) {
$this->items[$key] = $this->processItemData($item->data);
}
$this->normalize();
// In case anyone goes poking around our private members (uh...)
$this->feed_type = $this->is_atom() ? 'Atom' : 'RSS';
$this->feed_version = $this->feed_version();
$this->encoding = $pie->get_encoding();
}
示例3: SimplePieWP
//.........这里部分代码省略.........
// FEED_CONTRIBUTOR_LINK
if ($contributor = $feed->get_contributor()) {
if ($link = $contributor->get_link()) {
$tmpl = str_replace('{FEED_CONTRIBUTOR_LINK}', SimplePie_WordPress::post_process('FEED_CONTRIBUTOR_LINK', $link), $tmpl);
} else {
$tmpl = str_replace('{FEED_CONTRIBUTOR_LINK}', '', $tmpl);
}
} else {
$tmpl = str_replace('{FEED_CONTRIBUTOR_LINK}', '', $tmpl);
}
// FEED_CONTRIBUTOR_NAME
if ($contributor = $feed->get_contributor()) {
if ($name = $contributor->get_name()) {
$tmpl = str_replace('{FEED_CONTRIBUTOR_NAME}', SimplePie_WordPress::post_process('FEED_CONTRIBUTOR_NAME', $name), $tmpl);
} else {
$tmpl = str_replace('{FEED_CONTRIBUTOR_NAME}', '', $tmpl);
}
} else {
$tmpl = str_replace('{FEED_CONTRIBUTOR_NAME}', '', $tmpl);
}
// FEED_COPYRIGHT
if ($copyright = $feed->get_copyright()) {
$tmpl = str_replace('{FEED_COPYRIGHT}', SimplePie_WordPress::post_process('FEED_COPYRIGHT', $copyright), $tmpl);
} else {
$tmpl = str_replace('{FEED_COPYRIGHT}', '', $tmpl);
}
// FEED_DESCRIPTION
if ($description = $feed->get_description()) {
$tmpl = str_replace('{FEED_DESCRIPTION}', SimplePie_WordPress::post_process('FEED_DESCRIPTION', $description), $tmpl);
} else {
$tmpl = str_replace('{FEED_DESCRIPTION}', '', $tmpl);
}
// FEED_ENCODING
if ($encoding = $feed->get_encoding()) {
$tmpl = str_replace('{FEED_ENCODING}', SimplePie_WordPress::post_process('FEED_ENCODING', $encoding), $tmpl);
} else {
$tmpl = str_replace('{FEED_ENCODING}', '', $tmpl);
}
// FEED_FAVICON
if ($favicon = $feed->get_favicon()) {
$tmpl = str_replace('{FEED_FAVICON}', SimplePie_WordPress::post_process('FEED_FAVICON', $favicon), $tmpl);
} else {
$tmpl = str_replace('{FEED_FAVICON}', '', $tmpl);
}
// FEED_IMAGE_HEIGHT
if ($image_height = $feed->get_image_height()) {
$tmpl = str_replace('{FEED_IMAGE_HEIGHT}', SimplePie_WordPress::post_process('FEED_IMAGE_HEIGHT', $image_height), $tmpl);
} else {
$tmpl = str_replace('{FEED_IMAGE_HEIGHT}', '', $tmpl);
}
// FEED_IMAGE_LINK
if ($image_link = $feed->get_image_link()) {
$tmpl = str_replace('{FEED_IMAGE_LINK}', SimplePie_WordPress::post_process('FEED_IMAGE_LINK', $image_link), $tmpl);
} else {
$tmpl = str_replace('{FEED_IMAGE_LINK}', '', $tmpl);
}
// FEED_IMAGE_TITLE
if ($image_title = $feed->get_image_title()) {
$tmpl = str_replace('{FEED_IMAGE_TITLE}', SimplePie_WordPress::post_process('FEED_IMAGE_TITLE', $image_title), $tmpl);
} else {
$tmpl = str_replace('{FEED_IMAGE_TITLE}', '', $tmpl);
}
// FEED_IMAGE_URL
if ($image_url = $feed->get_image_url()) {
$tmpl = str_replace('{FEED_IMAGE_URL}', SimplePie_WordPress::post_process('FEED_IMAGE_URL', $image_url), $tmpl);
} else {
示例4: empty
$feed->init();
}
$feed->handle_content_type();
?>
<!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">
<head>
<title><?php
echo empty($_GET['feed']) ? 'SimplePie' : 'SimplePie: ' . $feed->get_title();
?>
</title>
<!-- META HTTP-EQUIV -->
<meta http-equiv="content-type" content="text/html; charset=<?php
echo $feed->get_encoding() ? $feed->get_encoding() : 'UTF-8';
?>
" />
<meta http-equiv="imagetoolbar" content="false" />
<style type="text/css">
html, body {
height:100%;
margin:0;
padding:0;
}
h1 {
background-color:#333;
color:#fff;
font-size:3em;
示例5: _setSimplePieModxPlaceholders
//.........这里部分代码省略.........
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();
$phArray[$joinKey]['longitude'] = $feed->get_longitude();
$phArray[$joinKey]['language'] = $feed->get_language();
$phArray[$joinKey]['encoding'] = $feed->get_encoding();
if ($item->get_authors()) {
foreach ($item->get_authors() as $authorObject) {
$authorName = $authorObject->get_name();
$authorLink = $authorObject->get_link();
$authorEmail = $authorObject->get_email();
}
$phArray[$joinKey]['authorName'] = $authorName;
$phArray[$joinKey]['authorLink'] = $authorLink;
$phArray[$joinKey]['authorEmail'] = $authorEmail;
}
$category = $item->get_category();
if ($category) {
$phArray[$joinKey]['category'] = htmlspecialchars_decode($category->get_label(), ENT_QUOTES);
}
$contributor = $item->get_contributor();
$phArray[$joinKey]['contributor'] = '';
if ($contributor) {
$phArray[$joinKey]['contributor'] = $contributor->get_name();
}
if ($feed->get_type() & SIMPLEPIE_TYPE_NONE) {
$phArray[$joinKey]['getType'] = 'Unknown';
} elseif ($feed->get_type() & SIMPLEPIE_TYPE_RSS_ALL) {
$phArray[$joinKey]['getType'] = 'RSS';
} elseif ($feed->get_type() & SIMPLEPIE_TYPE_ATOM_ALL) {
$phArray[$joinKey]['getType'] = 'Atom';
} elseif ($feed->get_type() & SIMPLEPIE_TYPE_ALL) {
$phArray[$joinKey]['getType'] = 'Supported';
}
// Media from Flickr RSS stream
if ($enclosure = $item->get_enclosure()) {
$phArray[$joinKey]['itemImageThumbnailUrl'] = $enclosure->get_thumbnail();
$phArray[$joinKey]['itemImageWidth'] = $enclosure->get_width();
$phArray[$joinKey]['itemImageHeight'] = $enclosure->get_height();
}
$countLimit++;
$joinKey++;
} // foreach ($feed->get_items($getItemStart, $getItemEnd) as $item)
} // foreach ($spie['setFeedUrl'] as $setFeedUrl)
return $this->_filterModxTags($phArray);
}