public function __construct($config, $type)
 {
     if (is_string($config)) {
         $config = (require $config);
     }
     if (isset($config['app_path'])) {
         $this->setBasePath($config['app_path']);
         Base::setAppPath($config['app_path']);
         Loader::setPathOfAlias('app', Base::getAppPath());
         Loader::setPathOfAlias('public', dirname($_SERVER['SCRIPT_FILENAME']));
         unset($config['app_path']);
     } else {
         throw new Exception('Application: missing application\'s config "app_path"');
     }
     if (!isset($config['namespace'])) {
         throw new Exception('Application: missng config "namespace"');
     }
     Loader::addNamespace($config['namespace'], dirname(Base::getAppPath()));
     $this->setAppNamespace($config['namespace']);
     if (isset($config['import'])) {
         $this->_import($config['import']);
         unset($config['import']);
     }
     $this->_type = $type;
     $this->preInit();
     $this->configuration($config);
     $this->_init();
     $this->afterInit();
     /**
      * @TODO removed since version 1.0.2, application custom error handler
      */
     //        set_error_handler(array($this,'handleError'),error_reporting());
 }
示例#2
0
<?php

defined('APP_PATH') or define('APP_PATH', dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR);
defined('APP_RESOURCES_PATH') or define('APP_RESOURCES_PATH', APP_PATH . 'Resources' . DIRECTORY_SEPARATOR);
\Flywheel\Loader::addNamespace('CMSBackend', dirname(APP_PATH));
return array('i18n' => ['default_locale' => 'en-GB', 'resource' => ['vi-VN' => [APP_RESOURCES_PATH . 'i18n/vi-VN/messages.yml'], 'en-GB' => [APP_RESOURCES_PATH . 'i18n/en-GB/messages.yml']]], 'app_name' => 'CMSBackend', 'app_path' => APP_PATH, 'view_path' => APP_PATH . DIRECTORY_SEPARATOR . 'Template/', 'import' => array('app.Library.*', 'app.Controller.*', 'root.model.*'), 'editor' => 'app.Widget.Editor.SummerNote', 'namespace' => 'CMSBackend', 'timezone' => 'Asia/Ho_Chi_Minh', 'template' => 'Flat', 'css_version' => '1.0', 'js_version' => '1.0');
示例#3
0
<?php

defined('APP_PATH') or define('APP_PATH', dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR);
\Flywheel\Loader::addNamespace('Frontend', dirname(APP_PATH));
return array('app_name' => 'Frontend', 'app_path' => APP_PATH, 'view_path' => APP_PATH . DIRECTORY_SEPARATOR . 'Template/', 'import' => array('app.Library.*', 'app.Controller.*', 'root.model.*'), 'namespace' => 'Frontend', 'timezone' => 'Asia/Ho_Chi_Minh', 'template' => 'Mobile9');
示例#4
0
<?php

use Flywheel\Loader;
define('ROOT_DIR', dirname(dirname(__DIR__)));
define('MEDIA_DIR', ROOT_DIR . '/public/media');
define('PUBLIC_DIR', ROOT_DIR . '/public/');
require_once __DIR__ . '/../../vendor/autoload.php';
Loader::addNamespace('SFS', ROOT_DIR . '/library/');
Loader::register();
$app = new \Slim\Slim(array('debug' => true, 'mode' => 'development'));
$app->get('/cache/:function/:dimension/:path+', function ($function, $dimension, $path) use($app) {
    $path = implode(DIRECTORY_SEPARATOR, $path);
    $public_dir = rtrim(dirname(MEDIA_DIR), '/');
    //check file exists
    if (!file_exists($public_dir . '/' . $path)) {
        //throw 404
        $app->halt(404, 'File not found!');
    }
    try {
        $dimension = explode('-', $dimension);
        $params = \SFS\Image\Transform::hydrateParameters($dimension);
        $imgTransform = new \SFS\Image\Transform($public_dir . '/' . $path);
        if (!method_exists($imgTransform, $function)) {
            $app->halt(400, 'Not support API "' . $function . '"');
            exit;
        }
        $imgTransform->{$function}($params);
        $dimension = implode('-', $dimension);
        $output = "{$public_dir}/thumbs/cache/{$function}/{$dimension}/{$path}";
        \SFS\Upload::makeFileStorageDir($output);
        $imgTransform->save($output);
示例#5
0
<?php

use Flywheel\Loader;
define('ROOT_PATH', dirname(__FILE__));
define('GLOBAL_PATH', ROOT_PATH . DIRECTORY_SEPARATOR . 'global');
define('LIBRARY_PATH', ROOT_PATH . DIRECTORY_SEPARATOR . 'library');
define('RUNTIME_PATH', ROOT_PATH . DIRECTORY_SEPARATOR . 'runtime');
define('PUBLIC_DIR', ROOT_PATH . DIRECTORY_SEPARATOR . 'public');
define('MEDIA_DIR', ROOT_PATH . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR . 'media');
define('EXTENSION_DIR', ROOT_PATH . DIRECTORY_SEPARATOR . 'extension');
define('FRONTEND_DIR', ROOT_PATH . DIRECTORY_SEPARATOR . 'apps/Frontend');
require_once ROOT_PATH . '/vendor/autoload.php';
//add namespace before register
Loader::addNamespace('Toxotes', LIBRARY_PATH);
Loader::register();
Loader::setPathOfAlias('root', ROOT_PATH);
Loader::setPathOfAlias('global', GLOBAL_PATH);
Loader::setPathOfAlias('library', LIBRARY_PATH);
Loader::setPathOfAlias('extension', EXTENSION_DIR);
Loader::import('global.include.*');
set_error_handler(array('Toxotes\\ErrorHandler', 'errorHandling'));
set_exception_handler(array('Toxotes\\ErrorHandler', 'exceptionHandling'));