get_option('anyfeed_pause_rate'), 'fade_rate' => get_option('anyfeed_fade_rate'), 'media_type' => get_option('anyfeed_media_type'), 'loading_text' => addslashes(get_option('anyfeed_loading_text')), 'title_bar' => $t['titlebar'], 'perm_title_bar' => $t['perm_title_bar'], 'navigation' => $t['navigation'], 'c_width' => get_option('anyfeed_width'), 'c_height' => get_option('anyfeed_bgcolor'), 'c_height' => get_option('anyfeed_height'), 'bgcolor' => get_option('anyfeed_bgcolor'), 'target' => get_option('anyfeed_target'), 'xml_url' => anyfeed_pathTo().'/anyfeed_slideshow.php?xml', 'maximages' => get_option('anyfeed_maximages') ); return(urlencode(serialize($return))); }} ///////////////////////////////////////////////////////////////////////////////// errorXML if(!function_exists('errorXML')) { function errorXML($title, $link='http://wordpress.org/tags/anyfeed-slideshow') { return( ''."\r\n". ''."\r\n". ' '."\r\n". ' 50 Random APR Listings, 2 Million +, Residential'."\r\n". ' http://www.apr.com/'."\r\n". ' APR Datafeed Framework'."\r\n". ' '."\r\n". ' '."\r\n". ' '.$title.''."\r\n". ' '.$link.''."\r\n". ' '."\r\n". ' '."\r\n". ' '."\r\n". ' '."\r\n". ''."\r\n" ); }} ////////////////////////////////////////////////////////////////////////// anyfeed_getFile if(!function_exists('anyfeed_getFile')) { function anyfeed_getFile($display = false) { $urla = explode("://", get_option('anyfeed_feed_url')); if(isset($urla[1])) { $url = $urla[1]; } $url = 'http://'.$url; if(function_exists('curl_init')) { $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_HEADER, 0); ob_start(); curl_exec ($ch); curl_close ($ch); $content = ob_get_contents(); ob_end_clean(); } elseif(ini_get('allow_url_fopen')) { // Check fopen $handle = fopen($url, 'r'); if(!$handle){ die("Failed to open url".get_option('anyfeed_feed_url')); } $content = stream_get_contents($handle); fclose($handle); } else { return(errorxml('No available file transfer tools')); } // This alters scripts for JS parsing compatability with all browsers. $content = preg_replace('/|.*?<\/description>)/s', 'true', $content); $content = preg_replace('/(|?.*?<\/media:title>)/s', '', $content); $content = preg_replace('/&(amp;)?/', '&', $content); if(preg_match('/flickr.com/', get_option('anyfeed_feed_url'))) { /* Resize photos from Flickr */ return preg_replace('/(flickr.com\/[\d]*?\/[\d]*?_.*?_)s\.((jpg|gif|png)") height="75" width="75"/', '$1m.$2', $content); } elseif(preg_match('/picasaweb.google.com/', get_option('anyfeed_feed_url'))) { /* Resize photos from Google */ return preg_replace('/(url=\'http:\/\/.*?\.ggpht\.com\/.*?\/.*?\/.*?\/.*?\/s)[\d]*?(\/.*?\.(jpg|JPG|jpeg|JPEG|gif|GIF|png|PNG)\' height=\').*?(\' width=\').*?(\')/', "\${1}240\${2}240\${4}240\${5}", $content);} else { return $content; } }} ########################################################################################## # XML PASSER # ########################################################################################## if(isset($_GET['xml'])) { header('HTTP/1.1 200 OK'); // header ("Content-Type: text/plain"); header ("Content-Type: text/xml"); print(anyfeed_getFile(true)); die; } ########################################################################################## # WP PLUGIN DEFINITION # ########################################################################################## /////////////////////////////////////////////////////////////////////////// Head Additions add_action('wp_head', 'anyfeed_head' ); function anyfeed_head(){print("\r\n". ''."\r\n". ''."\r\n" );} //////////////////////////////////////////////////////////////////////// Widget Initiation add_action( 'widgets_init', 'anyfeed_init' ); function anyfeed_init() { register_widget( 'anyfeed_slideshow' ); } ////////////////////////////////////////////////////////////////// Widget Class Definition class anyfeed_slideshow extends WP_Widget { function anyfeed_slideshow() { /* Widget settings. */ $widget_ops = array( 'classname' => 'anyfeed', 'description' => 'XML/RSS/ATOM slideshow widget engine.'); /* Widget control settings. */ $control_ops = array( 'width' => 245, 'height' => 200, 'id_base' => 'anyfeed'); /* Create the widget. */ $this->WP_Widget( 'anyfeed', 'Anyfeed Slideshow', $widget_ops, $control_ops ); wp_enqueue_script('jquery'); } //////////////////////////////////////////////////////////////////////// Widget Definition function widget( $args, $instance ) { extract( $args ); // Title echo $before_widget . $before_title . $instance['title'] . $after_title; // Drawing Widget echo '
'; echo $after_widget; } ///////////////////////////////////////////////////////////////// Settings Update Function function update( $new_instance, $old_instance ) { $instance = $old_instance; $instance['title'] = strip_tags( $new_instance['title'] ); $instance['width'] = strip_tags( $new_instance['width'] ); update_option('anyfeed_width', $instance['width']); $instance['height'] = strip_tags( $new_instance['height'] ); update_option('anyfeed_height', $instance['height']); $instance['feed_url'] = $new_instance['feed_url']; update_option('anyfeed_feed_url', $instance['feed_url']); if($new_instance['show_titlebar'] == 'on') { $new_instance['show_titlebar'] = true; } else { $new_instance['show_titlebar'] = false; } $instance['show_titlebar'] = $new_instance['show_titlebar']; update_option('anyfeed_show_titlebar', $instance['show_titlebar']); if($new_instance['perm_titlebar'] == 'on') { $new_instance['perm_titlebar'] = true; } else { $new_instance['perm_titlebar'] = false; } $instance['perm_titlebar'] = $new_instance['perm_titlebar']; update_option('anyfeed_perm_titlebar', $instance['perm_titlebar']); if($new_instance['show_navigation'] == 'on') { $new_instance['show_navigation'] = true; } else { $new_instance['show_navigation'] = false; } $instance['show_navigation'] = $new_instance['show_navigation']; update_option('anyfeed_show_navigation', $instance['show_navigation']); $instance['pause_rate'] = $new_instance['pause_rate']; update_option('anyfeed_pause_rate', $instance['pause_rate']); $instance['fade_rate'] = $new_instance['fade_rate']; update_option('anyfeed_fade_rate', $instance['fade_rate']); $instance['loading_text'] = $new_instance['loading_text']; update_option('anyfeed_loading_text', $instance['loading_text']); $instance['media_type'] = $new_instance['media_type']; update_option('anyfeed_media_type', $instance['media_type']); $instance['bgcolor'] = $new_instance['bgcolor']; update_option('anyfeed_bgcolor', $instance['bgcolor']); $instance['maximages'] = $new_instance['maximages']; update_option('anyfeed_maximages', $instance['maximages']); $instance['target'] = $new_instance['target']; update_option('anyfeed_target', $instance['target']); if($new_instance['cache'] == 'on') { $new_instance['cache'] = true; } else { $new_instance['cache'] = false; } $instance['cache'] = $new_instance['cache']; update_option('anyfeed_cache', $instance['cache']); return $instance; } //////////////////////////////////////////////////////////////////// Widget Options Window function form( $instance ) { print( ''."\r\n". '

(Hover your mouse over the label text for a short description of the corresponding field)

'."\r\n"); /* Default Widget Settings. */ $defaults = array( 'title' => 'Anyfeed Slideshow', 'width' => '100%', 'height' => '200px', 'feed_url' => 'http://api.flickr.com/services/feeds/photos_public.gne?format=rss_200', 'show_titlebar' => true, 'perm_titlebar' => false, 'show_navigation' => true, 'pause_rate' => 5000, 'fade_rate' => 1000, 'maximages' => 50, 'loading_text' => 'Loading...', 'media_type' => 'thumbnail', 'bgcolor' => 'transparent', 'target' => '_blank', 'cache' => false ); $instance = wp_parse_args( $instance, $defaults ); ?>
Basic Options

Display Options
Feed Options
Timing Options