SimplePie::get_favicon PHP Method

get_favicon() public method

Get the favicon for the current feed
Deprecation: Use your own favicon handling instead
public get_favicon ( )
    public function get_favicon()
    {
        $level = defined('E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_WARNING;
        trigger_error('Favicon handling has been removed, please use your own handling', $level);
        if (($url = $this->get_link()) !== null) {
            return 'http://g.etfv.co/' . urlencode($url);
        }
        return false;
    }

Usage Example

Example #1
0
 /**
  * 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 &raquo;"</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 &raquo;';
     $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);
 }
All Usage Examples Of SimplePie::get_favicon