本文整理汇总了PHP中SimplePie::get_image_height方法的典型用法代码示例。如果您正苦于以下问题:PHP SimplePie::get_image_height方法的具体用法?PHP SimplePie::get_image_height怎么用?PHP SimplePie::get_image_height使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimplePie
的用法示例。
在下文中一共展示了SimplePie::get_image_height方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: compile
/**
* 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);
}
示例2: Folder
function feed_paginate($feed_url, $start = 0, $limit = 5)
{
//make the cache dir if it doesn't exist
if (!file_exists($this->cache)) {
$folder = new Folder($this->cache, true);
}
//include the vendor class
App::import('Vendor', 'simplepie/simplepie');
//setup SimplePie
$feed = new SimplePie();
$feed->set_feed_url($feed_url);
$feed->set_cache_location($this->cache);
//retrieve the feed
$feed->init();
//limits
$max = $start + $limit;
$items['title'] = $feed->get_title();
$items['image_url'] = $feed->get_image_url();
$items['image_height'] = $feed->get_image_height();
$items['image_width'] = $feed->get_image_width();
//$items['title'] = $feed->get_title();
//get the feed items
$items['quantity'] = $feed->get_item_quantity();
if ($items['quantity'] < $start) {
$items['items'] = false;
return $items;
} elseif ($items['quantity'] < $max) {
$max = $items['quantity'];
}
for ($i = $start; $i < $max; $i++) {
$items['items'][] = $feed->get_item($i);
}
//return
if ($items) {
return $items;
} else {
return false;
}
}
示例3: SimplePieWP
//.........这里部分代码省略.........
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 {
示例4: _setSimplePieModxPlaceholders
/**
* Processing the parameters into placeholders
* @param string $spie snippet parameters
* @return array placeholders
*/
private function _setSimplePieModxPlaceholders($spie) {
/**
* @link http://github.com/simplepie/simplepie/tree/one-dot-two
*/
if (!file_exists($spie['simplePieClassFile'])) {
return 'File ' . $spie['simplePieClassFile'] . ' does not exist.';
}
include_once $spie['simplePieClassFile'];
$feed = new SimplePie();
$joinKey = 0;
foreach ($spie['setFeedUrl'] as $setFeedUrl) {
$feed->set_cache_location($spie['setCacheLocation']);
$feed->set_feed_url($setFeedUrl);
if (isset($spie['setInputEncoding'])) {
$feed->set_input_encoding($spie['setInputEncoding']);
}
if (isset($spie['setOutputEncoding'])) {
$feed->set_output_encoding($spie['setOutputEncoding']);
}
// if no cURL, try fsockopen
if (isset($spie['forceFSockopen'])) {
$feed->force_fsockopen(true);
}
if (isset($spie['enableCache']))
$feed->enable_cache($spie['enableCache']);
if (isset($spie['enableOrderByDate']))
$feed->enable_order_by_date($spie['enableOrderByDate']);
if (isset($spie['setCacheDuration']))
$feed->set_cache_duration($spie['setCacheDuration']);
if (!empty($spie['setFaviconHandler']))
$feed->set_favicon_handler($spie['setFaviconHandler'][0], $spie['setFaviconHandler'][1]);
if (!empty($spie['setImageHandler'])) {
// handler_image.php?image=67d5fa9a87bad230fb03ea68b9f71090
$feed->set_image_handler($spie['setImageHandler'][0], $spie['setImageHandler'][1]);
}
// disabled since these are all splitted into a single fetching
// it's been used with different way, see below looping
// if (isset($spie['setItemLimit']))
// $feed->set_item_limit((int) $spie['setItemLimit']);
if (isset($spie['setJavascript']))
$feed->set_javascript($spie['setJavascript']);
if (isset($spie['stripAttributes']))
$feed->strip_attributes(array_merge($feed->strip_attributes, $spie['stripAttributes']));
if (isset($spie['stripComments']))
$feed->strip_comments($spie['stripComments']);
if (isset($spie['stripHtmlTags']))
$feed->strip_htmltags(array_merge($feed->strip_htmltags, $spie['stripHtmlTags']));
/**
* Initiating the Feeding.
* This always be placed AFTER all the settings above.
*/
if (!$feed->init()) {
echo $feed->error();
return FALSE;
}
$countItems = count($feed->get_items());
if (1 > $countItems) {
continue;
}
$feed->handle_content_type();
$countLimit = 0;
foreach ($feed->get_items($getItemStart, $getItemEnd) as $item) {
if (isset($spie['setItemLimit']) && $spie['setItemLimit'] == $countLimit)
continue;
$phArray[$joinKey]['favicon'] = $feed->get_favicon();
$phArray[$joinKey]['link'] = $item->get_link();
$phArray[$joinKey]['title'] = $item->get_title();
$phArray[$joinKey]['description'] = $item->get_description();
$phArray[$joinKey]['content'] = $item->get_content();
$phArray[$joinKey]['permalink'] = $item->get_permalink();
$parsedUrl = parse_url($phArray[$joinKey]['permalink']);
$implodedParsedUrl = $parsedUrl['scheme'] . '://' . $parsedUrl['host'];
$imageLink = $feed->get_image_link() != '' ? $feed->get_image_link() : $implodedParsedUrl;
$phArray[$joinKey]['imageLink'] = $imageLink;
$phArray[$joinKey]['imageTitle'] = $feed->get_image_title();
$phArray[$joinKey]['imageUrl'] = $feed->get_image_url();
$phArray[$joinKey]['imageWidth'] = $feed->get_image_width();
$phArray[$joinKey]['imageHeight'] = $feed->get_image_height();
$phArray[$joinKey]['date'] = $item->get_date($spie['dateFormat']);
$phArray[$joinKey]['localDate'] = $item->get_local_date($spie['localDateFormat']);
$phArray[$joinKey]['copyright'] = $item->get_copyright();
$phArray[$joinKey]['latitude'] = $feed->get_latitude();
//.........这里部分代码省略.........