Make WordPress Core

Changeset 52973


Ignore:
Timestamp:
03/21/2022 12:03:29 PM (2 years ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Wrap the $this->request property in wp-includes/class-wp-*-query.php.

This aims to improve readability by fitting the values on a single screen to avoid horizontal scrolling.

See #54728.

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

Legend:

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

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

    r51518 r52973  
    481481        $this->sql_clauses['limits']  = $limits;
    482482
    483         $this->request = "{$this->sql_clauses['select']} {$this->sql_clauses['from']} {$where} {$this->sql_clauses['groupby']} {$this->sql_clauses['orderby']} {$this->sql_clauses['limits']}";
     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        );
    484494
    485495        if ( $this->query_vars['count'] ) {
  • trunk/src/wp-includes/class-wp-query.php

    r52822 r52973  
    30013001        }
    30023002
    3003         $old_request   = "SELECT $found_rows $distinct $fields FROM {$wpdb->posts} $join WHERE 1=1 $where $groupby $orderby $limits";
     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        );
     3014
    30043015        $this->request = $old_request;
    30053016
     
    30873098                // First get the IDs and then fill in the objects.
    30883099
    3089                 $this->request = "SELECT $found_rows $distinct {$wpdb->posts}.ID FROM {$wpdb->posts} $join WHERE 1=1 $where $groupby $orderby $limits";
     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                );
    30903111
    30913112                /**
  • trunk/src/wp-includes/class-wp-site-query.php

    r52226 r52973  
    684684        $this->sql_clauses['limits']  = $limits;
    685685
    686         $this->request = "{$this->sql_clauses['select']} {$this->sql_clauses['from']} {$where} {$this->sql_clauses['groupby']} {$this->sql_clauses['orderby']} {$this->sql_clauses['limits']}";
     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        );
    687697
    688698        if ( $this->query_vars['count'] ) {
  • trunk/src/wp-includes/class-wp-term-query.php

    r52972 r52973  
    723723        $this->sql_clauses['limits']  = $limits;
    724724
    725         $this->request = "{$this->sql_clauses['select']} {$this->sql_clauses['from']} {$where} {$this->sql_clauses['orderby']} {$this->sql_clauses['limits']}";
     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        );
    726735
    727736        $this->terms = null;
  • trunk/src/wp-includes/class-wp-user-query.php

    r52653 r52973  
    771771
    772772        if ( null === $this->results ) {
    773             $this->request = "SELECT $this->query_fields $this->query_from $this->query_where $this->query_orderby $this->query_limit";
     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            );
    774783
    775784            if ( is_array( $qv['fields'] ) || 'all' === $qv['fields'] ) {
Note: See TracChangeset for help on using the changeset viewer.