RSS 0.9.0, 1.0 and 2.0 feeds are allowed to have a "feed logo" title.
Uses </span> or <span class='highlight'><image><dc:title></span> </div>
</div>
<div class="row doc-tags">
<div class="col-md-12">
<div class="tag-block tag-summary">
</div>
<div class="tag-block tag-remarks">
</div>
<div class="tag-block tag-exception">
</div>
<div class="tag-block tag-see">
</div>
<div class="tag-block tag-link">
</div>
<div class="tag-block tag-deprecated">
</div>
<div class="tag-block tag-since">
</div>
<div class="tag-block tag-author">
</div>
</div>
</div>
<div class="row">
<div class="col-md-12" style="overflow: auto">
<table class="table table-striped">
<tr>
<td colspan="3" class="rendered">
<span class="modifier">public</span > <span class="method-name"><a class="method-link" href="https://doc.hotexamples.com/fr/class/-/SimplePie#method-get_image_title">get_image_title</a></span> ( ) : <span class="return-type"><a href="http://php.net/manual/en/language.types.string.php">string</a> | <a href="http://php.net/manual/en/language.types.null.php">null</a></span> </td>
</tr>
<tr>
<td class="field-return">Résultat</td>
<td class="field-return-type"><a href="http://php.net/manual/en/language.types.string.php">string</a> | <a href="http://php.net/manual/en/language.types.null.php">null</a></td>
<td></td>
</tr>
</table>
</div>
</div>
</div> </div>
</div>
<div class="row" style="margin-bottom: 15px">
<div class="col-md-12">
<a class="btn btn-default" href="https://doc.hotexamples.com/fr/class/-/SimplePie">
SimplePie Class Documentation </a>
</div>
</div>
</div>
<div id="ezoic-pub-ad-placeholder-106">
</div>
<div class="example-item" id="0x98b48626b02cd4d293dadee22e0a3d19298c89fb1d77bebd829e560a648f35a8-68,,130,">
<div class="bs-example">
<div>
<div class="bs-example-title">Exemple #1</div>
<div style="position: absolute;right: 15px;top: 10px;" id="rating_1" data-hash="0x98b48626b02cd4d293dadee22e0a3d19298c89fb1d77bebd829e560a648f35a8" data-area="68,,130,">
<div class="rating-amount">0</div>
<a title="Noter cet exemple comme bon" href="javascript:app.addRating(1, '1')" class="rating-up btn btn-success"
data-id="rating_1"><i class="icon-button icon-thumbs-up"></i></a>
<a title="Noter cet exemple comme mauvais" href="javascript:app.addRating(-1,'1')" class="rating-down btn btn-danger"
data-id="rating_1"><i class="icon-button icon-thumbs-down"></i></a>
</div>
</div>
<div style="display:flex;align-items: center;flex-wrap: wrap">
<div style="display: inline-block;margin-right: 10px">
<a class="btn btn-default" title="Lien direct vers cet exemple"
href="https://hotexamples.com/fr/examples/-/SimplePie/get_image_title/php-simplepie-get_image_title-method-examples.html#0x98b48626b02cd4d293dadee22e0a3d19298c89fb1d77bebd829e560a648f35a8-68,,130,"><i class="icon-button icon-link"></i></a>
<a rel="nofollow" class="btn btn-default"
href="javascript:app.open('https://hotexamples.com/fr/site/file?hash=0x98b48626b02cd4d293dadee22e0a3d19298c89fb1d77bebd829e560a648f35a8&fullName=src%2FResources%2Fcontao%2FModuleRssReader.php&project=contao%2Fcore-bundle')">Afficher le fichier</a>
</div>
<div class="example-project-info">
<nobr>
<span>Fichier :</span>
<a target="_blank" rel="nofollow" href="https://hotexamples.com/fr/site/redirect?url=https%3A%2F%2Fgithub.com%2Fcontao%2Fcore-bundle%2Fblob%2Fmaster%2Fsrc%2FResources%2Fcontao%2FModuleRssReader.php">ModuleRssReader.php</a>
</nobr>
<nobr>
<span>Projet :</span>
<a target="_blank" rel="nofollow" href="https://hotexamples.com/fr/site/redirect?url=https%3A%2F%2Fgithub.com%2Fcontao%2Fcore-bundle">contao/core-bundle</a>
</nobr>
</div>
</div>
</div>
<figure class="highlight">
<div class="example" data-id="1">
<pre class="line-numbers language-php" data-end="130" data-start="69"
data-highlight="25,92"> /**
* Generate the module
*/
protected function compile()
{
/** @var PageModel $objPage */
global $objPage;
if ($this->rss_template != 'rss_default') {
$this->strTemplate = $this->rss_template;
/** @var FrontendTemplate|object $objTemplate */
$objTemplate = new \FrontendTemplate($this->strTemplate);
$this->Template = $objTemplate;
$this->Template->setData($this->arrData);
}
$this->Template->link = $this->objFeed->get_link();
$this->Template->title = $this->objFeed->get_title();
$this->Template->language = $this->objFeed->get_language();
$this->Template->description = $this->objFeed->get_description();
$this->Template->copyright = $this->objFeed->get_copyright();
// Add image
if ($this->objFeed->get_image_url()) {
$this->Template->image = true;
$this->Template->src = $this->objFeed->get_image_url();
$this->Template->alt = $this->objFeed->get_image_title();
$this->Template->href = $this->objFeed->get_image_link();
$this->Template->height = $this->objFeed->get_image_height();
$this->Template->width = $this->objFeed->get_image_width();
}
// Get the items (see #6107)
$arrItems = array_slice($this->objFeed->get_items(0, intval($this->numberOfItems) + intval($this->skipFirst)), intval($this->skipFirst), intval($this->numberOfItems) ?: null);
$limit = count($arrItems);
$offset = 0;
// Split pages
if ($this->perPage > 0) {
// Get the current page
$id = 'page_r' . $this->id;
$page = \Input::get($id) !== null ? \Input::get($id) : 1;
// Do not index or cache the page if the page number is outside the range
if ($page < 1 || $page > max(ceil(count($arrItems) / $this->perPage), 1)) {
throw new PageNotFoundException('Page not found: ' . \Environment::get('uri'));
}
// Set limit and offset
$offset = ($page - 1) * $this->perPage;
$limit = $this->perPage + $offset;
$objPagination = new \Pagination(count($arrItems), $this->perPage, \Config::get('maxPaginationLinks'), $id);
$this->Template->pagination = $objPagination->generate("\n ");
}
$items = array();
$last = min($limit, count($arrItems)) - 1;
/** @var \SimplePie_Item[] $arrItems */
for ($i = $offset, $c = count($arrItems); $i < $limit && $i < $c; $i++) {
$items[$i] = array('link' => $arrItems[$i]->get_link(), 'title' => $arrItems[$i]->get_title(), 'permalink' => $arrItems[$i]->get_permalink(), 'description' => str_replace(array('<?', '?>'), array('<?', '?>'), $arrItems[$i]->get_description()), 'class' => ($i == 0 ? ' first' : '') . ($i == $last ? ' last' : '') . ($i % 2 == 0 ? ' even' : ' odd'), 'pubdate' => \Date::parse($objPage->datimFormat, $arrItems[$i]->get_date('U')), 'category' => $arrItems[$i]->get_category(0), 'object' => $arrItems[$i]);
// Add author
if (($objAuthor = $arrItems[$i]->get_author(0)) != false) {
$items[$i]['author'] = trim($objAuthor->name . ' ' . $objAuthor->email);
}
// Add enclosure
if (($objEnclosure = $arrItems[$i]->get_enclosure(0)) != false) {
$items[$i]['enclosure'] = $objEnclosure->get_link();
}
}
$this->Template->items = array_values($items);
}</pre>
</div>
</figure>
</div>
<div id="ezoic-pub-ad-placeholder-107">
<div style="text-align: center;margin-bottom: 10px">
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- after-example-1 -->
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-3697522372581514"
data-ad-slot="4981531786"
data-ad-format="auto"
data-full-width-responsive="true"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
</div>
<div class="example-item" id="0x92d9931b8470f7a17e3770d9d23783bb03ca7f4f0f54b0e116145bb64a94a05b-22,,66,">
<div class="bs-example">
<div>
<div class="bs-example-title">Exemple #2</div>
<div style="position: absolute;right: 15px;top: 10px;" id="rating_2" data-hash="0x92d9931b8470f7a17e3770d9d23783bb03ca7f4f0f54b0e116145bb64a94a05b" data-area="22,,66,">
<div class="rating-amount">0</div>
<a title="Noter cet exemple comme bon" href="javascript:app.addRating(1, '2')" class="rating-up btn btn-success"
data-id="rating_2"><i class="icon-button icon-thumbs-up"></i></a>
<a title="Noter cet exemple comme mauvais" href="javascript:app.addRating(-1,'2')" class="rating-down btn btn-danger"
data-id="rating_2"><i class="icon-button icon-thumbs-down"></i></a>
</div>
</div>
<div style="display:flex;align-items: center;flex-wrap: wrap">
<div style="display: inline-block;margin-right: 10px">
<a class="btn btn-default" title="Lien direct vers cet exemple"
href="https://hotexamples.com/fr/examples/-/SimplePie/get_image_title/php-simplepie-get_image_title-method-examples.html#0x92d9931b8470f7a17e3770d9d23783bb03ca7f4f0f54b0e116145bb64a94a05b-22,,66,"><i class="icon-button icon-link"></i></a>
<a rel="nofollow" class="btn btn-default"
href="javascript:app.open('https://hotexamples.com/fr/site/file?hash=0x92d9931b8470f7a17e3770d9d23783bb03ca7f4f0f54b0e116145bb64a94a05b&fullName=sportnet%2Fapplication%2Fcron_model.php&project=robdmat%2Fsport.net')">Afficher le fichier</a>
</div>
<div class="example-project-info">
<nobr>
<span>Fichier :</span>
<a target="_blank" rel="nofollow" href="https://hotexamples.com/fr/site/redirect?url=https%3A%2F%2Fgithub.com%2Frobdmat%2Fsport.net%2Fblob%2Fmaster%2Fsportnet%2Fapplication%2Fcron_model.php">cron_model.php</a>
</nobr>
<nobr>
<span>Projet :</span>
<a target="_blank" rel="nofollow" href="https://hotexamples.com/fr/site/redirect?url=https%3A%2F%2Fgithub.com%2Frobdmat%2Fsport.net">robdmat/sport.net</a>
</nobr>
</div>
</div>
</div>
<figure class="highlight">
<div class="example" data-id="2">
<pre class="line-numbers language-php" data-end="66" data-start="23"
data-highlight="62"> public function setCron()
{
$getUnique = $this->getAllFeedUrls();
if (!empty($getUnique)) {
foreach ($getUnique as $feedTableData) {
$feed_user_title = $feedTableData->feed_user_title;
$feed_url = $feedTableData->feed_admin_url;
$usercat = $feedTableData->feed_user_category;
$feed_filter_type = $feedTableData->feed_filter_type;
$favicon_icon = $feedTableData->feed_favicon;
$feed = new SimplePie();
$feed->set_feed_url($feed_url);
$feed->set_cache_location(APPPATH . '/cache');
$feed->set_output_encoding('ISO-8859-1');
$feed->init();
$feed->handle_content_type();
// Language
$lang = $feed->get_language();
$language = isset($lang) ? $lang : 'en-us';
if ($feed->get_type() & SIMPLEPIE_TYPE_NONE) {
$feed_type = 'Unknown';
} elseif ($feed->get_type() & SIMPLEPIE_TYPE_RSS_ALL) {
$feed_type = 'RSS';
} elseif ($feed->get_type() & SIMPLEPIE_TYPE_ATOM_ALL) {
$feed_type = 'Atom';
} elseif ($feed->get_type() & SIMPLEPIE_TYPE_ALL) {
$feed_type = 'Supported';
}
// Author
if ($author = $feed->get_author()) {
$feedAuthor = $author->get_name();
} else {
$feedAuthor = '';
}
if ($feed->error()) {
die;
} else {
$feed_image_link = $feed->get_image_link();
$feed_image_url = $feed->get_image_url();
$feed_image_title = $feed->get_image_title();
$this->addFeeds($feed->get_items(0, 500), $feed_image_link, $feed_image_url, $feed_image_title, $usercat, $feed_url, $language, $feed_type, $feedAuthor, $feed_filter_type, $feed_user_title, $favicon_icon);
}
}
}
}</pre>
</div>
</figure>
</div>
<div id="ezoic-pub-ad-placeholder-108">
<div style="text-align: center;">
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- after-example-2 -->
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-3697522372581514"
data-ad-slot="7155150962"
data-ad-format="auto"
data-full-width-responsive="true"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
</div>
<div class="example-item" id="0xd9d3e52a6fde5590374f7eaaca751d133d3e21bdf66f804fe881a2e46b3088eb-42,,103,">
<div class="bs-example">
<div>
<div class="bs-example-title">Exemple #3</div>
<div style="position: absolute;right: 15px;top: 10px;" id="rating_3" data-hash="0xd9d3e52a6fde5590374f7eaaca751d133d3e21bdf66f804fe881a2e46b3088eb" data-area="42,,103,">
<div class="rating-amount">0</div>
<a title="Noter cet exemple comme bon" href="javascript:app.addRating(1, '3')" class="rating-up btn btn-success"
data-id="rating_3"><i class="icon-button icon-thumbs-up"></i></a>
<a title="Noter cet exemple comme mauvais" href="javascript:app.addRating(-1,'3')" class="rating-down btn btn-danger"
data-id="rating_3"><i class="icon-button icon-thumbs-down"></i></a>
</div>
</div>
<div style="display:flex;align-items: center;flex-wrap: wrap">
<div style="display: inline-block;margin-right: 10px">
<a class="btn btn-default" title="Lien direct vers cet exemple"
href="https://hotexamples.com/fr/examples/-/SimplePie/get_image_title/php-simplepie-get_image_title-method-examples.html#0xd9d3e52a6fde5590374f7eaaca751d133d3e21bdf66f804fe881a2e46b3088eb-42,,103,"><i class="icon-button icon-link"></i></a>
<a rel="nofollow" class="btn btn-default"
href="javascript:app.open('https://hotexamples.com/fr/site/file?hash=0xd9d3e52a6fde5590374f7eaaca751d133d3e21bdf66f804fe881a2e46b3088eb&fullName=sportnet%2Fapplication%2Ffeeds.php&project=robdmat%2Fsport.net')">Afficher le fichier</a>
</div>
<div class="example-project-info">
<nobr>
<span>Fichier :</span>
<a target="_blank" rel="nofollow" href="https://hotexamples.com/fr/site/redirect?url=https%3A%2F%2Fgithub.com%2Frobdmat%2Fsport.net%2Fblob%2Fmaster%2Fsportnet%2Fapplication%2Ffeeds.php">feeds.php</a>
</nobr>
<nobr>
<span>Projet :</span>
<a target="_blank" rel="nofollow" href="https://hotexamples.com/fr/site/redirect?url=https%3A%2F%2Fgithub.com%2Frobdmat%2Fsport.net">robdmat/sport.net</a>
</nobr>
</div>
</div>
</div>
<figure class="highlight">
<div class="example" data-id="3">
<pre class="line-numbers language-php" data-end="103" data-start="43"
data-highlight="95"> /**
*/
public function add()
{
$feed_user_title = $this->input->post('feed_title', TRUE);
$feed_url = $this->input->post('feed_url');
$usercat = $this->input->post('category');
$feed_filter_type = $this->input->post('feed_type');
$_icon = $this->input->post('favicon_icon');
$favicon_icon = $_icon;
if (!isset($feed_url) || $feed_url == '') {
$this->stencil->title('Feeds');
$this->stencil->layout('admin_layout');
$this->stencil->css(array('admin_css/bootstrap.min', 'admin_css/bootstrap-responsive.min', 'admin_css/styles'));
$this->stencil->js(array('vendors/datatables/js/jquery.dataTables.min.js', 'DT_bootstrap'));
$this->stencil->paint('admin/feeds/add');
} else {
$check = $this->validateUrl($feed_url);
if ($check == FALSE) {
echo json_encode(array('result' => 'fail', 'msg' => '<div class="alert alert-error"><button type="button" class="close" data-dismiss="alert">×</button>Url Already exists in the database!</div>'));
die;
}
$feed = new SimplePie();
$feed->set_feed_url($feed_url);
$feed->set_cache_location(APPPATH . '/cache');
$feed->set_output_encoding('ISO-8859-1');
$feed->init();
$feed->handle_content_type();
// Language
$lang = $feed->get_language();
$language = isset($lang) ? $lang : 'en-us';
if ($feed->get_type() & SIMPLEPIE_TYPE_NONE) {
$feed_type = 'Unknown';
} elseif ($feed->get_type() & SIMPLEPIE_TYPE_RSS_ALL) {
$feed_type = 'RSS';
} elseif ($feed->get_type() & SIMPLEPIE_TYPE_ATOM_ALL) {
$feed_type = 'Atom';
} elseif ($feed->get_type() & SIMPLEPIE_TYPE_ALL) {
$feed_type = 'Supported';
}
// Author
if ($author = $feed->get_author()) {
$feedAuthor = $author->get_name();
} else {
$feedAuthor = '';
}
if ($feed->error()) {
echo json_encode(array('result' => 'fail', 'msg' => '<div class="alert alert-error"><button type="button" class="close" data-dismiss="alert">×</button>Found error while making request</div>'));
} else {
// $return = $this->feed_model->addFeeds($feed->get_items(0, 500));
$feed_image_link = $feed->get_image_link();
$feed_image_url = $feed->get_image_url();
$feed_image_title = $feed->get_image_title();
$return = $this->feedModel->addFeeds($feed->get_items(0, 500), $feed_image_link, $feed_image_url, $feed_image_title, $usercat, $feed_url, $language, $feed_type, $feedAuthor, $feed_filter_type, $feed_user_title, $favicon_icon);
if ($return) {
echo json_encode(array('result' => 'success', 'msg' => '<div class="alert alert-success"><button type="button" class="close" data-dismiss="alert">×</button>Blog is added successfully</div>'));
} else {
echo json_encode(array('result' => 'fail', 'msg' => '<div class="alert alert-error"><button type="button" class="close" data-dismiss="alert">×</button>Found error while making request</div>'));
}
}
}
}</pre>
</div>
</figure>
</div>
<div id="ezoic-pub-ad-placeholder-109">
<div style="text-align: center;">
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- after-example-3 -->
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-3697522372581514"
data-ad-slot="8699811701"
data-ad-format="auto"
data-full-width-responsive="true"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
</div>
<div class="example-item" id="0xa3aac1ab34693121f6b0b4fb4c0944b62376235ee1ed37969b8d5d6f120c3c95-13,,210,">
<div class="bs-example">
<div>
<div class="bs-example-title">Exemple #4</div>
<div style="position: absolute;right: 15px;top: 10px;" id="rating_4" data-hash="0xa3aac1ab34693121f6b0b4fb4c0944b62376235ee1ed37969b8d5d6f120c3c95" data-area="13,,210,">
<div class="rating-amount">0</div>
<a title="Noter cet exemple comme bon" href="javascript:app.addRating(1, '4')" class="rating-up btn btn-success"
data-id="rating_4"><i class="icon-button icon-thumbs-up"></i></a>
<a title="Noter cet exemple comme mauvais" href="javascript:app.addRating(-1,'4')" class="rating-down btn btn-danger"
data-id="rating_4"><i class="icon-button icon-thumbs-down"></i></a>
</div>
</div>
<div style="display:flex;align-items: center;flex-wrap: wrap">
<div style="display: inline-block;margin-right: 10px">
<a class="btn btn-default" title="Lien direct vers cet exemple"
href="https://hotexamples.com/fr/examples/-/SimplePie/get_image_title/php-simplepie-get_image_title-method-examples.html#0xa3aac1ab34693121f6b0b4fb4c0944b62376235ee1ed37969b8d5d6f120c3c95-13,,210,"><i class="icon-button icon-link"></i></a>
<a rel="nofollow" class="btn btn-default"
href="javascript:app.open('https://hotexamples.com/fr/site/file?hash=0xa3aac1ab34693121f6b0b4fb4c0944b62376235ee1ed37969b8d5d6f120c3c95&fullName=modules%2Fhelper.php&project=bizanto%2FHooked')">Afficher le fichier</a>
</div>
<div class="example-project-info">
<nobr>
<span>Fichier :</span>
<a target="_blank" rel="nofollow" href="https://hotexamples.com/fr/site/redirect?url=https%3A%2F%2Fgithub.com%2Fbizanto%2FHooked%2Fblob%2Fmaster%2Fmodules%2Fhelper.php">helper.php</a>
</nobr>
<nobr>
<span>Projet :</span>
<a target="_blank" rel="nofollow" href="https://hotexamples.com/fr/site/redirect?url=https%3A%2F%2Fgithub.com%2Fbizanto%2FHooked">bizanto/Hooked</a>
</nobr>
</div>
</div>
</div>
<figure class="highlight">
<div class="example" data-id="4">
<pre class="line-numbers language-php" data-end="210" data-start="14"
data-highlight="101"> function getFeed(&$params)
{
//global $mainframe;
$slick_rss = array();
//init feed array
if (!class_exists('SimplePie')) {
//include Simple Pie processor class
require_once JPATH_SITE . DS . 'libraries' . DS . 'simplepie' . DS . 'simplepie.php';
}
// check if cache directory exists and is writeable
$cacheDir = JPATH_BASE . DS . 'cache';
if (!is_writable($cacheDir)) {
$slick_rss['error'][] = 'Cache folder is unwriteable. Solution: chmod 777 ' . $cacheDir;
$cache_exists = false;
} else {
$cache_exists = true;
}
//get local module parameters from xml file module config settings
$rssurl = $params->get('rssurl', NULL);
$rssitems = $params->get('rssitems', 5);
$rssdesc = $params->get('rssdesc', 1);
$rssimage = $params->get('rssimage', 1);
$rssitemtitle_words = $params->get('rssitemtitle_words', 0);
$rssitemdesc = $params->get('rssitemdesc', 0);
$rssitemdesc_images = $params->get('rssitemdesc_images', 1);
$rssitemdesc_words = $params->get('rssitemdesc_words', 0);
$rsstitle = $params->get('rsstitle', 1);
$rsscache = $params->get('rsscache', 3600);
$link_target = $params->get('link_target', 1);
$no_follow = $params->get('no_follow', 0);
$enable_tooltip = $params->get('enable_tooltip', 'yes');
$tooltip_desc_words = $params->get('t_word_count_desc', 25);
$tooltip_desc_images = $params->get('tooltip_desc_images', 1);
$tooltip_title_words = $params->get('t_word_count_title', 25);
if (!$rssurl) {
$slick_rss['error'][] = 'Invalid feed url. Please enter a valid url in the module settings.';
return $slick_rss;
//halt if no valid feed url supplied
}
switch ($link_target) {
//open links in current or new window
case 1:
$link_target = '_blank';
break;
case 0:
$link_target = '_self';
break;
default:
$link_target = '_blank';
break;
}
$slick_rss['target'] = $link_target;
if ($no_follow) {
$slick_rss['nofollow'] = 'rel="nofollow"';
}
//Load and build the feed array
$feed = new SimplePie();
$feed->set_feed_url($rssurl);
//check and set caching
if ($cache_exists) {
$feed->set_cache_location($cacheDir);
$feed->enable_cache();
$cache_time = intval($rsscache);
$feed->set_cache_duration($cache_time);
} else {
$feed->enable_cache('false');
}
$feed->init();
//process the loaded feed
$feed->handle_content_type();
//store any error message
if (isset($feed->error)) {
$slick_rss['error'][] = $feed->error;
}
//start building the feed meta-info (title, desc and image)
// feed title
if ($feed->get_title() && $rsstitle) {
$slick_rss['title']['link'] = $feed->get_link();
$slick_rss['title']['title'] = $feed->get_title();
}
// feed description
if ($rssdesc) {
$slick_rss['description'] = $feed->get_description();
}
// feed image
if ($rssimage && $feed->get_image_url()) {
$slick_rss['image']['url'] = $feed->get_image_url();
$slick_rss['image']['title'] = $feed->get_image_title();
}
//end feed meta-info
//start processing feed items
//if there are items in the feed
if ($feed->get_item_quantity()) {
//start looping through the feed items
$slick_rss_item = 0;
//item counter for array indexing in the loop
foreach ($feed->get_items(0, $rssitems) as $currItem) {
// item title
$item_title = trim($currItem->get_title());
// item title word limit check
if ($rssitemtitle_words) {
$item_titles = explode(' ', $item_title);
$count = count($item_titles);
if ($count > $rssitemtitle_words) {
$item_title = '';
for ($i = 0; $i < $rssitemtitle_words; $i++) {
$item_title .= ' ' . $item_titles[$i];
}
$item_title .= '...';
}
}
$slick_rss['items'][$slick_rss_item]['title'] = $item_title;
// Item Title
$slick_rss['items'][$slick_rss_item]['link'] = $currItem->get_permalink();
// item description
if ($rssitemdesc) {
$desc = trim($currItem->get_description());
if (!$rssitemdesc_images) {
$desc = preg_replace("/<img[^>]+\\>/i", "", $desc);
//strip image tags
}
//item description word limit check
if ($rssitemdesc_words) {
$texts = explode(' ', $desc);
$count = count($texts);
if ($count > $rssitemdesc_words) {
$desc = '';
for ($i = 0; $i < $rssitemdesc_words; $i++) {
$desc .= ' ' . $texts[$i];
//build words
}
$desc .= '...';
}
}
$slick_rss['items'][$slick_rss_item]['description'] = $desc;
//Item Description
}
// tooltip text
if ($enable_tooltip == 'yes') {
//tooltip item title
$t_item_title = trim($currItem->get_title());
// tooltip title word limit check
if ($tooltip_title_words) {
$t_item_titles = explode(' ', $t_item_title);
$count = count($t_item_titles);
if ($count > $tooltip_title_words) {
$tooltip_title = '';
for ($i = 0; $i < $tooltip_title_words; $i++) {
$tooltip_title .= ' ' . $t_item_titles[$i];
}
$tooltip_title .= '...';
} else {
$tooltip_title = $t_item_title;
}
} else {
$tooltip_title = $t_item_title;
}
$tooltip_title = preg_replace("/(\r\n|\n|\r)/", " ", $tooltip_title);
//replace new line characters in tooltip title, important!
$tooltip_title = htmlspecialchars(html_entity_decode($tooltip_title), ENT_QUOTES);
//format text for tooltip
$slick_rss['items'][$slick_rss_item]['tooltip']['title'] = $tooltip_title;
//Tooltip Title
//tooltip item description
$text = trim($currItem->get_description());
if (!$tooltip_desc_images) {
$text = preg_replace("/<img[^>]+\\>/i", "", $text);
}
// tooltip desc word limit check
if ($tooltip_desc_words) {
$texts = explode(' ', $text);
$count = count($texts);
if ($count > $tooltip_desc_words) {
$text = '';
for ($i = 0; $i < $tooltip_desc_words; $i++) {
$text .= ' ' . $texts[$i];
}
$text .= '...';
}
}
$text = preg_replace("/(\r\n|\n|\r)/", " ", $text);
//replace new line characters in tooltip, important!
$text = htmlspecialchars(html_entity_decode($text), ENT_QUOTES);
//format text for tooltip
$slick_rss['items'][$slick_rss_item]['tooltip']['description'] = $text;
//Tooltip Body
} else {
$slick_rss['items'][$slick_rss_item]['tooltip'] = array();
//blank
}
$slick_rss_item++;
//increment item counter
}
}
//end item quantity check if statement
//return the feed data structure for the template
return $slick_rss;
}</pre>
</div>
</figure>
</div>
<div id="ezoic-pub-ad-placeholder-110">
</div>
<div class="example-item" id="0x7f180b277d986e215af7f5b4d0c8edde1ad2b7cfdc0ea893b861c4f3f42e5ace-68,,98,">
<div class="bs-example">
<div>
<div class="bs-example-title">Exemple #5</div>
<div style="position: absolute;right: 15px;top: 10px;" id="rating_5" data-hash="0x7f180b277d986e215af7f5b4d0c8edde1ad2b7cfdc0ea893b861c4f3f42e5ace" data-area="68,,98,">
<div class="rating-amount">0</div>
<a title="Noter cet exemple comme bon" href="javascript:app.addRating(1, '5')" class="rating-up btn btn-success"
data-id="rating_5"><i class="icon-button icon-thumbs-up"></i></a>
<a title="Noter cet exemple comme mauvais" href="javascript:app.addRating(-1,'5')" class="rating-down btn btn-danger"
data-id="rating_5"><i class="icon-button icon-thumbs-down"></i></a>
</div>
</div>
<div style="display:flex;align-items: center;flex-wrap: wrap">
<div style="display: inline-block;margin-right: 10px">
<a class="btn btn-default" title="Lien direct vers cet exemple"
href="https://hotexamples.com/fr/examples/-/SimplePie/get_image_title/php-simplepie-get_image_title-method-examples.html#0x7f180b277d986e215af7f5b4d0c8edde1ad2b7cfdc0ea893b861c4f3f42e5ace-68,,98,"><i class="icon-button icon-link"></i></a>
<a rel="nofollow" class="btn btn-default"
href="javascript:app.open('https://hotexamples.com/fr/site/file?hash=0x7f180b277d986e215af7f5b4d0c8edde1ad2b7cfdc0ea893b861c4f3f42e5ace&fullName=include%2Finc_front%2Fcnt22.article.inc.php&project=EDVLanger%2Fphpwcms')">Afficher le fichier</a>
</div>
<div class="example-project-info">
<nobr>
<span>Fichier :</span>
<a target="_blank" rel="nofollow" href="https://hotexamples.com/fr/site/redirect?url=https%3A%2F%2Fgithub.com%2FEDVLanger%2Fphpwcms%2Fblob%2Fmaster%2Finclude%2Finc_front%2Fcnt22.article.inc.php">cnt22.article.inc.php</a>
</nobr>
<nobr>
<span>Projet :</span>
<a target="_blank" rel="nofollow" href="https://hotexamples.com/fr/site/redirect?url=https%3A%2F%2Fgithub.com%2FEDVLanger%2Fphpwcms">EDVLanger/phpwcms</a>
</nobr>
</div>
</div>
</div>
<figure class="highlight">
<div class="example" data-id="5">
<pre class="line-numbers language-php" data-end="98" data-start="69"
data-highlight="84"> }
// Remove surrounding DIV
$rss_obj->remove_div(true);
// Strip all HTML Tags
$rss_obj->strip_htmltags(true);
// Limit items
if ($rssfeed["item"]) {
$rss_obj->set_item_limit($rssfeed["item"]);
}
// Init Feed
$rss_obj->init();
if ($rss_obj->data) {
// check RSS image
if ($rss_obj->get_image_url()) {
$rss['temp_feedinfo'] = '<a href="' . ($rss_obj->get_image_link() ? $rss_obj->get_image_link() : $rss_obj->get_permalink()) . '" target="_blank">';
$rss['temp_feedinfo'] .= '<img src="' . $rss_obj->get_image_url() . '" alt="' . $rss_obj->get_image_title() . '" />';
$rss['temp_feedinfo'] .= '</a>';
$rss['template_FEEDINFO'] = render_cnt_template($rss['template_FEEDINFO'], 'IMAGE', $rss['temp_feedinfo']);
} else {
$rss['template_FEEDINFO'] = render_cnt_template($rss['template_FEEDINFO'], 'IMAGE', '');
}
$rss['template_FEEDINFO'] = render_cnt_template($rss['template_FEEDINFO'], 'TITLE', $rss_obj->get_title());
$rss['template_FEEDINFO'] = render_cnt_template($rss['template_FEEDINFO'], 'DESCRIPTION', $rss_obj->get_description());
$c = 0;
$rss['items'] = array();
foreach ($rss_obj->get_items() as $rssvalue) {
// general item info
$rss['items'][$c] = render_cnt_template($rss['template_ITEM'], 'LINK', $rssvalue->get_permalink());
$rss['items'][$c] = render_cnt_template($rss['items'][$c], 'TITLE', $rssvalue->get_title());
$rss['items'][$c] = render_cnt_template($rss['items'][$c], 'DESCRIPTION', $rssvalue->get_description());
$rss['items'][$c] = render_cnt_template($rss['items'][$c], 'CONTENT', $rssvalue->get_content());</pre>
</div>
</figure>
</div>
<div id="ezoic-pub-ad-placeholder-111">
</div>
<div class="example-item" id="0x5621c0c652a468d0d91d3a250b21bc523f5004e6f8e875dc29f6638ca6282f1d-873,,1717,">
<div class="bs-example">
<div>
<div class="bs-example-title">Exemple #6</div>
<div style="position: absolute;right: 15px;top: 10px;" id="rating_6" data-hash="0x5621c0c652a468d0d91d3a250b21bc523f5004e6f8e875dc29f6638ca6282f1d" data-area="873,,1717,">
<div class="rating-amount">0</div>
<a title="Noter cet exemple comme bon" href="javascript:app.addRating(1, '6')" class="rating-up btn btn-success"
data-id="rating_6"><i class="icon-button icon-thumbs-up"></i></a>
<a title="Noter cet exemple comme mauvais" href="javascript:app.addRating(-1,'6')" class="rating-down btn btn-danger"
data-id="rating_6"><i class="icon-button icon-thumbs-down"></i></a>
</div>
</div>
<div style="display:flex;align-items: center;flex-wrap: wrap">
<div style="display: inline-block;margin-right: 10px">
<a class="btn btn-default" title="Lien direct vers cet exemple"
href="https://hotexamples.com/fr/examples/-/SimplePie/get_image_title/php-simplepie-get_image_title-method-examples.html#0x5621c0c652a468d0d91d3a250b21bc523f5004e6f8e875dc29f6638ca6282f1d-873,,1717,"><i class="icon-button icon-link"></i></a>
<a rel="nofollow" class="btn btn-default"
href="javascript:app.open('https://hotexamples.com/fr/site/file?hash=0x5621c0c652a468d0d91d3a250b21bc523f5004e6f8e875dc29f6638ca6282f1d&fullName=simplepie_wordpress_2.php&project=simplepie%2Fwordpress')">Afficher le fichier</a>
</div>
<div class="example-project-info">
<nobr>
<span>Fichier :</span>
<a target="_blank" rel="nofollow" href="https://hotexamples.com/fr/site/redirect?url=https%3A%2F%2Fgithub.com%2Fsimplepie%2Fwordpress%2Fblob%2Fmaster%2Fsimplepie_wordpress_2.php">simplepie_wordpress_2.php</a>
</nobr>
<nobr>
<span>Projet :</span>
<a target="_blank" rel="nofollow" href="https://hotexamples.com/fr/site/redirect?url=https%3A%2F%2Fgithub.com%2Fsimplepie%2Fwordpress">simplepie/wordpress</a>
</nobr>
</div>
</div>
</div>
<figure class="highlight">
<div class="example" data-id="6">
<pre class="line-numbers language-php" data-end="1717" data-start="874"
data-highlight="1068">/**
* The actual function that can be called on webpages.
*/
function SimplePieWP($feed_url, $options = null)
{
// Quit if the SimplePie class isn't loaded.
if (!class_exists('SimplePie')) {
die('<p style="font-size:16px; line-height:1.5em; background-color:#c00; color:#fff; padding:10px; border:3px solid #f00; text-align:left;"><img src="' . SIMPLEPIE_PLUGINDIR_WEB . '/images/error.png" /> There is a problem with the SimplePie Plugin for WordPress. Check your <a href="' . WP_CPANEL . '" style="color:#ff0; text-decoration:underline;">Installation Status</a> for more information.</p>');
}
if (isset($locale) && !empty($locale) && $locale != 'auto') {
setlocale(LC_TIME, $locale);
}
// Default general settings
$template = get_option('simplepie_template');
$items = get_option('simplepie_items');
$items_per_feed = get_option('simplepie_items_per_feed');
$date_format = get_option('simplepie_date_format');
$enable_cache = get_option('simplepie_enable_cache');
$set_cache_location = get_option('simplepie_set_cache_location');
$set_cache_duration = get_option('simplepie_set_cache_duration');
$enable_order_by_date = get_option('simplepie_enable_order_by_date');
$set_timeout = get_option('simplepie_set_timeout');
// Default text-shortening settings
$truncate_feed_title = get_option('simplepie_truncate_feed_title');
$truncate_feed_description = get_option('simplepie_truncate_feed_description');
$truncate_item_title = get_option('simplepie_truncate_item_title');
$truncate_item_description = get_option('simplepie_truncate_item_description');
// Default advanced settings
$processing = get_option('simplepie_processing');
$locale = get_option('simplepie_locale');
$local_date_format = get_option('simplepie_local_date_format');
$strip_htmltags = get_option('simplepie_strip_htmltags');
$strip_attributes = get_option('simplepie_strip_attributes');
$set_max_checked_feeds = get_option('simplepie_set_max_checked_feeds');
// Overridden settings
if ($options) {
// Fix the template location if one was passed in.
if (isset($options['template']) && !empty($options['template'])) {
$options['template'] = SIMPLEPIE_PLUGINDIR . '/templates/' . strtolower(str_replace(' ', '_', $options['template'])) . '.tmpl';
}
// Fix the processing location if one was passed in.
if (isset($options['processing']) && !empty($options['processing'])) {
$options['processing'] = SIMPLEPIE_PLUGINDIR . '/processing/' . strtolower(str_replace(' ', '_', $options['processing'])) . '.php';
}
extract($options);
}
// Load post-processing file.
if ($processing && $processing != '') {
include_once $processing;
}
// If template doesn't exist, die.
if (!file_exists($template) || !is_readable($template)) {
die('<p style="font-size:16px; line-height:1.5em; background-color:#c00; color:#fff; padding:10px; border:3px solid #f00; text-align:left;"><img src="' . SIMPLEPIE_PLUGINDIR_WEB . '/images/error.png" /> The SimplePie template file is not readable by WordPress. Check the <a href="' . WP_CPANEL . '" style="color:#ff0; text-decoration:underline;">WordPress Control Panel</a> for more information.</p>');
}
// Initialize SimplePie
$feed = new SimplePie();
$feed->set_feed_url($feed_url);
$feed->enable_cache($enable_cache);
$feed->set_item_limit($items_per_feed);
$feed->set_cache_location($set_cache_location);
$feed->set_cache_duration($set_cache_duration);
$feed->enable_order_by_date($enable_order_by_date);
$feed->set_timeout($set_timeout);
$feed->strip_htmltags(explode(' ', $strip_htmltags));
$feed->strip_attributes(explode(' ', $strip_attributes));
$feed->set_max_checked_feeds($set_max_checked_feeds);
$feed->init();
// Load up the selected template file
$handle = fopen($template, 'r');
$tmpl = fread($handle, filesize($template));
fclose($handle);
/**************************************************************************************************************/
// ERRORS
// I'm absolutely sure that there is a better way to do this.
// Define what we're looking for
$error_start_tag = '{IF_ERROR_BEGIN}';
$error_end_tag = '{IF_ERROR_END}';
$error_start_length = strlen($error_start_tag);
$error_end_length = strlen($error_end_tag);
// Find what we're looking for
$error_start_pos = strpos($tmpl, $error_start_tag);
$error_end_pos = strpos($tmpl, $error_end_tag);
$error_length_pos = $error_end_pos - $error_start_pos;
// Grab what we're looking for
$error_string = substr($tmpl, $error_start_pos + $error_start_length, $error_length_pos - $error_start_length);
$replacable_string = $error_start_tag . $error_string . $error_end_tag;
if ($error_message = $feed->error()) {
$tmpl = str_replace($replacable_string, $error_string, $tmpl);
$tmpl = str_replace('{ERROR_MESSAGE}', SimplePie_WordPress::post_process('ERROR_MESSAGE', $error_message), $tmpl);
} elseif ($feed->get_item_quantity() == 0) {
$tmpl = str_replace($replacable_string, $error_string, $tmpl);
$tmpl = str_replace('{ERROR_MESSAGE}', SimplePie_WordPress::post_process('ERROR_MESSAGE', 'There are no items in this feed.'), $tmpl);
} else {
$tmpl = str_replace($replacable_string, '', $tmpl);
}
/**************************************************************************************************************/
// FEED
// FEED_AUTHOR_EMAIL
if ($author = $feed->get_author()) {
if ($email = $author->get_email()) {
$tmpl = str_replace('{FEED_AUTHOR_EMAIL}', SimplePie_WordPress::post_process('FEED_AUTHOR_EMAIL', $email), $tmpl);
} else {
$tmpl = str_replace('{FEED_AUTHOR_EMAIL}', '', $tmpl);
}
} else {
$tmpl = str_replace('{FEED_AUTHOR_EMAIL}', '', $tmpl);
}
// FEED_AUTHOR_LINK
if ($author = $feed->get_author()) {
if ($link = $author->get_link()) {
$tmpl = str_replace('{FEED_AUTHOR_LINK}', SimplePie_WordPress::post_process('FEED_AUTHOR_LINK', $link), $tmpl);
} else {
$tmpl = str_replace('{FEED_AUTHOR_LINK}', '', $tmpl);
}
} else {
$tmpl = str_replace('{FEED_AUTHOR_LINK}', '', $tmpl);
}
// FEED_AUTHOR_NAME
if ($author = $feed->get_author()) {
if ($name = $author->get_name()) {
$tmpl = str_replace('{FEED_AUTHOR_NAME}', SimplePie_WordPress::post_process('FEED_AUTHOR_NAME', $name), $tmpl);
} else {
$tmpl = str_replace('{FEED_AUTHOR_NAME}', '', $tmpl);
}
} else {
$tmpl = str_replace('{FEED_AUTHOR_NAME}', '', $tmpl);
}
// FEED_CONTRIBUTOR_EMAIL
if ($contributor = $feed->get_contributor()) {
if ($email = $contributor->get_email()) {
$tmpl = str_replace('{FEED_CONTRIBUTOR_EMAIL}', SimplePie_WordPress::post_process('FEED_CONTRIBUTOR_EMAIL', $email), $tmpl);
} else {
$tmpl = str_replace('{FEED_CONTRIBUTOR_EMAIL}', '', $tmpl);
}
} else {
$tmpl = str_replace('{FEED_CONTRIBUTOR_EMAIL}', '', $tmpl);
}
// 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 {
$tmpl = str_replace('{FEED_IMAGE_URL}', '', $tmpl);
}
// FEED_IMAGE_WIDTH
if ($image_width = $feed->get_image_width()) {
$tmpl = str_replace('{FEED_IMAGE_WIDTH}', SimplePie_WordPress::post_process('FEED_IMAGE_WIDTH', $image_width), $tmpl);
} else {
$tmpl = str_replace('{FEED_IMAGE_WIDTH}', '', $tmpl);
}
// FEED_LANGUAGE
if ($language = $feed->get_language()) {
$tmpl = str_replace('{FEED_LANGUAGE}', SimplePie_WordPress::post_process('FEED_LANGUAGE', $language), $tmpl);
} else {
$tmpl = str_replace('{FEED_LANGUAGE}', '', $tmpl);
}
// FEED_LATITUDE
if ($latitude = $feed->get_latitude()) {
$tmpl = str_replace('{FEED_LATITUDE}', SimplePie_WordPress::post_process('FEED_LATITUDE', $latitude), $tmpl);
} else {
$tmpl = str_replace('{FEED_LATITUDE}', '', $tmpl);
}
// FEED_LONGITUDE
if ($longitude = $feed->get_longitude()) {
$tmpl = str_replace('{FEED_LONGITUDE}', SimplePie_WordPress::post_process('FEED_LONGITUDE', $longitude), $tmpl);
} else {
$tmpl = str_replace('{FEED_LONGITUDE}', '', $tmpl);
}
// FEED_PERMALINK
if ($permalink = $feed->get_permalink()) {
$tmpl = str_replace('{FEED_PERMALINK}', SimplePie_WordPress::post_process('FEED_PERMALINK', $permalink), $tmpl);
} else {
$tmpl = str_replace('{FEED_PERMALINK}', '', $tmpl);
}
// FEED_TITLE
if ($title = $feed->get_title()) {
$tmpl = str_replace('{FEED_TITLE}', SimplePie_WordPress::post_process('FEED_TITLE', $title), $tmpl);
} else {
$tmpl = str_replace('{FEED_TITLE}', '', $tmpl);
}
// SUBSCRIBE_URL
if ($subscribe_url = $feed->subscribe_url()) {
$tmpl = str_replace('{SUBSCRIBE_URL}', SimplePie_WordPress::post_process('SUBSCRIBE_URL', $subscribe_url), $tmpl);
} else {
$tmpl = str_replace('{SUBSCRIBE_URL}', '', $tmpl);
}
// TRUNCATE_FEED_DESCRIPTION
if ($description = $feed->get_description()) {
$tmpl = str_replace('{TRUNCATE_FEED_DESCRIPTION}', SimplePie_Truncate(SimplePie_WordPress::post_process('TRUNCATE_FEED_DESCRIPTION', $description), $truncate_feed_description), $tmpl);
} else {
$tmpl = str_replace('{TRUNCATE_FEED_DESCRIPTION}', '', $tmpl);
}
// TRUNCATE_FEED_TITLE
if ($title = $feed->get_title()) {
$tmpl = str_replace('{TRUNCATE_FEED_TITLE}', SimplePie_Truncate(SimplePie_WordPress::post_process('TRUNCATE_FEED_TITLE', $title), $truncate_feed_title), $tmpl);
} else {
$tmpl = str_replace('{TRUNCATE_FEED_TITLE}', '', $tmpl);
}
/**************************************************************************************************************/
// ITEMS
// Separate out the pre-item template
$tmpl = explode('{ITEM_LOOP_BEGIN}', $tmpl);
$pre_tmpl = $tmpl[0];
// Separate out the item template
$tmpl = explode('{ITEM_LOOP_END}', $tmpl[1]);
$item_tmpl = $tmpl[0];
// Separate out the post-item template
$post_tmpl = $tmpl[1];
// Clear out the variable
unset($tmpl);
// Start putting the output string together.
$tmpl = $pre_tmpl;
// Loop through all of the items that we're supposed to.
foreach ($feed->get_items(0, $items) as $item) {
// Get a reference to the parent $feed object.
$parent = $item->get_feed();
// Get a working copy of the item template. We don't want to edit the original.
$working_item = $item_tmpl;
// ITEM_CONTRIBUTOR_EMAIL
if ($contributor = $item->get_contributor()) {
if ($email = $contributor->get_email()) {
$working_item = str_replace('{ITEM_CONTRIBUTOR_EMAIL}', SimplePie_WordPress::post_process('ITEM_CONTRIBUTOR_EMAIL', $email), $working_item);
} else {
$working_item = str_replace('{ITEM_CONTRIBUTOR_EMAIL}', '', $working_item);
}
} else {
$working_item = str_replace('{ITEM_CONTRIBUTOR_EMAIL}', '', $working_item);
}
// ITEM_CONTRIBUTOR_LINK
if ($contributor = $item->get_contributor()) {
if ($link = $contributor->get_link()) {
$working_item = str_replace('{ITEM_CONTRIBUTOR_LINK}', SimplePie_WordPress::post_process('ITEM_CONTRIBUTOR_LINK', $link), $working_item);
} else {
$working_item = str_replace('{ITEM_CONTRIBUTOR_LINK}', '', $working_item);
}
} else {
$working_item = str_replace('{ITEM_CONTRIBUTOR_LINK}', '', $working_item);
}
// ITEM_CONTRIBUTOR_NAME
if ($contributor = $item->get_contributor()) {
if ($name = $contributor->get_name()) {
$working_item = str_replace('{ITEM_CONTRIBUTOR_NAME}', SimplePie_WordPress::post_process('ITEM_CONTRIBUTOR_NAME', $name), $working_item);
} else {
$working_item = str_replace('{ITEM_CONTRIBUTOR_NAME}', '', $working_item);
}
} else {
$working_item = str_replace('{ITEM_CONTRIBUTOR_NAME}', '', $working_item);
}
// ITEM_COPYRIGHT
if ($copyright = $item->get_copyright()) {
$working_item = str_replace('{ITEM_COPYRIGHT}', SimplePie_WordPress::post_process('ITEM_COPYRIGHT', $copyright), $working_item);
} else {
$working_item = str_replace('{ITEM_COPYRIGHT}', '', $working_item);
}
// ITEM_PARENT_AUTHOR_EMAIL
if ($author = $parent->get_author()) {
if ($email = $author->get_email()) {
$working_item = str_replace('{ITEM_PARENT_AUTHOR_EMAIL}', SimplePie_WordPress::post_process('ITEM_PARENT_AUTHOR_EMAIL', $email), $working_item);
} else {
$working_item = str_replace('{ITEM_PARENT_AUTHOR_EMAIL}', '', $working_item);
}
} else {
$working_item = str_replace('{ITEM_PARENT_AUTHOR_EMAIL}', '', $working_item);
}
// ITEM_PARENT_AUTHOR_LINK
if ($author = $parent->get_author()) {
if ($link = $author->get_link()) {
$working_item = str_replace('{ITEM_PARENT_AUTHOR_LINK}', SimplePie_WordPress::post_process('ITEM_PARENT_AUTHOR_LINK', $link), $working_item);
} else {
$working_item = str_replace('{ITEM_PARENT_AUTHOR_LINK}', '', $working_item);
}
} else {
$working_item = str_replace('{ITEM_PARENT_AUTHOR_LINK}', '', $working_item);
}
// ITEM_PARENT_AUTHOR_NAME
if ($author = $parent->get_author()) {
if ($name = $author->get_name()) {
$working_item = str_replace('{ITEM_PARENT_AUTHOR_NAME}', SimplePie_WordPress::post_process('ITEM_PARENT_AUTHOR_NAME', $name), $working_item);
} else {
$working_item = str_replace('{ITEM_PARENT_AUTHOR_NAME}', '', $working_item);
}
} else {
$working_item = str_replace('{ITEM_PARENT_AUTHOR_NAME}', '', $working_item);
}
// ITEM_PARENT_CONTRIBUTOR_EMAIL
if ($contributor = $parent->get_contributor()) {
if ($email = $contributor->get_email()) {
$working_item = str_replace('{ITEM_PARENT_CONTRIBUTOR_EMAIL}', SimplePie_WordPress::post_process('ITEM_PARENT_CONTRIBUTOR_EMAIL', $email), $working_item);
} else {
$working_item = str_replace('{ITEM_PARENT_CONTRIBUTOR_EMAIL}', '', $working_item);
}
} else {
$working_item = str_replace('{ITEM_PARENT_CONTRIBUTOR_EMAIL}', '', $working_item);
}
// ITEM_PARENT_CONTRIBUTOR_LINK
if ($contributor = $parent->get_contributor()) {
if ($link = $contributor->get_link()) {
$working_item = str_replace('{ITEM_PARENT_CONTRIBUTOR_LINK}', SimplePie_WordPress::post_process('ITEM_PARENT_CONTRIBUTOR_LINK', $link), $working_item);
} else {
$working_item = str_replace('{ITEM_PARENT_CONTRIBUTOR_LINK}', '', $working_item);
}
} else {
$working_item = str_replace('{ITEM_PARENT_CONTRIBUTOR_LINK}', '', $working_item);
}
// ITEM_PARENT_CONTRIBUTOR_NAME
if ($contributor = $parent->get_contributor()) {
if ($name = $contributor->get_name()) {
$working_item = str_replace('{ITEM_PARENT_CONTRIBUTOR_NAME}', SimplePie_WordPress::post_process('ITEM_PARENT_CONTRIBUTOR_NAME', $name), $working_item);
} else {
$working_item = str_replace('{ITEM_PARENT_CONTRIBUTOR_NAME}', '', $working_item);
}
} else {
$working_item = str_replace('{ITEM_PARENT_CONTRIBUTOR_NAME}', '', $working_item);
}
// ITEM_AUTHOR_EMAIL
if ($author = $item->get_author()) {
if ($email = $author->get_email()) {
$working_item = str_replace('{ITEM_AUTHOR_EMAIL}', SimplePie_WordPress::post_process('ITEM_AUTHOR_EMAIL', $email), $working_item);
} else {
$working_item = str_replace('{ITEM_AUTHOR_EMAIL}', '', $working_item);
}
} else {
$working_item = str_replace('{ITEM_AUTHOR_EMAIL}', '', $working_item);
}
// ITEM_AUTHOR_LINK
if ($author = $item->get_author()) {
if ($link = $author->get_link()) {
$working_item = str_replace('{ITEM_AUTHOR_LINK}', SimplePie_WordPress::post_process('ITEM_AUTHOR_LINK', $link), $working_item);
} else {
$working_item = str_replace('{ITEM_AUTHOR_LINK}', '', $working_item);
}
} else {
$working_item = str_replace('{ITEM_AUTHOR_LINK}', '', $working_item);
}
// ITEM_AUTHOR_NAME
if ($author = $item->get_author()) {
if ($name = $author->get_name()) {
$working_item = str_replace('{ITEM_AUTHOR_NAME}', SimplePie_WordPress::post_process('ITEM_AUTHOR_NAME', $name), $working_item);
} else {
$working_item = str_replace('{ITEM_AUTHOR_NAME}', '', $working_item);
}
} else {
$working_item = str_replace('{ITEM_AUTHOR_NAME}', '', $working_item);
}
// ITEM_CATEGORY
if ($category = $item->get_category()) {
if ($label = $category->get_label()) {
$working_item = str_replace('{ITEM_CATEGORY}', SimplePie_WordPress::post_process('ITEM_CATEGORY', $label), $working_item);
} else {
$working_item = str_replace('{ITEM_CATEGORY}', '', $working_item);
}
} else {
$working_item = str_replace('{ITEM_CATEGORY}', '', $working_item);
}
// ITEM_CONTENT
if ($content = $item->get_content()) {
$working_item = str_replace('{ITEM_CONTENT}', SimplePie_WordPress::post_process('ITEM_CONTENT', $content), $working_item);
} else {
$working_item = str_replace('{ITEM_CONTENT}', '', $working_item);
}
// ITEM_DATE
if ($date = $item->get_date($date_format)) {
$working_item = str_replace('{ITEM_DATE}', SimplePie_WordPress::post_process('ITEM_DATE', $date), $working_item);
} else {
$working_item = str_replace('{ITEM_DATE}', '', $working_item);
}
// ITEM_DATE_UTC
if ($date = $item->get_date('U')) {
$date = gmdate($date_format, $date);
$working_item = str_replace('{ITEM_DATE_UTC}', SimplePie_WordPress::post_process('ITEM_DATE_UTC', $date), $working_item);
} else {
$working_item = str_replace('{ITEM_DATE_UTC}', '', $working_item);
}
// ITEM_DESCRIPTION
if ($description = $item->get_description()) {
$working_item = str_replace('{ITEM_DESCRIPTION}', SimplePie_WordPress::post_process('ITEM_DESCRIPTION', $description), $working_item);
} else {
$working_item = str_replace('{ITEM_DESCRIPTION}', '', $working_item);
}
// ITEM_ENCLOSURE_EMBED
if ($enclosure = $item->get_enclosure()) {
if ($encltemp = $enclosure->native_embed()) {
$working_item = str_replace('{ITEM_ENCLOSURE_EMBED}', SimplePie_WordPress::post_process('ITEM_ENCLOSURE_EMBED', $encltemp), $working_item);
} else {
$working_item = str_replace('{ITEM_ENCLOSURE_EMBED}', '', $working_item);
}
} else {
$working_item = str_replace('{ITEM_ENCLOSURE_EMBED}', '', $working_item);
}
// ITEM_ENCLOSURE_EXTENSION
if ($enclosure = $item->get_enclosure()) {
if ($encltemp = $enclosure->get_extension()) {
$working_item = str_replace('{ITEM_ENCLOSURE_EXTENSION}', SimplePie_WordPress::post_process('ITEM_ENCLOSURE_EXTENSION', $encltemp), $working_item);
} else {
$working_item = str_replace('{ITEM_ENCLOSURE_EXTENSION}', '', $working_item);
}
} else {
$working_item = str_replace('{ITEM_ENCLOSURE_EXTENSION}', '', $working_item);
}
// ITEM_ENCLOSURE_HANDLER
if ($enclosure = $item->get_enclosure()) {
if ($encltemp = $enclosure->get_handler()) {
$working_item = str_replace('{ITEM_ENCLOSURE_HANDLER}', SimplePie_WordPress::post_process('ITEM_ENCLOSURE_HANDLER', $encltemp), $working_item);
} else {
$working_item = str_replace('{ITEM_ENCLOSURE_HANDLER}', '', $working_item);
}
} else {
$working_item = str_replace('{ITEM_ENCLOSURE_HANDLER}', '', $working_item);
}
// ITEM_ENCLOSURE_LENGTH
if ($enclosure = $item->get_enclosure()) {
if ($encltemp = $enclosure->get_length()) {
$working_item = str_replace('{ITEM_ENCLOSURE_LENGTH}', SimplePie_WordPress::post_process('ITEM_ENCLOSURE_LENGTH', $encltemp), $working_item);
} else {
$working_item = str_replace('{ITEM_ENCLOSURE_LENGTH}', '', $working_item);
}
} else {
$working_item = str_replace('{ITEM_ENCLOSURE_LENGTH}', '', $working_item);
}
// ITEM_ENCLOSURE_LINK
if ($enclosure = $item->get_enclosure()) {
if ($encltemp = $enclosure->get_link()) {
$working_item = str_replace('{ITEM_ENCLOSURE_LINK}', SimplePie_WordPress::post_process('ITEM_ENCLOSURE_LINK', $encltemp), $working_item);
} else {
$working_item = str_replace('{ITEM_ENCLOSURE_LINK}', '', $working_item);
}
} else {
$working_item = str_replace('{ITEM_ENCLOSURE_LINK}', '', $working_item);
}
// ITEM_ENCLOSURE_REAL_TYPE
if ($enclosure = $item->get_enclosure()) {
if ($encltemp = $enclosure->get_real_type()) {
$working_item = str_replace('{ITEM_ENCLOSURE_REAL_TYPE}', SimplePie_WordPress::post_process('ITEM_ENCLOSURE_REAL_TYPE', $encltemp), $working_item);
} else {
$working_item = str_replace('{ITEM_ENCLOSURE_REAL_TYPE}', '', $working_item);
}
} else {
$working_item = str_replace('{ITEM_ENCLOSURE_REAL_TYPE}', '', $working_item);
}
// ITEM_ENCLOSURE_SIZE
if ($enclosure = $item->get_enclosure()) {
if ($encltemp = $enclosure->get_size()) {
$working_item = str_replace('{ITEM_ENCLOSURE_SIZE}', SimplePie_WordPress::post_process('ITEM_ENCLOSURE_SIZE', $encltemp), $working_item);
} else {
$working_item = str_replace('{ITEM_ENCLOSURE_SIZE}', '', $working_item);
}
} else {
$working_item = str_replace('{ITEM_ENCLOSURE_SIZE}', '', $working_item);
}
// ITEM_ENCLOSURE_TYPE
if ($enclosure = $item->get_enclosure()) {
if ($encltemp = $enclosure->get_type()) {
$working_item = str_replace('{ITEM_ENCLOSURE_TYPE}', SimplePie_WordPress::post_process('ITEM_ENCLOSURE_TYPE', $encltemp), $working_item);
} else {
$working_item = str_replace('{ITEM_ENCLOSURE_TYPE}', '', $working_item);
}
} else {
$working_item = str_replace('{ITEM_ENCLOSURE_TYPE}', '', $working_item);
}
// ITEM_ENCLOSURE_BITRATE
if ($enclosure = $item->get_enclosure()) {
if ($encltemp = $enclosure->get_bitrate()) {
$working_item = str_replace('{ITEM_ENCLOSURE_BITRATE}', SimplePie_WordPress::post_process('ITEM_ENCLOSURE_BITRATE', $encltemp), $working_item);
} else {
$working_item = str_replace('{ITEM_ENCLOSURE_BITRATE}', '', $working_item);
}
} else {
$working_item = str_replace('{ITEM_ENCLOSURE_BITRATE}', '', $working_item);
}
// ITEM_ENCLOSURE_CHANNELS
if ($enclosure = $item->get_enclosure()) {
if ($encltemp = $enclosure->get_channels()) {
$working_item = str_replace('{ITEM_ENCLOSURE_CHANNELS}', SimplePie_WordPress::post_process('ITEM_ENCLOSURE_CHANNELS', $encltemp), $working_item);
} else {
$working_item = str_replace('{ITEM_ENCLOSURE_CHANNELS}', '', $working_item);
}
} else {
$working_item = str_replace('{ITEM_ENCLOSURE_CHANNELS}', '', $working_item);
}
// ITEM_ENCLOSURE_DESCRIPTION
if ($enclosure = $item->get_enclosure()) {
if ($encltemp = $enclosure->get_description()) {
$working_item = str_replace('{ITEM_ENCLOSURE_DESCRIPTION}', SimplePie_WordPress::post_process('ITEM_ENCLOSURE_DESCRIPTION', $encltemp), $working_item);
} else {
$working_item = str_replace('{ITEM_ENCLOSURE_DESCRIPTION}', '', $working_item);
}
} else {
$working_item = str_replace('{ITEM_ENCLOSURE_DESCRIPTION}', '', $working_item);
}
// ITEM_ENCLOSURE_DURATION
if ($enclosure = $item->get_enclosure()) {
if ($encltemp = $enclosure->get_duration()) {
$working_item = str_replace('{ITEM_ENCLOSURE_DURATION}', SimplePie_WordPress::post_process('ITEM_ENCLOSURE_DURATION', $encltemp), $working_item);
} else {
$working_item = str_replace('{ITEM_ENCLOSURE_DURATION}', '', $working_item);
}
} else {
$working_item = str_replace('{ITEM_ENCLOSURE_DURATION}', '', $working_item);
}
// ITEM_ENCLOSURE_EXPRESSION
if ($enclosure = $item->get_enclosure()) {
if ($encltemp = $enclosure->get_expression()) {
$working_item = str_replace('{ITEM_ENCLOSURE_EXPRESSION}', SimplePie_WordPress::post_process('ITEM_ENCLOSURE_EXPRESSION', $encltemp), $working_item);
} else {
$working_item = str_replace('{ITEM_ENCLOSURE_EXPRESSION}', '', $working_item);
}
} else {
$working_item = str_replace('{ITEM_ENCLOSURE_EXPRESSION}', '', $working_item);
}
// ITEM_ENCLOSURE_FRAMERATE
if ($enclosure = $item->get_enclosure()) {
if ($encltemp = $enclosure->get_framerate()) {
$working_item = str_replace('{ITEM_ENCLOSURE_FRAMERATE}', SimplePie_WordPress::post_process('ITEM_ENCLOSURE_FRAMERATE', $encltemp), $working_item);
} else {
$working_item = str_replace('{ITEM_ENCLOSURE_FRAMERATE}', '', $working_item);
}
} else {
$working_item = str_replace('{ITEM_ENCLOSURE_FRAMERATE}', '', $working_item);
}
// ITEM_ENCLOSURE_HASH
if ($enclosure = $item->get_enclosure()) {
if ($encltemp = $enclosure->get_hash()) {
$working_item = str_replace('{ITEM_ENCLOSURE_HASH}', SimplePie_WordPress::post_process('ITEM_ENCLOSURE_HASH', $encltemp), $working_item);
} else {
$working_item = str_replace('{ITEM_ENCLOSURE_HASH}', '', $working_item);
}
} else {
$working_item = str_replace('{ITEM_ENCLOSURE_HASH}', '', $working_item);
}
// ITEM_ENCLOSURE_HEIGHT
if ($enclosure = $item->get_enclosure()) {
if ($encltemp = $enclosure->get_height()) {
$working_item = str_replace('{ITEM_ENCLOSURE_HEIGHT}', SimplePie_WordPress::post_process('ITEM_ENCLOSURE_HEIGHT', $encltemp), $working_item);
} else {
$working_item = str_replace('{ITEM_ENCLOSURE_HEIGHT}', '', $working_item);
}
} else {
$working_item = str_replace('{ITEM_ENCLOSURE_HEIGHT}', '', $working_item);
}
// ITEM_ENCLOSURE_LANGUAGE
if ($enclosure = $item->get_enclosure()) {
if ($encltemp = $enclosure->get_language()) {
$working_item = str_replace('{ITEM_ENCLOSURE_LANGUAGE}', SimplePie_WordPress::post_process('ITEM_ENCLOSURE_LANGUAGE', $encltemp), $working_item);
} else {
$working_item = str_replace('{ITEM_ENCLOSURE_LANGUAGE}', '', $working_item);
}
} else {
$working_item = str_replace('{ITEM_ENCLOSURE_LANGUAGE}', '', $working_item);
}
// ITEM_ENCLOSURE_MEDIUM
if ($enclosure = $item->get_enclosure()) {
if ($encltemp = $enclosure->get_medium()) {
$working_item = str_replace('{ITEM_ENCLOSURE_MEDIUM}', SimplePie_WordPress::post_process('ITEM_ENCLOSURE_MEDIUM', $encltemp), $working_item);
} else {
$working_item = str_replace('{ITEM_ENCLOSURE_MEDIUM}', '', $working_item);
}
} else {
$working_item = str_replace('{ITEM_ENCLOSURE_MEDIUM}', '', $working_item);
}
// ITEM_ENCLOSURE_PLAYER
if ($enclosure = $item->get_enclosure()) {
if ($encltemp = $enclosure->get_player()) {
$working_item = str_replace('{ITEM_ENCLOSURE_PLAYER}', SimplePie_WordPress::post_process('ITEM_ENCLOSURE_PLAYER', $encltemp), $working_item);
} else {
$working_item = str_replace('{ITEM_ENCLOSURE_PLAYER}', '', $working_item);
}
} else {
$working_item = str_replace('{ITEM_ENCLOSURE_PLAYER}', '', $working_item);
}
// ITEM_ENCLOSURE_SAMPLINGRATE
if ($enclosure = $item->get_enclosure()) {
if ($encltemp = $enclosure->get_sampling_rate()) {
$working_item = str_replace('{ITEM_ENCLOSURE_SAMPLINGRATE}', SimplePie_WordPress::post_process('ITEM_ENCLOSURE_SAMPLINGRATE', $encltemp), $working_item);
} else {
$working_item = str_replace('{ITEM_ENCLOSURE_SAMPLINGRATE}', '', $working_item);
}
} else {
$working_item = str_replace('{ITEM_ENCLOSURE_SAMPLINGRATE}', '', $working_item);
}
// ITEM_ENCLOSURE_THUMBNAIL
if ($enclosure = $item->get_enclosure()) {
if ($encltemp = $enclosure->get_thumbnail()) {
$working_item = str_replace('{ITEM_ENCLOSURE_THUMBNAIL}', SimplePie_WordPress::post_process('ITEM_ENCLOSURE_THUMBNAIL', $encltemp), $working_item);
} else {
$working_item = str_replace('{ITEM_ENCLOSURE_THUMBNAIL}', '', $working_item);
}
} else {
$working_item = str_replace('{ITEM_ENCLOSURE_THUMBNAIL}', '', $working_item);
}
// ITEM_ENCLOSURE_TITLE
if ($enclosure = $item->get_enclosure()) {
if ($encltemp = $enclosure->get_title()) {
$working_item = str_replace('{ITEM_ENCLOSURE_TITLE}', SimplePie_WordPress::post_process('ITEM_ENCLOSURE_TITLE', $encltemp), $working_item);
} else {
$working_item = str_replace('{ITEM_ENCLOSURE_TITLE}', '', $working_item);
}
} else {
$working_item = str_replace('{ITEM_ENCLOSURE_TITLE}', '', $working_item);
}
// ITEM_ENCLOSURE_WIDTH
if ($enclosure = $item->get_enclosure()) {
if ($encltemp = $enclosure->get_width()) {
$working_item = str_replace('{ITEM_ENCLOSURE_WIDTH}', SimplePie_WordPress::post_process('ITEM_ENCLOSURE_WIDTH', $encltemp), $working_item);
} else {
$working_item = str_replace('{ITEM_ENCLOSURE_WIDTH}', '', $working_item);
}
} else {
$working_item = str_replace('{ITEM_ENCLOSURE_WIDTH}', '', $working_item);
}
// ITEM_ID
if ($id = $item->get_id()) {
$working_item = str_replace('{ITEM_ID}', SimplePie_WordPress::post_process('ITEM_ID', $id), $working_item);
} else {
$working_item = str_replace('{ITEM_ID}', '', $working_item);
}
// ITEM_ID
if ($latitude = $item->get_latitude()) {
$working_item = str_replace('{ITEM_LATITUDE}', SimplePie_WordPress::post_process('ITEM_LATITUDE', $latitude), $working_item);
} else {
$working_item = str_replace('{ITEM_LATITUDE}', '', $working_item);
}
// ITEM_LOCAL_DATE
if ($local_date = $item->get_local_date($local_date_format)) {
$working_item = str_replace('{ITEM_LOCAL_DATE}', SimplePie_WordPress::post_process('ITEM_LOCAL_DATE', $local_date), $working_item);
} else {
$working_item = str_replace('{ITEM_LOCAL_DATE}', '', $working_item);
}
// ITEM_LOCAL_DATE_UTC
if ($local_date = $item->get_date('U')) {
$local_date = gmdate('U', $local_date);
$local_date = strftime($local_date_format, $local_date);
$working_item = str_replace('{ITEM_LOCAL_DATE_UTC}', SimplePie_WordPress::post_process('ITEM_LOCAL_DATE_UTC', $local_date), $working_item);
} else {
$working_item = str_replace('{ITEM_LOCAL_DATE_UTC}', '', $working_item);
}
// ITEM_LONGITUDE
if ($longitude = $item->get_longitude()) {
$working_item = str_replace('{ITEM_LONGITUDE}', SimplePie_WordPress::post_process('ITEM_LONGITUDE', $longitude), $working_item);
} else {
$working_item = str_replace('{ITEM_LONGITUDE}', '', $working_item);
}
// ITEM_PERMALINK
if ($permalink = $item->get_permalink()) {
$working_item = str_replace('{ITEM_PERMALINK}', SimplePie_WordPress::post_process('ITEM_PERMALINK', $permalink), $working_item);
} else {
$working_item = str_replace('{ITEM_PERMALINK}', '', $working_item);
}
// ITEM_TITLE
if ($title = $item->get_title()) {
$working_item = str_replace('{ITEM_TITLE}', SimplePie_WordPress::post_process('ITEM_TITLE', $title), $working_item);
} else {
$working_item = str_replace('{ITEM_TITLE}', '', $working_item);
}
// ITEM_PARENT_COPYRIGHT
if ($copyright = $parent->get_copyright()) {
$working_item = str_replace('{ITEM_PARENT_COPYRIGHT}', SimplePie_WordPress::post_process('ITEM_PARENT_COPYRIGHT', $copyright), $working_item);
} else {
$working_item = str_replace('{ITEM_PARENT_COPYRIGHT}', '', $working_item);
}
// ITEM_PARENT_DESCRIPTION
if ($description = $parent->get_description()) {
$working_item = str_replace('{ITEM_PARENT_DESCRIPTION}', SimplePie_WordPress::post_process('ITEM_PARENT_DESCRIPTION', $description), $working_item);
} else {
$working_item = str_replace('{ITEM_PARENT_DESCRIPTION}', '', $working_item);
}
// ITEM_PARENT_ENCODING
if ($encoding = $parent->get_encoding()) {
$working_item = str_replace('{ITEM_PARENT_ENCODING}', SimplePie_WordPress::post_process('ITEM_PARENT_ENCODING', $encoding), $working_item);
} else {
$working_item = str_replace('{ITEM_PARENT_ENCODING}', '', $working_item);
}
// ITEM_PARENT_FAVICON
if ($favicon = $parent->get_favicon()) {
$working_item = str_replace('{ITEM_PARENT_FAVICON}', SimplePie_WordPress::post_process('ITEM_PARENT_FAVICON', $favicon), $working_item);
} else {
$working_item = str_replace('{ITEM_PARENT_FAVICON}', '', $working_item);
}
// ITEM_PARENT_IMAGE_HEIGHT
if ($image_height = $parent->get_image_height()) {
$working_item = str_replace('{ITEM_PARENT_IMAGE_HEIGHT}', SimplePie_WordPress::post_process('ITEM_PARENT_IMAGE_HEIGHT', $image_height), $working_item);
} else {
$working_item = str_replace('{ITEM_PARENT_IMAGE_HEIGHT}', '', $working_item);
}
// ITEM_PARENT_IMAGE_LINK
if ($image_link = $parent->get_image_link()) {
$working_item = str_replace('{ITEM_PARENT_IMAGE_LINK}', SimplePie_WordPress::post_process('ITEM_PARENT_IMAGE_LINK', $image_link), $working_item);
} else {
$working_item = str_replace('{ITEM_PARENT_IMAGE_LINK}', '', $working_item);
}
// ITEM_PARENT_IMAGE_TITLE
if ($image_title = $parent->get_image_title()) {
$working_item = str_replace('{ITEM_PARENT_IMAGE_TITLE}', SimplePie_WordPress::post_process('ITEM_PARENT_IMAGE_TITLE', $image_title), $working_item);
} else {
$working_item = str_replace('{ITEM_PARENT_IMAGE_TITLE}', '', $working_item);
}
// ITEM_PARENT_IMAGE_URL
if ($image_url = $parent->get_image_url()) {
$working_item = str_replace('{ITEM_PARENT_IMAGE_URL}', SimplePie_WordPress::post_process('ITEM_PARENT_IMAGE_URL', $image_url), $working_item);
} else {
$working_item = str_replace('{ITEM_PARENT_IMAGE_URL}', '', $working_item);
}
// ITEM_PARENT_IMAGE_WIDTH
if ($image_width = $parent->get_image_width()) {
$working_item = str_replace('{ITEM_PARENT_IMAGE_WIDTH}', SimplePie_WordPress::post_process('ITEM_PARENT_IMAGE_WIDTH', $image_width), $working_item);
} else {
$working_item = str_replace('{ITEM_PARENT_IMAGE_WIDTH}', '', $working_item);
}
// ITEM_PARENT_LANGUAGE
if ($language = $parent->get_language()) {
$working_item = str_replace('{ITEM_PARENT_LANGUAGE}', SimplePie_WordPress::post_process('ITEM_PARENT_LANGUAGE', $language), $working_item);
} else {
$working_item = str_replace('{ITEM_PARENT_LANGUAGE}', '', $working_item);
}
// ITEM_PARENT_LATITUDE
if ($latitude = $parent->get_latitude()) {
$working_item = str_replace('{ITEM_PARENT_LATITUDE}', SimplePie_WordPress::post_process('ITEM_PARENT_LATITUDE', $latitude), $working_item);
} else {
$working_item = str_replace('{ITEM_PARENT_LATITUDE}', '', $working_item);
}
// ITEM_PARENT_LONGITUDE
if ($longitude = $parent->get_longitude()) {
$working_item = str_replace('{ITEM_PARENT_LONGITUDE}', SimplePie_WordPress::post_process('ITEM_PARENT_LONGITUDE', $longitude), $working_item);
} else {
$working_item = str_replace('{ITEM_PARENT_LONGITUDE}', '', $working_item);
}
// ITEM_PARENT_PERMALINK
if ($permalink = $parent->get_permalink()) {
$working_item = str_replace('{ITEM_PARENT_PERMALINK}', SimplePie_WordPress::post_process('ITEM_PARENT_PERMALINK', $permalink), $working_item);
} else {
$working_item = str_replace('{ITEM_PARENT_PERMALINK}', '', $working_item);
}
// ITEM_PARENT_TITLE
if ($title = $parent->get_title()) {
$working_item = str_replace('{ITEM_PARENT_TITLE}', SimplePie_WordPress::post_process('ITEM_PARENT_TITLE', $title), $working_item);
} else {
$working_item = str_replace('{ITEM_PARENT_TITLE}', '', $working_item);
}
// ITEM_PARENT_SUBSCRIBE_URL
if ($subscribe_url = $parent->subscribe_url()) {
$working_item = str_replace('{ITEM_PARENT_SUBSCRIBE_URL}', SimplePie_WordPress::post_process('ITEM_PARENT_SUBSCRIBE_URL', $subscribe_url), $working_item);
} else {
$working_item = str_replace('{ITEM_PARENT_SUBSCRIBE_URL}', '', $working_item);
}
// TRUNCATE_ITEM_DESCRIPTION
if ($description = $item->get_description()) {
$working_item = str_replace('{TRUNCATE_ITEM_DESCRIPTION}', SimplePie_Truncate(SimplePie_WordPress::post_process('TRUNCATE_ITEM_DESCRIPTION', $description), $truncate_item_description), $working_item);
} else {
$working_item = str_replace('{TRUNCATE_ITEM_DESCRIPTION}', '', $working_item);
}
// TRUNCATE_ITEM_TITLE
if ($title = $item->get_title()) {
$working_item = str_replace('{TRUNCATE_ITEM_TITLE}', SimplePie_Truncate(SimplePie_WordPress::post_process('TRUNCATE_ITEM_TITLE', $title), $truncate_item_title), $working_item);
} else {
$working_item = str_replace('{TRUNCATE_ITEM_TITLE}', '', $working_item);
}
// TRUNCATE_ITEM_PARENT_DESCRIPTION
if ($description = $parent->get_description()) {
$working_item = str_replace('{TRUNCATE_ITEM_PARENT_DESCRIPTION}', SimplePie_Truncate(SimplePie_WordPress::post_process('TRUNCATE_ITEM_PARENT_DESCRIPTION', $description), $truncate_feed_description), $working_item);
} else {
$working_item = str_replace('{TRUNCATE_ITEM_PARENT_DESCRIPTION}', '', $working_item);
}
// TRUNCATE_ITEM_PARENT_TITLE
if ($title = $parent->get_title()) {
$working_item = str_replace('{TRUNCATE_ITEM_PARENT_TITLE}', SimplePie_Truncate(SimplePie_WordPress::post_process('TRUNCATE_ITEM_PARENT_TITLE', $title), $truncate_feed_title), $working_item);
} else {
$working_item = str_replace('{TRUNCATE_ITEM_PARENT_TITLE}', '', $working_item);
}
$tmpl .= $working_item;
}
/**************************************************************************************************************/
// LAST STUFF
// Start by removing all line breaks and tabs.
$tmpl = preg_replace('/(\\n|\\r|\\t)/i', "", $tmpl);
// PLUGIN_DIR
$tmpl = str_replace('{PLUGIN_DIR}', SIMPLEPIE_PLUGINDIR_WEB, $tmpl);
$tmpl .= $post_tmpl;
// Kill the object to prevent memory leaks.
$feed->__destruct();
unset($feed);
unset($encltemp);
unset($working_item);
// Return the data back to the page.
return $tmpl;
}</pre>
</div>
</figure>
</div>
<div class="example-item" id="0x435a97d371c361bdb3c3f5b4da97e29c64f3a3a38ee3bc7c3245487eea4922f9-81,,231,">
<div class="bs-example">
<div>
<div class="bs-example-title">Exemple #7</div>
<div style="position: absolute;right: 15px;top: 10px;" id="rating_7" data-hash="0x435a97d371c361bdb3c3f5b4da97e29c64f3a3a38ee3bc7c3245487eea4922f9" data-area="81,,231,">
<div class="rating-amount">0</div>
<a title="Noter cet exemple comme bon" href="javascript:app.addRating(1, '7')" class="rating-up btn btn-success"
data-id="rating_7"><i class="icon-button icon-thumbs-up"></i></a>
<a title="Noter cet exemple comme mauvais" href="javascript:app.addRating(-1,'7')" class="rating-down btn btn-danger"
data-id="rating_7"><i class="icon-button icon-thumbs-down"></i></a>
</div>
</div>
<div style="display:flex;align-items: center;flex-wrap: wrap">
<div style="display: inline-block;margin-right: 10px">
<a class="btn btn-default" title="Lien direct vers cet exemple"
href="https://hotexamples.com/fr/examples/-/SimplePie/get_image_title/php-simplepie-get_image_title-method-examples.html#0x435a97d371c361bdb3c3f5b4da97e29c64f3a3a38ee3bc7c3245487eea4922f9-81,,231,"><i class="icon-button icon-link"></i></a>
<a rel="nofollow" class="btn btn-default"
href="javascript:app.open('https://hotexamples.com/fr/site/file?hash=0x435a97d371c361bdb3c3f5b4da97e29c64f3a3a38ee3bc7c3245487eea4922f9&fullName=core%2Fcomponents%2Fspiefeed%2Fspiefeed.class.php&project=ncrossland%2Fspiefeed')">Afficher le fichier</a>
</div>
<div class="example-project-info">
<nobr>
<span>Fichier :</span>
<a target="_blank" rel="nofollow" href="https://hotexamples.com/fr/site/redirect?url=https%3A%2F%2Fgithub.com%2Fncrossland%2Fspiefeed%2Fblob%2Fmaster%2Fcore%2Fcomponents%2Fspiefeed%2Fspiefeed.class.php">spiefeed.class.php</a>
</nobr>
<nobr>
<span>Projet :</span>
<a target="_blank" rel="nofollow" href="https://hotexamples.com/fr/site/redirect?url=https%3A%2F%2Fgithub.com%2Fncrossland%2Fspiefeed">ncrossland/spiefeed</a>
</nobr>
</div>
</div>
</div>
<figure class="highlight">
<div class="example" data-id="7">
<pre class="line-numbers language-php" data-end="231" data-start="82"
data-highlight="172"> /**
* 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();
$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);
}</pre>
</div>
</figure>
</div>
<div class="example-item" id="0x2001a72c66b569cd26e5d4bd01728a933504fdfef6282bbb56ef78677feee178-20,,116,">
<div class="bs-example">
<div>
<div class="bs-example-title">Exemple #8</div>
<div style="position: absolute;right: 15px;top: 10px;" id="rating_8" data-hash="0x2001a72c66b569cd26e5d4bd01728a933504fdfef6282bbb56ef78677feee178" data-area="20,,116,">
<div class="rating-amount">0</div>
<a title="Noter cet exemple comme bon" href="javascript:app.addRating(1, '8')" class="rating-up btn btn-success"
data-id="rating_8"><i class="icon-button icon-thumbs-up"></i></a>
<a title="Noter cet exemple comme mauvais" href="javascript:app.addRating(-1,'8')" class="rating-down btn btn-danger"
data-id="rating_8"><i class="icon-button icon-thumbs-down"></i></a>
</div>
</div>
<div style="display:flex;align-items: center;flex-wrap: wrap">
<div style="display: inline-block;margin-right: 10px">
<a class="btn btn-default" title="Lien direct vers cet exemple"
href="https://hotexamples.com/fr/examples/-/SimplePie/get_image_title/php-simplepie-get_image_title-method-examples.html#0x2001a72c66b569cd26e5d4bd01728a933504fdfef6282bbb56ef78677feee178-20,,116,"><i class="icon-button icon-link"></i></a>
<a rel="nofollow" class="btn btn-default"
href="javascript:app.open('https://hotexamples.com/fr/site/file?hash=0x2001a72c66b569cd26e5d4bd01728a933504fdfef6282bbb56ef78677feee178&fullName=Rss.class.php&project=jorgefuertes%2FqPlanet')">Afficher le fichier</a>
</div>
<div class="example-project-info">
<nobr>
<span>Fichier :</span>
<a target="_blank" rel="nofollow" href="https://hotexamples.com/fr/site/redirect?url=https%3A%2F%2Fgithub.com%2Fjorgefuertes%2FqPlanet%2Fblob%2Fmaster%2FRss.class.php">Rss.class.php</a>
</nobr>
<nobr>
<span>Projet :</span>
<a target="_blank" rel="nofollow" href="https://hotexamples.com/fr/site/redirect?url=https%3A%2F%2Fgithub.com%2Fjorgefuertes%2FqPlanet">jorgefuertes/qPlanet</a>
</nobr>
</div>
</div>
</div>
<figure class="highlight">
<div class="example" data-id="8">
<pre class="line-numbers language-php" data-end="116" data-start="21"
data-highlight="106"> /**
*
* Get posts from feeds:
* @param array $feeds Array with the feeds.
* @return array Array with the posts.
*/
public function getPosts($feeds)
{
$posts = array();
foreach ($feeds as $name => $feed) {
Debug::info("Getting posts from " . $feed['url']);
$rss = new SimplePie($feed['url']);
$rss->handle_content_type();
$rss->force_feed(true);
$counter = 1;
foreach ($rss->get_items() as $item) {
Debug::info(" post {$counter} of " . MAXPOSTS . ".");
if (!is_object($item)) {
Debug::error("Parsing item (" . $item . ").");
} else {
if (strstr($item->get_title(), "[minipost]")) {
Debug::say("Minipost...passing.");
} else {
$counter++;
$timestamp = strtotime($item->get_date());
# Post:
$posts[$timestamp]['id'] = "p" . $timestamp . "-" . $counter;
$posts[$timestamp]['pubdate'] = $item->get_date('r');
$posts[$timestamp]['date'] = $item->get_local_date();
$posts[$timestamp]['time'] = $item->get_local_date("%T");
$posts[$timestamp]['permalink'] = $item->get_permalink();
$posts[$timestamp]['title'] = $item->get_title();
$posts[$timestamp]['description'] = $item->get_description();
$posts[$timestamp]['content'] = $item->get_content();
if ($posts[$timestamp]['description'] == $posts[$timestamp]['content'] and strlen($posts[$timestamp]['content']) < 400) {
$posts[$timestamp]['description'] = Html::Cut(Html::BurnerClean($item->get_description()));
$posts[$timestamp]['content'] = "";
$posts[$timestamp]['toggle'] = "";
} else {
$posts[$timestamp]['description'] = Html::Cut(Html::BurnerClean($item->get_description()));
$posts[$timestamp]['content'] = Html::Clean($item->get_content());
$posts[$timestamp]['toggle'] = "<a onclick='ToggleContent(\"" . $posts[$timestamp]['id'] . "\"); return false;' href=\"#\">⇓ Read more</a>";
}
// Microblogging posts have same description as title
if (FALSE !== strpos($posts[$timestamp]['title'], $posts[$timestamp]['description'])) {
$posts[$timestamp]['description'] = "";
$posts[$timestamp]['content'] = "";
$posts[$timestamp]['toggle'] = "";
}
# Rss:
$posts[$timestamp]['description_rss'] = $posts[$timestamp]['description'];
$posts[$timestamp]['content_rss'] = $posts[$timestamp]['content'];
# author:
if (method_exists($item, 'get_author') and is_object($item->get_author())) {
# The feed ones:
$posts[$timestamp]['author'] = $item->get_author()->get_name();
$posts[$timestamp]['author_link'] = $item->get_author()->get_link();
} else {
Debug::say("No author data feed " . $name);
$posts[$timestamp]['author'] = $name;
$posts[$timestamp]['author_link'] = $rss->get_permalink();
}
# Si han quedado vacíos pese a todo:
if (empty($posts[$timestamp]['author'])) {
$posts[$timestamp]['author'] = $name;
}
if (empty($posts[$timestamp]['author_link'])) {
$posts[$timestamp]['author_link'] = $feed['url'];
}
$posts[$timestamp]['author_email'] = $feed['email'];
# Gravatar:
if (strlen($feed['avatar'])) {
$posts[$timestamp]['author_avatar'] = "http://www.gravatar.com/avatar.php?gravatar_id=" . md5($feed['avatar']) . "&size=40&default=" . urlencode(DEFAULT_AVATAR);
} else {
if (strlen($feed['avatar_url'])) {
$posts[$timestamp]['author_avatar'] = $feed['avatar_url'];
}
}
# Blog:
$posts[$timestamp]['blog_title'] = $rss->get_title();
$posts[$timestamp]['blog_url'] = $rss->get_permalink();
$posts[$timestamp]['blog_desc'] = $rss->get_description();
# Logo:
$posts[$timestamp]['logo_url'] = $rss->get_image_url();
$posts[$timestamp]['logo_link'] = $rss->get_image_link();
$posts[$timestamp]['logo_title'] = $rss->get_image_title();
}
}
if ($counter > MAXPOSTS) {
break;
}
}
}
krsort($posts);
#Debug::dump($posts);
return $posts;
}</pre>
</div>
</figure>
</div>
<div class="example-item" id="0x0251200c72691375386d69757b8a1f33d0b2a078e41edab39e9330e3acdef03a-22,,227,">
<div class="bs-example">
<div>
<div class="bs-example-title">Exemple #9</div>
<div style="position: absolute;right: 15px;top: 10px;" id="rating_9" data-hash="0x0251200c72691375386d69757b8a1f33d0b2a078e41edab39e9330e3acdef03a" data-area="22,,227,">
<div class="rating-amount">0</div>
<a title="Noter cet exemple comme bon" href="javascript:app.addRating(1, '9')" class="rating-up btn btn-success"
data-id="rating_9"><i class="icon-button icon-thumbs-up"></i></a>
<a title="Noter cet exemple comme mauvais" href="javascript:app.addRating(-1,'9')" class="rating-down btn btn-danger"
data-id="rating_9"><i class="icon-button icon-thumbs-down"></i></a>
</div>
</div>
<div style="display:flex;align-items: center;flex-wrap: wrap">
<div style="display: inline-block;margin-right: 10px">
<a class="btn btn-default" title="Lien direct vers cet exemple"
href="https://hotexamples.com/fr/examples/-/SimplePie/get_image_title/php-simplepie-get_image_title-method-examples.html#0x0251200c72691375386d69757b8a1f33d0b2a078e41edab39e9330e3acdef03a-22,,227,"><i class="icon-button icon-link"></i></a>
<a rel="nofollow" class="btn btn-default"
href="javascript:app.open('https://hotexamples.com/fr/site/file?hash=0x0251200c72691375386d69757b8a1f33d0b2a078e41edab39e9330e3acdef03a&fullName=modules%2Fhelper.php&project=johngrange%2Fwookeyholeweb')">Afficher le fichier</a>
</div>
<div class="example-project-info">
<nobr>
<span>Fichier :</span>
<a target="_blank" rel="nofollow" href="https://hotexamples.com/fr/site/redirect?url=https%3A%2F%2Fgithub.com%2Fjohngrange%2Fwookeyholeweb%2Fblob%2Fmaster%2Fmodules%2Fhelper.php">helper.php</a>
</nobr>
<nobr>
<span>Projet :</span>
<a target="_blank" rel="nofollow" href="https://hotexamples.com/fr/site/redirect?url=https%3A%2F%2Fgithub.com%2Fjohngrange%2Fwookeyholeweb">johngrange/wookeyholeweb</a>
</nobr>
</div>
</div>
</div>
<figure class="highlight">
<div class="example" data-id="9">
<pre class="line-numbers language-php" data-end="227" data-start="23"
data-highlight="110"> /**
* getFeed
*
* @param array &$params The module options.
*
* @return void
*/
public static function getFeed(&$params)
{
// Global $mainframe;
// Init feed array
$light_rss = array();
// Get local module parameters from xml file module config settings
$rssurl = $params->get('rssurl', null);
$rssitems = $params->get('rssitems', 5);
$rssdesc = $params->get('rssdesc', 1);
$rssimage = $params->get('rssimage', 1);
$rssitemtitle_words = $params->get('rssitemtitle_words', 0);
$rssitemdesc = $params->get('rssitemdesc', 0);
$rssitemdesc_images = $params->get('rssitemdesc_images', 1);
$rssitemdesc_words = $params->get('rssitemdesc_words', 0);
$rsstitle = $params->get('rsstitle', 1);
$rsscache = $params->get('rsscache', 3600);
$link_target = $params->get('link_target', 1);
$no_follow = $params->get('no_follow', 0);
$enable_tooltip = $params->get('enable_tooltip', 'yes');
$tooltip_desc_words = $params->get('t_word_count_desc', 25);
$tooltip_desc_images = $params->get('tooltip_desc_images', 1);
$tooltip_title_words = $params->get('t_word_count_title', 25);
$add_dots = !EParameter::getComponentParam(CAUTOTWEETNG, 'donot_add_dots');
if (!$rssurl) {
$light_rss['error'][] = 'Invalid feed url. Please enter a valid url in the module settings.';
// Halt if no valid feed url supplied
return $light_rss;
}
switch ($link_target) {
// Open links in current or new window
case 1:
$link_target = '_blank';
break;
case 0:
$link_target = '_self';
break;
default:
$link_target = '_blank';
break;
}
$light_rss['target'] = $link_target;
if ($no_follow) {
$light_rss['nofollow'] = 'rel="nofollow"';
}
if (!class_exists('SimplePie')) {
// Include Simple Pie processor class
include_once JPATH_AUTOTWEET . '/libs/SimplePie_autoloader.php';
}
// Load and build the feed array
$feed = new SimplePie();
$use_sp_cache = EParameter::getComponentParam(CAUTOTWEETNG, 'use_sp_cache', true);
if ($use_sp_cache && is_writable(JPATH_CACHE)) {
$feed->set_cache_location(JPATH_CACHE);
$feed->enable_cache(true);
$cache_time = intval($rsscache);
$feed->set_cache_duration($cache_time);
} else {
$feed->enable_cache(false);
}
$feed->set_feed_url($rssurl);
// Process the loaded feed
$feed->init();
$feed->handle_content_type();
// Store any error message
if (isset($feed->error)) {
$light_rss['error'][] = $feed->error;
}
// Start building the feed meta-info (title, desc and image)
// Feed title
if ($feed->get_title() && $rsstitle) {
$light_rss['title']['link'] = $feed->get_link();
$light_rss['title']['title'] = $feed->get_title();
}
// Feed description
if ($rssdesc) {
$light_rss['description'] = $feed->get_description();
}
// Feed image
if ($rssimage && $feed->get_image_url()) {
$light_rss['image']['url'] = $feed->get_image_url();
$light_rss['image']['title'] = $feed->get_image_title();
}
// End feed meta-info
// Start processing feed items
// If there are items in the feed
if ($feed->get_item_quantity()) {
// Start looping through the feed items
$light_rss_item = 0;
// Item counter for array indexing in the loop
foreach ($feed->get_items(0, $rssitems) as $currItem) {
// Item title
$item_title = trim($currItem->get_title());
// Item title word limit check
if ($rssitemtitle_words) {
$item_titles = explode(' ', $item_title);
$count = count($item_titles);
if ($count > $rssitemtitle_words) {
$item_title = '';
for ($i = 0; $i < $rssitemtitle_words; $i++) {
$item_title .= ' ' . $item_titles[$i];
}
if ($add_dots) {
$item_title .= '...';
}
}
}
// Item Title
$light_rss['items'][$light_rss_item]['title'] = $item_title;
$light_rss['items'][$light_rss_item]['link'] = $currItem->get_permalink();
// Item description
if ($rssitemdesc) {
$desc = trim($currItem->get_description());
if (!$rssitemdesc_images) {
// Strip image tags
$desc = preg_replace("/<img[^>]+\\>/i", "", $desc);
}
// Item description word limit check
if ($rssitemdesc_words) {
$texts = explode(' ', $desc);
$count = count($texts);
if ($count > $rssitemdesc_words) {
$desc = '';
for ($i = 0; $i < $rssitemdesc_words; $i++) {
// Build words
$desc .= ' ' . $texts[$i];
}
if ($add_dots) {
$desc .= '...';
}
}
}
// Item Description
$light_rss['items'][$light_rss_item]['description'] = $desc;
}
// Tooltip text
if ($enable_tooltip == 'yes') {
// Tooltip item title
$t_item_title = trim($currItem->get_title());
// Tooltip title word limit check
if ($tooltip_title_words) {
$t_item_titles = explode(' ', $t_item_title);
$count = count($t_item_titles);
if ($count > $tooltip_title_words) {
$tooltip_title = '';
for ($i = 0; $i < $tooltip_title_words; $i++) {
$tooltip_title .= ' ' . $t_item_titles[$i];
}
if ($add_dots) {
$tooltip_title .= '...';
}
} else {
$tooltip_title = $t_item_title;
}
} else {
$tooltip_title = $t_item_title;
}
// Replace new line characters in tooltip title, important!
$tooltip_title = preg_replace("/(\r\n|\n|\r)/", " ", $tooltip_title);
// Format text for tooltip
$tooltip_title = htmlspecialchars(html_entity_decode($tooltip_title), ENT_QUOTES);
// Tooltip Title
$light_rss['items'][$light_rss_item]['tooltip']['title'] = $tooltip_title;
// Tooltip item description
$text = trim($currItem->get_description());
if (!$tooltip_desc_images) {
$text = preg_replace("/<img[^>]+\\>/i", "", $text);
}
// Tooltip desc word limit check
if ($tooltip_desc_words) {
$texts = explode(' ', $text);
$count = count($texts);
if ($count > $tooltip_desc_words) {
$text = '';
for ($i = 0; $i < $tooltip_desc_words; $i++) {
$text .= ' ' . $texts[$i];
}
if ($add_dots) {
$text .= '...';
}
}
}
// Replace new line characters in tooltip, important!
$text = preg_replace("/(\r\n|\n|\r)/", " ", $text);
// Format text for tooltip
$text = htmlspecialchars(html_entity_decode($text), ENT_QUOTES);
// Tooltip Body
$light_rss['items'][$light_rss_item]['tooltip']['description'] = $text;
} else {
// Blank
$light_rss['items'][$light_rss_item]['tooltip'] = array();
}
// Increment item counter
$light_rss_item++;
}
}
// End item quantity check if statement
// Return the feed data structure for the template
return $light_rss;
}</pre>
</div>
</figure>
</div>
<div id="all-examples"></div>
</div>
</div>
</div>
<div class="page-side-banner hidden-xs hidden-sm hidden-md" style="width:300px">
<div id="ezoic-pub-ad-placeholder-131">
<div class="fx" style="width:300px">
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- right-sidebar-fx -->
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-3697522372581514"
data-ad-slot="8968655429"
data-ad-format="auto"
data-full-width-responsive="true"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="container">
<div class="row">
<div class="col-md-12" style="text-align: center">
<a href="https://hotexamples.com/fr/site/trends?type=php%7Cf">Fonctions les mieux classées</a> |
<a href="https://hotexamples.com/fr/site/trends?type=php%7Cc">
Classes les mieux classées </a>
|
<a href="https://doc.hotexamples.com/fr/doc/map">Documentation</a>
| <a href="/site/privacy">Politique de confidentialité</a>
| <a href="https://cpp.hotexamples.com/direct-sales.html">Advertise with us</a>
</div>
</div>
<div class="row">
<div class="col-md-12" style="text-align: center">
<a
href="https://hotexamples.com/fr/">PHP</a>
| <a
href="https://csharp.hotexamples.com/fr/">C# (CSharp)</a>
| <a
href="https://java.hotexamples.com/fr/">Java</a>
| <a
href="https://golang.hotexamples.com/fr/">Golang</a>
| <a
href="https://cpp.hotexamples.com/fr/">C++ (Cpp)</a>
| <a
href="https://python.hotexamples.com/fr/">Python</a>
| <a
href="https://javascript.hotexamples.com/fr/">JavaScript</a>
| <a
href="https://typescript.hotexamples.com/fr/">TypeScript</a>
</div>
</div>
<div class="row">
<div class="col-md-12" style="text-align: center">
<a
href="https://hotexamples.com/examples/-/SimplePie/get_image_title/php-simplepie-get_image_title-method-examples.html">EN</a>
| <a
href="https://hotexamples.com/ru/examples/-/SimplePie/get_image_title/php-simplepie-get_image_title-method-examples.html">RU</a>
| <a
href="https://hotexamples.com/de/examples/-/SimplePie/get_image_title/php-simplepie-get_image_title-method-examples.html">DE</a>
| <a
href="https://hotexamples.com/fr/examples/-/SimplePie/get_image_title/php-simplepie-get_image_title-method-examples.html">FR</a>
| <a
href="https://hotexamples.com/es/examples/-/SimplePie/get_image_title/php-simplepie-get_image_title-method-examples.html">ES</a>
| <a
href="https://hotexamples.com/pt/examples/-/SimplePie/get_image_title/php-simplepie-get_image_title-method-examples.html">PT</a>
| <a
href="https://hotexamples.com/it/examples/-/SimplePie/get_image_title/php-simplepie-get_image_title-method-examples.html">IT</a>
| <a
href="https://hotexamples.com/jp/examples/-/SimplePie/get_image_title/php-simplepie-get_image_title-method-examples.html">JP</a>
| <a
href="https://hotexamples.com/zh/examples/-/SimplePie/get_image_title/php-simplepie-get_image_title-method-examples.html">ZH</a>
| <a
href="https://hotexamples.com/ko/examples/-/SimplePie/get_image_title/php-simplepie-get_image_title-method-examples.html">KO</a>
</div>
</div>
<div class="row">
<div class="col-md-10 col-md-offset-1">
</div>
<div class="col-md-1">
<!--LiveInternet counter-->
<script type="text/javascript"><!--
document.write("<a href='//www.liveinternet.ru/click' " +
"target=_blank><img src='//counter.yadro.ru/hit?t44.6;r" +
escape(document.referrer) + ((typeof (screen) == "undefined") ? "" :
";s" + screen.width + "*" + screen.height + "*" + (screen.colorDepth ?
screen.colorDepth : screen.pixelDepth)) + ";u" + escape(document.URL) +
";" + Math.random() +
"' alt='' title='LiveInternet' " +
"border='0' width='31' height='31'><\/a>");
//--></script><!--/LiveInternet-->
</div>
</div>
</div>
</footer>
<script src="//ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="/assets/30dd86a6f06b64184847037c52c63e07aa3c9a26.js"></script>
<script>jQuery(function ($) {
jQuery('#search-form').yiiActiveForm([{"id":"searchform-lang","name":"lang","container":".field-searchform-lang","input":"#searchform-lang","enableAjaxValidation":true},{"id":"searchform-search","name":"search","container":".field-searchform-search","input":"#searchform-search","enableAjaxValidation":true,"validate":function (attribute, value, messages, deferred, $form) {yii.validation.required(value, messages, {"message":"Search ne peut être vide."});}}], []);
});</script></body>
</html>