public function __construct() { $this->controller = ControllerPage::getInstance(); $this->model = ModelPage::getInstance(); require_once CORE_ROOT . THREEPARTY_REQ . "template" . DIRECTORY_SEPARATOR . "Template.php"; $this->template = new \Template(WEBSITE_ROOT . 'templates' . DIRECTORY_SEPARATOR, WEBSITE_ROOT . 'cache/'); }
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 .= ''; } } } }
/** This method is the main controller */ public static function serveWeb() { if (Config::get('PROFILING_ENABLED')) { Profiling::start('index'); } $url = $_SERVER['REQUEST_URI']; $hash = md5($url); if (!@(include 'cache/' . $hash)) { Router::setUrl($url); switch (Router::$node->getProperty('type')) { case 'page': case 'root': ControllerPage::compile(); break; case 'php': ControllerPhp::compile(); break; } } if (Config::get('PROFILING_ENABLED')) { Profiling::end(); } }
protected function getControllerPage() { if (!class_exists('ControllerPage')) { require_once CORE_ROOT . CONTROLLERS . DIRECTORY_SEPARATOR . 'ControllerPage.php'; } if (!is_object($this->page)) { $this->page = ControllerPage::getInstance(); } }