本文整理汇总了PHP中SimplePie::get_base方法的典型用法代码示例。如果您正苦于以下问题:PHP SimplePie::get_base方法的具体用法?PHP SimplePie::get_base怎么用?PHP SimplePie::get_base使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimplePie
的用法示例。
在下文中一共展示了SimplePie::get_base方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: discover_favicon
/**
* Find the feed's icon
*
* @param SimplePie $feed SimplePie object to retrieve logo for
* @return string URL to feed icon
*/
protected static function discover_favicon($feed, $id)
{
if ($return = $feed->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'icon')) {
$favicon = SimplePie_Misc::absolutize_url($return[0]['data'], $feed->get_base($return[0]));
} elseif (($url = $feed->get_link()) !== null && preg_match('/^http(s)?:\\/\\//i', $url)) {
$filename = $id . '.ico';
$favicon = SimplePie_Misc::absolutize_url('/favicon.ico', $url);
} else {
return false;
}
$cache = new DataHandler(get_option('cachedir'));
$request = new HTTPRequest();
$file = $request->get($favicon, array('X-Forwarded-For' => $_SERVER['REMOTE_ADDR']));
if ($file->success && strlen($file->body) > 0) {
$sniffer = new $feed->content_type_sniffer_class($file);
if (substr($sniffer->get_type(), 0, 6) === 'image/') {
$body = array('type' => $sniffer->get_type(), 'body' => $file->body);
return $cache->save($filename, serialize($body));
} else {
return false;
}
}
return false;
}
示例2: get_base
/**
* Get the base URL value from the parent feed
*
* Uses `<xml:base>`
*
* @param array $element
* @return string
*/
public function get_base($element = array())
{
return $this->feed->get_base($element);
}
示例3: foreach
<title><?php
echo $feed->get_title();
?>
</title>
<?php
$protocol = 'http';
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
$protocol = 'https';
}
?>
<link href="<?php
echo $protocol . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
?>
" rel="self"/>
<link href="<?php
echo $feed->get_base();
?>
" />
<id><?php
echo $feed->get_permalink();
?>
</id>
<?php
if ($feed->get_authors()) {
?>
<?php
foreach ($feed->get_authors() as $author) {
?>
<author>
<?php
if ($author->get_name()) {