當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。