@@ 194-211 (lines=18) @@ | ||
191 | * @param bool $add_to_header |
|
192 | * @throws DomainException |
|
193 | */ |
|
194 | public function addScripts(array $scripts, $add_to_header = false) |
|
195 | { |
|
196 | if (empty($scripts)) { |
|
197 | throw new DomainException( |
|
198 | esc_html__( |
|
199 | 'A non-empty array of URLs, is required to add Javascript to an iframe.', |
|
200 | 'event_espresso' |
|
201 | ) |
|
202 | ); |
|
203 | } |
|
204 | foreach ($scripts as $handle => $script) { |
|
205 | if ($add_to_header) { |
|
206 | $this->header_js[ $handle ] = $script; |
|
207 | } else { |
|
208 | $this->footer_js[ $handle ] = $script; |
|
209 | } |
|
210 | } |
|
211 | } |
|
212 | ||
213 | ||
214 | /** |
|
@@ 219-236 (lines=18) @@ | ||
216 | * @param bool $add_to_header |
|
217 | * @throws DomainException |
|
218 | */ |
|
219 | public function addScriptAttributes(array $script_attributes, $add_to_header = false) |
|
220 | { |
|
221 | if (empty($script_attributes)) { |
|
222 | throw new DomainException( |
|
223 | esc_html__( |
|
224 | 'A non-empty array of strings, is required to add attributes to iframe Javascript.', |
|
225 | 'event_espresso' |
|
226 | ) |
|
227 | ); |
|
228 | } |
|
229 | foreach ($script_attributes as $handle => $script_attribute) { |
|
230 | if ($add_to_header) { |
|
231 | $this->header_js_attributes[ $handle ] = $script_attribute; |
|
232 | } else { |
|
233 | $this->footer_js_attributes[ $handle ] = $script_attribute; |
|
234 | } |
|
235 | } |
|
236 | } |
|
237 | ||
238 | ||
239 | /** |