Make WordPress Core


Ignore:
Timestamp:
05/12/2020 06:30:03 PM (6 years ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Use strict comparison in some wp-admin files.

Props pikamander2, mukesh27, SergeyBiryukov.
Fixes #49239.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/edit-form-advanced.php

    r47410 r47785  
    7777$action  = isset( $action ) ? $action : '';
    7878
    79 if ( get_option( 'page_for_posts' ) == $post_ID && empty( $post->post_content ) ) {
     79if ( (int) get_option( 'page_for_posts' ) === $post_ID && empty( $post->post_content ) ) {
    8080    add_action( 'edit_form_after_title', '_wp_posts_page_notice' );
    8181    remove_post_type_support( $post_type, 'editor' );
     
    229229$notice     = false;
    230230$form_extra = '';
    231 if ( 'auto-draft' == $post->post_status ) {
    232     if ( 'edit' == $action ) {
     231if ( 'auto-draft' === $post->post_status ) {
     232    if ( 'edit' === $action ) {
    233233        $post->post_title = '';
    234234    }
     
    277277);
    278278
    279 if ( 'post' == $post_type ) {
     279if ( 'post' === $post_type ) {
    280280    $customize_display = '<p>' . __( 'The title field and the big Post Editing Area are fixed in place, but you can reposition all the other boxes using drag and drop. You can also minimize or expand them by clicking the title bar of each box. Use the Screen Options tab to unhide more boxes (Excerpt, Send Trackbacks, Custom Fields, Discussion, Slug, Author) or to choose a 1- or 2-column layout for this screen.' ) . '</p>';
    281281
     
    314314            '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
    315315    );
    316 } elseif ( 'page' == $post_type ) {
     316} elseif ( 'page' === $post_type ) {
    317317    $about_pages = '<p>' . __( 'Pages are similar to posts in that they have a title, body text, and associated metadata, but they are different in that they are not part of the chronological blog stream, kind of like permanent posts. Pages are not categorized or tagged, but can have a hierarchy. You can nest pages under other pages by making one the &#8220;Parent&#8221; of the other, creating a group of pages.' ) . '</p>' .
    318318        '<p>' . __( 'Creating a Page is very similar to creating a Post, and the screens can be customized in the same way using drag and drop, the Screen Options tab, and expanding/collapsing boxes as you choose. This screen also has the distraction-free writing space, available in both the Visual and Text modes via the Fullscreen buttons. The Page editor mostly works the same as the Post editor, but there are some Page-specific features in the Page Attributes box.' ) . '</p>';
     
    332332            '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
    333333    );
    334 } elseif ( 'attachment' == $post_type ) {
     334} elseif ( 'attachment' === $post_type ) {
    335335    get_current_screen()->add_help_tab(
    336336        array(
     
    352352}
    353353
    354 if ( 'post' == $post_type || 'page' == $post_type ) {
     354if ( 'post' === $post_type || 'page' === $post_type ) {
    355355    $inserting_media  = '<p>' . __( 'You can upload and insert media (images, audio, documents, etc.) by clicking the Add Media button. You can select from the images and files already uploaded to the Media Library, or upload new media to add to your page or post. To create an image gallery, select the images to add and click the &#8220;Create a new gallery&#8221; button.' ) . '</p>';
    356356    $inserting_media .= '<p>' . __( 'You can also embed media from many popular websites including Twitter, YouTube, Flickr and others by pasting the media URL on its own line into the content of your post/page. <a href="https://wordpress.org/support/article/embeds/">Learn more about embeds</a>.' ) . '</p>';
     
    365365}
    366366
    367 if ( 'post' == $post_type ) {
     367if ( 'post' === $post_type ) {
    368368    $publish_box  = '<p>' . __( 'Several boxes on this screen contain settings for how your content will be published, including:' ) . '</p>';
    369369    $publish_box .= '<ul><li>' .
     
    403403        )
    404404    );
    405 } elseif ( 'page' == $post_type ) {
     405} elseif ( 'page' === $post_type ) {
    406406    $page_attributes = '<p>' . __( '<strong>Parent</strong> &mdash; You can arrange your pages in hierarchies. For example, you could have an &#8220;About&#8221; page that has &#8220;Life Story&#8221; and &#8220;My Dog&#8221; pages under it. There are no limits to how many levels you can nest pages.' ) . '</p>' .
    407407        '<p>' . __( '<strong>Template</strong> &mdash; Some themes have custom templates you can use for certain pages that might have additional features or custom layouts. If so, you&#8217;ll see them in this dropdown menu.' ) . '</p>' .
     
    472472    <?php
    473473}
    474 if ( 'draft' != get_post_status( $post ) ) {
     474if ( 'draft' !== get_post_status( $post ) ) {
    475475    wp_original_referer_field( true, 'previous' );
    476476}
     
    496496
    497497<div id="poststuff">
    498 <div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
     498<div id="post-body" class="metabox-holder columns-<?php echo ( 1 === get_current_screen()->get_columns() ) ? '1' : '2'; ?>">
    499499<div id="post-body-content">
    500500
     
    536536
    537537            if ( ! empty( $shortlink ) && $shortlink !== $permalink && home_url( '?page_id=' . $post->ID ) !== $permalink ) {
    538                 $sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr( $shortlink ) . '" /><button type="button" class="button button-small" onclick="prompt(&#39;URL:&#39;, jQuery(\'#shortlink\').val());">' . __( 'Get Shortlink' ) . '</button>';
     538                $sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr( $shortlink ) . '" />' .
     539                    '<button type="button" class="button button-small" onclick="prompt(&#39;URL:&#39;, jQuery(\'#shortlink\').val());">' .
     540                    __( 'Get Shortlink' ) .
     541                    '</button>';
    539542            }
    540543        }
    541544
    542         if ( $post_type_object->public && ! ( 'pending' == get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) ) {
    543             $has_sample_permalink = $sample_permalink_html && 'auto-draft' != $post->post_status;
     545        if ( $post_type_object->public
     546            && ! ( 'pending' === get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) )
     547        ) {
     548            $has_sample_permalink = $sample_permalink_html && 'auto-draft' !== $post->post_status;
    544549            ?>
    545550    <div id="edit-slug-box" class="hide-if-no-js">
     
    609614    <span class="autosave-message">&nbsp;</span>
    610615    <?php
    611     if ( 'auto-draft' != $post->post_status ) {
     616    if ( 'auto-draft' !== $post->post_status ) {
    612617        echo '<span id="last-edit">';
    613618        $last_user = get_userdata( get_post_meta( $post_ID, '_edit_last', true ) );
     
    643648<?php
    644649
    645 if ( 'page' == $post_type ) {
     650if ( 'page' === $post_type ) {
    646651    /**
    647652     * Fires before meta boxes with 'side' context are output for the 'page' post type.
     
    677682do_meta_boxes( null, 'normal', $post );
    678683
    679 if ( 'page' == $post_type ) {
     684if ( 'page' === $post_type ) {
    680685    /**
    681686     * Fires after 'normal' context meta boxes have been output for the 'page' post type.
Note: See TracChangeset for help on using the changeset viewer.