示例#1
0
 function __construct($widget)
 {
     $this->id = $widget->widget;
     $this->templateTarget = $widget->templateTarget;
     $this->tags = $widget->tags;
     $theData = getFile("widgets/" . $this->id . "/widget.json", true);
     if ($theData == false) {
         throw new RuntimeException("JSON FILE couldn't be opened.");
     }
     try {
         $json = JsonHandler::decode($theData);
         $this->name = $json->name;
         $this->description = $json->description;
         $this->js = $json->js;
         $this->dependencies = $json->dependencies;
         $this->dependenciesCSS = $json->dependenciesCSS;
         $this->html = $json->html;
         $this->css = $json->css;
     } catch (Exception $e) {
         throw new RuntimeException("JSON FILE corrupted. " . $e);
     }
 }
示例#2
0
        return;
    }
    $theData = getFile($filename);
    try {
        $json = JsonHandler::decode($theData);
    } catch (Exception $e) {
        echo "ERROR: JSON cant be decoded.";
        echo "Caught " . $e->getMessage();
        return;
    }
} else {
    echo "ERROR: parameter id is mandatory";
    return;
}
if ($_GET['test'] != '' && $_GET['test'] == 'true') {
    array_push($json->widgets, JsonHandler::decode('{	"widget": "QUnitWidget", "parameters": { "id": "qunit"}, "templateTarget":"center"}'));
}
switch ($_GET['type']) {
    case "json":
        Header("content-type: application/json");
        echo $theData;
        break;
    case "js":
        Header("content-type: application/x-javascript");
        //Adding all the mandatory dependencies that are Web based
        foreach ($mandatoryWeb as $url) {
            echo "\n//" . $url . "\n" . getUrl($url) . "\n";
        }
        //Adding all the mandatory dependencies that are local files
        foreach ($mandatoryLocal as $path) {
            echo "\n//" . $path . "\n" . getFile($path, true);