public function testCreating() { $time = $this->tpl('temp.tpl', 'Template 1 a'); $fenom = new Fenom($provider = new \Fenom\Provider(FENOM_RESOURCES . '/template')); $fenom->setCompileDir(FENOM_RESOURCES . '/compile'); $this->assertInstanceOf('Fenom\\Template', $tpl = $fenom->getTemplate('temp.tpl')); $this->assertSame($provider, $tpl->getProvider()); $this->assertSame('temp.tpl', $tpl->getBaseName()); $this->assertSame('temp.tpl', $tpl->getName()); $this->assertSame($time, $tpl->getTime()); $fenom->clearAllCompiles(); }
/** * Set compile directory * * @param string $dir directory to store compiled templates in * * @throws LogicException * @return Fenom */ public function setCompileDir($dir) { $dir = str_replace(MODX_CORE_PATH, '', $dir); $path = MODX_CORE_PATH; $tmp = explode('/', trim($dir, '/')); foreach ($tmp as $v) { if (!empty($v)) { $path .= $v . '/'; } if (!file_exists($path)) { mkdir($path); } } return parent::setCompileDir($path); }
<?php require_once 'core.php'; use Fenom\Provider; $fenom = new Fenom(new Provider('../ucp/themes')); $fenom->setCompileDir('../cache'); if (defined('DEBUG')) { $fenom->setOptions(Fenom::AUTO_RELOAD); } if (isset($_GET['lang'])) { $currentLanguage = $_GET['lang']; setcookie('lang', $currentLanguage); } else { if (isset($_COOKIE['lang'])) { $currentLanguage = $_COOKIE['lang']; } else { $currentLanguage = configgetvalue('system', 'main', NULL, 'ucpLocale'); } } loadLocale('ucp', $currentLanguage); $ipRequest = " WHERE iplist LIKE '%\"" . $_SERVER['REMOTE_ADDR'] . "\"%'"; function formatCash($sum) { $currency = configgetvalue('system', 'main', NULL, 'currency'); return sprintf(_ngettext("%s {$currency}", "%s {$currency}", $sum), $sum); } class User { private $data = array(); private $valid = false; private $table = false;