From bee55953116be9d3ba41a2d2cfbe5f9015dcc8c6 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 17 Apr 2020 09:36:25 +0000 Subject: [PATCH] Coding Standards: Format the markup of widget forms in a more consistent manner. See #49542. git-svn-id: https://develop.svn.wordpress.org/trunk@47593 602fd350-edb4-49c9-b593-d223f7449a82 --- .../widgets/class-wp-widget-archives.php | 11 ++- .../widgets/class-wp-widget-calendar.php | 6 +- .../widgets/class-wp-widget-categories.php | 22 +++-- .../widgets/class-wp-widget-links.php | 62 +++++++------- .../widgets/class-wp-widget-meta.php | 5 +- .../widgets/class-wp-widget-pages.php | 2 + .../class-wp-widget-recent-comments.php | 12 ++- .../widgets/class-wp-widget-recent-posts.php | 18 +++-- .../widgets/class-wp-widget-search.php | 5 +- .../widgets/class-wp-widget-tag-cloud.php | 81 +++++++++---------- 10 files changed, 129 insertions(+), 95 deletions(-) diff --git a/src/wp-includes/widgets/class-wp-widget-archives.php b/src/wp-includes/widgets/class-wp-widget-archives.php index 7df65d9335..2dfd60c7a5 100644 --- a/src/wp-includes/widgets/class-wp-widget-archives.php +++ b/src/wp-includes/widgets/class-wp-widget-archives.php @@ -197,11 +197,16 @@ class WP_Widget_Archives extends WP_Widget { ) ); ?> -

- id="get_field_id( 'dropdown' ); ?>" name="get_field_name( 'dropdown' ); ?>" /> + + +

+

+ id="get_field_id( 'dropdown' ); ?>" name="get_field_name( 'dropdown' ); ?>" /> +
- id="get_field_id( 'count' ); ?>" name="get_field_name( 'count' ); ?>" /> + id="get_field_id( 'count' ); ?>" name="get_field_name( 'count' ); ?>" /> +

'' ) ); ?> -

-

+

+ + +

-

-

+

+ + +

-

/> -
+

+ /> + +
- /> -
+ /> + +
- /> -

+ /> + +

- - - - + + + +

+

- id="get_field_id( 'images' ); ?>" name="get_field_name( 'images' ); ?>" /> -
- id="get_field_id( 'name' ); ?>" name="get_field_name( 'name' ); ?>" /> -
- id="get_field_id( 'description' ); ?>" name="get_field_name( 'description' ); ?>" /> -
- id="get_field_id( 'rating' ); ?>" name="get_field_name( 'rating' ); ?>" /> - + id="get_field_id( 'images' ); ?>" name="get_field_name( 'images' ); ?>" /> + +
+ + id="get_field_id( 'name' ); ?>" name="get_field_name( 'name' ); ?>" /> + +
+ + id="get_field_id( 'description' ); ?>" name="get_field_name( 'description' ); ?>" /> + +
+ + id="get_field_id( 'rating' ); ?>" name="get_field_name( 'rating' ); ?>" /> +

+

- - + +

'' ) ); ?> -

+

+ + +

get_field_id( 'title' ) ); ?>">

+

+

diff --git a/src/wp-includes/widgets/class-wp-widget-recent-comments.php b/src/wp-includes/widgets/class-wp-widget-recent-comments.php index 01b8d5989a..e9da5c1bdc 100644 --- a/src/wp-includes/widgets/class-wp-widget-recent-comments.php +++ b/src/wp-includes/widgets/class-wp-widget-recent-comments.php @@ -176,11 +176,15 @@ class WP_Widget_Recent_Comments extends WP_Widget { $title = isset( $instance['title'] ) ? $instance['title'] : ''; $number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5; ?> -

-

+

+ + +

-

-

+

+ + +

-

-

+

+ + +

-

-

+

+ + +

-

id="get_field_id( 'show_date' ); ?>" name="get_field_name( 'show_date' ); ?>" /> -

+

+ id="get_field_id( 'show_date' ); ?>" name="get_field_name( 'show_date' ); ?>" /> + +

'' ) ); $title = $instance['title']; ?> -

+

+ + +

_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 '

- -

'; - - $taxonomies = get_taxonomies( array( 'show_tagcloud' => true ), 'object' ); - $id = $this->get_field_id( 'taxonomy' ); - $name = $this->get_field_name( 'taxonomy' ); - $input = ''; - - $count_checkbox = sprintf( - '

', - $this->get_field_id( 'count' ), - $this->get_field_name( 'count' ), - checked( $count, true, false ), - __( 'Show tag counts' ) - ); + $title = ! empty( $instance['title'] ) ? $instance['title'] : ''; + $count = isset( $instance['count'] ) ? (bool) $instance['count'] : false; + ?> +

+ + +

+ true ), 'object' ); + $current_taxonomy = $this->_get_current_taxonomy( $instance ); 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, '' ); + ?> + +

+ +

+ + + ' . - ' + $tax ) : ?> + + + +

+ $tax ) { - printf( - '', - esc_attr( $taxonomy ), - selected( $taxonomy, $current_taxonomy, false ), - $tax->labels->name - ); - } - - echo '

' . $count_checkbox; + if ( count( $taxonomies ) > 0 ) { + ?> +

+ /> + +

+