diff -r c7c34916027a -r 177826044cd9 wp/wp-includes/widgets/class-wp-widget-tag-cloud.php --- a/wp/wp-includes/widgets/class-wp-widget-tag-cloud.php Mon Oct 14 18:06:33 2019 +0200 +++ b/wp/wp-includes/widgets/class-wp-widget-tag-cloud.php Mon Oct 14 18:28:13 2019 +0200 @@ -23,7 +23,7 @@ */ public function __construct() { $widget_ops = array( - 'description' => __( 'A cloud of your most used tags.' ), + 'description' => __( 'A cloud of your most used tags.' ), 'customize_selective_refresh' => true, ); parent::__construct( 'tag_cloud', __( 'Tag Cloud' ), $widget_ops ); @@ -47,7 +47,7 @@ if ( 'post_tag' === $current_taxonomy ) { $title = __( 'Tags' ); } else { - $tax = get_taxonomy( $current_taxonomy ); + $tax = get_taxonomy( $current_taxonomy ); $title = $tax->labels->name; } } @@ -66,11 +66,17 @@ * @param array $args Args used for the tag cloud widget. * @param array $instance Array of settings for the current widget. */ - $tag_cloud = wp_tag_cloud( apply_filters( 'widget_tag_cloud_args', array( - 'taxonomy' => $current_taxonomy, - 'echo' => false, - 'show_count' => $show_count, - ), $instance ) ); + $tag_cloud = wp_tag_cloud( + apply_filters( + 'widget_tag_cloud_args', + array( + 'taxonomy' => $current_taxonomy, + 'echo' => false, + 'show_count' => $show_count, + ), + $instance + ) + ); if ( empty( $tag_cloud ) ) { return; @@ -103,10 +109,10 @@ * @return array Settings to save or bool false to cancel saving. */ public function update( $new_instance, $old_instance ) { - $instance = array(); - $instance['title'] = sanitize_text_field( $new_instance['title'] ); - $instance['count'] = ! empty( $new_instance['count'] ) ? 1 : 0; - $instance['taxonomy'] = stripslashes($new_instance['taxonomy']); + $instance = array(); + $instance['title'] = sanitize_text_field( $new_instance['title'] ); + $instance['count'] = ! empty( $new_instance['count'] ) ? 1 : 0; + $instance['taxonomy'] = stripslashes( $new_instance['taxonomy'] ); return $instance; } @@ -118,19 +124,19 @@ * @param array $instance Current settings. */ public function form( $instance ) { - $current_taxonomy = $this->_get_current_taxonomy($instance); - $title_id = $this->get_field_id( 'title' ); - $count = isset( $instance['count'] ) ? (bool) $instance['count'] : false; + $current_taxonomy = $this->_get_current_taxonomy( $instance ); + $title_id = $this->get_field_id( 'title' ); + $count = isset( $instance['count'] ) ? (bool) $instance['count'] : false; $instance['title'] = ! empty( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; - echo '
- + echo '
+
'; $taxonomies = get_taxonomies( array( 'show_tagcloud' => true ), 'object' ); - $id = $this->get_field_id( 'taxonomy' ); - $name = $this->get_field_name( 'taxonomy' ); - $input = ''; + $id = $this->get_field_id( 'taxonomy' ); + $name = $this->get_field_name( 'taxonomy' ); + $input = ''; $count_checkbox = sprintf( '', @@ -142,40 +148,40 @@ switch ( count( $taxonomies ) ) { - // No tag cloud supporting taxonomies found, display error message - case 0: - echo '
' . __( 'The tag cloud will not be displayed since there are no taxonomies that support the tag cloud widget.' ) . '
'; - printf( $input, '' ); - break; + // No tag cloud supporting taxonomies found, display error message + case 0: + echo '' . __( 'The tag cloud will not be displayed since there are no taxonomies that support the tag cloud widget.' ) . '
'; + printf( $input, '' ); + break; - // Just a single tag cloud supporting taxonomy found, no need to display a select. - case 1: - $keys = array_keys( $taxonomies ); - $taxonomy = reset( $keys ); - printf( $input, esc_attr( $taxonomy ) ); - echo $count_checkbox; - break; + // Just a single tag cloud supporting taxonomy found, no need to display a select. + case 1: + $keys = array_keys( $taxonomies ); + $taxonomy = reset( $keys ); + printf( $input, esc_attr( $taxonomy ) ); + echo $count_checkbox; + break; - // More than one tag cloud supporting taxonomy found, display a select. - default: - printf( - '' . - '
' . $count_checkbox; } } @@ -187,9 +193,10 @@ * @param array $instance Current settings. * @return string Name of the current taxonomy if set, otherwise 'post_tag'. */ - public function _get_current_taxonomy($instance) { - if ( !empty($instance['taxonomy']) && taxonomy_exists($instance['taxonomy']) ) + public function _get_current_taxonomy( $instance ) { + if ( ! empty( $instance['taxonomy'] ) && taxonomy_exists( $instance['taxonomy'] ) ) { return $instance['taxonomy']; + } return 'post_tag'; }