Пример #1
0
 /**
  * @return CRM_Core_CodeGen_Util_Smarty
  */
 public static function singleton()
 {
     if (self::$singleton === NULL) {
         self::$singleton = new CRM_Core_CodeGen_Util_Smarty();
     }
     return self::$singleton;
 }
Пример #2
0
 /**
  * @param string $filetype
  */
 public function __construct($filetype)
 {
     $this->filetype = $filetype;
     $this->smarty = CRM_Core_CodeGen_Util_Smarty::singleton()->createSmarty();
     $this->assign('generated', "DO NOT EDIT.  Generated by CRM_Core_CodeGen");
     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('NewLines', array('after' => 'class, public, require, comment'));
         $this->beautifier->setIndentChar(' ');
         $this->beautifier->setIndentNumber(2);
         $this->beautifier->setNewLine("\n");
     }
 }
Пример #3
0
 /**
  * @param $CoreDAOCodePath
  * @param $sqlCodePath
  * @param $phpCodePath
  * @param $tplCodePath
  * @param $smartyPluginDirs
  * @param $argCms
  * @param $argVersion
  * @param $schemaPath
  * @param $digestPath
  */
 function __construct($CoreDAOCodePath, $sqlCodePath, $phpCodePath, $tplCodePath, $smartyPluginDirs, $argCms, $argVersion, $schemaPath, $digestPath)
 {
     $this->CoreDAOCodePath = $CoreDAOCodePath;
     $this->sqlCodePath = $sqlCodePath;
     $this->phpCodePath = $phpCodePath;
     $this->tplCodePath = $tplCodePath;
     $this->digestPath = $digestPath;
     $this->digest = NULL;
     // default cms is 'drupal', if not specified
     $this->cms = isset($argCms) ? strtolower($argCms) : 'drupal';
     CRM_Core_CodeGen_Util_Smarty::singleton()->setPluginDirs($smartyPluginDirs);
     $versionFile = "version.xml";
     $versionXML = CRM_Core_CodeGen_Util_Xml::parse($versionFile);
     $this->db_version = $versionXML->version_no;
     $this->buildVersion = preg_replace('/^(\\d{1,2}\\.\\d{1,2})\\.(\\d{1,2}|\\w{4,7})$/i', '$1', $this->db_version);
     if (isset($argVersion)) {
         // change the version to that explicitly passed, if any
         $this->db_version = $argVersion;
     }
     $this->schemaPath = $schemaPath;
 }
Пример #4
0
 /**
  * @param string $filetype
  */
 public function __construct($filetype)
 {
     $this->filetype = $filetype;
     $this->smarty = CRM_Core_CodeGen_Util_Smarty::singleton()->getSmarty();
     $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");
     }
 }