Make WordPress Core

Changeset 52977


Ignore:
Timestamp:
03/22/2022 02:54:45 PM (4 years ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Use multi-line strings for the $this->request property in wp-includes/class-wp-*-query.php.

This further improves the readability by replacing implode() calls with string interpolation.

Follow-up to [52973].

Props jrf.
See #54728.

Location:
trunk/src/wp-includes
Files:
6 edited

Legend:

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

    r52974 r52977  
    962962                $this->sql_clauses['limits']  = $limits;
    963963
    964                 $this->request = implode(
    965                         ' ',
    966                         array(
    967                                 $this->sql_clauses['select'],
    968                                 $this->sql_clauses['from'],
    969                                 $where,
    970                                 $this->sql_clauses['groupby'],
    971                                 $this->sql_clauses['orderby'],
    972                                 $this->sql_clauses['limits'],
    973                         )
    974                 );
     964                $this->request = "
     965                        {$this->sql_clauses['select']}
     966                        {$this->sql_clauses['from']}
     967                        {$where}
     968                        {$this->sql_clauses['groupby']}
     969                        {$this->sql_clauses['orderby']}
     970                        {$this->sql_clauses['limits']}
     971                ";
    975972
    976973                if ( $this->query_vars['count'] ) {
  • trunk/src/wp-includes/class-wp-network-query.php

    r52974 r52977  
    481481                $this->sql_clauses['limits']  = $limits;
    482482
    483                 $this->request = implode(
    484                         ' ',
    485                         array(
    486                                 $this->sql_clauses['select'],
    487                                 $this->sql_clauses['from'],
    488                                 $where,
    489                                 $this->sql_clauses['groupby'],
    490                                 $this->sql_clauses['orderby'],
    491                                 $this->sql_clauses['limits'],
    492                         )
    493                 );
     483                $this->request = "
     484                        {$this->sql_clauses['select']}
     485                        {$this->sql_clauses['from']}
     486                        {$where}
     487                        {$this->sql_clauses['groupby']}
     488                        {$this->sql_clauses['orderby']}
     489                        {$this->sql_clauses['limits']}
     490                ";
    494491
    495492                if ( $this->query_vars['count'] ) {
  • trunk/src/wp-includes/class-wp-query.php

    r52974 r52977  
    30013001                }
    30023002
    3003                 $old_request = implode(
    3004                         ' ',
    3005                         array(
    3006                                 "SELECT $found_rows $distinct $fields",
    3007                                 "FROM {$wpdb->posts} $join",
    3008                                 "WHERE 1=1 $where",
    3009                                 $groupby,
    3010                                 $orderby,
    3011                                 $limits,
    3012                         )
    3013                 );
     3003                $old_request = "
     3004                        SELECT $found_rows $distinct $fields
     3005                        FROM {$wpdb->posts} $join
     3006                        WHERE 1=1 $where
     3007                        $groupby
     3008                        $orderby
     3009                        $limits
     3010                ";
    30143011
    30153012                $this->request = $old_request;
     
    30983095                                // First get the IDs and then fill in the objects.
    30993096
    3100                                 $this->request = implode(
    3101                                         ' ',
    3102                                         array(
    3103                                                 "SELECT $found_rows $distinct {$wpdb->posts}.ID",
    3104                                                 "FROM {$wpdb->posts} $join",
    3105                                                 "WHERE 1=1 $where",
    3106                                                 $groupby,
    3107                                                 $orderby,
    3108                                                 $limits,
    3109                                         )
    3110                                 );
     3097                                $this->request = "
     3098                                        SELECT $found_rows $distinct {$wpdb->posts}.ID
     3099                                        FROM {$wpdb->posts} $join
     3100                                        WHERE 1=1 $where
     3101                                        $groupby
     3102                                        $orderby
     3103                                        $limits
     3104                                ";
    31113105
    31123106                                /**
  • trunk/src/wp-includes/class-wp-site-query.php

    r52974 r52977  
    684684                $this->sql_clauses['limits']  = $limits;
    685685
    686                 $this->request = implode(
    687                         ' ',
    688                         array(
    689                                 $this->sql_clauses['select'],
    690                                 $this->sql_clauses['from'],
    691                                 $where,
    692                                 $this->sql_clauses['groupby'],
    693                                 $this->sql_clauses['orderby'],
    694                                 $this->sql_clauses['limits'],
    695                         )
    696                 );
     686                $this->request = "
     687                        {$this->sql_clauses['select']}
     688                        {$this->sql_clauses['from']}
     689                        {$where}
     690                        {$this->sql_clauses['groupby']}
     691                        {$this->sql_clauses['orderby']}
     692                        {$this->sql_clauses['limits']}
     693                ";
    697694
    698695                if ( $this->query_vars['count'] ) {
  • trunk/src/wp-includes/class-wp-term-query.php

    r52974 r52977  
    723723                $this->sql_clauses['limits']  = $limits;
    724724
    725                 $this->request = implode(
    726                         ' ',
    727                         array(
    728                                 $this->sql_clauses['select'],
    729                                 $this->sql_clauses['from'],
    730                                 $where,
    731                                 $this->sql_clauses['orderby'],
    732                                 $this->sql_clauses['limits'],
    733                         )
    734                 );
     725                $this->request = "
     726                        {$this->sql_clauses['select']}
     727                        {$this->sql_clauses['from']}
     728                        {$where}
     729                        {$this->sql_clauses['orderby']}
     730                        {$this->sql_clauses['limits']}
     731                ";
    735732
    736733                $this->terms = null;
  • trunk/src/wp-includes/class-wp-user-query.php

    r52973 r52977  
    771771
    772772                if ( null === $this->results ) {
    773                         $this->request = implode(
    774                                 ' ',
    775                                 array(
    776                                         "SELECT {$this->query_fields}",
    777                                         $this->query_from,
    778                                         $this->query_where,
    779                                         $this->query_orderby,
    780                                         $this->query_limit,
    781                                 )
    782                         );
     773                        $this->request = "
     774                                SELECT {$this->query_fields}
     775                                {$this->query_from}
     776                                {$this->query_where}
     777                                {$this->query_orderby}
     778                                {$this->query_limit}
     779                        ";
    783780
    784781                        if ( is_array( $qv['fields'] ) || 'all' === $qv['fields'] ) {
Note: See TracChangeset for help on using the changeset viewer.