示例#1
0
 protected function open($write = false)
 {
     $ioAdapter = new Varien_Io_File();
     try {
         $path = $ioAdapter->getCleanPath($this->getPath());
         $ioAdapter->checkAndCreateFolder($path);
         $filePath = $path . DS . $this->getFileName();
     } catch (Exception $e) {
         Mage::helper('mailchimp')->addException($e);
     }
     if ($write && $ioAdapter->fileExists($filePath)) {
         $ioAdapter->rm($filePath);
     }
     if (!$write && !$ioAdapter->fileExists($filePath)) {
         $message = Mage::helper('mailchimp')->__('File "%s" does not exist.', $this->getFileName());
         Mage::getSingleton('adminhtml/session')->addError($this->__('Mailchimp General Error: ') . $message);
     }
     $mode = $write ? 'wb' . self::COMPRESS_RATE : 'rb';
     try {
         $this->_handler = gzopen($filePath, $mode);
     } catch (Exception $e) {
         Mage::helper('mailchimp')->addException($e);
     }
     return $this;
 }
示例#2
0
 /**
  * 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();
     }
 }
 protected function _beforeSave()
 {
     $io = new Varien_Io_File();
     $realPath = $io->getCleanPath($this->getPath());
     /**
      * Check path is allow
      */
     if (!$io->allowedPath($realPath, Mage::getBaseDir())) {
         Mage::throwException(Mage::helper('sitemap')->__('Please define correct path'));
     }
     /**
      * Check exists and writeable path
      */
     if (!$io->fileExists($realPath, false)) {
         Mage::throwException(Mage::helper('sitemap')->__('Please create the specified folder "%s" before saving the sitemap.', Mage::helper('core')->htmlEscape($this->getPreparedFilename())));
     }
     if (!$io->isWriteable($realPath)) {
         Mage::throwException(Mage::helper('sitemap')->__('Please make sure that "%s" is writable by web-server.', $this->getPreparedFilename()));
     }
     /**
      * Check allow filename
      */
     if (!preg_match('#\\.xml$#', $this->getSitemapFilename())) {
         $this->setSitemapFilename($this->getSitemapFilename() . '.xml');
     }
     $this->setSitemapPath(rtrim(str_replace(str_replace('\\', '/', Mage::getBaseDir()), '', $realPath), '/') . '/');
     return parent::_beforeSave();
 }
示例#4
0
 /**
  * @param $orderId
  * @return boolean
  */
 public function photoExists($orderId)
 {
     $dir = $this->getBaseDir();
     $filename = $dir . $orderId . self::TIMION_ORDERPHOTO_EXT;
     $io = new Varien_Io_File();
     return $io->fileExists($filename);
 }
示例#5
0
 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;
 }
示例#6
0
文件: Job.php 项目: mygento/cdn
 /**
  * Upload file to CDN async
  */
 public function uploadFile()
 {
     $adapter = Mage::getModel('mycdn/adapter');
     if (!$adapter) {
         return;
     }
     $ioObject = new Varien_Io_File();
     $ioObject->setAllowCreateFolders(true);
     $ioObject->open(array('path' => $ioObject->dirname($this->getData('filename'))));
     if (!$ioObject->fileExists($this->getData('filename'), true)) {
         Mage::helper('mycdn')->addLog('[CRON] No file ' . $this->getData('filename'));
         $this->delete();
         return;
     }
     //Mage::helper('mycdn')->addLog('[CRON] processing id = ' . $this->getId());
     //Mage::helper('mycdn')->addLog($this->getData());
     $result = $adapter->uploadFile($this->getData('filename'), $this->getData('uploadname'), $this->getData('content_type'));
     if ($result && $this->getData('delete')) {
         $ioObject->rm($this->getData('filename'));
         Mage::helper('mycdn')->addLog('[DELETE] CRON delete for ' . $this->getData('filename'));
     }
     if ($result) {
         Mage::helper('mycdn')->addLog('[JOB] CRON delete job for ' . $this->getData('filename') . "\n");
         $this->delete();
     }
 }
 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;
 }
示例#8
0
 /**
  * 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;
 }
示例#9
0
 /**
  * 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;
 }
示例#10
0
 public function viewfileAction()
 {
     $file = null;
     $plain = false;
     if ($this->getRequest()->getParam('file')) {
         // download file
         $file = Mage::helper('core')->urlDecode($this->getRequest()->getParam('file'));
     } else {
         if ($this->getRequest()->getParam('image')) {
             // show plain image
             $file = Mage::helper('core')->urlDecode($this->getRequest()->getParam('image'));
             $plain = true;
         } else {
             return $this->norouteAction();
         }
     }
     if (strpos($file, 'medma_avatar') !== false) {
         $path = Mage::getBaseDir('media') . DS . 'medma_avatar' . DS;
     } else {
         $path = Mage::getBaseDir('media') . DS . 'customer';
     }
     $ioFile = new Varien_Io_File();
     $ioFile->open(array('path' => $path));
     $fileName = $ioFile->getCleanPath($path . $file);
     $path = $ioFile->getCleanPath($path);
     if ((!$ioFile->fileExists($fileName) || strpos($fileName, $path) !== 0) && !Mage::helper('core/file_storage')->processStorageFile(str_replace('/', DS, $fileName))) {
         return $this->norouteAction();
     }
     if ($plain) {
         $extension = pathinfo($fileName, PATHINFO_EXTENSION);
         switch (strtolower($extension)) {
             case 'gif':
                 $contentType = 'image/gif';
                 break;
             case 'jpg':
                 $contentType = 'image/jpeg';
                 break;
             case 'png':
                 $contentType = 'image/png';
                 break;
             default:
                 $contentType = 'application/octet-stream';
                 break;
         }
         $ioFile->streamOpen($fileName, 'r');
         $contentLength = $ioFile->streamStat('size');
         $contentModify = $ioFile->streamStat('mtime');
         $this->getResponse()->setHttpResponseCode(200)->setHeader('Pragma', 'public', true)->setHeader('Content-type', $contentType, true)->setHeader('Content-Length', $contentLength)->setHeader('Last-Modified', date('r', $contentModify))->clearBody();
         $this->getResponse()->sendHeaders();
         while (false !== ($buffer = $ioFile->streamRead())) {
             echo $buffer;
         }
     } else {
         $name = pathinfo($fileName, PATHINFO_BASENAME);
         $this->_prepareDownloadResponse($name, array('type' => 'filename', 'value' => $fileName));
     }
     exit;
 }
示例#11
0
文件: Data.php 项目: mygento/cdn
 public function isFileExists($fileName)
 {
     $ioObject = new Varien_Io_File();
     $ioObject->setAllowCreateFolders(true);
     $ioObject->open(array('path' => $ioObject->dirname($fileName)));
     if ($ioObject->fileExists($fileName, true)) {
         return true;
     }
     return false;
 }
示例#12
0
文件: File.php 项目: buttasg/cowgirlk
    protected function _rewriteGrid($blcgClass, $originalClass, $gridType)
    {
        $classParts = explode('_', str_replace($this->_getBlcgClassPrefix(), '', $blcgClass));
        $fileName = array_pop($classParts) . '.php';
        $rewriteDir = dirname(__FILE__) . '/../../../Block/Rewrite/' . implode('/', $classParts);
        $ioFile = new Varien_Io_File();
        $ioFile->setAllowCreateFolders(true);
        $ioFile->checkAndCreateFolder($rewriteDir);
        $ioFile->cd($rewriteDir);
        // Use open() to initialize Varien_Io_File::$_iwd
        // Prevents a warning when chdir() is used without error control in Varien_Io_File::read()
        if ($ioFile->fileExists($fileName, true) && $ioFile->open()) {
            if ($content = $ioFile->read($fileName)) {
                $lines = preg_split('#\\R#', $content, 3);
                $isUpToDate = false;
                if (isset($lines[0]) && isset($lines[1]) && $lines[0] == '<?php' && preg_match('#^// BLCG_REWRITE_CODE_VERSION\\=([0-9]+)$#', $lines[1], $matches)) {
                    if ($matches[1] === strval(self::REWRITE_CODE_VERSION)) {
                        $isUpToDate = true;
                    }
                }
            }
            $ioFile->close();
            if ($isUpToDate) {
                return $this;
            }
        }
        $content = '<?php
// BLCG_REWRITE_CODE_VERSION=' . self::REWRITE_CODE_VERSION . '
// This file was generated automatically. Do not alter its content.

/**
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/osl-3.0.php
 *
 * @category   BL
 * @package    BL_CustomGrid
 * @copyright  Copyright (c) ' . date('Y') . ' Benoît Leulliette <*****@*****.**>
 * @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */

';
        $content .= $this->_getRewriteCode($blcgClass, $originalClass, $gridType);
        if (!$ioFile->write($fileName, $content)) {
            Mage::throwException();
        }
        return $this;
    }
 /**
  * Use to load the patches array with applied patches.
  *
  * @return void
  */
 protected function _loadPatchFile()
 {
     $ioAdapter = new Varien_Io_File();
     if (!$ioAdapter->fileExists($this->patchFile)) {
         return;
     }
     $ioAdapter->open(array('path' => $ioAdapter->dirname($this->patchFile)));
     $ioAdapter->streamOpen($this->patchFile, 'r');
     while ($buffer = $ioAdapter->streamRead()) {
         if (stristr($buffer, '|')) {
             list($date, $patch) = array_map('trim', explode('|', $buffer));
             $this->appliedPatches[] = $patch;
         }
     }
     $ioAdapter->streamClose();
 }
示例#14
0
 /**
  * Create new sitemap file
  *
  * @param string $fileName
  * @param string $type
  * @return void
  */
 protected function _createSitemap($fileName = null, $type = self::TYPE_URL)
 {
     if (!$fileName) {
         $this->_sitemapIncrement++;
         $fileName = $this->_getCurrentSitemapFilename($this->_sitemapIncrement);
     }
     $this->_fileHandler = $this->_getFileObject();
     $this->_fileHandler->setAllowCreateFolders(true);
     $path = $this->_fileHandler->getCleanPath($this->_getBaseDir() . $this->getSitemapPath());
     $this->_fileHandler->open(array('path' => $path));
     if ($this->_fileHandler->fileExists($fileName) && !$this->_fileHandler->isWriteable($fileName)) {
         Mage::throwException(Mage::helper('Mage_Sitemap_Helper_Data')->__('File "%s" cannot be saved. Please, make sure the directory "%s" is writable by web server.', $fileName, $path));
     }
     $fileHeader = sprintf($this->_tags[$type][self::OPEN_TAG_KEY], $type);
     $this->_fileHandler->streamOpen($fileName);
     $this->_fileHandler->streamWrite($fileHeader);
     $this->_fileSize = strlen($fileHeader . sprintf($this->_tags[$type][self::CLOSE_TAG_KEY], $type));
 }
示例#15
0
 protected function _deactivateModule()
 {
     $file = Mage::getBaseDir('etc') . DS . 'modules' . DS . 'Netzarbeiter_GroupsCatalog.xml';
     $io = new Varien_Io_File();
     if (!$io->fileExists($file)) {
         $message = Mage::helper('netzarbeiter_groupscatalog2')->__("The file app/etc/modules/Netzarbeiter_GroupsCatalog.xml doesn't exist.");
         Mage::throwException($message);
     }
     $xml = simplexml_load_file($file);
     if (in_array((string) $xml->modules->Netzarbeiter_GroupsCatalog->active, array('true', '1'), true)) {
         if (!$io->isWriteable($file)) {
             $message = Mage::helper('netzarbeiter_groupscatalog2')->__('The file app/etc/modules/Netzarbeiter_GroupsCatalog.xml is not writable.<br/>' . 'Please fix it and flush the configuration cache, or deactivate the module manually in that file.');
             Mage::throwException($message);
         }
         $xml->modules->Netzarbeiter_GroupsCatalog->active = 'false';
         $xml->asXML($file);
         Mage::app()->cleanCache(Mage_Core_Model_Config::CACHE_TAG);
     }
 }
示例#16
0
 protected function _beforeSave()
 {
     $io = new Varien_Io_File();
     $realPath = $io->getCleanPath(Mage::getBaseDir() . '/' . $this->getSitemapPath());
     if (!$io->allowedPath($realPath, Mage::getBaseDir())) {
         Mage::throwException(Mage::helper('xsitemap')->__('Please define correct path'));
     }
     if (!$io->fileExists($realPath, false)) {
         Mage::throwException(Mage::helper('xsitemap')->__('Please create the specified folder "%s" before saving the sitemap.', $this->getSitemapPath()));
     }
     if (!$io->isWriteable($realPath)) {
         Mage::throwException(Mage::helper('xsitemap')->__('Please make sure that "%s" is writable by web-server.', $this->getSitemapPath()));
     }
     if (!preg_match('#^[a-zA-Z0-9_\\.]+$#', $this->getSitemapFilename())) {
         Mage::throwException(Mage::helper('xsitemap')->__('Please use only letters (a-z or A-Z), numbers (0-9) or underscore (_) in the filename. No spaces or other characters are allowed.'));
     }
     if (!preg_match('#\\.xml$#', $this->getSitemapFilename())) {
         $this->setSitemapFilename($this->getSitemapFilename() . '.xml');
     }
     $this->setSitemapPath(rtrim(str_replace(str_replace('\\', '/', Mage::getBaseDir()), '', $realPath), '/') . '/');
     return parent::_beforeSave();
 }
示例#17
0
 protected function _copyImage($file)
 {
     try {
         $ioObject = new Varien_Io_File();
         $destDirectory = dirname($this->_getConfig()->getMediaPath($file));
         $ioObject->open(array('path' => $destDirectory));
         $destFile = $this->_getUniqueFileName($file, $ioObject->dirsep());
         if (!$ioObject->fileExists($this->_getConfig()->getMediaPath($file), true)) {
             throw new Exception('File not exists');
         }
         if ($this->_checkDb()) {
             Mage::helper('core/file_storage_database')->copyFile($this->_getConfig()->getMediaShortUrl($file), $this->_getConfig()->getMediaShortUrl($destFile));
             $ioObject->rm($this->_getConfig()->getMediaPath($destFile));
         } else {
             $ioObject->cp($this->_getConfig()->getMediaPath($file), $this->_getConfig()->getMediaPath($destFile));
         }
     } catch (Exception $e) {
         $file = $this->_getConfig()->getMediaPath($file);
         Mage::throwException(Mage::helper('ampaction')->__('Failed to copy file %s. Please, delete media with non-existing images and try again.', $file));
         $e = $e;
         // for zend debugger
     }
     return str_replace($ioObject->dirsep(), '/', $destFile);
 }
示例#18
0
 protected function _copy($file)
 {
     $ioAdapter = new Varien_Io_File();
     if (!$ioAdapter->fileExists($file)) {
         Mage::throwException(Mage::helper('dataflow')->__('File "%s" does not exist.', $file));
     }
     $ioAdapter->setAllowCreateFolders(true);
     $ioAdapter->createDestinationDir($this->getBatchModel()->getIoAdapter()->getPath());
     return $ioAdapter->cp($file, $this->getBatchModel()->getIoAdapter()->getFile(true));
 }
示例#19
0
 /**
  * Directory structure initializing
  */
 protected function _initFilesystem()
 {
     $this->_createWriteableDir($this->getTargetDir());
     $this->_createWriteableDir($this->getQuoteTargetDir());
     $this->_createWriteableDir($this->getOrderTargetDir());
     // Directory listing and hotlink secure
     $io = new Varien_Io_File();
     $io->cd($this->getTargetDir());
     if (!$io->fileExists($this->getTargetDir() . DS . '.htaccess')) {
         $io->streamOpen($this->getTargetDir() . DS . '.htaccess');
         $io->streamLock(true);
         $io->streamWrite("Order deny,allow\nDeny from all");
         $io->streamUnlock();
         $io->streamClose();
     }
 }
示例#20
0
 /**
  * Upload file by file map to Google FTP server and delete it from local file system
  *
  * @param array $fileNameMap   array(array('local' => 'local file name', 'remote' => 'remote file name'), ...)
  * @param mixed $store
  *
  * @throws Varien_Io_Exception If FTP related error occurred
  */
 protected function _uploadFiles(array &$fileNameMap, $store)
 {
     $ftp = new Varien_Io_Ftp();
     $fs = new Varien_Io_File();
     try {
         $ftp->open(array('host' => $host = $this->_getConfig()->getFtpHostName(), 'user' => $this->_getConfig()->getFtpUserName($store), 'password' => $this->_getConfig()->getFtpPassword($store), 'passive' => $this->_getConfig()->getFtpMode($store)));
     } catch (Exception $e) {
         foreach ($fileNameMap as &$item) {
             $item['error_message'] = $e->getMessage();
         }
         throw $e;
     }
     $uploadedFiles = array();
     $exceptions = array();
     foreach ($fileNameMap as &$item) {
         if ($fs->fileExists($item['local'])) {
             $result = $ftp->write($item['remote'], $item['local']);
             if (false === $result) {
                 $item['error_message'] = Mage::helper('googletrustedstore')->__("Unable to upload '%s' to '%s' on server %s", $item['local'], $item['remote'], $host);
                 $exceptions[] = $item['error_message'];
             } else {
                 $uploadedFiles[] = $item['local'];
                 $fs->rm($item['local']);
                 $item['successfully'] = true;
             }
         } else {
             $item['error_message'] = Mage::helper('googletrustedstore')->__("The '%s' file does not exist on Magento server", $item['local']);
         }
     }
     $ftp->close();
     if (!empty($exceptions)) {
         throw new Varien_Io_Exception(implode(PHP_EOL, $exceptions));
     }
     return $uploadedFiles;
 }
示例#21
0
 /**
  * Declare headers and content file in responce for file download
  *
  * @param string $fileName
  * @param string|array $content set to null to avoid starting output, $contentLength should be set explicitly in
  *                              that case
  * @param string $contentType
  * @param int $contentLength    explicit content length, if strlen($content) isn't applicable
  * @return Mage_Adminhtml_Controller_Action
  */
 protected function _prepareDownloadResponse($fileName, $content, $contentType = 'application/octet-stream', $contentLength = null)
 {
     $session = Mage::getSingleton('admin/session');
     if ($session->isFirstPageAfterLogin()) {
         $this->_redirect($session->getUser()->getStartupPageUrl());
         return $this;
     }
     $isFile = false;
     $file = null;
     if (is_array($content)) {
         if (!isset($content['type']) || !isset($content['value'])) {
             return $this;
         }
         if ($content['type'] == 'filename') {
             $isFile = true;
             $file = $content['value'];
             $contentLength = filesize($file);
         }
     }
     $this->getResponse()->setHttpResponseCode(200)->setHeader('Pragma', 'public', true)->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true)->setHeader('Content-type', $contentType, true)->setHeader('Content-Length', is_null($contentLength) ? strlen($content) : $contentLength)->setHeader('Content-Disposition', 'attachment; filename="' . $fileName . '"')->setHeader('Last-Modified', date('r'));
     if (!is_null($content)) {
         if ($isFile) {
             $this->getResponse()->clearBody();
             $this->getResponse()->sendHeaders();
             $ioAdapter = new Varien_Io_File();
             if (!$ioAdapter->fileExists($file)) {
                 Mage::throwException(Mage::helper('core')->__('File not found'));
             }
             $ioAdapter->open(array('path' => $ioAdapter->dirname($file)));
             $ioAdapter->streamOpen($file, 'r');
             while ($buffer = $ioAdapter->streamRead()) {
                 print $buffer;
             }
             $ioAdapter->streamClose();
             if (!empty($content['rm'])) {
                 $ioAdapter->rm($file);
             }
         } else {
             $this->getResponse()->setBody($content);
         }
     }
     return $this;
 }
示例#22
0
文件: Theme.php 项目: quyip8818/Mag
 /**
  * Delete theme by id
  *
  * @param  $themeId
  * @return bool
  */
 public function deleteTheme($themeId)
 {
     $result = false;
     $ioFile = new Varien_Io_File();
     $ioFile->cd($this->getMediaThemePath());
     $themeFile = basename($themeId . '.xml');
     if ($ioFile->fileExists($themeFile)) {
         $result = $ioFile->rm($themeFile);
     }
     return $result;
 }
示例#23
0
 public function isFileExists()
 {
     $io = new Varien_Io_File();
     return $io->fileExists($this->local_file, true);
 }
 public function generateFile()
 {
     $x114 = "preg_split";
     $x115 = "implode";
     $x116 = "str_replace";
     $x117 = "utf8_encode";
     $x118 = "preg_match_all";
     $x119 = "preg_match";
     $x11a = "rtrim";
     $x11b = "is_null";
     $x11c = "count";
     $x11d = "is_numeric";
     $x11e = "explode";
     $x11f = "substr";
     $x120 = "trim";
     $x121 = "strlen";
     $x122 = "htmlentities";
     $x123 = "html_entity_decode";
     $x124 = "preg_replace";
     $x125 = "json_decode";
     $x126 = "is_array";
     $x127 = "stristr";
     $x128 = "print_r";
     $x129 = "is_string";
     $x12a = "ucwords";
     $x12b = "array_push";
     $x12c = "version_compare";
     $x12d = "in_array";
     $x12e = "sprintf";
     $x12f = "array_pop";
     $x130 = "ceil";
     $x131 = "ini_get";
     $x132 = "set_time_limit";
     $x133 = "number_format";
     $x134 = "strip_tags";
     $x135 = "htmlspecialchars";
     $x136 = "strrpos";
     $x137 = "is_bool";
     $x138 = "mb_strtolower";
     $x139 = "mb_strtoupper";
     $x13a = "ftp_connect";
     $x13b = "ftp_login";
     $x13c = "ftp_pasv";
     $x13d = "ftp_put";
     $x13e = "ftp_close";
     ini_set('memory_limit', Mage::getStoreConfig("datafeedmanager/system/memory_limit") . 'M');
     error_reporting(Mage::getStoreConfig("datafeedmanager/system/error_reporting"));
     $this->_debug = isset($_GET['debug']) ? true : false;
     $this->_log = Mage::getStoreConfig("datafeedmanager/system/log_enabled");
     if ($this->_debug) {
         echo "----------------------------------------------<br>------------ DEBUG MODE ----------------<br>----------------------------------------------<br><br>";
         $x128($x66);
     }
     $x67 = $this->_indexPhp;
     $x68 = array("ac" => "activation_code", "ak" => "activation_key", "bu" => "base_url", "md" => "md5", "th" => "this", "dm" => "_demo", "ext" => "dfm", "ver" => "6.5.0");
     $x129(Mage::app()->getRequest()->getParam("store_id")) ? $x69 = Mage::app()->getRequest()->getParam("store_id") : ($x69 = $this->getStoreId());
     $x6a = Mage::getSingleton('core/date')->gmtDate('Y-m-d');
     $x6b = Mage::getDesign()->getSkinUrl();
     $x6c = Mage::getStoreConfig("catalog/placeholder/image_placeholder", $x69);
     $x6d = Mage::getStoreConfig("currency/options/base", $x69);
     $x6e = Mage::getStoreConfig("cataloginventory/item_options/manage_stock", $x69);
     $x6f = Mage::getStoreConfig("cataloginventory/item_options/backorders", $x69);
     $x70 = Mage::app()->getStore($x69)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB, false);
     $x71 = Mage::getModel('core/store')->load($x69)->getBaseUrl();
     $x72 = Mage::app()->getStore($x69)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA, false);
     $x73 = Mage::getStoreConfig(Mage_Tax_Model_Config::CONFIG_XML_PATH_PRICE_INCLUDES_TAX, $x69);
     $x74 = Mage::app()->getStore($x69)->getRootCategoryId();
     $x75 = array("activation_key" => Mage::getStoreConfig("datafeedmanager/license/activation_key"), "activation_code" => Mage::getStoreConfig("datafeedmanager/license/activation_code"), "base_url" => Mage::getStoreConfig("web/secure/base_url"));
     $x129(Mage::app()->getRequest()->getParam("feed_product")) ? $x76 = Mage::app()->getRequest()->getParam("feed_product") : ($x76 = $this->getFeed_product());
     $x129(Mage::app()->getRequest()->getParam("feed_header")) ? $x63 = Mage::app()->getRequest()->getParam("feed_header") : ($x63 = $this->getFeed_header());
     $x129(Mage::app()->getRequest()->getParam("feed_footer")) ? $x77 = Mage::app()->getRequest()->getParam("feed_footer") : ($x77 = $this->getFeed_footer());
     $x129(Mage::app()->getRequest()->getParam("feed_type")) ? $x78 = Mage::app()->getRequest()->getParam("feed_type") : ($x78 = $this->getFeed_type());
     $x129(Mage::app()->getRequest()->getParam("feed_extraheader")) ? $x79 = Mage::app()->getRequest()->getParam("feed_extraheader") : ($x79 = $this->getFeed_extraheader());
     $x129(Mage::app()->getRequest()->getParam("feed_include_header")) ? $x7a = Mage::app()->getRequest()->getParam("feed_include_header") : ($x7a = $this->getFeed_include_header());
     $x129(Mage::app()->getRequest()->getParam("feed_separator")) ? $x5e = Mage::app()->getRequest()->getParam("feed_separator") : ($x5e = $this->getFeed_separator());
     $x129(Mage::app()->getRequest()->getParam("feed_protector")) ? $x5f = Mage::app()->getRequest()->getParam("feed_protector") : ($x5f = $this->getFeed_protector());
     $x129(Mage::app()->getRequest()->getParam("feed_escape")) ? $x60 = Mage::app()->getRequest()->getParam("feed_escape") : ($x60 = $this->getFeed_escape());
     $x129(Mage::app()->getRequest()->getParam("feed_satus")) ? $x7b = Mage::app()->getRequest()->getParam("feed_satus") : ($x7b = $this->getFeed_status());
     $x129(Mage::app()->getRequest()->getParam("feed_enclose_data")) ? $x7c = Mage::app()->getRequest()->getParam("feed_enclose_data") : ($x7c = $this->getFeed_enclose_data());
     $x129(Mage::app()->getRequest()->getParam("feed_clean_data")) ? $x7d = Mage::app()->getRequest()->getParam("feed_clean_data") : ($x7d = $this->getFeed_clean_data());
     $x129(Mage::app()->getRequest()->getParam("datafeedmanager_categories")) ? $x7e = $x125(Mage::app()->getRequest()->getParam("datafeedmanager_categories")) : ($x7e = $x125($this->getDatafeedmanagerCategories()));
     $x129(Mage::app()->getRequest()->getParam("datafeedmanager_category_filter")) ? $x7f = Mage::app()->getRequest()->getParam("datafeedmanager_category_filter") : ($x7f = $this->getDatafeedmanagerCategoryFilter());
     $x129(Mage::app()->getRequest()->getParam("datafeedmanager_categories")) ? $x66 = Mage::app()->getRequest()->getParam("datafeedmanager_categories") : ($x66 = $this->getDatafeedmanagerCategories());
     $x129(Mage::app()->getRequest()->getParam("feed_encoding")) ? $this->_feed_encoding = Mage::app()->getRequest()->getParam("feed_encoding") : ($this->_feed_encoding = $this->getFeed_encoding());
     $x80 = $this->getFtpEnabled();
     $x81 = $this->getFtpHost();
     $x82 = $this->getFtpLogin();
     $x83 = $this->getFtpPassword();
     $x84 = $this->getFtpDir();
     $x85 = $this->getFtpActive();
     $x86 = array();
     $x87 = array();
     if ($x66 != '*' && $x126($x7e)) {
         foreach ($x7e as $x88) {
             if ($x88->checked) {
                 $x86[] = $x88->line;
             }
         }
         foreach ($x7e as $x88) {
             if ($x88->mapping != "") {
                 $x87[$x88->line] = $x88->mapping;
             }
         }
     }
     if ($x11c($x86) < 1) {
         $x86[] = '*';
     }
     $x129(Mage::app()->getRequest()->getParam("datafeedmanager_type_ids")) ? $x89 = $x11e(',', Mage::app()->getRequest()->getParam("datafeedmanager_type_ids")) : ($x89 = $x11e(',', $this->getDatafeedmanagerTypeIds()));
     $x129(Mage::app()->getRequest()->getParam("datafeedmanager_visibility")) ? $x8a = $x11e(',', Mage::app()->getRequest()->getParam("datafeedmanager_visibility")) : ($x8a = $x11e(',', $this->getDatafeedmanagerVisibility()));
     $x129(Mage::app()->getRequest()->getParam("datafeedmanager_attributes")) ? $x8b = $x125(Mage::app()->getRequest()->getParam("datafeedmanager_attributes")) : ($x8b = $x125($this->getDatafeedmanagerAttributes()));
     if ($this->_log) {
         Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> --------------- START PROCESS FOR " . strtoupper($this->getFilename(false)) . "-----------------", null, $this->getFilename('.log'));
     }
     if ($x75[$x68['ac']] != $x68["md"]($x68["md"]($x75[$x68['ak']]) . $x68["md"]($x75[$x68['bu']]) . $x68["md"]($x68["ext"]) . $x68["md"]($x68["ver"]))) {
         ${$x68}["ext"] = "valid";
         ${$x68}["th"]->{$x68}["dm"] = true;
     } else {
         ${$x68}["th"]->{$x68}["dm"] = false;
         ${$x68}["ext"] = "valid";
     }
     if (!$x7b && !$this->_display) {
         Mage::throwException(Mage::helper("datafeedmanager")->__("The data feed configuration must be enabled in order to generate a file."));
     }
     $x43 = new Varien_Io_File();
     $x43->setAllowCreateFolders(true);
     if (!$this->_display) {
         $x43->open(array('path' => $this->getPath()));
         if ($x43->fileExists($this->getFilename()) && !$x43->isWriteable($this->getFilename())) {
             Mage::throwException(Mage::helper('datafeedmanager')->__('File "%s" cannot be saved. Please, make sure the directory "%s" is writeable by web server.', $this->getFilename(), $this->getPath()));
         }
         $x43->streamOpen($this->getFilename());
         if ($this->_log) {
             Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> " . $this->getFilename() . " created and opened", null, $this->getFilename('.log'));
         }
     }
     if (!isset(${$x68}["ext"]) || ${$x68}["th"]->{$x68}["dm"]) {
         ${$x68}["th"]->{$x68}["dm"] = true;
         return ${$x68}["th"];
     }
     $x8c = '';
     $x8d = '';
     header("Content-Type: text/html; charset=utf-8");
     $x3f = '/{([a-zA-Z_0-9:]+)(\\sparent|\\sgrouped|\\sconfigurable|\\sbundle)?([^}]*)}/';
     $x118($x3f, $x76, $x40);
     $x40[0][] = "{categories,[1],[1],[1]}";
     $x40[1][] = "categories";
     $x40[2][] = "";
     $x40[3][] = ",[1],[1],[1]";
     $x8e = array();
     $x8f = array();
     foreach ($x40[1] as $x41 => $x90) {
         $x8e[$x41]['methodName'] = "get" . $x116(' ', '', $x12a($x120($x90)) . '()');
         $x8e[$x41]['pattern'] = "{" . $x120($x90) . "}";
         $x8e[$x41]['fullpattern'] = $x40[0][$x41];
         $x8e[$x41]['name'] = $x120($x90);
         $x8e[$x41]['reference'] = $x120($x40[2][$x41]);
         if (empty($x8e[$x41]['reference'])) {
             $x8e[$x41]['reference'] = 'self';
         }
         switch ($x8e[$x41]['name']) {
             case 'url':
                 $x12b($x8f, 'url_key');
                 break;
             case 'uri':
                 $x12b($x8f, 'url_key');
                 break;
             case 'G:IMAGE_LINK':
                 $x12b($x8f, 'image');
                 $x12b($x8f, 'small_image');
                 $x12b($x8f, 'thumbnail');
                 break;
             case 'SC:IMAGES':
                 $x12b($x8f, 'image');
                 $x12b($x8f, 'small_image');
                 $x12b($x8f, 'thumbnail');
                 break;
             case 'SC:DESCRIPTION':
                 $x12b($x8f, 'description');
                 $x12b($x8f, 'short_description');
                 $x12b($x8f, 'manufacturer');
                 $x12b($x8f, 'name');
                 $x12b($x8f, 'sku');
                 break;
             case 'SC:EAN':
                 $x12b($x8f, 'ean');
                 break;
             case 'SC:URL':
                 $x12b($x8f, 'url_key');
                 $x12b($x8f, 'url');
                 break;
             case 'sc:images':
                 $x12b($x8f, 'image');
                 $x12b($x8f, 'small_image');
                 $x12b($x8f, 'thumbnail');
                 break;
             case 'sc:description':
                 $x12b($x8f, 'description');
                 $x12b($x8f, 'short_description');
                 $x12b($x8f, 'manufacturer');
                 $x12b($x8f, 'name');
                 $x12b($x8f, 'sku');
                 break;
             case 'sc:ean':
                 $x12b($x8f, 'ean');
                 break;
             case 'sc:url':
                 $x12b($x8f, 'url_key');
                 $x12b($x8f, 'url');
                 break;
             default:
                 $x12b($x8f, $x8e[$x41]['name']);
         }
         include Mage::getBaseDir() . "/app/code/local/Wyomind/Datafeedmanager/myRequiredAttributes.php";
         $x8e[$x41]["value"] = '$product->get' . $x8e[$x41]['name'] . "()";
         $x8e[$x41]["getText"] = 'getAttributeText(\'' . $x120($x90) . '\')';
         $x91 = '/\\[([^\\]]+)\\]/';
         $x118($x91, $x40[3][$x41], $x92);
         $x8e[$x41]["options"] = $x92[1];
     }
     if ($this->_debug) {
         echo "<br><br>------------ ATTRIBUTES REQUIRED ----------------<br>";
         $x128($x8e);
     }
     $x93 = Mage::getModel('catalog/category')->getCollection()->setStoreId($x69)->addAttributeToSelect('name')->addAttributeToSelect('is_active')->addAttributeToSelect('include_in_menu');
     $x66 = array();
     foreach ($x93 as $x94) {
         $x66[$x94->getId()]['name'] = $x94->getName();
         $x66[$x94->getId()]['path'] = $x94->getPath();
         $x66[$x94->getId()]['level'] = $x94->getLevel();
         if ($x12c(Mage::getVersion(), '1.6.0', '<') || Mage::getStoreConfig("datafeedmanager/system/include_in_menu")) {
             $x66[$x94->getId()]['include_in_menu'] = true;
         } else {
             $x66[$x94->getId()]['include_in_menu'] = $x94->getIncludeInMenu();
         }
     }
     if ($this->_debug) {
         echo "<br><br>------------ CATEGORIES ----------------<br>";
         $x128($x66);
     }
     if ($this->_log) {
         Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Product template analyzed", null, $this->getFilename('.log'));
     }
     $x95 = Mage::getSingleton('core/resource');
     $x96 = $x95->getConnection('core_read');
     $x97 = $x95->getTableName('eav_entity_type');
     $x98 = $x96->select()->from($x97)->where('entity_type_code=\'catalog_product\'');
     $x5a = $x96->fetchAll($x98);
     $x99 = $x5a[0]['entity_type_id'];
     $x95 = Mage::getSingleton('core/resource');
     $x96 = $x95->getConnection('core_read');
     $x9a = $x95->getTableName('directory_currency_rate');
     $x98 = $x96->select()->from($x9a)->where('currency_from=\'' . $x6d . '\'');
     $x49 = $x96->fetchAll($x98);
     $x9b = array();
     foreach ($x49 as $x48) {
         $x9b[$x48['currency_to']] = $x48['rate'];
     }
     $this->_currencies = $x9b;
     if ($this->_debug) {
         echo "<br><br>------------ CURRENCIES ----------------<br>";
         $x128($x9b);
     }
     if ($this->_log) {
         Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Currencies rate collected", null, $this->getFilename('.log'));
     }
     $x9c = Mage::getResourceModel('eav/entity_attribute_collection')->setEntityTypeFilter($x99)->addSetInfo()->getData();
     $x9d = array();
     $x9e = array();
     foreach ($x9c as $x41 => $x90) {
         if ($x12d($x90['attribute_code'], $x8f)) {
             $x12b($x9d, $x90['attribute_code']);
             $x9e[$x90['attribute_code']] = $x90['frontend_input'];
         }
     }
     if (!$x12d('special_price', $x9d)) {
         $x9d[] = 'special_price';
     }
     if (!$x12d('special_from_date', $x9d)) {
         $x9d[] = 'special_from_date';
     }
     if (!$x12d('special_to_date', $x9d)) {
         $x9d[] = 'special_to_date';
     }
     if (!$x12d('price_type', $x9d)) {
         $x9d[] = 'price_type';
     }
     if (!$x12d('price', $x9d)) {
         $x9d[] = 'price';
     }
     $x9d[] = 'tax_class_id';
     foreach ($x8b as $x9f) {
         if (!$x12d($x9f->code, $x9d) && $x9f->checked) {
             $x9d[] = $x9f->code;
         }
     }
     if ($this->_debug) {
         echo "<br><br>------------ ATTRIBUTES ----------------<br>";
         $x128($x9d);
     }
     if ($this->_log) {
         Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> List of required attributes collected", null, $this->getFilename('.log'));
     }
     $x95 = Mage::getSingleton('core/resource');
     $x96 = $x95->getConnection('core_read');
     $xa0 = $x95->getTableName('eav_attribute_option_value');
     $x98 = $x96->select();
     $x98->from($xa0);
     $x98->where("store_id=" . $x69 . ' OR store_id=0');
     $x98->order(array('option_id', 'store_id'));
     $xa1 = $x96->fetchAll($x98);
     foreach ($xa1 as $xa2) {
         $xa3[$xa2['option_id']][$xa2['store_id']] = $xa2['value'];
     }
     if ($this->_debug) {
         echo "<br><br>------------ ATTRIBUTES LABEL ----------------<br>";
         $x128($xa3);
     }
     if ($this->_log) {
         Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> List of attribute labels collected", null, $this->getFilename('.log'));
     }
     $xa4 = $x95->getTableName('tax_class');
     $xa5 = $x95->getTableName('tax_calculation');
     $xa6 = $x95->getTableName('tax_calculation_rate');
     $xa7 = $x95->getTableName('directory_country_region');
     $x98 = $x96->select();
     $x98->from($xa4)->order(array('class_id', 'tax_calculation_rate_id'));
     $x98->joinleft(array('tc' => $xa5), 'tc.product_tax_class_id = ' . $xa4 . '.class_id', 'tc.tax_calculation_rate_id');
     $x98->joinleft(array('tcr' => $xa6), 'tcr.tax_calculation_rate_id = tc.tax_calculation_rate_id', array('tcr.rate', 'tax_country_id', 'tax_region_id'));
     $x98->joinleft(array('dcr' => $xa7), 'dcr.region_id=tcr.tax_region_id', 'code');
     $xa8 = $x96->fetchAll($x98);
     $x4d = array();
     $x45 = '';
     foreach ($xa8 as $xa9) {
         if ($x45 != $xa9['class_id']) {
             $xaa = 0;
         } else {
             $xaa++;
         }
         $x45 = $xa9['class_id'];
         $x4d[$xa9['class_id']][$xaa]['rate'] = $xa9['rate'];
         $x4d[$xa9['class_id']][$xaa]['code'] = $xa9['code'];
         $x4d[$xa9['class_id']][$xaa]['country'] = $xa9['tax_country_id'];
     }
     $this->_rates = $x4d;
     if ($this->_debug) {
         echo "<br><br>------------ TAX CLASS ----------------<br>";
         $x128($x4d);
     }
     if ($this->_log) {
         Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Tax rate collected", null, $this->getFilename('.log'));
     }
     $xab = $x95->getTableName('review');
     $xac = $x95->getTableName('review_store');
     $xad = $x95->getTableName('rating_option_vote');
     $xae = $x96->select()->distinct('review_id');
     $xae->from(array("r" => $xab), array("COUNT(DISTINCT r.review_id) AS count", 'entity_pk_value'));
     $xae->joinleft(array('rs' => $xac), 'rs.review_id=r.review_id', 'rs.store_id');
     $xae->joinleft(array('rov' => $xad), 'rov.review_id=r.review_id', 'AVG(rov.percent) AS score');
     $xae->where("status_id=1 and entity_id=1");
     $xae->group(array('r.entity_pk_value', 'rs.store_id'));
     $xaf = $x96->select();
     $xaf->from(array("r" => $xab), array("COUNT(DISTINCT r.review_id) AS count", 'entity_pk_value', "(SELECT 0) AS  store_id"));
     $xaf->joinleft(array('rs' => $xac), 'rs.review_id=r.review_id', array());
     $xaf->joinleft(array('rov' => $xad), 'rov.review_id=r.review_id', 'AVG(rov.percent) AS score');
     $xaf->where("status_id=1 and entity_id=1");
     $xaf->group(array('r.entity_pk_value'));
     $x98 = $x96->select()->union(array($xae, $xaf));
     $x98->order(array('entity_pk_value', 'store_id'));
     $xb0 = $x96->fetchAll($x98);
     $xb1 = array();
     foreach ($xb0 as $xb2) {
         $xb1[$xb2['entity_pk_value']][$xb2['store_id']]["count"] = $xb2["count"];
         $xb1[$xb2['entity_pk_value']][$xb2['store_id']]['score'] = $xb2['score'];
     }
     if ($this->_log) {
         Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Reviews collected", null, $this->getFilename('.log'));
     }
     $x95 = Mage::getSingleton('core/resource');
     $x96 = $x95->getConnection('core_read');
     $xb3 = $x95->getTableName('catalog_product_entity_media_gallery');
     $xb4 = $x95->getTableName('catalog_product_entity_media_gallery_value');
     $x98 = $x96->select();
     $x98->from($xb3);
     $x98->joinleft(array('cpemgv' => $xb4), 'cpemgv.value_id = ' . $xb3 . '.value_id', array('cpemgv.position', 'cpemgv.disabled'));
     $x98->where("value<>TRIM('') AND (store_id=" . $x69 . ' OR store_id=0)');
     $x98->order(array('position', 'value_id'));
     $xb5 = $x96->fetchAll($x98);
     foreach ($xb5 as $xb6) {
         if ($xb6['disabled'] != 1 && $xb6['value'] != '') {
             $xb7[$xb6['entity_id']]['src'][] = $xb6['value'];
             $xb7[$xb6['entity_id']]['disabled'][] = $xb6['disabled'];
         }
     }
     if ($this->_debug) {
         echo "<br><br>------------ IMAGES ----------------<br>";
         $x128($xb7);
     }
     if ($this->_log) {
         Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Images collected", null, $this->getFilename('.log'));
     }
     $xb8 = $x95->getTableName("cataloginventory_stock_item");
     $xb9 = $x95->getTableName("core_url_rewrite");
     $x9a = $x95->getTableName('catalog_category_product');
     $xba = $x95->getTableName('catalog_category_product_index');
     $xbb = $x95->getTableName('catalog_product_index_price');
     $xbc = $x95->getTableName('catalog_product_super_link');
     $xbd = $x95->getTableName('catalog_product_link');
     $xbe = $x95->getTableName('catalog_product_bundle_selection');
     $x12c(Mage::getVersion(), '1.6.0', '<') ? $x92 = "options=''" : ($x92 = "ISNULL(options)");
     $xbf = Mage::getModel('catalog/product')->getCollection()->addStoreFilter($x69);
     if (Mage::getStoreConfig("datafeedmanager/system/disabled")) {
         $xbf->addFieldToFilter("status", array('gteq' => 1));
     } else {
         $xbf->addFieldToFilter("status", 1);
     }
     $xbf->addAttributeToFilter('type_id', array("in" => "configurable"));
     $xbf->addAttributeToFilter('visibility', array("nin" => 1));
     $xbf->addAttributeToSelect($x9d);
     $xbf->getSelect()->joinLeft($xbc . ' AS cpsl', 'cpsl.parent_id=e.entity_id ', array('child_ids' => 'GROUP_CONCAT( DISTINCT cpsl.product_id)'));
     $xbf->getSelect()->joinLeft($xb8 . ' AS stock', 'stock.product_id=e.entity_id', array('qty' => 'qty', 'is_in_stock' => 'is_in_stock', 'manage_stock' => 'manage_stock', 'use_config_manage_stock' => 'use_config_manage_stock'));
     if (Mage::getStoreConfig("datafeedmanager/system/urlrewrite")) {
         $xbf->getSelect()->joinLeft($xb9 . ' AS url', 'url.product_id=e.entity_id AND url.target_path NOT LIKE "%category%" AND is_system=1 AND ' . $x92 . ' AND url.store_id=' . $x69, array('request_path' => 'request_path'));
     }
     $xbf->getSelect()->joinLeft($x9a . ' AS categories', 'categories.product_id=e.entity_id');
     $xbf->getSelect()->joinLeft($xba . ' AS categories_index', 'categories_index.category_id=categories.category_id AND categories_index.product_id=categories.product_id AND categories_index.store_id=' . $x69, array('categories_ids' => 'GROUP_CONCAT( DISTINCT categories_index.category_id)'));
     $xbf->getSelect()->group(array('cpsl.parent_id'));
     $xc0 = array();
     foreach ($xbf as $xc1) {
         foreach ($x11e(",", $xc1->getChildIds()) as $xc2) {
             $xc0[$xc2] = $xc1;
             $xc3[$xc2]['categories_ids'] = $xc1->getCategories_ids();
             $xc3[$xc2]['parent_id'] = $xc1->getId();
             $xc3[$xc2]['parent_sku'] = $xc1->getSku();
             $xc3[$xc2]['parent_request_path'] = $xc1->getRequestPath();
         }
     }
     $this->configurable = $xc0;
     if ($this->_debug) {
         echo "<br><br>------------ CONFIGURABLES ----------------<br>";
         echo $xbf->getSelect() . '<br><br>';
         $x128($xc3);
     }
     if ($this->_log) {
         Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Relations with configurable products detected", null, $this->getFilename('.log'));
     }
     $xbf = Mage::getModel('catalog/product')->getCollection()->addStoreFilter($x69);
     if (Mage::getStoreConfig("datafeedmanager/system/disabled")) {
         $xbf->addFieldToFilter("status", array('gteq' => 1));
     } else {
         $xbf->addFieldToFilter("status", 1);
     }
     $xbf->addAttributeToFilter('type_id', array("in" => "configurable"));
     $xbf->addAttributeToFilter('visibility', array("nin" => 1));
     $xbf->getSelect()->joinLeft($xbc . ' AS cpsl', 'cpsl.parent_id=e.entity_id ');
     $xbf->getSelect()->joinLeft($xb8 . ' AS stock', 'stock.product_id=cpsl.product_id', array('qty' => 'SUM(qty)'));
     $xbf->getSelect()->group(array('cpsl.parent_id'));
     $xc4 = array();
     foreach ($xbf as $xc5) {
         $xc4[$xc5->getId()] = $xc5->getQty();
     }
     $this->configurableQty = $xc4;
     if ($this->_debug) {
         echo "<br><br>------------ CONFIGURABLES QTY ----------------<br>";
         echo $xbf->getSelect() . '<br><br>';
         $x128($xc4);
     }
     if ($this->_log) {
         Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Qty for configurable products calculated", null, $this->getFilename('.log'));
     }
     $xbf = Mage::getModel('catalog/product')->getCollection()->addStoreFilter($x69);
     if (Mage::getStoreConfig("datafeedmanager/system/disabled")) {
         $xbf->addFieldToFilter("status", array('gteq' => 1));
     } else {
         $xbf->addFieldToFilter("status", 1);
     }
     $xbf->addAttributeToFilter('type_id', array("in" => "grouped"));
     $xbf->addAttributeToFilter('visibility', array("nin" => 1));
     $xbf->addAttributeToSelect($x9d);
     $xbf->getSelect()->joinLeft($xbd . ' AS cpl', 'cpl.product_id=e.entity_id AND cpl.link_type_id=3', array('child_ids' => 'GROUP_CONCAT( DISTINCT cpl.linked_product_id)'));
     $xbf->getSelect()->joinLeft($xb8 . ' AS stock', 'stock.product_id=e.entity_id', array('qty' => 'qty', 'is_in_stock' => 'is_in_stock', 'manage_stock' => 'manage_stock', 'use_config_manage_stock' => 'use_config_manage_stock'));
     if (Mage::getStoreConfig("datafeedmanager/system/urlrewrite")) {
         $xbf->getSelect()->joinLeft($xb9 . ' AS url', 'url.product_id=e.entity_id AND url.target_path NOT LIKE "%category%" AND is_system=1 AND ' . $x92 . ' AND url.store_id=' . $x69, array('request_path' => 'request_path'));
     }
     $xbf->getSelect()->joinLeft($x9a . ' AS categories', 'categories.product_id=e.entity_id');
     $xbf->getSelect()->joinLeft($xba . ' AS categories_index', 'categories_index.category_id=categories.category_id AND categories_index.product_id=categories.product_id AND categories_index.store_id=' . $x69, array('categories_ids' => 'GROUP_CONCAT( DISTINCT categories_index.category_id)'));
     $xbf->getSelect()->group(array('cpl.product_id'));
     $xc6 = array();
     foreach ($xbf as $xc1) {
         foreach ($x11e(",", $xc1->getChildIds()) as $xc2) {
             $xc6[$xc2] = $xc1;
             $xc7[$xc2]['categories_ids'] = $xc1->getCategories_ids();
             $xc7[$xc2]['parent_id'] = $xc1->getId();
             $xc7[$xc2]['parent_sku'] = $xc1->getSku();
             $xc7[$xc2]['parent_request_path'] = $xc1->getRequestPath();
         }
     }
     $this->grouped = $xc6;
     if ($this->_debug) {
         echo "<br><br>------------ GROUPED ----------------<br>";
         echo $xbf->getSelect() . '<br><br>';
         $x128($xc7);
     }
     if ($this->_log) {
         Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Relations with grouped products detected", null, $this->getFilename('.log'));
     }
     $xbf = Mage::getModel('catalog/product')->getCollection()->addStoreFilter($x69);
     if (Mage::getStoreConfig("datafeedmanager/system/disabled")) {
         $xbf->addFieldToFilter("status", array('gteq' => 1));
     } else {
         $xbf->addFieldToFilter("status", 1);
     }
     $xbf->addAttributeToFilter('type_id', array("in" => "bundle"));
     $xbf->addAttributeToFilter('visibility', array("nin" => 1));
     $xbf->addAttributeToSelect($x9d);
     $xbf->getSelect()->joinLeft($xbe . ' AS cpbs', 'cpbs.parent_product_id=e.entity_id', array('child_ids' => 'GROUP_CONCAT( DISTINCT cpbs.product_id)'));
     $xbf->getSelect()->joinLeft($xb8 . ' AS stock', 'stock.product_id=e.entity_id', array('qty' => 'qty', 'is_in_stock' => 'is_in_stock', 'manage_stock' => 'manage_stock', 'use_config_manage_stock' => 'use_config_manage_stock'));
     if (Mage::getStoreConfig("datafeedmanager/system/urlrewrite")) {
         $xbf->getSelect()->joinLeft($xb9 . ' AS url', 'url.product_id=e.entity_id AND url.target_path NOT LIKE "%category%" AND is_system=1 AND ' . $x92 . ' AND url.store_id=' . $x69, array('request_path' => 'request_path'));
     }
     $xbf->getSelect()->joinLeft($x9a . ' AS categories', 'categories.product_id=e.entity_id');
     $xbf->getSelect()->joinLeft($xba . ' AS categories_index', 'categories_index.category_id=categories.category_id AND categories_index.product_id=categories.product_id AND categories_index.store_id=' . $x69, array('categories_ids' => 'GROUP_CONCAT( DISTINCT categories_index.category_id)'));
     $xbf->getSelect()->group(array('e.entity_id'));
     $xc8 = array();
     foreach ($xbf as $xc1) {
         foreach ($x11e(",", $xc1->getChildIds()) as $xc2) {
             $xc8[$xc2] = $xc1;
             $xc9[$xc2]['parent_id'] = $xc1->getId();
             $xc9[$xc2]['parent_sku'] = $xc1->getSku();
             $xc9[$xc2]['parent_request_path'] = $xc1->getRequestPath();
             $xc9[$xc2]['categories_ids'] = $xc1->getCategories_ids();
         }
     }
     $this->bundle = $xc8;
     if ($this->_debug) {
         echo "<br><br>------------ BUNDLE ----------------<br>";
         echo $xbf->getSelect() . '<br><br>';
         $x128($xc9);
     }
     if ($this->_log) {
         Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Relations with bundle products detected", null, $this->getFilename('.log'));
     }
     $xca = $x95->getTableName("catalog_product_option");
     $xcb = $x95->getTableName("catalog_product_option_title");
     $xcc = $x95->getTableName("catalog_product_option_type_value");
     $xcd = $x95->getTableName("catalog_product_option_type_title");
     $xce = $x95->getTableName("catalog_product_option_type_price");
     $xcf = $x96->select();
     $xcf->from(array("cpo" => $xca), array("product_id"));
     $xcf->joinleft(array("cpot" => $xcb), "cpot.option_id=cpo.option_id AND cpot.store_id=0", array("option" => "title", "option_id", "store_id"));
     $xcf->joinleft(array("cpotv" => $xcc), "cpotv.option_id = cpo.option_id", "sku");
     $xcf->joinleft(array("cpott" => $xcd), "cpott.option_type_id=cpotv.option_type_id AND cpott.store_id=cpot.store_id", "title AS value");
     $xcf->joinleft(array("cpotp" => $xce), "cpotp.option_type_id=cpotv.option_type_id AND cpotp.store_id=cpot.store_id", array("price", "price_type"));
     $x98 = $xcf->order(array("product_id", "cpotv.sort_order ASC"));
     $xb0 = $x96->fetchAll($x98);
     $xd0 = array();
     $xd1 = 0;
     foreach ($xb0 as $xd2) {
         $xd0[$xd2["product_id"]][$xd2["option"]]["options"][] = array("value" => $xd2["value"], "sku" => $xd2["sku"], "price" => $xd2["price"], "price_type" => $xd2["price_type"]);
         $xd1++;
     }
     $this->customOptions = $xd0;
     if ($this->_debug) {
         echo "<br><br>------------ CUSTOM OPTIONS ----------------<br>";
         echo $xcf . '<br><br>';
         $x128($xd0);
     }
     if ($this->_log) {
         Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Custom options collected", null, $this->getFilename('.log'));
     }
     $xd3 = new Wyomind_Datafeedmanager_Model_MyCustomOptions();
     $xd4 = new Wyomind_Datafeedmanager_Model_MyCustomAttributes();
     if ($this->_log) {
         Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Custom attributes/options scripts loaded", null, $this->getFilename('.log'));
     }
     $xbf = Mage::getModel('catalog/product')->getCollection()->addStoreFilter($x69);
     if (Mage::getStoreConfig("datafeedmanager/system/disabled")) {
         $xbf->addFieldToFilter("status", array('gteq' => 1));
     } else {
         $xbf->addFieldToFilter("status", 1);
     }
     $xbf->addAttributeToFilter("type_id", array("in" => $x89));
     $xbf->addAttributeToFilter("visibility", array("in" => $x8a));
     $xbf->addAttributeToSelect($x9d);
     $xd5 = array("eq" => "= '%s'", "neq" => "!= '%s'", "gteq" => ">= '%s'", "lteq" => "<= '%s'", "gt" => "> '%s'", "lt" => "< '%s'", "like" => "like '%s'", "nlike" => "not like '%s'", "null" => "is null", "notnull" => "is not null", "in" => "in (%s)", "nin" => "not in(%s)");
     $xd6 = '';
     $x55 = 0;
     foreach ($x8b as $x9f) {
         if ($x9f->checked) {
             if ($x9f->condition == 'in' || $x9f->condition == 'nin') {
                 if ($x9f->code == 'qty' || $x9f->code == 'is_in_stock') {
                     $xd7 = $x11e(',', $x9f->value);
                     $x9f->value = "'" . $x115($xd7, "','") . "'";
                 } else {
                     $x9f->value = $x11e(',', $x9f->value);
                 }
             }
             switch ($x9f->code) {
                 case 'qty':
                     if ($x55 > 0) {
                         $xd6 .= ' AND ';
                     }
                     $xd6 .= " qty " . $x12e($xd5[$x9f->condition], $x9f->value);
                     $x55++;
                     break;
                 case 'is_in_stock':
                     if ($x55 > 0) {
                         $xd6 .= ' AND ';
                     }
                     $xd6 .= " (is_in_stock " . $x12e($xd5[$x9f->condition], $x9f->value);
                     $xd6 .= " OR ( manage_stock " . $x12e($xd5[$x9f->condition], (int) (!$x9f->value));
                     $xd6 .= " AND use_config_manage_stock " . $x12e($xd5[$x9f->condition], (int) (!$x9f->value)) . ')';
                     $xd6 .= " OR (use_config_manage_stock " . $x12e($xd5[$x9f->condition], $x9f->value) . ' AND ' . $x6e . '=' . (int) $x9f->value . ' AND is_in_stock = ' . $x9f->value . ' )';
                     $xd6 .= ")";
                     $x55++;
                     break;
                 default:
                     $xbf->addFieldToFilter($x9f->code, array($x9f->condition => $x9f->value));
                     break;
             }
         }
     }
     $xbf->getSelect()->joinLeft($xb8 . ' AS stock', 'stock.product_id=e.entity_id', array('qty' => 'qty', 'is_in_stock' => 'is_in_stock', 'manage_stock' => 'manage_stock', 'use_config_manage_stock' => 'use_config_manage_stock'));
     if (Mage::getStoreConfig("datafeedmanager/system/urlrewrite")) {
         $xbf->getSelect()->joinLeft($xb9 . ' AS url', 'url.product_id=e.entity_id AND url.target_path NOT LIKE "%category%" AND is_system=1 AND ' . $x92 . ' AND url.store_id=' . $x69, array('request_path' => 'request_path'));
     }
     $xbf->getSelect()->joinLeft($x9a . ' AS categories', 'categories.product_id=e.entity_id');
     if ($x86[0] != '*') {
         $x5d = 0;
         $xd8 = null;
         foreach ($x86 as $x88) {
             if ($x5d > 0) {
                 $xd8 .= ',';
             }
             $xd8 .= $x12f($x11e('/', $x88));
             $x5d++;
         }
         $x7f ? $xd9 = "IN" : ($xd9 = "NOT IN");
         $xd8 = "AND categories_index.category_id " . $xd9 . " (" . $xd8 . ")";
         $xbf->getSelect()->joinInner($xba . ' AS categories_index', 'categories_index.category_id=categories.category_id AND categories_index.product_id=categories.product_id AND categories_index.store_id=' . $x69 . ' ' . $xd8, array('categories_ids' => 'GROUP_CONCAT(categories_index.category_id)'));
     } else {
         $xbf->getSelect()->joinLeft($xba . ' AS categories_index', 'categories_index.category_id=categories.category_id AND categories_index.product_id=categories.product_id AND categories_index.store_id=' . $x69, array('categories_ids' => 'GROUP_CONCAT(categories_index.category_id)'));
     }
     if ($x12c(Mage::getVersion(), '1.4.0', '>=')) {
         $xbf->getSelect()->joinLeft($xbb . ' AS price_index', 'price_index.entity_id=e.entity_id AND customer_group_id=0 AND price_index.website_id=' . Mage::getModel('core/store')->load($x69)->getWebsiteId(), array('min_price' => 'min_price', 'max_price' => 'max_price', 'tier_price' => 'tier_price', 'final_price' => 'final_price'));
     }
     if (!empty($xd6)) {
         $xbf->getSelect()->where($xd6);
     }
     if ($this->_log) {
         Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Main sql request: \n" . $xbf->getSelect(), null, $this->getFilename('.log'));
     }
     $xda = 0;
     $xdb = clone $xbf;
     $xdb->getSelect()->columns("COUNT(DISTINCT e.entity_id) As total");
     $this->_counter = $xdb->getFirstItem()->getTotal();
     $xdc = $x130($this->_counter / $this->_sqlSize);
     $x8c = '';
     $xdd = 1;
     if ($this->_log) {
         Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Total items calculated ({$this->_counter} in {$xdc} queries )", null, $this->getFilename('.log'));
     }
     $x63 = $this->x13f($x63, null, $x78, true);
     if ($x78 == 1 || $x78 != 1 && !$this->_display) {
         $x63 = $this->x143($x63);
     }
     if ($this->_display) {
         if ($x78 == 1) {
             $x8d = $this->x142($x63, $x7c, $x7d) . "";
         } else {
             $x8d = $x79 . '<br>';
             $x8d .= "<table style='border:2px solid grey; font-family:arial; font-size:12px' cellspacing=0 cellpadding=0 width='100%'>";
             if ($x7a) {
                 $x8d .= $this->x144($x63, true);
             }
         }
     } else {
         if ($x78 == 1) {
             $x43->streamWrite($this->x142($x63, $x7c, $x7d) . "");
         } else {
             if ($x79 != '') {
                 $x43->streamWrite($x79 . "\r\n");
             }
             if ($x7a) {
                 $x43->streamWrite($this->x145($x63, $x5e, $x5f, $x60));
             }
         }
     }
     if ($this->_log) {
         Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Header template parsed and added", null, $this->getFilename('.log'));
     }
     while ($xda < $xdc) {
         if ($this->_debug) {
             echo "<br><br>------------ SQL ----------------<br>";
             print $xbf->getSelect();
         }
         $xbf->getSelect()->limit($this->_sqlSize, $this->_sqlSize * $xda);
         $xbf->getSelect()->group(array('e.entity_id'));
         $xda++;
         if ($this->_log) {
             Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Fetching products from " . $this->_sqlSize * ($xda - 1) . " to " . $this->_sqlSize * $xda, null, $this->getFilename('.log'));
         }
         $xd1 = 1;
         foreach ($xbf as $product) {
             if ($this->_debug) {
                 echo "<br><br>------------ PRODUCT [ SKU -> " . $product->getSku() . " | ID -> " . $product->getId() . "]---------------<br>";
                 echo "categories : " . $product->getCategoriesIds() . ", Root id: " . $x74 . "<br>";
                 foreach ($x11e(',', $product->getCategoriesIds()) as $x41 => $x94) {
                     echo $x94 . "=>" . $x66[$x94]["path"] . "<br>";
                 }
             }
             if (!$x131('safe_mode')) {
                 $x132(60);
             }
             $x51 = $x76;
             foreach ($x8e as $x41 => $exp) {
                 $value = "";
                 $this->option = 0;
                 switch ($exp['pattern']) {
                     case '{load_options}':
                         $xb0 = 1;
                         $xde = array();
                         foreach ($exp['options'] as $x41 => $option) {
                             if (isset($xd0[$product->getId()][$option])) {
                                 $xb0 = $xb0 * $x11c($xd0[$product->getId()][$option]["options"]);
                                 $xde[$x41] = 0;
                             }
                         }
                         $x3f = array();
                         for ($xaa = 1; $xaa <= $xb0; $xaa++) {
                             $xdf = $x51;
                             foreach ($exp['options'] as $x41 => $option) {
                                 if (isset($xd0[$product->getId()][$option])) {
                                     $xdf = $x116("{" . $option . "_label}", $xd0[$product->getId()][$option]["options"][$xde[$x41]]['value'], $xdf);
                                     $xdf = $x116("{" . $option . "_sku}", $xd0[$product->getId()][$option]["options"][$xde[$x41]]['sku'], $xdf);
                                     $xdf = $x116("{" . $option . "_price}", $xd0[$product->getId()][$option]["options"][$xde[$x41]]['price'], $xdf);
                                     $xdf = $x116("{" . $option . "_type}", $xd0[$product->getId()][$option]["options"][$xde[$x41]]['price_type'], $xdf);
                                     if ($x41 > 0 || $x11c($xd0[$product->getId()]) == 1 || $x11c($exp['options']) < 2) {
                                         $xde[$x41]++;
                                     }
                                     if ($xde[$x41] >= $x11c($xd0[$product->getId()][$option]["options"])) {
                                         $xde[$x41] = 0;
                                         $xde[$x41 - 1]++;
                                     }
                                 }
                             }
                             $x3f[] = $xdf;
                         }
                         if ($x11c($x3f) > 0) {
                             if ($x78 == 1) {
                                 $x51 = $x115($x3f);
                             } else {
                                 $x51 = "[" . $x115(',', $x3f) . "]";
                             }
                         }
                         $this->skipOptions($x11c($exp['options']));
                         break;
                     case '{use_options}':
                         foreach ($exp['options'] as $x41 => $option) {
                             if (isset($xd0[$product->getId()][$option])) {
                                 $xe0 = array();
                                 $xe1 = array();
                                 $xe2 = array();
                                 foreach ($xd0[$product->getId()][$option]["options"] as $x56) {
                                     $xe0[] = $x56['value'];
                                     $xe1[] = $x56['sku'];
                                     $xe2[] = $x56['price'];
                                 }
                                 $x51 = $x116("{" . $option . "_label}", $x115(',', $xe0), $x51);
                                 $x51 = $x116("{" . $option . "_sku}", $x115(',', $xe1), $x51);
                                 $x51 = $x116("{" . $option . "_price}", $x115(',', $xe2), $x51);
                             }
                         }
                         $this->skipOptions($x11c($exp['options']));
                         break;
                     case '{id}':
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         $value = $xe3->getId();
                         break;
                     case '{inc}':
                         $value = $xdd;
                         break;
                     case '{final_price}':
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         $x47 = $xe3->getFinalePrice();
                         !isset($exp['options'][1]) ? $x4c = false : ($x4c = $exp['options'][1]);
                         $value = $this->x141($x47, $x73, $xe3->getTaxClassId(), $x4c);
                         !isset($exp['options'][0]) ? $x48 = $x6d : ($x48 = $exp['options'][0]);
                         $value = $this->x140($value, $x48);
                         $value = $x133($value, 2, '.', '');
                         $this->skipOptions(2);
                         break;
                     case '{tier_price}':
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         $x47 = $xe3->getTierPrice();
                         !isset($exp['options'][1]) ? $x4c = false : ($x4c = $exp['options'][1]);
                         $value = $this->x141($x47, $x73, $xe3->getTaxClassId(), $x4c);
                         !isset($exp['options'][0]) ? $x48 = $x6d : ($x48 = $exp['options'][0]);
                         $value = $this->x140($value, $x48);
                         $value = $x133($value, 2, '.', '');
                         $this->skipOptions(2);
                         break;
                     case '{min_price}':
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         $x47 = $xe3->getMinPrice();
                         !isset($exp['options'][1]) ? $x4c = false : ($x4c = $exp['options'][1]);
                         $value = $this->x141($x47, $x73, $xe3->getTaxClassId(), $x4c);
                         !isset($exp['options'][0]) ? $x48 = $x6d : ($x48 = $exp['options'][0]);
                         $value = $this->x140($value, $x48);
                         $value = $x133($value, 2, '.', '');
                         $this->skipOptions(2);
                         break;
                     case '{max_price}':
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         $x47 = $xe3->getMaxPrice();
                         !isset($exp['options'][1]) ? $x4c = false : ($x4c = $exp['options'][1]);
                         $value = $this->x141($x47, $x73, $xe3->getTaxClassId(), $x4c);
                         !isset($exp['options'][0]) ? $x48 = $x6d : ($x48 = $exp['options'][0]);
                         $value = $this->x140($value, $x48);
                         $value = $x133($value, 2, '.', '');
                         $this->skipOptions(2);
                         break;
                     case '{normal_price}':
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         if ($xe3->type_id == 'bundle') {
                             $x47 = $xe3->price;
                         } else {
                             $x47 = $xe3->getPrice();
                         }
                         !isset($exp['options'][1]) ? $x4c = false : ($x4c = $exp['options'][1]);
                         $value = $this->x141($x47, $x73, $xe3->getTaxClassId(), $x4c);
                         !isset($exp['options'][0]) ? $x48 = $x6d : ($x48 = $exp['options'][0]);
                         $value = $this->x140($value, $x48);
                         $value = $x133($value, 2, '.', '');
                         $this->skipOptions(2);
                         break;
                     case '{price}':
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         if ($xe3->getSpecialFromDate() && !$xe3->getSpecialToDate()) {
                             if ($xe3->getSpecialFromDate() <= date("Y-m-d H:i:s")) {
                                 if ($xe3->type_id == "bundle") {
                                     if (($xe3->price_type || !$xe3->price_type && $xe3->special_price < $xe3->price) && $xe3->special_price > 0) {
                                         if ($xe3->price_type) {
                                             $x47 = $x133($xe3->price * $xe3->special_price / 100, 2, ".", "");
                                         } else {
                                             $x47 = $xe3->special_price;
                                         }
                                     } else {
                                         $x47 = $xe3->price;
                                     }
                                 } else {
                                     $xe3->getSpecial_price() && $xe3->getSpecial_price() < $xe3->getPrice() ? $x47 = $xe3->getSpecialPrice() : ($x47 = $xe3->getPrice());
                                 }
                             } else {
                                 if ($xe3->type_id == "bundle") {
                                     $x47 = $xe3->price;
                                 } else {
                                     $x47 = $xe3->getPrice();
                                 }
                             }
                         } elseif ($xe3->getSpecialFromDate() && $xe3->getSpecialToDate()) {
                             if ($xe3->getSpecialFromDate() <= date("Y-m-d H:i:s") && date("Y-m-d H:i:s") < $xe3->getSpecialToDate()) {
                                 if ($xe3->type_id == "bundle") {
                                     if (($xe3->price_type || !$xe3->price_type && $xe3->special_price < $xe3->price) && $xe3->special_price > 0) {
                                         if ($xe3->price_type) {
                                             $x47 = $x133($xe3->price * $xe3->special_price / 100, 2, ".", "");
                                         } else {
                                             $x47 = $xe3->special_price;
                                         }
                                     } else {
                                         $x47 = $xe3->price;
                                     }
                                 } else {
                                     $xe3->getSpecial_price() && $xe3->getSpecial_price() < $xe3->getPrice() ? $x47 = $xe3->getSpecialPrice() : ($x47 = $xe3->getPrice());
                                 }
                             } else {
                                 if ($xe3->type_id == "bundle") {
                                     $x47 = $xe3->price;
                                 } else {
                                     $x47 = $xe3->getPrice();
                                 }
                             }
                         } else {
                             if ($xe3->type_id == "bundle") {
                                 if (($xe3->price_type || !$xe3->price_type && $xe3->special_price < $xe3->price) && $xe3->special_price > 0) {
                                     if ($xe3->price_type) {
                                         $x47 = $x133($xe3->price * $xe3->special_price / 100, 2, ".", "");
                                     } else {
                                         $x47 = $xe3->special_price;
                                     }
                                 } else {
                                     $x47 = $xe3->price;
                                 }
                             } else {
                                 $xe3->getSpecial_price() && $xe3->getSpecial_price() < $xe3->getPrice() ? $x47 = $xe3->getSpecialPrice() : ($x47 = $xe3->getPrice());
                             }
                         }
                         !isset($exp['options'][1]) ? $x4c = false : ($x4c = $exp['options'][1]);
                         $value = $this->x141($x47, $x73, $xe3->getTaxClassId(), $x4c);
                         !isset($exp["options"][0]) ? $x48 = $x6d : ($x48 = $exp["options"][0]);
                         $value = $this->x140($value, $x48);
                         $value = $x133($value, 2, ".", "");
                         $this->skipOptions(2);
                         break;
                     case "{is_special_price}":
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         !isset($exp["options"][0]) ? $xe4 = 1 : ($xe4 = $exp["options"][0]);
                         !isset($exp["options"][1]) ? $xe5 = 0 : ($xe5 = $exp["options"][1]);
                         if ($xe3->getSpecialFromDate() && !$xe3->getSpecialToDate()) {
                             if ($xe3->getSpecialFromDate() <= date("Y-m-d H:i:s")) {
                                 if ($xe3->type_id == "bundle") {
                                     ($xe3->price_type || !$xe3->price_type && $xe3->special_price < $xe3->price) && $xe3->special_price > 0 ? $value = $xe4 : ($value = $xe5);
                                 } else {
                                     $xe3->getSpecial_price() && $xe3->getSpecial_price() < $xe3->getPrice() ? $value = $xe4 : ($value = $xe5);
                                 }
                             } else {
                                 if ($xe3->type_id == "bundle") {
                                     $value = $xe5;
                                 } else {
                                     $value = $xe5;
                                 }
                             }
                         } elseif ($xe3->getSpecialFromDate() && $xe3->getSpecialToDate()) {
                             if ($xe3->getSpecialFromDate() <= date("Y-m-d H:i:s") && date("Y-m-d H:i:s") < $xe3->getSpecialToDate()) {
                                 if ($xe3->type_id == "bundle") {
                                     ($xe3->price_type || !$xe3->price_type && $xe3->special_price < $xe3->price) && $xe3->special_price > 0 ? $value = $xe4 : ($value = $xe5);
                                 } else {
                                     $xe3->getSpecial_price() && $xe3->getSpecial_price() < $xe3->getPrice() ? $value = $xe4 : ($value = $xe5);
                                 }
                             } else {
                                 if ($xe3->type_id == "bundle") {
                                     $value = $xe5;
                                 } else {
                                     $value = $xe5;
                                 }
                             }
                         } else {
                             if ($xe3->type_id == "bundle") {
                                 ($xe3->price_type || !$xe3->price_type && $xe3->special_price < $xe3->price) && $xe3->special_price > 0 ? $value = $xe4 : ($value = $xe5);
                             } else {
                                 $xe3->getSpecial_price() && $xe3->getSpecial_price() < $xe3->getPrice() ? $value = $xe4 : ($value = $xe5);
                             }
                         }
                         $this->skipOptions(2);
                         break;
                     case "{special_price}":
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         $x47 = null;
                         if ($xe3->getSpecialFromDate() && !$xe3->getSpecialToDate()) {
                             if ($xe3->getSpecialFromDate() <= date("Y-m-d H:i:s")) {
                                 if ($xe3->type_id == 'bundle') {
                                     if ($xe3->price_type) {
                                         $x47 = $x133($xe3->price * $xe3->special_price / 100, 2, ".", "");
                                     } else {
                                         $x47 = $xe3->special_price;
                                     }
                                 } else {
                                     $x47 = $xe3->getSpecial_price();
                                 }
                             }
                         } elseif ($xe3->getSpecialFromDate() && $xe3->getSpecialToDate()) {
                             if ($xe3->getSpecialFromDate() <= date("Y-m-d H:i:s") && date("Y-m-d H:i:s") < $xe3->getSpecialToDate()) {
                                 if ($xe3->type_id == 'bundle') {
                                     if ($xe3->price_type) {
                                         $x47 = $x133($xe3->price * $xe3->special_price / 100, 2, ".", "");
                                     } else {
                                         $x47 = $xe3->special_price;
                                     }
                                 } else {
                                     $x47 = $xe3->getSpecial_price();
                                 }
                             }
                         } else {
                             if ($xe3->type_id == 'bundle') {
                                 if ($xe3->price_type) {
                                     $x47 = $x133($xe3->price * $xe3->special_price / 100, 2, ".", "");
                                 } else {
                                     $x47 = $xe3->special_price;
                                 }
                             } else {
                                 $x47 = $xe3->getSpecial_price();
                             }
                         }
                         !isset($exp['options'][1]) ? $x4c = false : ($x4c = $exp['options'][1]);
                         if ($x47 > 0) {
                             $value = $this->x141($x47, $x73, $xe3->getTaxClassId(), $x4c);
                             !isset($exp['options'][0]) ? $x48 = $x6d : ($x48 = $exp['options'][0]);
                             $value = $this->x140($value, $x48);
                             $value = $x133($value, 2, '.', '');
                         } else {
                             $value = "";
                         }
                         $this->skipOptions(2);
                         break;
                     case '{price_rules}':
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         $x69 = $this->getStoreId();
                         $xe6 = Mage::getResourceModel('catalogrule/rule');
                         $xe7 = Mage::app()->getLocale()->storeTimeStamp($x69);
                         $xe8 = Mage::app()->getStore($x69);
                         $xe9 = $xe8->getWebsiteId();
                         $xea = Mage::getSingleton('customer/session')->getCustomerGroupId();
                         $xeb = $xe6->getRulePrice($xe7, $xe9, $xea, $xe3->getId());
                         if ($xe3->getSpecialFromDate() && !$xe3->getSpecialToDate()) {
                             if ($xe3->getSpecialFromDate() <= date("Y-m-d H:i:s")) {
                                 if ($xe3->type_id == "bundle") {
                                     if (($xe3->price_type || !$xe3->price_type && $xe3->special_price < $xe3->price) && $xe3->special_price > 0) {
                                         if ($xe3->price_type) {
                                             $x47 = $x133($xe3->price * $xe3->special_price / 100, 2, ".", "");
                                         } else {
                                             $x47 = $xe3->special_price;
                                         }
                                     } else {
                                         $x47 = $xe3->price;
                                     }
                                 } else {
                                     $xe3->getSpecial_price() && $xe3->getSpecial_price() < $xe3->getPrice() ? $x47 = $xe3->getSpecialPrice() : ($x47 = $xe3->getPrice());
                                 }
                             } else {
                                 if ($xe3->type_id == "bundle") {
                                     $x47 = $xe3->price;
                                 } else {
                                     $x47 = $xe3->getPrice();
                                 }
                             }
                         } elseif ($xe3->getSpecialFromDate() && $xe3->getSpecialToDate()) {
                             if ($xe3->getSpecialFromDate() <= date("Y-m-d H:i:s") && date("Y-m-d H:i:s") < $xe3->getSpecialToDate()) {
                                 if ($xe3->type_id == "bundle") {
                                     if (($xe3->price_type || !$xe3->price_type && $xe3->special_price < $xe3->price) && $xe3->special_price > 0) {
                                         if ($xe3->price_type) {
                                             $x47 = $x133($xe3->price * $xe3->special_price / 100, 2, ".", "");
                                         } else {
                                             $x47 = $xe3->special_price;
                                         }
                                     } else {
                                         $x47 = $xe3->price;
                                     }
                                 } else {
                                     $xe3->getSpecial_price() && $xe3->getSpecial_price() < $xe3->getPrice() ? $x47 = $xe3->getSpecialPrice() : ($x47 = $xe3->getPrice());
                                 }
                             } else {
                                 if ($xe3->type_id == "bundle") {
                                     $x47 = $xe3->price;
                                 } else {
                                     $x47 = $xe3->getPrice();
                                 }
                             }
                         } else {
                             if ($xe3->type_id == "bundle") {
                                 if (($xe3->price_type || !$xe3->price_type && $xe3->special_price < $xe3->price) && $xe3->special_price > 0) {
                                     if ($xe3->price_type) {
                                         $x47 = $x133($xe3->price * $xe3->special_price / 100, 2, ".", "");
                                     } else {
                                         $x47 = $xe3->special_price;
                                     }
                                 } else {
                                     $x47 = $xe3->price;
                                 }
                             } else {
                                 $xe3->getSpecial_price() && $xe3->getSpecial_price() < $xe3->getPrice() ? $x47 = $xe3->getSpecialPrice() : ($x47 = $xe3->getPrice());
                             }
                         }
                         if ($xeb !== FALSE) {
                             if ($xeb < $x47) {
                                 $value = $xeb;
                             } else {
                                 $value = $x47;
                             }
                         } else {
                             $value = $x47;
                         }
                         !isset($exp['options'][1]) ? $x4c = false : ($x4c = $exp['options'][1]);
                         $value = $this->x141($value, $x73, $xe3->getTaxClassId(), $x4c);
                         !isset($exp["options"][0]) ? $x48 = $x6d : ($x48 = $exp["options"][0]);
                         $value = $this->x140($value, $x48);
                         $value = $x133($value, 2, ".", "");
                         $this->skipOptions(2);
                         break;
                     case "{G:SALE_PRICE}":
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         $xec = $x116(' ', 'T', $xe3->getSpecialFromDate());
                         $xed = $x116(' ', 'T', $xe3->getSpecialToDate());
                         if ($xe3->type_id == 'bundle' && $xe3->special_price) {
                             if ($xe3->price_type) {
                                 $x47 = $x133($xe3->price * $xe3->special_price / 100, 2, ".", "");
                             } else {
                                 $x47 = $xe3->special_price;
                             }
                         } else {
                             $x47 = $xe3->getSpecial_price();
                         }
                         !isset($exp['options'][1]) ? $x4c = false : ($x4c = $exp['options'][1]);
                         if ($x47 > 0) {
                             $x47 = $this->x141($x47, $x73, $xe3->getTaxClassId(), $x4c);
                             !isset($exp['options'][0]) ? $x48 = $x6d : ($x48 = $exp['options'][0]);
                             $x47 = $this->x140($x47, $x48);
                             $x47 = $x133($x47, 2, '.', '');
                         }
                         if ($x47 > 0) {
                             $value = "<g:sale_price><![CDATA[" . $x47 . "]]></g:sale_price>\n";
                         }
                         if ($x47 > 0 && $xed) {
                             $value .= "<g:sale_price_effective_date><![CDATA[" . $xec . "/" . $xed . "]]></g:sale_price_effective_date>";
                         }
                         $this->skipOptions(2);
                         break;
                     case "{image}":
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         $xee = $xe3->getImage();
                         if (!isset($exp['options'][0]) || $exp['options'][0] == 0) {
                             if ($xe3->getImage() && $xe3->getImage() != 'no_selection') {
                                 $xef = 'catalog/product/' . $xe3->getImage();
                                 $value = $x72 . $x116('//', '/', $xef);
                             } else {
                                 $value = $x72 . '/catalog/product/placeholder/' . $x6c;
                             }
                         } elseif (isset($xb7[$xe3->getId()]['src'][$exp['options'][0] - 1]) && $exp['options'][0] > 0) {
                             if ($xb7[$xe3->getId()]['src'][$exp['options'][0] - 1] != $xee) {
                                 $xef = 'catalog/product/' . $xb7[$xe3->getId()]['src'][$exp['options'][0] - 1];
                                 $value = $x72 . $x116('//', '/', $xef);
                             }
                         }
                         $this->skipOptions(1);
                         break;
                     case "{G:IMAGE_LINK}":
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         $xee = $xe3->getImage();
                         $xf0 = array($xe3->getSmall_image(), $xe3->getThumbnail());
                         $xf1 = '';
                         $xde = 0;
                         if ($xe3->getImage() && $xe3->getImage() != 'no_selection') {
                             $xef = 'catalog/product/' . $xe3->getImage();
                             $value = $x72 . $x116('//', '/', $xef);
                             $xf1 .= "<g:image_link><![CDATA[" . $value . "]]></g:image_link>\n";
                             $xde++;
                         }
                         $xf2 = 0;
                         while (isset($xb7[$xe3->getId()]['src'][$xf2]) && $xde < 10) {
                             if ($xb7[$xe3->getId()]['src'][$xf2] != $xee) {
                                 if ($x12d($xb7[$xe3->getId()]['src'][$xf2], $xf0) || $xb7[$xe3->getId()]['disabled'][$xf2] != 1) {
                                     $xef = 'catalog/product/' . $xb7[$xe3->getId()]['src'][$xf2];
                                     $value = $x72 . $x116('//', '/', $xef);
                                     $xf1 .= "<g:additional_image_link><![CDATA[" . $value . "]]></g:additional_image_link>\n";
                                     $xde++;
                                 }
                             }
                             $xf2++;
                         }
                         $value = $xf1;
                         break;
                     case "{url}":
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         if ($xe3->getRequest_path()) {
                             $value = $x71 . $xe3->getRequest_path();
                         } else {
                             $value = $xe3->getProductUrl();
                         }
                         break;
                     case "{host}":
                         $value = $x71;
                         break;
                     case "{uri}":
                         isset($exp['options'][0]) ? $xf3 = $exp['options'][0] : ($xf3 = "");
                         isset($exp['options'][1]) ? $xf4 = $exp['options'][1] : ($xf4 = "");
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         if ($xe3->getRequest_path()) {
                             $value = $xf4 . '' . $xe3->getRequest_path() . $xf3;
                         } else {
                             $value = $x116($x71, '', $xe3->getProductUrl());
                         }
                         break;
                     case '{is_in_stock}':
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         !isset($exp['options'][0]) ? $xf5 = 'in stock' : ($xf5 = $exp['options'][0]);
                         !isset($exp['options'][1]) ? $xf6 = "out of stock" : ($xf6 = $exp['options'][1]);
                         !isset($exp['options'][2]) ? $x6f = "available for order" : ($x6f = $exp['options'][2]);
                         if ($xe3->getManageStock() || $xe3->getUseConfigManageStock() && $x6e) {
                             if ($xe3->getIs_in_stock() > 0) {
                                 $value = $xf5;
                             } else {
                                 if ($xe3->getBackorders() || $xe3->getUseConfigBackorders() && $x6f) {
                                     $value = $x6f;
                                 } else {
                                     $value = $xf6;
                                 }
                             }
                         } else {
                             $value = $xf5;
                         }
                         $this->skipOptions(3);
                         break;
                     case '{stock_status}':
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         $xe3->getIs_in_stock() > 0 ? $value = Mage::helper('datafeedmanager')->__('in stock') : ($value = Mage::helper('datafeedmanager')->__('out of stock'));
                         break;
                     case '{qty}':
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         !isset($exp['options'][0]) ? $xf7 = 0 : ($xf7 = $exp['options'][0]);
                         if ($product->type_id == "configurable") {
                             $value = $xc4[$product->getId()];
                             $value = $x133($value, $xf7, '.', '');
                         } else {
                             if ($exp['reference'] == "configurable") {
                                 $value = $x133($xc4[$xe3->getId()], $xf7, '.', '');
                             } else {
                                 $value = $x133($xe3->getQty(), $xf7, '.', '');
                             }
                         }
                         $this->skipOptions(1);
                         break;
                     case "{categories}":
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         !isset($exp['options'][0]) || !$exp['options'][0] || $exp['options'][0] == 'INF' ? $xf8 = INF : ($xf8 = $exp['options'][0]);
                         !isset($exp['options'][1]) ? $xf9 = 1 : ($xf9 = $exp['options'][1]);
                         !isset($exp['options'][2]) || !$exp['options'][2] || $exp['options'][2] == 'INF' ? $xfa = INF : ($xfa = $exp['options'][2]);
                         $xfb = 0;
                         $value = '';
                         $xfc = '';
                         foreach ($x11e(',', $xe3->getCategoriesIds()) as $x41 => $x94) {
                             $x7f ? $xfd = $x12d($x66[$x94]["path"], $x86) : ($xfd = !$x12d($x66[$x94]["path"], $x86));
                             if (isset($x66[$x94]) && $xfb < $xf8 && ($xfd || $x86[0] == "*")) {
                                 $xfe = 0;
                                 $xff = $x11e('/', $x66[$x94]["path"]);
                                 if ($x12d($x74, $xff)) {
                                     $x100 = "";
                                     if ($xfb > 0) {
                                         $xfc = ",";
                                     }
                                     foreach ($xff as $x101) {
                                         if (isset($x66[$x101])) {
                                             if ($x66[$x101]['level'] > $xf9 && $xfe < $xfa) {
                                                 if ($xfe > 0) {
                                                     $x100 .= ' > ';
                                                 }
                                                 $x100 .= $x66[$x101]['name'];
                                                 $xfe++;
                                             }
                                         }
                                     }
                                     $x102 = "";
                                     if (!empty($x100)) {
                                         $value .= $xfc . $x100 . $x102;
                                         $xfb++;
                                     }
                                 }
                             }
                         }
                         $this->skipOptions(3);
                         break;
                     case "{G:PRODUCT_TYPE}":
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         !isset($exp['options'][0]) || !$exp['options'][0] || $exp['options'][0] == 'INF' ? $xf8 = INF : ($xf8 = $exp['options'][0]);
                         !isset($exp['options'][1]) ? $xf9 = 1 : ($xf9 = $exp['options'][1]);
                         !isset($exp['options'][2]) || !$exp['options'][2] || $exp['options'][2] == 'INF' ? $xfa = INF : ($xfa = $exp['options'][2]);
                         $xfb = 0;
                         $value = '';
                         foreach ($x11e(',', $xe3->getCategoriesIds()) as $x41 => $x94) {
                             $x7f ? $xfd = $x12d($x66[$x94]["path"], $x86) : ($xfd = !$x12d($x66[$x94]["path"], $x86));
                             if (@$x66[$x94]["include_in_menu"] && isset($x66[$x94]) && $xfb < $xf8 && ($xfd || $x86[0] == "*")) {
                                 $xfe = 0;
                                 $xff = $x11e('/', $x66[$x94]["path"]);
                                 if ($x12d($x74, $xff)) {
                                     $x100 = '';
                                     $xfc = '<g:product_type><![CDATA[';
                                     foreach ($xff as $x101) {
                                         if (isset($x66[$x101])) {
                                             if ($x66[$x101]['level'] > $xf9 && $xfe < $xfa) {
                                                 if ($xfe > 0) {
                                                     $x100 .= ' > ';
                                                 }
                                                 $x100 .= $x66[$x101]['name'];
                                                 $xfe++;
                                             }
                                         }
                                     }
                                     $x102 = "]]></g:product_type>\n";
                                     if (!empty($x100)) {
                                         $value .= $xfc . $x100 . $x102;
                                         $xfb++;
                                     }
                                 }
                             }
                         }
                         $this->skipOptions(3);
                         break;
                     case "{G:GOOGLE_PRODUCT_CATEGORY}":
                         isset($exp["options"][0]) ? $x103 = $exp["options"][0] : ($x103 = 0);
                         $value = "";
                         $x104 = 0;
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         foreach ($x11e(',', $xe3->getCategoriesIds()) as $x41 => $x94) {
                             if (isset($x66[$x94]["path"]) && isset($x87[$x66[$x94]["path"]])) {
                                 if ($x104 == $x103) {
                                     $value .= "<g:google_product_category><![CDATA[" . $x87[$x66[$x94]["path"]] . "]]></g:google_product_category>\n";
                                     break;
                                 }
                                 $x104++;
                             }
                         }
                         $this->skipOptions(1);
                         break;
                     case "{category_mapping}":
                         isset($exp["options"][0]) ? $x103 = $exp["options"][0] : ($x103 = 0);
                         $value = "";
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         $x104 = 0;
                         foreach ($x11e(',', $xe3->getCategoriesIds()) as $x41 => $x94) {
                             if (isset($x87[$x66[$x94]["path"]])) {
                                 if ($x104 == $x103) {
                                     $value .= $x87[$x66[$x94]["path"]];
                                     break;
                                 }
                                 $x104++;
                             }
                         }
                         $this->skipOptions(1);
                         break;
                     case "{review_count}":
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         $value = "";
                         isset($exp["options"][0]) && $exp["options"][0] == "*" ? $x105 = 0 : ($x105 = $x69);
                         if (isset($xb1[$xe3->getId()][$x105]["count"])) {
                             $x106 = $xb1[$xe3->getId()][$x105]["count"];
                             if (isset($x106)) {
                                 $value .= $x106;
                             }
                         }
                         $this->skipOptions(1);
                         break;
                     case "{review_average}":
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         $value = "";
                         isset($exp["options"][0]) && $exp["options"][0] == "*" ? $x105 = 0 : ($x105 = $x69);
                         !isset($exp["options"][1]) || !$exp["options"][1] ? $x107 = 5 : ($x107 = $exp["options"][1]);
                         if (isset($xb1[$xe3->getId()][$x105]["score"])) {
                             $x108 = $x133($xb1[$xe3->getId()][$x105]["score"] * $x107 / 100, 2, ".", "");
                             if (isset($x108)) {
                                 $value .= $x108;
                             }
                         }
                         $this->skipOptions(2);
                         break;
                     case "{G:PRODUCT_REVIEW}":
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         isset($exp["options"][0]) && $exp["options"][0] == "*" ? $x105 = 0 : ($x105 = $x69);
                         !isset($exp["options"][1]) || !$exp["options"][1] ? $x107 = 5 : ($x107 = $exp["options"][1]);
                         $value = "";
                         if (isset($xb1[$xe3->getId()][$x105]["count"])) {
                             $x106 = $xb1[$xe3->getId()][$x105]["count"];
                             $x108 = $x133($xb1[$xe3->getId()][$x105]["score"] * $x107 / 100, 2, ".", "");
                         }
                         if (isset($x108) && $x108 > 0) {
                             $value .= "<g:product_review_average><![CDATA[" . $x108 . "]]></g:product_review_average>\n";
                         }
                         if (isset($x106) && $x106 > 0) {
                             $value .= "<g:product_review_count><![CDATA[" . $x106 . "]]></g:product_review_count>\n";
                         }
                         unset($x108);
                         unset($x106);
                         break;
                     case "{G:ITEM_GROUP_ID}":
                         if (isset($this->configurable[$product->getId()])) {
                             $xe3 = $this->checkReference('configurable', $product);
                             $value = "<g:item_group_id><![CDATA[" . $xe3->getSku() . "]]></g:item_group_id>";
                         }
                         break;
                     case "{SC:EAN}":
                         $x11d($exp['options'][0]) && $exp['options'][0] > 0 ? $x109 = $exp['options'][0] : ($x109 = 0);
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         $value = $x11e(',', $xe3->getEan());
                         $value = "<g:ean><![CDATA[" . $value[$x109] . "]]></g:ean>";
                         break;
                     case "{sc:ean}":
                         $x11d($exp['options'][0]) && $exp['options'][0] > 0 ? $x109 = $exp['options'][0] : ($x109 = 0);
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         $value = $x11e(',', $xe3->getEan());
                         $value = $value[$x109];
                         break;
                     case "{SC:IMAGES}":
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         $xee = $xe3->getSmall_image();
                         $xf0 = array($xe3->getImage(), $xe3->getThumbnail());
                         $xf1 = '';
                         $xde = 0;
                         if ($xe3->getSmall_image() && $xe3->getSmall_image() != 'no_selection') {
                             $xef = $xe3->getSmall_image();
                             $value = $xef;
                             $xf1 .= "<g:image_link><![CDATA[" . $value . "]]></g:image_link>\n";
                             $xde++;
                         }
                         $xf2 = 0;
                         while (isset($xb7[$xe3->getId()]['src'][$xf2]) && $xde < 10) {
                             if ($xb7[$xe3->getId()]['src'][$xf2] != $xee) {
                                 if ($x12d($xb7[$xe3->getId()]['src'][$xf2], $xf0) || $xb7[$xe3->getId()]['disabled'][$xf2] != 1) {
                                     $xef = $xb7[$xe3->getId()]['src'][$xf2];
                                     $value = $xef;
                                     $xf1 .= "<g:additional_image_link><![CDATA[" . $value . "]]></g:additional_image_link>\n";
                                     $xde++;
                                 }
                             }
                             $xf2++;
                         }
                         $value = $xf1;
                         break;
                     case "{sc:images}":
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         $xee = $xe3->getSmall_image();
                         if (!isset($exp['options'][0]) || $exp['options'][0] == 0) {
                             if ($xe3->getSmall_image() && $xe3->getSmall_image() != 'no_selection') {
                                 $xef = $xe3->getSmall_image();
                                 $value = $xef;
                             } else {
                                 $value = $x72 . '/catalog/product/placeholder/' . $x6c;
                             }
                         } elseif (isset($xb7[$xe3->getId()]['src'][$exp['options'][0] - 1]) && $exp['options'][0] > 0) {
                             if ($xb7[$xe3->getId()]['src'][$exp['options'][0] - 1] != $xee) {
                                 $xef = 'catalog/product/' . $xb7[$xe3->getId()]['src'][$exp['options'][0] - 1];
                                 $value = $x72 . $x116('//', '/', $xef);
                             }
                         }
                         $this->skipOptions(1);
                         break;
                     case "{SC:DESCRIPTION}":
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         $x10a = $xe3->getDescription() . $xe3->getShortDescription();
                         $x10b = "|<iframe(.*)</iframe>|U";
                         $x119($x10b, $x10a, $x10c);
                         if ($x10c) {
                             $x10a = $xe3->getAttributeText('manufacturer') . " " . $xe3->getName() . " - Part number: " . $xe3->getSku() . " - Category : {categories,[1],[1],[1]}";
                         } else {
                             if ($x12d("strip_tags", $exp['options'])) {
                                 $x10a = $x124('!\\<br /\\>!isU', " ", $x10a);
                                 $x10a = $x124('!\\<br/\\>!isU', " ", $x10a);
                                 $x10a = $x124('!\\<br>!isU', " ", $x10a);
                                 $x10a = $x134($x10a);
                             }
                             if ($x12d("html_entity_decode", $exp['options'])) {
                                 $x10a = $x123($x10a, ENT_QUOTES, 'UTF-8');
                             }
                             if ($x12d("htmlentities", $exp['options'])) {
                                 $x10a = $x135($x10a);
                             }
                             if ($x121($x10a) > 900) {
                                 $x10a = $x11f($x10a, 0, 900 - 3);
                                 $x10d = $x136($x10a, " ");
                                 $x10a = $x11f($x10a, 0, $x10d) . '...';
                             }
                         }
                         if ($x10a == null) {
                             $x10a = $xe3->getAttributeText('manufacturer') . " " . $xe3->getName() . " - Part number: " . $xe3->getSku() . " - Category : {categories,[1],[1],[1]}";
                         }
                         $x10a = $x124('/' . '[\\x00-\\x1F\\x7F]' . '|[\\x00-\\x7F][\\x80-\\xBF]+' . '|([\\xC0\\xC1]|[\\xF0-\\xFF])[\\x80-\\xBF]*' . '|[\\xC2-\\xDF]((?![\\x80-\\xBF])|[\\x80-\\xBF]{2,})' . '|[\\xE0-\\xEF](([\\x80-\\xBF](?![\\x80-\\xBF]))|' . '(?![\\x80-\\xBF]{2})|[\\x80-\\xBF]{3,})' . '/S', ' ', $x10a);
                         $x10a = $x116('™', '', $x10a);
                         $value = "<description><![CDATA[" . $x10a . "]]></description>";
                         $exp['options'] = array();
                         break;
                     case "{sc:description}":
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         $x10a = $xe3->getDescription() . $xe3->getShortDescription();
                         $x10b = "|<iframe(.*)</iframe>|U";
                         $x119($x10b, $x10a, $x10c);
                         if ($x10c) {
                             $x10a = $xe3->getAttributeText('manufacturer') . " " . $xe3->getName() . " - Part number: " . $xe3->getSku() . " - Category : {categories,[1],[1],[1]}";
                         } else {
                             if ($x12d("strip_tags", $exp['options'])) {
                                 $x10a = $x124('!\\<br /\\>!isU', " ", $x10a);
                                 $x10a = $x124('!\\<br/\\>!isU', " ", $x10a);
                                 $x10a = $x124('!\\<br>!isU', " ", $x10a);
                                 $x10a = $x134($x10a);
                             }
                             if ($x12d("html_entity_decode", $exp['options'])) {
                                 $x10a = $x123($x10a, ENT_QUOTES, 'UTF-8');
                             }
                             if ($x12d("htmlentities", $exp['options'])) {
                                 $x10a = $x135($x10a);
                             }
                             if ($x121($x10a) > 900) {
                                 $x10a = $x11f($x10a, 0, 900 - 3);
                                 $x10d = $x136($x10a, " ");
                                 $x10a = $x11f($x10a, 0, $x10d) . '...';
                             }
                         }
                         if ($x10a == null) {
                             $x10a = $xe3->getAttributeText('manufacturer') . " " . $xe3->getName() . " - Part number: " . $xe3->getSku() . " - Category : {categories,[1],[1],[1]}";
                         }
                         $x10a = $x124('/' . '[\\x00-\\x1F\\x7F]' . '|[\\x00-\\x7F][\\x80-\\xBF]+' . '|([\\xC0\\xC1]|[\\xF0-\\xFF])[\\x80-\\xBF]*' . '|[\\xC2-\\xDF]((?![\\x80-\\xBF])|[\\x80-\\xBF]{2,})' . '|[\\xE0-\\xEF](([\\x80-\\xBF](?![\\x80-\\xBF]))|' . '(?![\\x80-\\xBF]{2})|[\\x80-\\xBF]{3,})' . '/S', ' ', $x10a);
                         $x10a = $x116('™', '', $x10a);
                         $value = $x10a;
                         $exp['options'] = array();
                         break;
                     case "{SC:URL}":
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         if ($xe3->getRequest_path()) {
                             $value = "<link><![CDATA[" . $x71 . $xe3->getRequest_path() . "]]></link>";
                         } else {
                             $value = "<link><![CDATA[" . $xe3->getProductUrl() . "]]></link>";
                         }
                         break;
                     case "{sc:url}":
                         isset($exp['options'][0]) ? $xf3 = $exp['options'][0] : ($xf3 = "");
                         isset($exp['options'][1]) ? $xf4 = $exp['options'][1] : ($xf4 = "");
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         if ($xe3->getUrlKey()) {
                             $value = $x71 . $xf4 . $xe3->getRequest_path() . $xf3;
                         } else {
                             $value = $xe3->getProductUrl();
                         }
                         break;
                     case "{SC:CONDITION}":
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         $x127($xe3->getName(), "refurbished") ? $xd5 = 'refurbished' : ($xd5 = 'new');
                         $value = "<g:condition><![CDATA[" . $xd5 . "]]></g:condition>";
                         break;
                     case "{sc:condition}":
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         $x127($xe3->getName(), "refurbished") ? $xd5 = 'refurbished' : ($xd5 = 'new');
                         $value = $xd5;
                         break;
                     default:
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         if ($x12d($exp['name'], $x9d)) {
                             if ($x12d($x9e[$exp['name']], array('select', 'multiselect'))) {
                                 eval('$x10f =($xe3->' . $exp['methodName'] . ");");
                                 $x10e = $x11e(',', $x10f);
                                 if ($x11c($x10e) > 1) {
                                     $value = array();
                                     foreach ($x10e as $x5d) {
                                         if (isset($xa3[$x5d][$x69])) {
                                             $value[] = $xa3[$x5d][$x69];
                                         } else {
                                             if (isset($xa3[$x5d][0])) {
                                                 $value[] = $xa3[$x5d][0];
                                             }
                                         }
                                     }
                                 } else {
                                     if (isset($xa3[$x10e[0]][$x69])) {
                                         $value = $xa3[$x10e[0]][$x69];
                                     } else {
                                         if (isset($xa3[$x10e[0]][0])) {
                                             $value = $xa3[$x10e[0]][0];
                                         }
                                     }
                                 }
                             } else {
                                 eval('$value =($xe3->' . $exp['methodName'] . ");");
                             }
                         }
                         if ($x12d(@$x9b[$exp['name']], $x9b)) {
                             $value = $x9b[$exp['name']];
                         }
                         $value = $xd4->_eval($product, $exp, $value);
                         if ($x137($value) && !$value) {
                             continue 3;
                         }
                         break;
                 }
                 if ($x11c($exp['options']) > 0) {
                     foreach ($exp['options'] as $x41 => $option) {
                         if ($x41 >= $this->option) {
                             switch ($exp['options'][$this->option]) {
                                 case "substr":
                                     if (isset($exp['options'][$this->option + 1]) && $x121($value) > $exp['options'][$this->option + 1]) {
                                         $value = $x11f($value, 0, $exp['options'][$this->option + 1] - 3);
                                         $x10d = $x136($value, " ");
                                         $value = $x11f($value, 0, $x10d) . $exp['options'][$this->option + 2];
                                     }
                                     $this->skipOptions(3);
                                     break;
                                 case "strip_tags":
                                     $x110 = " ";
                                     $value = $x124('!\\<br /\\>!isU', $x110, $value);
                                     $value = $x124('!\\<br/\\>!isU', $x110, $value);
                                     $value = $x124('!\\<br>!isU', $x110, $value);
                                     $value = $x134($value);
                                     $this->skipOptions(1);
                                     break;
                                 case "htmlentities":
                                     $value = $x135($value);
                                     $this->skipOptions(1);
                                     break;
                                 case "implode":
                                     $value = $x126($value) ? $x115($exp['options'][$this->option + 1], $value) : $value;
                                     $this->skipOptions(2);
                                     break;
                                 case "float":
                                     $value = $x133($value, $exp['options'][$this->option + 1], '.', '');
                                     $this->skipOptions(2);
                                     break;
                                 case "html_entity_decode":
                                     $value = $x123($value, ENT_QUOTES, 'UTF-8');
                                     $this->skipOptions(1);
                                     break;
                                 case "inline":
                                     $value = $x124('/(\\r\\n|\\n|\\r|\\r\\n\\t)/s', ' ', $value);
                                     $this->skipOptions(1);
                                     break;
                                 case "strtolower":
                                     $value = $x138($value, "UTF8");
                                     $this->skipOptions(1);
                                     break;
                                 case "strtoupper":
                                     $value = $x139($value, "UTF8");
                                     $this->skipOptions(1);
                                     break;
                                 case "cleaner":
                                     $value = $x124('/' . '[\\x00-\\x1F\\x7F]' . '|[\\x00-\\x7F][\\x80-\\xBF]+' . '|([\\xC0\\xC1]|[\\xF0-\\xFF])[\\x80-\\xBF]*' . '|[\\xC2-\\xDF]((?![\\x80-\\xBF])|[\\x80-\\xBF]{2,})' . '|[\\xE0-\\xEF](([\\x80-\\xBF](?![\\x80-\\xBF]))|' . '(?![\\x80-\\xBF]{2})|[\\x80-\\xBF]{3,})' . '/S', ' ', $value);
                                     $value = $x116('™', '', $value);
                                     $this->skipOptions(1);
                                     break;
                                 default:
                                     $xd3->option = $this->option;
                                     $value = $xd3->_eval($product, $exp, $value);
                                     $this->option = $xd3->option;
                                     if ($x137($value) && !$value) {
                                         continue 3;
                                     }
                                     break;
                             }
                         }
                     }
                 }
                 if ($x78 > 1 && !$this->_display) {
                     $value = $this->x146($value, $x5f, $x60);
                 }
                 $value = $x116(array("<", ">", '"', '\\'), array("__LOWERTHAN__", "__HIGHERTHAN__", "__QUOTES__", "__BACKSLASH__"), $value);
                 $x51 = $x116($exp['fullpattern'], $value, $x51);
             }
             $x51 = $this->x13f($x51, $product, $x78);
             if ($x78 == 1) {
                 if (!$this->_display) {
                     $x51 = $this->x143($x51);
                     $x51 = $this->x142($x51, $x7c, $x7d);
                 } else {
                     $x51 = $this->x142($x51, $x7c, $x7d);
                 }
             } elseif ($x78 != 1) {
                 if (!$this->_display) {
                     $x51 = $this->x145($x51, $x5e, $x5f, $x60);
                     $x51 = $this->x143($x51);
                 } else {
                     $x51 = $this->x144($x51, false);
                 }
             }
             $x51 = $x116(array("__LOWERTHAN__", "__HIGHERTHAN__", "__QUOTES__", "__BACKSLASH__"), array("<", ">", '"', '\\'), $x51);
             if (!empty($x51)) {
                 if ($x78 == 1) {
                     $x8c .= $x51 . "";
                 } else {
                     $x8c .= $x51 . "";
                 }
                 if ($this->_display) {
                     $x8d .= $x8c;
                     $x8c = '';
                 } else {
                     if ($xd1 % Mage::getStoreConfig("datafeedmanager/system/buffer") == 0) {
                         $x43->streamWrite($x8c);
                         unset($x8c);
                         $x8c = '';
                         if ($this->_log) {
                             Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" . $xdd . "/" . $this->_counter . " items added", null, $this->getFilename('.log'));
                         }
                     }
                 }
                 if ($this->_limit && $xd1 >= $this->_limit) {
                     break 2;
                 }
                 $xd1++;
                 $xdd++;
             }
         }
     }
     if (!$this->_display) {
         $x43->streamWrite($x8c);
         if ($x121($x120($x77)) > 1) {
             $x43->streamWrite($x77 . "\n");
         }
         if ($this->_log) {
             Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> " . ($xdd - 1) . "/" . $this->_counter . " items added", null, $this->getFilename('.log'));
         }
     } else {
         $x8d .= $x8c;
         $x8d .= $x77 . "\n";
         if ($x78 > 1) {
             $x8d .= "</table>";
         }
         if ($this->_log) {
             Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> " . $xdd . "/" . $this->_counter . " items added", null, $this->getFilename('.log'));
         }
     }
     unset($xbf);
     if ($this->_log) {
         Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Footer template added", null, $this->getFilename('.log'));
     }
     if ($this->_display && !$this->_debug) {
         $x78 == 1 && !Mage::app()->getRequest()->getParam("real_time_preview") ? $x10a = "<textarea id='CodeMirror' class='CodeMirror'>" . $x8d . "</textarea>" : ($x10a = $x8d);
         if (!Mage::app()->getRequest()->getParam("real_time_preview")) {
             return "\r\n    <html>\r\n   \t <head>\r     \t\t<title>" . $this->getFeedName() . "</title>                 <link rel='stylesheet' href='" . $x70 . "skin/adminhtml/default/default/CodeMirror2/lib/codemirror.css'> \n           <link rel='stylesheet' href='" . $x70 . "skin/adminhtml/default/default/CodeMirror2/theme/default.css'>\r\n         \r\n              <script type='text/javascript' src='" . $x70 . "skin/adminhtml/default/default/CodeMirror2/lib/codemirror.js'></script>\r\n               <script type='text/javascript' src='" . $x70 . "skin/adminhtml/default/default/CodeMirror2/mode/xml/xml.js'></script> \n       \r\n               \n             </head>\r                <body>\r\n                " . $x10a . " \n              <script language='javascript'> \n                  sHtml=document.getElementById('CodeMirror');\r\n              if(typeof sHtml != 'undefined'){\r\n                      var myCodeMirror = CodeMirror(function(elt) { \n                         sHtml.parentNode.replaceChild(elt, sHtml)}, {\r                         value: sHtml.value,                         mode:  'xml',\r\n                            readOnly: true\r\n \n                  })\r\n                  } \n               \n               </script>                 </body>\r\n              </html>";
         } else {
             return $x10a;
         }
     } elseif ($this->_debug) {
         echo "<br><br>------------ XML OUTPUT ----------------<br>";
         $x10a = "<pre>" . $x122($x8d) . "</pre>";
         return $x10a;
     } else {
         $x43->streamClose();
         $x43->mv($this->getFilename(), $this->getFilename(false));
         $x43->rm($this->getFilename());
         $this->setFeedUpdatedAt(Mage::getSingleton('core/date')->gmtDate('Y-m-d H:i:s'));
         $this->save();
         if ($this->_log) {
             Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Temp file closed and moved to " . $this->getFilename(false), null, $this->getFilename('.log'));
         }
         if ($x80) {
             $x111 = $x13a($x81);
             $x112 = $x13b($x111, $x82, $x83);
             $x13c($x111, true);
             if (!$x111 || !$x112) {
                 Mage::getSingleton("adminhtml/session")->addError(Mage::helper("datafeedmanager")->__("Unable to connect the ftp server, please check your credentials."));
             }
             $x113 = $x13d($x111, $x84 . $this->getFilename(false), $this->getPath() . $this->getFilename(false), FTP_BINARY);
             if (!$x113) {
                 Mage::getSingleton("adminhtml/session")->addError(Mage::helper("datafeedmanager")->__("Unable to upload the file to the FTP directory."));
             } else {
                 Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("datafeedmanager")->__("File successfully uploaded on {$x81}."));
             }
             $x13e($x111);
         }
     }
     return $this;
 }
 /**
  * Retrieve custom size image url
  *
  * @param string $imageFile
  * @param int $width
  * @param int $height
  * @return string|bool
  */
 public function getCustomSizeImageUrl($imageFile, $width = 100, $height = 100)
 {
     /** @var $imageHelper Mage_XmlConnect_Helper_Image */
     $imageHelper = Mage::helper('xmlconnect/image');
     $screenSize = $width . 'x' . $height;
     $customDir = $imageHelper->getMediaPath('custom' . DS . $screenSize);
     $ioFile = new Varien_Io_File();
     $ioFile->checkAndCreateFolder($customDir);
     $filePath = self::getBasePath() . DS . $imageFile;
     $isImagePng = true;
     if (!$ioFile->fileExists($filePath)) {
         return false;
     }
     $originalImageType = $this->_getImageType($filePath);
     if ($originalImageType !== IMAGETYPE_PNG) {
         $imageFile = $this->_convertFileExtensionToPng($imageFile);
         $isImagePng = false;
     }
     $customSizeFile = $customDir . DS . $imageFile;
     if (!file_exists($customSizeFile)) {
         if (!$isImagePng) {
             $filePath = $this->_forcedConvertPng($filePath, $customSizeFile, $originalImageType);
         }
         $image = new Varien_Image($filePath);
         $widthOriginal = $image->getOriginalWidth();
         $heightOriginal = $image->getOriginalHeight();
         if ($width != $widthOriginal) {
             $widthOriginal = $width;
         }
         if ($height != $heightOriginal) {
             $heightOriginal = $height;
         }
         if ($widthOriginal != $image->getOriginalWidth() || $heightOriginal != $image->getOriginalHeight()) {
             $image->keepTransparency(true);
             $image->keepFrame(true);
             $image->keepAspectRatio(true);
             $image->backgroundColor(array(0, 0, 0));
             $image->resize($widthOriginal, $heightOriginal);
             $image->save($customDir, basename($imageFile));
         } else {
             $ioFile->cp($filePath, $customSizeFile);
         }
     }
     return $imageHelper->getMediaUrl("custom/{$screenSize}/" . basename($imageFile));
 }
示例#26
0
 /**
  * Delete tmp file
  *
  * @param string $fileName
  * @return true
  */
 protected function _deleteFile($fileName)
 {
     $dir = $this->_getTmpDir();
     $file = new Varien_Io_File();
     if ($file->fileExists($dir . $fileName, true)) {
         $file->cd($dir);
         $file->rm($fileName);
     }
     return true;
 }
示例#27
0
 /**
  * Export attribute value to entity model
  *
  * @param Mage_Core_Model_Abstract $entity
  * @param array|string $value
  * @return Mage_Eav_Model_Attribute_Data_File
  */
 public function compactValue($value)
 {
     if ($this->getIsAjaxRequest()) {
         return $this;
     }
     $attribute = $this->getAttribute();
     $original = $this->getEntity()->getData($attribute->getAttributeCode());
     $toDelete = false;
     if ($original) {
         if (!$attribute->getIsRequired() && !empty($value['delete'])) {
             $toDelete = true;
         }
         if (!empty($value['tmp_name'])) {
             $toDelete = true;
         }
     }
     $path = Mage::getBaseDir('media') . DS . $attribute->getEntity()->getEntityTypeCode();
     // unlink entity file
     if ($toDelete) {
         $this->getEntity()->setData($attribute->getAttributeCode(), '');
         $file = $path . $original;
         $ioFile = new Varien_Io_File();
         if ($ioFile->fileExists($file)) {
             $ioFile->rm($file);
         }
     }
     if (!empty($value['tmp_name'])) {
         try {
             $uploader = new Varien_File_Uploader($value);
             $uploader->setFilesDispersion(true);
             $uploader->setFilenamesCaseSensitivity(false);
             $uploader->setAllowRenameFiles(true);
             $uploader->save($path, $value['name']);
             $fileName = $uploader->getUploadedFileName();
             $this->getEntity()->setData($attribute->getAttributeCode(), $fileName);
         } catch (Exception $e) {
             Mage::logException($e);
         }
     }
     return $this;
 }
示例#28
0
 /**
  * Save file to storage
  *
  * @param  string $filePath
  * @param  string $content
  * @param  bool $overwrite
  * @return bool
  */
 public function saveFile($filePath, $content, $overwrite = false)
 {
     $filename = basename($filePath);
     $path = $this->getMediaBaseDirectory() . DS . str_replace('/', DS, dirname($filePath));
     if (!file_exists($path) || !is_dir($path)) {
         @mkdir($path, 0777, true);
     }
     $ioFile = new Varien_Io_File();
     $ioFile->cd($path);
     if (!$ioFile->fileExists($filename) || $overwrite && $ioFile->rm($filename)) {
         $ioFile->streamOpen($filename);
         $ioFile->streamLock(true);
         $result = $ioFile->streamWrite($content);
         $ioFile->streamUnlock();
         $ioFile->streamClose();
         if ($result !== false) {
             return true;
         }
         Mage::throwException(Mage::helper('core')->__('Unable to save file: %s', $filePath));
     }
     return false;
 }
示例#29
0
 /**
  * Open backup file (write or read mode)
  *
  * @param bool $write
  * @return Mage_Backup_Model_Backup
  */
 public function open($write = false)
 {
     if (is_null($this->getPath())) {
         Mage::exception('Mage_Backup', Mage::helper('backup')->__('Backup file path was not specified.'));
     }
     $ioAdapter = new Varien_Io_File();
     try {
         $path = $ioAdapter->getCleanPath($this->getPath());
         $ioAdapter->checkAndCreateFolder($path);
         $filePath = $path . DS . $this->getFileName();
     } catch (Exception $e) {
         Mage::exception('Mage_Backup', $e->getMessage());
     }
     if ($write && $ioAdapter->fileExists($filePath)) {
         $ioAdapter->rm($filePath);
     }
     if (!$write && !$ioAdapter->fileExists($filePath)) {
         Mage::exception('Mage_Backup', Mage::helper('backup')->__('Backup file "%s" does not exist.', $this->getFileName()));
     }
     $mode = $write ? 'wb' . self::COMPRESS_RATE : 'rb';
     try {
         $this->_handler = gzopen($filePath, $mode);
     } catch (Exception $e) {
         Mage::exception('Mage_Backup', Mage::helper('backup')->__('Backup file "%s" cannot be read from or written to.', $this->getFileName()));
     }
     return $this;
 }
示例#30
0
 /**
  * Generate XML file
  *
  * @return ET_FeedSalidzini_Model_Feedsalidzini
  */
 public function generateXml()
 {
     $io = new Varien_Io_File();
     $io->setAllowCreateFolders(true);
     $io->open(array('path' => $this->getPath()));
     if ($io->fileExists($this->getXmlfileFilename()) && !$io->isWriteable($this->getXmlfileFilename())) {
         Mage::throwException(Mage::helper('feedsalidzini')->__('File "%s" cannot be saved. Please, make sure the directory "%s" is writeable by web server.', $this->getXmlfileFilename(), $this->getPath()));
     }
     $xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><root></root>');
     $storeId = $this->getStoreId();
     $appEmulation = Mage::getSingleton('core/app_emulation');
     $initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($storeId);
     /* @var $collection Mage_Catalog_Model_Resource_Product_Collection
      * @var $product Mage_Catalog_Model_Product
      * @var $categories Mage_Catalog_Model_Resource_Category_Collection
      * @var $category Mage_Catalog_Model_Category
      * @var $stockCollection Mage_CatalogInventory_Model_Resource_Stock_Item_Collection
      * @var $stockItem Mage_CatalogInventory_Model_Stock_Item
      */
     /* Collecting categories info */
     $categories = Mage::getModel('catalog/category')->getCollection();
     $categories->addIsActiveFilter();
     $categories->addNameToResult();
     $categories->addUrlRewriteToResult();
     foreach ($categories as $category) {
         $this->_tmpCategories[$category->getId()] = array('id' => $category->getId(), 'level' => $category->getLevel(), 'name' => $category->getName(), 'path' => $category->getPathIds(), 'url' => $_SERVER["SCRIPT_FILENAME"] ? str_replace($_SERVER["SCRIPT_FILENAME"] . "/", "", $category->getUrl()) : $category->getUrl(), 'parent' => $category->getParentCategory()->getId());
     }
     /* Collecting product stock info */
     $stockCollection = Mage::getModel('cataloginventory/stock_item')->getCollection();
     foreach ($stockCollection as $stockItem) {
         $this->_stock[$stockItem->getProductId()] = $stockItem->getQty();
     }
     unset($stockCollection);
     /* Subproduct collection */
     if ($this->_includeStock && $this->_emulateStock == 2) {
         /* @var $db Varien_Db_Adapter_Interface */
         $db = Mage::getSingleton('core/resource')->getConnection('core_write');
         $model = Mage::getResourceModel('catalog/product');
         $superTable = $model->getTable("catalog_product_super_link");
         $query = $db->query("SELECT * FROM " . $superTable);
         while ($row = $query->fetch()) {
             if (!isset($this->_superProducts[$row["parent_id"]])) {
                 $this->_superProducts[$row["parent_id"]] = array();
             }
             $this->_superProducts[$row["parent_id"]][] = $row["product_id"];
         }
     }
     /* Attribute collection */
     /* @var $attributes Mage_Eav_Model_Resource_Entity_Attribute_Collection
      * @var $attribute Mage_Eav_Model_Entity_Attribute
      */
     $attributes = Mage::getSingleton('eav/config')->getEntityType(Mage_Catalog_Model_Product::ENTITY)->getAttributeCollection()->addFieldToFilter('attribute_code', array('in', $this->_nameAttributes));
     foreach ($attributes as $attribute) {
         if (!in_array($attribute->getFrontendInput(), array('select', 'multiselect'))) {
             continue;
         }
         $options = $attribute->getSource()->getAllOptions();
         $this->_attributeOptions[$attribute->getAttributeCode()] = array();
         foreach ($options as $option) {
             $this->_attributeOptions[$attribute->getAttributeCode()][$option['value']] = $option['label'];
         }
     }
     /* Collecting product info */
     $collection = Mage::getModel('catalog/product')->getCollection();
     $collection->addFieldToFilter("type_id", array("in" => $this->_filterProductTypes));
     $collection->addAttributeToFilter("visibility", array("in" => $this->_filterProductVisibility));
     $collection->addStoreFilter($storeId);
     $collection->addAttributeToSelect("name");
     foreach ($this->_nameAttributes as $attr) {
         $collection->addAttributeToSelect($attr);
     }
     if (!in_array("manufacturer", $this->_nameAttributes)) {
         $collection->addAttributeToSelect("manufacturer");
     }
     $collection->addAttributeToSelect("model");
     $collection->addAttributeToSelect("price");
     $collection->addAttributeToSelect("status");
     $collection->addCategoryIds();
     $collection->addUrlRewrite();
     $collection->addFinalPrice();
     //echo $collection->getSelect();
     foreach ($collection as $product) {
         if (!$this->_shouldExport($product)) {
             continue;
         }
         $maxLevel = -1;
         if ($this->_hideDuplicates) {
             $selectedCategory = false;
             foreach ($product->getCategoryIds() as $categoryId) {
                 if (isset($this->_tmpCategories[$categoryId])) {
                     $categoryInfo = $this->_tmpCategories[$categoryId];
                     if ($categoryInfo['level'] > $maxLevel) {
                         $maxLevel = $categoryInfo['level'];
                         $selectedCategory = $categoryInfo;
                     }
                 }
             }
             $xml = $this->_addItemXml($xml, $product, $selectedCategory, $this->_stock);
         } else {
             foreach ($product->getCategoryIds() as $categoryId) {
                 if (isset($this->_tmpCategories[$categoryId]) && $this->_tmpCategories[$categoryId]['level'] > 1) {
                     $selectedCategory = $this->_tmpCategories[$categoryId];
                     $xml = $this->_addItemXml($xml, $product, $selectedCategory);
                 }
             }
         }
     }
     unset($collection);
     $appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
     $io->streamOpen($this->getXmlfileFilename());
     $io->streamWrite($xml->asXML());
     $io->streamClose();
     $this->setXmlfileTime(Mage::getSingleton('core/date')->gmtDate('Y-m-d H:i:s'));
     $this->save();
     return $this;
 }