@@ 281-297 (lines=17) @@ | ||
278 | * Default true. |
|
279 | * @return string|bool False if no data exists, inline styles if `$echo` is true, true otherwise. |
|
280 | */ |
|
281 | public function print_inline_style( $handle, $echo = true ) { |
|
282 | $output = $this->get_data( $handle, 'after' ); |
|
283 | ||
284 | if ( empty( $output ) ) { |
|
285 | return false; |
|
286 | } |
|
287 | ||
288 | $output = implode( "\n", $output ); |
|
289 | ||
290 | if ( ! $echo ) { |
|
291 | return $output; |
|
292 | } |
|
293 | ||
294 | printf( "<style id='%s-inline-css' type='text/css'>\n%s\n</style>\n", esc_attr( $handle ), $output ); |
|
295 | ||
296 | return true; |
|
297 | } |
|
298 | ||
299 | /** |
|
300 | * Determines style dependencies. |
@@ 407-421 (lines=15) @@ | ||
404 | * Default true. |
|
405 | * @return string|false Script on success, false otherwise. |
|
406 | */ |
|
407 | public function print_inline_script( $handle, $position = 'after', $echo = true ) { |
|
408 | $output = $this->get_data( $handle, $position ); |
|
409 | ||
410 | if ( empty( $output ) ) { |
|
411 | return false; |
|
412 | } |
|
413 | ||
414 | $output = trim( implode( "\n", $output ), "\n" ); |
|
415 | ||
416 | if ( $echo ) { |
|
417 | printf( "<script type='text/javascript'>\n%s\n</script>\n", $output ); |
|
418 | } |
|
419 | ||
420 | return $output; |
|
421 | } |
|
422 | ||
423 | /** |
|
424 | * Localizes a script, only if the script has already been added. |