Code Duplication    Length = 24-24 lines in 2 locations

plugin/vchamilo/lib/Virtual.php 2 locations

@@ 723-746 (lines=24) @@
720
     * @param bool $return
721
     * @return string
722
     */
723
    public static function requireJs($file, $component, $return = false)
724
    {
725
        global $_configuration, $htmlHeadXtra;
726
727
        if (preg_match('/^local_/', $component)) {
728
            $component = str_replace('local_', '', $component);
729
            $path = 'local/';
730
        } else {
731
            $path = 'plugin/';
732
        }
733
734
        // Secure the postslashing of the roots.
735
        $root_web = $_configuration['root_web'].'/';
736
        $root_web = preg_replace('#//$#', '/', $root_web);
737
738
        $str = '<script type="text/javascript" src="'.$root_web.$path.$component.'/js/'.$file.'"></script>'."\n";
739
        if ($return === 'head') {
740
            $htmlHeadXtra[] = $str;
741
        }
742
743
        if ($return) {
744
            return $str;
745
        }
746
        echo $str;
747
    }
748
749
    /**
@@ 755-778 (lines=24) @@
752
     * @param bool $return
753
     * @return string
754
     */
755
    public static function requireCss($file, $component, $return = false)
756
    {
757
        global $_configuration, $htmlHeadXtra;
758
759
        if (preg_match('/^local_/', $component)) {
760
            $component = str_replace('local_', '', $component);
761
            $path = 'local/';
762
        } else {
763
            $path = 'plugin/';
764
        }
765
766
        // Secure the postslashing of the roots.
767
        $root_web = $_configuration['root_web'].'/';
768
        $root_web = preg_replace('#//$#', '/', $root_web);
769
770
        $str = '<link rel="stylesheet" type="text/css" href="'.$root_web.$path.$component.'/'.$file.'.css" />'."\n";
771
        if ($return === 'head') {
772
            $htmlHeadXtra[] = $str;
773
        }
774
        if ($return) {
775
            return $str;
776
        }
777
        echo $str;
778
    }
779
780
    /**
781
     * @param string $url