-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
1,203 additions
and
1,196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,35 @@ | ||
<?php | ||
abstract class BaseCache { | ||
protected static $adapters = null; | ||
private static $_defaults = [ | ||
'adapter'=>'files', | ||
'options'=>[ | ||
'live'=>3600, | ||
'path'=>'/tmp/cache/' | ||
] | ||
]; | ||
private static $_convention = 'Storage'; | ||
public static function factory($config=null){ | ||
static::$_defaults['options']['path'] = $GLOBALS['APP_DIR'].static::$_defaults['options']['path']; | ||
$options = static::$_defaults['options']; | ||
$adapter_name = static::$_defaults['adapter']; | ||
if(is_string($config)) { | ||
$adapter_name = $config; | ||
} | ||
if(is_array($config)){ | ||
$adapter_name = isset($config['adapter']) ? $config['adapter'] : $adapter_name; | ||
$options = isset($config['options']) ? array_merge($options, $config['options']) : $options; | ||
} | ||
if ($adapter_name=='') { | ||
die('Missing adapter'); | ||
} | ||
if (static::$adapters === null) { | ||
$_n = static::$_convention.ucfirst($adapter_name); | ||
static::$adapters = new $_n($options); | ||
} | ||
return static::$adapters; | ||
} | ||
protected static $adapters = null; | ||
private static $_defaults = [ | ||
'adapter'=>'files', | ||
'options'=>[ | ||
'live'=>3600, | ||
'path'=>'/tmp/cache/' | ||
] | ||
]; | ||
private static $_convention = 'Storage'; | ||
public static function factory($config=null){ | ||
static::$_defaults['options']['path'] = $GLOBALS['APP_DIR'].static::$_defaults['options']['path']; | ||
$options = static::$_defaults['options']; | ||
$adapter_name = static::$_defaults['adapter']; | ||
if(is_string($config)) { | ||
$adapter_name = $config; | ||
} | ||
if(is_array($config)){ | ||
$adapter_name = isset($config['adapter']) ? $config['adapter'] : $adapter_name; | ||
$options = isset($config['options']) ? array_merge($options, $config['options']) : $options; | ||
} | ||
if ($adapter_name=='') { | ||
die('Missing adapter'); | ||
} | ||
if (static::$adapters === null) { | ||
$_n = static::$_convention.ucfirst($adapter_name); | ||
static::$adapters = new $_n($options); | ||
} | ||
return static::$adapters; | ||
} | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,56 @@ | ||
<?php | ||
class BaseController { | ||
public $db; | ||
public $view; | ||
public $params; | ||
public $resource; | ||
public $i18n; | ||
private $_render_layout = true; | ||
private $_render_action = true; | ||
public function __construct(Resource &$resource) { | ||
$this->resource = $resource; | ||
public $db; | ||
public $view; | ||
public $params; | ||
public $resource; | ||
public $i18n; | ||
private $_render_layout = true; | ||
private $_render_action = true; | ||
public function __construct(Resource &$resource) { | ||
$this->resource = $resource; | ||
|
||
//aliases | ||
$this->db = $resource->connect; | ||
$this->params = $resource->router->params; | ||
$this->view = $resource->view; | ||
if($resource->i18n){ | ||
$this->i18n = $resource->i18n->strings; | ||
} | ||
if($resource->helpers){ | ||
$this->helpers = $resource->helpers; | ||
} | ||
//aliases | ||
$this->db = $resource->connect; | ||
$this->params = $resource->router->params; | ||
$this->view = $resource->view; | ||
if($resource->i18n){ | ||
$this->i18n = $resource->i18n->strings; | ||
} | ||
if($resource->helpers){ | ||
$this->helpers = $resource->helpers; | ||
} | ||
|
||
$this->call_init(); | ||
return $this; | ||
} | ||
|
||
protected function call_init(){ | ||
if(method_exists($this, 'init')){ | ||
$this->init(); | ||
} | ||
$this->call_init(); | ||
return $this; | ||
} | ||
|
||
protected function call_init(){ | ||
if(method_exists($this, 'init')){ | ||
$this->init(); | ||
} | ||
|
||
protected function set_db(&$db){ | ||
$this->db = $db; | ||
} | ||
|
||
public function set_render_layout($flag=true){ | ||
$this->_render_layout = $flag; | ||
} | ||
|
||
public function get_render_layout(){ | ||
return $this->_render_layout; | ||
} | ||
|
||
public function set_render_action($flag=true){ | ||
$this->_render_action = $flag; | ||
} | ||
|
||
public function get_render_action(){ | ||
return $this->_render_action; | ||
} | ||
} | ||
|
||
protected function set_db(&$db){ | ||
$this->db = $db; | ||
} | ||
|
||
public function set_render_layout($flag=true){ | ||
$this->_render_layout = $flag; | ||
} | ||
|
||
public function get_render_layout(){ | ||
return $this->_render_layout; | ||
} | ||
|
||
public function set_render_action($flag=true){ | ||
$this->_render_action = $flag; | ||
} | ||
|
||
public function get_render_action(){ | ||
return $this->_render_action; | ||
} | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
<?php | ||
class BaseHelpers { | ||
|
||
} | ||
class BaseHelpers {} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,17 @@ | ||
<?php | ||
class BaseJob { | ||
public static $_db_di=null; | ||
protected $_db; | ||
|
||
public function __construct() { | ||
if(self::$_db_di!=null) | ||
$this->_db = self::$_db_di; | ||
if(method_exists($this, 'init')){ | ||
$this->init(); | ||
} | ||
return $this; | ||
} | ||
public static $_db_di=null; | ||
protected $_db; | ||
|
||
public function __construct() { | ||
if(self::$_db_di!=null){ | ||
$this->_db = self::$_db_di; | ||
} | ||
if(method_exists($this, 'init')){ | ||
$this->init(); | ||
} | ||
return $this; | ||
} | ||
} | ||
|
||
?> |
Oops, something went wrong.