Exemple #1
0
 function widget($args, $instance)
 {
     $cache = wp_cache_get('widget_tw', 'widget');
     if (!is_array($cache)) {
         $cache = array();
     }
     if (isset($cache[$args['widget_id']])) {
         return $cache[$args['widget_id']];
     }
     ob_start();
     extract($args);
     $title = apply_filters('widget_title', empty($instance['title']) ? __('Tags') : $instance['title']);
     $tagcloud = 'smallest=' . $instance['smallest'];
     $tagcloud .= '&largest=' . $instance['largest'];
     $tagcloud .= '&mincolor=' . $instance['mincolor'];
     $tagcloud .= '&maxcolor=' . $instance['maxcolor'];
     $tagcloud .= '&unit=' . $instance['unit'];
     $tagcloud .= '&format=' . $instance['format'];
     $tagcloud .= '&number=' . $instance['number'];
     $tagcloud .= '&minnum=' . $instance['minnum'];
     $tagcloud .= '&maxnum=' . $instance['maxnum'];
     $tagcloud .= '&orderby=' . $instance['orderby'];
     $tagcloud .= '&order=' . $instance['order'];
     $tagcloud .= '&showcount=' . $instance['showcount'];
     $tagcloud .= '&showcats=' . $instance['showcats'];
     $tagcloud .= '&showtags=' . $instance['showtags'];
     $tagcloud .= '&empty=' . $instance['empty'];
     $tagcloud .= '&widget=yes';
     echo $before_widget;
     echo $before_title . $title . $after_title;
     echo '<div class="tw">';
     wdgt_tw($tagcloud);
     echo '</div>';
     echo $after_widget;
     $cache[$args['widget_id']] = ob_get_flush();
     wp_cache_add('widget_tw', $cache, 'widget');
 }
Exemple #2
0
 function widget_tw($args)
 {
     extract($args);
     $defaults = array('title' => 'Tags', 'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => '', 'minnum' => 0, 'maxnum' => 100, 'format' => 'flat', 'orderby' => 'name', 'order' => 'ASC', 'exclude' => '', 'include' => '', 'mincolor' => '', 'maxcolor' => '', 'showcount' => 'no', 'showtags' => 'yes', 'showcats' => 'no', 'empty' => 'no', 'widget' => 'yes');
     $options = (array) get_option('widget_tw');
     foreach ($defaults as $key => $value) {
         if ($options[$key] == "") {
             $options[$key] = $defaults[$key];
         }
     }
     $tagcloud = 'smallest=' . $options['smallest'];
     $tagcloud .= '&largest=' . $options['largest'];
     $tagcloud .= '&mincolor=' . $options['mincolor'];
     $tagcloud .= '&maxcolor=' . $options['maxcolor'];
     $tagcloud .= '&unit=' . $options['unit'];
     $tagcloud .= '&format=' . $options['format'];
     $tagcloud .= '&number=' . $options['number'];
     $tagcloud .= '&minnum=' . $options['minnum'];
     $tagcloud .= '&maxnum=' . $options['maxnum'];
     $tagcloud .= '&orderby=' . $options['orderby'];
     $tagcloud .= '&order=' . $options['order'];
     $tagcloud .= '&showcount=' . $options['showcount'];
     $tagcloud .= '&showcats=' . $options['showcats'];
     $tagcloud .= '&showtags=' . $options['showtags'];
     $tagcloud .= '&empty=' . $options['empty'];
     echo $before_widget;
     echo $before_title . $options['title'] . $after_title;
     echo '<div class="tw">';
     wdgt_tw($tagcloud);
     echo '</div>';
     echo $after_widget;
 }