コード例 #1
0
ファイル: dev.php プロジェクト: titon/app
/**
 * @copyright   2010-2014, The Titon Project
 * @license     http://opensource.org/licenses/bsd-license.php
 * @link        http://titon.io
 */
use Titon\Cache\Storage\FileSystemStorage;
use Titon\Common\Config;
use Titon\Debug\Debugger;
use Titon\Mvc\Application;
/**
 * --------------------------------------------------------------
 *  Development
 * --------------------------------------------------------------
 *
 * Configuration pertaining to development environments should
 * be defined here. It will be bootstrapped automatically.
 */
$app = Application::getInstance();
/**
 * Update caching to use the file system.
 */
$app->get('cache')->addStorage('default', new FileSystemStorage(['directory' => TEMP_DIR . 'cache/']));
/**
 * Enable error reporting.
 */
Debugger::enable(true);
/**
 * Define database login credentials.
 */
Config::set('db.default', ['host' => 'localhost', 'port' => 3306, 'user' => 'root', 'pass' => '', 'database' => '', 'encoding' => 'utf8']);
コード例 #2
0
ファイル: Application.php プロジェクト: titon/mvc
 /**
  * Default mechanism for handling uncaught exceptions.
  * Will fetch the current controller instance or instantiate an ErrorController.
  * The error view template will be rendered.
  *
  * @uses Titon\Debug\Debugger
  *
  * @param \Exception $exception
  */
 public function handleError(Exception $exception)
 {
     if (class_exists('Titon\\Debug\\Debugger')) {
         Debugger::logException($exception);
     }
     // Get the controller
     try {
         $controller = Registry::get('titon.controller');
         if (!$controller instanceof Controller) {
             throw new MissingControllerException();
         }
     } catch (Exception $e) {
         $controller = new ErrorController();
         $controller->initialize();
     }
     // And the view
     try {
         $view = Registry::get('titon.view');
         if (!$view instanceof ViewInterface) {
             throw new MissingViewException();
         }
     } catch (Exception $e) {
         $view = new View();
         $view->addHelper('html', new HtmlHelper());
         $view->addHelper('block', new BlockHelper());
         $view->addHelper('asset', new AssetHelper(['webroot' => $this->getWebroot()]));
     }
     $controller->setView($view);
     $controller->setRequest($this->getRequest());
     $controller->setResponse($this->getResponse());
     $this->emit('mvc.preError', [$this, $controller, $exception]);
     $response = $controller->renderError($exception);
     $this->emit('mvc.postError', [$this, $controller, $exception, &$response]);
     $this->getResponse()->body($response)->respond();
     $this->emit('mvc.onShutdown', [$this]);
     exit;
 }
コード例 #3
0
ファイル: table.php プロジェクト: ciklon-z/framework
</td>
            </tr>

        <?php 
    }
    // Display class methods
    if (is_object($value)) {
        $methods = get_class_methods($value);
        sort($methods);
        foreach ($methods as $method) {
            ?>

            <tr>
                <td><span class="debug-type type-function"><?php 
            echo $method;
            ?>
</span></td>
                <td>method</td>
                <td></td>
            </tr>

        <?php 
        }
    }
    ?>
    </table>

<?php 
} else {
    echo Debugger::parseValue($value, true);
}
コード例 #4
0
ファイル: setup.php プロジェクト: titon/app
 * Enable the debugger to handle errors and exceptions.
 * A logger can be defined to log all exceptions.
 */
Debugger::initialize();
Debugger::setLogger(new Logger(TEMP_DIR . '/logs'));
/**
 * --------------------------------------------------------------
 *  Error Handling
 * --------------------------------------------------------------
 *
 * A custom error handler can be defined that can output error
 * pages for uncaught exceptions. By default, the Application
 * object handles errors by initializing an ErrorController
 * and rendering a template with the View.
 */
Debugger::setHandler([$app, 'handleError']);
/**
 * --------------------------------------------------------------
 *  Configuration
 * --------------------------------------------------------------
 *
 * Define the primary configurations used within the application.
 * These values can be conveniently accessed via methods on
 * the Config class -- Config::salt().
 */
Config::set('app', ['name' => 'Titon', 'salt' => 'AN3sk8ANjsSl1Hwx910APs7lq8nmsP5LQmKC', 'encoding' => 'UTF-8']);
/**
 * --------------------------------------------------------------
 *  Resource Mapping
 * --------------------------------------------------------------
 *