Code Duplication    Length = 20-20 lines in 2 locations

htdocs/class/theme.php 2 locations

@@ 595-614 (lines=20) @@
592
     * @param  string $name       Element Name in array scripts are stored in.
593
     * @return void
594
     */
595
    public function addScript($src = '', $attributes = array(), $content = '', $name = '')
596
    {
597
        if (empty($attributes)) {
598
            $attributes = array();
599
        }
600
        if (!empty($src)) {
601
            $src               = $GLOBALS['xoops']->url($this->resourcePath($src));
602
            $attributes['src'] = $src;
603
        }
604
        if (!empty($content)) {
605
            $attributes['_'] = $content;
606
        }
607
        if (!isset($attributes['type'])) {
608
            $attributes['type'] = 'text/javascript';
609
        }
610
        if (empty($name)) {
611
            $name = md5(serialize($attributes));
612
        }
613
        $this->addMeta('script', $name, $attributes);
614
    }
615
616
    /**
617
     * Add StyleSheet or CSS code to the document head
@@ 625-644 (lines=20) @@
622
     * @param  string $name       Element Name in array stylesheets are stored in.
623
     * @return void
624
     */
625
    public function addStylesheet($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['href'] = $src;
633
        }
634
        if (!isset($attributes['type'])) {
635
            $attributes['type'] = 'text/css';
636
        }
637
        if (!empty($content)) {
638
            $attributes['_'] = $content;
639
        }
640
        if (empty($name)) {
641
            $name = md5(serialize($attributes));
642
        }
643
        $this->addMeta('stylesheet', $name, $attributes);
644
    }
645
646
    /**
647
     * Add a <link> to the header