diff -r 53cff4b4a802 -r bde1974c263b web/wp-content/plugins/wp-cumulus/wp-cumulus.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/wp-content/plugins/wp-cumulus/wp-cumulus.php Wed Feb 03 15:37:20 2010 +0000 @@ -0,0 +1,399 @@ +. +*/ + + + + +// check for WP context +if ( !defined('ABSPATH') ){ die(); } + +//initially set the options +function wp_cumulus_install () { + $newoptions = get_option('wpcumulus_options'); + $newoptions['width'] = '100%'; + $newoptions['height'] = '100%'; + $newoptions['tcolor'] = '333333'; + $newoptions['tcolor2'] = '333333'; + $newoptions['hicolor'] = '333333'; + $newoptions['bgcolor'] = 'ffffff'; + $newoptions['speed'] = '100'; + $newoptions['trans'] = 'false'; + $newoptions['distr'] = 'true'; + $newoptions['args'] = ''; + $newoptions['compmode'] = 'false'; + $newoptions['showwptags'] = 'true'; + $newoptions['mode'] = 'tags'; + add_option('wpcumulus_options', $newoptions); + // widget options + $widgetoptions = get_option('wpcumulus_widget'); + $newoptions['width'] = '160'; + $newoptions['height'] = '160'; + $newoptions['tcolor'] = '333333'; + $newoptions['tcolor2'] = '333333'; + $newoptions['hicolor'] = '000000'; + $newoptions['bgcolor'] = 'ffffff'; + $newoptions['speed'] = '100'; + $newoptions['trans'] = 'false'; + $newoptions['distr'] = 'true'; + $newoptions['args'] = ''; + $newoptions['mode'] = 'tags'; + add_option('wpcumulus_widget', $newoptions); +} + +// add the admin page +function wp_cumulus_add_pages() { + add_options_page('WP Cumulus', 'WP Cumulus', 8, __FILE__, 'wp_cumulus_options'); +} + +// replace tag in content with tag cloud (non-shortcode version for WP 2.3.x) +function wp_cumulus_init($content){ + if( strpos($content, '[WP-CUMULUS]') === false ){ + return $content; + } else { + $code = wp_cumulus_createflashcode(false); + $content = str_replace( '[WP-CUMULUS]', $code, $content ); + return $content; + } +} + +// template function +function wp_cumulus_insert( $atts=NULL ){ + echo wp_cumulus_createflashcode( false, $atts ); +} + +// shortcode function +function wp_cumulus_shortcode( $atts=NULL ){ + return wp_cumulus_createflashcode( false, $atts ); +} + +// piece together the flash code +function wp_cumulus_createflashcode( $widget=false, $atts=NULL ){ + // get the options + if( $widget == true ){ + $options = get_option('wpcumulus_widget'); + $soname = "widget_so"; + $divname = "wpcumuluswidgetcontent"; + // get compatibility mode variable from the main options + $mainoptions = get_option('wpcumulus_options'); + $options['compmode'] = $mainoptions['compmode']; + $options['showwptags'] = $mainoptions['showwptags']; + } else if( $atts != NULL ){ + $options = shortcode_atts( get_option('wpcumulus_options'), $atts ); + $soname = "shortcode_so"; + $divname = "wpcumuluscontent"; + } else { + $options = get_option('wpcumulus_options'); + $soname = "so"; + $divname = "wpcumuluscontent"; + } + // get the tag cloud... + if( $options['mode'] != "cats" ){ + ob_start(); + wp_tag_cloud( $options['args'] ); + $tagcloud = urlencode( str_replace( " ", " ", ob_get_clean() ) ); + } + // get categories + if( $options['mode'] != "tags" ){ + ob_start(); + wp_list_categories('title_li=&show_count=1&hierarchical=0&style=none'); + $cats = urlencode( ob_get_clean() ); + } + // get some paths + if( function_exists('plugins_url') ){ + // 2.6 or better + $movie = plugins_url('wp-cumulus/tagcloud.swf'); + $path = plugins_url('wp-cumulus/'); + } else { + // pre 2.6 + $movie = get_bloginfo('wpurl') . "/wp-content/plugins/wp-cumulus/tagcloud.swf"; + $path = get_bloginfo('wpurl')."/wp-content/plugins/wp-cumulus/"; + } + // add random seeds to so name and movie url to avoid collisions and force reloading (needed for IE) + $soname .= rand(0,9999999); + $movie .= '?r=' . rand(0,9999999); + $divname .= rand(0,9999999); + // write flash tag + if( $options['compmode']!='true' ){ + $flashtag = ''; + $flashtag .= ''; + // ------------------------------------------------------------------------------------ + $flashtag .= '
'; } else { $flashtag .= '
+ > Tags
+ > Categories
+ > Both
+