diff --git a/src/classes/Config/Engine.class.php b/src/classes/Config/Engine.class.php new file mode 100644 index 0000000..9c1168b --- /dev/null +++ b/src/classes/Config/Engine.class.php @@ -0,0 +1,34 @@ +init(); + } + +} + +/** @} */ + +?> diff --git a/src/classes/Config/Engine/Ini.class.php b/src/classes/Config/Engine/Ini.class.php new file mode 100644 index 0000000..73b4979 --- /dev/null +++ b/src/classes/Config/Engine/Ini.class.php @@ -0,0 +1,97 @@ +_config = array(); + $this->_filename = ""; + if (defined('CONFIG_INI')) + $this->load(CONFIG_INI); + } + + public static function instance() { + if (!self::$_instance) + self::$_instance = new Config_Engine_Ini(); + return (self::$_instance); + } + + public function load($cfg_identifier) { + if (!is_file($cfg_identifier)) + throw new RuntimeException('invalid config identifier'); + $process_sections = true; + $this->_config = parse_ini_file($cfg_identifier, $process_sections); + $this->_filename = $cfg_identifier; + } + + /** + * @todo implement this + */ + public function save() { + + } + + /** + * @brief returns given key within given section + * @param group - ini section where to load given key + * @param key - key to retrieve + * @return mixed - given key value within given section + */ + public function getkey($group, $key) { + if (!array_key_exists($group, $this->_config)) + return (array()); + if (!array_key_exists($key, $this->_config[$group])) + return (array()); + return ($this->_config[$group][$key]); + } + + /** + * @todo implement this + */ + public function setkey($group, $key, $val) { + + } + + /** + * @brief returns currently loaded config as an array + * @return array - associative array representing loaded ini file + */ + public function get() { + return ($this->_config); + } + + /** + * @brief get given ini section, as an array + * @param $group string - ini section to load + * @return array - loaded section as an associative array + */ + public function getGroup($group) { + if (!array_key_exists($group, $this->_config)) + return (array()); + return ($this->_config[$group]); + } + +} + +/** @} */ + +?> diff --git a/src/classes/Config/Engine/Xml.class.php b/src/classes/Config/Engine/Xml.class.php new file mode 100644 index 0000000..3037585 --- /dev/null +++ b/src/classes/Config/Engine/Xml.class.php @@ -0,0 +1,64 @@ + diff --git a/src/config/.gitkeep b/src/config/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src/pic/index.php b/src/htdocs/pic/index.php similarity index 100% rename from src/pic/index.php rename to src/htdocs/pic/index.php diff --git a/src/pic/uuid_zero.jpeg b/src/htdocs/pic/uuid_zero.jpeg similarity index 100% rename from src/pic/uuid_zero.jpeg rename to src/htdocs/pic/uuid_zero.jpeg diff --git a/src/interfaces/IConfigEngine.interface.php b/src/interfaces/IConfigEngine.interface.php new file mode 100644 index 0000000..a292a9a --- /dev/null +++ b/src/interfaces/IConfigEngine.interface.php @@ -0,0 +1,24 @@ + diff --git a/src/test.php b/src/test.php index dbd386e..49b4ef1 100644 --- a/src/test.php +++ b/src/test.php @@ -6,7 +6,13 @@ */ require_once('bootstrap.php'); +$cfg = Config_Engine_Ini::instance(); +// ... + $viewer = WebAsset_Viewer::instance(); // ... +$asset = new WebAsset(); +// ... + ?> diff --git a/src/tmp/cache/.gitkeep b/src/tmp/cache/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src/tmp/logs/.gitkeep b/src/tmp/logs/.gitkeep new file mode 100644 index 0000000..e69de29