<?php // Example of a view-first controller //find the current dir $cwd = dirname(__FILE__); // let's start timing so that later we can display how long it took to run our app. // this will include the amount of time it took to include the glu framework. $start = microtime(TRUE); // include an auto-load function for classes, so that we can // put all of our related classes into this directory and they // will be automagically included for us. include $cwd . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR . '__autoload.php'; // We are making a view-first controller, so let's determine our view, shall we? I am calling // a short snippet that tells me what the name of my view is based on the current url. $view = GLU::instance($_SERVER)->dispatch(dir::lib . 'extract_view.php'); // set up some arguments $args = array('view' => $view, 'start' => $start, 'request' => $_REQUEST); // kick off the app. // since glu is in the directory (as a symlink), when we start using the glu class here, the main // glu file is automatically included. later, when we call other classes in our mvc, those classes // will be automatically included for us as well on the fly. GLU::instance($args)->dispatch(dir::app . 'main.php'); // EOF
<?php use Gaia\Glu; include __DIR__ . '/../../common.php'; $glu = GLU::instance(); foreach (array('result_set', 'result_get', 'result_isset', 'result_unset') as $key) { ${$key} = array(); } if (!isset($input) || !is_array($input)) { $input = array(); } foreach ($input as $k => $v) { $result_set[$k] = $glu->{$k} = $v; $result_isset[$k] = isset($glu->{$k}); $result_get[$k] = $glu->{$k}; unset($glu->{$k}); $result_unset[$k] = $glu->{$k}; }
<?php // This demo shows how to build a very simple html template //find the current dir $cwd = dirname(__FILE__); // include the glu class include $cwd . DIRECTORY_SEPARATOR . 'glu.php'; // kick off the main glu. GLU::instance()->dispatch($cwd . '/lib/main.php'); // EOF
<?php include dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR . '__autoload.php'; $vars = array('view' => $view, 'start' => $start = microtime(TRUE), 'request' => $input); ob_start(); GLU::instance($vars)->dispatch(dirname(dirname(__FILE__)) . '/app/main.php'); $output = trim(ob_get_clean()); $dom = new DOMDocument(); $dom->loadHTML($output); // EOF
<?php // Example of a front-end controller // let's start timing so that later we can display how long it took to run our app. // this will include the amount of time it took to include the glu framework. $start = microtime(TRUE); // include an auto-load function for classes, so that we can // put all of our related classes into this directory and they // will be automagically included for us. include 'class' . DIRECTORY_SEPARATOR . '__autoload.php'; // determine which controller to call. $route = GLU::instance($_SERVER)->dispatch(Dir::util . 'extract_route.php'); // kick off the app. // since glu is in the directory (as a symlink), when we start using the glu class here, the main // glu file is automatically included. later, when we call other classes in our mvc, those classes // will be automatically included for us as well on the fly. GLU::instance(array('start' => $start, 'route' => $route, 'request' => $_REQUEST))->dispatch(Dir::app . 'main.php'); // EOF
<?php use Gaia\Glu; include __DIR__ . '/../../../common.php'; include __DIR__ . '/../../../../tests/assert/dom_installed.php'; if (!isset($input)) { $input = NULL; } $vars = array('route' => $route, 'start' => $start = microtime(TRUE), 'request' => $input); ob_start(); GLU::instance($vars)->dispatch(__DIR__ . '/../app/main.php'); $output = trim(ob_get_clean()); $dom = new DOMDocument(); $dom->loadHTML($output); // EOF
<?php use Gaia\Glu; include __DIR__ . '/../../common.php'; // Example of a front-end controller // let's start timing so that later we can display how long it took to run our app. // this will include the amount of time it took to include the glu framework. $start = microtime(TRUE); // determine which controller to call. $route = GLU::instance($_SERVER)->dispatch(__DIR__ . '/app/util/extract_route.php'); // kick off the app. // since glu is in the directory (as a symlink), when we start using the glu class here, the main // glu file is automatically included. later, when we call other classes in our mvc, those classes // will be automatically included for us as well on the fly. GLU::instance(array('start' => $start, 'route' => $route, 'request' => $_REQUEST))->dispatch(__DIR__ . '/app/main.php'); // EOF
<?php // an example of a CLI app. //find the current dir $cwd = dirname(__FILE__) . DIRECTORY_SEPARATOR; // make sure we are running from cli. if (!is_resource(STDIN)) { // exit with an error message for the web browser. die('<h1>Please run this from CLI.</h1><h2>Does not work in browser.</h2>'); } // include glu include $cwd . 'glu.php'; // kick it off, reading from STDIN GLU::instance(array('STDIN' => STDIN))->dispatch($cwd . 'app/main.php'); // EOF
<?php $DIR = realpath(dirname(__FILE__) . '/../../') . DIRECTORY_SEPARATOR; include_once $DIR . 'glu.php'; include_once $DIR . 'tests/' . DIRECTORY_SEPARATOR . 'taptest.php'; $glu = $message = $code = $result = NULL; $glu = GLU::instance(); if ($message === NULL) { $result = GLU::instance()->exception(); } elseif ($code === NULL) { $result = GLU::instance()->exception($message); } else { $result = GLU::instance()->exception($message, $code); }
<?php use Gaia\Glu; include __DIR__ . '/../../common.php'; $export = $glu = $result_dispatch = $result_export_after_dispatch = $result_export_after_dispatch = $exception = $exception_message = NULL; try { $glu = GLU::instance($arg); $export = array(); foreach ($glu as $k => $v) { $export[$k] = $v; } $result_export_before_dispatch = $export; $result_dispatch = $glu->dispatch(__DIR__ . '/lib/string.php'); $export = array(); foreach ($glu as $k => $v) { $export[$k] = $v; } $result_export_after_dispatch = $export; } catch (\Exception $e) { $exception = $e; $exception_message = $e->getMessage(); } // EOF
<?php use Gaia\Glu; // Example of a view-first controller // let's start timing so that later we can display how long it took to run our app. // this will include the amount of time it took to include the glu framework. $start = microtime(TRUE); // include an auto-load function for classes, so that we can // put all of our related classes into this directory and they // will be automagically included for us. include __DIR__ . '/../../common.php'; // We are making a view-first controller, so let's determine our view, shall we? I am calling // a short snippet that tells me what the name of my view is based on the current url. $view = GLU::instance($_SERVER)->dispatch(__DIR__ . '/app/lib/extract_view.php'); // set up some arguments $args = array('view' => $view, 'start' => $start, 'request' => $_REQUEST); // kick off the app. // since glu is in the directory (as a symlink), when we start using the glu class here, the main // glu file is automatically included. later, when we call other classes in our mvc, those classes // will be automatically included for us as well on the fly. GLU::instance($args)->dispatch(__DIR__ . '/app/main.php'); // EOF