General: Fix some precision alignment formatting warnings.

The WPCS `WordPress.WhiteSpace.PrecisionAlignment` rule throws warnings for a bunch of code that will likely cause issues for `wpcbf`. Fixing these manually beforehand gives us better auto-fixed results later.

See #41057.


Built from https://develop.svn.wordpress.org/trunk@42228


git-svn-id: http://core.svn.wordpress.org/trunk@42057 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Gary Pendergast 2017-11-26 23:57:55 +00:00
parent 611c090b41
commit c90cfa3b50
63 changed files with 265 additions and 262 deletions

View File

@ -277,8 +277,7 @@ function wp_update_link( $linkdata ) {
$link = wp_slash( $link );
// Passed link category list overwrites existing category list if not empty.
if ( isset( $linkdata['link_category'] ) && is_array( $linkdata['link_category'] )
&& 0 != count( $linkdata['link_category'] ) )
if ( isset( $linkdata['link_category'] ) && is_array( $linkdata['link_category'] ) && 0 != count( $linkdata['link_category'] ) )
$link_cats = $linkdata['link_category'];
else
$link_cats = $link['link_category'];

View File

@ -136,8 +136,8 @@ switch ( $post->post_status ) {
<option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Draft') ?></option>
<?php endif; ?>
</select>
<a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e('OK'); ?></a>
<a href="#post_status" class="cancel-post-status hide-if-no-js button-cancel"><?php _e('Cancel'); ?></a>
<a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e('OK'); ?></a>
<a href="#post_status" class="cancel-post-status hide-if-no-js button-cancel"><?php _e('Cancel'); ?></a>
</div>
<?php } ?>

View File

@ -628,8 +628,10 @@ function install_plugin_information() {
) );
?>
<div class="counter-container">
<span class="counter-label"><a href="https://wordpress.org/support/view/plugin-reviews/<?php echo $api->slug; ?>?filter=<?php echo $key; ?>"
target="_blank" aria-label="<?php echo $aria_label; ?>"><?php printf( _n( '%d star', '%d stars', $key ), $key ); ?></a></span>
<span class="counter-label">
<a href="https://wordpress.org/support/view/plugin-reviews/<?php echo $api->slug; ?>?filter=<?php echo $key; ?>"
target="_blank" aria-label="<?php echo $aria_label; ?>"><?php printf( _n( '%d star', '%d stars', $key ), $key ); ?></a>
</span>
<span class="counter-back">
<span class="counter-bar" style="width: <?php echo 92 * $_rating; ?>px;"></span>
</span>

View File

@ -65,6 +65,7 @@ function _wp_translate_postdata( $update = false, $post_data = null ) {
if ( isset( $post_data['user_ID'] ) && ( $post_data['post_author'] != $post_data['user_ID'] )
&& ! current_user_can( $ptype->cap->edit_others_posts ) ) {
if ( $update ) {
if ( 'page' == $post_data['post_type'] )
return new WP_Error( 'edit_others_pages', __( 'Sorry, you are not allowed to edit pages as this user.' ) );

View File

@ -380,9 +380,10 @@ function populate_options() {
$timezone_string = '';
$gmt_offset = 0;
/* translators: default GMT offset or timezone string. Must be either a valid offset (-12 to 14)
or a valid timezone string (America/New_York). See https://secure.php.net/manual/en/timezones.php
for all timezone strings supported by PHP.
/*
* translators: default GMT offset or timezone string. Must be either a valid offset (-12 to 14)
* or a valid timezone string (America/New_York). See https://secure.php.net/manual/en/timezones.php
* for all timezone strings supported by PHP.
*/
$offset_or_tz = _x( '0', 'default GMT offset or timezone string' );
if ( is_numeric( $offset_or_tz ) )

View File

@ -297,7 +297,7 @@ printf( __( 'If you like, you may enter custom structures for your category and
<?php do_settings_sections('permalink'); ?>
<?php submit_button(); ?>
</form>
</form>
<?php if ( !is_multisite() ) { ?>
<?php if ( $iis7_permalinks ) :
if ( isset($_POST['submit']) && $permalink_structure && ! $using_index_permalinks && ! $writable ) :

View File

@ -287,13 +287,13 @@ foreach ( (array) $options as $option ) :
<?php endif ?></td>
</tr>
<?php endforeach; ?>
</table>
</table>
<input type="hidden" name="page_options" value="<?php echo esc_attr( implode( ',', $options_to_update ) ); ?>" />
<?php submit_button( __( 'Save Changes' ), 'primary', 'Update' ); ?>
</form>
</form>
</div>
<?php

View File

@ -31,8 +31,8 @@ $taxonomy = $tax->name;
$title = $tax->labels->edit_item;
if ( ! in_array( $taxonomy, get_taxonomies( array( 'show_ui' => true ) ) ) ||
! current_user_can( 'edit_term', $tag->term_id )
) {
! current_user_can( 'edit_term', $tag->term_id ) ) {
wp_die(
'<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
'<p>' . __( 'Sorry, you are not allowed to edit this item.' ) . '</p>',

View File

@ -327,7 +327,6 @@ if ( ! in_array( 'theme_editor_notice', $dismissed_pointers, true ) ) :
?>
</p>
<p><?php _e( 'If you decide to go ahead with direct edits anyway, use a file manager to create a copy with a new name and hang on to the original. That way, you can re-enable a functional version if something goes wrong.' ); ?></p>
</div>
<p>
<a class="button file-editor-warning-go-back" href="<?php echo esc_url( $return_url ); ?>"><?php _e( 'Go back' ); ?></a>

View File

@ -1209,8 +1209,7 @@ function wp_blacklist_check($author, $email, $url, $comment, $user_ip, $user_age
$word = preg_quote($word, '#');
$pattern = "#$word#i";
if (
preg_match($pattern, $author)
if ( preg_match($pattern, $author)
|| preg_match($pattern, $email)
|| preg_match($pattern, $url)
|| preg_match($pattern, $comment)

View File

@ -473,8 +473,8 @@ if ( ! function_exists( 'array_replace_recursive' ) ) :
foreach ( array_keys( $head ) as $key ) {
if ( isset( $key, $bref ) &&
isset( $bref[ $key ] ) && is_array( $bref[ $key ] ) &&
isset( $head[ $key ] ) && is_array( $head[ $key ] )
) {
isset( $head[ $key ] ) && is_array( $head[ $key ] ) ) {
$bref_stack[] = &$bref[ $key ];
$head_stack[] = $head[ $key ];
} else {

View File

@ -26,7 +26,7 @@ do_action( 'rss_tag_pre', 'atom' );
*/
do_action( 'atom_ns' );
?>
>
>
<title type="text"><?php wp_title_rss(); ?></title>
<subtitle type="text"><?php bloginfo_rss("description") ?></subtitle>

View File

@ -2751,8 +2751,8 @@ function wp_rel_nofollow_callback( $matches ) {
$rel = 'nofollow';
if ( preg_match( '%href=["\'](' . preg_quote( set_url_scheme( home_url(), 'http' ) ) . ')%i', $text ) ||
preg_match( '%href=["\'](' . preg_quote( set_url_scheme( home_url(), 'https' ) ) . ')%i', $text )
) {
preg_match( '%href=["\'](' . preg_quote( set_url_scheme( home_url(), 'https' ) ) . ')%i', $text ) ) {
return "<a $text>";
}

View File

@ -2948,8 +2948,8 @@ function wp_resource_hints() {
foreach ( $atts as $attr => $value ) {
if ( ! is_scalar( $value ) ||
( ! in_array( $attr, array( 'as', 'crossorigin', 'href', 'pr', 'rel', 'type' ), true ) && ! is_numeric( $attr ))
) {
( ! in_array( $attr, array( 'as', 'crossorigin', 'href', 'pr', 'rel', 'type' ), true ) && ! is_numeric( $attr )) ) {
continue;
}

View File

@ -2974,6 +2974,7 @@ function _wp_image_editor_choose( $args = array() ) {
if ( isset( $args['methods'] ) &&
array_diff( $args['methods'], get_class_methods( $implementation ) ) ) {
continue;
}
@ -3500,9 +3501,10 @@ function wp_enqueue_media( $args = array() ) {
'replace' => __( 'Replace' ),
'remove' => __( 'Remove' ),
'back' => __( 'Back' ),
/* translators: This is a would-be plural string used in the media manager.
If there is not a word you can use in your language to avoid issues with the
lack of plural support here, turn it into "selected: %d" then translate it.
/*
* translators: This is a would-be plural string used in the media manager.
* If there is not a word you can use in your language to avoid issues with the
* lack of plural support here, turn it into "selected: %d" then translate it.
*/
'selected' => __( '%d selected' ),
'dragInfo' => __( 'Drag and drop to reorder media files.' ),

View File

@ -600,8 +600,8 @@ function _wp_preview_post_thumbnail_filter( $value, $post_id, $meta_key ) {
$post->ID != $post_id ||
'_thumbnail_id' != $meta_key ||
'revision' == $post->post_type ||
$post_id != $_REQUEST['preview_id']
) {
$post_id != $_REQUEST['preview_id'] ) {
return $value;
}

View File

@ -56,7 +56,7 @@ _deprecated_file(
<div class="alignleft"><?php previous_comments_link() ?></div>
<div class="alignright"><?php next_comments_link() ?></div>
</div>
<?php else : // this is displayed if there are no comments so far ?>
<?php else : // this is displayed if there are no comments so far ?>
<?php if ( comments_open() ) : ?>
<!-- If comments are open, but there are no comments. -->

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.0-alpha-42227';
$wp_version = '5.0-alpha-42228';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.