Code Duplication    Length = 20-20 lines in 2 locations

htdocs/class/theme.php 2 locations

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