Changeset 47219 for trunk/src/wp-admin/includes/media.php
- Timestamp:
- 02/09/2020 04:52:28 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/media.php
r47202 r47219 636 636 $img = '<span class="wp-media-buttons-icon"></span> '; 637 637 638 $id_attribute = $instance === 1? ' id="insert-media-button"' : '';638 $id_attribute = 1 === $instance ? ' id="insert-media-button"' : ''; 639 639 640 640 printf( … … 768 768 $image_alt = wp_unslash( $attachment['image_alt'] ); 769 769 770 if ( $image_alt != get_post_meta( $attachment_id, '_wp_attachment_image_alt', true )) {770 if ( get_post_meta( $attachment_id, '_wp_attachment_image_alt', true ) !== $image_alt ) { 771 771 $image_alt = wp_strip_all_tags( $image_alt, true ); 772 772 … … 948 948 } 949 949 950 if ( isset( $_GET['tab'] ) && $_GET['tab'] == 'type_url') {950 if ( isset( $_GET['tab'] ) && 'type_url' === $_GET['tab'] ) { 951 951 $type = 'image'; 952 952 … … 1004 1004 return $id; 1005 1005 // If attachment id was requested, return it early. 1006 } elseif ( $return === 'id') {1006 } elseif ( 'id' === $return ) { 1007 1007 return $id; 1008 1008 } … … 1013 1013 // Finally, check to make sure the file has been saved, then return the HTML. 1014 1014 if ( ! empty( $src ) ) { 1015 if ( $return === 'src') {1015 if ( 'src' === $return ) { 1016 1016 return $src; 1017 1017 } … … 1212 1212 $url = ''; 1213 1213 1214 if ( $url_type == 'file') {1214 if ( 'file' === $url_type ) { 1215 1215 $url = $file; 1216 } elseif ( $url_type == 'post') {1216 } elseif ( 'post' === $url_type ) { 1217 1217 $url = $link; 1218 1218 } … … 1325 1325 $size = ! empty( $attachment['image-size'] ) ? $attachment['image-size'] : 'medium'; 1326 1326 $alt = ! empty( $attachment['image_alt'] ) ? $attachment['image_alt'] : ''; 1327 $rel = ( strpos( $url, 'attachment_id' ) || $url === get_attachment_link( $attachment_id ));1327 $rel = ( strpos( $url, 'attachment_id' ) || get_attachment_link( $attachment_id ) === $url ); 1328 1328 1329 1329 return get_image_send_to_editor( $attachment_id, $attachment['post_excerpt'], $attachment['post_title'], $align, $url, $rel, $size, $alt ); … … 1492 1492 $post = get_post( $post_id ); 1493 1493 1494 if ( $post && $post->post_type == 'attachment') {1494 if ( $post && 'attachment' === $post->post_type ) { 1495 1495 $attachments = array( $post->ID => $post ); 1496 1496 } else { … … 1514 1514 $output = ''; 1515 1515 foreach ( (array) $attachments as $id => $attachment ) { 1516 if ( $attachment->post_status == 'trash') {1516 if ( 'trash' === $attachment->post_status ) { 1517 1517 continue; 1518 1518 } … … 1736 1736 1737 1737 foreach ( $form_fields as $id => $field ) { 1738 if ( $id[0] == '_') {1738 if ( '_' === $id[0] ) { 1739 1739 continue; 1740 1740 } … … 1748 1748 $name = "attachments[$attachment_id][$id]"; 1749 1749 1750 if ( $field['input'] == 'hidden') {1750 if ( 'hidden' === $field['input'] ) { 1751 1751 $hidden_fields[ $name ] = $field['value']; 1752 1752 continue; … … 1762 1762 if ( ! empty( $field[ $field['input'] ] ) ) { 1763 1763 $item .= $field[ $field['input'] ]; 1764 } elseif ( $field['input'] == 'textarea') {1764 } elseif ( 'textarea' === $field['input'] ) { 1765 1765 if ( 'post_content' == $id && user_can_richedit() ) { 1766 1766 // Sanitize_post() skips the post_content when user_can_richedit. … … 1920 1920 1921 1921 foreach ( $form_fields as $id => $field ) { 1922 if ( $id[0] == '_') {1922 if ( '_' === $id[0] ) { 1923 1923 continue; 1924 1924 } … … 1938 1938 } 1939 1939 1940 if ( $field['input'] == 'hidden') {1940 if ( 'hidden' === $field['input'] ) { 1941 1941 $hidden_fields[ $name ] = $field['value']; 1942 1942 continue; … … 1955 1955 if ( ! empty( $field[ $field['input'] ] ) ) { 1956 1956 $item .= $field[ $field['input'] ]; 1957 } elseif ( $field['input'] == 'textarea') {1957 } elseif ( 'textarea' === $field['input'] ) { 1958 1958 if ( 'post_content' == $id && user_can_richedit() ) { 1959 1959 // sanitize_post() skips the post_content when user_can_richedit. … … 2717 2717 list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query(); 2718 2718 } 2719 if ( empty( $_GET['post_mime_type'] ) || $_GET['post_mime_type'] == 'all') {2719 if ( empty( $_GET['post_mime_type'] ) || 'all' === $_GET['post_mime_type'] ) { 2720 2720 $class = ' class="current"'; 2721 2721 } else { … … 2801 2801 2802 2802 foreach ( $arc_result as $arc_row ) { 2803 if ( $arc_row->yyear == 0) {2803 if ( 0 == $arc_row->yyear ) { 2804 2804 continue; 2805 2805 } … … 2927 2927 <th scope="row" class="label"><p><label for="align">' . __( 'Alignment' ) . '</label></p></th> 2928 2928 <td class="field"> 2929 <input name="align" id="align-none" value="none" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ( $default_align == 'none'? ' checked="checked"' : '' ) . ' />2929 <input name="align" id="align-none" value="none" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ( 'none' === $default_align ? ' checked="checked"' : '' ) . ' /> 2930 2930 <label for="align-none" class="align image-align-none-label">' . __( 'None' ) . '</label> 2931 <input name="align" id="align-left" value="left" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ( $default_align == 'left'? ' checked="checked"' : '' ) . ' />2931 <input name="align" id="align-left" value="left" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ( 'left' === $default_align ? ' checked="checked"' : '' ) . ' /> 2932 2932 <label for="align-left" class="align image-align-left-label">' . __( 'Left' ) . '</label> 2933 <input name="align" id="align-center" value="center" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ( $default_align == 'center'? ' checked="checked"' : '' ) . ' />2933 <input name="align" id="align-center" value="center" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ( 'center' === $default_align ? ' checked="checked"' : '' ) . ' /> 2934 2934 <label for="align-center" class="align image-align-center-label">' . __( 'Center' ) . '</label> 2935 <input name="align" id="align-right" value="right" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ( $default_align == 'right'? ' checked="checked"' : '' ) . ' />2935 <input name="align" id="align-right" value="right" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ( 'right' === $default_align ? ' checked="checked"' : '' ) . ' /> 2936 2936 <label for="align-right" class="align image-align-right-label">' . __( 'Right' ) . '</label> 2937 2937 </td> … … 3273 3273 echo esc_html( strtoupper( $matches[1] ) ); 3274 3274 list( $mime_type ) = explode( '/', $post->post_mime_type ); 3275 if ( $mime_type !== 'image'&& ! empty( $meta['mime_type'] ) ) {3276 if ( $meta['mime_type'] !== "$mime_type/" . strtolower( $matches[1] )) {3275 if ( 'image' !== $mime_type && ! empty( $meta['mime_type'] ) ) { 3276 if ( "$mime_type/" . strtolower( $matches[1] ) !== $meta['mime_type'] ) { 3277 3277 echo ' (' . $meta['mime_type'] . ')'; 3278 3278 } … … 3536 3536 $created_timestamp = wp_get_media_creation_timestamp( $data ); 3537 3537 3538 if ( $created_timestamp !== false) {3538 if ( false !== $created_timestamp ) { 3539 3539 $metadata['created_timestamp'] = $created_timestamp; 3540 3540 }
Note: See TracChangeset
for help on using the changeset viewer.