Exemplo n.º 1
0
 /**
  * Retrieve the assets for a fieldset
  * @return array
  */
 public static function assets()
 {
     if (is_array(static::$assets)) {
         static::$assets = new Assets\Bundle(static::$assets);
     }
     return static::$assets;
 }
Exemplo n.º 2
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);
 }
Exemplo n.º 3
0
 public static function run($config)
 {
     if (isset($config['db'])) {
         if (isset($config['db']['username'])) {
             static::$db = new DB($config['db']['dsn'], $config['db']['username'], $config['db']['password']);
         } else {
             static::$db = new DB($config['db']['dsn']);
         }
     }
     static::$assets = new Assets(isset($config['assets']) ? $config['assets'] : []);
     static::$user = new User();
     static::$url = new Url();
     static::$request = new Request();
     static::$session = new Session();
     static::$helper = new Helper();
     static::$params = $config['params'];
     $url = str_replace(static::$url->path(), '', $_SERVER['REQUEST_URI']);
     $options = isset($config['route']) ? $config['route'] : [];
     static::$route = new Route($url, $options);
     static::$route->run();
 }
Exemplo n.º 4
0
 public static function assets(array $assets)
 {
     static::$assets = $assets;
 }