Exemplo n.º 1
0
 /**
  * Dispense logger with config
  *
  * @param string $key Default key is "log"
  * @return Logger
  */
 public static function with($key = 'log')
 {
     if (empty(self::$instances[$key])) {
         self::$instances[$key] = new self(App::self()->get($key));
     }
     return self::$instances[$key];
 }
Exemplo n.º 2
0
/**
 * Compile template
 *
 * @param string $path
 * @param array  $data
 * @param array  $options
 * @return \Pagon\View
 */
function compile($path, array $data = null, array $options = array())
{
    return App::self()->output->compile($path, $data, $options);
}
Exemplo n.º 3
0
 /**
  * Init
  *
  * @param array $injectors
  */
 public function __construct(array $injectors = array())
 {
     // Auto global
     if (!isset($injectors['global'])) {
         $injectors['global'] = PHP_SAPI === 'CLI' ? false : true;
     }
     parent::__construct($injectors + $this->injectors);
     // Use default store is not set
     if (self::$defaultStore && $this->injectors['store'] === null) {
         $this->injectors['store'] = self::$defaultStore;
     }
     // If store is config, create store
     if ($this->injectors['store'] && !$this->injectors['store'] instanceof Store) {
         $this->injectors['store'] = Store::create($this->injectors['store']);
         // Set default store if not exists
         if (!self::$defaultStore) {
             self::$defaultStore = $this->injectors['store'];
         }
     }
     // If not app inject, use default
     if (!$this->injectors['app']) {
         $this->injectors['app'] = App::self();
     }
 }
Exemplo n.º 4
0
 /**
  * Get current encoding
  *
  * @return mixed
  */
 protected static function charset()
 {
     return static::$charset ?: (static::$charset = App::self()->get('charset'));
 }
Exemplo n.º 5
0
 public function isSuperAdmin()
 {
     return ($admins = App::self()->get('admins')) ? in_array($this->name, $admins) : false;
 }