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


PHP FileUtils::getFolders方法代码示例

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


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

示例1: 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

示例2: _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


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