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/template.php

    r48910 r49108  
    13221322                        echo '<span class="screen-reader-text">' . __( 'Warning:' ) . ' </span>';
    13231323                    }
    1324                     echo "{$box['title']}";
     1324                    echo $box['title'];
    13251325                    echo "</h2>\n";
    13261326
     
    22062206
    22072207    if ( 'page' === get_option( 'show_on_front' ) ) {
    2208         if ( intval( get_option( 'page_on_front' ) ) === $post->ID ) {
     2208        if ( (int) get_option( 'page_on_front' ) === $post->ID ) {
    22092209            $post_states['page_on_front'] = _x( 'Front Page', 'page label' );
    22102210        }
    22112211
    2212         if ( intval( get_option( 'page_for_posts' ) ) === $post->ID ) {
     2212        if ( (int) get_option( 'page_for_posts' ) === $post->ID ) {
    22132213            $post_states['page_for_posts'] = _x( 'Posts Page', 'page label' );
    22142214        }
    22152215    }
    22162216
    2217     if ( intval( get_option( 'wp_page_for_privacy_policy' ) ) === $post->ID ) {
     2217    if ( (int) get_option( 'wp_page_for_privacy_policy' ) === $post->ID ) {
    22182218        $post_states['page_for_privacy_policy'] = _x( 'Privacy Policy Page', 'page label' );
    22192219    }
Note: See TracChangeset for help on using the changeset viewer.