Plugin Directory

Changeset 3789375


Ignore:
Timestamp:
11/07/2026 10:36:52 AM (15 hours ago)
Author:
kgmservizi
Message:

Release 0.7: code review, coding standards, WP 7.1, direct links, unified name, new screenshot

Location:
show-thumbnail-sizes-name
Files:
9 edited
3 copied

Legend:

Unmodified
Added
Removed
  • show-thumbnail-sizes-name/assets/banner-1544x500.png

    • Property svn:mime-type changed from application/octet-stream to image/png
  • show-thumbnail-sizes-name/assets/banner-772x250.png

    • Property svn:mime-type changed from application/octet-stream to image/png
  • show-thumbnail-sizes-name/assets/icon-128x128.png

    • Property svn:mime-type changed from application/octet-stream to image/png
  • show-thumbnail-sizes-name/assets/icon-256x256.png

    • Property svn:mime-type changed from application/octet-stream to image/png
  • show-thumbnail-sizes-name/assets/screenshot-1.png

    • Property svn:mime-type changed from application/octet-stream to image/png
  • show-thumbnail-sizes-name/tags/0.7/index.php

    r1971583 r3789375  
    11<?php
    2 // Silence is golden.
     2/**
     3 * Silence is golden.
     4 *
     5 * @package ShowThumbnailSizesName
     6 */
  • show-thumbnail-sizes-name/tags/0.7/readme.txt

    r3358895 r3789375  
    1 === Thumbnail (image) size names and dimensions ===
     1=== Thumbnail (Image) Size Names and Dimensions ===
    22Contributors: kgmservizi
    33Donate link: https://kgmservizi.com
    4 Tags: thumbnail, thumbnail name, thumbnail sizes, thumbnail sizes name, thumbnail size, image sizes, image sizes dimension, thumbnail names
    5 Requires at least: 3.0
    6 Tested up to: 6.8
     4Tags: thumbnail, thumbnail sizes, image sizes, image size names, image dimensions
     5Requires at least: 4.6
     6Tested up to: 7.1
    77Requires PHP: 5.6
    8 Stable tag: 0.6
     8Stable tag: 0.7
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    1616**Don't work? Open ticket, we answer in max 48h.**
    1717
    18 You can easy view all image size names and dimensions in a settings page.
     18You can easily view all image size names and dimensions in a page under Tools.
    1919
    20 **Need to manage sizes generation?** Use our plugin [Disable Thumbnails, Threshold and Image Options](https://uskgm.it/disable-thumb-image-plugin "Disable Thumbnails, Threshold and Image Options")
     20**Need to manage sizes generation?** Use our plugin [Disable Thumbnails, Threshold and Image Options](https://wordpress.org/plugins/disable-thumbnails-and-threshold/ "Disable Thumbnails, Threshold and Image Options")
    2121
    2222
    … …  
    25251. Upload the plugin files to the '/wp-content/plugins/' directory, or install the plugin through the WordPress plugins page directly.
    26262. Activate the plugin through the 'Plugins' page in WordPress.
    27 3. Show plugin page in Tools -> Thumbnail Size.
     273. Open the plugin page in Tools -> Image Sizes.
    2828
    2929== Frequently Asked Questions ==
    … …  
    4040
    4141== Changelog ==
     42
     43= 0.7 =
     44* Code review and WordPress coding standards, translatable strings.
     45* Minimum WordPress version raised to 4.6.
     46* 7.1 compatibility.
     47* Direct link to the Disable Thumbnails plugin page.
     48* Image sizes shown in a standard, accessible admin table.
    4249
    4350= 0.6 =
    … …  
    8390== Upgrade Notice ==
    8491
     92= 0.7 =
     93Code review, coding standards and 7.1 compatibility.
     94
    8595= 0.6 =
    86966.8 compatibility and code revisions.
    … …  
    121131= 0.1 =
    122132Initial release.
    123 
    124 `<?php code(); // goes in backticks ?>`
  • show-thumbnail-sizes-name/tags/0.7/show-thumbnail-sizes-name.php

    r3358895 r3789375  
    11<?php
    22/**
    3  * Plugin Name: Thumbnail (Image) Size Names
    4  * Version: 0.6
    5  * Description: List of image size names of your installation.
    6  * Author: KGM Servizi
    7  * Author URI: https://kgmservizi.com
    8  * License: GPLv2 or later
    9  * License URI: https://www.gnu.org/licenses/gpl-2.0.html
     3 * Plugin Name:       Thumbnail (Image) Size Names and Dimensions
     4 * Version:           0.7
     5 * Description:       List of image size names and dimensions of your installation.
     6 * Author:            KGM Servizi
     7 * Author URI:        https://kgmservizi.com
     8 * License:           GPLv2 or later
     9 * License URI:       https://www.gnu.org/licenses/gpl-2.0.html
     10 * Text Domain:       show-thumbnail-sizes-name
     11 * Requires at least: 4.6
     12 * Requires PHP:      5.6
     13 *
     14 * @package ShowThumbnailSizesName
    1015 */
    1116
     17defined( 'ABSPATH' ) || exit;
     18
     19add_action( 'admin_menu', 'show_thumbnail_sizes_name_menu' );
     20
    1221/**
    13  *
    14  * Image size names menù and option
    15  *
     22 * Registers the page under Tools.
     23 *
     24 * @return void
    1625 */
    17 add_action('admin_menu', 'show_thumbnail_sizes_name_menu');
    1826function show_thumbnail_sizes_name_menu() {
    19         add_management_page('Image Sizes', 'Image Sizes', 'activate_plugins', 'show-thumbnail-size-name', 'show_thumbnail_sizes_name_function');
    20 }
    21 
    22 // Add nonce via admin_init hook
    23 add_action('admin_init', 'show_thumbnail_sizes_handle_nonce_redirect');
    24 function show_thumbnail_sizes_handle_nonce_redirect() {
    25         if (isset($_GET['page']) && $_GET['page'] === 'show-thumbnail-size-name') {
    26                 if (!isset($_GET['_wpnonce']) || !wp_verify_nonce($_GET['_wpnonce'], 'show_thumbnail_sizes_nonce')) {
    27                         // Redirect to add nonce
    28                         $redirect_url = add_query_arg('_wpnonce', wp_create_nonce('show_thumbnail_sizes_nonce'), admin_url('tools.php?page=show-thumbnail-size-name'));
    29                         wp_redirect($redirect_url);
    30                         exit;
    31                 }
    32         }
     27        add_management_page(
     28                __( 'Image Sizes', 'show-thumbnail-sizes-name' ),
     29                __( 'Image Sizes', 'show-thumbnail-sizes-name' ),
     30                'activate_plugins',
     31                'show-thumbnail-size-name',
     32                'show_thumbnail_sizes_name_function'
     33        );
    3334}
    3435
    3536/**
    36  *
    37  * Show list of image sizes
     37 * Renders the list of registered image sizes.
     38 *
     39 * Read-only page: it changes no state, so it needs no nonce. Core already
     40 * enforces the menu capability; the check below is defence in depth.
     41 *
     42 * @return void
    3843 */
    3944function show_thumbnail_sizes_name_function() {
    40         // Enhanced security checks
    4145        if ( ! current_user_can( 'activate_plugins' ) ) {
    42                 wp_die(
    43                         '<h1>' . __( 'Access Denied' ) . '</h1>' .
    44                         '<p>' . __( 'You do not have sufficient permissions to access this page. This page requires the ability to activate plugins.' ) . '</p>',
    45                         __( 'Access Denied' ),
     46                wp_die(
     47                        esc_html__( 'You do not have sufficient permissions to access this page.', 'show-thumbnail-sizes-name' ),
     48                        esc_html__( 'Access Denied', 'show-thumbnail-sizes-name' ),
    4649                        array( 'response' => 403 )
    4750                );
    4851        }
    49        
    50         // Nonce is already verified in admin_init hook
    51        
    52         echo '<div style="margin: 50px 25px;">';
    53     echo '<h1 style="margin: 0 0 25px 0">Image Size Names</h1>';
    54     echo '<h3>You can disable image sizes with <a href="https://uskgm.it/disable-thumb-image-plugin" target="_blank" rel="noopener">this plugin</a>.</h3>';
    55     echo '<pre>';   
    56         foreach ( show_thumbnail_sizes_name_get_image_size() as $name => $_size ) {
    57                 echo '<div style="margin: 50px 0 0 0">';
    58                 echo '<h3>' . esc_html( $name ) . '</h3>';
    59                 echo 'width => ' . esc_html( $_size['width'] ) . '</br>';
    60                 echo 'height => ' . esc_html( $_size['height'] ) . '</br>';
    61                 if ($_size['crop'] == 1) {
    62                         echo 'crop => <b>TRUE</b>';
    63                 } else {
    64                         echo 'crop => false';
    65                 }               
    66                 echo '</div>';
    67         }
    68     echo '</pre></div>';
     52        ?>
     53        <div class="wrap">
     54                <h1><?php esc_html_e( 'Image Size Names', 'show-thumbnail-sizes-name' ); ?></h1>
     55                <p>
     56                        <?php
     57                        printf(
     58                                /* translators: %s: link to the Disable Thumbnails plugin. */
     59                                esc_html__( 'You can disable image sizes with %s.', 'show-thumbnail-sizes-name' ),
     60                                '<a href="' . esc_url( 'https://wordpress.org/plugins/disable-thumbnails-and-threshold/' ) . '" target="_blank" rel="noopener">' . esc_html__( 'this plugin', 'show-thumbnail-sizes-name' ) . '<span class="screen-reader-text"> ' . esc_html__( '(opens in a new tab)', 'show-thumbnail-sizes-name' ) . '</span></a>'
     61                        );
     62                        ?>
     63                </p>
     64                <table class="widefat striped">
     65                        <caption class="screen-reader-text"><?php esc_html_e( 'Registered image sizes', 'show-thumbnail-sizes-name' ); ?></caption>
     66                        <thead>
     67                                <tr>
     68                                        <th scope="col"><?php esc_html_e( 'Name', 'show-thumbnail-sizes-name' ); ?></th>
     69                                        <th scope="col"><?php esc_html_e( 'Width', 'show-thumbnail-sizes-name' ); ?></th>
     70                                        <th scope="col"><?php esc_html_e( 'Height', 'show-thumbnail-sizes-name' ); ?></th>
     71                                        <th scope="col"><?php esc_html_e( 'Crop', 'show-thumbnail-sizes-name' ); ?></th>
     72                                </tr>
     73                        </thead>
     74                        <tbody>
     75                                <?php foreach ( show_thumbnail_sizes_name_get_image_size() as $name => $size ) : ?>
     76                                        <tr>
     77                                                <td><code><?php echo esc_html( $name ); ?></code></td>
     78                                                <td><?php echo esc_html( $size['width'] ); ?></td>
     79                                                <td><?php echo esc_html( $size['height'] ); ?></td>
     80                                                <td>
     81                                                        <?php
     82                                                        if ( $size['crop'] ) {
     83                                                                echo '<strong>' . esc_html__( 'Yes', 'show-thumbnail-sizes-name' ) . '</strong>';
     84                                                        } else {
     85                                                                esc_html_e( 'No', 'show-thumbnail-sizes-name' );
     86                                                        }
     87                                                        ?>
     88                                                </td>
     89                                        </tr>
     90                                <?php endforeach; ?>
     91                        </tbody>
     92                </table>
     93        </div>
     94        <?php
    6995}
    7096
    7197/**
    72  *
    73  * Function for retrieve all image sizes
    74  *
     98 * Collects every intermediate image size with its dimensions.
     99 *
     100 * @return array<string, array{width: int, height: int, crop: bool}> Sizes keyed by name.
    75101 */
    76102function show_thumbnail_sizes_name_get_image_size() {
    … …  
    79105        $sizes = array();
    80106
    81         foreach ( get_intermediate_image_sizes() as $_size ) {
    82                 if ( in_array( $_size, array('thumbnail', 'medium', 'medium_large', 'large') ) ) {
    83                         $width = get_option( "{$_size}_size_w" );
    84                         $height = get_option( "{$_size}_size_h" );
    85                         $crop = get_option( "{$_size}_crop" );
    86                        
    87                         $sizes[ $_size ]['width']  = is_numeric( $width ) ? (int) $width : 0;
    88                         $sizes[ $_size ]['height'] = is_numeric( $height ) ? (int) $height : 0;
    89                         $sizes[ $_size ]['crop']   = (bool) $crop;
    90                 } elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) {
    91                         $additional_size = $_wp_additional_image_sizes[ $_size ];
    92                        
    93                         $sizes[ $_size ] = array(
    94                                 'width'  => is_numeric( $additional_size['width'] ) ? (int) $additional_size['width'] : 0,
    95                                 'height' => is_numeric( $additional_size['height'] ) ? (int) $additional_size['height'] : 0,
    96                                 'crop'   => (bool) $additional_size['crop'],
    97                         );
     107        foreach ( get_intermediate_image_sizes() as $size_name ) {
     108                if ( in_array( $size_name, array( 'thumbnail', 'medium', 'medium_large', 'large' ), true ) ) {
     109                        $width  = get_option( "{$size_name}_size_w" );
     110                        $height = get_option( "{$size_name}_size_h" );
     111                        $crop   = get_option( "{$size_name}_crop" );
     112                } elseif ( isset( $_wp_additional_image_sizes[ $size_name ] ) ) {
     113                        $width  = $_wp_additional_image_sizes[ $size_name ]['width'];
     114                        $height = $_wp_additional_image_sizes[ $size_name ]['height'];
     115                        $crop   = $_wp_additional_image_sizes[ $size_name ]['crop'];
     116                } else {
     117                        continue;
    98118                }
     119
     120                $sizes[ $size_name ] = array(
     121                        'width'  => is_numeric( $width ) ? (int) $width : 0,
     122                        'height' => is_numeric( $height ) ? (int) $height : 0,
     123                        // Crop may be an array of positions for custom sizes: any non-empty value means cropped.
     124                        'crop'   => (bool) $crop,
     125                );
    99126        }
    100127
  • show-thumbnail-sizes-name/trunk/index.php

    r1971583 r3789375  
    11<?php
    2 // Silence is golden.
     2/**
     3 * Silence is golden.
     4 *
     5 * @package ShowThumbnailSizesName
     6 */
  • show-thumbnail-sizes-name/trunk/readme.txt

    r3358895 r3789375  
    1 === Thumbnail (image) size names and dimensions ===
     1=== Thumbnail (Image) Size Names and Dimensions ===
    22Contributors: kgmservizi
    33Donate link: https://kgmservizi.com
    4 Tags: thumbnail, thumbnail name, thumbnail sizes, thumbnail sizes name, thumbnail size, image sizes, image sizes dimension, thumbnail names
    5 Requires at least: 3.0
    6 Tested up to: 6.8
     4Tags: thumbnail, thumbnail sizes, image sizes, image size names, image dimensions
     5Requires at least: 4.6
     6Tested up to: 7.1
    77Requires PHP: 5.6
    8 Stable tag: 0.6
     8Stable tag: 0.7
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    1616**Don't work? Open ticket, we answer in max 48h.**
    1717
    18 You can easy view all image size names and dimensions in a settings page.
     18You can easily view all image size names and dimensions in a page under Tools.
    1919
    20 **Need to manage sizes generation?** Use our plugin [Disable Thumbnails, Threshold and Image Options](https://uskgm.it/disable-thumb-image-plugin "Disable Thumbnails, Threshold and Image Options")
     20**Need to manage sizes generation?** Use our plugin [Disable Thumbnails, Threshold and Image Options](https://wordpress.org/plugins/disable-thumbnails-and-threshold/ "Disable Thumbnails, Threshold and Image Options")
    2121
    2222
    … …  
    25251. Upload the plugin files to the '/wp-content/plugins/' directory, or install the plugin through the WordPress plugins page directly.
    26262. Activate the plugin through the 'Plugins' page in WordPress.
    27 3. Show plugin page in Tools -> Thumbnail Size.
     273. Open the plugin page in Tools -> Image Sizes.
    2828
    2929== Frequently Asked Questions ==
    … …  
    4040
    4141== Changelog ==
     42
     43= 0.7 =
     44* Code review and WordPress coding standards, translatable strings.
     45* Minimum WordPress version raised to 4.6.
     46* 7.1 compatibility.
     47* Direct link to the Disable Thumbnails plugin page.
     48* Image sizes shown in a standard, accessible admin table.
    4249
    4350= 0.6 =
    … …  
    8390== Upgrade Notice ==
    8491
     92= 0.7 =
     93Code review, coding standards and 7.1 compatibility.
     94
    8595= 0.6 =
    86966.8 compatibility and code revisions.
    … …  
    121131= 0.1 =
    122132Initial release.
    123 
    124 `<?php code(); // goes in backticks ?>`
  • show-thumbnail-sizes-name/trunk/show-thumbnail-sizes-name.php

    r3358895 r3789375  
    11<?php
    22/**
    3  * Plugin Name: Thumbnail (Image) Size Names
    4  * Version: 0.6
    5  * Description: List of image size names of your installation.
    6  * Author: KGM Servizi
    7  * Author URI: https://kgmservizi.com
    8  * License: GPLv2 or later
    9  * License URI: https://www.gnu.org/licenses/gpl-2.0.html
     3 * Plugin Name:       Thumbnail (Image) Size Names and Dimensions
     4 * Version:           0.7
     5 * Description:       List of image size names and dimensions of your installation.
     6 * Author:            KGM Servizi
     7 * Author URI:        https://kgmservizi.com
     8 * License:           GPLv2 or later
     9 * License URI:       https://www.gnu.org/licenses/gpl-2.0.html
     10 * Text Domain:       show-thumbnail-sizes-name
     11 * Requires at least: 4.6
     12 * Requires PHP:      5.6
     13 *
     14 * @package ShowThumbnailSizesName
    1015 */
    1116
     17defined( 'ABSPATH' ) || exit;
     18
     19add_action( 'admin_menu', 'show_thumbnail_sizes_name_menu' );
     20
    1221/**
    13  *
    14  * Image size names menù and option
    15  *
     22 * Registers the page under Tools.
     23 *
     24 * @return void
    1625 */
    17 add_action('admin_menu', 'show_thumbnail_sizes_name_menu');
    1826function show_thumbnail_sizes_name_menu() {
    19         add_management_page('Image Sizes', 'Image Sizes', 'activate_plugins', 'show-thumbnail-size-name', 'show_thumbnail_sizes_name_function');
    20 }
    21 
    22 // Add nonce via admin_init hook
    23 add_action('admin_init', 'show_thumbnail_sizes_handle_nonce_redirect');
    24 function show_thumbnail_sizes_handle_nonce_redirect() {
    25         if (isset($_GET['page']) && $_GET['page'] === 'show-thumbnail-size-name') {
    26                 if (!isset($_GET['_wpnonce']) || !wp_verify_nonce($_GET['_wpnonce'], 'show_thumbnail_sizes_nonce')) {
    27                         // Redirect to add nonce
    28                         $redirect_url = add_query_arg('_wpnonce', wp_create_nonce('show_thumbnail_sizes_nonce'), admin_url('tools.php?page=show-thumbnail-size-name'));
    29                         wp_redirect($redirect_url);
    30                         exit;
    31                 }
    32         }
     27        add_management_page(
     28                __( 'Image Sizes', 'show-thumbnail-sizes-name' ),
     29                __( 'Image Sizes', 'show-thumbnail-sizes-name' ),
     30                'activate_plugins',
     31                'show-thumbnail-size-name',
     32                'show_thumbnail_sizes_name_function'
     33        );
    3334}
    3435
    3536/**
    36  *
    37  * Show list of image sizes
     37 * Renders the list of registered image sizes.
     38 *
     39 * Read-only page: it changes no state, so it needs no nonce. Core already
     40 * enforces the menu capability; the check below is defence in depth.
     41 *
     42 * @return void
    3843 */
    3944function show_thumbnail_sizes_name_function() {
    40         // Enhanced security checks
    4145        if ( ! current_user_can( 'activate_plugins' ) ) {
    42                 wp_die(
    43                         '<h1>' . __( 'Access Denied' ) . '</h1>' .
    44                         '<p>' . __( 'You do not have sufficient permissions to access this page. This page requires the ability to activate plugins.' ) . '</p>',
    45                         __( 'Access Denied' ),
     46                wp_die(
     47                        esc_html__( 'You do not have sufficient permissions to access this page.', 'show-thumbnail-sizes-name' ),
     48                        esc_html__( 'Access Denied', 'show-thumbnail-sizes-name' ),
    4649                        array( 'response' => 403 )
    4750                );
    4851        }
    49        
    50         // Nonce is already verified in admin_init hook
    51        
    52         echo '<div style="margin: 50px 25px;">';
    53     echo '<h1 style="margin: 0 0 25px 0">Image Size Names</h1>';
    54     echo '<h3>You can disable image sizes with <a href="https://uskgm.it/disable-thumb-image-plugin" target="_blank" rel="noopener">this plugin</a>.</h3>';
    55     echo '<pre>';   
    56         foreach ( show_thumbnail_sizes_name_get_image_size() as $name => $_size ) {
    57                 echo '<div style="margin: 50px 0 0 0">';
    58                 echo '<h3>' . esc_html( $name ) . '</h3>';
    59                 echo 'width => ' . esc_html( $_size['width'] ) . '</br>';
    60                 echo 'height => ' . esc_html( $_size['height'] ) . '</br>';
    61                 if ($_size['crop'] == 1) {
    62                         echo 'crop => <b>TRUE</b>';
    63                 } else {
    64                         echo 'crop => false';
    65                 }               
    66                 echo '</div>';
    67         }
    68     echo '</pre></div>';
     52        ?>
     53        <div class="wrap">
     54                <h1><?php esc_html_e( 'Image Size Names', 'show-thumbnail-sizes-name' ); ?></h1>
     55                <p>
     56                        <?php
     57                        printf(
     58                                /* translators: %s: link to the Disable Thumbnails plugin. */
     59                                esc_html__( 'You can disable image sizes with %s.', 'show-thumbnail-sizes-name' ),
     60                                '<a href="' . esc_url( 'https://wordpress.org/plugins/disable-thumbnails-and-threshold/' ) . '" target="_blank" rel="noopener">' . esc_html__( 'this plugin', 'show-thumbnail-sizes-name' ) . '<span class="screen-reader-text"> ' . esc_html__( '(opens in a new tab)', 'show-thumbnail-sizes-name' ) . '</span></a>'
     61                        );
     62                        ?>
     63                </p>
     64                <table class="widefat striped">
     65                        <caption class="screen-reader-text"><?php esc_html_e( 'Registered image sizes', 'show-thumbnail-sizes-name' ); ?></caption>
     66                        <thead>
     67                                <tr>
     68                                        <th scope="col"><?php esc_html_e( 'Name', 'show-thumbnail-sizes-name' ); ?></th>
     69                                        <th scope="col"><?php esc_html_e( 'Width', 'show-thumbnail-sizes-name' ); ?></th>
     70                                        <th scope="col"><?php esc_html_e( 'Height', 'show-thumbnail-sizes-name' ); ?></th>
     71                                        <th scope="col"><?php esc_html_e( 'Crop', 'show-thumbnail-sizes-name' ); ?></th>
     72                                </tr>
     73                        </thead>
     74                        <tbody>
     75                                <?php foreach ( show_thumbnail_sizes_name_get_image_size() as $name => $size ) : ?>
     76                                        <tr>
     77                                                <td><code><?php echo esc_html( $name ); ?></code></td>
     78                                                <td><?php echo esc_html( $size['width'] ); ?></td>
     79                                                <td><?php echo esc_html( $size['height'] ); ?></td>
     80                                                <td>
     81                                                        <?php
     82                                                        if ( $size['crop'] ) {
     83                                                                echo '<strong>' . esc_html__( 'Yes', 'show-thumbnail-sizes-name' ) . '</strong>';
     84                                                        } else {
     85                                                                esc_html_e( 'No', 'show-thumbnail-sizes-name' );
     86                                                        }
     87                                                        ?>
     88                                                </td>
     89                                        </tr>
     90                                <?php endforeach; ?>
     91                        </tbody>
     92                </table>
     93        </div>
     94        <?php
    6995}
    7096
    7197/**
    72  *
    73  * Function for retrieve all image sizes
    74  *
     98 * Collects every intermediate image size with its dimensions.
     99 *
     100 * @return array<string, array{width: int, height: int, crop: bool}> Sizes keyed by name.
    75101 */
    76102function show_thumbnail_sizes_name_get_image_size() {
    … …  
    79105        $sizes = array();
    80106
    81         foreach ( get_intermediate_image_sizes() as $_size ) {
    82                 if ( in_array( $_size, array('thumbnail', 'medium', 'medium_large', 'large') ) ) {
    83                         $width = get_option( "{$_size}_size_w" );
    84                         $height = get_option( "{$_size}_size_h" );
    85                         $crop = get_option( "{$_size}_crop" );
    86                        
    87                         $sizes[ $_size ]['width']  = is_numeric( $width ) ? (int) $width : 0;
    88                         $sizes[ $_size ]['height'] = is_numeric( $height ) ? (int) $height : 0;
    89                         $sizes[ $_size ]['crop']   = (bool) $crop;
    90                 } elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) {
    91                         $additional_size = $_wp_additional_image_sizes[ $_size ];
    92                        
    93                         $sizes[ $_size ] = array(
    94                                 'width'  => is_numeric( $additional_size['width'] ) ? (int) $additional_size['width'] : 0,
    95                                 'height' => is_numeric( $additional_size['height'] ) ? (int) $additional_size['height'] : 0,
    96                                 'crop'   => (bool) $additional_size['crop'],
    97                         );
     107        foreach ( get_intermediate_image_sizes() as $size_name ) {
     108                if ( in_array( $size_name, array( 'thumbnail', 'medium', 'medium_large', 'large' ), true ) ) {
     109                        $width  = get_option( "{$size_name}_size_w" );
     110                        $height = get_option( "{$size_name}_size_h" );
     111                        $crop   = get_option( "{$size_name}_crop" );
     112                } elseif ( isset( $_wp_additional_image_sizes[ $size_name ] ) ) {
     113                        $width  = $_wp_additional_image_sizes[ $size_name ]['width'];
     114                        $height = $_wp_additional_image_sizes[ $size_name ]['height'];
     115                        $crop   = $_wp_additional_image_sizes[ $size_name ]['crop'];
     116                } else {
     117                        continue;
    98118                }
     119
     120                $sizes[ $size_name ] = array(
     121                        'width'  => is_numeric( $width ) ? (int) $width : 0,
     122                        'height' => is_numeric( $height ) ? (int) $height : 0,
     123                        // Crop may be an array of positions for custom sizes: any non-empty value means cropped.
     124                        'crop'   => (bool) $crop,
     125                );
    99126        }
    100127
Note: See TracChangeset for help on using the changeset viewer.