本文整理汇总了PHP中SimplePie::get_copyright方法的典型用法代码示例。如果您正苦于以下问题:PHP SimplePie::get_copyright方法的具体用法?PHP SimplePie::get_copyright怎么用?PHP SimplePie::get_copyright使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimplePie
的用法示例。
在下文中一共展示了SimplePie::get_copyright方法的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');
}
// 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: data
/**
* Handles all of the heavy lifting for getting the feed, parsing it, and managing customizations.
*
* @access private
* @param mixed $url Either a single feed URL (as a string) or an array of feed URLs (as an array of strings).
* @param array $options An associative array of options that the function should take into account when rendering the markup.
* <ul>
* <li>string $classname - The classname that the <div> surrounding the feed should have. Defaults to nb-list for newsblocks::listing() and nb-wide for newsblocks::wide().</li>
* <li>string $copyright - The copyright string to use for a feed. Not part of the standard output, but it's available if you want to use it. Defaults to NULL with multifeeds; Use $item->get_feed()->get_copyright() instead.</li>
* <li>string $date_format - The format to use when displaying dates on items. Uses values from http://php.net/strftime, NOT http://php.net/date.</li>
* <li>string $description - The description for the feed (not the item). Not part of the standard output, but it's available if you want to use it. Defaults to NULL with multifeeds; Use $item->get_feed()->get_description() instead.</li>
* <li>string $direction - The direction of the text. Valid values are "ltr" and "rtl". Defaults to "ltr".</li>
* <li>string $favicon - The favicon URL to use for the feed. Since favicon URLs aren't actually located in feeds, SimplePie guesses. Sometimes that guess is wrong. Give it the correct favicon with this option. Defaults to NULL with multifeeds; Use $item->get_feed()->get_favicon() instead.</li>
* <li>string $id - The ID attribute that the <div> surrounding the feed should have. This value should be unique per feed. Defaults to a SHA1 hash value based on the URL(s).</li>
* <li>string $item_classname - The classname for the items. Useful for styling with CSS. Also useful for JavaScript in creating custom tooltips for a feed. Defaults to "tips".</li>
* <li>integer $items - The number of items to show (the rest are hidden until "More" is clicked). Defaults to 10.</li>
* <li>string $language - The language of the feed. Not part of the standard output, but it's available if you want to use it. Defaults to NULL with multifeeds; Use $item->get_feed()->get_language() instead.</li>
* <li>integer $length - The maximum character length of the item description in the tooltip. Defaults to 200.</li>
* <li>string $more - The text to use for the "More" link. Defaults to "More »"</li>
* <li>boolean $more_move - Whether the "More" link should move when it's clicked. Defaults to FALSE (i.e. stays in the same place).</li>
* <li>boolean $more_fx - Whether the secondary list should slide or simply appear/disappear when the "More" link is clicked. Defaults to TRUE (i.e. slides).</li>
* <li>string $permalink - The permalink for the feed (not the item). Defaults to NULL with multifeeds; Use $item->get_feed()->get_permalink() instead.</li>
* <li>boolean $show_title - Whether to show the title of the feed. Defaults to TRUE.</li>
* <li>integer $since - A Unix timestamp. Anything posted more recently than this timestamp will get the "New" image applied to it. Defaults to 24 hours ago.</li>
* <li>$string $title - The title for the feed (not the item). Defaults to multiple titles with multifeeds, so you should manually set it in that case.</li>
* </ul>
* @return string The (X)HTML markup to display on the page.
*/
function data($url, $options = null)
{
// Create a new SimplePie instance with this feed
$feed = new SimplePie();
$feed->set_feed_url($url);
$feed->init();
// Prep URL values to hash later.
if (!is_array($url)) {
$hash_str = array($url);
} else {
$hash_str = $url;
}
// Set the default values.
$classname = null;
$copyright = $feed->get_copyright();
$date_format = '%a, %e %b %Y, %I:%M %p';
$description = $feed->get_description();
$direction = 'ltr';
$favicon = $feed->get_favicon();
$id = 'a' . sha1(implode('', $hash_str));
$item_classname = 'tips';
$items = 10;
$language = $feed->get_language();
$length = 200;
$more = 'More »';
$more_move = false;
$more_fx = true;
$permalink = $feed->get_permalink();
$show_title = true;
$since = time() - 24 * 60 * 60;
// 24 hours ago.
$title = $feed->get_title();
// Override defaults with passed-in values.
extract($options);
// Set values for those that are still null
if (!$favicon) {
$favicon = NB_FAVICON_DEFAULT;
}
if (!$title) {
if (is_array($url)) {
$feed_title = array();
foreach ($url as $u) {
$feed_title[] = newsblocks::name($u);
}
$title = implode(', ', $feed_title);
}
}
// Send the data back to the calling function.
return array('classname' => $classname, 'copyright' => $copyright, 'date_format' => $date_format, 'description' => $description, 'direction' => $direction, 'favicon' => $favicon, 'feed' => $feed, 'id' => $id, 'item_classname' => $item_classname, 'items' => $items, 'language' => $language, 'length' => $length, 'more' => $more, 'more_move' => $more_move, 'more_fx' => $more_fx, 'permalink' => $permalink, 'show_title' => $show_title, 'since' => $since, 'title' => $title);
}
示例3: SimplePieWP
//.........这里部分代码省略.........
$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 {
示例4: foreach
<?php
}
}
if ($feed->get_categories()) {
?>
<?php
foreach ($feed->get_categories() as $category) {
?>
<category term="<?php
echo $category;
?>
"/>
<?php
}
}
if ($feed->get_copyright()) {
?>
<rights><?php
echo $feed->get_copyright();
?>
</rights>
<?php
}
if ($feed->get_image_url()) {
?>
<logo><?php
echo $feed->get_image_url();
?>
</logo>
<?php
}