示例#1
0
 public static function tokenDefault(&$token, &$text)
 {
     if ($token['type'] == 'text') {
         $text .= $token['data'];
     } else {
         if ($token['type'] == 'tag' && strtoupper($token['name']) == 'COMPONENT') {
             $name = $token['data']['name'];
             $component = SystemComponent::getComponentByName($name);
             if ($component !== null) {
                 $text .= '<?php $data = ' . var_export($token['data'], true) . '; $flags = ' . var_export($token['flags'], true) . '; ?>';
                 // Sustituyo esto:
                 //$text .= $component->getPHP();
                 // Por esto otro:
                 $html = $component->getPHP();
                 $ctokens = TreeScript::getParse($html);
                 $ctext = '';
                 foreach ($ctokens as $ctoken) {
                     RenderToken::tokenDefault($ctoken, $ctext);
                 }
                 $text .= $ctext;
                 // FIN
                 ControllerPage::requireComponent($name);
             }
         } else {
             if ($token['type'] == 'tag' && $token['name'] == '') {
                 $text .= '';
             } else {
                 //$text .= '';
             }
         }
     }
 }
示例#2
0
 private function requireComponent($name)
 {
     if (!array_key_exists($name, $this->components_loaded)) {
         // Busco el componente:
         $component = SystemComponent::getComponentByName($name);
         if (null === $component) {
             // Error
             $this->components_loaded[$name] = "error";
         } else {
             $this->components_loaded[$name] = true;
             $this->appendJS($component->getJS(), $name);
             $this->css = $component->getCSS() . $this->css;
         }
     }
 }
示例#3
0
<?php

$name = $_POST['id_component'];
$component = SystemComponent::getComponentByName($name);
$result = new stdClass();
$result->js = $component->getJS();
$result->css = $component->getCSS();
$result->html = $component->getPHP();
echo json_encode($result);
示例#4
0
文件: ajax.php 项目: fulldump/8
<?php

$param = Router::$parameters;
if (!array_key_exists('{component}', $param)) {
    echo 'show all component list if mode debug on. Else 404';
    return;
}
if (!array_key_exists('{call}', $param)) {
    echo "See all calls for the component '{$parameters['{component}']}' if mode debug on. Else 404";
    return;
}
$component = SystemComponent::getComponentByName($param['{component}']);
if (null === $component) {
    echo "Component does not exist (debug mode). Else 404";
    return;
}
$ajax = $component->getAjax($param['{call}']);
if (null === $ajax) {
    echo "Ajax does not exist (debug mode). Else 404";
    return;
}
eval('?>' . $ajax);
// TODO: fix this !!!
if (Config::get('CACHE_AJAX_ENABLED')) {
    $cached = Router::export() . $ajax;
    Cache::add(Router::$url, $cached);
    $filename = 'cache/' . md5(Router::$url);
    file_put_contents($filename, php_strip_whitespace($filename));
}
示例#5
0
文件: store_js.php 项目: fulldump/8
<?php

$name = $_POST['id_component'];
$code = $_POST['js'];
SystemComponent::getComponentByName($name)->setJS($code);