Ejemplo n.º 1
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());
     }
 }