| 1 | <?php |
|---|
| 2 | /* |
|---|
| 3 | Plugin Name: Tag Clout for 2.2-bleeding |
|---|
| 4 | Description: Shows the Tag-Cloud |
|---|
| 5 | Author: Bauer Christoph |
|---|
| 6 | Version: 1.0 |
|---|
| 7 | Author URI: http://my.stargazer.at |
|---|
| 8 | */ |
|---|
| 9 | |
|---|
| 10 | function widget_tagcloud_init() { |
|---|
| 11 | if ( !function_exists('register_sidebar_widget') AND !function_exists('register_widget_control') ) |
|---|
| 12 | return; |
|---|
| 13 | |
|---|
| 14 | function widget_tagcloud($args) { |
|---|
| 15 | extract($args); |
|---|
| 16 | $options=get_option('widget_tagcloud'); |
|---|
| 17 | $title=$options['title']; |
|---|
| 18 | |
|---|
| 19 | echo $before_widget . $before_title . $title . $after_title; |
|---|
| 20 | wp_tag_cloud(); |
|---|
| 21 | echo $after_widget; |
|---|
| 22 | } |
|---|
| 23 | |
|---|
| 24 | function widget_tagcloud_control() { |
|---|
| 25 | $options = $newoptions = get_option('widget_tagcloud'); |
|---|
| 26 | if ( $_POST['tagcloud-submit'] ) { |
|---|
| 27 | $newoptions['title'] = strip_tags(stripslashes($_POST['tagcloud-title'])); |
|---|
| 28 | } |
|---|
| 29 | if ( $options != $newoptions ) { |
|---|
| 30 | $options = $newoptions; |
|---|
| 31 | update_option('widget_tagcloud', $options); |
|---|
| 32 | } |
|---|
| 33 | ?> |
|---|
| 34 | |
|---|
| 35 | <div style="text-align:right"> |
|---|
| 36 | <label for="tagcloud-title" style="line-height:35px;display:block;">Title: <input type="text" id="tagcloud-title" name="tagcloud-title" value="<?=htmlspecialchars($options['title'])?>" /></label> |
|---|
| 37 | <input type="hidden" name="tagcloud-submit" id="tagcloud-submit" value="1" /> |
|---|
| 38 | </div> |
|---|
| 39 | <?php |
|---|
| 40 | } |
|---|
| 41 | register_sidebar_widget('tagcloud embedded', 'widget_tagcloud'); |
|---|
| 42 | register_widget_control('tagcloud embedded', 'widget_tagcloud_control',300,200); |
|---|
| 43 | } |
|---|
| 44 | |
|---|
| 45 | add_action('plugins_loaded', 'widget_tagcloud_init'); |
|---|
| 46 | ?> |
|---|