| @@ 625-644 (lines=20) @@ | ||
| 622 | * @param string $name Element Name in array scripts are stored in. |
|
| 623 | * @return void |
|
| 624 | */ |
|
| 625 | public function addScript($src = '', $attributes = array(), $content = '', $name = '') |
|
| 626 | { |
|
| 627 | if (empty($attributes)) { |
|
| 628 | $attributes = array(); |
|
| 629 | } |
|
| 630 | if (!empty($src)) { |
|
| 631 | $src = $GLOBALS['xoops']->url($this->resourcePath($src)); |
|
| 632 | $attributes['src'] = $src; |
|
| 633 | } |
|
| 634 | if (!empty($content)) { |
|
| 635 | $attributes['_'] = $content; |
|
| 636 | } |
|
| 637 | if (!isset($attributes['type'])) { |
|
| 638 | $attributes['type'] = 'text/javascript'; |
|
| 639 | } |
|
| 640 | if (empty($name)) { |
|
| 641 | $name = md5(serialize($attributes)); |
|
| 642 | } |
|
| 643 | $this->addMeta('script', $name, $attributes); |
|
| 644 | } |
|
| 645 | ||
| 646 | /** |
|
| 647 | * Add StyleSheet or CSS code to the document head |
|
| @@ 655-674 (lines=20) @@ | ||
| 652 | * @param string $name Element Name in array stylesheets are stored in. |
|
| 653 | * @return void |
|
| 654 | */ |
|
| 655 | public function addStylesheet($src = '', $attributes = array(), $content = '', $name = '') |
|
| 656 | { |
|
| 657 | if (empty($attributes)) { |
|
| 658 | $attributes = array(); |
|
| 659 | } |
|
| 660 | if (!empty($src)) { |
|
| 661 | $src = $GLOBALS['xoops']->url($this->resourcePath($src)); |
|
| 662 | $attributes['href'] = $src; |
|
| 663 | } |
|
| 664 | if (!isset($attributes['type'])) { |
|
| 665 | $attributes['type'] = 'text/css'; |
|
| 666 | } |
|
| 667 | if (!empty($content)) { |
|
| 668 | $attributes['_'] = $content; |
|
| 669 | } |
|
| 670 | if (empty($name)) { |
|
| 671 | $name = md5(serialize($attributes)); |
|
| 672 | } |
|
| 673 | $this->addMeta('stylesheet', $name, $attributes); |
|
| 674 | } |
|
| 675 | ||
| 676 | /** |
|
| 677 | * Add a <link> to the header |
|