| @@ 333-350 (lines=18) @@ | ||
| 330 | */ |
|
| 331 | public function pushData($key, $value) |
|
| 332 | { |
|
| 333 | if (isset($this->jsdata[ $key ]) |
|
| 334 | && ! is_array($this->jsdata[ $key ]) |
|
| 335 | ) { |
|
| 336 | if (! $this->debug()) { |
|
| 337 | return; |
|
| 338 | } |
|
| 339 | throw new InvalidArgumentException( |
|
| 340 | sprintf( |
|
| 341 | __( |
|
| 342 | 'The value for %1$s is already set and it is not an array. The %2$s method can only be used to |
|
| 343 | push values to this data element when it is an array.', |
|
| 344 | 'event_espresso' |
|
| 345 | ), |
|
| 346 | $key, |
|
| 347 | __METHOD__ |
|
| 348 | ) |
|
| 349 | ); |
|
| 350 | } |
|
| 351 | if ( ! isset( $this->jsdata[ $key ] ) ) { |
|
| 352 | $this->jsdata[ $key ] = is_array($value) ? $value : [$value]; |
|
| 353 | } else { |
|
| @@ 373-386 (lines=14) @@ | ||
| 370 | $this->jsdata['templates'] = array(); |
|
| 371 | } |
|
| 372 | //no overrides allowed. |
|
| 373 | if (isset($this->jsdata['templates'][ $template_reference ])) { |
|
| 374 | if (! $this->debug()) { |
|
| 375 | return; |
|
| 376 | } |
|
| 377 | throw new InvalidArgumentException( |
|
| 378 | sprintf( |
|
| 379 | __( |
|
| 380 | 'The %1$s key already exists for the templates array in the js data array. No overrides are allowed.', |
|
| 381 | 'event_espresso' |
|
| 382 | ), |
|
| 383 | $template_reference |
|
| 384 | ) |
|
| 385 | ); |
|
| 386 | } |
|
| 387 | $this->jsdata['templates'][ $template_reference ] = $template_content; |
|
| 388 | } |
|
| 389 | ||
| @@ 677-690 (lines=14) @@ | ||
| 674 | */ |
|
| 675 | public function registerManifestFile($namespace, $url_base, $manifest_file, $manifest_file_path = '') |
|
| 676 | { |
|
| 677 | if (isset($this->manifest_data[ $namespace ])) { |
|
| 678 | if (! $this->debug()) { |
|
| 679 | return; |
|
| 680 | } |
|
| 681 | throw new InvalidArgumentException( |
|
| 682 | sprintf( |
|
| 683 | esc_html__( |
|
| 684 | 'The namespace for this manifest file has already been registered, choose a namespace other than %s', |
|
| 685 | 'event_espresso' |
|
| 686 | ), |
|
| 687 | $namespace |
|
| 688 | ) |
|
| 689 | ); |
|
| 690 | } |
|
| 691 | if (filter_var($url_base, FILTER_VALIDATE_URL) === false) { |
|
| 692 | if (is_admin()) { |
|
| 693 | EE_Error::add_error( |
|