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


PHP Varien_Io_File::ls方法代码示例

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


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

示例1: toOptionArray

 public function toOptionArray($exclude = true)
 {
     $result = array();
     $result['Magento'] = array('label' => 'Magento');
     $path = Mage::getModuleDir('', 'Mirasvit_SearchIndex') . DS . 'Model' . DS . 'Index';
     $io = new Varien_Io_File();
     $io->open();
     $io->cd($path);
     foreach ($io->ls(Varien_Io_File::GREP_DIRS) as $space) {
         $io->cd($space['id']);
         foreach ($io->ls(Varien_Io_File::GREP_DIRS) as $module) {
             $io->cd($module['id']);
             foreach ($io->ls(Varien_Io_File::GREP_DIRS) as $entity) {
                 if ($io->fileExists($entity['id'] . DS . 'Index.php', true)) {
                     $indexCode = $space['text'] . '_' . $module['text'] . '_' . $entity['text'];
                     $index = Mage::helper('searchindex/index')->getIndexModel($indexCode);
                     if (is_object($index)) {
                         if ($index->canUse()) {
                             if (!isset($result[$index->getBaseGroup()])) {
                                 $result[$index->getBaseGroup()] = array('label' => $index->getBaseGroup(), 'value' => array());
                             }
                             $result[$index->getBaseGroup()]['value'][] = array('value' => $index->getCode(), 'label' => $index->getBaseTitle());
                         }
                     } else {
                         Mage::throwException('Wrong model for index ' . $indexCode);
                     }
                 }
             }
         }
     }
     return $result;
 }
开发者ID:vishalpatel14,项目名称:indiankalaniketan,代码行数:32,代码来源:Index.php

示例2: loadData

 /**
  * Load the import data from the csv files
  *
  * @return array
  */
 public function loadData()
 {
     $ioHandler = new Varien_Io_File();
     $ioHandler->open(array('path' => $this->getImportDir()));
     $debitFiles = $ioHandler->ls(Varien_Io_File::GREP_FILES);
     $import = array();
     foreach ($debitFiles as $debitFile) {
         if ($debitFile['filetype'] != 'csv') {
             continue;
         }
         $country = str_replace('.csv', '', $debitFile['text']);
         $country = strtoupper($country);
         $import[$country] = array();
         $i = 1;
         $ioHandler->streamOpen($debitFile['text'], 'r');
         while (($line = $ioHandler->streamReadCsv()) !== false) {
             if ($i == 1) {
                 $i++;
                 continue;
             }
             // Check if routing number already exists
             $swiftCode = trim($line[2]);
             if (array_key_exists($swiftCode, $import[$country]) || empty($swiftCode)) {
                 continue;
             }
             // Add bank to array
             $import[$country][$swiftCode] = array('routing_number' => trim($line[0]), 'swift_code' => $swiftCode, 'bank_name' => trim($line[1]));
         }
         $ioHandler->streamClose();
     }
     return $import;
 }
开发者ID:pette87,项目名称:Magento-DebitPayment,代码行数:37,代码来源:Bankdata.php

示例3: _loadFiles

 protected function _loadFiles()
 {
     if (!$this->_isLoaded) {
         $readPath = Mage::getBaseDir("var") . DS . "backups";
         $ioProxy = new Varien_Io_File();
         try {
             $ioProxy->open(array('path' => $readPath));
         } catch (Exception $e) {
             $ioProxy->mkdir($readPath, 0755);
             $ioProxy->chmod($readPath, 0755);
             $ioProxy->open(array('path' => $readPath));
         }
         if (!is_file($readPath . DS . ".htaccess")) {
             // Deny from reading in browser
             $ioProxy->write(".htaccess", "deny from all", 0644);
         }
         $list = $ioProxy->ls(Varien_Io_File::GREP_FILES);
         $fileExtension = constant($this->_itemObjectClass . "::BACKUP_EXTENSION");
         foreach ($list as $entry) {
             if ($entry['filetype'] == $fileExtension) {
                 $item = new $this->_itemObjectClass();
                 $item->load($entry['text'], $readPath);
                 if ($this->_checkCondition($item)) {
                     $this->addItem($item);
                 }
             }
         }
         $this->_totalRecords = count($this->_items);
         if ($this->_totalRecords > 1) {
             usort($this->_items, array(&$this, 'compareByTypeOrDate'));
         }
         $this->_isLoaded = true;
     }
     return $this;
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:35,代码来源:Collection.php

示例4: toOptionArray

 public function toOptionArray()
 {
     $io = new Varien_Io_File();
     $io->cd(Mage::getBaseDir() . DS . 'js' . DS . 'codemirror' . DS . 'theme');
     $files = $io->ls(Varien_Io_File::GREP_FILES);
     $options = array(array('value' => 'default', 'label' => 'default'));
     foreach ($files as $file) {
         $theme = pathinfo($file['text'], PATHINFO_FILENAME);
         $options[] = array('value' => $theme, 'label' => $theme);
     }
     return $options;
 }
开发者ID:TomFranssen,项目名称:magento-highlighter,代码行数:12,代码来源:Theme.php

示例5: getLogFiles

 /**
  * Returns the log files of the var/log directory
  *
  * @return array File List
  */
 public function getLogFiles()
 {
     // Check if path exists
     $path = Mage::getBaseDir('var') . DS . 'log' . DS;
     if (!file_exists($path)) {
         return array();
     }
     // Return file list
     $io = new Varien_Io_File();
     $io->open(array('path' => $path));
     return $io->ls(Varien_Io_File::GREP_FILES);
 }
开发者ID:helirexi,项目名称:firegento-debug,代码行数:17,代码来源:Console.php

示例6: ls

 public function ls($grep = null)
 {
     $directories = parent::ls($grep);
     if (is_array($directories)) {
         foreach ($directories as $key => $directory) {
             if (isset($directory['id']) === false) {
                 $directories[$key]['id'] = $this->_cwd . DS . $directory['text'];
             }
         }
     }
     return $directories;
 }
开发者ID:xiaoguizhidao,项目名称:devfashion,代码行数:12,代码来源:File.php

示例7: _getBiggestFiles

 protected function _getBiggestFiles()
 {
     $return = array();
     $logDir = new Varien_Io_File();
     $logDir->open(array('path' => Mage::getBaseDir('log')));
     foreach ($logDir->ls(Varien_Io_File::GREP_FILES) as $file) {
         if (substr($file['text'], -4) == '.log') {
             $return[$file['text']] = $file['size'] / 1024;
         }
     }
     arsort($return);
     return array_slice($return, 0, 10);
 }
开发者ID:nanawel,项目名称:Arrakis_Munin,代码行数:13,代码来源:Log.php

示例8: getFilesOlderThan

 /**
  * Get all files which are older than X days and containing a pattern.
  *
  * @param  int    $days     Days
  * @param  string $dir      Directory
  * @param  string $filename Filename
  * @return array
  */
 public function getFilesOlderThan($days, $dir, $filename)
 {
     $date = Mage::getModel('core/date')->gmtTimestamp() - 60 * 60 * 24 * $days;
     $oldFiles = array();
     $scanDir = new Varien_Io_File();
     $scanDir->cd($dir);
     foreach ($scanDir->ls(Varien_Io_File::GREP_FILES) as $oldFile) {
         if (stripos($oldFile['text'], $filename) != false && strtotime($oldFile['mod_date']) < $date) {
             $oldFiles[] = $oldFile;
         }
     }
     return $oldFiles;
 }
开发者ID:kirchbergerknorr,项目名称:firegento-logger,代码行数:21,代码来源:Observer.php

示例9: toArray

 public static function toArray()
 {
     $result = array();
     $path = Mage::getModuleDir('', 'Mirasvit_Email') . DS . 'Model' . DS . 'Event';
     $io = new Varien_Io_File();
     $io->open();
     $io->cd($path);
     foreach ($io->ls(Varien_Io_File::GREP_DIRS) as $entity) {
         $io->cd($entity['id']);
         foreach ($io->ls(Varien_Io_File::GREP_FILES) as $event) {
             if ($event['filetype'] != 'php') {
                 continue;
             }
             $info = pathinfo($event['text']);
             $eventCode = strtolower($entity['text'] . '_' . $info['filename']);
             $event = Mage::helper('email/event')->getEventModel($eventCode);
             foreach ($event->getEvents() as $code => $name) {
                 $result[$event->getEventsGroup()][$code] = $name;
             }
         }
     }
     return $result;
 }
开发者ID:ashfaqphplhr,项目名称:artificiallawnsforturf,代码行数:23,代码来源:Event.php

示例10: cleanCache

 public function cleanCache(Varien_Event_Observer $observer)
 {
     /** @var Mage_Catalog_Model_Product_Media_Config $mediaConfig */
     $mediaConfig = Mage::getSingleton('catalog/product_media_config');
     $baseCacheDir = realpath($mediaConfig->getMediaPath(Aoe_LazyCatalogImages_Helper_Catalog_Image::TOKEN_PREFIX));
     $io = new Varien_Io_File();
     $io->cd($baseCacheDir);
     foreach ($io->ls(Varien_Io_File::GREP_DIRS) as $info) {
         $dir = $info['id'];
         if (strpos($dir, $baseCacheDir) === 0) {
             $io->rmdir($dir, true);
         }
     }
 }
开发者ID:erfanimani,项目名称:Aoe_LazyCatalogImages,代码行数:14,代码来源:Observer.php

示例11: _getRuleClasses

 protected function _getRuleClasses()
 {
     $classes = array();
     $rulesDir = Mage::getModuleDir('', 'Mirasvit_Email') . DS . 'Model' . DS . 'Rule' . DS . 'Condition';
     $io = new Varien_Io_File();
     $io->open();
     $io->cd($rulesDir);
     foreach ($io->ls(Varien_Io_File::GREP_FILES) as $event) {
         if ($event['filetype'] != 'php') {
             continue;
         }
         $info = pathinfo($event['text']);
         $class = strtolower($info['filename']);
         $classes[$class] = 'email/rule_condition_' . strtolower($class);
     }
     $io->close();
     return $classes;
 }
开发者ID:ashfaqphplhr,项目名称:artificiallawnsforturf,代码行数:18,代码来源:Combine.php

示例12: getVariablesHelpers

 public function getVariablesHelpers()
 {
     $result = array();
     $pathes = array('email' => Mage::getModuleDir('', 'Mirasvit_Email') . DS . 'Helper' . DS . 'Variables', 'emaildesign' => Mage::getModuleDir('', 'Mirasvit_EmailDesign') . DS . 'Helper' . DS . 'Variables');
     $io = new Varien_Io_File();
     $io->open();
     foreach ($pathes as $pathKey => $path) {
         $io->cd($path);
         foreach ($io->ls(Varien_Io_File::GREP_FILES) as $event) {
             if ($event['filetype'] != 'php') {
                 continue;
             }
             $info = pathinfo($event['text']);
             $result[] = $pathKey . '/variables_' . strtolower($info['filename']);
         }
     }
     $io->close();
     return $result;
 }
开发者ID:ashfaqphplhr,项目名称:artificiallawnsforturf,代码行数:19,代码来源:Config.php

示例13: deleteExtensionFolderFiles

 /**
  * Deletes all extension folders and the app/etc/modules config file.
  */
 public function deleteExtensionFolderFiles()
 {
     $namespacePath = $this->_getNamespacePath();
     $extensionPath = $this->_getExtensionPath();
     try {
         $this->_filesystem->rmdir($extensionPath, true);
         if (is_dir($namespacePath)) {
             $this->_filesystem->cd($namespacePath);
             if (count($this->_filesystem->ls()) == 0) {
                 $this->_filesystem->rmdir($namespacePath, true);
             }
         }
         $modulesConfigFile = $this->_namespace . '_' . $this->_extensionName . '.xml';
         $modulesConfigFilePath = $this->_helper->getModulesConfigDir() . DS . $modulesConfigFile;
         if (file_exists($modulesConfigFilePath)) {
             $this->_filesystem->rm($modulesConfigFilePath);
         }
     } catch (Exception $e) {
         Mage::log($e->getMessage(), null, $this->_helper->getLogFilename());
         Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
     }
 }
开发者ID:blackchacal,项目名称:prometheus,代码行数:25,代码来源:Writer.php

示例14:

 * Mirasvit
 *
 * This source file is subject to the Mirasvit Software License, which is available at http://mirasvit.com/license/.
 * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
 * If you wish to customize this module for your needs.
 * Please refer to http://www.magentocommerce.com for more information.
 *
 * @category  Mirasvit
 * @package   Advanced Product Feeds
 * @version   1.1.2
 * @build     619
 * @copyright Copyright (C) 2015 Mirasvit (http://mirasvit.com/)
 */
$templatePath = Mage::getSingleton('feedexport/config')->getTemplatePath();
$rulePath = Mage::getSingleton('feedexport/config')->getRulePath();
$ioFile = new Varien_Io_File();
$ioFile->open();
$ioFile->cd($templatePath);
foreach ($ioFile->ls(Varien_Io_File::GREP_FILES) as $fl) {
    if ($fl['filetype'] == 'xml') {
        $template = Mage::getModel('feedexport/template');
        $template->import($templatePath . DS . $fl['text']);
    }
}
$ioFile->cd($rulePath);
foreach ($ioFile->ls(Varien_Io_File::GREP_FILES) as $fl) {
    if ($fl['filetype'] == 'xml') {
        $rule = Mage::getModel('feedexport/rule');
        $rule->import($rulePath . DS . $fl['text']);
    }
}
开发者ID:vinayshuklasourcefuse,项目名称:sareez,代码行数:31,代码来源:data-upgrade-0.0.5-0.0.6.php

示例15: resetAllThemes

 /**
  * Reset all theme color changes
  * Copy media/xmlconnect/themes/default/* to media/xmlconnect/themes/*
  *
  * @return void
  */
 public function resetAllThemes()
 {
     $themeDir = Mage::getBaseDir('media') . DS . 'xmlconnect' . DS . 'themes';
     $defaultThemeDir = Mage::getBaseDir('media') . DS . 'xmlconnect' . DS . 'themes' . DS . 'default';
     $io = new Varien_Io_File();
     $io->open(array('path' => $defaultThemeDir));
     $fileList = $io->ls(Varien_Io_File::GREP_FILES);
     foreach ($fileList as $file) {
         $f = $file['text'];
         $src = $defaultThemeDir . DS . $f;
         $dst = $themeDir . DS . $f;
         if ($io->isWriteable($dst)) {
             try {
                 if (!$io->cp($src, $dst)) {
                     Mage::throwException(Mage::helper('xmlconnect')->__('Can\\t copy file "%s" to "%s".', $src, $dst));
                 } else {
                     $io->chmod($dst, 0755);
                 }
             } catch (Exception $e) {
                 Mage::logException($e);
             }
         }
     }
 }
开发者ID:votanlean,项目名称:Magento-Pruebas,代码行数:30,代码来源:Theme.php


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