Make WordPress Core

Ticket #32363: 32363.5.diff

File 32363.5.diff, 2.1 KB (added by MikeHansenMe, 11 years ago)

fixes some code sniffer errors

  • src/wp-includes/media.php

     
    693693 * @return false|array Returns an array (url, width, height), or false, if no image is available.
    694694 */
    695695function wp_get_attachment_image_src( $attachment_id, $size = 'thumbnail', $icon = false ) {
    696 
     696        $image = false;
    697697        // get a thumbnail or intermediate image if there is one
    698         if ( $image = image_downsize($attachment_id, $size) )
    699                 return $image;
     698        $image = image_downsize( $attachment_id, $size );
     699        if ( ! $image ) {
     700                $src = false;
    700701
    701         $src = false;
     702                if ( $icon && $src = wp_mime_type_icon( $attachment_id ) ) {
     703                        /** This filter is documented in wp-includes/post.php */
     704                        $icon_dir = apply_filters( 'icon_dir', ABSPATH . WPINC . '/images/media' );
    702705
    703         if ( $icon && $src = wp_mime_type_icon($attachment_id) ) {
    704                 /** This filter is documented in wp-includes/post.php */
    705                 $icon_dir = apply_filters( 'icon_dir', ABSPATH . WPINC . '/images/media' );
    706 
    707                 $src_file = $icon_dir . '/' . wp_basename($src);
    708                 @list($width, $height) = getimagesize($src_file);
     706                        $src_file = $icon_dir . '/' . wp_basename( $src );
     707                        @list( $width, $height ) = getimagesize( $src_file );
     708                }
     709                if ( $src && $width && $height ) {
     710                        $image = array( $src, $width, $height );
     711                }
    709712        }
    710         if ( $src && $width && $height )
    711                 return array( $src, $width, $height );
    712         return false;
     713        /**
     714         * Filter the image src result
     715         *
     716         * @since 4.3.0
     717         *
     718         * @param mixed                 $image                  either array with src, width & height, icon src, or false.
     719         * @param int                   $attachment_id  Image attachment ID.
     720         * @param string|array  $size           Optional. Registered image size to retrieve the source for or a flat
     721         *                                      array of height and width dimensions. Default 'thumbnail'.
     722         * @param bool                  $icon Optional. Whether the image should be treated as an icon. Default false.
     723         */
     724        return apply_filters( 'attachment_image_src', $image, $attachment_id, $size, $icon );
    713725}
    714726
    715727/**