SimplePie 1.5 is now available!

SimplePie Documentation.  Learn how to use this thing.  It's way better than going to school.

You are here: Documentation

Search

You can find the results of your search below. If you didn't find what you were looking for, you can create or edit the page named after your query with the appropriate button.

Results


SimplePie 1.0 "Razzleberry": 120 Hits
ace. (RC1) * Added the following constants: ''[[reference:SimplePie:SIMPLEPIE_BUILD]]'', ''[[reference:SimplePie:SIMPLEPIE_LINKBACK]]'', ''[[reference:SimplePie:SIMPLEPIE_NAME]]'', ''[[reference:SimplePie:SIMPLEPIE_URL]]'', ''[[reference:SimplePie:SIMPLEPIE_USERAGENT]]'', and ''[[reference:SimplePie:SIMPLEPIE_VERSION]]''. (RC1) * Added ''[[reference:SimplePie:set_favicon_handler]]'' to enable the caching and dis
set_item_class(): 43 Hits
====== set_item_class() ====== ===== Description ===== <code>class SimplePie { set_item_class ( [string $class = 'SimplePie_Item'] ) }</code> Allows you to add new methods or replace existing methods in the [[reference:SimplePie_Item:start]] class. Learn more about extending classes in PHP: * **PHP 4:** http://php.net/manual/en/keyword.extends.php * **PHP 5:** http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends ===== Availability ===== * Available since SimplePie Beta 3. ===== Parameters ===== ==== class ==== The new class for SimplePie to use. ===== Examples ===== ==== Replace a method and add a method ==== <code php><?php require_once('../simplepie.inc'); // Create a new class that extends an existing class class SimplePie_Item_Extras extends SimplePie_Item { /** This is an example of adding a new method to an existing class. */ // Retrieve the <gd:when startTime="" /> value. function get_gcal_starttime($format = false) { // We want to grab the Google-namespaced <gd:when> tag. // http://simplepie.org/wiki/tutorial/grab_custom_tags_or_attributes $when = $this->get_item_tags('http://schemas.google.com/g/2005', 'when'); // Once we grab the tag, let's grab the startTime attribute $date = $when[0]['attribs']['']['startTime']; if ($format) { // Let's pass it through strtotime() and then format it with date(). This will be the date we display. return date($format, strtotime($date)); } else { // Otherwise we'll return it as-is with no modifications. return $date; } } /** This is an example of modifying an existing method of an existing class. */ function get_id() { return $this->__toString(); } } // Let's do our standard SimplePie thing. $feed = new SimplePie(); $feed->set_feed_url('http://www.google.com/calendar/feeds/eventi%40emmealcubo.com/public/full'); $feed->set_item_class('SimplePie_Item_Extras'); $feed->init(); $feed->handle_content_type(); ?> <html> <body> <?php foreach ($feed->get_items(0,5) as $item): ?> <h4><a href="<?php echo $item->get_permalink()?>"><?php echo $item->get_title()?></a></h4> <p><small><?php echo $item->get_date('j F Y, g:i a')?></small></p> <p><?php echo $item->get_description()?></p> <p>Starts on <?php echo $item->get_gcal_starttime('j F Y')?></p> <p>GUID: <?php echo $item->get_id()?></p> <hr /> <?php endforeach; ?> </body> </html></code> ===== See Also ===== * [[reference:SimplePie:start]] * [[reference:SimplePie_Item:start]]
embed(): 34 Hits
rue )); } }</code> ===== See Also ===== * [[reference:SimplePie:start]] * [[reference:SimplePie_Item:start]] * [[reference:SimplePie_Enclosure:start]] * [[reference:SimplePie_Enclosure:native_embed]]
native_embed(): 33 Hits
====== native_embed() ====== ===== Description ===== <code>class SimplePie_Enclosure { native_embed ( [(array) $options] ) }</code> Embeds the enclosure into the webpage using the HTML ''<embed>'' tag. This will use ''[[reference:SimplePie_Enclosure:get_real_type]]'' to determine which handler should be used to embed the content into the page. SimplePie supports QuickTime, Windows Media, Flash, Flash Media, and the Odeo Player for Odeo feeds. Because of the fallout from the [[http://en.wikipedia.org/wiki/Eolas|Eolas lawsuit against Microsoft]] and the [[http://blogs.msdn.com/ie/archive/2006/04/11/573479.aspx|changes that were recently made to Internet Explorer]] as a result, we generate and include a [[http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/overview/activating_activex.asp|JavaScript library containing functions]] that allow us to embed the multimedia content. This function is identical to ''[[reference:SimplePie_Enclosure:embed]]'' except that, whereas ''[[reference:SimplePie_Enclosure:embed]]'' uses JavaScript to dynamically create the ''<embed>'' object, this function writes the ''<embed>'' tag directly to your pages, so that JavaScript is not required. It also works better for free webhosts that insert advertisements into everything. On the flip-side, //pages using this function WILL NOT [[http://validator.w3.org|VALIDATE]] as HTML or XHTML, because the ''<embed>'' tag is invalid.// ===== Availability ===== * Available since SimplePie Beta 3. ===== Parameters ===== ==== options ==== ''options'' is an array of multiple options that can all be passed into the [[reference:SimplePie_Enclosure:embed]] method. They are as follows: * ''alt'' (string)\\ Alternate content for when an end-user does not have the appropriate handler installed or when a file type is unsupported. Can be any text or HTML. Defaults to blank. * ''altclass'' (string)\\ If a file type is unsupported, the end-user will see the alt text (above) linked directly to the content. That link will have this value as its class name. Defaults to blank. * ''audio'' (string)\\ This is an image that should be used as a placeholder for audio files before they're loaded (QuickTime-only). Can be any relative or absolute URL. Defaults to blank. * ''bgcolor'' (string)\\ The background color for the media, if not already transparent. Defaults to ''#ffffff''. * ''height'' (integer)\\ The height of the embedded media. Accepts any numeric pixel value (such as ''360'') or ''auto''. Defaults to ''auto'', and it is recommended that you use this default. * ''loop'' (boolean)\\ Do you want the media to loop when its done? Defaults to ''false''. * ''mediaplayer'' (string)\\ The location of the included ''mediaplayer.swf'' file. This allows for the playback of Flash Video (''.flv'') files, and is the default handler for non-Odeo MP3's. Defaults to blank. * ''video'' (string)\\ This is an image that should be used as a placeholder for video files before they're loaded (QuickTime-only). Can be any relative or absolute URL. Defaults to blank. * ''width'' (integer)\\ The width of the embedded media. Accepts any numeric pixel value (such as ''480'') or ''auto''. Defaults to ''auto'', and it is recommended that you use this default. * ''widescreen'' (boolean)\\ Is the enclosure widescreen or standard? This applies only to video enclosures, and will automatically resize the content appropriately. Defaults to ''false'', implying 4:3 mode. **NOTE:** Non-widescreen (4:3) mode with ''width'' and ''height'' set to ''auto'' will default to 480x360 video resolution. Widescreen (16:9) mode with ''width'' and ''height'' set to ''auto'' will default to 480x270 video resolution. ===== Examples ===== <code php>$feed = new SimplePie(); $feed->set_feed_url('http://youtube.com/rss/global/top_favorites.rss'); $feed->init(); $feed->handle_content_type(); foreach ($feed->get_items() as $item) { if ($enclosure = $item->get_enclosure()) { echo $enclosure->native_embed(array( 'alt' => 'Download this enclosure!', 'audio' => './for_the_demo/place_audio.png', 'video' => './for_the_demo/place_video.png', 'mediaplayer' => './for_the_demo/mediaplayer.swf', 'widescreen' => true )); } }</code> ===== See Also ===== * [[reference:SimplePie:start]] * [[reference:SimplePie_Item:start]] * [[reference:SimplePie_Enclosure:start]] * [[reference:SimplePie_Enclosure:embed]]
Sorting by custom criteria instead of date: 29 Hits
ab extra Digg-specific data, and we'll extend the SimplePie class and override the [[reference:SimplePie:sort_items]] method to sort by number o... necessary libraries. Digg Add-on found at http://simplepie.org/wiki/addons/digg require_once('simplepie.inc'); require_once('simplepie_digg.inc'); // Extend the SimplePie class and override the existing sort_items() func... with our own. class SimplePie_Custom_Sort extends SimplePie { public static function sort_items($a, $b) {
get_all_discovered_feeds(): 19 Hits
====== get_all_discovered_feeds() ====== ===== Description ===== <code>class SimplePie { get_all_discovered_feeds () }</code> Returns an array of SimplePie_File objects, pointing to feeds found during the autodiscovery process. ===== Availability ===== * Available since SimplePie 1.2. * Available since [[http://bugs.simplepie.org/repositories/revision/sp1/1051|r1051]] ===== Examples ===== ==== Loop through each item and do something with each ==== <code php><?php require_once('../simplepie.inc'); $feed = new SimplePie('http://simplepie.org/wiki/reference/simplepie/get_all_discovered_feeds'); foreach ($feed->get_all_discovered_feeds() as $link) { echo $link->url . "<br />"; } ?></code> ===== See Also ===== * [[reference:SimplePie:start]] * [[reference:SimplePie:subscribe_url]]
How do I get a thumbnail from a YouTube feed?: 15 Hits
t's simplify this with the shorter syntax. http://simplepie.org/wiki/reference/simplepie/start $feed = new SimplePie('http://youtube.com/rss/global/top_favorites.rss'); // Make sure the content is being serve... _content_type(); foreach ($feed->get_items() as $item) { // As long as an enclosure exists... if ($enclosure = $item->get_enclosure()) { // Display the thumbnail as an image and link it back to the