Coding Standards: Fix WPCS issues in WP_Widget_Links and WP_Widget_Pages.

Props itowhid06.
Fixes #48228.

git-svn-id: https://develop.svn.wordpress.org/trunk@46415 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2019-10-06 15:26:42 +00:00
parent 3a06234fe4
commit a59b9dd39e
2 changed files with 3 additions and 3 deletions

View File

@ -45,7 +45,7 @@ class WP_Widget_Links extends WP_Widget {
$show_images = isset( $instance['images'] ) ? $instance['images'] : true;
$category = isset( $instance['category'] ) ? $instance['category'] : false;
$orderby = isset( $instance['orderby'] ) ? $instance['orderby'] : 'name';
$order = $orderby == 'rating' ? 'DESC' : 'ASC';
$order = 'rating' === $orderby ? 'DESC' : 'ASC';
$limit = isset( $instance['limit'] ) ? $instance['limit'] : -1;
$before_widget = preg_replace( '/id="[^"]*"/', 'id="%id"', $args['before_widget'] );
@ -175,7 +175,7 @@ class WP_Widget_Links extends WP_Widget {
</p>
<p>
<label for="<?php echo $this->get_field_id( 'limit' ); ?>"><?php _e( 'Number of links to show:' ); ?></label>
<input id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="text" value="<?php echo $limit == -1 ? '' : intval( $limit ); ?>" size="3" />
<input id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="text" value="<?php echo ( -1 !== $limit ) ? intval( $limit ) : ''; ?>" size="3" />
</p>
<?php
}

View File

@ -56,7 +56,7 @@ class WP_Widget_Pages extends WP_Widget {
$sortby = empty( $instance['sortby'] ) ? 'menu_order' : $instance['sortby'];
$exclude = empty( $instance['exclude'] ) ? '' : $instance['exclude'];
if ( $sortby == 'menu_order' ) {
if ( 'menu_order' === $sortby ) {
$sortby = 'menu_order, post_title';
}