Make WordPress Core


Ignore:
Timestamp:
10/08/2020 09:13:57 PM (4 years ago)
Author:
SergeyBiryukov
Message:

General: Replace older-style PHP type conversion functions with type casts.

This improves performance, readability, and consistency throughout core.

  • intval()(int)
  • strval()(string)
  • floatval()(float)

Props ayeshrajans.
Fixes #42918.

File:
1 edited

Legend:

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

    r48798 r49108  
    787787    }
    788788
    789     $fwidth  = ! empty( $_REQUEST['fwidth'] ) ? intval( $_REQUEST['fwidth'] ) : 0;
    790     $fheight = ! empty( $_REQUEST['fheight'] ) ? intval( $_REQUEST['fheight'] ) : 0;
     789    $fwidth  = ! empty( $_REQUEST['fwidth'] ) ? (int) $_REQUEST['fwidth'] : 0;
     790    $fheight = ! empty( $_REQUEST['fheight'] ) ? (int) $_REQUEST['fheight'] : 0;
    791791    $target  = ! empty( $_REQUEST['target'] ) ? preg_replace( '/[^a-z0-9_-]+/i', '', $_REQUEST['target'] ) : '';
    792792    $scale   = ! empty( $_REQUEST['do'] ) && 'scale' === $_REQUEST['do'];
     
    945945
    946946            if ( isset( $_wp_additional_image_sizes[ $size ] ) ) {
    947                 $width  = intval( $_wp_additional_image_sizes[ $size ]['width'] );
    948                 $height = intval( $_wp_additional_image_sizes[ $size ]['height'] );
     947                $width  = (int) $_wp_additional_image_sizes[ $size ]['width'];
     948                $height = (int) $_wp_additional_image_sizes[ $size ]['height'];
    949949                $crop   = ( $nocrop ) ? false : $_wp_additional_image_sizes[ $size ]['crop'];
    950950            } else {
Note: See TracChangeset for help on using the changeset viewer.