Changeset 47808 for trunk/src/wp-admin/includes/media.php
- Timestamp:
- 05/16/2020 06:40:52 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/media.php
r47771 r47808 681 681 $upload_iframe_src = add_query_arg( 'post_id', (int) $post_id, admin_url( 'media-upload.php' ) ); 682 682 683 if ( $type && 'media' != $type ) {683 if ( $type && 'media' !== $type ) { 684 684 $upload_iframe_src = add_query_arg( 'type', $type, $upload_iframe_src ); 685 685 } … … 866 866 } 867 867 868 if ( isset( $_POST['media_type'] ) && 'image' != $_POST['media_type'] ) {868 if ( isset( $_POST['media_type'] ) && 'image' !== $_POST['media_type'] ) { 869 869 $title = esc_html( wp_unslash( $_POST['title'] ) ); 870 870 if ( empty( $title ) ) { … … 881 881 if ( $ext ) { 882 882 $ext_type = wp_ext2type( $ext ); 883 if ( 'audio' == $ext_type || 'video'== $ext_type ) {883 if ( 'audio' === $ext_type || 'video' === $ext_type ) { 884 884 $type = $ext_type; 885 885 } … … 1160 1160 1161 1161 // Is this size selectable? 1162 $enabled = ( $downsize[3] || 'full' == $size );1162 $enabled = ( $downsize[3] || 'full' === $size ); 1163 1163 $css_id = "image-size-{$size}-{$post->ID}"; 1164 1164 … … 1170 1170 $check = ''; 1171 1171 } 1172 } elseif ( ! $check && $enabled && 'thumbnail' != $size ) {1172 } elseif ( ! $check && $enabled && 'thumbnail' !== $size ) { 1173 1173 /* 1174 1174 * If $check is not enabled, default to the first available size … … 1303 1303 */ 1304 1304 function image_attachment_fields_to_save( $post, $attachment ) { 1305 if ( substr( $post['post_mime_type'], 0, 5 ) == 'image') {1305 if ( 'image' === substr( $post['post_mime_type'], 0, 5 ) ) { 1306 1306 if ( strlen( trim( $post['post_title'] ) ) == 0 ) { 1307 1307 $attachment_url = ( isset( $post['attachment_url'] ) ) ? $post['attachment_url'] : $post['guid']; … … 1327 1327 $post = get_post( $attachment_id ); 1328 1328 1329 if ( substr( $post->post_mime_type, 0, 5 ) == 'image') {1329 if ( 'image' === substr( $post->post_mime_type, 0, 5 ) ) { 1330 1330 $url = $attachment['url']; 1331 1331 $align = ! empty( $attachment['align'] ) ? $attachment['align'] : 'none'; … … 1438 1438 1439 1439 // This was formerly in image_attachment_fields_to_edit(). 1440 if ( substr( $post->post_mime_type, 0, 5 ) == 'image') {1440 if ( 'image' === substr( $post->post_mime_type, 0, 5 ) ) { 1441 1441 $alt = get_post_meta( $post->ID, '_wp_attachment_image_alt', true ); 1442 1442 … … 1611 1611 $display_title = $parsed_args['show_title'] ? "<div class='filename new'><span class='title'>" . wp_html_excerpt( $display_title, 60, '…' ) . '</span></div>' : ''; 1612 1612 1613 $gallery = ( ( isset( $_REQUEST['tab'] ) && 'gallery' == $_REQUEST['tab'] ) || ( isset( $redir_tab ) && 'gallery'== $redir_tab ) );1613 $gallery = ( ( isset( $_REQUEST['tab'] ) && 'gallery' === $_REQUEST['tab'] ) || ( isset( $redir_tab ) && 'gallery' === $redir_tab ) ); 1614 1614 $order = ''; 1615 1615 1616 1616 foreach ( $form_fields as $key => $val ) { 1617 if ( 'menu_order' == $key ) {1617 if ( 'menu_order' === $key ) { 1618 1618 if ( $gallery ) { 1619 1619 $order = "<div class='menu_order'> <input class='menu_order_input' type='text' id='attachments[$attachment_id][menu_order]' name='attachments[$attachment_id][menu_order]' value='" . esc_attr( $val['value'] ) . "' /></div>"; … … 1726 1726 } 1727 1727 1728 if ( 'image' == $type && $calling_post_id && current_theme_supports( 'post-thumbnails', get_post_type( $calling_post_id ) ) 1729 && post_type_supports( get_post_type( $calling_post_id ), 'thumbnail' ) && get_post_thumbnail_id( $calling_post_id ) != $attachment_id ) { 1728 if ( 'image' === $type && $calling_post_id 1729 && current_theme_supports( 'post-thumbnails', get_post_type( $calling_post_id ) ) 1730 && post_type_supports( get_post_type( $calling_post_id ), 'thumbnail' ) 1731 && get_post_thumbnail_id( $calling_post_id ) != $attachment_id 1732 ) { 1730 1733 1731 1734 $calling_post = get_post( $calling_post_id ); … … 1770 1773 $item .= $field[ $field['input'] ]; 1771 1774 } elseif ( 'textarea' === $field['input'] ) { 1772 if ( 'post_content' == $id && user_can_richedit() ) {1775 if ( 'post_content' === $id && user_can_richedit() ) { 1773 1776 // Sanitize_post() skips the post_content when user_can_richedit. 1774 1777 $field['value'] = htmlspecialchars( $field['value'], ENT_QUOTES ); … … 1963 1966 $item .= $field[ $field['input'] ]; 1964 1967 } elseif ( 'textarea' === $field['input'] ) { 1965 if ( 'post_content' == $id && user_can_richedit() ) {1968 if ( 'post_content' === $id && user_can_richedit() ) { 1966 1969 // sanitize_post() skips the post_content when user_can_richedit. 1967 1970 $field['value'] = htmlspecialchars( $field['value'], ENT_QUOTES ); … … 2384 2387 var t = this, html, f = document.forms[0], cls, title = '', alt = '', caption = ''; 2385 2388 2386 if ( '' == f.src.value || ''== t.width )2389 if ( '' === f.src.value || '' === t.width ) 2387 2390 return false; 2388 2391 … … 2891 2894 } 2892 2895 2893 if ( 'image' == $default_view ) {2896 if ( 'image' === $default_view ) { 2894 2897 $view = 'image-only'; 2895 2898 $table_class = '';
Note: See TracChangeset
for help on using the changeset viewer.