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