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


PHP Varien_Io_File::streamClose方法代码示例

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


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

示例1: parseCsv

 /**
  * Parses csv file
  *
  * @param string $file
  * @return Mage_Core_Model_Resource_Abstract
  */
 public function parseCsv($file)
 {
     $info = pathinfo($file);
     $io = new Varien_Io_File();
     $io->open(array('path' => $info['dirname']));
     $io->streamOpen($info['basename'], 'r');
     $headers = $io->streamReadCsv();
     if ($headers === false) {
         $io->streamClose();
         Mage::throwException(Mage::helper('pyro_licenses')->__('You must specify valid headers in the first row'));
     }
     if (false === ($columns = $this->_prepareColumns($headers))) {
         $io->streamClose();
         Mage::throwException(Mage::helper('pyro_licenses')->__("Invalid header: 'License' is missed"));
     }
     $this->_write->beginTransaction();
     try {
         $rowNumber = 1;
         $importData = array();
         while (false !== ($csvLine = $io->streamReadCsv())) {
             $rowNumber++;
             // check for empty lines
             $emptyLine = array_unique($csvLine);
             if (count($emptyLine) == 1 && $emptyLine[0] == "") {
                 continue;
             }
             $row = $this->_getImportRow($csvLine, $columns, $rowNumber);
             if ($row !== false) {
                 $importData[] = $row;
             }
             if (count($importData) == 5000) {
                 $this->_saveImportData($importData);
                 $importData = array();
             }
         }
         $this->_saveImportData($importData);
         $io->streamClose();
     } catch (Mage_Core_Exception $e) {
         $this->_write->rollback();
         $io->streamClose();
         Mage::throwException($e->getMessage());
     } catch (Exception $e) {
         $this->_write->rollback();
         $io->streamClose();
         Mage::logException($e);
         Mage::throwException(Mage::helper('adminhtml')->__($e->getMessage()));
     }
     $this->_write->commit();
     if ($this->_importErrors) {
         $error = sprintf('ImportSubscribers: "%1$s"', implode('", "', $this->_importErrors));
         Mage::log($error, 3, '', true);
     }
     return $this;
 }
开发者ID:artmouse,项目名称:ProductLicense,代码行数:60,代码来源:Licenses.php

示例2: _printList

 private function _printList($cards, $path)
 {
     try {
         $io = new Varien_Io_File();
         $fullPath = Mage::getBaseDir() . $path;
         $parts = pathinfo($fullPath);
         if (!isset($parts['extension']) || strtolower($parts['extension']) != 'csv') {
             Mage::throwException('Error in file extension. Only *.csv files are supported');
         }
         $delimiter = ';';
         $enclosure = '"';
         $io->open(array('path' => $parts['dirname']));
         $io->streamOpen($fullPath, 'w+');
         $io->streamLock(true);
         $header = array('card_id' => 'Gift Card Code', 'amount' => 'Card Amount');
         $io->streamWriteCsv($header, $delimiter, $enclosure);
         $content = array();
         foreach ($cards as $card) {
             $content['card_id'] = $card['code'];
             $content['amount'] = $card['amount'];
             $io->streamWriteCsv($content, $delimiter, $enclosure);
         }
         $io->streamUnlock();
         $io->streamClose();
         $list = Mage::getModel('giftcards/cardslist')->load($fullPath, 'file_path');
         $list->setFilePath($fullPath)->save();
     } catch (Mage_Core_Exception $e) {
         Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
     } catch (Exception $e) {
         Mage::getSingleton('adminhtml/session')->addError(Mage::helper('giftcards')->__('An error occurred while save cards list.'));
     }
 }
开发者ID:AleksNesh,项目名称:pandora,代码行数:32,代码来源:CardscreateController.php

示例3: _generateStoreCss

 protected function _generateStoreCss($type, $storeCode)
 {
     if (!Mage::app()->getStore($storeCode)->getIsActive()) {
         return false;
     }
     $fileName = $type . '_' . $storeCode . '.css';
     $file = Mage::helper('legenda/config')->getGeneratedCssDir() . $fileName;
     $templateFile = 'smartwave/legenda/css/' . $type . '.phtml';
     Mage::register('legenda_css_generate_store', $storeCode);
     try {
         $tempalte = Mage::app()->getLayout()->createBlock("core/template")->setData('area', 'frontend')->setTemplate($templateFile)->toHtml();
         if (empty($tempalte)) {
             throw new Exception(Mage::helper('legenda')->__("Template file is empty or doesn't exist: %s", $templateFile));
             return false;
         }
         $io = new Varien_Io_File();
         $io->setAllowCreateFolders(true);
         $io->open(array('path' => Mage::helper('legenda/config')->getGeneratedCssDir()));
         $io->streamOpen($file, 'w+');
         $io->streamLock(true);
         $io->streamWrite($tempalte);
         $io->streamUnlock();
         $io->streamClose();
     } catch (Exception $exception) {
         Mage::getSingleton('adminhtml/session')->addError(Mage::helper('legenda')->__('Failed generating CSS file: %s in %s', $fileName, Mage::helper('legenda/config')->getGeneratedCssDir()) . '<br/>Message: ' . $exception->getMessage());
         Mage::logException($exception);
         return false;
     }
     Mage::unregister('legenda_css_generate_store');
     return true;
 }
开发者ID:EagleSH,项目名称:besttoy,代码行数:31,代码来源:Generator.php

示例4: _generateStoreCss

 protected function _generateStoreCss($design, $storeCode)
 {
     if (!Mage::app()->getStore($storeCode)->getIsActive()) {
         return;
     }
     $prefix = '_' . $storeCode;
     if ($design == 'layout') {
         $filename = $design . $prefix . '.css';
     } else {
         $filename = $design . $prefix . '.less';
     }
     $filedefault = Mage::helper('dgtyaris/cssgen')->getGeneratedCssDir() . $filename;
     $path = 'dgtthemes/dgtyaris/css/' . $design . '.phtml';
     Mage::register('cssgen_store', $storeCode);
     try {
         $block = Mage::app()->getLayout()->createBlock("core/template")->setData('area', 'frontend')->setTemplate($path)->toHtml();
         if (empty($block)) {
             throw new Exception(Mage::helper('dgtyaris')->__("Template file is empty or doesn't exist: %s", $path));
         }
         $file = new Varien_Io_File();
         $file->setAllowCreateFolders(true);
         $file->open(array('path' => Mage::helper('dgtyaris/cssgen')->getGeneratedCssDir()));
         $file->streamOpen($filedefault, 'w+');
         $file->streamLock(true);
         $file->streamWrite($block);
         $file->streamUnlock();
         $file->streamClose();
     } catch (Exception $gener) {
         Mage::getSingleton('adminhtml/session')->addError(Mage::helper('dgtyaris')->__('Failed generating CSS file: %s in %s', $filename, Mage::helper('dgtyaris/cssgen')->getGeneratedCssDir()) . '<br/>Message: ' . $gener->getMessage());
         Mage::logException($gener);
     }
     Mage::unregister('cssgen_store');
 }
开发者ID:dragontheme1235,项目名称:project-1,代码行数:33,代码来源:Generator.php

示例5: massConfigGenAction

 public function massConfigGenAction()
 {
     $configArray = array();
     try {
         $ids = $this->getRequest()->getPost('ids', array());
         foreach ($ids as $id) {
             $model = Mage::getModel("configgen/config")->load($id);
             $configArray[] = $model->getData();
         }
         $output = $this->getLayout()->createBlock('core/template')->setTemplate('proxiblue_configgen.phtml')->setConfigItems($configArray);
         $io = new Varien_Io_File();
         $path = Mage::getBaseDir('var') . DS . 'export' . DS;
         $name = md5(microtime());
         $file = $path . DS . $name . '.php';
         $io->setAllowCreateFolders(true);
         $io->open(array('path' => $path));
         $io->streamOpen($file, 'w+');
         $io->streamLock(true);
         $io->streamWrite($output->toHtml());
         $io->streamUnlock();
         $io->streamClose();
         $this->_prepareDownloadResponse('proxiblue_generated_config.php', array('type' => 'filename', 'value' => $file, 'rm' => true));
         Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Config was generated"));
     } catch (Exception $e) {
         Mage::getSingleton("adminhtml/session")->addError($e->getMessage());
     }
     $this->_redirect('*/*/');
 }
开发者ID:jpujari,项目名称:ConfigGen,代码行数:28,代码来源:ConfigController.php

示例6: getFile

 public function getFile($downloadName)
 {
     Varien_Profiler::start('cdn_download_file_' . $downloadName);
     $adapter = $this->getAdapter();
     if ($adapter) {
         $fileName = Mage::helper('mycdn')->getRelativeFile($downloadName);
         $image = $adapter->downloadFile($fileName);
         if ($image) {
             $bn = new Zend_Filter_BaseName();
             $image_name = $bn->filter($downloadName);
             $dn = new Zend_Filter_Dir();
             $image_path = $dn->filter($downloadName);
             $file = new Varien_Io_File();
             $file->setAllowCreateFolders(true);
             $file->open(['path' => $image_path]);
             $file->streamOpen($image_name);
             $file->streamLock(true);
             $file->streamWrite($image);
             $file->streamUnlock();
             $file->streamClose();
             Mage::helper('mycdn')->addLog('[DOWNLOADED] File downloaded to ' . $downloadName);
             Varien_Profiler::stop('cdn_download_file_' . $downloadName);
             //saving to cache
             Mage::helper('mycdn')->savePathInCache($fileName, $this->getUrl($fileName));
             return true;
         } else {
             Mage::helper('mycdn')->addLog('[NOT DOWNLOADED] File not downloaded to ' . $downloadName);
         }
     }
     Varien_Profiler::stop('cdn_download_file_' . $downloadName);
     return false;
 }
开发者ID:mygento,项目名称:cdn,代码行数:32,代码来源:Adapter.php

示例7: generateXml

 public function generateXml()
 {
     $io = new Varien_Io_File();
     $io->setAllowCreateFolders(true);
     $io->open(array('path' => $this->getPath()));
     if ($io->fileExists($this->getSitemapFilename()) && !$io->isWriteable($this->getSitemapFilename())) {
         Mage::throwException(Mage::helper('sitemap')->__('File "%s" cannot be saved. Please, make sure the directory "%s" is writeable by web server.', $this->getSitemapFilename(), $this->getPath()));
     }
     $io->streamOpen($this->getSitemapFilename());
     $io->streamWrite('<?xml version="1.0" encoding="UTF-8"?>' . "\n");
     $io->streamWrite('<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">');
     $storeId = $this->getStoreId();
     $date = Mage::getSingleton('core/date')->gmtDate('Y-m-d');
     $baseUrl = Mage::app()->getStore($storeId)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
     // Generate filterurl sitemap
     $changefreq = (string) Mage::getStoreConfig('sitemap/category/changefreq', $storeId);
     $priority = (string) Mage::getStoreConfig('sitemap/category/priority', $storeId);
     /* @var $collection Flagbit_FilterUrls_Model_Resource_Mysql4_Url_Collection */
     $collection = Mage::getModel('filterurls/url')->getCollection();
     $collection->addFieldToFilter('store_id', $storeId);
     foreach ($collection as $item) {
         $xml = sprintf('<url><loc>%s</loc><lastmod>%s</lastmod><changefreq>%s</changefreq><priority>%.1f</priority></url>', htmlspecialchars($baseUrl . $item->getRequestPath()), $date, $changefreq, $priority);
         $io->streamWrite($xml . PHP_EOL);
     }
     $io->streamWrite('</urlset>');
     $io->streamClose();
     $this->setSitemapTime(Mage::getSingleton('core/date')->gmtDate('Y-m-d H:i:s'));
     $this->save();
     return $this;
 }
开发者ID:konstantins90,项目名称:Magento-FilterUrls,代码行数:30,代码来源:Sitemap.php

示例8: generateStoreCss

 protected function generateStoreCss($type, $storeCode)
 {
     if (!Mage::app()->getStore($storeCode)->getIsActive()) {
         return;
     }
     $str1 = '_' . $storeCode;
     $str2 = $type . $str1 . '.css';
     $str3 = Mage::helper('mango/cssconfig')->getCssConfigDir() . $str2;
     $str4 = 'mango/css/' . $type . '.phtml';
     Mage::register('cssgen_store', $storeCode);
     try {
         $block = Mage::app()->getLayout()->createBlock("core/template")->setData('area', 'frontend')->setTemplate($str4)->toHtml();
         if (empty($block)) {
             throw new Exception(Mage::helper('mango')->__("Template file is empty or doesn't exist: %s", $str4));
         }
         $file = new Varien_Io_File();
         $file->setAllowCreateFolders(true);
         $file->open(array('path' => Mage::helper('mango/cssconfig')->getCssConfigDir()));
         $file->streamOpen($str3, 'w+');
         $file->streamLock(true);
         $file->streamWrite($block);
         $file->streamUnlock();
         $file->streamClose();
     } catch (Exception $e) {
         Mage::getSingleton('adminhtml/session')->addError(Mage::helper('mango')->__('Failed generating CSS file: %s in %s', $str2, Mage::helper('mango/cssconfig')->getCssConfigDir()) . '<br/>Message: ' . $e->getMessage());
         Mage::logException($e);
     }
     Mage::unregister('cssgen_store');
 }
开发者ID:perseusl,项目名称:kingdavid,代码行数:29,代码来源:Generator.php

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

示例10: _generateStoreCss

 protected function _generateStoreCss($x0b, $x0d)
 {
     if (!Mage::app()->getStore($x0d)->getIsActive()) {
         return;
     }
     $x11 = '_' . $x0d;
     $x12 = $x0b . $x11 . '.css';
     $x13 = Mage::helper('ultimo/cssgen')->getGeneratedCssDir() . $x12;
     $x14 = Mage::helper('ultimo/cssgen')->getTemplatePath() . $x0b . '.phtml';
     Mage::register('cssgen_store', $x0d);
     try {
         $x15 = Mage::app()->getLayout()->createBlock("core/template")->setData('area', 'frontend')->setTemplate($x14)->toHtml();
         if (empty($x15)) {
             throw new Exception(Mage::helper('ultimo')->__("Template file is empty or doesn't exist: %s", $x14));
         }
         $x16 = new Varien_Io_File();
         $x16->setAllowCreateFolders(true);
         $x16->open(array('path' => Mage::helper('ultimo/cssgen')->getGeneratedCssDir()));
         $x16->streamOpen($x13, 'w+', 0777);
         $x16->streamLock(true);
         $x16->streamWrite($x15);
         $x16->streamUnlock();
         $x16->streamClose();
     } catch (Exception $x17) {
         Mage::getSingleton('adminhtml/session')->addError(Mage::helper('ultimo')->__('Failed generating CSS file: %s in %s', $x12, Mage::helper('ultimo/cssgen')->getGeneratedCssDir()) . '<br/>Message: ' . $x17->getMessage());
         Mage::logException($x17);
     }
     Mage::unregister('cssgen_store');
 }
开发者ID:klord9x,项目名称:project-nam1,代码行数:29,代码来源:Generator.php

示例11: generateStoreCss

 public function generateStoreCss($x0c, $x0e = '')
 {
     $x12 = $x0e ? '_' . $x0e : '';
     $x13 = '_' . $x0c . $x12 . '.css';
     $x14 = $this->_cssDirPath . $x13;
     $x15 = 'infortis/ultimo/css/' . $x0c . '.phtml';
     Mage::register('cssgen_store', $x0e);
     try {
         $x16 = Mage::app()->getLayout()->createBlock("core/template")->setData('area', 'frontend')->setTemplate($x15)->toHtml();
         if (empty($x16)) {
             throw new Exception(Mage::helper('ultimo')->__("Template file is empty or doesn't exist: %s", $x15));
         }
         $x17 = new Varien_Io_File();
         $x17->setAllowCreateFolders(true);
         $x17->open(array('path' => $this->_cssDirPath));
         $x17->streamOpen($x14, 'w+');
         $x17->streamLock(true);
         $x17->streamWrite($x16);
         $x17->streamUnlock();
         $x17->streamClose();
         Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('ultimo')->__('CSS file %s has been refreshed', $x13));
     } catch (Exception $x18) {
         Mage::getSingleton('adminhtml/session')->addError(Mage::helper('ultimo')->__('Failed refreshing css file %s in %s', $x13, Mage::helper('ultimo')->getGeneratedCssPath()) . '<br/>Message: ' . $x18->getMessage());
         Mage::logException($x18);
     }
     Mage::unregister('cssgen_store');
 }
开发者ID:xiaoguizhidao,项目名称:bilderrahmen,代码行数:27,代码来源:Generate.php

示例12: regenerate

 /**
  * regenerate theme css based on appearance settings
  */
 public function regenerate()
 {
     $websites = Mage::app()->getWebsites();
     foreach ($websites as $_website) {
         $_website_code = $_website->getCode();
         foreach ($_website->getStores() as $_store) {
             if (!Mage::app()->getStore($_store)->getIsActive()) {
                 continue;
             }
             ob_start();
             require $this->_css_template_path;
             $css = ob_get_clean();
             $filename = str_replace(array('%WEBSITE%', '%STORE%'), array($_website_code, $_store->getCode()), $this->_css_file);
             try {
                 $file = new Varien_Io_File();
                 $file->setAllowCreateFolders(true)->open(array('path' => $this->_css_path));
                 $file->streamOpen($filename, 'w+');
                 $file->streamWrite($css);
                 $file->streamClose();
             } catch (Exception $e) {
                 Mage::getSingleton('adminhtml/session')->addError(Mage::helper('athlete')->__('Css generation error: %s', $this->_css_path . $filename) . '<br/>' . $e->getMessage());
                 Mage::logException($e);
             }
         }
     }
 }
开发者ID:bigtailbear14,项目名称:rosstheme,代码行数:29,代码来源:Css.php

示例13: generateXml

 /**
  * Generate sitemap XML file - override to dispatch more events
  *
  * @return $this|Mage_Sitemap_Model_Sitemap
  */
 public function generateXml()
 {
     $io = new Varien_Io_File();
     $io->setAllowCreateFolders(true);
     $io->open(array('path' => $this->getPath()));
     if ($io->fileExists($this->getSitemapFilename()) && !$io->isWriteable($this->getSitemapFilename())) {
         Mage::throwException(Mage::helper('sitemap')->__('File "%s" cannot be saved. Please, make sure the directory "%s" is writeable by web server.', $this->getSitemapFilename(), $this->getPath()));
     }
     $io->streamOpen($this->getSitemapFilename());
     $io->streamWrite('<?xml version="1.0" encoding="UTF-8"?>' . "\n");
     $io->streamWrite('<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">');
     $storeId = $this->getStoreId();
     $date = Mage::getSingleton('core/date')->gmtDate('Y-m-d');
     $baseUrl = Mage::app()->getStore($storeId)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
     /**
      * Generate categories sitemap
      */
     $changefreq = (string) Mage::getStoreConfig('sitemap/category/changefreq', $storeId);
     $priority = (string) Mage::getStoreConfig('sitemap/category/priority', $storeId);
     $collection = Mage::getResourceModel('sitemap/catalog_category')->getCollection($storeId);
     $categories = new Varien_Object();
     $categories->setItems($collection);
     Mage::dispatchEvent('sitemap_categories_generating_before', array('collection' => $categories));
     foreach ($categories->getItems() as $item) {
         $xml = sprintf('<url><loc>%s</loc><lastmod>%s</lastmod><changefreq>%s</changefreq><priority>%.1f</priority></url>', htmlspecialchars($baseUrl . $item->getUrl()), $date, $changefreq, $priority);
         $io->streamWrite($xml);
     }
     unset($collection);
     /**
      * Generate products sitemap
      */
     $changefreq = (string) Mage::getStoreConfig('sitemap/product/changefreq', $storeId);
     $priority = (string) Mage::getStoreConfig('sitemap/product/priority', $storeId);
     $collection = Mage::getResourceModel('sitemap/catalog_product')->getCollection($storeId);
     $products = new Varien_Object();
     $products->setItems($collection);
     Mage::dispatchEvent('sitemap_products_generating_before', array('collection' => $products));
     foreach ($products->getItems() as $item) {
         $xml = sprintf('<url><loc>%s</loc><lastmod>%s</lastmod><changefreq>%s</changefreq><priority>%.1f</priority></url>', htmlspecialchars($baseUrl . $item->getUrl()), $date, $changefreq, $priority);
         $io->streamWrite($xml);
     }
     unset($collection);
     /**
      * Generate cms pages sitemap
      */
     $changefreq = (string) Mage::getStoreConfig('sitemap/page/changefreq', $storeId);
     $priority = (string) Mage::getStoreConfig('sitemap/page/priority', $storeId);
     $collection = Mage::getResourceModel('sitemap/cms_page')->getCollection($storeId);
     foreach ($collection as $item) {
         $xml = sprintf('<url><loc>%s</loc><lastmod>%s</lastmod><changefreq>%s</changefreq><priority>%.1f</priority></url>', htmlspecialchars($baseUrl . $item->getUrl()), $date, $changefreq, $priority);
         $io->streamWrite($xml);
     }
     unset($collection);
     $io->streamWrite('</urlset>');
     $io->streamClose();
     $this->setSitemapTime(Mage::getSingleton('core/date')->gmtDate('Y-m-d H:i:s'));
     $this->save();
     return $this;
 }
开发者ID:xiaoguizhidao,项目名称:magento,代码行数:64,代码来源:Sitemap.php

示例14: cssgenerate

 /**
  * After any system config is saved
  */
 public function cssgenerate()
 {
     $section = Mage::app()->getRequest()->getParam('section');
     if ($section == 'themeoptions') {
         $store_ids = array();
         if (Mage::app()->getRequest()->getParam('store') && Mage::app()->getRequest()->getParam('website')) {
             $store_ids[] = Mage::getModel("core/store")->load(Mage::app()->getRequest()->getParam('store'))->getStore_id();
         } elseif (Mage::app()->getRequest()->getParam('website')) {
             $store_ids = Mage::getModel('core/website')->load(Mage::app()->getRequest()->getParam('website'))->getstoreIds();
         } else {
             foreach (Mage::app()->getWebsites() as $website) {
                 foreach ($website->getGroups() as $group) {
                     $stores = $group->getStores();
                     foreach ($stores as $store) {
                         $store_ids[] = $store->getId();
                     }
                 }
             }
         }
         foreach ($store_ids as $store_id) {
             $this->setLocation($store_id);
             if (!$this->getConfig('reset_css', $store_id)) {
                 $css = 'h1,h2,h3,h4,h5,h6{';
                 if ($this->getConfig('font_main', $store_id)) {
                     $css .= 'font-family:' . str_replace("+", " ", $this->getConfig('font', $store_id)) . ';font-weight:' . $this->getConfig('font_weight', $store_id) . ';';
                 }
                 $css .= 'color:' . $this->getConfig('title_color', $store_id) . '}';
                 $image_bg = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN) . 'frontend/' . $this->dir_store . '/images/pattern/' . $this->getConfig('bg_pattern', $store_id) . '.png';
                 $css .= 'body{';
                 if ($this->getConfig('font_content_main', $store_id)) {
                     $css .= 'font-family:' . str_replace("+", " ", $this->getConfig('font_content', $store_id)) . ';font-weight:' . $this->getConfig('font_contentweight', $store_id) . ';background-color:' . $this->getConfig('bg_color', $store_id) . ';';
                 }
                 $css .= 'color:' . $this->getConfig('text_color', $store_id) . ';';
                 if ($this->getConfig('bg_pattern', $store_id)) {
                     $css .= 'background-image:url("' . $image_bg . '")';
                 }
                 $css .= '}';
                 $css .= 'a{color:' . $this->getConfig('link_color', $store_id) . '}';
                 $css .= 'a:hover{color:' . $this->getConfig('link_hover_color', $store_id) . '}';
             } else {
                 $css = '';
             }
             try {
                 $fh = new Varien_Io_File();
                 $fh->setAllowCreateFolders(true);
                 $fh->open(array('path' => $this->dirPath));
                 $fh->streamOpen($this->filePath, 'w+');
                 $fh->streamLock(true);
                 $fh->streamWrite($css);
                 $fh->streamUnlock();
                 $fh->streamClose();
             } catch (Exception $e) {
                 Mage::getSingleton('adminhtml/session')->addError(Mage::helper('themeoptions')->__('Failed creation custom css rules. ' . $e->getMessage()));
             }
         }
     }
 }
开发者ID:xiaoguizhidao,项目名称:mozar,代码行数:60,代码来源:Observer.php

示例15: _finalizeSitemap

 /**
  * Write closing tag and close stream
  *
  * @param string $type
  */
 protected function _finalizeSitemap($type = self::TYPE_URL)
 {
     if ($this->_fileHandler) {
         $this->_fileHandler->streamWrite(sprintf($this->_tags[$type][self::CLOSE_TAG_KEY], $type));
         $this->_fileHandler->streamClose();
     }
     // Reset all counters
     $this->_lineCount = 0;
     $this->_fileSize = 0;
 }
开发者ID:natxetee,项目名称:magento2,代码行数:15,代码来源:Sitemap.php


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