public static function init(array $initArgs = array())
    {
        if (!self::$_initiated) {
            if (!defined('XIPHE_HTML_BASE_FOLDER')) {
                define('XIPHE_HTML_BASE_FOLDER', dirname(__DIR__).DIRECTORY_SEPARATOR);
            }

            foreach (self::getThemasterSettings() as $key => $s) {
                if (is_array($s) && isset($s['default'])) {
                    self::$_defaults[$key] = $s['default'];
                }
            }

            /*
             * Get the config array from config.php
             */
            $config = array();
            if (file_exists(XIPHE_HTML_BASE_FOLDER.'config.php')) {
                call_user_func(
                    function () use (&$config) {
                        include XIPHE_HTML_BASE_FOLDER.'config.php';
                    }
                );
            } elseif(!file_exists(XIPHE_HTML_BASE_FOLDER.'config-sample.php')) {
                self::_createSampleConfig();
            }

            /*
             * Make sure config is an array.
             */
            if (!is_array($config)) {
                Generator::debug('$config is not an array.', 3, 7);
                $config = array();
            }

            /*
             * Merge it into the defaults
             */
            $defaults = array_merge(self::$_defaults, $config);

            /*
             * Remove invalid keys and merge the initArgs.
             */
            foreach (self::$_defaults as $k => $v) {
                self::$_config[$k] = (isset($initArgs[$k]) ? $initArgs[$k] : $defaults[$k]);
            }

            self::$_initiated = true;
        }
    }