<?php // Get sencha2 require_once "../atsumi/init.php"; // Add class areas to the class loader atsumi_Loader::references(array('atsumi-examples' => 'app examples mvc', 'atsumi' => 'caster mvc widgets validators cache database')); // Initalise sencha and the url parser $settings = new ex_Settings(); Atsumi::initApp($settings); Atsumi::app__setUriParser('uriparser_Gyokuro'); // Execute sencha try { Atsumi::app__go($_SERVER['REDIRECT_URL']); } catch (app_PageNotFoundException $e) { Atsumi::app__go("/404/"); } // Render the processed output Atsumi::app__render();
/** * Creates a new mvc_ClamShellHandler instance * Note: Directory strings that do not start with a '/' will be presumed relative to the * atsumi workspace. Directory strings that do start with a '/' will be presumed to be * absolute paths * @param string $templateDir The directory that all templates are stored in * @param string $compileDir The directory that ClamShell will write its compiled templates to */ public function __construct($templateDir, $compileDir, $flags = 0) { $this->flags = $flags; $this->templateDir = substr($templateDir, 0, 1) == '/' ? $templateDir : atsumi_Loader::getWorkspace() . '/' . $templateDir; $this->compileDir = substr($compileDir, 0, 1) == '/' ? $compileDir : atsumi_Loader::getWorkspace() . '/' . $compileDir; }
/** * Formats a backtrace into a content type * @access protected * @param array $trace The trace to format * @param string $contentType The type of content to return */ protected static function formatTrace($trace, $contentType = 'text/plain') { $out = ''; $row = 0; foreach ($trace as $i => $l) { if (array_key_exists('class', $l) && $l['class'] == 'atsumi_ErrorHandler') { continue; } $args = array_key_exists('args', $l) ? self::argsToString($l['args']) : ''; switch ($contentType) { default: case 'text/plain': $location = array_key_exists('file', $l) ? sf("%s(%s): ", str_replace(atsumi_Loader::getWorkspace(), 'WORKSPACE', $l['file']), $l['line']) : "[internal function]: "; $out .= sfl('#%s %s%s%s', $row, $location, array_key_exists('class', $l) ? array_key_exists('object', $l) ? sf('%s->%s', $l['class'], $l['function']) : sf('%s::%s', $l['class'], $l['function']) : $l['function'], sf('(%s)', $args)); break; case 'text/html': $location = array_key_exists('file', $l) ? sf("%s(<strong>%s</strong>): ", preg_replace('|\\/([a-zA-Z0-9\\-\\_\\.]+\\.php)|', '/<strong class="atsumiFile">\\1</strong>', htmlentities(str_replace(atsumi_Loader::getWorkspace(), 'WORKSPACE', $l['file']))), $l['line']) : "[internal function]: "; $out .= sfl("#<strong>%s</strong> %s%s%s", $row, $location, array_key_exists('class', $l) ? array_key_exists('object', $l) ? sf("<strong class='atsumiObject'>%s</strong>-><strong class='atsumiMethod'>%s</strong>", $l['class'], $l['function']) : sf("<strong class='atsumiClass'>%s</strong>::<strong class='atsumiMethod'>%s</strong>", $l['class'], $l['function']) : sf("%s", $l['function']), sf("(%s)", $args)); break; } $row++; } return $out; }
<?php /* include Atsumi */ require_once "../atsumi/init.php"; /* load the necessary packages in Atsumi & project */ atsumi_Loader::references(array('atsumi' => 'utility mvc database', 'projectFolder' => 'app mvc')); /* initialise the project settings */ $settings = new boot_Settings(); /* load the project settings in to Atsumi */ Atsumi::initApp($settings); try { /* process the controller & method requested by the URI */ Atsumi::app__go($_SERVER['REQUEST_URI']); } catch (app_PageNotFoundException $e) { /* handle 404's */ Atsumi::app__go("/404/"); } /* render the page */ Atsumi::app__render();
<?php // Get sencha2 require_once "../atsumi/init.php"; // Add class areas to the class loader atsumi_Loader::references(array('atsumi-live' => 'app live site', 'atsumi' => 'caster mvc widgets validators')); // Initalise atsumi and the uri parser $settings = new al_Settings(); Atsumi::initApp($settings); Atsumi::app__setUriParser('uriparser_Gyokuro'); // Execute Atsumi try { Atsumi::app__go($_SERVER['REDIRECT_URL']); } catch (app_PageNotFoundException $e) { Atsumi::app__go("/404/"); } // Render the processed output Atsumi::app__render();
<?php atsumi_Loader::references(array('atsumi' => 'utility/calendar')); abstract class db_AbstractRow { private $rowData; protected $caster; protected abstract function initCaster(); public function __construct($rowData) { $this->rowData = $rowData; } public function cast($format, $column) { if (!array_key_exists($column, $this->rowData)) { throw new db_RowColumnNotFoundException('Column not found: ' . $column); } $data = $this->rowData[$column]; $this->initCaster(); return $this->caster->cast('%' . $format, $data); } public function getRaw($column) { return $data[$column]; } public function __get($call) { $pos = strpos($call, '_'); return call_user_func_array(array($this, 'cast'), array(substr($call, 0, $pos), substr($call, $pos + 1))); } }