/** * 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; }