Esempio n. 1
0
 /**
  * Loads the defined Filters into the Twig Environment
  */
 private static function twigFilters()
 {
     $filters = Config::twig('filters');
     foreach ($filters as $name => $callable) {
         self::$_twig->addFilter(new Twig_SimpleFilter($name, $callable));
     }
 }
Esempio n. 2
0
 public function __construct(Google_Client $client = null)
 {
     $this->client = $client;
     if ($this->client) {
         $this->client->setClientId(Config::extra('social.google.client_id'));
         $this->client->setClientSecret(Config::extra('social.google.client_secret'));
         $this->client->setRedirectUri(route('google'));
         $this->client->setScopes(Config::extra('social.google.scopes'));
     }
     $this->defaults = ['role' => 'normal', 'national_id' => '', 'pass' => 'nothing', 'active' => 1, 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()];
 }
Esempio n. 3
0
 public static function __callStatic($method, $args)
 {
     $registered = (include Config::container());
     if (in_array($method, array_keys($registered))) {
         if (is_callable($registered[$method])) {
             return call_user_func_array($registered[$method], $args);
         } else {
             return $registered[$method];
         }
     } else {
         throw new Exception("No registered method or object found", 1);
     }
 }
Esempio n. 4
0
 function __construct()
 {
     $fb = new Facebook(['app_id' => Config::extra('social.facebook.app_id'), 'app_secret' => Config::extra('social.facebook.app_secret'), 'default_graph_version' => Config::extra('social.facebook.default_graph_version')]);
     $this->helper = $fb->getRedirectLoginHelper();
 }
Esempio n. 5
0
 public static function app()
 {
     return Config::app('url.app');
 }
Esempio n. 6
0
 public function __construct()
 {
     $this->fb = new Facebook(['app_id' => Config::extra('social.facebook.app_id'), 'app_secret' => Config::extra('social.facebook.app_secret'), 'default_graph_version' => Config::extra('social.facebook.default_graph_version')]);
     $this->defaults = ['role' => 'normal', 'national_id' => '', 'pass' => 'nothing', 'active' => 1, 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()];
 }
Esempio n. 7
0
 public static function getHash()
 {
     return Session::get(Config::extra('session.remember_me'));
 }
Esempio n. 8
0
 public static function error($code)
 {
     if (is_numeric($code)) {
         $txt = '';
         switch ($code) {
             case 404:
                 // Page was not found:
                 header('HTTP/1.1 404 Not Found');
                 $txt = twig(Config::app('url.error.404'));
                 break;
             case 403:
                 // Access forbidden:
                 header('HTTP/1.1 403 Forbidden');
                 $txt = twig(Config::app('url.error.403'));
                 break;
             case 500:
                 // Server error
                 header('HTTP/1.1 500 Internal Server Error');
                 $txt = twig(Config::app('url.error.500'));
                 break;
             case 301:
                 // The page moved permanently should be used for
                 // all redrictions, because search engines know
                 // what's going on and can easily update their urls.
                 header('HTTP/1.1 301 Page Moved Permanently');
                 $txt = twig(Config::app('url.error.301'));
                 break;
             case 401:
                 header('HTTP/1.1 401 Unauthorized: Access is denied due to invalid credentials');
                 $txt = twig(Config::app('url.error.401'));
                 break;
         }
         die($txt);
     }
 }
Esempio n. 9
0
 /**
  * Build the database from the specified SQL file <code>dbfile</code> if the <code>dbrestore</code> flag is set
  * @return boolean
  */
 public function buildDB()
 {
     $filename = path("resources.databases") . "/" . Config::app('mysql>dbfile');
     $dbrestore = Config::app('mysql>dbrestore');
     $op_data = '';
     if (file_exists($filename) && $dbrestore === true) {
         $lines = file($filename);
         foreach ($lines as $line) {
             if (substr($line, 0, 2) == '--' || $line == '') {
                 //This IF Remove Comment Inside SQL FILE
                 continue;
             }
             $op_data .= $line;
             if (substr(trim($line), -1, 1) == ';') {
                 //Breack Line Upto ';' NEW QUERY
                 $this->exec($op_data);
                 $op_data = '';
             }
         }
         if ($this->isError()) {
             return false;
         } else {
             return true;
         }
     }
     return true;
 }
Esempio n. 10
0
 public function __destruct()
 {
     $app_middleware = Config::app('app_middleware');
     if (is_callable($app_middleware)) {
         return call_user_func($app_middleware, [$this, 'run']);
     } else {
         if (!empty($app_middleware) && is_string($app_middleware)) {
             $middleware = "App\\Http\\Middlewares\\{$app_middleware}Middleware";
             $middleware = new $middleware();
             return call_user_func([$middleware, 'control'], [$this, 'run']);
         } else {
             return $this->run();
         }
     }
 }