本文整理汇总了PHP中Varien_Io_File::streamWrite方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Io_File::streamWrite方法的具体用法?PHP Varien_Io_File::streamWrite怎么用?PHP Varien_Io_File::streamWrite使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Io_File
的用法示例。
在下文中一共展示了Varien_Io_File::streamWrite方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareFeed
/**
* Prepare the feed file and returns its path
*
* @param array $productsData
* @param int $storeId
* @return string
*/
public function prepareFeed(array $productsData, $storeId)
{
$mId = $this->getVendorConfig('merchant_id', $storeId);
if (!$mId) {
Mage::throwException(Mage::helper('productfeed')->__('Rakuten Seller ID must be set.'));
}
$filename = 'rakuten_product_' . Mage::getModel('core/date')->date('Ymd') . '.txt';
$filepath = $this->getFeedStorageDir() . $filename;
try {
$ioAdapter = new Varien_Io_File();
$ioAdapter->setAllowCreateFolders(true);
$ioAdapter->createDestinationDir($this->getFeedStorageDir());
$ioAdapter->cd($this->getFeedStorageDir());
$ioAdapter->streamOpen($filename);
$ioAdapter->streamWrite(implode(self::DELIMITER, $this->getHeaders()) . "\n");
foreach ($productsData as $productId => $row) {
array_unshift($row, $mId);
$this->prepareRow($row, $productId);
$ioAdapter->streamWrite(implode(self::DELIMITER, $row) . "\n");
// because a CSV enclosure is not supported
}
return $filepath;
} catch (Exception $e) {
Mage::throwException(Mage::helper('productfeed')->__('Could not write feed file to path: %s, %s', $filepath, $e->getMessage()));
}
}
示例2: createIndexSitemapFile
/**
* Create additional xml index file with links to other xml files (if number of them more than 1)
*/
public function createIndexSitemapFile()
{
if (sizeof($this->filenamesForIndexSitemap) > 1) {
$io = new Varien_Io_File();
$io->setAllowCreateFolders(true);
$io->open(array('path' => $this->getPath()));
$fileToCreate = Mage::helper('ascurl')->insertStringToFilename($this->getSitemapFilename(), '_index');
if ($io->fileExists($fileToCreate) && !$io->isWriteable($fileToCreate)) {
Mage::throwException(Mage::helper('sitemap')->__('File "%s" cannot be saved. Please, make sure the directory "%s" is writeable by web server.', $fileToCreate, $this->getPath()));
}
$io->streamOpen($fileToCreate);
$io->streamWrite('<?xml version="1.0" encoding="UTF-8"?>' . "\n");
$io->streamWrite('<sitemapindex ' . self::URLSET . '>');
$storeId = $this->getStoreId();
$baseUrl = Mage::app()->getStore($storeId)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
$date = Mage::getSingleton('core/date')->gmtDate('Y-m-d');
$path = $this->getSitemapPath();
$fullPath = preg_replace('/(?<=[^:])\\/{2,}/', '/', $baseUrl . $path);
foreach ($this->filenamesForIndexSitemap as $item) {
$xml = sprintf('<sitemap><loc>%s</loc><lastmod>%s</lastmod></sitemap>', htmlspecialchars($fullPath . $item), $date);
$io->streamWrite($xml);
}
$io->streamWrite('</sitemapindex>');
$io->streamClose();
}
}
示例3: generateXml
/**
* Generate XML file
*
* @return 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" xmlns:content="http://www.google.com/schemas/sitemap-content/1.0" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">' . "\n");
$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);
// Hans2103 change -> set mediaUrl
$mediaUrl = Mage::app()->getStore($storeId)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
$mediaUrl = preg_replace('/^https/', 'http', $mediaUrl);
/**
* 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);
foreach ($collection as $item) {
$xml = sprintf('<url><loc>%s</loc><lastmod>%s</lastmod><changefreq>%s</changefreq><priority>%.1f</priority></url>' . "\n", htmlspecialchars($baseUrl . $item->getUrl()), $date, $changefreq, $priority);
$io->streamWrite($xml);
$this->check_counter($io);
}
unset($collection);
/**
* Generate products sitemap
*/
/**
* override to include images in 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);
foreach ($collection as $item) {
$xml = sprintf('<url><loc>%s</loc><image:image><image:loc>%s</image:loc><image:title>%s</image:title></image:image><lastmod>%s</lastmod><changefreq>%s</changefreq><priority>%.1f</priority><PageMap xmlns="http://www.google.com/schemas/sitemap-pagemap/1.0"><DataObject type="thumbnail"><Attribute name="name" value="%s"/><Attribute name="src" value="%s"/></DataObject></PageMap></url>' . "\n", htmlspecialchars($baseUrl . $item->getUrl()), htmlspecialchars($mediaUrl . 'catalog/product' . $item->getMedia()), htmlspecialchars($item->getName()), $date, $changefreq, $priority, htmlspecialchars($item->getName()), htmlspecialchars($mediaUrl . 'catalog/product' . $item->getMedia()));
$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>' . "\n", 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;
}
示例4: 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;
}
示例5: fileCreate
protected function fileCreate()
{
$io = new Varien_Io_File();
$io->setAllowCreateFolders(true);
$io->open(array('path' => $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">');
$this->_io = $io;
}
示例6: genSitemap
public function genSitemap($params, $saveMode = NULL)
{
$product_collection = Mage::getResourceModel('catalog/product_collection')->addAttributeToSelect('*')->addAttributeToFilter('status', array('eq' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED))->addAttributeToFilter('price', array('neq' => NULL));
$base = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
$filename = $params['filename'];
$timestamp = "\n<!-- Generated at " . gmdate('Y-m-d\\TH:i:s', time()) . "-->";
$masterTag = $params['field']['master']['code'];
$producTag = $params['field']['master']['product']['code'];
$xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
$xml .= sprintf("\n%s", $timestamp);
$xml .= sprintf("\n<%s>", $masterTag);
$io = new Varien_Io_File();
$io->setAllowCreateFolders(true);
$io->open(array('path' => Mage::getBaseDir() . '/' . $params['path']));
$io->streamOpen(Mage::getBaseDir() . "/" . $params['path'] . $filename);
$io->streamWrite($xml);
$xml = "";
foreach ($product_collection as $product) {
$xml .= sprintf("\n\t<%s>", $producTag);
foreach ($params['field'] as $fieldType => $field) {
switch ($fieldType) {
case 'default':
case 'custom':
foreach ($field as $param) {
$code = $param['code'];
$value = self::splitAndSet($param['value'], $product);
$xml .= sprintf("\n\t\t<%s>%s</%s>", $code, $value, $code);
}
break;
}
}
$xml .= sprintf("\n\t</%s>", $producTag);
$io->streamWrite($xml);
$xml = "";
}
$xml .= sprintf("\n</%s>", $masterTag);
$io->streamWrite($xml);
if ($io->streamClose()) {
unset($product_collection);
$configType = self::_getTypeId($params['type']);
$typeModel = Mage::getModel('sitemaps/type')->load($configType['id']);
$typeModel->setFields(json_encode($params['field']))->save();
if (is_null($saveMode)) {
$sitemaps = Mage::getModel('sitemaps/sitemap')->setFilename($filename)->setPath($params['path'])->setLink(self::_getLink($params['path'], $filename))->setType($configType['id'])->setData('created_at', date('Y-m-d H:i:s'))->setData('updated_at', date('Y-m-d H:i:s'));
} else {
if ($saveMode === 'edit') {
$sitemaps = Mage::getModel('sitemaps/sitemap')->load($params['sitemap_id'])->setFilename($filename)->setPath($params['path'])->setLink(self::_getLink($params['path'], $filename))->setType($configType['id'])->setData('updated_at', date('Y-m-d H:i:s'));
}
}
if ($sitemaps->save()) {
return true;
}
}
}
示例7: _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');
}
示例8: 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);
}
}
}
}
示例9: prepareFeed
/**
* Prepare the feed file and returns its path
*
* @param array $productsData
* @param int $storeId
* @return string
*/
public function prepareFeed(array $productsData, $storeId)
{
$mId = $this->getVendorConfig('merchant_id', $storeId);
$company = $this->getVendorConfig('company', $storeId);
if (!$mId || !$company) {
Mage::throwException(Mage::helper('productfeed')->__('LinkShare Merchant ID and Company Name must be set.'));
}
Varien_Profiler::start('productfeed_' . $this->getVendorCode() . '::' . __FUNCTION__);
$content = implode(self::DELIMITER, array('HDR', $mId, $company, Mage::getModel('core/date')->date('Y-m-d/H:i:s'))) . self::EOL;
foreach ($productsData as $row) {
$content .= $row . self::EOL;
}
$filename = $mId . '_nmerchandis' . Mage::getModel('core/date')->date('Ymd') . '.txt';
$filepath = $this->getFeedStorageDir() . $filename;
try {
$ioAdapter = new Varien_Io_File();
$ioAdapter->setAllowCreateFolders(true);
$ioAdapter->createDestinationDir($this->getFeedStorageDir());
$ioAdapter->cd($this->getFeedStorageDir());
$ioAdapter->streamOpen($filename);
$ioAdapter->streamWrite($content);
Varien_Profiler::stop('productfeed_' . $this->getVendorCode() . '::' . __FUNCTION__);
return $filepath;
} catch (Exception $e) {
Varien_Profiler::stop('productfeed_' . $this->getVendorCode() . '::' . __FUNCTION__);
Mage::throwException(Mage::helper('productfeed')->__('Could not write feed file to path: %s, %s', $filepath, $e->getMessage()));
}
}
示例10: 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');
}
示例11: _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;
}
示例12: 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('*/*/');
}
示例13: 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;
}
示例14: _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');
}
示例15: 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');
}