Make WordPress Core


Ignore:
Timestamp:
07/17/2014 09:13:53 AM (12 years ago)
Author:
DrewAPicture
Message:

Fix syntax for single- and multi-line comments in wp-admin-directory files.

See #28931.

File:
1 edited

Legend:

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

    r29029 r29206  
    181181        $caption = str_replace( array("\r\n", "\r"), "\n", $caption);
    182182        $caption = preg_replace_callback( '/<[a-zA-Z0-9]+(?: [^<>]+>)*/', '_cleanup_image_add_caption', $caption );
    183         // convert any remaining line breaks to <br>
     183
     184        // Convert any remaining line breaks to <br>.
    184185        $caption = preg_replace( '/[ \n\t]*\n[ \t]*/', '<br />', $caption );
    185186
     
    209210 */
    210211function _cleanup_image_add_caption( $matches ) {
    211         // remove any line breaks from inside the tags
     212        // Remove any line breaks from inside the tags.
    212213        return preg_replace( '/[\r\n\t]+/', ' ', $matches[0] );
    213214}
     
    318319                        $content .= ' ' . sprintf( __( 'Genre: %s.' ), $meta['genre'] );
    319320
    320         // use image exif/iptc data for title and caption defaults if possible
     321        // Use image exif/iptc data for title and caption defaults if possible.
    321322        } elseif ( $image_meta = @wp_read_image_metadata( $file ) ) {
    322323                if ( trim( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) )
     
    379380        $content = '';
    380381
    381         // use image exif/iptc data for title and caption defaults if possible
     382        // Use image exif/iptc data for title and caption defaults if possible.
    382383        if ( $image_meta = @wp_read_image_metadata($file) ) {
    383384                if ( trim( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) )
     
    390391                $title = $desc;
    391392
    392         // Construct the attachment array
     393        // Construct the attachment array.
    393394        $attachment = array_merge( array(
    394395                'post_mime_type' => $type,
     
    635636                        if ( $image_alt != get_post_meta($attachment_id, '_wp_attachment_image_alt', true) ) {
    636637                                $image_alt = wp_strip_all_tags( $image_alt, true );
    637                                 // update_meta expects slashed
     638
     639                                // Update_meta expects slashed.
    638640                                update_post_meta( $attachment_id, '_wp_attachment_image_alt', wp_slash( $image_alt ) );
    639641                        }
     
    808810function media_sideload_image( $file, $post_id, $desc = null ) {
    809811        if ( ! empty( $file ) ) {
    810                 // Set variables for storage
    811                 // fix file filename for query strings
     812                // Set variables for storage, fix file filename for query strings.
    812813                preg_match( '/[^\?]+\.(jpe?g|jpe|gif|png)\b/i', $file, $matches );
    813814                $file_array['name'] = basename( $matches[0] );
    814                 // Download file to temp location
     815
     816                // Download file to temp location.
    815817                $file_array['tmp_name'] = download_url( $file );
    816818
     
    820822                }
    821823
    822                 // do the validation and storage stuff
     824                // Do the validation and storage stuff.
    823825                $id = media_handle_sideload( $file_array, $post_id, $desc );
    824                 // If error storing permanently, unlink
     826
     827                // If error storing permanently, unlink.
    825828                if ( is_wp_error( $id ) ) {
    826829                        @unlink( $file_array['tmp_name'] );
     
    831834        }
    832835
    833         // Finally check to make sure the file has been saved, then return the html
     836        // Finally check to make sure the file has been saved, then return the HTML.
    834837        if ( ! empty( $src ) ) {
    835838                $alt = isset( $desc ) ? esc_attr( $desc ) : '';
     
    944947                        $checked = '';
    945948
    946                         // is this size selectable?
     949                        // Is this size selectable?
    947950                        $enabled = ( $downsize[3] || 'full' == $size );
    948951                        $css_id = "image-size-{$size}-{$post->ID}";
    949                         // if this size is the default but that's not available, don't select it
     952
     953                        // If this size is the default but that's not available, don't select it.
    950954                        if ( $size == $check ) {
    951955                                if ( $enabled )
     
    954958                                        $check = '';
    955959                        } elseif ( !$check && $enabled && 'thumbnail' != $size ) {
    956                                 // if $check is not enabled, default to the first available size that's bigger than a thumbnail
     960                                /*
     961                                 * If $check is not enabled, default to the first available size
     962                                 * that's bigger than a thumbnail.
     963                                 */
    957964                                $check = $size;
    958965                                $checked = " checked='checked'";
     
    962969
    963970                        $html .= "<label for='{$css_id}'>$label</label>";
    964                         // only show the dimensions if that choice is available
     971
     972                        // Only show the dimensions if that choice is available.
    965973                        if ( $enabled )
    966974                                $html .= " <label for='{$css_id}' class='help'>" . sprintf( "(%d&nbsp;&times;&nbsp;%d)", $downsize[1], $downsize[2] ). "</label>";
     
    10101018
    10111019function wp_caption_input_textarea($edit_post) {
    1012         // post data is already escaped
     1020        // Post data is already escaped.
    10131021        $name = "attachments[{$edit_post->ID}][post_excerpt]";
    10141022
     
    14731481                elseif ( $field['input'] == 'textarea' ) {
    14741482                        if ( 'post_content' == $id && user_can_richedit() ) {
    1475                                 // sanitize_post() skips the post_content when user_can_richedit
     1483                                // Sanitize_post() skips the post_content when user_can_richedit.
    14761484                                $field['value'] = htmlspecialchars( $field['value'], ENT_QUOTES );
    14771485                        }
    1478                         // post_excerpt is already escaped by sanitize_post() in get_attachment_fields_to_edit()
     1486                        // Post_excerpt is already escaped by sanitize_post() in get_attachment_fields_to_edit().
    14791487                        $item .= "<textarea id='$name' name='$name' $aria_required>" . $field['value'] . '</textarea>';
    14801488                } else {
     
    16221630                elseif ( $field['input'] == 'textarea' ) {
    16231631                        if ( 'post_content' == $id && user_can_richedit() ) {
    1624                                 // sanitize_post() skips the post_content when user_can_richedit
     1632                                // sanitize_post() skips the post_content when user_can_richedit.
    16251633                                $field['value'] = htmlspecialchars( $field['value'], ENT_QUOTES );
    16261634                        }
     
    28532861                                if ( ! empty( $list ) ) {
    28542862                                        $metadata[$key] = reset( $list );
    2855                                         // fix bug in byte stream analysis
     2863                                        // Fix bug in byte stream analysis.
    28562864                                        if ( 'terms_of_use' === $key && 0 === strpos( $metadata[$key], 'yright notice.' ) )
    28572865                                                $metadata[$key] = 'Cop' . $metadata[$key];
Note: See TracChangeset for help on using the changeset viewer.