Support Joomla!

Joomla! 1.5 Documentation

Packages

Package: Unknown

Developer Network License

The Joomla! Developer Network content is © copyright 2006 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution- NonCommercial- ShareAlike 2.5
Source code for file /simplepie/demo/index.php

Documentation is available at index.php

  1. <?php
  2. // Start counting time for the page load
  3. $starttime explode(' 'microtime());
  4. $starttime $starttime[1$starttime[0];
  5.  
  6. // Include SimplePie
  7. // Located in the parent directory
  8. include_once('../simplepie.inc');
  9. include_once('../idn/idna_convert.class.php');
  10.  
  11. // Create a new instance of the SimplePie object
  12. $feed new SimplePie();
  13.  
  14. // Set these Configuration Options
  15. $feed->strip_ads(true);
  16.  
  17. // Make sure that page is getting passed a URL
  18. if (!empty($_GET['feed'])) {
  19.  
  20.     // Strip slashes if magic quotes is enabled (which automatically escapes certain characters)
  21.         if (get_magic_quotes_gpc())
  22.     {
  23.         $_GET['feed'stripslashes($_GET['feed']);
  24.     }
  25.  
  26.     // Use the URL that was passed to the page in SimplePie
  27.         $feed->feed_url($_GET['feed']);
  28. }
  29.  
  30. // Allow us to change the input encoding from the URL string if we want to. (optional)
  31. if (!empty($_GET['input'])) {
  32.     $feed->input_encoding($_GET['input']);
  33. }
  34.  
  35. // Allow us to snap into IHBB mode.
  36. if (!empty($_GET['image'])) {
  37.     $feed->bypass_image_hotlink('i');
  38.     $feed->bypass_image_hotlink_page('./ihbb.php');
  39. }
  40.  
  41. // Initialize the whole SimplePie object.  Read the feed, process it, parse it, cache it, and
  42. // all that other good stuff.  The feed's information will not be available to SimplePie before
  43. // this is called.
  44. $feed->init();
  45.  
  46. // We'll make sure that the right content type and character encoding gets set automatically.
  47. // This function will grab the proper character encoding, as well as set the content type to text/html.
  48. $feed->handle_content_type();
  49.  
  50. // When we end our PHP block, we want to make sure our DOCTYPE is on the top line to make
  51. // sure that the browser snaps into Standards Mode.
  52. ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  53.  
  54. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
  55. <head>
  56. <title>SimplePie: Demo</title>
  57.  
  58. <link rel="stylesheet" href="./for_the_demo/simplepie.css" media="screen, projector" />
  59. <script type="text/javascript" src="./for_the_demo/sifr.js"></script>
  60. <script type="text/javascript" src="./for_the_demo/sleight.js"></script>
  61.  
  62. </head>
  63.  
  64. <body id="bodydemo">
  65.  
  66. <ul id="menu">
  67.     <!-- Must all be on the same line due to spacing bugs. -->
  68.     <li><a href="http://simplepie.org/docs/misc/release-notes/beta3/">Release Notes</a>|</li><li><a href="http://simplepie.org/support/">Bug Reports &amp; Feature Requests</a>|</li><li><a href="http://simplepie.org/docs/reference/">Function Reference</a>|</li><li><a href="http://simplepie.org/blog/">Weblog</a></li>
  69. </ul>
  70.  
  71. <div id="site">
  72.  
  73.     <h1 id="logo"><img src="./for_the_demo/logo_simplepie_demo.png" alt="SimplePie Demo" title="SimplePie Demo" /></h1>
  74.  
  75.     <div id="content">
  76.  
  77.         <div class="chunk">
  78.             <form action="" method="get" name="sp_form" id="sp_form">
  79.                 <div id="sp_input">
  80.  
  81.  
  82.                     <!-- If a feed has already been passed through the form, then make sure that the URL remains in the form field. -->
  83.                     <p><strong>Feed URL:</strong>&nbsp;<input type="text" name="feed" value="<?php if ($feed->subscribe_url()) echo htmlspecialchars($feed->subscribe_url())?>" class="text" id="feed_input" />&nbsp;<input type="submit" value="Read" class="button" /></p>
  84.  
  85.  
  86.                 </div>
  87.             </form>
  88.  
  89.  
  90.             <?php
  91.             // Check to see if there are more than zero errors (i.e. if there are any errors at all)
  92.                         if (isset($feed->error)) {
  93.  
  94.                 // If so, start a <div> element with a classname so we can style it.
  95.                                 echo '<div class="sp_errors">' "\r\n";
  96.  
  97.                     // ... and display it.
  98.                                         echo '<p>' htmlspecialchars($feed->error"</p>\r\n";
  99.  
  100.                 // Close the <div> element we opened.
  101.                                 echo '</div>' "\r\n";
  102.             }
  103.             ?>
  104.  
  105.  
  106.             <!-- Here are some sample feeds. -->
  107.             <p class="sample_feeds"><strong>Or try one of the following:</strong>
  108. <a href="?feed=http://www.詹姆斯.com/atomtests/iri/everything.atom#feed" title="Test: International Domain Name support">詹姆斯.com</a>,
  109. <a href="?feed=http://www.adultswim.com/williams/podcast/tools/xml/video_rss.xml#feed" title="Humor from the people who make [adult swim] cartoons.">adult swim</a>,
  110. <a href="?feed=http://afterdawn.com/news/afterdawn_rss.xml#feed" title="Ripping, Burning, DRM, and the Dark Side of Consumer Electronics Media">Afterdawn</a>,
  111. <a href="?feed=http://feeds.feedburner.com/ajaxian#feed" title="AJAX and Scripting News">Ajaxian</a>,
  112. <a href="?feed=http://www.andybudd.com/index.rdf&amp;image=true#feed" title="Test: Bypass Image Hotlink Blocking">Andy Budd</a>,
  113. <a href="?feed=http://feeds.feedburner.com/AskANinja#feed" title="Test: Embedded Enclosures">Ask a Ninja</a>,
  114. <a href="?feed=http://www.atomenabled.org/atom.xml#feed" title="Test: Atom 1.0 Support">AtomEnabled.org</a>,
  115. <a href="?feed=http://newsrss.bbc.co.uk/rss/newsonline_world_edition/front_page/rss.xml#feed" title="World News">BBC News</a>,
  116. <a href="?feed=http://newsrss.bbc.co.uk/rss/arabic/news/rss.xml#feed" title="Test: Windows-1256 Encoding">BBC Arabic</a>,
  117. <a href="?feed=http://newsrss.bbc.co.uk/rss/chinese/simp/news/rss.xml#feed" title="Test: GB2312 Encoding">BBC China</a>,
  118. <a href="?feed=http://newsrss.bbc.co.uk/rss/russian/news/rss.xml#feed" title="Test: Windows-1251 Encoding">BBC Russia</a>,
  119. <a href="?feed=http://blogdigger.com/media/mov.xml#feed" title="Test: Multiple Issues">Blogdigger</a>,
  120. <a href="?feed=http://inessential.com/xml/rss.xml#feed" title="Developer of NetNewsWire">Brent Simmons</a>,
  121. <a href="?feed=http://www.channelfrederator.com/rss#feed" title="Test: Embedded Enclosures">Channel Frederator</a>,
  122. <a href="?feed=http://rss.cnn.com/rss/cnn_topstories.rss#feed" title="World News">CNN</a>,
  123. <a href="?feed=http://www.crazyapplerumors.com/?feed=rss2#feed" title="Hilarity at its best">Crazy Apple Rumors</a>,
  124. <a href="?feed=http://del.icio.us/rss/#feed" title="The defacto social bookmarking site">del.icio.us</a>,
  125. <a href="?feed=http://digg.com/rss/index.xml#feed" title="Tech news.  Better than Slashdot.">Digg</a>,
  126. <a href="?feed=http://odeo.com/channel/rss/4565#feed" title="Tech and industry videocast.">Diggnation (Odeo)</a>,
  127. <a href="?feed=http://revision3.com/diggnation/feed/small.mov.xml#feed" title="Tech and industry videocast.">Diggnation (Video)</a>,
  128. <a href="?feed=http://odeo.com/channel/32022/rss#feed" title="Test: Embedded Odeo Player">Dominic Sagolla</a>,
  129. <a href="?feed=http://www.dooce.com/atom.xml#feed" title="Test: Ad Stripping">Dooce</a>,
  130. <a href="?feed=http://www.flickr.com/services/feeds/photos_public.gne?format=rss2#feed" title="Flickr Photos">Flickr</a>,
  131. <a href="?feed=http://news.google.com/?output=rss#feed" title="World News">Google News</a>,
  132. <a href="?feed=http://blogs.law.harvard.edu/home/feed/rdf/#feed" title="Test: Tag Stripping">Harvard Law</a>,
  133. <a href="?feed=http://hagada.org.il/hagada/html/backend.php#feed" title="Test: Window-1255 Encoding">Hebrew Language</a>,
  134. <a href="?feed=http://korfball.hu/rss_news.xml#feed" title="ISO-8859-2">Hungarian Language</a>,
  135. <a href="?feed=http://www.infoworld.com/rss/news.xml#feed" title="Test: Ad Stripping">InfoWorld</a>,
  136. <a href="?feed=http://phobos.apple.com/WebObjects/MZStore.woa/wpa/MRSS/topsongs/limit=10/rss.xml#feed" title="Test: Tag Stripping">iTunes</a>,
  137. <a href="?feed=http://blog.japan.cnet.com/lessig/index.rdf#feed" title="Test: EUC-JP Encoding">Japanese Language</a>,
  138. <a href="?feed=http://nurapt.kaist.ac.kr/~jamaica/htmls/blog/rss.php&amp;input=EUC-KR#feed" title="Test: EUC-KR Encoding">Korean Language</a>,
  139. <a href="?feed=http://macnn.com/podcasts/macnn.rss#feed" title="Test: Embedded Enclosures">MacNN</a>,
  140. <a href="?feed=http://mir.aculo.us/xml/rss/feed.xml#feed" title="Weblog for the developer of Scriptaculous">mir.aculo.us</a>,
  141. <a href="?feed=http://images.apple.com/trailers/rss/newtrailers.rss#feed" title="Apple's QuickTime movie trailer site">Movie Trailers</a>,
  142. <a href="?feed=http://nick.typepad.com/blog/index.rss#feed" title="Developer of TopStyle and FeedDemon">Nick Bradbury</a>,
  143. <a href="?feed=http://feeds.feedburner.com/ok-cancel#feed" title="Usability comics and commentary">OK/Cancel</a>,
  144. <a href="?feed=http://osnews.com/files/recent.rdf#feed" title="News about every OS ever">OS News</a>,
  145. <a href="?feed=http://weblog.philringnalda.com/feed/#feed" title="Test: Atom 1.0 Support">Phil Ringnalda</a>,
  146. <a href="?feed=http://photocast.mac.com/turboderek/iPhoto/top-rides/index.rss#feed" title="Test: iPhoto 6 Photocasting">Photocast</a>,
  147. <a href="?feed=http://kabili.libsyn.com/rss#feed" title="Test: Improved enclosure type sniffing">Photoshop Videocast</a>,
  148. <a href="?feed=http://refrederator.com/rss#feed" title="Test: Embedded Enclosures">ReFrederator</a>,
  149. <a href="?feed=http://www.pariurisportive.com/blog/xmlsrv/rss2.php?blog=2#feed" title="Test: ISO-8859-1 Encoding">Romanian Language</a>,
  150. <a href="?feed=http://www.erased.info/rss2.php#feed" title="Test: KOI8-R Encoding">Russian Language</a>,
  151. <a href="?feed=http://www.upsaid.com/isis/index.rdf#feed" title="Test: BIG5 Encoding">Traditional Chinese Language</a>,
  152. <a href="?feed=http://technorati.com/watchlists/rss.html?wid=29290#feed" title="Technorati watch for SimplePie">Technorati</a>,
  153. <a href="?feed=http://thinksecret.com/rss.xml#feed" title="Apple Rumors">Think Secret</a>,
  154. <a href="?feed=http://www.tbray.org/ongoing/ongoing.atom#feed" title="Test: Atom 1.0 Support">Tim Bray</a>,
  155. <a href="?feed=http://tuaw.com/rss.xml#feed" title="Test: Ad Stripping">TUAW</a>,
  156. <a href="?feed=http://www.tvgasm.com/atom.xml&amp;image=true#feed" title="Test: Bypass Image Hotlink Blocking">TVgasm</a>,
  157. <a href="?feed=http://feeds.feedburner.com/web20Show#feed" title="Test: Embedded Enclosures">Web 2.0 Show</a>,
  158. <a href="?feed=http://whitecollarruckus.libsyn.com/rss#feed" title="Test: Embedded Enclosures">White Collar Ruckus</a>,
  159. <a href="?feed=http://blogs.technet.com/windowsvista/rss.xml#feed" title="Test: Tag Stripping">Windows Vista Blog</a>,
  160. <a href="?feed=http://rss.news.yahoo.com/rss/topstories#feed" title="World News">Yahoo! News</a>,
  161. <a href="?feed=http://youtube.com/rss/global/recently_added.rss#feed" title="Funny user-submitted videos">You Tube</a>,
  162. <a href="?feed=http://zeldman.com/rss/#feed" title="The father of the web standards movement">Zeldman</a></p>
  163.             <a name="feed"></a>
  164.         </div>
  165.  
  166.         <div id="sp_results">
  167.  
  168.  
  169.             <!-- As long as the feed has data to work with... -->
  170.             <?php if ($feed->data)?>
  171.                 <div class="chunk focus" align="center">
  172.  
  173.                     <!-- If the feed has a link back to the site that publishes it (which 99% of them do), link the feed's title to it. -->
  174.                     <h3 class="header"><?php if ($feed->get_feed_link()) echo '<a href="' $feed->get_feed_link('">'echo $feed->get_feed_title()if ($feed->get_feed_link()) echo '</a>'?></h3>
  175.  
  176.                     <!-- If the feed has a description, display it. -->
  177.                     <?php echo $feed->get_feed_description()?>
  178.  
  179.                 </div>
  180.  
  181.  
  182.                 <!-- Add subscribe links for several different aggregation services -->
  183.                 <p class="subscribe"><strong>Subscribe:</strong> <a href="<?php echo $feed->subscribe_bloglines()?>">Bloglines</a>, <a href="<?php echo $feed->subscribe_google()?>">Google Reader</a>, <a href="<?php echo $feed->subscribe_msn()?>">My MSN</a>, <a href="<?php echo $feed->subscribe_netvibes()?>">Netvibes</a>, <a href="<?php echo $feed->subscribe_newsburst()?>">Newsburst</a><br /><a href="<?php echo $feed->subscribe_newsgator()?>">Newsgator</a>, <a href="<?php echo $feed->subscribe_odeo()?>">Odeo</a>, <a href="<?php echo $feed->subscribe_pluck()?>">Pluck</a>, <a href="<?php echo $feed->subscribe_podnova()?>">Podnova</a>, <a href="<?php echo $feed->subscribe_rojo()?>">Rojo</a>, <a href="<?php echo $feed->subscribe_yahoo()?>">My Yahoo!</a>, <a href="<?php echo $feed->subscribe_feed()?>">Desktop Reader</a></p>
  184.  
  185.  
  186.                 <!-- Let's begin looping through each individual news item in the feed. -->
  187.                 <?php foreach($feed->get_items(as $item)?>
  188.                     <div class="chunk">
  189.  
  190.                         <!-- If the item has a permalink back to the original post (which 99% of them do), link the item's title to it. -->
  191.                         <h4><?php if ($item->get_permalink()) echo '<a href="' $item->get_permalink('">'echo $item->get_title()if ($item->get_permalink()) echo '</a>'?>&nbsp;<span class="footnote"><?php echo $item->get_date('j M Y')?></span></h4>
  192.  
  193.                         <!-- Display the item's primary content. -->
  194.                         <?php echo $item->get_description()?>
  195.  
  196.                         <?php
  197.                         // Check for enclosures.  If an item has any, set the first one to the $enclosure variable.
  198.                                                 if ($enclosure $item->get_enclosure(0)) {
  199.  
  200.                             // Use the embed() method to embed the enclosure into the page inline.
  201.                                                         echo '<div align="center">';
  202.                             echo '<p>' $enclosure->embed(array(
  203.                                 'audio' => './for_the_demo/place_audio.png',
  204.                                 'video' => './for_the_demo/place_video.png',
  205.                                 'alt' => '<img src="./for_the_demo/mini_podcast.png" class="download" border="0" title="Download the Podcast (' $enclosure->get_extension('; ' $enclosure->get_size(' MB)" />',
  206.                                 'altclass' => 'download'
  207.                             )) '</p>';
  208.                             echo '<p class="footnote" align="center">(' $enclosure->get_type('; ' $enclosure->get_size(' MB)</p>';
  209.                             echo '</div>';
  210.                         }
  211.                         ?>
  212.  
  213.                         <!-- Add links to add this post to one of a handful of services. -->
  214.                         <p class="footnote" align="center"><a href="<?php echo $item->add_to_blinklist()?>" title="Add post to Blinklist">Blinklist</a> | <a href="<?php echo $item->add_to_delicious()?>" title="Add post to del.icio.us">Del.icio.us</a> | <a href="<?php echo $item->add_to_digg()?>" title="Digg this!">Digg</a> | <a href="<?php echo $item->add_to_furl()?>" title="Add post to Furl">Furl</a> | <a href="<?php echo $item->add_to_magnolia()?>" title="Add post to Ma.gnolia">Ma.gnolia</a> | <a href="<?php echo $item->add_to_newsvine()?>" title="Add post to Newsvine">Newsvine</a> | <a href="<?php echo $item->add_to_spurl()?>" title="Add post to Spurl">Spurl</a> | <a href="<?php echo $item->search_technorati()?>" title="Who's linking to this post?">Technorati</a></p>
  215.  
  216.                     </div>
  217.  
  218.                 <!-- Stop looping through each item once we've gone through all of them. -->
  219.                 <?php endforeach?>
  220.  
  221.             <!-- From here on, we're no longer using data from the feed. -->
  222.             <?php endif?>
  223.  
  224.         </div>
  225.  
  226.         <div>
  227.             <!-- Display how fast the page was rendered. -->
  228.             <p class="footnote">Page processed in <?php $mtime explode(' 'microtime())echo round($mtime[0$mtime[1$starttime3)?> seconds.</p>
  229.  
  230.             <!-- Display the version of SimplePie being loaded. -->
  231.             <p class="footnote">Powered by <a href="<?php echo $feed->url?>"><?php echo $feed->name ' ' $feed->version ', Build ' $feed->build?></a>.  Run the <a href="../compatibility_test/sp_compatibility_test.php">SimplePie Compatibility Test</a>.  SimplePie is &copy; 2004&ndash;<?php echo date('Y')?>, <a href="http://www.skyzyx.com">Skyzyx Technologies</a>, and licensed under the <a href="http://creativecommons.org/licenses/LGPL/2.1/">LGPL</a>.</p>
  232.         </div>
  233.  
  234.     </div>
  235.  
  236. </div>
  237.  
  238. <script type="text/javascript">
  239. //<![CDATA[
  240.  
  241. // Load the sIFR font for the feed's title.
  242. if(typeof sIFR == "function"){
  243.     sIFR.replaceElement(named({sSelector:"h3.header", sFlashSrc:"./for_the_demo/yanone-kaffeesatz-bold.swf", sColor:"#000000", sHoverColor:"#666666", sBgColor:"#EEFFEE", sFlashVars:"textalign=center"}));
  244. };
  245.  
  246. //]]>
  247. </script>
  248.  
  249. </body>
  250. </html>

Documentation generated on Mon, 05 Mar 2007 21:07:45 +0000 by phpDocumentor 1.3.1