Visit widget page for more information.
Version: 1.00
Author: IOIX Ukraine
Author URI: http://ioix.com.ua
Copyright 2009, IOIX Ukraine
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
//initially set the options
function wp_7feeds_install () {
$newoptions = get_option('wp7feeds_options');
$newoptions['x_size'] = '180';
$newoptions['y_size'] = '320';
$newoptions['summary_length'] = '300';
$newoptions['scroll_speed'] = '50';
$newoptions['num_of_entries'] = '5';
$newoptions['pause_time'] = '3000';
$newoptions['open_new_window'] = '1';
$newoptions['feed_url'] = 'http://news.bbc.co.uk/';
$newoptions['strip_tags'] = '0';
$newoptions['theme'] = '0';
$newoptions['widget_header'] = '1';
$newoptions['news_content'] = '1';
$newoptions['pub_time'] = '1';
$newoptions['widget_title'] = '';
$newoptions['widget_promote'] = '1';
add_option('wp7feeds_options', $newoptions);
}
// add the admin page
function wp_7feeds_add_pages() {
add_options_page('7feeds ticker', '7feeds ticker', 8, __FILE__, 'wp_7feeds_options');
}
// replace tag in content with tag cloud (non-shortcode version for WP 2.3.x)
function wp_7feeds_init($content){
if( strpos($content, '[WP-7feeds]') === false ){
return $content;
} else {
$code = wp_7feeds_createflashcode(false);
$content = str_replace( '[WP-7feeds]', $code, $content );
return $content;
}
}
// template function
function wp_7feeds_insert( $atts=NULL ){
echo wp_7feeds_createflashcode( false, $atts );
}
// shortcode function
function wp_7feeds_shortcode( $atts=NULL ){
return wp_7feeds_createflashcode( false, $atts );
}
// piece together the flash code
function wp_7feeds_createflashcode( $widget=false, $atts=NULL, $widget_options = array() ){
static $aWidgetIds;
if (!isset($aWidgetIds)) {
$aWidgetIds = array();
}
//Gen id
while (true) {
srand(time());
$num = rand(1,1000000);
if (!in_array($num, $aWidgetIds)) {
break;
}
}
$aWidgetIds[] = $num;
//Get options
if ($widget && !empty($widget_options)) {
$options = $widget_options;
}
$atOptions = get_option('wp7feeds_options');
foreach ($atOptions as $key=>$val) {
if (!isset($options[$key]) || $options[$key] == '') {
$options[$key] = $val;
}
}
// get some paths
if( function_exists('plugins_url') ){
// 2.6 or better
$movie = plugins_url('wp-7feeds/rssinformer.swf');
$path = plugins_url('wp-7feeds/');
} else {
// pre 2.6
$movie = get_bloginfo('wpurl') . "/wp-content/plugins/wp-7feeds/rssinformer.swf";
$path = get_bloginfo('wpurl')."/wp-content/plugins/wp-7feeds/";
}
$flashCode = '';
$flashCode .= '