WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/08/2020 09:13:57 PM (14 months 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-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php

    r48547 r49108  
    500500            $size = $image_editor->get_size();
    501501
    502             $crop_x = round( ( $size['width'] * floatval( $request['x'] ) ) / 100.0 );
    503             $crop_y = round( ( $size['height'] * floatval( $request['y'] ) ) / 100.0 );
    504             $width  = round( ( $size['width'] * floatval( $request['width'] ) ) / 100.0 );
    505             $height = round( ( $size['height'] * floatval( $request['height'] ) ) / 100.0 );
     502            $crop_x = round( ( $size['width'] * (float) $request['x'] ) / 100.0 );
     503            $crop_y = round( ( $size['height'] * (float) $request['y'] ) / 100.0 );
     504            $width  = round( ( $size['width'] * (float) $request['width'] ) / 100.0 );
     505            $height = round( ( $size['height'] * (float) $request['height'] ) / 100.0 );
    506506
    507507            $result = $image_editor->crop( $crop_x, $crop_y, $width, $height );
Note: See TracChangeset for help on using the changeset viewer.