Example #1
0
 public function testMain()
 {
     var_dump(Nora::Configure()->toArray());
 }
Example #2
0
 /**
  * Initialize
  *
  * @covers ::initialize
  */
 public function testInitialize()
 {
     Nora::initialize(TEST_PROJECT_PATH, 'devel');
 }
Example #3
0
<?php

/**
 * Nora Project
 *
 * @author Hajime MATSUMOTO <*****@*****.**>
 * @copyright 2015 nora-worker.net.
 * @licence https://www.nora-worker.net/LICENCE
 * @version 1.0.0
 */
require_once realpath(__DIR__ . '/../') . '/class/Nora.php';
// オートローダを登録する
Nora::Autoloader()->register();
Example #4
0
 /**
  * MimeTypeを取得する
  */
 public static function getMimeType($data, $ext = false)
 {
     static $finfo = null;
     if ($finfo === null) {
         $finfo = finfo_open(FILEINFO_MIME);
     }
     $type = finfo_file($finfo, $data);
     if (!$ext) {
         return $type;
     }
     switch (strtok($type, ';')) {
         case 'image/jpeg':
         case 'image/jpg':
             return 'jpeg';
             break;
         case 'image/png':
             return 'png';
             break;
         case 'image/gif':
             return 'gif';
             break;
     }
     throw new \Exception(Nora::message('サポートされてないタイプです'));
 }
Example #5
0
 /**
  * スタンドアローン版
  */
 public static function standalone()
 {
     $scope = Scope::create(null, 'NoraScope')->setComponent('Autoloader', function () {
         return Nora::Autoloader();
     })->on('app.pre_configure', function ($e) {
         # モジュールロードパスを追加
         $e->app->ModuleLoader()->addModulePath(realpath(__DIR__ . '/../modules'));
         # コンフィグロードパスを追加
         $e->app->Config()->addConfigDir(realpath(__DIR__ . '/../..') . '/config');
     });
     self::$_app = new App($scope);
     self::configure();
     return self::$_app;
 }