Make WordPress Core


Ignore:
Timestamp:
10/18/2020 05:25:10 PM (3 years ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Replace alias PHP functions with the canonical names.

Using the canonical function name for PHP functions is strongly recommended, as aliases may be deprecated or removed without (much) warning.

This replaces all uses of the following:

  • join() with implode()
  • sizeof() with count()
  • is_writeable() with is_writable()
  • doubleval() with a (float) cast

In part, this is a follow-up to #47746.

Props jrf.
See #50767.

File:
1 edited

Legend:

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

    r49119 r49193  
    24212421                $where .= ' AND 1=0 ';
    24222422            } else {
    2423                 $where .= " AND {$wpdb->posts}.post_type IN ('" . join( "', '", array_map( 'esc_sql', $in_search_post_types ) ) . "')";
     2423                $where .= " AND {$wpdb->posts}.post_type IN ('" . implode( "', '", array_map( 'esc_sql', $in_search_post_types ) ) . "')";
    24242424            }
    24252425        } elseif ( ! empty( $post_type ) && is_array( $post_type ) ) {
    2426             $where .= " AND {$wpdb->posts}.post_type IN ('" . join( "', '", esc_sql( $post_type ) ) . "')";
     2426            $where .= " AND {$wpdb->posts}.post_type IN ('" . implode( "', '", esc_sql( $post_type ) ) . "')";
    24272427        } elseif ( ! empty( $post_type ) ) {
    24282428            $where           .= $wpdb->prepare( " AND {$wpdb->posts}.post_type = %s", $post_type );
     
    24862486
    24872487            if ( ! empty( $e_status ) ) {
    2488                 $statuswheres[] = '(' . join( ' AND ', $e_status ) . ')';
     2488                $statuswheres[] = '(' . implode( ' AND ', $e_status ) . ')';
    24892489            }
    24902490            if ( ! empty( $r_status ) ) {
    24912491                if ( ! empty( $q['perm'] ) && 'editable' === $q['perm'] && ! current_user_can( $edit_others_cap ) ) {
    2492                     $statuswheres[] = "({$wpdb->posts}.post_author = $user_id " . 'AND (' . join( ' OR ', $r_status ) . '))';
     2492                    $statuswheres[] = "({$wpdb->posts}.post_author = $user_id " . 'AND (' . implode( ' OR ', $r_status ) . '))';
    24932493                } else {
    2494                     $statuswheres[] = '(' . join( ' OR ', $r_status ) . ')';
     2494                    $statuswheres[] = '(' . implode( ' OR ', $r_status ) . ')';
    24952495                }
    24962496            }
    24972497            if ( ! empty( $p_status ) ) {
    24982498                if ( ! empty( $q['perm'] ) && 'readable' === $q['perm'] && ! current_user_can( $read_private_cap ) ) {
    2499                     $statuswheres[] = "({$wpdb->posts}.post_author = $user_id " . 'AND (' . join( ' OR ', $p_status ) . '))';
     2499                    $statuswheres[] = "({$wpdb->posts}.post_author = $user_id " . 'AND (' . implode( ' OR ', $p_status ) . '))';
    25002500                } else {
    2501                     $statuswheres[] = '(' . join( ' OR ', $p_status ) . ')';
     2501                    $statuswheres[] = '(' . implode( ' OR ', $p_status ) . ')';
    25022502                }
    25032503            }
     
    26702670            }
    26712671
    2672             $post_ids = join( ',', $post_ids );
     2672            $post_ids = implode( ',', $post_ids );
    26732673            $join     = '';
    26742674            if ( $post_ids ) {
Note: See TracChangeset for help on using the changeset viewer.