Make WordPress Core

Changeset 27128


Ignore:
Timestamp:
02/08/2014 12:19:29 AM (11 years ago)
Author:
wonderboymusic
Message:

Introduce has_image_size( $name ), a utility function that helps avoid loading the $_wp_additional_image_sizes global.

Props mordauk.
Fixes #26951.

File:
1 edited

Legend:

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

    r27127 r27128  
    189189    global $_wp_additional_image_sizes;
    190190    $_wp_additional_image_sizes[$name] = array( 'width' => absint( $width ), 'height' => absint( $height ), 'crop' => (bool) $crop );
     191}
     192
     193/**
     194 * Check if an image size exists
     195 *
     196 * @since 3.9.0
     197 *
     198 * @param string $name The image size name.
     199 * @return bool True if it exists, false if not.
     200 */
     201function has_image_size( $name = '' ) {
     202    global $_wp_additional_image_sizes;
     203
     204    return isset( $_wp_additional_image_sizes[$name] );
    191205}
    192206
Note: See TracChangeset for help on using the changeset viewer.