File: testhelloworld.php

package info (click to toggle)
jsxgraph 0.98~dfsg1-3
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 28,132 kB
  • ctags: 1,325
  • sloc: xml: 5,869; java: 1,072; python: 667; php: 355; makefile: 129; sh: 36
file content (28 lines) | stat: -rw-r--r-- 572 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<html>
<?php
function jxgcompress($filename) 
{   
    if (file_exists($filename)) {
        $base64 = base64_encode(gzcompress(rawurlencode(file_get_contents($filename)),9));
        echo "var jxgcompressed = \"$base64\";\n";
    } else {
        throw new Exception("$filename not found");
    }
}
?>

<head>
<script src="./jsxcompressor.js" type="text/javascript"></script>
</head>
<body>
<h1>Using the JSX Compressor</h1>
<script type="text/javascript">
<?php 
    jxgcompress("./helloworld.js");
?>   

eval(JXG.decompress(jxgcompressed));
</script>
</body>
</html>