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


PHP FileUtils::getAllFiles方法代码示例

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


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

示例1: postProcessForm

 public function postProcessForm(&$v, &$fb, &$obj)
 {
     $defs = $obj->_getPluginsDef();
     $field = $obj->fb_elementNamePrefix . 'filename' . $obj->fb_elementNamePostfix;
     if (!$_FILES[$field]['tmp_name']) {
         return;
     }
     $filename = $obj->getImageName();
     if (!$filename) {
         $filename = $obj->getOwner()->tableName() . '_' . substr(md5(time() + rand(0, 100)), 0, 10);
     }
     $obj->filename = $this->_upFile($obj, $obj->fb_elementNamePrefix . 'filename' . $obj->fb_elementNamePostfix, $defs['otfimage']['path'], $filename);
     $obj->update();
     /**
      * Clearing cache for this image
      **/
     $filename = eregi_replace('(\\.[^\\.]+)$', '', basename($obj->filename));
     $cachefolder = APP_ROOT . 'public/' . $defs['otfimage']['cache'] . '/' . $filename . '/';
     foreach (FileUtils::getAllFiles($cachefolder) as $file) {
         @unlink($file);
     }
     /**
      * Setting as main if none exist
      */
     $main = $obj->getOwner();
     $mainImg = $main->getMainImage();
     if (!$obj->ismain && !$mainImg->pk()) {
         $obj->setAsMain();
     }
 }
开发者ID:demental,项目名称:m,代码行数:30,代码来源:db.php

示例2: longHelp

 public function longHelp($params)
 {
     if (count($params) == 0) {
         $this->line('Invoques a plugin subcommand');
         $this->line('Usage:');
         $this->line('plugin [PLUGIN_NAME] [COMMAND_NAME] [[COMMAND_PARAMETERS]]');
         $this->line('');
         $this->line('You can get a description of the plugin and list the available subcommands using:');
         $this->line('help plugin [PLUGIN_NAME]');
         $this->line('You can also get help from subcommands if provided using:');
         $this->line('help plugin [PLUGIN_NAME] [COMMAND_NAME]');
         $this->line('============');
         $this->line('Here is a list of available plugins:');
         $dir = dirname(realpath(__FILE__));
         $pluginsPath = realpath($dir . '/../plugins/');
         foreach (FileUtils::getFolders($pluginsPath) as $adir) {
             if (ereg('^\\.', basename($adir))) {
                 continue;
             }
             $this->line(basename($adir));
         }
     } elseif (count($params) == 1) {
         $plugin = $params[0];
         $pluginPath = 'M/plugins/' . $plugin . '/';
         if (!FileUtils::file_exists_incpath($pluginPath . 'commands/help.php')) {
             if (!FileUtils::file_exists_incpath('M/plugins/' . $plugin)) {
                 throw new Exception($plugin . ' plugin does not exist');
             } else {
                 $this->line('no description for ' . $plugin . ' plugin');
             }
         } else {
             require_once 'M/plugins/' . $plugin . '/commands/help.php';
             $className = $plugin . '_Command_help';
             $h = new $className();
             $h->execute();
         }
         $this->line('============');
         $this->line('Here is a list of available commands for this plugin:');
         $dir = dirname(realpath(__FILE__));
         $commandsPath = realpath($dir . '/../../' . $pluginPath . 'commands/');
         foreach (FileUtils::getAllFiles($commandsPath) as $file) {
             $commandname = basename($file, '.php');
             if ($commandname == 'help') {
                 continue;
             }
             $className = $plugin . '_Command_' . $commandname;
             require_once $file;
             $newcommand = new $className();
             $this->line('');
             $this->line($commandname);
             $newcommand->shortHelp();
         }
     } else {
         $plugin = array_shift($params);
         $command = array_shift($params);
         $this->getPluginCommand($plugin, $command, $params)->longHelp();
     }
 }
开发者ID:demental,项目名称:m,代码行数:58,代码来源:plugin.php

示例3: tablesWithPlugin

 public static function tablesWithPlugin($pluginName)
 {
     foreach (FileUtils::getAllFiles(APP_ROOT . 'app/models/', 'php') as $file) {
         $t = DB_DataObject::factory(strtolower(basename($file, '.php')));
         if (PEAR::isError($t)) {
             continue;
         }
         $plugs = $t->_getPluginsDef();
         if ($plugs[$pluginName]) {
             $ret[] = $t->tableName();
         }
     }
     return $ret;
 }
开发者ID:demental,项目名称:m,代码行数:14,代码来源:M.php

示例4: setup

 public function setup()
 {
     $options =& PEAR::getStaticProperty('DB_DataObject', 'options');
     $options['class_location'] = PEAR_FOLDER . 'M/tests/DO/';
     $options['schema_location'] = PEAR_FOLDER . 'M/tests/DO/';
     $options['class_prefix'] = 'DataObjects_';
     foreach (FileUtils::getAllFiles(PEAR_FOLDER . 'M/tests/DO/') as $file) {
         unlink($file);
     }
     foreach (FileUtils::getAllFiles(PEAR_FOLDER . 'M/tests/DO_dist/') as $file) {
         copy($file, str_replace('DO_dist', 'DO', $file));
     }
     $this->setUpDatabase('Mfixture.sql', 1);
 }
开发者ID:demental,项目名称:m,代码行数:14,代码来源:DB_DataObject_Pluggable_test.php

示例5: _checkForCustomLinks

 protected function _checkForCustomLinks()
 {
     $data = PEAR::getStaticProperty('DB_DataObject', 'options');
     $folder = $data['class_location'];
     $files = FileUtils::getAllFiles($folder, 'php');
     foreach ($files as $file) {
         $content = file_get_contents($file);
         $classname = strtolower(basename($file, '.php'));
         if (DB_DataObject_Advgenerator::hasCustomLinksMethod($content)) {
             if ($this->confirm($classname . ' class seems to have dynamic/conditional links.' . "\n" . 'Do you wish to scan all table for link fix (long but recommended) ?', 'y')) {
                 $this->toScan[] = $classname;
             }
         }
     }
 }
开发者ID:demental,项目名称:m,代码行数:15,代码来源:uninstall.php

示例6: longHelp

 public function longHelp($params)
 {
     if (count($params) == 0) {
         $this->line('Invoques a module subcommand');
         $this->line('Usage:');
         $this->line('module [MODULE_NAME] [COMMAND_NAME] [[COMMAND_PARAMETERS]]');
         $this->line('');
         $this->line('You can get a description of the module and list the available subcommands using:');
         $this->line('help module [MODULE_NAME]');
         $this->line('You can also get help from subcommands if provided using:');
         $this->line('help module [MODULE_NAME] [COMMAND_NAME]');
         $this->line('============');
     } elseif (count($params) == 1) {
         $module = $params[0];
         $modulePath = APP_ROOT . 'app/' . APP_NAME . '/modules/' . $module . '/';
         if (!file_exists($modulePath . 'commands/help.php')) {
             if (!file_exists($modulePath)) {
                 throw new Exception($module . ' module does not exist while processing help');
             } else {
                 $this->line('no description for ' . $module . ' module');
             }
         } else {
             require_once $modulePath . '/commands/help.php';
             $className = $module . '_Command_help';
             $h = new $className();
             $h->execute();
         }
         $this->line('============');
         $this->line('Here is a list of available commands for this module:');
         $commandsPath = realpath($modulePath . 'commands/');
         foreach (FileUtils::getAllFiles($commandsPath) as $file) {
             $commandname = basename($file, '.php');
             if ($commandname == 'help') {
                 continue;
             }
             $className = $module . '_Command_' . $commandname;
             require_once $file;
             $newcommand = new $className();
             $this->line('');
             $this->line($commandname);
             $newcommand->shortHelp();
         }
     } else {
         $module = array_shift($params);
         $command = array_shift($params);
         $this->getModuleCommand($module, $command, $params)->longHelp();
     }
 }
开发者ID:demental,项目名称:m,代码行数:48,代码来源:module.php

示例7: execute

 public function execute($params)
 {
     $lang = $params[0];
     if (!in_array($lang, Config::getAllLangs())) {
         throw new Exception('Specified lang is not part of this project handled languages');
     }
     foreach (FileUtils::getAllFiles(APP_ROOT . 'app/' . APP_NAME) as $file) {
         $result = preg_match_all('`(?:__|_e)\\(\'(.+)\'(?:,array\\(.+\\))?\\)`sU', file_get_contents($file), $matches);
         foreach ($matches[1] as $elem) {
             $nbfound++;
             __(str_replace("\\'", "'", $elem));
         }
     }
     $arr = T::getInstance($lang)->getStrings();
     T::getInstance($lang)->save(true);
 }
开发者ID:demental,项目名称:m,代码行数:16,代码来源:extractlng.php

示例8: setup

 public function setup()
 {
     ini_set('display_errors', 1);
     $options =& PEAR::getStaticProperty('DB_DataObject', 'options');
     $options['class_location'] = PEAR_FOLDER . 'M/tests/DO/';
     $options['schema_location'] = PEAR_FOLDER . 'M/tests/DO/';
     $options['class_prefix'] = 'DataObjects_';
     $this->setUpDatabase('Mfixture.sql', 1);
     // Setup 3 langs : fr en es and fr as default
     Config::set('defautLang', 'es');
     Config::set('installedLangs', array('en', 'fr', 'es'));
     // Copy original test DO's
     foreach (FileUtils::getAllFiles(PEAR_FOLDER . 'M/tests/DO/') as $file) {
         unlink($file);
     }
     foreach (FileUtils::getAllFiles(PEAR_FOLDER . 'M/tests/DO_dist/') as $file) {
         copy($file, str_replace('DO_dist', 'DO', $file));
     }
 }
开发者ID:demental,项目名称:m,代码行数:19,代码来源:i18n_test.php

示例9: files_to_load

 public function files_to_load($lang)
 {
     foreach (T::paths() as $path) {
         foreach (FileUtils::getAllFiles($path) as $file) {
             if (substr($file, -6, 3) == $lang . '.') {
                 $files_to_load[] = $file;
             }
         }
     }
     return $files_to_load;
 }
开发者ID:demental,项目名称:m,代码行数:11,代码来源:T.php

示例10: _regenerateAssets

 protected function _regenerateAssets()
 {
     $this->header('Regenerating assets');
     $version_file = APP_ROOT . 'app/ASSETSVERSION';
     $assetsversion = (int) file_get_contents($version_file);
     $assetsversion++;
     file_put_contents($version_file, $assetsversion);
     $assetsfolder = APP_ROOT . 'public/assets/';
     $jsfolder = $assetsfolder . 'js/';
     foreach (FileUtils::getFolders($jsfolder) as $folder) {
         if (preg_match('`^\\.`', $folder)) {
             continue;
         }
         $this->line('Regenerating ' . $folder . ' javascript asset');
         $out = '';
         foreach (FileUtils::getAllFiles($jsfolder . $folder) as $file) {
             $out .= file_get_contents($file) . "\n";
         }
         if (MODE == 'production') {
             $out = JSmin::minify($out);
         }
         $version = self::getOption('assetsurlrewriting') ? '' : $assetsversion;
         file_put_contents(APP_ROOT . 'public/cache/' . $folder . $version . '.js', $out);
     }
     // css
     $cssfolder = $assetsfolder . 'css/';
     foreach (FileUtils::getFolders($cssfolder) as $folder) {
         if (preg_match('`^\\.`', $folder)) {
             continue;
         }
         $this->line('Regenerating ' . $folder . ' CSS asset');
         $out = '';
         foreach (FileUtils::getAllFiles($cssfolder . $folder) as $file) {
             $out .= file_get_contents($file) . "\n";
         }
         if (MODE == 'production') {
             $out = CSSmin::minify($out);
         }
         $version = self::getOption('assetsurlrewriting') ? '' : $assetsversion;
         file_put_contents(APP_ROOT . 'public/cache/' . $folder . $version . '.css', $out);
     }
 }
开发者ID:demental,项目名称:m,代码行数:42,代码来源:clearcache.php

示例11: execute

 public function execute($params)
 {
     if (is_array($params) && count($params) > 0) {
         $command = array_shift($params);
         $exec = Command::factory($command);
         $exec->longHelp($params);
     } else {
         $this->line('This command displays global help text or specific help text for a command if provided');
         $this->line('Usage:');
         $this->line('help');
         $this->line('  Displays this help');
         $this->line('help [COMMAND_NAME]');
         $this->line('  Displays specific and longer help for [COMMAND_NAME]');
         $this->line('help [COMMAND_NAME] [SUBCOMMAND_NAME] and so on....');
         $this->line('  Displays specific and longer help for [SUBCOMMAND_NAME] if [COMMAND_NAME] contains some subcommands (e.g. the plugin command)');
         $this->line('==========');
         $this->line('Here is the list of available root commands:');
         $dir = dirname(realpath(__FILE__));
         foreach (FileUtils::getAllFiles($dir, 'php') as $afile) {
             $subcname = basename($afile, '.php');
             $subc = Command::factory($subcname);
             $this->line('====== ' . $subcname . ' ======');
             $subc->shortHelp();
         }
     }
 }
开发者ID:demental,项目名称:m,代码行数:26,代码来源:help.php


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