Note: this may not work as you think for multifeeds!
public get_feed ( ) : SimplePie | ||
Résultat | SimplePie |
public function getFavIcon(SimplePie_Item $item) { $shortname = ''; $categories = $item->get_categories(); foreach ($categories as $category) { $matches = array(); $matched = preg_match('/short=([a-z-]+)/', $category->get_term(), $matches); if ($matched === 1) { $shortname = $matches[1]; break; } } if (array_key_exists($shortname, self::$map)) { $favIcon = self::$map[$shortname]; } else { $favIcon = $item->get_feed()->get_favicon(); } return $favIcon; }
/** * Pieces together the title attribute without using inline ternary conditional statements * * @access public * @param SimplePie_Item $item The item to generate the title attribute for. * @param integer $length The number of characters to return in the description. * @param string $date_format The format to use when displaying dates on items. Uses values from http://php.net/strftime, NOT http://php.net/date. * @return string The string for the title attribute. */ function get_title_attr($item, $length, $date_format) { // Get a handle for the item's parent feed object for PHP 4.x. $parent = $item->get_feed(); $title_attr = ''; $title_attr .= $item->get_title(); // The title of the post $title_attr .= ' :: '; // The separator between the title and the description (required by MooTools) $title_attr .= newsblocks::cleanup($item->get_description(), $length); // The cleaned-up and shortened version of the description $title_attr .= '<span>'; // This marks the beginning of the date/domain line (and is CSS styleable) // Does the item have a timestamp? if ($item->get_local_date($date_format)) { $title_attr .= $item->get_local_date($date_format); // Use the locale-friendly version for non-English languages. $title_attr .= ' // '; // Visual separator. } $title_attr .= newsblocks::name($parent->subscribe_url()); // The domain name that the item is coming from. $title_attr .= '</span>'; // Mark the end of the date/domain line. return $title_attr; }