/** * Get templates_c directory. * * @return string */ public function getCompileDir() { if ($this->compileDir === NULL) { $this->compileDir = CRM_Core_CodeGen_Util_File::createTempDir('templates_c_'); } return $this->compileDir; }
/** * @param string $filetype */ function __construct($filetype) { $this->compileDir = CRM_Core_CodeGen_Util_File::createTempDir('templates_c_'); $this->filetype = $filetype; // TODO use Core Smarty require_once 'Smarty/Smarty.class.php'; $this->smarty = new Smarty(); $this->smarty->template_dir = './templates'; $this->smarty->plugins_dir = self::$smartyPluginDirs; $this->smarty->compile_dir = $this->compileDir; $this->smarty->clear_all_cache(); $this->assign('generated', "DO NOT EDIT. Generated by CRM_Core_CodeGen"); // CRM-5308 / CRM-3507 - we need {localize} to work in the templates require_once 'CRM/Core/Smarty/plugins/block.localize.php'; $this->smarty->register_block('localize', 'smarty_block_localize'); if ($this->filetype === 'php') { require_once 'PHP/Beautifier.php'; // create an instance $this->beautifier = new PHP_Beautifier(); $this->beautifier->addFilter('ArrayNested'); // add one or more filters $this->beautifier->addFilter('Pear'); // add one or more filters $this->beautifier->addFilter('NewLines', array('after' => 'class, public, require, comment')); $this->beautifier->setIndentChar(' '); $this->beautifier->setIndentNumber(2); $this->beautifier->setNewLine("\n"); } }