Subversion Repositories ALCASAR

Rev

Rev 2770 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2770 Rev 3037
Line 44... Line 44...
44
if ($script != null) {
44
if ($script != null) {
45
    $scriptjs = $script.'.js';
45
    $scriptjs = $script.'.js';
46
    $scriptmin = $script.'.min.js';
46
    $scriptmin = $script.'.min.js';
47
    $compression = false;
47
    $compression = false;
48
 
48
 
49
    header("content-type: application/x-javascript");
49
    header('content-type: application/x-javascript');
50
 
50
 
51
    if ((!defined("PSI_DEBUG") || (PSI_DEBUG !== true)) && defined("PSI_JS_COMPRESSION")) {
51
    if ((!defined("PSI_DEBUG") || (PSI_DEBUG !== true)) && defined("PSI_JS_COMPRESSION")) {
52
        $compression = strtolower(PSI_JS_COMPRESSION);
52
        $compression = strtolower(PSI_JS_COMPRESSION);
53
    }
53
    }
54
    switch ($compression) {
54
    switch ($compression) {
55
        case "normal":
55
    case "normal":
56
            if (file_exists($scriptmin) && is_readable($scriptmin)) {
56
        if (file_exists($scriptmin) && is_readable($scriptmin)) {
57
                $filecontent = file_get_contents($scriptmin);
57
            echo file_get_contents($scriptmin);
58
                echo $filecontent;
-
 
59
            } elseif (file_exists($scriptjs) && is_readable($scriptjs)) {
58
        } elseif (file_exists($scriptjs) && is_readable($scriptjs)) {
60
                $filecontent = file_get_contents($scriptjs);
-
 
61
                $packer = new JavaScriptPacker($filecontent);
59
            $packer = new JavaScriptPacker(file_get_contents($scriptjs));
62
                echo $packer->pack();
60
            echo $packer->pack();
63
            }
61
        }
64
            break;
62
        break;
65
        case "none":
63
    case "none":
66
            if (file_exists($scriptjs) && is_readable($scriptjs)) {
64
        if (file_exists($scriptjs) && is_readable($scriptjs)) {
67
                $filecontent = file_get_contents($scriptjs);
-
 
68
                $packer = new JavaScriptPacker($filecontent, 0);
65
           $packer = new JavaScriptPacker(file_get_contents($scriptjs), 0);
69
                echo $packer->pack();
66
            echo $packer->pack();
70
            } elseif (file_exists($scriptmin) && is_readable($scriptmin)) {
67
        } elseif (file_exists($scriptmin) && is_readable($scriptmin)) {
71
                $filecontent = file_get_contents($scriptmin);
68
           echo file_get_contents($scriptmin);
72
                echo $filecontent;
-
 
73
            }
69
        }
74
            break;
70
        break;
75
        default:
71
    default:
76
            if (file_exists($scriptjs) && is_readable($scriptjs)) {
72
        if (file_exists($scriptjs) && is_readable($scriptjs)) {
77
                $filecontent = file_get_contents($scriptjs);
73
            echo file_get_contents($scriptjs);
78
            } elseif (file_exists($scriptmin) && is_readable($scriptmin)) {
74
        } elseif (file_exists($scriptmin) && is_readable($scriptmin)) {
79
                $filecontent = file_get_contents($scriptmin);
75
            echo file_get_contents($scriptmin);
80
            } else break;
-
 
81
 
-
 
82
            echo $filecontent;
-
 
83
            break;
76
        }
84
    }
77
    }
85
}
78
}