Make WordPress Core

Ticket #54728: 54728.5.diff

File 54728.5.diff, 6.7 KB (added by azouamauriac, 3 years ago)

Fix "WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase" in src/wp-includes/class-wp-http-curl.php src/wp-includes/class-wp-http-streams.php src/wp-includes/category-template.php;

  • src/wp-includes/class-wp-http-curl.php

     
    258258                curl_exec( $handle );
    259259
    260260                $processed_headers   = WP_Http::processHeaders( $this->headers, $url );
    261                 $theBody             = $this->body;
     261                $the_body            = $this->body;
    262262                $bytes_written_total = $this->bytes_written_total;
    263263
    264264                $this->headers             = '';
     
    268268                $curl_error = curl_errno( $handle );
    269269
    270270                // If an error occurred, or, no response.
    271                 if ( $curl_error || ( 0 == strlen( $theBody ) && empty( $processed_headers['headers'] ) ) ) {
     271                if ( $curl_error || ( 0 == strlen( $the_body ) && empty( $processed_headers['headers'] ) ) ) {
    272272                        if ( CURLE_WRITE_ERROR /* 23 */ == $curl_error ) {
    273273                                if ( ! $this->max_body_length || $this->max_body_length != $bytes_written_total ) {
    274274                                        if ( $parsed_args['stream'] ) {
     
    316316                if ( true === $parsed_args['decompress']
    317317                        && true === WP_Http_Encoding::should_decode( $processed_headers['headers'] )
    318318                ) {
    319                         $theBody = WP_Http_Encoding::decompress( $theBody );
     319                        $the_body = WP_Http_Encoding::decompress( $the_body );
    320320                }
    321321
    322                 $response['body'] = $theBody;
     322                $response['body'] = $the_body;
    323323
    324324                return $response;
    325325        }
  • src/wp-includes/class-wp-http-streams.php

     
    206206                stream_set_timeout( $handle, $timeout, $utimeout );
    207207
    208208                if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) { // Some proxies require full URL in this field.
    209                         $requestPath = $url;
     209                        $request_path = $url;
    210210                } else {
    211                         $requestPath = $parsed_url['path'] . ( isset( $parsed_url['query'] ) ? '?' . $parsed_url['query'] : '' );
     211                        $request_path = $parsed_url['path'] . ( isset( $parsed_url['query'] ) ? '?' . $parsed_url['query'] : '' );
    212212                }
    213213
    214                 $strHeaders = strtoupper( $parsed_args['method'] ) . ' ' . $requestPath . ' HTTP/' . $parsed_args['httpversion'] . "\r\n";
     214                $str_headers = strtoupper( $parsed_args['method'] ) . ' ' . $request_path . ' HTTP/' . $parsed_args['httpversion'] . "\r\n";
    215215
    216216                $include_port_in_host_header = (
    217217                        ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) )
     
    220220                );
    221221
    222222                if ( $include_port_in_host_header ) {
    223                         $strHeaders .= 'Host: ' . $parsed_url['host'] . ':' . $parsed_url['port'] . "\r\n";
     223                        $str_headers .= 'Host: ' . $parsed_url['host'] . ':' . $parsed_url['port'] . "\r\n";
    224224                } else {
    225                         $strHeaders .= 'Host: ' . $parsed_url['host'] . "\r\n";
     225                        $str_headers .= 'Host: ' . $parsed_url['host'] . "\r\n";
    226226                }
    227227
    228228                if ( isset( $parsed_args['user-agent'] ) ) {
    229                         $strHeaders .= 'User-agent: ' . $parsed_args['user-agent'] . "\r\n";
     229                        $str_headers .= 'User-agent: ' . $parsed_args['user-agent'] . "\r\n";
    230230                }
    231231
    232232                if ( is_array( $parsed_args['headers'] ) ) {
    233                         foreach ( (array) $parsed_args['headers'] as $header => $headerValue ) {
    234                                 $strHeaders .= $header . ': ' . $headerValue . "\r\n";
     233                        foreach ( (array) $parsed_args['headers'] as $header => $header_value ) {
     234                                $str_headers .= $header . ': ' . $header_value . "\r\n";
    235235                        }
    236236                } else {
    237                         $strHeaders .= $parsed_args['headers'];
     237                        $str_headers .= $parsed_args['headers'];
    238238                }
    239239
    240240                if ( $proxy->use_authentication() ) {
    241                         $strHeaders .= $proxy->authentication_header() . "\r\n";
     241                        $str_headers .= $proxy->authentication_header() . "\r\n";
    242242                }
    243243
    244                 $strHeaders .= "\r\n";
     244                $str_headers .= "\r\n";
    245245
    246246                if ( ! is_null( $parsed_args['body'] ) ) {
    247                         $strHeaders .= $parsed_args['body'];
     247                        $str_headers .= $parsed_args['body'];
    248248                }
    249249
    250                 fwrite( $handle, $strHeaders );
     250                fwrite( $handle, $str_headers );
    251251
    252252                if ( ! $parsed_args['blocking'] ) {
    253253                        stream_set_blocking( $handle, 0 );
     
    263263                        );
    264264                }
    265265
    266                 $strResponse = '';
    267                 $bodyStarted = false;
     266                $str_response = '';
     267                $body_started = false;
    268268                $keep_reading = true;
    269269                $block_size   = 4096;
    270270
     
    296296
    297297                        while ( ! feof( $handle ) && $keep_reading ) {
    298298                                $block = fread( $handle, $block_size );
    299                                 if ( ! $bodyStarted ) {
    300                                         $strResponse .= $block;
    301                                         if ( strpos( $strResponse, "\r\n\r\n" ) ) {
    302                                                 $processed_response = WP_Http::processResponse( $strResponse );
    303                                                 $bodyStarted        = true;
     299                                if ( ! $body_started ) {
     300                                        $str_response .= $block;
     301                                        if ( strpos( $str_response, "\r\n\r\n" ) ) {
     302                                                $processed_response = WP_Http::processResponse( $str_response );
     303                                                $body_started       = true;
    304304                                                $block              = $processed_response['body'];
    305                                                 unset( $strResponse );
     305                                                unset( $str_response );
    306306                                                $processed_response['body'] = '';
    307307                                        }
    308308                                }
     
    338338                        $header_length = 0;
    339339
    340340                        while ( ! feof( $handle ) && $keep_reading ) {
    341                                 $block        = fread( $handle, $block_size );
    342                                 $strResponse .= $block;
     341                                $block         = fread( $handle, $block_size );
     342                                $str_response .= $block;
    343343
    344                                 if ( ! $bodyStarted && strpos( $strResponse, "\r\n\r\n" ) ) {
    345                                         $header_length = strpos( $strResponse, "\r\n\r\n" ) + 4;
    346                                         $bodyStarted   = true;
     344                                if ( ! $body_started && strpos( $str_response, "\r\n\r\n" ) ) {
     345                                        $header_length = strpos( $str_response, "\r\n\r\n" ) + 4;
     346                                        $body_started  = true;
    347347                                }
    348348
    349349                                $keep_reading = (
    350                                         ! $bodyStarted
     350                                        ! $body_started
    351351                                        || ! isset( $parsed_args['limit_response_size'] )
    352                                         || strlen( $strResponse ) < ( $header_length + $parsed_args['limit_response_size'] )
     352                                        || strlen( $str_response ) < ( $header_length + $parsed_args['limit_response_size'] )
    353353                                );
    354354                        }
    355355
    356                         $processed_response = WP_Http::processResponse( $strResponse );
    357                         unset( $strResponse );
     356                        $processed_response = WP_Http::processResponse( $str_response );
     357                        unset( $str_response );
    358358
    359359                }
    360360
  • src/wp-includes/category-template.php

     
    103103 *
    104104 * @since 0.71
    105105 *
    106  * @param int $cat_ID Category ID.
     106 * @param int $cat_id Category ID.
    107107 * @return string|WP_Error Category name on success, WP_Error on failure.
    108108 */
    109 function get_the_category_by_ID( $cat_ID ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
    110         $cat_ID   = (int) $cat_ID;
    111         $category = get_term( $cat_ID );
     109function get_the_category_by_ID( $cat_id ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
     110        $cat_id   = (int) $cat_id;
     111        $category = get_term( $cat_id );
    112112
    113113        if ( is_wp_error( $category ) ) {
    114114                return $category;