| @@ 609-628 (lines=20) @@ | ||
| 606 | * @param string $name Element Name in array scripts are stored in. |
|
| 607 | * @return void |
|
| 608 | */ |
|
| 609 | public function addScript($src = '', $attributes = array(), $content = '', $name = '') |
|
| 610 | { |
|
| 611 | if (empty($attributes)) { |
|
| 612 | $attributes = array(); |
|
| 613 | } |
|
| 614 | if (!empty($src)) { |
|
| 615 | $src = $GLOBALS['xoops']->url($this->resourcePath($src)); |
|
| 616 | $attributes['src'] = $src; |
|
| 617 | } |
|
| 618 | if (!empty($content)) { |
|
| 619 | $attributes['_'] = $content; |
|
| 620 | } |
|
| 621 | if (!isset($attributes['type'])) { |
|
| 622 | $attributes['type'] = 'text/javascript'; |
|
| 623 | } |
|
| 624 | if (empty($name)) { |
|
| 625 | $name = md5(serialize($attributes)); |
|
| 626 | } |
|
| 627 | $this->addMeta('script', $name, $attributes); |
|
| 628 | } |
|
| 629 | ||
| 630 | /** |
|
| 631 | * Add StyleSheet or CSS code to the document head |
|
| @@ 639-658 (lines=20) @@ | ||
| 636 | * @param string $name Element Name in array stylesheets are stored in. |
|
| 637 | * @return void |
|
| 638 | */ |
|
| 639 | public function addStylesheet($src = '', $attributes = array(), $content = '', $name = '') |
|
| 640 | { |
|
| 641 | if (empty($attributes)) { |
|
| 642 | $attributes = array(); |
|
| 643 | } |
|
| 644 | if (!empty($src)) { |
|
| 645 | $src = $GLOBALS['xoops']->url($this->resourcePath($src)); |
|
| 646 | $attributes['href'] = $src; |
|
| 647 | } |
|
| 648 | if (!isset($attributes['type'])) { |
|
| 649 | $attributes['type'] = 'text/css'; |
|
| 650 | } |
|
| 651 | if (!empty($content)) { |
|
| 652 | $attributes['_'] = $content; |
|
| 653 | } |
|
| 654 | if (empty($name)) { |
|
| 655 | $name = md5(serialize($attributes)); |
|
| 656 | } |
|
| 657 | $this->addMeta('stylesheet', $name, $attributes); |
|
| 658 | } |
|
| 659 | ||
| 660 | /** |
|
| 661 | * Add a <link> to the header |
|