Coding Standards: Prepare for upgrading WPCS to 1.0.0.

In order to get the best result when running `phpcbf` across the codebase, there are some manual tweaks we need to make.

These fall into three categories:
- Fixing incorrectly indented code which has flow-on effects when auto-fixing.
- Tweaking the layout of inline PHP inside HTML tags.
- Moving more complex inline PHP inside HTML tags, to execute earlier.

See #44600.



git-svn-id: https://develop.svn.wordpress.org/trunk@43569 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Gary Pendergast 2018-08-15 06:22:00 +00:00
parent c5d013bf95
commit cb3d1777b1
15 changed files with 214 additions and 236 deletions

View File

@ -76,7 +76,9 @@ get_header( 'wp-activate' );
<div id="signup-content" class="widecolumn"> <div id="signup-content" class="widecolumn">
<div class="wp-activate-container"> <div class="wp-activate-container">
<?php if ( empty( $_GET['key'] ) && empty( $_POST['key'] ) ) { ?> <?php
if ( empty( $_GET['key'] ) && empty( $_POST['key'] ) ) {
?>
<h2><?php _e( 'Activation Key Required' ); ?></h2> <h2><?php _e( 'Activation Key Required' ); ?></h2>
<form name="activateform" id="activateform" method="post" action="<?php echo network_site_url( 'wp-activate.php' ); ?>"> <form name="activateform" id="activateform" method="post" action="<?php echo network_site_url( 'wp-activate.php' ); ?>">

View File

@ -17,6 +17,14 @@ include( ABSPATH . 'wp-admin/admin-header.php' );
$is_privacy_notice = isset( $_GET['privacy-notice'] ); $is_privacy_notice = isset( $_GET['privacy-notice'] );
if ( $is_privacy_notice ) {
$freedoms_class = '';
$privacy_class = ' nav-tab-active';
} else {
$freedoms_class = ' nav-tab-active';
$privacy_class = '';
}
?> ?>
<div class="wrap about-wrap full-width-layout"> <div class="wrap about-wrap full-width-layout">
@ -29,8 +37,8 @@ $is_privacy_notice = isset( $_GET['privacy-notice'] );
<h2 class="nav-tab-wrapper wp-clearfix"> <h2 class="nav-tab-wrapper wp-clearfix">
<a href="about.php" class="nav-tab"><?php _e( 'What&#8217;s New' ); ?></a> <a href="about.php" class="nav-tab"><?php _e( 'What&#8217;s New' ); ?></a>
<a href="credits.php" class="nav-tab"><?php _e( 'Credits' ); ?></a> <a href="credits.php" class="nav-tab"><?php _e( 'Credits' ); ?></a>
<a href="freedoms.php" class="nav-tab<?php if ( ! $is_privacy_notice ) { echo ' nav-tab-active'; } ?>"><?php _e( 'Freedoms' ); ?></a> <a href="freedoms.php" class="nav-tab<?php echo $freedoms_class; ?>"><?php _e( 'Freedoms' ); ?></a>
<a href="freedoms.php?privacy-notice" class="nav-tab<?php if ( $is_privacy_notice ) { echo ' nav-tab-active'; } ?>"><?php _e( 'Privacy' ); ?></a> <a href="freedoms.php?privacy-notice" class="nav-tab<?php echo $privacy_class; ?>"><?php _e( 'Privacy' ); ?></a>
</h2> </h2>
<?php if ( $is_privacy_notice ) : ?> <?php if ( $is_privacy_notice ) : ?>

View File

@ -1817,6 +1817,11 @@ if ( ( isset( $types['ftp'] ) || isset( $types['ftps'] ) ) ) {
} }
_e( 'If you do not remember your credentials, you should contact your web host.' ); _e( 'If you do not remember your credentials, you should contact your web host.' );
$hostname_value = esc_attr( $hostname );
if ( ! empty( $port ) ) {
$hostname_value .= ":$port";
}
$password_value = ''; $password_value = '';
if ( defined( 'FTP_PASS' ) ) { if ( defined( 'FTP_PASS' ) ) {
$password_value = '*****'; $password_value = '*****';
@ -1825,13 +1830,7 @@ if ( defined( 'FTP_PASS' ) ) {
</p> </p>
<label for="hostname"> <label for="hostname">
<span class="field-title"><?php _e( 'Hostname' ); ?></span> <span class="field-title"><?php _e( 'Hostname' ); ?></span>
<input name="hostname" type="text" id="hostname" aria-describedby="request-filesystem-credentials-desc" class="code" placeholder="<?php esc_attr_e( 'example: www.wordpress.org' ); ?>" value=" <input name="hostname" type="text" id="hostname" aria-describedby="request-filesystem-credentials-desc" class="code" placeholder="<?php esc_attr_e( 'example: www.wordpress.org' ); ?>" value="<?php echo $hostname_value; ?>"<?php disabled( defined( 'FTP_HOST' ) ); ?> />
<?php
echo esc_attr( $hostname );
if ( ! empty( $port ) ) {
echo ":$port";}
?>
"<?php disabled( defined( 'FTP_HOST' ) ); ?> />
</label> </label>
<div class="ftp-username"> <div class="ftp-username">
<label for="username"> <label for="username">
@ -1858,12 +1857,7 @@ if ( defined( 'FTP_PASS' ) ) {
foreach ( $types as $name => $text ) : foreach ( $types as $name => $text ) :
?> ?>
<label for="<?php echo esc_attr( $name ); ?>"> <label for="<?php echo esc_attr( $name ); ?>">
<input type="radio" name="connection_type" id="<?php echo esc_attr( $name ); ?>" value="<?php echo esc_attr( $name ); ?>" <input type="radio" name="connection_type" id="<?php echo esc_attr( $name ); ?>" value="<?php echo esc_attr( $name ); ?>" <?php checked( $name, $connection_type ); ?> <?php echo $disabled; ?> />
<?php
checked( $name, $connection_type );
echo $disabled;
?>
/>
<?php echo $text; ?> <?php echo $text; ?>
</label> </label>
<?php <?php

View File

@ -1350,16 +1350,14 @@ function attachment_id3_data_meta_box( $post ) {
} }
foreach ( wp_get_attachment_id3_keys( $post, 'edit' ) as $key => $label ) : foreach ( wp_get_attachment_id3_keys( $post, 'edit' ) as $key => $label ) :
$value = '';
if ( ! empty( $meta[ $key ] ) ) {
$value = $meta[ $key ];
}
?> ?>
<p> <p>
<label for="title"><?php echo $label; ?></label><br /> <label for="title"><?php echo $label; ?></label><br />
<input type="text" name="id3_<?php echo esc_attr( $key ); ?>" id="id3_<?php echo esc_attr( $key ); ?>" class="large-text" value=" <input type="text" name="id3_<?php echo esc_attr( $key ); ?>" id="id3_<?php echo esc_attr( $key ); ?>" class="large-text" value="<?php echo esc_attr( $value ); ?>" />
<?php
if ( ! empty( $meta[ $key ] ) ) {
echo esc_attr( $meta[ $key ] );
}
?>
" />
</p> </p>
<?php <?php
endforeach; endforeach;

View File

@ -435,11 +435,7 @@ function wp_nav_menu_item_post_type_meta_box( $object, $box ) {
</li> </li>
</ul><!-- .posttype-tabs --> </ul><!-- .posttype-tabs -->
<div id="tabs-panel-posttype-<?php echo $post_type_name; ?>-most-recent" class="tabs-panel <div id="tabs-panel-posttype-<?php echo $post_type_name; ?>-most-recent" class="tabs-panel <?php echo ( 'most-recent' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); ?>">
<?php
echo ( 'most-recent' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
?>
">
<ul id="<?php echo $post_type_name; ?>checklist-most-recent" class="categorychecklist form-no-clear"> <ul id="<?php echo $post_type_name; ?>checklist-most-recent" class="categorychecklist form-no-clear">
<?php <?php
$recent_args = array_merge( $recent_args = array_merge(
@ -473,11 +469,7 @@ function wp_nav_menu_item_post_type_meta_box( $object, $box ) {
</ul> </ul>
</div><!-- /.tabs-panel --> </div><!-- /.tabs-panel -->
<div class="tabs-panel <div class="tabs-panel <?php echo ( 'search' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); ?>" id="tabs-panel-posttype-<?php echo $post_type_name; ?>-search">
<?php
echo ( 'search' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
?>
" id="tabs-panel-posttype-<?php echo $post_type_name; ?>-search">
<?php <?php
if ( isset( $_REQUEST[ 'quick-search-posttype-' . $post_type_name ] ) ) { if ( isset( $_REQUEST[ 'quick-search-posttype-' . $post_type_name ] ) ) {
$searched = esc_attr( $_REQUEST[ 'quick-search-posttype-' . $post_type_name ] ); $searched = esc_attr( $_REQUEST[ 'quick-search-posttype-' . $post_type_name ] );
@ -515,11 +507,7 @@ function wp_nav_menu_item_post_type_meta_box( $object, $box ) {
</ul> </ul>
</div><!-- /.tabs-panel --> </div><!-- /.tabs-panel -->
<div id="<?php echo $post_type_name; ?>-all" class="tabs-panel tabs-panel-view-all <div id="<?php echo $post_type_name; ?>-all" class="tabs-panel tabs-panel-view-all <?php echo ( 'all' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); ?>">
<?php
echo ( 'all' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
?>
">
<?php if ( ! empty( $page_links ) ) : ?> <?php if ( ! empty( $page_links ) ) : ?>
<div class="add-menu-item-pagelinks"> <div class="add-menu-item-pagelinks">
<?php echo $page_links; ?> <?php echo $page_links; ?>
@ -771,11 +759,7 @@ function wp_nav_menu_item_taxonomy_meta_box( $object, $box ) {
</li> </li>
</ul><!-- .taxonomy-tabs --> </ul><!-- .taxonomy-tabs -->
<div id="tabs-panel-<?php echo $taxonomy_name; ?>-pop" class="tabs-panel <div id="tabs-panel-<?php echo $taxonomy_name; ?>-pop" class="tabs-panel <?php echo ( 'most-used' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); ?> ">
<?php
echo ( 'most-used' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
?>
">
<ul id="<?php echo $taxonomy_name; ?>checklist-pop" class="categorychecklist form-no-clear" > <ul id="<?php echo $taxonomy_name; ?>checklist-pop" class="categorychecklist form-no-clear" >
<?php <?php
$popular_terms = get_terms( $popular_terms = get_terms(
@ -792,11 +776,7 @@ function wp_nav_menu_item_taxonomy_meta_box( $object, $box ) {
</ul> </ul>
</div><!-- /.tabs-panel --> </div><!-- /.tabs-panel -->
<div id="tabs-panel-<?php echo $taxonomy_name; ?>-all" class="tabs-panel tabs-panel-view-all <div id="tabs-panel-<?php echo $taxonomy_name; ?>-all" class="tabs-panel tabs-panel-view-all <?php echo ( 'all' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); ?> ">
<?php
echo ( 'all' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
?>
">
<?php if ( ! empty( $page_links ) ) : ?> <?php if ( ! empty( $page_links ) ) : ?>
<div class="add-menu-item-pagelinks"> <div class="add-menu-item-pagelinks">
<?php echo $page_links; ?> <?php echo $page_links; ?>
@ -815,11 +795,7 @@ function wp_nav_menu_item_taxonomy_meta_box( $object, $box ) {
<?php endif; ?> <?php endif; ?>
</div><!-- /.tabs-panel --> </div><!-- /.tabs-panel -->
<div class="tabs-panel <div class="tabs-panel <?php echo ( 'search' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); ?>" id="tabs-panel-search-taxonomy-<?php echo $taxonomy_name; ?>">
<?php
echo ( 'search' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
?>
" id="tabs-panel-search-taxonomy-<?php echo $taxonomy_name; ?>">
<?php <?php
if ( isset( $_REQUEST[ 'quick-search-taxonomy-' . $taxonomy_name ] ) ) { if ( isset( $_REQUEST[ 'quick-search-taxonomy-' . $taxonomy_name ] ) ) {
$searched = esc_attr( $_REQUEST[ 'quick-search-taxonomy-' . $taxonomy_name ] ); $searched = esc_attr( $_REQUEST[ 'quick-search-taxonomy-' . $taxonomy_name ] );

View File

@ -2184,16 +2184,20 @@ function _wp_admin_html_begin() {
* @since 2.2.0 * @since 2.2.0
*/ */
do_action( 'admin_xml_ns' ); do_action( 'admin_xml_ns' );
language_attributes();
?> ?>
<?php language_attributes(); ?>> >
<![endif]--> <![endif]-->
<!--[if !(IE 8) ]><!--> <!--[if !(IE 8) ]><!-->
<html xmlns="http://www.w3.org/1999/xhtml" class="<?php echo $admin_html_class; ?>" <html xmlns="http://www.w3.org/1999/xhtml" class="<?php echo $admin_html_class; ?>"
<?php <?php
/** This action is documented in wp-admin/includes/template.php */ /** This action is documented in wp-admin/includes/template.php */
do_action( 'admin_xml_ns' ); do_action( 'admin_xml_ns' );
language_attributes();
?> ?>
<?php language_attributes(); ?>> >
<!--<![endif]--> <!--<![endif]-->
<head> <head>
<meta http-equiv="Content-Type" content="<?php bloginfo( 'html_type' ); ?>; charset=<?php echo get_option( 'blog_charset' ); ?>" /> <meta http-equiv="Content-Type" content="<?php bloginfo( 'html_type' ); ?>; charset=<?php echo get_option( 'blog_charset' ); ?>" />

View File

@ -628,15 +628,16 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
<h2 class="nav-tab-wrapper wp-clearfix"> <h2 class="nav-tab-wrapper wp-clearfix">
<a href="<?php echo admin_url( 'nav-menus.php' ); ?>" class="nav-tab<?php echo $nav_tab_active_class; ?>"><?php esc_html_e( 'Edit Menus' ); ?></a> <a href="<?php echo admin_url( 'nav-menus.php' ); ?>" class="nav-tab<?php echo $nav_tab_active_class; ?>"><?php esc_html_e( 'Edit Menus' ); ?></a>
<?php if ( $num_locations && $menu_count ) : ?>
<a href="<?php echo esc_url( add_query_arg( array( 'action' => 'locations' ), admin_url( 'nav-menus.php' ) ) ); ?>" class="nav-tab
<?php <?php
if ( $num_locations && $menu_count ) {
$active_tab_class = '';
if ( $locations_screen ) { if ( $locations_screen ) {
echo ' nav-tab-active';} $active_tab_class = ' nav-tab-active';
}
?> ?>
"><?php esc_html_e( 'Manage Locations' ); ?></a> <a href="<?php echo esc_url( add_query_arg( array( 'action' => 'locations' ), admin_url( 'nav-menus.php' ) ) ); ?>" class="nav-tab<?php echo $active_tab_class; ?>"><?php esc_html_e( 'Manage Locations' ); ?></a>
<?php <?php
endif; }
?> ?>
</h2> </h2>
<?php <?php

View File

@ -193,12 +193,7 @@ if ( ! empty( $messages ) ) {
<fieldset> <fieldset>
<legend class="screen-reader-text"><?php _e( 'Set site attributes' ); ?></legend> <legend class="screen-reader-text"><?php _e( 'Set site attributes' ); ?></legend>
<?php foreach ( $attribute_fields as $field_key => $field_label ) : ?> <?php foreach ( $attribute_fields as $field_key => $field_label ) : ?>
<label><input type="checkbox" name="blog[<?php echo $field_key; ?>]" value="1" <label><input type="checkbox" name="blog[<?php echo $field_key; ?>]" value="1" <?php checked( (bool) $details->$field_key, true ); ?> <?php disabled( ! in_array( $details->$field_key, array( 0, 1 ) ) ); ?> />
<?php
checked( (bool) $details->$field_key, true );
disabled( ! in_array( $details->$field_key, array( 0, 1 ) ) );
?>
/>
<?php echo $field_label; ?></label><br/> <?php echo $field_label; ?></label><br/>
<?php endforeach; ?> <?php endforeach; ?>
<fieldset> <fieldset>

View File

@ -31,8 +31,8 @@ include( dirname( __FILE__ ) . '/wp-load.php' );
if ( isset( $_GET['rsd'] ) ) { // http://cyber.law.harvard.edu/blogs/gems/tech/rsd.html if ( isset( $_GET['rsd'] ) ) { // http://cyber.law.harvard.edu/blogs/gems/tech/rsd.html
header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true ); header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true );
echo '<?xml version="1.0" encoding="' . get_option( 'blog_charset' ) . '"?' . '>';
?> ?>
<?php echo '<?xml version="1.0" encoding="' . get_option( 'blog_charset' ) . '"?' . '>'; ?>
<rsd version="1.0" xmlns="http://archipelago.phrasewise.com/rsd"> <rsd version="1.0" xmlns="http://archipelago.phrasewise.com/rsd">
<service> <service>
<engineName>WordPress</engineName> <engineName>WordPress</engineName>