Exemple #1
0
 public function _use($path)
 {
     $scr = $this->fs->getContent($path);
     $j = new Services_JSON();
     $vmc = $j->decode($scr);
     $root = $this->root;
     return Dtl::run($root, $vmc);
 }
Exemple #2
0
require_once __DIR__ . "/php/json.php";
require_once __DIR__ . "/php/dtlfs/DtlFS.php";
require_once __DIR__ . "/php/dtlfs/DtlSys.php";
require_once __DIR__ . "/php/dtlfs/DtlParam.php";
require_once __DIR__ . "/php/ErrorHandler.php";
if (isset($_POST["script"]) || isset($_GET["file"])) {
    $root = Dtl::createEmptyRoot();
    //----Load Builtin Libraries----
    Dtl::initRoot($root);
    DtlFS::initRoot($root);
    DtlSys::initRoot($root);
    //--------------------------
    $root->param = new DtlParam();
    if (isset($_GET["file"])) {
        $scr = $root->FS->getContent($_GET["file"]);
    } else {
        $scr = $_POST["script"];
    }
    $j = new Services_JSON();
    $vmc = $j->decode($scr);
    header("Content-type: text/json; charset=utf8");
    echo $j->encode(DtlUtil::unwrap(Dtl::run($root, $vmc)));
} else {
    ?>
    <form action="runDtl.php" method="POST">
    <textarea name="script" rows=10 cols=40>
    </textarea>
    <input type="submit">
    </form>
<?php 
}