Make WordPress Core

Ticket #25832: 25832.2.diff

File 25832.2.diff, 4.1 KB (added by theorboman, 11 years ago)

Fixed indentation (again!)

  • wp-admin/includes/image.php

     
    102102                                $sizes[$s]['crop'] = get_option( "{$s}_crop" ); // For default sizes set in options
    103103                }
    104104
     105                /**
     106                 * Filter the image sizes automatically generated when uploading an image.
     107                 *
     108                 * @since 2.9.0
     109                 *
     110                 * @param array $sizes Array of image sizes.
     111                 */
    105112                $sizes = apply_filters( 'intermediate_image_sizes_advanced', $sizes );
    106113
    107114                if ( $sizes ) {
     
    155162        if ( isset( $metadata['image']['data'] ) )
    156163                unset( $metadata['image']['data'] );
    157164
     165        /**
     166         * Filter the attachment metadata.
     167         *
     168         * @since 2.1.0
     169         *
     170         * @param array $metadata      Attachment metadata.
     171         * @param int   $attachment_id Attachment ID.
     172         */
    158173        return apply_filters( 'wp_generate_attachment_metadata', $metadata, $attachment_id );
    159174}
    160175
     
    268283                 }
    269284        }
    270285
     286        /**
     287         * Filter the image types for which to check for exif data.
     288         *
     289         * @since 2.5.0
     290         *
     291         * @param array Image types to check for exit data.
     292         */
    271293        // fetch additional info from exif if available
    272294        if ( is_callable( 'exif_read_data' ) && in_array( $sourceImageType, apply_filters( 'wp_read_image_metadata_types', array( IMAGETYPE_JPEG, IMAGETYPE_TIFF_II, IMAGETYPE_TIFF_MM ) ) ) ) {
    273295                $exif = @exif_read_data( $file );
     
    316338                        $meta[ $key ] = utf8_encode( $meta[ $key ] );
    317339        }
    318340
     341        /**
     342         * Filter the returned image metadata.
     343         *
     344         * @since 2.5.0
     345         *
     346         * @param array  $meta            Image metadata.
     347         * @param string $file            Path to image file.
     348         * @param int    $sourceImageType Type of image @see http://php.net/manual/en/function.getimagesize.php.
     349         */
    319350        return apply_filters( 'wp_read_image_metadata', $meta, $file, $sourceImageType );
    320351
    321352}
     
    351382        else
    352383                $result = true;
    353384
     385        /**
     386         * Filter the result as to whether or not the image is displayable in a web browser.
     387         *
     388         * @since 2.5.0
     389         *
     390         * @param bool   $result Whether or not the image can be displayed.
     391         * @param string $path   Path to the image.
     392         */
    354393        return apply_filters('file_is_displayable_image', $result, $path);
    355394}
    356395
     
    384423                        break;
    385424        }
    386425        if ( is_resource($image) ) {
     426
     427                /**
     428                 * Filter the image resource to be edited.
     429                 *
     430                 * @since 2.9.0
     431                 *
     432                 * @param resource $image         Image resource.
     433                 * @param string   $attachment_id Attachment ID.
     434                 * @param string   $size          Size of the image.
     435                 */
    387436                $image = apply_filters('load_image_to_edit', $image, $attachment_id, $size);
    388437                if ( function_exists('imagealphablending') && function_exists('imagesavealpha') ) {
    389438                        imagealphablending($image, false);
     
    411460
    412461        if ( $filepath && file_exists( $filepath ) ) {
    413462                if ( 'full' != $size && ( $data = image_get_intermediate_size( $attachment_id, $size ) ) ) {
     463
     464                /**
     465                 * Filter the path to the image.
     466                 *
     467                 * @since 3.1.0
     468                 *
     469                 * @param string                Path to the image.
     470                 * @param string $attachment_id Attachment ID.
     471                 * @param string $size          Size of the image.
     472                 */
    414473                        $filepath = apply_filters( 'load_image_to_edit_filesystempath', path_join( dirname( $filepath ), $data['file'] ), $attachment_id, $size );
    415474                }
    416475        } elseif ( function_exists( 'fopen' ) && function_exists( 'ini_get' ) && true == ini_get( 'allow_url_fopen' ) ) {
     476
     477                /* Filter the url to the image if not on the local filesystem.
     478                 *
     479                 * @since 3.1.0
     480                 *
     481                 * @param string                Image url.
     482                 * @param string $attachment_id Attachment ID.
     483                 * @param string $size          Size of the image.
     484                 */
    417485                $filepath = apply_filters( 'load_image_to_edit_attachmenturl', wp_get_attachment_url( $attachment_id ), $attachment_id, $size );
    418486        }
    419487
     488        /**
     489         * Filter the returned path or url of the image.
     490         *
     491         * @since 2.9.0
     492         *
     493         * @param string|false $filepath      Filepath or url to image or false.
     494         * @param string       $attachment_id Attachment ID.
     495         * @param string       $size          Size of the image.
     496         */
    420497        return apply_filters( 'load_image_to_edit_path', $filepath, $attachment_id, $size );
    421498}
    422499