Example #1
0
 /** 
  * Main function for initialize this class.
  * @param \Slim\Slim
  */
 public static function init()
 {
     date_default_timezone_set(static::config()->timezone);
     static::$db = static::config()->db;
     static::$user = new \ptejada\uFlex\User();
     static::$app = new \Slim\Slim();
     static::$mail = new \PHPMailer();
     static::$assets = new \Assets();
     static::$user->config->database->host = static::config()->db['server'];
     static::$user->config->database->user = static::config()->db['username'];
     static::$user->config->database->password = static::config()->db['password'];
     static::$user->config->database->name = static::config()->db['database_name'];
     static::$user->start();
     require 'app/config/mail.php';
     static::$mail->isSMTP();
     static::$mail->Host = $mail['Host'];
     static::$mail->SMTPAuth = $mail['SMTPAuth'];
     static::$mail->Username = $mail['Username'];
     static::$mail->Password = $mail['Password'];
     static::$mail->SMTPSecure = $mail['SMTPSecure'];
     static::$mail->Port = $mail['Port'];
     static::$mail->From = $mail['From'];
     static::$mail->FromName = $mail['FromName'];
     static::$mail->isHTML(true);
 }
Example #2
0
 /**
  * @return App Return a single instance of App
  */
 public static function app()
 {
     if (static::$app === null) {
         static::$app = new App(static::$configFile);
     }
     return static::$app;
 }
Example #3
0
 /**
  * Get the registered name of the component.
  *
  * @return string
  */
 protected static function getFacadeAccessor()
 {
     if (!static::$app) {
         static::$app = TruckerServiceProvider::make();
     }
     return 'trucker.model';
 }
Example #4
0
 /**
  * Retrieve Illuminage from the Container
  *
  * @return string
  */
 public static function getFacadeAccessor()
 {
     if (!static::$app) {
         static::$app = IlluminageServiceProvider::make();
     }
     return 'illuminage';
 }
 /**
  * @param Config $config
  *
  * @return Application
  */
 public static function getInstance(Config $config)
 {
     if (static::$app === null) {
         static::$app = new static($config);
     }
     return static::$app;
 }
Example #6
0
 /**
  * Get the Application Instance
  * @return Kernel
  */
 public static function instance()
 {
     if (!static::$app instanceof Kernel) {
         static::$app = new Kernel();
     }
     return static::$app;
 }
Example #7
0
 /**
  * Create a new CabinetUpload instance.
  */
 public function __construct(array $attributes = array())
 {
     parent::__construct($attributes);
     if (!static::$app) {
         static::$app = app();
     }
 }
Example #8
0
 /**
  * Get the registered name of the component.
  *
  * @return string
  */
 protected static function getFacadeAccessor()
 {
     if (!static::$app) {
         static::$app = AcetoneServiceProvider::make();
     }
     return 'acetone.acetone';
 }
Example #9
0
 /**
  * Get the registered name of the component.
  *
  * @return string
  */
 protected static function getFacadeAccessor()
 {
     if (!static::$app) {
         static::$app = RocketeerServiceProvider::make();
     }
     return static::$accessor;
 }
Example #10
0
 /**
  * @return SeviceLocator
  */
 public static function app()
 {
     if (empty(static::$app)) {
         static::$app = new SeviceLocator(static::$config);
     }
     return static::$app;
 }
Example #11
0
 public static function getSlimApp()
 {
     if (!isset(static::$app)) {
         static::$app = $GLOBALS['app'];
     }
     return static::$app;
 }
Example #12
0
 /**
  * Get the registered component.
  *
  * @return string
  */
 protected static function getFacadeAccessor()
 {
     if (!static::$app) {
         static::$app = FormerServiceProvider::make();
     }
     return 'former';
 }
Example #13
0
 /**
  * App constructor
  */
 public function __construct()
 {
     if (empty(static::$app)) {
         static::$app = $this;
     }
     $this->setTimezone()->setErrorHandler()->addRegistry()->factory();
 }
 /**
  * Create a new Notification instance.
  *
  * @param Twig_Template $template The Twig template object to use to create this notification.
  * @todo Allow other content sources (string, database, etc)
  */
 public function __construct($template)
 {
     $this->template = $template;
     if (!static::$app) {
         static::$app = UserFrosting::getInstance();
     }
 }
Example #15
0
 /**
  * Returns singleton app.
  */
 public function app()
 {
     if (!isset(static::$app)) {
         static::$app = new static();
     }
     return static::$app;
 }
Example #16
0
 public function __construct()
 {
     /**
      * 实例化容器,并且保存在此载体中
      */
     if (empty(static::$app)) {
         static::$app = new Application();
     }
     /**
      * 通过反射获取所有父类,并且获取他们的类名,通过这些类名来形成构造函数
      * 比如当前类的构造函数为 $this->OBlood()
      * 切记:Application类不能继承此类
      */
     $reflectionClass = new \ReflectionClass($this);
     $constructs[] = $reflectionClass->getShortName();
     $parentClass = $reflectionClass->getParentClass();
     while ($parentClass != false) {
         $constructs[] = $parentClass->getShortName();
         $parentClass = $parentClass->getParentClass();
     }
     /**
      * 这里采用倒叙的方式来进行排列,
      * 主要是以顶级父类为最先执行,一次向下
      */
     rsort($constructs);
     foreach ($constructs as $construct) {
         if (method_exists($this, $construct)) {
             call_user_func_array([$this, $construct], func_get_args());
         }
     }
 }
Example #17
0
 /**
  * Application copy for non-static call
  * @return DfApp
  */
 public static function app()
 {
     if (static::$app === null) {
         static::$app = new DfApp();
     }
     return static::$app;
 }
Example #18
0
 public static function instance()
 {
     if (!static::$app) {
         static::$app = new self();
     }
     return self::$app;
 }
Example #19
0
 public function __construct($values = array())
 {
     parent::__construct();
     static::$app = $this;
     foreach ($values as $key => $value) {
         $this[$key] = $value;
     }
     Facade::setFacadeApplication($this);
     // register the configserviceprovider so we can access the config
     $this->register(new ConfigServiceProvider());
     // grab the providers from the config and load them
     $providers = $this['config']->get('app/providers');
     foreach ($providers as $provider) {
         $this->register(new $provider());
     }
     // set the locale (https://github.com/silexphp/Silex/issues/983)
     $locale = $values['locale'];
     if ($this['translator']) {
         $this['translator']->setlocale($locale);
     }
     // register fieldtypes from config
     $fieldTypesConfig = $this['config']->get('fieldtypes');
     if ($fieldTypesConfig) {
         $this['fieldtypes'] = $this['fieldtypes.factory']->fromConfig($fieldTypesConfig);
     }
     // register contenttypes from config
     $contentTypeConfig = $this['config']->get('contenttypes');
     if ($contentTypeConfig) {
         $this['contenttypes'] = $this['contenttypes.factory']->fromConfig($contentTypeConfig);
     }
 }
 /**
  * Creates a new instance of the model
  */
 public function __construct(array $attributes = array())
 {
     parent::__construct($attributes);
     if (!static::$app) {
         static::$app = app();
     }
     $this->table = static::$app['config']->get('workflow::resourcenode_table');
 }
Example #21
0
 /**
  * Create a new AdministratorModel instance.
  */
 public function __construct(array $attributes = array())
 {
     parent::__construct($attributes);
     if (!static::$app) {
         static::$app = app();
     }
     $this->table = 'cb_administrators';
 }
Example #22
0
 /**
  * Create a new ConfideUser instance.
  */
 public function __construct(array $attributes = array())
 {
     parent::__construct($attributes);
     if (!static::$app) {
         static::$app = app();
     }
     $this->table = static::$app['config']->get('auth.table');
 }
 public static function setUpBeforeClass()
 {
     $test = new static();
     static::$app = $app = $test->createApplication();
     $app->register(DuctibleServiceProvider::class);
     static::$ductible = $app->make('ductible');
     $response = static::$ductible->index(['id' => 1, 'index' => 'ductible_search', 'type' => 'ductible_search', 'body' => ['text' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatibus reiciendis nisi, sed explicabo maxime rem consectetur incidunt perspiciatis, quibusdam deleniti iste quod, qui quasi eveniet ab. Ipsa at corporis blanditiis.', 'tag' => 'wow', 'much' => 'doge']]);
 }
Example #24
0
 /**
  * Get the registered component.
  *
  * @return object
  */
 protected static function getFacadeAccessor()
 {
     // If the app does not exist, get one with FilterServiceProvider booted
     if (!static::$app) {
         static::$app = FilterServiceProvider::make();
     }
     return 'filter';
 }
Example #25
0
 public function bootstrap()
 {
     static::$app = $this;
     $this->setAutoloader();
     $this->configuration();
     $this->dbconnect();
     $this->createSessions();
     $this->setSlim();
 }
Example #26
0
 /**
  * Get the registered component.
  *
  * @return string
  */
 protected static function getFacadeAccessor()
 {
     if (!static::$app) {
         static::$app = new Container();
         $provider = new FlattenServiceProvider(static::$app);
         $provider->register();
     }
     return 'flatten';
 }
 protected static function getFacadeAccessor()
 {
     if (!static::$app) {
         static::$app = new Container();
         $provider = new JscssboosterServiceProvider(static::$app);
         $provider->register();
     }
     return "Jscssbooster";
 }
Example #28
0
 /**
  * Create a new object, initializing the table name and whitelisted columns.
  *
  */
 public function __construct($properties = [])
 {
     $table_schema = Database::getSchemaTable(static::$_table_id);
     $this->table = $table_schema->name;
     $this->fillable = $table_schema->columns;
     if (!static::$app) {
         static::$app = UserFrosting::getInstance();
     }
     parent::__construct($properties);
 }
Example #29
0
 /**
  * @return string
  */
 protected static function getFacadeAccessor()
 {
     if (!static::$app) {
         $container = new Container();
         $provider = new GitHookServiceProvider($container);
         $provider->boot();
         static::$app = $container;
     }
     return static::$accessor;
 }
 public static function onWorkerStart($worker)
 {
     foreach (spl_autoload_functions() as $function) {
         spl_autoload_unregister($function);
     }
     static::$server = $worker;
     require static::$root_dir . '/bootstrap/autoload.php';
     static::$app = static::getApp();
     static::$kernel = static::$app->make(\Illuminate\Contracts\Http\Kernel::class);
 }