| @@ 151-163 (lines=13) @@ | ||
| 148 | $fieldValues = is_array($fieldValues) ? $fieldValues : array($fieldValues); |
|
| 149 | // verify client code has not passed any invalid field names |
|
| 150 | foreach ($fieldValues as $field_name => $field_value) { |
|
| 151 | if (! isset($model_fields[ $field_name ])) { |
|
| 152 | throw new EE_Error( |
|
| 153 | sprintf( |
|
| 154 | esc_html__( |
|
| 155 | 'Invalid field (%s) passed to constructor of %s. Allowed fields are :%s', |
|
| 156 | 'event_espresso' |
|
| 157 | ), |
|
| 158 | $field_name, |
|
| 159 | get_class($this), |
|
| 160 | implode(', ', array_keys($model_fields)) |
|
| 161 | ) |
|
| 162 | ); |
|
| 163 | } |
|
| 164 | } |
|
| 165 | $this->_timezone = EEH_DTT_Helper::get_valid_timezone_string($timezone); |
|
| 166 | if (! empty($date_formats) && is_array($date_formats)) { |
|
| @@ 485-498 (lines=14) @@ | ||
| 482 | public function validate_context($context) |
|
| 483 | { |
|
| 484 | $contexts = $this->contexts_config(); |
|
| 485 | if (! isset($contexts[$context])) { |
|
| 486 | throw new InvalidIdentifierException( |
|
| 487 | '', |
|
| 488 | '', |
|
| 489 | sprintf( |
|
| 490 | esc_html__( |
|
| 491 | 'An invalid string identifying a context was provided. "%1$s" was received, and one of "%2$s" was expected.', |
|
| 492 | 'event_espresso' |
|
| 493 | ), |
|
| 494 | $context, |
|
| 495 | implode(',', array_keys($contexts)) |
|
| 496 | ) |
|
| 497 | ); |
|
| 498 | } |
|
| 499 | } |
|
| 500 | } |
|
| 501 | ||