@@ -351,8 +351,8 @@ discard block |
||
351 | 351 | 'low_in_stock', |
352 | 352 | ); |
353 | 353 | foreach ( $custom_keys as $key ) { |
354 | - if ( ! empty( $request[ $key ] ) ) { |
|
355 | - $args[ $key ] = $request[ $key ]; |
|
354 | + if ( ! empty( $request[$key] ) ) { |
|
355 | + $args[$key] = $request[$key]; |
|
356 | 356 | } |
357 | 357 | } |
358 | 358 | |
@@ -369,11 +369,11 @@ discard block |
||
369 | 369 | |
370 | 370 | // Set tax_query for each passed arg. |
371 | 371 | foreach ( $taxonomies as $taxonomy => $key ) { |
372 | - if ( ! empty( $request[ $key ] ) ) { |
|
372 | + if ( ! empty( $request[$key] ) ) { |
|
373 | 373 | $tax_query[] = array( |
374 | 374 | 'taxonomy' => $taxonomy, |
375 | 375 | 'field' => 'term_id', |
376 | - 'terms' => $request[ $key ], |
|
376 | + 'terms' => $request[$key], |
|
377 | 377 | ); |
378 | 378 | } |
379 | 379 | } |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | // Use 0 when there's no on sale products to avoid return all products. |
437 | 437 | $on_sale_ids = empty( $on_sale_ids ) ? array( 0 ) : $on_sale_ids; |
438 | 438 | |
439 | - $args[ $on_sale_key ] += $on_sale_ids; |
|
439 | + $args[$on_sale_key] += $on_sale_ids; |
|
440 | 440 | } |
441 | 441 | |
442 | 442 | // Force the post_type argument, since it's not a user input variable. |
@@ -470,16 +470,16 @@ discard block |
||
470 | 470 | protected function prepare_links( $object, $request ) { |
471 | 471 | $links = array( |
472 | 472 | 'self' => array( |
473 | - 'href' => rest_url( sprintf( '/%s/%s/%d', $this->namespace, $this->rest_base, $object->get_id() ) ), // @codingStandardsIgnoreLine. |
|
473 | + 'href' => rest_url( sprintf( '/%s/%s/%d', $this->namespace, $this->rest_base, $object->get_id() ) ), // @codingStandardsIgnoreLine. |
|
474 | 474 | ), |
475 | 475 | 'collection' => array( |
476 | - 'href' => rest_url( sprintf( '/%s/%s', $this->namespace, $this->rest_base ) ), // @codingStandardsIgnoreLine. |
|
476 | + 'href' => rest_url( sprintf( '/%s/%s', $this->namespace, $this->rest_base ) ), // @codingStandardsIgnoreLine. |
|
477 | 477 | ), |
478 | 478 | ); |
479 | 479 | |
480 | 480 | if ( $object->get_parent_id() ) { |
481 | 481 | $links['up'] = array( |
482 | - 'href' => rest_url( sprintf( '/%s/products/%d', $this->namespace, $object->get_parent_id() ) ), // @codingStandardsIgnoreLine. |
|
482 | + 'href' => rest_url( sprintf( '/%s/products/%d', $this->namespace, $object->get_parent_id() ) ), // @codingStandardsIgnoreLine. |
|
483 | 483 | ); |
484 | 484 | } |
485 | 485 |
@@ -260,8 +260,8 @@ discard block |
||
260 | 260 | 'low_in_stock', |
261 | 261 | ); |
262 | 262 | foreach ( $custom_keys as $key ) { |
263 | - if ( ! empty( $request[ $key ] ) ) { |
|
264 | - $args[ $key ] = $request[ $key ]; |
|
263 | + if ( ! empty( $request[$key] ) ) { |
|
264 | + $args[$key] = $request[$key]; |
|
265 | 265 | } |
266 | 266 | } |
267 | 267 | |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | // Use 0 when there's no on sale products to avoid return all products. |
285 | 285 | $on_sale_ids = empty( $on_sale_ids ) ? array( 0 ) : $on_sale_ids; |
286 | 286 | |
287 | - $args[ $on_sale_key ] += $on_sale_ids; |
|
287 | + $args[$on_sale_key] += $on_sale_ids; |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | // Force the post_type argument, since it's not a user input variable. |
@@ -447,15 +447,15 @@ discard block |
||
447 | 447 | $url_params = $request->get_url_params(); |
448 | 448 | $product_id = $url_params['product_id']; |
449 | 449 | |
450 | - if ( ! isset( $params[ $batch_type ] ) ) { |
|
450 | + if ( ! isset( $params[$batch_type] ) ) { |
|
451 | 451 | return array(); |
452 | 452 | } |
453 | 453 | |
454 | - $items = array_filter( $params[ $batch_type ] ); |
|
454 | + $items = array_filter( $params[$batch_type] ); |
|
455 | 455 | |
456 | 456 | if ( 'update' === $batch_type || 'create' === $batch_type ) { |
457 | 457 | foreach ( $items as $key => $item ) { |
458 | - $items[ $key ] = array_merge( |
|
458 | + $items[$key] = array_merge( |
|
459 | 459 | array( |
460 | 460 | 'product_id' => $product_id, |
461 | 461 | ), |
@@ -502,8 +502,8 @@ discard block |
||
502 | 502 | ]; |
503 | 503 | |
504 | 504 | foreach ( $props_to_set as $prop ) { |
505 | - if ( isset( $request[ $prop ] ) && is_callable( array( $object, "set_$prop" ) ) ) { |
|
506 | - $object->{"set_$prop"}( $request[ $prop ] ); |
|
505 | + if ( isset( $request[$prop] ) && is_callable( array( $object, "set_$prop" ) ) ) { |
|
506 | + $object->{"set_$prop"}( $request[$prop] ); |
|
507 | 507 | } |
508 | 508 | } |
509 | 509 | |
@@ -604,14 +604,14 @@ discard block |
||
604 | 604 | continue; |
605 | 605 | } |
606 | 606 | |
607 | - if ( ! isset( $parent_attributes[ $attribute_name ] ) || ! $parent_attributes[ $attribute_name ]->get_variation() ) { |
|
607 | + if ( ! isset( $parent_attributes[$attribute_name] ) || ! $parent_attributes[$attribute_name]->get_variation() ) { |
|
608 | 608 | continue; |
609 | 609 | } |
610 | 610 | |
611 | - $attribute_key = sanitize_title( $parent_attributes[ $attribute_name ]->get_name() ); |
|
611 | + $attribute_key = sanitize_title( $parent_attributes[$attribute_name]->get_name() ); |
|
612 | 612 | $attribute_value = isset( $attribute['option'] ) ? wc_clean( stripslashes( $attribute['option'] ) ) : ''; |
613 | 613 | |
614 | - if ( $parent_attributes[ $attribute_name ]->is_taxonomy() ) { |
|
614 | + if ( $parent_attributes[$attribute_name]->is_taxonomy() ) { |
|
615 | 615 | // If dealing with a taxonomy, we need to get the slug from the name posted to the API. |
616 | 616 | $term = get_term_by( 'name', $attribute_value, $attribute_name ); |
617 | 617 | |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | } |
623 | 623 | } |
624 | 624 | |
625 | - $attributes[ $attribute_key ] = $attribute_value; |
|
625 | + $attributes[$attribute_key] = $attribute_value; |
|
626 | 626 | } |
627 | 627 | |
628 | 628 | $object->set_attributes( $attributes ); |
@@ -816,8 +816,8 @@ discard block |
||
816 | 816 | ]; |
817 | 817 | |
818 | 818 | foreach ( $props_to_set as $prop ) { |
819 | - if ( isset( $request[ $prop ] ) && is_callable( array( $object, "set_$prop" ) ) ) { |
|
820 | - $object->{"set_$prop"}( $request[ $prop ] ); |
|
819 | + if ( isset( $request[$prop] ) && is_callable( array( $object, "set_$prop" ) ) ) { |
|
820 | + $object->{"set_$prop"}( $request[$prop] ); |
|
821 | 821 | } |
822 | 822 | } |
823 | 823 | |
@@ -1001,10 +1001,10 @@ discard block |
||
1001 | 1001 | $attribute = false; |
1002 | 1002 | |
1003 | 1003 | // pa_ attributes. |
1004 | - if ( isset( $attributes[ wc_attribute_taxonomy_name( $slug ) ] ) ) { |
|
1005 | - $attribute = $attributes[ wc_attribute_taxonomy_name( $slug ) ]; |
|
1006 | - } elseif ( isset( $attributes[ $slug ] ) ) { |
|
1007 | - $attribute = $attributes[ $slug ]; |
|
1004 | + if ( isset( $attributes[wc_attribute_taxonomy_name( $slug )] ) ) { |
|
1005 | + $attribute = $attributes[wc_attribute_taxonomy_name( $slug )]; |
|
1006 | + } elseif ( isset( $attributes[$slug] ) ) { |
|
1007 | + $attribute = $attributes[$slug]; |
|
1008 | 1008 | } |
1009 | 1009 | |
1010 | 1010 | if ( ! $attribute ) { |
@@ -1371,8 +1371,8 @@ discard block |
||
1371 | 1371 | continue; |
1372 | 1372 | } |
1373 | 1373 | |
1374 | - if ( isset( $attributes[ $attribute_name ] ) ) { |
|
1375 | - $_attribute = $attributes[ $attribute_name ]; |
|
1374 | + if ( isset( $attributes[$attribute_name] ) ) { |
|
1375 | + $_attribute = $attributes[$attribute_name]; |
|
1376 | 1376 | |
1377 | 1377 | if ( $_attribute['is_variation'] ) { |
1378 | 1378 | $value = isset( $attribute['option'] ) ? wc_clean( stripslashes( $attribute['option'] ) ) : ''; |
@@ -1389,7 +1389,7 @@ discard block |
||
1389 | 1389 | } |
1390 | 1390 | |
1391 | 1391 | if ( $value ) { |
1392 | - $default_attributes[ $attribute_name ] = $value; |
|
1392 | + $default_attributes[$attribute_name] = $value; |
|
1393 | 1393 | } |
1394 | 1394 | } |
1395 | 1395 | } |