-
Notifications
You must be signed in to change notification settings - Fork 1
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
Fariz Luqman
committed
Jul 10, 2016
1 parent
618ae1e
commit b52984f
Showing
10 changed files
with
255 additions
and
27 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Windows image file caches | ||
Thumbs.db | ||
ehthumbs.db | ||
|
||
# Folder config file | ||
Desktop.ini | ||
|
||
# Recycle Bin used on file shares | ||
$RECYCLE.BIN/ | ||
|
||
# Windows Installer files | ||
*.cab | ||
*.msi | ||
*.msm | ||
*.msp | ||
|
||
# Windows shortcuts | ||
*.lnk | ||
|
||
# ========================= | ||
# Operating System Files | ||
# ========================= | ||
|
||
# OSX | ||
# ========================= | ||
|
||
.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
||
# Thumbnails | ||
._* | ||
|
||
# Files that might appear in the root of a volume | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
|
||
# Directories potentially created on remote AFP share | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk |
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 |
---|---|---|
|
@@ -26,7 +26,7 @@ | |
* @author Studio Nexus <[email protected]> | ||
* @copyright 2016 Studio Nexus | ||
* @license MIT | ||
* @version Release: 0.1.0 | ||
* @version Release: 0.1.1 | ||
* @link https://www.studionexus.co/php/damnstupidsimple | ||
*/ | ||
namespace Core; | ||
|
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 |
---|---|---|
|
@@ -26,7 +26,7 @@ | |
* @author Studio Nexus <[email protected]> | ||
* @copyright 2016 Studio Nexus | ||
* @license MIT | ||
* @version Release: 0.1.0 | ||
* @version Release: 0.1.1 | ||
* @link https://www.studionexus.co/php/damnstupidsimple | ||
*/ | ||
namespace Core; | ||
|
@@ -73,7 +73,7 @@ class Cache { | |
static function init(){ | ||
|
||
if(self::$config === null){ | ||
self::$config = require_once(DSS_PATH.'config/cache.php'); | ||
self::$config = Config::get('cache'); | ||
} | ||
|
||
if(self::$config['enabled'] === true){ | ||
|
@@ -98,4 +98,4 @@ static function clean(){ | |
CacheManager::clean(); | ||
} | ||
|
||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,109 @@ | ||
<?php | ||
/** | ||
* Damn Stupid Simple - A PHP Framework For Lazy Developers | ||
* | ||
* Copyright (c) 2016 Studio Nexus | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a | ||
* copy of this software and associated documentation files (the "Software"), | ||
* to deal in the Software without restriction, including without limitation | ||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
* and/or sell copies of the Software, and to permit persons to whom the | ||
* Software is furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included | ||
* in all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | ||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
* | ||
* @package Damn Stupid Simple | ||
* @author Studio Nexus <[email protected]> | ||
* @copyright 2016 Studio Nexus | ||
* @license MIT | ||
* @version Release: 0.1.1 | ||
* @link https://www.studionexus.co/php/damnstupidsimple | ||
*/ | ||
namespace Core; | ||
|
||
/** | ||
* The Configuration Loader | ||
* ----------------------------------------------------------------------- | ||
* | ||
* The Configuration loader are responsible to read and return the | ||
* configurations in a form of array. | ||
* | ||
* Usage: | ||
* 1. Get the entire configuration from a file: | ||
* $config = Config::get('filename'); | ||
* | ||
* 2. Get specific configuration from a file: | ||
* $config = Config::get('filename', 'configuration_key'); | ||
* | ||
*/ | ||
class Config { | ||
|
||
/** | ||
* The array of configuration from config/env.php | ||
* @var array | ||
* @access protected | ||
* @static | ||
*/ | ||
protected static $env = null; | ||
|
||
/** | ||
* The array of configuration from files located on config directory | ||
* @var array | ||
* @access protected | ||
* @static | ||
*/ | ||
protected static $hive = null; | ||
|
||
/** | ||
* Link a variable or an object to the container | ||
* | ||
* @param string $file the configuration file name (without .php) | ||
* @param string $key the array key | ||
* | ||
* @return array $hive the array of configurations | ||
* | ||
* @static | ||
* @access public | ||
* @since Method available since 0.1.1 | ||
*/ | ||
public static function get($file, $key = null){ | ||
if(isset(self::$hive[$file]) === false){ | ||
self::$hive[$file] = include_once(DSS_PATH.'config/'.$file.'.php'); | ||
} | ||
|
||
if($key === null){ | ||
return self::$hive[$file]; | ||
}else{ | ||
return self::$hive[$file][$key]; | ||
} | ||
} | ||
|
||
/** | ||
* Reads the configuration file (config/env.php) and include each of the | ||
* variables (retrieved in a form of associative array) to the Environment | ||
* Variable. Also store the configurations into static variable $env | ||
* | ||
* @static | ||
* @access public | ||
* @since Method available since Release 0.1.1 | ||
*/ | ||
public static function setEnv(){ | ||
if(self::$env === null){ | ||
self::$env = require_once(DSS_PATH.'config/env.php'); | ||
} | ||
|
||
foreach(self::$env as $v => $a){ | ||
putenv($v.'='.$a); | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -26,7 +26,7 @@ | |
* @author Studio Nexus <[email protected]> | ||
* @copyright 2016 Studio Nexus | ||
* @license MIT | ||
* @version Release: 0.1.0 | ||
* @version Release: 0.1.1 | ||
* @link https://www.studionexus.co/php/damnstupidsimple | ||
*/ | ||
namespace Core; | ||
|
@@ -55,10 +55,10 @@ class Database extends Capsule{ | |
* @access public | ||
* @since Method available since Release 0.1.0 | ||
*/ | ||
static function connect(){ | ||
public static function connect(){ | ||
|
||
if(self::$config === null){ | ||
self::$config = include(DSS_PATH.'config/database.php'); | ||
self::$config = Config::get('database'); | ||
} | ||
|
||
if(self::$config['enabled'] === true){ | ||
|
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 |
---|---|---|
|
@@ -26,7 +26,7 @@ | |
* @author Studio Nexus <[email protected]> | ||
* @copyright 2016 Studio Nexus | ||
* @license MIT | ||
* @version Release: 0.1.0 | ||
* @version Release: 0.1.1 | ||
* @link https://www.studionexus.co/php/damnstupidsimple | ||
*/ | ||
namespace Core; | ||
|
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 |
---|---|---|
@@ -0,0 +1,88 @@ | ||
<?php | ||
/** | ||
* Damn Stupid Simple - A PHP Framework For Lazy Developers | ||
* | ||
* Copyright (c) 2016 Studio Nexus | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a | ||
* copy of this software and associated documentation files (the "Software"), | ||
* to deal in the Software without restriction, including without limitation | ||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
* and/or sell copies of the Software, and to permit persons to whom the | ||
* Software is furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included | ||
* in all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | ||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
* | ||
* @package Damn Stupid Simple | ||
* @author Studio Nexus <[email protected]> | ||
* @copyright 2016 Studio Nexus | ||
* @license MIT | ||
* @version Release: 0.1.1 | ||
* @link https://www.studionexus.co/php/damnstupidsimple | ||
*/ | ||
namespace Core; | ||
|
||
/** | ||
* The Singleton | ||
* ----------------------------------------------------------------------- | ||
* | ||
* Simply extends this Singleton class if you wish to use the Singleton | ||
* pattern of programming in your project | ||
* | ||
*/ | ||
class Singleton { | ||
private static $instances = array(); | ||
|
||
/** | ||
* Constructor method | ||
* | ||
* @access protected | ||
* @since Method available since Release 0.1.1 | ||
*/ | ||
protected function __construct() { | ||
// | ||
} | ||
|
||
/** | ||
* Avoid cloning | ||
* | ||
* @access protected | ||
* @since Method available since Release 0.1.1 | ||
*/ | ||
protected function __clone() { | ||
// | ||
} | ||
|
||
/** | ||
* Avoid unserialization | ||
* | ||
* @access public | ||
* @since Method available since Release 0.1.1 | ||
*/ | ||
public function __wakeup(){ | ||
throw new Exception("Cannot unserialize singleton"); | ||
} | ||
|
||
/** | ||
* Get the instance of desired class | ||
* | ||
* @access public | ||
* @since Method available since Release 0.1.1 | ||
*/ | ||
public static function getInstance(){ | ||
$class = get_called_class(); // late-static-bound class name | ||
if (!isset(self::$instances[$class])) { | ||
self::$instances[$class] = new static; | ||
} | ||
return self::$instances[$class]; | ||
} | ||
} |
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 |
---|---|---|
|
@@ -26,7 +26,7 @@ | |
* @author Studio Nexus <[email protected]> | ||
* @copyright 2016 Studio Nexus | ||
* @license MIT | ||
* @version Release: 0.1.0 | ||
* @version Release: 0.1.1 | ||
* @link https://www.studionexus.co/php/damnstupidsimple | ||
*/ | ||
namespace Core; | ||
|