| @@ 556-573 (lines=18) @@ | ||
| 553 | * |
|
| 554 | * @return void |
|
| 555 | */ |
|
| 556 | public function addScript($src = '', $attributes = array(), $content = '') |
|
| 557 | { |
|
| 558 | $xoops = \Xoops::getInstance(); |
|
| 559 | if (empty($attributes)) { |
|
| 560 | $attributes = array(); |
|
| 561 | } |
|
| 562 | if (!empty($src)) { |
|
| 563 | $src = $xoops->url($this->resourcePath($src)); |
|
| 564 | $attributes['src'] = $src; |
|
| 565 | } |
|
| 566 | if (!empty($content)) { |
|
| 567 | $attributes['_'] = $content; |
|
| 568 | } |
|
| 569 | if (!isset($attributes['type'])) { |
|
| 570 | $attributes['type'] = 'text/javascript'; |
|
| 571 | } |
|
| 572 | $this->addMeta('script', $src, $attributes); |
|
| 573 | } |
|
| 574 | ||
| 575 | /** |
|
| 576 | * Add StyleSheet or CSS code to the document head |
|
| @@ 584-601 (lines=18) @@ | ||
| 581 | * |
|
| 582 | * @return void |
|
| 583 | */ |
|
| 584 | public function addStylesheet($src = '', $attributes = array(), $content = '') |
|
| 585 | { |
|
| 586 | $xoops = \Xoops::getInstance(); |
|
| 587 | if (empty($attributes)) { |
|
| 588 | $attributes = array(); |
|
| 589 | } |
|
| 590 | if (!empty($src)) { |
|
| 591 | $src = $xoops->url($this->resourcePath($src)); |
|
| 592 | $attributes['href'] = $src; |
|
| 593 | } |
|
| 594 | if (!isset($attributes['type'])) { |
|
| 595 | $attributes['type'] = 'text/css'; |
|
| 596 | } |
|
| 597 | if (!empty($content)) { |
|
| 598 | $attributes['_'] = $content; |
|
| 599 | } |
|
| 600 | $this->addMeta('stylesheet', $src, $attributes); |
|
| 601 | } |
|
| 602 | ||
| 603 | /** |
|
| 604 | * addScriptAssets - add a list of scripts to the page |
|