| @@ 390-403 (lines=14) @@ | ||
| 387 | * or after. Default 'after'. |
|
| 388 | * @return bool True on success, false on failure. |
|
| 389 | */ |
|
| 390 | public function add_inline_script( $handle, $data, $position = 'after' ) { |
|
| 391 | if ( ! $data ) { |
|
| 392 | return false; |
|
| 393 | } |
|
| 394 | ||
| 395 | if ( 'after' !== $position ) { |
|
| 396 | $position = 'before'; |
|
| 397 | } |
|
| 398 | ||
| 399 | $script = (array) $this->get_data( $handle, $position ); |
|
| 400 | $script[] = $data; |
|
| 401 | ||
| 402 | return $this->add_data( $handle, $position, $script ); |
|
| 403 | } |
|
| 404 | ||
| 405 | /** |
|
| 406 | * Prints inline scripts registered for a specific handle. |
|
| @@ 255-268 (lines=14) @@ | ||
| 252 | * @param string $code String containing the CSS styles to be added. |
|
| 253 | * @return bool True on success, false on failure. |
|
| 254 | */ |
|
| 255 | public function add_inline_style( $handle, $code ) { |
|
| 256 | if ( ! $code ) { |
|
| 257 | return false; |
|
| 258 | } |
|
| 259 | ||
| 260 | $after = $this->get_data( $handle, 'after' ); |
|
| 261 | if ( ! $after ) { |
|
| 262 | $after = array(); |
|
| 263 | } |
|
| 264 | ||
| 265 | $after[] = $code; |
|
| 266 | ||
| 267 | return $this->add_data( $handle, 'after', $after ); |
|
| 268 | } |
|
| 269 | ||
| 270 | /** |
|
| 271 | * Prints extra CSS styles of a registered stylesheet. |
|