Podcasts

Stress and Anxiety Podcasts on the web

class rss_parser {

var $rss_url;
var $num_to_show;
var $offset; //added in version 0.4.3
var $do_update;
var $tags = array();
var $content;
var $rss = array();

var $feed_title;
var $feed_link;
var $feed_description;

var $my_html;

function rss_parser($url, $numtoshow = 10, $html = "", $update = FALSE, $offset = 1)
{
$this->rss_url = $url;
$this->num_to_show = $numtoshow;
$this->do_update = $update;
$this->my_html = preg_replace(“/(#{.*?):(.*?})/”, “\\1__\\2″, $html); //xx:xx tag workaround
$this->offset = –$offset;
$this->content = $this->fetch_feed();
$this->parse_feed();
$this->show();
}

/* string */
function fetch_feed()
{
$url_parts = parse_url($this->rss_url);

$filename = $url_parts['host'] . str_replace(“/”, “,”, $url_parts['path']) . “_” . @$url_parts['query'];
if(file_exists($this->data_directory . “/$filename”)) {
$last = filemtime($this->data_directory . “/$filename”);
if(time() – $last > $this->update_interval * 60 || $this->update_interval == 0) {
$update = 1;
}
} else {
$create= 1;
}

if($create == 1 || ($this->do_update == TRUE && $update == 1)) {
$fp = @fsockopen($url_parts['host'], 80, $errno, $errstr, 5);
if (!$fp) {
echo “Couldn’t open rss feed {$this->feed_url} in {$_SERVER['PHP_SELF']}
\n”;
return;
}

fputs($fp, “GET ” . $url_parts['path'] . “?” . @$url_parts['query'] . ” HTTP/1.0\r\n”
.”Host: ” . $url_parts['host'] . “\r\n”
.”User-Agent: Drew’s RSS Reader 0.1\r\n”
.”Connection: Close\r\n\r\n”);

while(!feof($fp)) {
$rss_data .= @fgets($fp, 1024);
}

list(, $rss_data) = explode(“\r\n\r\n”, $rss_data, 2);

$output = @fopen($this->data_directory . “/$filename”, “w+”);
if(!$output) {
return $rss_data;
} else {
flock($output, LOCK_EX);
fputs($output, $rss_data);
flock($output, LOCK_UN);
fclose($output);
}
} //update

return file_get_contents($this->data_directory . “/$filename”);
}

/* void */
function parse_feed()
{
preg_match(“/(.*?)<\/title>/”, $this->content, $title);<br /> $this->feed_title = @$title[1];</p><p> preg_match(“/<link>(.*?)<\/link>/”, $this->content, $link);<br /> $this->feed_link = @$link[1];</p><p> preg_match(“/<description>(.*?)<\/description>/”, $this->content, $description);<br /> $this->feed_description = @$description[1];</p><p> preg_match_all(“/<item[^>]*>(.*?)<\/item>/s”, $this->content, $items);<br /> if (sizeof($items[0]) == 0) {<br /> echo “<br />\n”;<br /> }</p><p> for($i = 0; $i < sizeof($items[0]); ++$i) {</p><p> preg_match_all("/(?:<([\w:]*)[^>]*>\s*(?:<!\[CDATA\[)?(.*?)(?:]]>)?\s*<\/\\1>)+?/si”, preg_replace(“/<item[^>]*>/”, “”, $items[0][$i]), $elements);<br /> for($j = 0; $j < sizeof($elements[0]); ++$j) {<br /> $elements[1][$j] = str_replace(":", "__", $elements[1][$j]);<br /> $elements[2][$j] = str_replace(" ", " ", $elements[2][$j]); //regex fix for items with unicode character<br /> $this->rss[$i][$elements[1][$j]] = trim(html_entity_decode($elements[2][$j]));<br /> }<br /> }<br /> }</p><p> /* void */<br /> function show()<br /> {<br /> if($this->my_html == “”) {<br /> $this->show_html();<br /> } else {<br /> $this->show_user_html();<br /> }<br /> }</p><p> function show_html()<br /> {<br /> $show = (sizeof($this->rss) > $this->num_to_show ? $this->num_to_show : sizeof($this->rss));<br /> for($i = $this->offset; $i < $this->offset + $show; ++$i) {<br /> echo “- <a href=\"{$this->rss[$i]['link']}\” onclick=\”return GB_showFullScreen(‘#{title}’, this.href)\” rel=\”nofollow\”>{$this->rss[$i]['title']}</a><br />\n”;<br /> }<br /> }</p><p> function show_user_html()<br /> {<br /> $show = (sizeof($this->rss) > $this->num_to_show + $this->offset ? $this->num_to_show : sizeof($this->rss));<br /> $show = ($this->offset + $this->num_to_show > sizeof($this->rss) ? sizeof($this->rss) – $this->offset : $this->num_to_show);<br /> for($i = $this->offset; $i < $this->offset + $show; ++$i) {<br /> extract($this->rss[$i]);<br /> $item = preg_replace(“/#\{([^}]+)}/e”, “$\\1″, $this->my_html);<br /> echo $item;<br /> }<br /> }</p><p>} // end class</p><p>//set our feeds<br /> $feeds = array(<br /> “http://search.everyzing.com/rss.jsp?q=stress&col=en-aud-public-ep&start=0&num=10&filter=1&dedupe=1&expand=true&match=query,channel&x=35&y=13&mc=en-aud&il=en&format=xml”<br /> );</p><p>//pick a random feed to display<br /> srand ((double)microtime()*1000000);<br /> $randomurl = rand(0, count($feeds)-1);</p><p>$url = $feeds[$randomurl];</p><p>//define layout for rss item display<br /> $html = ”<br /><h3>#{title}</h3><p>\n”;<br /> $html .= ”<p>#{description}</p><p>\n”;<br /> $html .= ” <a href='#{link}' title='Podcasts' onclick=\"return GB_showFullScreen('Stress and Anxiety Podcasts on the web', this.href)\" rel=\"nofollow\">Read more…</a></p><p>\n”;<br /> $html .= ”<br /><hr size='1' />\n”;</p><p>//check url of feed we’re trying to display<br /> //echo $url;</p><p>$rss = new rss_parser($url, 10, $html, 1); //Parse and Display<br /> ?></p><p style="text-align: center;"><script type="text/javascript">google_ad_client="pub-6183580695833604";google_ad_slot="4552818312";google_ad_width=336;google_ad_height=280;</script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script></p></div></div></div><div id="sidebar_1" class="sidebar"><ul class="sidebar_list"><li class="widget widget_categories" id="categories-201659011"><h3>Categories</h3><ul><li class="cat-item cat-item-1"><a href="http://www.stressandanxietyguides.com/alternative/" title="View all posts filed under Alternative Medicines and Therapies">Alternative Medicines and Therapies</a></li><li class="cat-item cat-item-3"><a href="http://www.stressandanxietyguides.com/anxiety/" title="View all posts filed under Anxiety">Anxiety</a></li><li class="cat-item cat-item-16"><a href="http://www.stressandanxietyguides.com/symptoms/" title="View all posts filed under Anxiety Symptoms and Stress Signs">Anxiety Symptoms and Stress Signs</a></li><li class="cat-item cat-item-5"><a href="http://www.stressandanxietyguides.com/behavior/" title="View all posts filed under Behavior Modifications">Behavior Modifications</a></li><li class="cat-item cat-item-6"><a href="http://www.stressandanxietyguides.com/depression/" title="View all posts filed under Depression">Depression</a></li><li class="cat-item cat-item-8"><a href="http://www.stressandanxietyguides.com/herbal/" title="View all posts filed under Herbal Medications">Herbal Medications</a></li><li class="cat-item cat-item-11"><a href="http://www.stressandanxietyguides.com/mental/" title="View all posts filed under Mental Health">Mental Health</a></li><li class="cat-item cat-item-4"><a href="http://www.stressandanxietyguides.com/attacks/" title="View all posts filed under Panic Attacks">Panic Attacks</a></li><li class="cat-item cat-item-7"><a href="http://www.stressandanxietyguides.com/disorders/" title="View all posts filed under Panic Disorders">Panic Disorders</a></li><li class="cat-item cat-item-12"><a href="http://www.stressandanxietyguides.com/psychologists/" title="View all posts filed under Psychologist">Psychologist</a></li><li class="cat-item cat-item-14"><a href="http://www.stressandanxietyguides.com/social/" title="View all posts filed under Social Anxiety">Social Anxiety</a></li><li class="cat-item cat-item-15"><a href="http://www.stressandanxietyguides.com/stress/" title="View all posts filed under Stress">Stress</a></li><li class="cat-item cat-item-10"><a href="http://www.stressandanxietyguides.com/medications/" title="View all posts filed under Stress and Anxiety Medications">Stress and Anxiety Medications</a></li><li class="cat-item cat-item-13"><a href="http://www.stressandanxietyguides.com/relief/" title="View all posts filed under Stress and Anxiety Relief">Stress and Anxiety Relief</a></li><li class="cat-item cat-item-9"><a href="http://www.stressandanxietyguides.com/management/" title="View all posts filed under Stress Management">Stress Management</a></li></ul></li><li class="widget widget_ad_rotator" id="ad_rotator-3"><h3>Stress eBooks</h3><div class="widget_ad_rotator"><a href="http://www.stressandanxietyguides.com/knowanxiety/" class="ebooks" onclick="window.open(this.href,'_blank');return false;"><img src="http://www.stressandanxietyguides.com/images/GettingToKnowAnxiety.jpg" alt="Getting to Know Anxiety" title="Getting to Know Anxiety" /></a></div></li><li class="widget widget_text" id="text-202854211"><div class="textwidget"><script type="text/javascript">/*<![CDATA[*/ch_client="activuk";ch_type="mpu";ch_width=120;ch_height=600;ch_color_bg="FFFFFF";ch_color_border="FFFFFF";ch_color_title="2361A1";ch_color_site_link="2361A1";ch_color_text="0D3700";ch_non_contextual=4;ch_vertical="premium";ch_font_title="Verdana";ch_font_text="Verdana";ch_sid="Chitika Premium Stress";var ch_queries=new Array();var ch_selected=Math.floor((Math.random()*ch_queries.length));if(ch_selected<ch_queries.length){ch_query=ch_queries[ch_selected];}/*]]>*/</script> <script src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript"></script></div></li><li class="widget widget_ara_randomposts" id="random-posts-widget"><h3>Random Posts</h3><ul><li><a href="http://www.stressandanxietyguides.com/stress/down-to-stress/">It Always Comes Down to Stress</a></li><li><a href="http://www.stressandanxietyguides.com/mental/mental-health-parity-bill/">The Controversial Mental Health Parity Bill</a></li><li><a href="http://www.stressandanxietyguides.com/management/stressful-stressors/">Stressful Stressors</a></li><li><a href="http://www.stressandanxietyguides.com/anxiety/do-it-myself/">I’ll Do It Myself</a></li><li><a href="http://www.stressandanxietyguides.com/behavior/behavior-modifications-for-students/">Behavior Modifications for Students</a></li></ul></li></ul></div></div><div id="sidebars"><div id="sidebar_2" class="sidebar"><ul class="sidebar_list"><li class="widget thesis_widget_google_cse" id="google-custom-search"><h3>Search</h3><form action="http://www.stressandanxietyguides.com/search/" id="cse-search-box"><div> <input type="hidden" name="cx" value="partner-pub-6183580695833604:r4u0wk-2hpu" /> <input type="hidden" name="cof" value="FORID:10" /> <input type="hidden" name="ie" value="UTF-8" /> <input type="text" name="q" size="31" /> <input type="submit" name="sa" value="Search" /></div></form> <script type="text/javascript" src="http://www.google.com/cse/brand?form=cse-search-box&lang=en"></script> </li><li class="widget widget_text" id="text-201659851"><h3>Newsletter</h3><div class="textwidget">Subscribe to our newsletter to receive our exclusive Special Report<br /><img src='http://www.stressandanxietyguides.com/images/report-sm.jpg' class='report' alt='' /><br /><form method="post" action="http://www.aweber.com/scripts/addlead.pl" onclick="window.open(this.href,'_new');return false;" /> <input type="hidden" name="meta_web_form_id" value="1394183409" /> <input type="hidden" name="meta_split_id" value="" /> <input type="hidden" name="unit" value="stressguides" /> <input type="hidden" name="redirect" value="http://www.stressandanxietyguides.com/ebook.html" id="redirect_6b448fc7171a1f363b4768d649c3a6f6" /> <input type="hidden" name="meta_redirect_onlist" value="" /> <input type="hidden" name="meta_adtracking" value="" /> <input type="hidden" name="meta_message" value="1" /> <input type="hidden" name="meta_required" value="from" /> <input type="hidden" name="meta_forward_vars" value="0" /><table><tr><td colspan="2"></td></tr><tr><td>Email:</td><td><input type="text" name="from" value="" size="10" /></td></tr><tr><td>First Name:</td><td><input type="text" name="name" value="" size="10" /></td></tr><tr><td align="center" colspan="2"><input type="submit" name="submit" value="Submit" /></td></tr></table></div></li><li class="widget widget_killer_recent_entries" id="widget_killer_recent_entries-437726741"><h3>Recent Posts</h3><ul><li><a href="http://www.stressandanxietyguides.com/management/stress-management-techniques/" title="Click to read Meditation, Exercise, and Other Stress Management Techniques" rel="bookmark">Meditation, Exercise, and Other Stress Management Techniques</a></li><li><a href="http://www.stressandanxietyguides.com/relief/anxiety-cure/" title="Click to read Some Tips for Anxiety Cure" rel="bookmark">Some Tips for Anxiety Cure</a></li><li><a href="http://www.stressandanxietyguides.com/herbal/depression-natural-medications/" title="Click to read Depression Natural Medication Provides An Alternative" rel="bookmark">Depression Natural Medication Provides An Alternative</a></li><li><a href="http://www.stressandanxietyguides.com/medications/social-phobias-anxiety-medications/" title="Click to read Social Phobias Anxiety Medications Make A Difference" rel="bookmark">Social Phobias Anxiety Medications Make A Difference</a></li><li><a href="http://www.stressandanxietyguides.com/attacks/child-anxiety-attacks/" title="Click to read Child Anxiety Attacks" rel="bookmark">Child Anxiety Attacks</a></li></ul></li><li class="widget widget_text" id="text-421771244"><h3>Find Us On Twitter</h3><div class="textwidget"><a href="http://twitter.com/stressguides" onclick="window.open(this.href,'_blank');return false;" rel="nofollow" title="Follow@stressguides on Twitter"><img src="http://dmpyldved26gk.cloudfront.net/images/twitter.png" alt="Follow Us On Twitter!" height="64" style="border: medium none ;" width="128"/></a></div></li></ul></div></div></div><ul class="menu"><li class="tab tab-home"><a href="http://www.stressandanxietyguides.com">Home</a></li><li class="tab tab-1"><a href="http://www.stressandanxietyguides.com/pictures/" title="Images">Images</a></li><li class="tab tab-2"><a href="http://www.stressandanxietyguides.com/videos/" title="Videos">Videos</a></li><li class="rss"><a href="http://feeds2.feedburner.com/StressAnxietyGuide" title="Stress and Anxiety Guide RSS Feed" rel="nofollow">Subscribe</a></li></ul><div id="footer"><p><a href="http://www.stressandanxietyguides.com/privacy-policy/">Privacy Policy</a> | <a href="http://www.stressandanxietyguides.com/terms-of-service/">Terms Of Service</a> | <a href="http://www.stressandanxietyguides.com/sitemap/" >Sitemap</a> Copyright © 2010 Stress and Anxiety Guides</p></div> <script type="text/javascript">var _gaq=_gaq||[];_gaq.push(['_setAccount','UA-1284484-8']);_gaq.push(['_trackPageview']);(function(){var ga=document.createElement('script');ga.src=('https:'==document.location.protocol?'https://ssl':'http://www')+'.google-analytics.com/ga.js';ga.setAttribute('async','true');document.documentElement.firstChild.appendChild(ga);})();</script></div></div> <!--[if lte IE 7]><div id="ie_clear"></div> <![endif]--></body></html> <!-- This site's performance optimized by W3 Total Cache. Dramatically improve the speed and reliability of your blog! Learn more about our WordPress Plugins: http://www.w3-edge.com/wordpress-plugins/ Minified using disk Page Caching using disk (enhanced) (user agent is rejected) Database Caching 18/40 queries in 0.018 seconds using disk Content Delivery Network via Amazon Web Services: CloudFront: dmpyldved26gk.cloudfront.net Served from: 64.cb.85ae.static.theplanet.com @ 2010-03-10 18:46:21 -->