@@ 481-497 (lines=17) @@ | ||
478 | $model, |
|
479 | $requested_version |
|
480 | ); |
|
481 | } elseif (defined('EE_REST_API_DEBUG_MODE') && EE_REST_API_DEBUG_MODE) { |
|
482 | // only tell API clients they got it wrong if we're in debug mode |
|
483 | // otherwise try our best ot fulfill their request by ignoring this invalid data |
|
484 | throw new RestException( |
|
485 | 'invalid_parameter', |
|
486 | sprintf( |
|
487 | /* translators: 1: variable name */ |
|
488 | esc_html__( |
|
489 | 'You provided an invalid parameter, with key "%1$s"', |
|
490 | 'event_espresso' |
|
491 | ), |
|
492 | $query_param_key |
|
493 | ), |
|
494 | array( |
|
495 | 'status' => 400, |
|
496 | ) |
|
497 | ); |
|
498 | } |
|
499 | } |
|
500 | return null; |
|
@@ 626-641 (lines=16) @@ | ||
623 | } else { |
|
624 | $query_param_value = array($sub_array_key, $sub_array_value); |
|
625 | } |
|
626 | } elseif (defined('EE_REST_API_DEBUG_MODE') && EE_REST_API_DEBUG_MODE) { |
|
627 | throw new RestException( |
|
628 | 'numerically_indexed_array_of_values_only', |
|
629 | sprintf( |
|
630 | /* translators: 1: variable name*/ |
|
631 | esc_html__( |
|
632 | 'The array provided for the parameter "%1$s" should be numerically indexed.', |
|
633 | 'event_espresso' |
|
634 | ), |
|
635 | $query_param_key |
|
636 | ), |
|
637 | array( |
|
638 | 'status' => 400, |
|
639 | ) |
|
640 | ); |
|
641 | } |
|
642 | } |
|
643 | $valid_operators = $model->valid_operators(); |
|
644 | // did they specify an operator? |
|
@@ 712-730 (lines=19) @@ | ||
709 | $requested_version, |
|
710 | $timezone |
|
711 | ); |
|
712 | } else { |
|
713 | // so they provided a valid operator, but wrong number of arguments |
|
714 | if (defined('EE_REST_API_DEBUG_MODE') && EE_REST_API_DEBUG_MODE) { |
|
715 | throw new RestException( |
|
716 | 'wrong_number_of_arguments', |
|
717 | sprintf( |
|
718 | esc_html__( |
|
719 | 'The operator you provided, "%1$s" had the wrong number of arguments', |
|
720 | 'event_espresso' |
|
721 | ), |
|
722 | $sub_array_key |
|
723 | ), |
|
724 | array( |
|
725 | 'status' => 400, |
|
726 | ) |
|
727 | ); |
|
728 | } |
|
729 | $translated_value = null; |
|
730 | } |
|
731 | } else { |
|
732 | // so they didn't provide a valid operator |
|
733 | if (defined('EE_REST_API_DEBUG_MODE') && EE_REST_API_DEBUG_MODE) { |
|
@@ 731-751 (lines=21) @@ | ||
728 | } |
|
729 | $translated_value = null; |
|
730 | } |
|
731 | } else { |
|
732 | // so they didn't provide a valid operator |
|
733 | if (defined('EE_REST_API_DEBUG_MODE') && EE_REST_API_DEBUG_MODE) { |
|
734 | throw new RestException( |
|
735 | 'invalid_operator', |
|
736 | sprintf( |
|
737 | esc_html__( |
|
738 | 'You provided an invalid parameter, with key "%1$s" and value "%2$s"', |
|
739 | 'event_espresso' |
|
740 | ), |
|
741 | $query_param_key, |
|
742 | $query_param_value |
|
743 | ), |
|
744 | array( |
|
745 | 'status' => 400, |
|
746 | ) |
|
747 | ); |
|
748 | } |
|
749 | // if we aren't in debug mode, then just try our best to fulfill the user's request |
|
750 | $translated_value = null; |
|
751 | } |
|
752 | } else { |
|
753 | $translated_value = ModelDataTranslator::prepareFieldValueFromJson( |
|
754 | $field, |