@@ -76,7 +76,7 @@ |
||
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | if ( array_key_exists( $class, self::$classmap ) ) { |
| 79 | - return include self::$classmap[ $class ]; |
|
| 79 | + return include self::$classmap[$class]; |
|
| 80 | 80 | } |
| 81 | 81 | } |
| 82 | 82 | } |
@@ -141,19 +141,19 @@ discard block |
||
| 141 | 141 | |
| 142 | 142 | // Format decimal values. |
| 143 | 143 | foreach ( $format_decimal as $key ) { |
| 144 | - $data[ $key ] = wc_format_decimal( $data[ $key ], $this->request['dp'] ); |
|
| 144 | + $data[$key] = wc_format_decimal( $data[$key], $this->request['dp'] ); |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | // Format date values. |
| 148 | 148 | foreach ( $format_date as $key ) { |
| 149 | - $datetime = $data[ $key ]; |
|
| 150 | - $data[ $key ] = wc_rest_prepare_date_response( $datetime, false ); |
|
| 151 | - $data[ $key . '_gmt' ] = wc_rest_prepare_date_response( $datetime ); |
|
| 149 | + $datetime = $data[$key]; |
|
| 150 | + $data[$key] = wc_rest_prepare_date_response( $datetime, false ); |
|
| 151 | + $data[$key . '_gmt'] = wc_rest_prepare_date_response( $datetime ); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | // Format line items. |
| 155 | 155 | foreach ( $format_line_items as $key ) { |
| 156 | - $data[ $key ] = array_values( array_map( array( $this, 'get_order_item_data' ), $data[ $key ] ) ); |
|
| 156 | + $data[$key] = array_values( array_map( array( $this, 'get_order_item_data' ), $data[$key] ) ); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | return array( |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | $line_tax = array(); |
| 295 | 295 | |
| 296 | 296 | foreach ( $item_line_taxes['total'] as $tax_rate_id => $tax ) { |
| 297 | - $line_tax[ $tax_rate_id ] = array( |
|
| 297 | + $line_tax[$tax_rate_id] = array( |
|
| 298 | 298 | 'id' => $tax_rate_id, |
| 299 | 299 | 'total' => $tax, |
| 300 | 300 | 'subtotal' => '', |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | foreach ( $item_line_taxes['subtotal'] as $tax_rate_id => $tax ) { |
| 305 | - $line_tax[ $tax_rate_id ]['subtotal'] = $tax; |
|
| 305 | + $line_tax[$tax_rate_id]['subtotal'] = $tax; |
|
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | $line_item['taxes'] = array_values( $line_tax ); |
@@ -148,19 +148,19 @@ discard block |
||
| 148 | 148 | |
| 149 | 149 | // Format decimal values. |
| 150 | 150 | foreach ( $format_decimal as $key ) { |
| 151 | - $data[ $key ] = wc_format_decimal( $data[ $key ], 2 ); |
|
| 151 | + $data[$key] = wc_format_decimal( $data[$key], 2 ); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | // Format date values. |
| 155 | 155 | foreach ( $format_date as $key ) { |
| 156 | - $datetime = $data[ $key ]; |
|
| 157 | - $data[ $key ] = wc_rest_prepare_date_response( $datetime, false ); |
|
| 158 | - $data[ $key . '_gmt' ] = wc_rest_prepare_date_response( $datetime ); |
|
| 156 | + $datetime = $data[$key]; |
|
| 157 | + $data[$key] = wc_rest_prepare_date_response( $datetime, false ); |
|
| 158 | + $data[$key . '_gmt'] = wc_rest_prepare_date_response( $datetime ); |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | // Format null values. |
| 162 | 162 | foreach ( $format_null as $key ) { |
| 163 | - $data[ $key ] = $data[ $key ] ? $data[ $key ] : null; |
|
| 163 | + $data[$key] = $data[$key] ? $data[$key] : null; |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | return array( |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | |
| 267 | 267 | // Handle all writable props. |
| 268 | 268 | foreach ( $data_keys as $key ) { |
| 269 | - $value = $request[ $key ]; |
|
| 269 | + $value = $request[$key]; |
|
| 270 | 270 | |
| 271 | 271 | if ( ! is_null( $value ) ) { |
| 272 | 272 | switch ( $key ) { |
@@ -232,7 +232,7 @@ |
||
| 232 | 232 | foreach ( $classes as $key => $class ) { |
| 233 | 233 | if ( sanitize_title( $class ) === $tax_class['slug'] ) { |
| 234 | 234 | $tax_class['name'] = $class; |
| 235 | - unset( $classes[ $key ] ); |
|
| 235 | + unset( $classes[$key] ); |
|
| 236 | 236 | $deleted = true; |
| 237 | 237 | break; |
| 238 | 238 | } |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | $max_pages = ceil( $total_terms / $per_page ); |
| 354 | 354 | $response->header( 'X-WP-TotalPages', (int) $max_pages ); |
| 355 | 355 | |
| 356 | - $base = str_replace( '(?P<attribute_id>[\d]+)', $request['attribute_id'], $this->rest_base ); |
|
| 356 | + $base = str_replace( '(?P<attribute_id>[\d]+)', $request['attribute_id'], $this->rest_base ); |
|
| 357 | 357 | $base = add_query_arg( $request->get_query_params(), rest_url( '/' . $this->namespace . '/' . $base ) ); |
| 358 | 358 | if ( $page > 1 ) { |
| 359 | 359 | $prev_page = $page - 1; |
@@ -728,7 +728,7 @@ discard block |
||
| 728 | 728 | 'validate_callback' => 'rest_validate_request_arg', |
| 729 | 729 | ); |
| 730 | 730 | } |
| 731 | - $params['order'] = array( |
|
| 731 | + $params['order'] = array( |
|
| 732 | 732 | 'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce' ), |
| 733 | 733 | 'type' => 'string', |
| 734 | 734 | 'sanitize_callback' => 'sanitize_key', |
@@ -739,7 +739,7 @@ discard block |
||
| 739 | 739 | ), |
| 740 | 740 | 'validate_callback' => 'rest_validate_request_arg', |
| 741 | 741 | ); |
| 742 | - $params['orderby'] = array( |
|
| 742 | + $params['orderby'] = array( |
|
| 743 | 743 | 'description' => __( 'Sort collection by resource attribute.', 'woocommerce' ), |
| 744 | 744 | 'type' => 'string', |
| 745 | 745 | 'sanitize_callback' => 'sanitize_key', |
@@ -775,7 +775,7 @@ discard block |
||
| 775 | 775 | 'default' => null, |
| 776 | 776 | 'validate_callback' => 'rest_validate_request_arg', |
| 777 | 777 | ); |
| 778 | - $params['slug'] = array( |
|
| 778 | + $params['slug'] = array( |
|
| 779 | 779 | 'description' => __( 'Limit result set to resources with a specific slug.', 'woocommerce' ), |
| 780 | 780 | 'type' => 'string', |
| 781 | 781 | 'validate_callback' => 'rest_validate_request_arg', |
@@ -722,13 +722,13 @@ discard block |
||
| 722 | 722 | |
| 723 | 723 | $params['context']['default'] = 'view'; |
| 724 | 724 | |
| 725 | - $params['after'] = array( |
|
| 725 | + $params['after'] = array( |
|
| 726 | 726 | 'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce' ), |
| 727 | 727 | 'type' => 'string', |
| 728 | 728 | 'format' => 'date-time', |
| 729 | 729 | 'validate_callback' => 'rest_validate_request_arg', |
| 730 | 730 | ); |
| 731 | - $params['before'] = array( |
|
| 731 | + $params['before'] = array( |
|
| 732 | 732 | 'description' => __( 'Limit response to resources published before a given ISO8601 compliant date.', 'woocommerce' ), |
| 733 | 733 | 'type' => 'string', |
| 734 | 734 | 'format' => 'date-time', |
@@ -752,13 +752,13 @@ discard block |
||
| 752 | 752 | 'default' => array(), |
| 753 | 753 | 'sanitize_callback' => 'wp_parse_id_list', |
| 754 | 754 | ); |
| 755 | - $params['offset'] = array( |
|
| 755 | + $params['offset'] = array( |
|
| 756 | 756 | 'description' => __( 'Offset the result set by a specific number of items.', 'woocommerce' ), |
| 757 | 757 | 'type' => 'integer', |
| 758 | 758 | 'sanitize_callback' => 'absint', |
| 759 | 759 | 'validate_callback' => 'rest_validate_request_arg', |
| 760 | 760 | ); |
| 761 | - $params['order'] = array( |
|
| 761 | + $params['order'] = array( |
|
| 762 | 762 | 'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce' ), |
| 763 | 763 | 'type' => 'string', |
| 764 | 764 | 'default' => 'desc', |
@@ -776,7 +776,7 @@ discard block |
||
| 776 | 776 | ), |
| 777 | 777 | 'validate_callback' => 'rest_validate_request_arg', |
| 778 | 778 | ); |
| 779 | - $params['status'] = array( |
|
| 779 | + $params['status'] = array( |
|
| 780 | 780 | 'default' => 'all', |
| 781 | 781 | 'description' => __( 'Limit result set to webhooks assigned a specific status.', 'woocommerce' ), |
| 782 | 782 | 'type' => 'string', |
@@ -421,8 +421,8 @@ discard block |
||
| 421 | 421 | $beginning_offset = strlen( $attrib_prefix ); |
| 422 | 422 | $attrib_name_end = strpos( $attrib_name_match[0], '>', $attrib_name_match[1] ); |
| 423 | 423 | $attrib_name = substr( $attrib_name_match[0], $beginning_offset, $attrib_name_end - $beginning_offset ); |
| 424 | - if ( isset( $request[ $attrib_name ] ) ) { |
|
| 425 | - $base = str_replace( "(?P<$attrib_name>[\d]+)", $request[ $attrib_name ], $base ); |
|
| 424 | + if ( isset( $request[$attrib_name] ) ) { |
|
| 425 | + $base = str_replace( "(?P<$attrib_name>[\d]+)", $request[$attrib_name], $base ); |
|
| 426 | 426 | } |
| 427 | 427 | } |
| 428 | 428 | } |
@@ -726,7 +726,7 @@ discard block |
||
| 726 | 726 | $valid_vars = array_flip( $this->get_allowed_query_vars() ); |
| 727 | 727 | $query_args = array(); |
| 728 | 728 | foreach ( $valid_vars as $var => $index ) { |
| 729 | - if ( isset( $prepared_args[ $var ] ) ) { |
|
| 729 | + if ( isset( $prepared_args[$var] ) ) { |
|
| 730 | 730 | /** |
| 731 | 731 | * Filter the query_vars used in `get_items` for the constructed query. |
| 732 | 732 | * |
@@ -734,7 +734,7 @@ discard block |
||
| 734 | 734 | * |
| 735 | 735 | * @param mixed $prepared_args[ $var ] The query_var value. |
| 736 | 736 | */ |
| 737 | - $query_args[ $var ] = apply_filters( "woocommerce_rest_query_var_{$var}", $prepared_args[ $var ] ); |
|
| 737 | + $query_args[$var] = apply_filters( "woocommerce_rest_query_var_{$var}", $prepared_args[$var] ); |
|
| 738 | 738 | } |
| 739 | 739 | } |
| 740 | 740 | |
@@ -309,17 +309,17 @@ discard block |
||
| 309 | 309 | $instance_settings = $method->instance_settings; |
| 310 | 310 | $errors_found = false; |
| 311 | 311 | foreach ( $method->get_instance_form_fields() as $key => $field ) { |
| 312 | - if ( isset( $request['settings'][ $key ] ) ) { |
|
| 312 | + if ( isset( $request['settings'][$key] ) ) { |
|
| 313 | 313 | if ( is_callable( array( $this, 'validate_setting_' . $field['type'] . '_field' ) ) ) { |
| 314 | - $value = $this->{'validate_setting_' . $field['type'] . '_field'}( $request['settings'][ $key ], $field ); |
|
| 314 | + $value = $this->{'validate_setting_' . $field['type'] . '_field'}( $request['settings'][$key], $field ); |
|
| 315 | 315 | } else { |
| 316 | - $value = $this->validate_setting_text_field( $request['settings'][ $key ], $field ); |
|
| 316 | + $value = $this->validate_setting_text_field( $request['settings'][$key], $field ); |
|
| 317 | 317 | } |
| 318 | 318 | if ( is_wp_error( $value ) ) { |
| 319 | 319 | $errors_found = true; |
| 320 | 320 | break; |
| 321 | 321 | } |
| 322 | - $instance_settings[ $key ] = $value; |
|
| 322 | + $instance_settings[$key] = $value; |
|
| 323 | 323 | } |
| 324 | 324 | } |
| 325 | 325 | |
@@ -397,7 +397,7 @@ discard block |
||
| 397 | 397 | 'label' => $field['title'], |
| 398 | 398 | 'description' => empty( $field['description'] ) ? '' : $field['description'], |
| 399 | 399 | 'type' => $field['type'], |
| 400 | - 'value' => $item->instance_settings[ $id ], |
|
| 400 | + 'value' => $item->instance_settings[$id], |
|
| 401 | 401 | 'default' => empty( $field['default'] ) ? '' : $field['default'], |
| 402 | 402 | 'tip' => empty( $field['description'] ) ? '' : $field['description'], |
| 403 | 403 | 'placeholder' => empty( $field['placeholder'] ) ? '' : $field['placeholder'], |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | if ( ! empty( $field['options'] ) ) { |
| 406 | 406 | $data['options'] = $field['options']; |
| 407 | 407 | } |
| 408 | - $settings[ $id ] = $data; |
|
| 408 | + $settings[$id] = $data; |
|
| 409 | 409 | } |
| 410 | 410 | return $settings; |
| 411 | 411 | } |
@@ -46,25 +46,25 @@ |
||
| 46 | 46 | public function get_public_item_schema() { |
| 47 | 47 | $schema = parent::get_public_item_schema(); |
| 48 | 48 | |
| 49 | - $schema['properties']['blog'] = array( |
|
| 49 | + $schema['properties']['blog'] = array( |
|
| 50 | 50 | 'description' => __( 'Blog id of the record on the multisite.', 'woocommerce' ), |
| 51 | 51 | 'type' => 'integer', |
| 52 | 52 | 'context' => array( 'view' ), |
| 53 | 53 | 'readonly' => true, |
| 54 | 54 | ); |
| 55 | - $schema['properties']['edit_url'] = array( |
|
| 55 | + $schema['properties']['edit_url'] = array( |
|
| 56 | 56 | 'description' => __( 'URL to edit the order', 'woocommerce' ), |
| 57 | 57 | 'type' => 'string', |
| 58 | 58 | 'context' => array( 'view' ), |
| 59 | 59 | 'readonly' => true, |
| 60 | 60 | ); |
| 61 | - $schema['properties']['customer'][] = array( |
|
| 61 | + $schema['properties']['customer'][] = array( |
|
| 62 | 62 | 'description' => __( 'Name of the customer for the order', 'woocommerce' ), |
| 63 | 63 | 'type' => 'string', |
| 64 | 64 | 'context' => array( 'view' ), |
| 65 | 65 | 'readonly' => true, |
| 66 | 66 | ); |
| 67 | - $schema['properties']['status_name'][] = array( |
|
| 67 | + $schema['properties']['status_name'][] = array( |
|
| 68 | 68 | 'description' => __( 'Order Status', 'woocommerce' ), |
| 69 | 69 | 'type' => 'string', |
| 70 | 70 | 'context' => array( 'view' ), |