Menu

[r59]: / trunk / lang / python / python.exec.php  Maximize  Restore  History

Download this file

40 lines (29 with data), 747 Bytes

 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
29
30
31
32
33
34
35
36
37
38
39
40
<?php
##
require_once __DIR__.'/python.eval.php';
##
class lang_python_exec {
##
public static function __exec__($file,$endmarker=true) {
##
$code = file_get_contents($file);
##
$phpc = lang_python_eval::__eval__($code,$file,$endmarker);
##
echo '<xmp style="padding:5px;background:#f2f2f2;border:1px solid #ccc">';
echo $code;
echo '</xmp>';
##
echo '<xmp style="padding:5px;background:#f2f2f2;border:1px solid #ccc">';
echo $phpc;
echo '</xmp>';
##
$exec = __DIR__.'/'.md5($file).'.php';
##
file_put_contents($exec, "<?php\n".$phpc);
##
echo '<xmp style="padding:5px;border:1px solid #f2f2f2">';
include($exec);
echo '</xmp>';
}
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.