@@ -308,10 +308,10 @@ |
||
| 308 | 308 | $attribute = false; |
| 309 | 309 | |
| 310 | 310 | // pa_ attributes. |
| 311 | - if ( isset( $attributes[ wc_attribute_taxonomy_name( $slug ) ] ) ) { |
|
| 312 | - $attribute = $attributes[ wc_attribute_taxonomy_name( $slug ) ]; |
|
| 313 | - } elseif ( isset( $attributes[ $slug ] ) ) { |
|
| 314 | - $attribute = $attributes[ $slug ]; |
|
| 311 | + if ( isset( $attributes[wc_attribute_taxonomy_name( $slug )] ) ) { |
|
| 312 | + $attribute = $attributes[wc_attribute_taxonomy_name( $slug )]; |
|
| 313 | + } elseif ( isset( $attributes[$slug] ) ) { |
|
| 314 | + $attribute = $attributes[$slug]; |
|
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | if ( ! $attribute ) { |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | $prop_values['shipping_class_id'] = $this->parse_shipping_class( $value, $object ); |
| 94 | 94 | break; |
| 95 | 95 | default: |
| 96 | - $prop_values[ $prop ] = $value; |
|
| 96 | + $prop_values[$prop] = $value; |
|
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | 99 | |
@@ -129,14 +129,14 @@ discard block |
||
| 129 | 129 | continue; |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - if ( ! isset( $parent_attributes[ $attribute_name ] ) || ! $parent_attributes[ $attribute_name ]->get_variation() ) { |
|
| 132 | + if ( ! isset( $parent_attributes[$attribute_name] ) || ! $parent_attributes[$attribute_name]->get_variation() ) { |
|
| 133 | 133 | continue; |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | - $attribute_key = sanitize_title( $parent_attributes[ $attribute_name ]->get_name() ); |
|
| 136 | + $attribute_key = sanitize_title( $parent_attributes[$attribute_name]->get_name() ); |
|
| 137 | 137 | $attribute_value = isset( $attribute['option'] ) ? wc_clean( stripslashes( $attribute['option'] ) ) : ''; |
| 138 | 138 | |
| 139 | - if ( $parent_attributes[ $attribute_name ]->is_taxonomy() ) { |
|
| 139 | + if ( $parent_attributes[$attribute_name]->is_taxonomy() ) { |
|
| 140 | 140 | // If dealing with a taxonomy, we need to get the slug from the name posted to the API. |
| 141 | 141 | $term = get_term_by( 'name', $attribute_value, $attribute_name ); |
| 142 | 142 | |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | } |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | - $attributes[ $attribute_key ] = $attribute_value; |
|
| 150 | + $attributes[$attribute_key] = $attribute_value; |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | return $attributes; |
@@ -128,11 +128,11 @@ discard block |
||
| 128 | 128 | switch ( $prop ) { |
| 129 | 129 | case 'date_created': |
| 130 | 130 | case 'date_created_gmt': |
| 131 | - $prop_values[ $prop ] = rest_parse_date( $value ); |
|
| 131 | + $prop_values[$prop] = rest_parse_date( $value ); |
|
| 132 | 132 | break; |
| 133 | 133 | case 'upsell_ids': |
| 134 | 134 | case 'cross_sell_ids': |
| 135 | - $prop_values[ $prop ] = wp_parse_id_list( $value ); |
|
| 135 | + $prop_values[$prop] = wp_parse_id_list( $value ); |
|
| 136 | 136 | break; |
| 137 | 137 | case 'images': |
| 138 | 138 | $images = $this->parse_images_field( $value, $object ); |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | $prop_values['shipping_class_id'] = $this->parse_shipping_class( $value, $object ); |
| 156 | 156 | break; |
| 157 | 157 | default: |
| 158 | - $prop_values[ $prop ] = $value; |
|
| 158 | + $prop_values[$prop] = $value; |
|
| 159 | 159 | } |
| 160 | 160 | } |
| 161 | 161 | |
@@ -479,8 +479,8 @@ discard block |
||
| 479 | 479 | continue; |
| 480 | 480 | } |
| 481 | 481 | |
| 482 | - if ( isset( $attributes[ $attribute_name ] ) ) { |
|
| 483 | - $_attribute = $attributes[ $attribute_name ]; |
|
| 482 | + if ( isset( $attributes[$attribute_name] ) ) { |
|
| 483 | + $_attribute = $attributes[$attribute_name]; |
|
| 484 | 484 | |
| 485 | 485 | if ( $_attribute['is_variation'] ) { |
| 486 | 486 | $value = isset( $attribute['option'] ) ? wc_clean( stripslashes( $attribute['option'] ) ) : ''; |
@@ -497,7 +497,7 @@ discard block |
||
| 497 | 497 | } |
| 498 | 498 | |
| 499 | 499 | if ( $value ) { |
| 500 | - $default_attributes[ $attribute_name ] = $value; |
|
| 500 | + $default_attributes[$attribute_name] = $value; |
|
| 501 | 501 | } |
| 502 | 502 | } |
| 503 | 503 | } |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | * @param mixed $default Default to return if not set. |
| 38 | 38 | */ |
| 39 | 39 | protected function get_param( $name, $default = null ) { |
| 40 | - return isset( $this->request[ $name ] ) ? $this->request[ $name ] : $default; |
|
| 40 | + return isset( $this->request[$name] ) ? $this->request[$name] : $default; |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |