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 .= '
'; + if( $options['showwptags'] == 'true' ){ $flashtag .= '

'; } else { $flashtag .= '

'; }; + // alternate content + if( $options['mode'] != "cats" ){ $flashtag .= urldecode($tagcloud); } + if( $options['mode'] != "tags" ){ $flashtag .= urldecode($cats); } + $flashtag .= '

'; + $flashtag .= ''; + } else { + $flashtag = ''; + $flashtag .= ''; + $flashtag .= ''; + $flashtag .= ''; + $flashtag .= ''; + if( $options['trans'] == 'true' ){ + $flashtag .= ''; + } + $flashtag .= '') . $tagcloud . urlencode(''); + } + // put categories in flashvar + if( $options['mode'] != "tags" ){ + $flashtag .= '&categories=' . $cats; + } + $flashtag .= '" />'; + // alternate content + if( $options['mode'] != "cats" ){ $flashtag .= '

'.urldecode($tagcloud).'

'; } + if( $options['mode'] != "tags" ){ $flashtag .= '

'.urldecode($cats).'

'; } + $flashtag .= ''; + $flashtag .= '
'; + } + return $flashtag; +} + +// options page +function wp_cumulus_options() { + $options = $newoptions = get_option('wpcumulus_options'); + // if submitted, process results + if ( $_POST["wpcumulus_submit"] ) { + $newoptions['width'] = strip_tags(stripslashes($_POST["width"])); + $newoptions['height'] = strip_tags(stripslashes($_POST["height"])); + $newoptions['tcolor'] = strip_tags(stripslashes($_POST["tcolor"])); + $newoptions['tcolor2'] = strip_tags(stripslashes($_POST["tcolor2"])); + $newoptions['hicolor'] = strip_tags(stripslashes($_POST["hicolor"])); + $newoptions['bgcolor'] = strip_tags(stripslashes($_POST["bgcolor"])); + $newoptions['trans'] = strip_tags(stripslashes($_POST["trans"])); + $newoptions['speed'] = strip_tags(stripslashes($_POST["speed"])); + $newoptions['distr'] = strip_tags(stripslashes($_POST["distr"])); + $newoptions['mode'] = strip_tags(stripslashes($_POST["mode"])); + $newoptions['args'] = strip_tags(stripslashes($_POST["args"])); + $newoptions['compmode'] = strip_tags(stripslashes($_POST["compmode"])); + $newoptions['showwptags'] = strip_tags(stripslashes($_POST["showwptags"])); + } + // any changes? save! + if ( $options != $newoptions ) { + $options = $newoptions; + update_option('wpcumulus_options', $options); + } + // options form + echo '
'; + echo "

Display options

"; + echo ''; + // width + echo ''; + echo ''; + // height + echo ''; + echo ''; + // text color + echo ''; + echo ''; + // background color + echo ''; + echo ''; + // transparent + echo ''; + echo ''; + // speed + echo ''; + echo ''; + // distribution + echo ''; + echo ''; + // end table + echo '
Width of the Flash tag cloud
Width in pixels (500 or more is recommended)
Height of the Flash tag cloud
Height in pixels (ideally around 3/4 of the width)
Color of the tags Optional second color for gradient: Optional highlighl color:
These should be 6 character hex color values without the # prefix (000000 for black, ffffff for white)
Background color
6 character hex color value
Use transparent mode
Switches on Flash\'s wmode-transparent setting
Rotation speed
Speed (percentage, default is 100)
Distribute tags evenly on sphere
Places tags at equal intervals instead of random
'; + // tags, cats? + echo '

Output options

'; + echo ''; + echo ''; + echo '
Display: Tags
Categories
Both (you may want to consider lowering the number of tags , using the advanced options below)'; + // end table + echo '
'; + // advanced options + echo '

Advanced options

Please leave this setting empty unless you know what you\'re doing.

'; + echo ''; + // arguments + echo ''; + echo ''; + // compatibility mode + echo ''; + echo ''; + // show regular tag in alternate content? + echo ''; + echo ''; + // close stuff + echo ''; + echo '
wp_tag_cloud parameters
Parameter string for wp_tag_cloud (see the codex for more details)

Example uses
number=20 - limit the number of tags to 20
smallest=5&largest=50 - specify custom font sizes

Known issues
  • Currently, the \'units\', \'orderby\' and \'order\' parameters are not supported.
  • Setting \'format\' to anything but \'flat\' will cause the plugin to fail.
Use compatibility mode?
Enabling this option switches the plugin to a different way of embedding Flash into the page. Use this if your page has markup errors or if you\'re having trouble getting WP-Cumulus to display correctly. This affects both the shortcode version and the widget.
Show the regular HTML tag cloud?
Un-hides the regular HTML tag cloud that may appear for a second or so before it is replaced by the Flash one. Turn this on if SEO and/or non-flash users are a major concern for you. This option affects both the shortcode version and the widget.
'; + echo '

'; + echo "
"; + echo '
'; + +} + +//uninstall all options +function wp_cumulus_uninstall () { + delete_option('cumulus_options'); + delete_option('cumulus_widget'); +} + + +// widget +function widget_init_wp_cumulus_widget() { + // Check for required functions + + if (!function_exists('register_sidebar_widget')) + return; + + function wp_cumulus_widget($args){ + extract($args); + $options = get_option('wpcumulus_widget'); + ?> + + + + + + + +

+

+

+

+

+

+

+

+

+

+

+ > Tags
+ > Categories
+ > Both +

+

+ + \ No newline at end of file