当前位置: 首页>>代码示例>>PHP>>正文


PHP ZendT_Lib::replaceFiles方法代码示例

本文整理汇总了PHP中ZendT_Lib::replaceFiles方法的典型用法代码示例。如果您正苦于以下问题:PHP ZendT_Lib::replaceFiles方法的具体用法?PHP ZendT_Lib::replaceFiles怎么用?PHP ZendT_Lib::replaceFiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ZendT_Lib的用法示例。


在下文中一共展示了ZendT_Lib::replaceFiles方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: factory

 public function factory($table, $module)
 {
     $this->_loadProfile(self::NO_PROFILE_THROW_EXCEPTION);
     $path = $this->_loadedProfile->getAttribute('projectDirectory');
     $dirModules = $path . '/application/configs/modules';
     if (!is_dir($dirModules)) {
         mkdir($dirModules);
     }
     $dirModule = $dirModules . '/' . $module;
     if (!is_dir($dirModule)) {
         mkdir($dirModule);
     }
     $fileName = $dirModule . '/' . $table . '.php';
     if (!file_exists($fileName)) {
         throw new Zend_Tool_Project_Provider_Exception('Para executar essa ação é necessário criar o arquivo ' . $fileName);
     }
     $config = (require $fileName);
     $path .= '/application/modules/' . strtolower($module);
     /**
      * Gerando o DataView 
      */
     if (!isset($config['table']['modelName'])) {
         $config['table']['modelName'] = $config['table']['name'];
     }
     $modelName = ZendT_Lib::convertTableNameToClassName($config['table']['modelName']);
     /**
      * 
      */
     if (file_exists($path . '/models/' . $modelName . '/MapperView.php')) {
         ZendT_Lib::createDirectory($path, '/data-views/' . $modelName . '/Crud');
         copy($path . '/models/' . $modelName . '/Crud/MapperView.php', $path . '/data-views/' . $modelName . '/Crud/MapperView.php');
         unlink($path . '/models/' . $modelName . '/Crud/MapperView.php');
         $content = file_get_contents($path . '/data-views/' . $modelName . '/Crud/MapperView.php');
         $content = str_replace(ucfirst($module) . '_Model_' . $modelName . '_Crud_MapperView', ucfirst($module) . '_DataView_' . $modelName . '_Crud_MapperView', $content);
         file_put_contents($path . '/data-views/' . $modelName . '/Crud/MapperView.php', $content);
         copy($path . '/models/' . $modelName . '/MapperView.php', $path . '/data-views/' . $modelName . '/MapperView.php');
         unlink($path . '/models/' . $modelName . '/MapperView.php');
         $content = file_get_contents($path . '/data-views/' . $modelName . '/MapperView.php');
         $content = str_replace(ucfirst($module) . '_Model_' . $modelName . '_MapperView', ucfirst($module) . '_DataView_' . $modelName . '_MapperView', $content);
         $content = str_replace(ucfirst($module) . '_Model_' . $modelName . '_Crud_MapperView', ucfirst($module) . '_DataView_' . $modelName . '_Crud_MapperView', $content);
         file_put_contents($path . '/data-views/' . $modelName . '/MapperView.php', $content);
         $content = file_get_contents($path . '/controllers/' . $modelName . 'Controller.php');
         $content = str_replace(ucfirst($module) . '_Model_' . $modelName . '_MapperView', ucfirst($module) . '_DataView_' . $modelName . '_MapperView', $content);
         file_put_contents($path . '/controllers/' . $modelName . 'Controller.php', $content);
         $this->_print('Objeto MapperView fatorado com sucesso!');
     } else {
         $this->_print('Objeto MapperView já fatorado');
     }
     /**
      * 
      */
     if (file_exists($path . '/models/' . $modelName . '/Element.php')) {
         copy($path . '/models/' . $modelName . '/Crud/Element.php', $path . '/forms/' . $modelName . '/Crud/Elements.php');
         unlink($path . '/models/' . $modelName . '/Crud/Element.php');
         $content = file_get_contents($path . '/forms/' . $modelName . '/Crud/Elements.php');
         $content = str_replace(ucfirst($module) . '_Model_' . $modelName . '_Crud_Element', ucfirst($module) . '_Form_' . $modelName . '_Crud_Elements', $content);
         file_put_contents($path . '/forms/' . $modelName . '/Crud/Elements.php', $content);
         copy($path . '/models/' . $modelName . '/Element.php', $path . '/forms/' . $modelName . '/Elements.php');
         unlink($path . '/models/' . $modelName . '/Element.php');
         $content = file_get_contents($path . '/forms/' . $modelName . '/Elements.php');
         $content = str_replace(ucfirst($module) . '_Model_' . $modelName . '_Element', ucfirst($module) . '_Form_' . $modelName . '_Elements', $content);
         $content = str_replace(ucfirst($module) . '_Model_' . $modelName . '_Crud_Element', ucfirst($module) . '_Form_' . $modelName . '_Crud_Elements', $content);
         file_put_contents($path . '/forms/' . $modelName . '/Elements.php', $content);
         $this->_print('Objeto Element fatorado com sucesso!');
     } else {
         $this->_print('Objeto Element já fatorado');
     }
     ZendT_Lib::replaceFiles($path, ucfirst($module) . '_Model_' . $modelName . '_MapperView', ucfirst($module) . '_DataView_' . $modelName . '_MapperView');
     ZendT_Lib::replaceFiles($path, ucfirst($module) . '_Model_' . $modelName . '_Element', ucfirst($module) . '_Form_' . $modelName . '_Elements');
     $path = $this->_loadedProfile->getAttribute('projectDirectory');
     $this->_print(' Criando Tables ');
     ZendT_Tool_Crud_Table::create($path, $config);
     $this->_print(' Criando Mappers ');
     ZendT_Tool_Crud_Mapper::create($path, $config);
     $this->_print(' Criando MapperView ');
     ZendT_Tool_Crud_MapperView::create($path, $config);
     $this->_print(' Criando Elements ');
     ZendT_Tool_Crud_Element::create($path, $config);
     $this->_print(' Criando Form ');
     ZendT_Tool_Crud_Form::create($path, $config);
     $this->_print(' Criando Bootstrap ');
     ZendT_Tool_Crud_Bootstrap::create($path, $config, 1);
     $this->_print('Finalizado Factory ' . $table);
 }
开发者ID:rtsantos,项目名称:mais,代码行数:84,代码来源:CrudTProvider.php

示例2: replaceFiles

 public static function replaceFiles($pathBase, $strOld, $strNew, $filter = '*.*')
 {
     $pathBase = str_replace('\\', '/', $pathBase);
     $files = glob($pathBase . '/' . $filter);
     foreach ($files as $file) {
         file_put_contents($file, str_replace($strOld, $strNew, file_get_contents($file)));
     }
     @($myDirectory = opendir($pathBase));
     if ($myDirectory) {
         while ($dir = @readdir($myDirectory)) {
             if ($dir != '.' && $dir != '..' && $dir != '.svn' && is_dir($pathBase . '/' . $dir)) {
                 ZendT_Lib::replaceFiles($pathBase . '/' . $dir, $strOld, $strNew, $filter);
             }
         }
         closedir($myDirectory);
     }
 }
开发者ID:rtsantos,项目名称:mais,代码行数:17,代码来源:Lib.php


注:本文中的ZendT_Lib::replaceFiles方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。