コード例 #1
0
ファイル: Action.php プロジェクト: sketchmedia/sketchguild
 public function __construct()
 {
     if (!class_exists('Sighhat\\Config')) {
         throw new \InvalidArgumentException('Cannot locate Config class');
     }
     if (!class_exists('Sighhat\\Controller\\Request')) {
         throw new \InvalidArgumentException('Cannot locate Request class');
     }
     if (!class_exists('Sighhat\\Controller\\Response')) {
         throw new \InvalidArgumentException('Cannot locate Response class');
     }
     if (!class_exists('Sighhat\\View\\Base')) {
         throw new \InvalidArgumentException('Cannot locate View class');
     }
     $this->request = $this->asShared(function ($this) {
         return Request::Instance();
     });
     $this->response = $this->asShared(function ($this) {
         return Response::Instance();
     });
     $this->config = $this->asShared(function ($this) {
         return Config::Instance();
     });
     $this->view = $this->asShared(function ($this) {
         return new View(new DIView());
     });
     $this->cache = $this->asShared(function ($this) {
         return Cache::Instance();
     });
     $this->router = $this->asShared(function ($this) {
         return Router::Instance();
     });
 }
コード例 #2
0
ファイル: Base.php プロジェクト: sketchmedia/sketchguild
 public function __construct($sUsername, $sPassword)
 {
     $this->sIdentity = $sUsername;
     $this->sCredentials = $sPassword;
     $cfg = \Sighhat\Config::Instance()->get('auth');
     $this->sIdentityColumn = $cfg['identityColumn'];
     $this->sCredentialColoumn = $cfg['credentialColumn'];
 }
コード例 #3
0
ファイル: DB.php プロジェクト: sketchmedia/sketchguild
 public function __construct($username, $password)
 {
     $cfg = \Sighhat\Config::Instance()->get('auth');
     if (!($this->sAuthTable = $cfg['table'])) {
         throw new \Sighhat\Exception('No auth table set in the config, expecting auth.table');
     }
     parent::__construct($username, $password);
 }
コード例 #4
0
ファイル: Base.php プロジェクト: sketchmedia/sketchguild
 public static function clearIdentity()
 {
     self::$Identity = false;
     $cfg = \Sighhat\Config::Instance()->get('session');
     $session = new Session($cfg['name']);
     $session->auth->identity = false;
     unset($session->auth);
 }
コード例 #5
0
ファイル: Cache.php プロジェクト: sketchmedia/sketchguild
 public function __construct()
 {
     if (!class_exists('Sighhat\\Config')) {
         throw new \Exception('Cannot locate Config class');
     }
     $this->config = $this->asShared(function ($this) {
         return Config::Instance();
     });
 }
コード例 #6
0
ファイル: File.php プロジェクト: sketchmedia/sketchguild
 public function __construct()
 {
     $cfg = \Sighhat\Config::Instance();
     if (!($this->cacheDir = $cfg->get('cache_dir'))) {
         throw new \Exception('No cache directory specified in config');
     }
     if (!file_exists($this->cacheDir)) {
         throw new \Exception('Cache directory doesnt exist or isnt writable');
     }
 }
コード例 #7
0
ファイル: Router.php プロジェクト: sketchmedia/sketchguild
 public function __construct()
 {
     if (!class_exists('Sighhat\\Config')) {
         throw new \InvalidArgumentException('Cannot locate Config class');
     }
     if (!class_exists('Sighhat\\Controller\\Request')) {
         throw new \InvalidArgumentException('Cannot locate Request class');
     }
     $this->config = \Sighhat\Config::Instance();
     $this->request = \Sighhat\Controller\Request::Instance();
 }
コード例 #8
0
ファイル: Model.php プロジェクト: sketchmedia/sketchguild
 public final function __construct($stuff = null)
 {
     $this->config = Config::Instance();
     $connect = $this->db ? true : false;
     $this->db = Db::Instance();
     if ($connect) {
         $this->db = $this->db->connect();
     }
     $sessioncfg = $this->config->get('session');
     if ($this->session) {
         $this->session = new \Sighhat\Session\Named($sessioncfg['name']);
     }
     if (method_exists($this, 'init')) {
         $this->init($stuff);
     }
 }
コード例 #9
0
ファイル: Db.php プロジェクト: sketchmedia/sketchguild
 public function __construct()
 {
     if (!class_exists('Sighhat\\Config')) {
         throw new \InvalidArgumentException('Cannot locate Config class');
     }
     $this->config = $this->asShared(function ($this) {
         return Config::Instance()->get('database');
     });
     $this->server = $this->config['server'];
     $this->username = $this->config['user'];
     $this->password = $this->config['password'];
     $this->schema = $this->config['schema'];
     $this->adapter = 'adapt_' . $this->config['adapter'];
     $this->port = ($r = isset($this->config['port'])) ? $r : ini_get('mysqli.default_port');
     $this->socket = ($r = isset($this->config['socket'])) ? $r : ini_get('mysqli.default_socket');
 }
コード例 #10
0
ファイル: Bootstrap.php プロジェクト: sketchmedia/sketchguild
<?php

include LIB_PATH . 'Sighhat/Includes.php';
include 'Includes.php';
use Sighhat\Cache\Base as Cache, Sighhat\Error, Sighhat\Config, Sighhat\Session\Base as Session, Sighhat\Cache\Container\Cache as DICache, Sighhat\Session\Container\Base as DISession, Sighhat\Db\Base as Db, Sighhat\Db\Container\Db as DIDb;
error_reporting(E_ALL | E_STRICT);
function exception_error_handler($errno, $errstr, $errfile, $errline)
{
    ob_clean();
    Error::handle(new Exception($errstr));
}
//set_error_handler("exception_error_handler");
define('CSS_VERSION', 1);
define('JS_VERSION', 1);
define('DEV_ENV', 'development');
define('PROD_ENV', 'production');
define('STAGE_ENV', 'stage');
define('CLI', false);
define('ERROR_LOG', true);
//define('ENV', DEV_ENV);// Dev/Prod switch, pref in apache vhost tbh
Config::Instance(include 'Config.php');
Session::Start(new DISession());
Cache::Instance(new DICache());
Db::Instance(new DIDb());
コード例 #11
0
ファイル: Base.php プロジェクト: sketchmedia/sketchguild
 public function parse()
 {
     $cfg = \Sighhat\Config::Instance()->get('external_data');
     $limit = $cfg['feed_item_limit'];
     return new FeedObject($this->meta, $this->items, $limit);
 }