.gitignore000064400000000036144761607200006542 0ustar00/vendor/ /tests/ composer.lockREADME.md000064400000000013144761607200006024 0ustar00# dhsmarty composer.json000064400000000752144761607200007301 0ustar00{ "name": "boru/dhsmarty", "type": "library", "autoload": { "psr-4": { "boru\\dhsmarty\\": "src/" } }, "authors": [ { "name": "Daniel Hayes", "email": "dhayes@boruapps.com" } ], "require": { "boru/dhutils": ">=2.0.0", "smarty/smarty": "^3" }, "repositories": [ { "type": "composer", "url": "https://satis.boruapps.com" } ] } instructions-composer.txt000064400000000300144761607200011676 0ustar00{ "require": { "boru/dhapi": "*" }, "repositories": [ { "type": "composer", "url": "https://satis.boruapps.com" } ] }src/dhSmarty.php000064400000004737144761607200007661 0ustar00 __DIR__."/../work/templates", "configDir" => __DIR__."/../work/configs", "compileDir" => __DIR__."/../work/compiled", "cacheDir" => __DIR__."/../work/cache", "caching" => \Smarty::CACHING_OFF, ]; public static function get() { if(self::$smarty === null) { self::$smarty = self::createInstance(); } return self::$smarty; } public static function createInstance($options=[]) { $smarty = new \Smarty(); $smarty->setTemplateDir( isset($options["templateDir"]) ? $options["templateDir"] : static::$options["templateDir"]); $smarty->setConfigDir( isset($options["configDir"]) ? $options["configDir"] : static::$options["configDir"]); $smarty->setCompileDir( isset($options["compileDir"]) ? $options["compileDir"] : static::$options["compileDir"]); $smarty->setCacheDir( isset($options["cacheDir"]) ? $options["cacheDir"] : static::$options["cacheDir"]); $smarty->caching = isset($options["caching"]) ? $options["caching"] : static::$options["caching"]; if(($dir = dhGlobal::dirIfExists($smarty->getCompileDir(),false)) === false) { if(!mkdir($smarty->getCompileDir(),0777,true)) { throw new \Exception("Could not create compile dir: ".$smarty->getCompileDir()); } } else { if(!is_writable($smarty->getCompileDir())) { throw new \Exception("Compile dir is not writable: ".$smarty->getCompileDir()); } } if(($dir = dhGlobal::dirIfExists($smarty->getCacheDir(),false)) === false) { if(!mkdir($smarty->getCacheDir(),0777,true)) { throw new \Exception("Could not create cache dir: ".$smarty->getCompileDir()); } } else { if(!is_writable($smarty->getCacheDir())) { throw new \Exception("Cache dir is not writable: ".$smarty->getCacheDir()); } } } public static function setOption($option,$value=null) { if(is_array($option)) { foreach($option as $key=>$value) { static::$options[$key] = $value; } } else { static::$options[$option] = $value; } } }work/.htaccess000064400000000015144761607200007327 0ustar00Deny from allwork/cache/.htaccess000064400000000015144761607200010372 0ustar00Deny from allwork/compiled/.htaccess000064400000000015144761607200011123 0ustar00Deny from allwork/configs/.htaccess000064400000000015144761607200010757 0ustar00Deny from allwork/templates/.htaccess000064400000000015144761607200011325 0ustar00Deny from all