SATOKO_ROOT_DIRECTORY. self::getConfig('path', 'cache') // Set cache directory )); // Load String template loader self::$_ENG->addExtension(new \Twig_Extension_StringLoader()); } // Parse .cfg files public static function parseCfg($data) { // Create storage variable $out = array(); // Remove comments and empty lines $data = preg_replace('/#.*?\r\n/im', null, $data); $data = preg_replace('/^\r\n/im', null, $data); // Break line breaks up into array values $data = str_replace("\r\n", "\n", $data); $data = explode("\n", $data); foreach($data as $var) { // Make sure no whitespaces escaped the check if(empty($var)) continue; // Remove whitespace between key, equals sign and value $var = preg_replace('/[\s+]=[\s+]/i', '=', $var); // Then break this up $var = explode('=', $var); // And assign the value with the key to the output variable $out[$var[0]] = $var[1]; } // Return the output variable return $out; } // Render template public static function render($file, $tags) { return self::$_ENG->render($file, $tags); } }