WordPress.org

Make WordPress Core


Ignore:
Timestamp:
11/23/2017 04:08:42 AM (2 years ago)
Author:
pento
Message:

General: Reformat inline if () statements inside HTML tags.

This pattern occurs a handful of times across the codebase:

<div class="foo<?php if ( $bar ) { echo ' baz'; } ?>">

Unfortunately, it doesn't really play nicely with phpcbf, so all instances need to be removed in preperation for auto code formatting.

See #41057.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/media.php

    r41964 r42217  
    526526    do_action( "admin_head_{$content_func}" );
    527527}
     528
     529$body_id_attr = '';
     530if ( isset( $GLOBALS['body_id'] ) ) {
     531    $body_id_attr = ' id="' . $GLOBALS['body_id'] . '"';
     532}
    528533?>
    529534</head>
    530 <body<?php if ( isset($GLOBALS['body_id']) ) echo ' id="' . $GLOBALS['body_id'] . '"'; ?> class="wp-core-ui no-js">
     535<body<?php echo $body_id_attr; ?> class="wp-core-ui no-js">
    531536<script type="text/javascript">
    532537document.body.className = document.body.className.replace('no-js', 'js');
     
    27392744            $image_edit_button = "<input type='button' id='imgedit-open-btn-$post->ID' onclick='imageEdit.open( $post->ID, \"$nonce\" )' class='button' value='" . esc_attr__( 'Edit Image' ) . "' /> <span class='spinner'></span>";
    27402745        }
     2746
     2747        $open_style = $not_open_style = '';
     2748        if ( $open ) {
     2749            $open_style = ' style="display:none"';
     2750        } else {
     2751            $not_open_style = ' style="display:none"';
     2752        }
    27412753    ?>
    27422754
    27432755        <div class="imgedit-response" id="imgedit-response-<?php echo $attachment_id; ?>"></div>
    27442756
    2745         <div<?php if ( $open ) echo ' style="display:none"'; ?> class="wp_attachment_image wp-clearfix" id="media-head-<?php echo $attachment_id; ?>">
     2757        <div<?php echo $open_style; ?> class="wp_attachment_image wp-clearfix" id="media-head-<?php echo $attachment_id; ?>">
    27462758            <p id="thumbnail-head-<?php echo $attachment_id; ?>"><img class="thumbnail" src="<?php echo set_url_scheme( $thumb_url[0] ); ?>" style="max-width:100%" alt="" /></p>
    27472759            <p><?php echo $image_edit_button; ?></p>
    27482760        </div>
    2749         <div<?php if ( ! $open ) echo ' style="display:none"'; ?> class="image-editor" id="image-editor-<?php echo $attachment_id; ?>">
     2761        <div<?php echo $not_open_style; ?> class="image-editor" id="image-editor-<?php echo $attachment_id; ?>">
    27502762            <?php if ( $open ) wp_image_editor( $attachment_id ); ?>
    27512763        </div>
Note: See TracChangeset for help on using the changeset viewer.