WordPress.org

Make WordPress Core

Ticket #5770: default-widgets.php_11605-5770.diff

File default-widgets.php_11605-5770.diff, 3.9 KB (added by AndrewFrazier, 9 years ago)

Updated patch. Fixes bugs.

  • wp-includes/default-widgets.php

     
    966966                extract($args);
    967967                $title = apply_filters('widget_title', empty($instance['title']) ? __('Tags') : $instance['title']);
    968968
     969                $largest = isset($instance['largest']) ? $instance['largest'] : 22;
     970                $number = isset($instance['number']) ? $instance['number'] : 0;
     971                $format = isset($instance['format']) ? $instance['format'] : 'flat';
     972                $orderby = isset($instance['orderby']) ? $instance['orderby'] : 'name';
     973                $order = isset($instance['order']) ? $instance['order'] : 'ASC';
     974
    969975                echo $before_widget;
    970976                if ( $title )
    971977                        echo $before_title . $title . $after_title;
    972978                echo '<div>';
    973                 wp_tag_cloud(apply_filters('widget_tag_cloud_args', array()));
     979                wp_tag_cloud(apply_filters('widget_tag_cloud_args', array('largest' => $largest, 'number' => $number, 'format' => $format, 'orderby' => $orderby, 'order' => $order )));
    974980                echo "</div>\n";
    975981                echo $after_widget;
    976982        }
    977983
    978984        function update( $new_instance, $old_instance ) {
    979985                $instance['title'] = strip_tags(stripslashes($new_instance['title']));
     986                $instance['largest'] = $new_instance['largest'];
     987                $instance['number'] = $new_instance['number'];
     988                $instance['format'] = strip_tags(stripslashes($new_instance['format']));
     989                $instance['orderby'] = strip_tags(stripslashes($new_instance['orderby']));
     990                $instance['order'] = strip_tags(stripslashes($new_instance['order']));
    980991                return $instance;
    981992        }
    982993
     
    984995?>
    985996        <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:') ?></label>
    986997        <input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr( $instance['title'] ); ?>" /></p>
     998        <p><label for="<?php echo $this->get_field_id('largest'); ?>">
     999        <?php _e('Maximum Font Size:'); ?>
     1000        <input type="text" class="widefat" id="<?php echo $this->get_field_id('largest'); ?>" name="<?php echo $this->get_field_name('largest'); ?>" value="<?php echo esc_attr($instance['largest']); ?>" size="4" />
     1001        </label></p>
     1002        <p><label for="<?php echo $this->get_field_id('number'); ?>">
     1003        <?php _e('Number to show:'); ?>
     1004        <input type="text" class="widefat" id="<?php echo $this->get_field_id('number'); ?>" name="<?php echo $this->get_field_name('number'); ?>" value="<?php echo esc_attr($instance['number']); ?>" size="4" />
     1005        </label></p>
     1006        <p><label for="<?php echo $this->get_field_id('format'); ?>">
     1007        <?php _e('Display Format:'); ?>
     1008        <select class="widefat" size="1" id="<?php echo $this->get_field_id('format'); ?>" name="<?php echo $this->get_field_name('format'); ?>">
     1009                <option value="flat" <?php selected($instance['format'], 'flat') ?>><?php _e('Flat'); ?></option>
     1010                <option value="list" <?php selected($instance['format'], 'list') ?>><?php _e('List'); ?></option>
     1011        </select></label></p>
     1012        <p><label for="<?php echo $this->get_field_id('orderby'); ?>">
     1013        <?php _e('Order By:'); ?>
     1014        <select class="widefat" size="1" id="<?php echo $this->get_field_id('orderby'); ?>" name="<?php echo $this->get_field_name('orderby'); ?>">
     1015                <option value="name" <?php selected($instance['orderby'], 'name') ?>><?php _e('Name'); ?></option>
     1016                <option value="count" <?php selected($instance['orderby'], 'count') ?>><?php _e('Count'); ?></option>
     1017        </select></label></p>
     1018        <p><label for="<?php echo $this->get_field_id('order'); ?>">
     1019        <?php _e('Order:'); ?>
     1020        <select class="widefat" size="1" id="<?php echo $this->get_field_id('order'); ?>" name="<?php echo $this->get_field_name('order'); ?>">
     1021                <option value="ASC" <?php selected($instance['order'], 'ASC' )?>><?php _e('Ascending'); ?></option>
     1022                <option value="DESC" <?php selected($instance['order'], 'DESC') ?>><?php _e('Descending'); ?></option>
     1023        </select></label></p>
     1024
    9871025<?php
    9881026        }
    9891027}