Esempio n. 1
0
 /**
  * @todo Implement testInit().
  */
 public function testInit()
 {
     $config = Panda::getConfig();
     $config[Panda::CONFIG_DEBUG] = true;
     Panda::init($config);
     $config = Panda::getConfig();
     $this->assertTrue($config[Panda::CONFIG_DEBUG] === true);
 }
Esempio n. 2
0
<?php

ob_start();
/**
 * Panda init
 */
// required files
include 'Panda.php';
$config = array(Panda::CONFIG_DEBUG => true, Panda::CONFIG_VALID_PATH => array('/'), Panda::CONFIG_LOG_PATH => '/tmp/', Panda::CONFIG_HTTP_TPL => __DIR__ . '/../../../Panda/templates/http.php', Panda::CONFIG_FATAL_HTML => __DIR__ . '/../../../Panda/templates/fatal.php', Panda::CONFIG_ON_ERROR_FIRED => array('Panda_App_Error_Handler', 'onError'), Panda::CONFIG_ENABLE_FIREPHP => true, Panda::CONFIG_CATCH_FATAL => true, Panda::CONFIG_PANDA_PATH => '/', Panda::CONFIG_EDITOR => Panda::EDITOR_BESPIN | Panda::EDITOR_TEXTMATE, Panda::CONFIG_CATCH_STRICT => true);
// catch stric error in compile ?
Panda::init($config);
/**
 * Application error handler
 *
 * @param string $headering
 * @param string $subheading
 * @param array  $info
 * @param array  $options
 *
 * @return void
 */
class Panda_App_Error_Handler
{
    public static function onError($heading, $subheading, $info, $options)
    {
    }
}
Esempio n. 3
0
 /**
  * 初期化
  *
  * BEARの使用時にbootstrapなどの部分で一度呼び使用クラスの設定
  * オートローダー、エラーハンドラの設定、デバック用機能有効化などを行います。
  *
  * @param array $appConfig アプリケーション別クラス設定
  *
  * @return void
  */
 public static function init(array $appConfig = array('core' => array('debug' => false)))
 {
     static $_run = false;
     if ($_run === true) {
         return;
     }
     $_run = true;
     // PEAR_Errorがオートローダー効かないための事前require
     include_once 'PEAR.php';
     // クラスオートローダー登録
     self::set('app', new ArrayObject($appConfig));
     self::$_config = $appConfig['core'];
     if (self::$_config['debug'] === false) {
         spl_autoload_register(array(__CLASS__, 'onAutoload'));
         //Panda (live)
         $pandaConfig = isset($appConfig['Panda']) ? $appConfig['Panda'] : array();
         $pandaConfig[Panda::CONFIG_DEBUG] = false;
         // デバックモードオフ
         if (defined('_BEAR_APP_HOME')) {
             $pandaConfig[Panda::CONFIG_LOG_PATH] = _BEAR_APP_HOME . '/logs/';
         }
         Panda::init($pandaConfig);
     } else {
         if (isset($appConfig['BEAR']['autoload'])) {
             spl_autoload_register($appConfig['BEAR']['autoload']);
         } else {
             spl_autoload_register(array(__CLASS__, 'onAutoload'));
         }
         include _BEAR_BEAR_HOME . '/BEAR/BEAR/script/debug_init.php';
     }
     if (PHP_SAPI === 'cli' && defined('_BEAR_APP_HOME')) {
         ini_set('include_path', _BEAR_APP_HOME . PATH_SEPARATOR . get_include_path());
     }
 }
Esempio n. 4
0
}
// エラー初期化(Panda)
if (defined('_BEAR_APP_HOME')) {
    $validPath = array(_BEAR_APP_HOME . '/htdocs', _BEAR_APP_HOME . '/App');
} else {
    $validPath = array();
}
// BEAR developperのみBEAR内のエラー表示
if (isset($_SERVER['beardev']) && $_SERVER['beardev']) {
    $validPath[] = _BEAR_BEAR_HOME;
}
$pandaConfig = array(Panda::CONFIG_DEBUG => $appConfig['core']['debug'], Panda::CONFIG_VALID_PATH => $validPath, Panda::CONFIG_LOG_PATH => _BEAR_APP_HOME . '/logs/');
if (isset($appConfig['Panda'])) {
    $pandaConfig = array_merge($pandaConfig, $appConfig['Panda']);
}
Panda::init($pandaConfig);
// デバック用画面
include _BEAR_BEAR_HOME . '/BEAR/BEAR/script/dev_info_screen.php';
// _preクエリー
if (isset($_GET['_pre'])) {
    echo '<pre>';
}
// _errorクエリー
if (isset($_GET['_error'])) {
    ini_set('display_errors', 1);
    error_reporting(E_ALL);
    restore_error_handler();
    restore_exception_handler();
    return;
}
// exit