get_base() public méthode

Uses if available, otherwise uses the first link in the feed, or failing that, the URL of the feed itself.
See also: get_link
See also: subscribe_url
public get_base ( array $element = [] ) : string
$element array
Résultat string
 /**
  * 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;
 }
Exemple #2
0
 /**
  * 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);
 }
Exemple #3
0
<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()) {