Example #1
0
 public function hasRoute($route, $key = null)
 {
     if (\Configuration::has('admin_routes')) {
         $routes = \Admin::routes();
         // limit the search to a particular route group
         if (isset($key)) {
             try {
                 $routes = $routes[$key];
                 foreach ($routes as $k => $r) {
                     if (array_key_exists($route, $r)) {
                         return true;
                     }
                 }
             } catch (\ErrorException $e) {
                 // try general execution
             }
         }
         // general execution
         if (isset($routes)) {
             foreach ($routes as $k => $r) {
                 foreach ($r as $key => $foundRoute) {
                     if (array_key_exists($route, $foundRoute)) {
                         return true;
                     }
                 }
             }
         }
     }
     return false;
 }
 /**
  * Bootstrap the application services.
  *
  * @return void
  */
 public function boot()
 {
     if (\Schema::hasTable('config')) {
         if (!\Configuration::has('app_name')) {
             \Configuration::set('app_name', env('APP_NAME'));
         }
     }
 }
 /**
  * Register the application services.
  *
  * @return void
  */
 public function register()
 {
     \App::bind('admin', function () {
         // set debug mode!
         if (!\Configuration::has('debug')) {
             \Configuration::set('debug', true);
         }
         return new \App\Classes\Admin();
     });
 }
Example #4
0
 /**
  * Handle a formatted log message.
  * <p>If logfile is defined, then that file is appended.  Otherwise,
  * the PHP system logging mechanism is used.
  * @param string $message Formatted log message to handle.
  */
 function handle($message)
 {
     // notice that error_log() is not preferred because apache munges
     // the log output and makes any formatted message with a newline
     // practically unreadable.
     if ($this->config->has('message-handler')) {
         $mh = $this->config->get('message-handler');
         if (function_exists($mh)) {
             $mh($message);
         } else {
             error_log("Invalid message handler {$mh}\n" . "unhandled message: {$message}");
         }
     } elseif ($this->config->has('logfile')) {
         $this->openLogFile();
         fwrite($this->logfile, $message);
     } else {
         error_log($message);
     }
 }