--- 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 '<p><label for="' . $title_id .'">' . __( 'Title:' ) . '</label>
- <input type="text" class="widefat" id="' . $title_id .'" name="' . $this->get_field_name( 'title' ) .'" value="' . $instance['title'] .'" />
+ echo '<p><label for="' . $title_id . '">' . __( 'Title:' ) . '</label>
+ <input type="text" class="widefat" id="' . $title_id . '" name="' . $this->get_field_name( 'title' ) . '" value="' . $instance['title'] . '" />
</p>';
$taxonomies = get_taxonomies( array( 'show_tagcloud' => true ), 'object' );
- $id = $this->get_field_id( 'taxonomy' );
- $name = $this->get_field_name( 'taxonomy' );
- $input = '<input type="hidden" id="' . $id . '" name="' . $name . '" value="%s" />';
+ $id = $this->get_field_id( 'taxonomy' );
+ $name = $this->get_field_name( 'taxonomy' );
+ $input = '<input type="hidden" id="' . $id . '" name="' . $name . '" value="%s" />';
$count_checkbox = sprintf(
'<p><input type="checkbox" class="checkbox" id="%1$s" name="%2$s"%3$s /> <label for="%1$s">%4$s</label></p>',
@@ -142,40 +148,40 @@
switch ( count( $taxonomies ) ) {
- // No tag cloud supporting taxonomies found, display error message
- case 0:
- echo '<p>' . __( 'The tag cloud will not be displayed since there are no taxonomies that support the tag cloud widget.' ) . '</p>';
- printf( $input, '' );
- break;
+ // No tag cloud supporting taxonomies found, display error message
+ case 0:
+ echo '<p>' . __( 'The tag cloud will not be displayed since there are no taxonomies that support the tag cloud widget.' ) . '</p>';
+ 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(
- '<p><label for="%1$s">%2$s</label>' .
- '<select class="widefat" id="%1$s" name="%3$s">',
- $id,
- __( 'Taxonomy:' ),
- $name
- );
+ // More than one tag cloud supporting taxonomy found, display a select.
+ default:
+ printf(
+ '<p><label for="%1$s">%2$s</label>' .
+ '<select class="widefat" id="%1$s" name="%3$s">',
+ $id,
+ __( 'Taxonomy:' ),
+ $name
+ );
- foreach ( $taxonomies as $taxonomy => $tax ) {
- printf(
- '<option value="%s"%s>%s</option>',
- esc_attr( $taxonomy ),
- selected( $taxonomy, $current_taxonomy, false ),
- $tax->labels->name
- );
- }
+ foreach ( $taxonomies as $taxonomy => $tax ) {
+ printf(
+ '<option value="%s"%s>%s</option>',
+ esc_attr( $taxonomy ),
+ selected( $taxonomy, $current_taxonomy, false ),
+ $tax->labels->name
+ );
+ }
- echo '</select></p>' . $count_checkbox;
+ echo '</select></p>' . $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';
}