本文整理汇总了PHP中Varien_Io_File::getCleanPath方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Io_File::getCleanPath方法的具体用法?PHP Varien_Io_File::getCleanPath怎么用?PHP Varien_Io_File::getCleanPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Io_File
的用法示例。
在下文中一共展示了Varien_Io_File::getCleanPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: viewfileAction
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;
}
示例2: _beforeSave
protected function _beforeSave()
{
$io = new Varien_Io_File();
$realPath = $io->getCleanPath(Mage::getBaseDir() . '/' . $this->getSitemapPath());
/**
* 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->getSitemapPath())));
}
if (!$io->isWriteable($realPath)) {
Mage::throwException(Mage::helper('sitemap')->__('Please make sure that "%s" is writable by web-server.', $this->getSitemapPath()));
}
/**
* Check allow filename
*/
if (!preg_match('#^[a-zA-Z0-9_\\.]+$#', $this->getSitemapFilename())) {
Mage::throwException(Mage::helper('sitemap')->__('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();
}
示例3: open
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;
}
示例4: _removeOldFiles
protected function _removeOldFiles()
{
$io = new Varien_Io_File();
$realPath = $io->getCleanPath($this->getPath());
$fileName = $this->getSitemapFilename();
$pos = strpos($fileName, ".xml");
$noExtensionFileName = substr($fileName, 0, $pos);
$fullFilePath = $realPath . $noExtensionFileName . "_*";
array_map("unlink", glob($fullFilePath));
}
示例5: _ToHtml
public function _ToHtml()
{
$txt = null;
$i = 0;
$io = new Varien_Io_File();
$realPath = $io->getCleanPath(Mage::getBaseDir() . $this->getRequest()->getParam('file'));
$io->streamOpen($realPath, "r+");
while (false !== ($line = $io->streamRead())) {
if (stripos($line, str_replace('__', '&', $this->getRequest()->getParam('s'))) !== FALSE) {
$txt .= $line;
}
}
return $txt;
}
示例6: _createSitemap
/**
* 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));
}
示例7: loadfileAction
public function loadfileAction()
{
$tmp_file = $this->getRequest()->getParam('file');
if ($this->getRequest()->getParam('file_system_type') === "1") {
$content = $this->downloadFile();
if (is_array($content)) {
$rtn['status'] = 'error';
$rtn['body'] = $content[0];
die(json_encode($rtn));
} else {
$tmp_file = $content;
}
}
$io = new Varien_Io_File();
$realPath = $io->getCleanPath(Mage::getBaseDir() . '/' . $tmp_file);
if ($tmp_file == '') {
$rtn['status'] = 'error';
$rtn['body'] = Mage::helper('massstockupdate')->__('File path can\'t be empty.');
} elseif (stripos($tmp_file, 'csv') < 1 && stripos($tmp_file, 'xml') < 1) {
$rtn['status'] = 'error';
$rtn['body'] = Mage::helper('massstockupdate')->__('Wrong file type. "%s" must be a csv or xml file.', $realPath);
} elseif (!$io->fileExists($realPath, false)) {
$rtn['status'] = 'error';
$rtn['body'] = Mage::helper('massstockupdate')->__('Wrong file path. "%s" is not a file.', $realPath);
} elseif (!is_readable($realPath)) {
$rtn['status'] = 'error';
$rtn['body'] = Mage::helper('massstockupdate')->__('Please make sure that "%s" is readable by web-server.', $realPath);
} else {
$rtn['status'] = 'valid';
if ($this->getRequest()->getParam('file_type') == 1) {
// xml
$csv_file = $this->transformXmlToCsv($realPath, $this->getRequest()->getParam('xpath'), 1000);
if (is_array($csv_file)) {
$rtn['status'] = 'error';
$rtn['body'] = $csv_file[0];
die(json_encode($rtn));
}
$realPath = $io->getCleanPath(Mage::getBaseDir() . '/' . $csv_file);
}
if ($this->getRequest()->getParam('file_type') === "1") {
$fileSeparator = ";";
$fileEnclosure = "none";
} else {
$fileSeparator = $this->getRequest()->getParam('separator');
$fileEnclosure = $this->getRequest()->getParam('enclosure');
}
$io->streamOpen($realPath, 'r');
$rtn = array();
$i = 0;
if (Mage::helper('core')->isModuleEnabled('Wyomind_Advancedinventory')) {
$places = Mage::getModel('pointofsale/pointofsale')->getPlaces();
foreach ($places as $p) {
$rtn["places"][$i]['label'] = $p->getName();
$rtn["places"][$i]['value'] = $p->getPlaceId();
$rtn["places"][$i]['id'] = $p->getPlaceId();
$rtn["places"][$i]['style'] = "store " . $p->getPlaceId();
$i++;
}
$rtn["places"][$i]['label'] = "Manage Local Stock";
$rtn["places"][$i]['value'] = "manage_local_stock";
$rtn["places"][$i]['id'] = 'manage_local_stock';
$rtn["places"][$i]['style'] = "manage_local_stock";
$i++;
}
if ($this->getRequest()->getParam('autoSetInStock') == "0") {
$rtn["places"][$i]['label'] = "Stock status";
$rtn["places"][$i]['value'] = "is_in_stock";
$rtn["places"][$i]['id'] = 'is_in_stock';
$rtn["places"][$i]['style'] = "is_in_stock";
$i++;
}
/* if ($this->getRequest()->getParam('autoSetManageStock') == "0") {
$rtn["places"][$i]['label'] = "Manage stock";
$rtn["places"][$i]['value'] = "manage_stock";
$rtn["places"][$i]['id'] = 'manage_stock';
$rtn["places"][$i]['style'] = "manage_stock";
$i++;
} */
// if total stock are not sync with local stocks or if total stock are sync with local stocks but sync is done by user
if ($this->getRequest()->getParam('autoSetTotal') == "0") {
$rtn["places"][$i]['label'] = "Total Stock";
$rtn["places"][$i]['value'] = "total";
$rtn["places"][$i]['id'] = 'total';
$rtn["places"][$i]['style'] = "total";
$i++;
} else {
$rtn["places"][$i]['label'] = "used";
$rtn["places"][$i]['value'] = "used";
$rtn["places"][$i]['id'] = 'used';
$rtn["places"][$i]['style'] = "used";
$i++;
}
$resource = Mage::getSingleton('core/resource');
$read = $resource->getConnection('core_read');
$tableEet = $resource->getTableName('eav_entity_type');
$select = $read->select()->from($tableEet)->where('entity_type_code=\'catalog_product\'');
$data = $read->fetchAll($select);
$typeId = $data[0]['entity_type_id'];
function cmp($a, $b)
{
//.........这里部分代码省略.........
示例8: _beforeSave
protected function _beforeSave()
{
$x147 = "str_replace";
$x148 = "utf8_encode";
$x149 = "preg_match_all";
$x14a = "preg_match";
$x14b = "is_null";
$x14c = "number_format";
$x14d = "is_numeric";
$x14e = "preg_split";
$x14f = "utf8_decode";
$x150 = "is_string";
$x151 = "json_decode";
$x152 = "is_array";
$x153 = "array_push";
$x154 = "print_r";
$x155 = "version_compare";
$x156 = "in_array";
$x157 = "array_pop";
$x158 = "str_pad";
$x159 = "array_shift";
$x15a = "array_reverse";
$x15b = "array_values";
$x15c = "preg_replace";
$x15d = "strip_tags";
$x15e = "html_entity_decode";
$x15f = "mb_strtolower";
$x160 = "mb_strtoupper";
$x3a = new Varien_Io_File();
$x3b = $x3a->getCleanPath(Mage::getBaseDir() . '/' . $this->getSimplegoogleshoppingPath());
if (!$x3a->fileExists($x3b, false)) {
Mage::throwException(Mage::helper('simplegoogleshopping')->__('Please create the specified folder %s before saving the googleshopping.', Mage::helper('core')->htmlEscape($this->getSimplegoogleshoppingPath())));
}
if (!$x3a->isWriteable($x3b)) {
Mage::throwException(Mage::helper('simplegoogleshopping')->__('Please make sure that %s is writable by web-server.', $this->getSimplegoogleshoppingPath()));
}
if (!$x14a('#^[a-zA-Z0-9_\\-\\.]+$#', $this->x165())) {
Mage::throwException(Mage::helper('simplegoogleshopping')->__('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 (!$x14a('#\\.xml$#', $this->getSimplegoogleshoppingFilename())) {
$this->setSimplegoogleshoppingFilename($this->getSimplegoogleshoppingFilename() . '.xml');
}
if (!$this->getSimplegoogleshoppingId() && $this->x164($this->x165())) {
Mage::throwException(Mage::helper('simplegoogleshopping')->__('This data feed name is already used. Please specify a new one.'));
}
$this->setSimplegoogleshoppingPath(rtrim($x147($x147('\\', '/', Mage::getBaseDir()), '', $x3b), '/') . '/');
return parent::_beforeSave();
}
示例9: _beforeSave
protected function _beforeSave()
{
$io = new Varien_Io_File();
$pathmap = $this->getHelper()->getGeneralConf($this->getStoreId())->getPathMap();
if ($pathmap) {
$pathmap = DS . $pathmap;
}
$realPath = $io->getCleanPath(Mage::getBaseDir() . $pathmap . DS . $this->getSitemapPath());
$realPath_save = $io->getCleanPath(Mage::getBaseDir() . DS . $this->getSitemapPath());
$_isCompressed = $this->getHelper()->getGeneralConf($this->getStoreId())->getUsecompression();
/**
* Check path is allow
*/
if (!$pathmap) {
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($realPath)));
}
if (!$io->isWriteable($realPath)) {
Mage::throwException(Mage::helper('sitemap')->__('Please make sure that "%s" is writable by web-server.', $realPath));
}
/**
* Check allow filename
*/
if (!preg_match('#^[a-zA-Z0-9_\\.]+$#', $this->getSitemapFilename())) {
Mage::throwException(Mage::helper('sitemap')->__('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 ($_isCompressed) {
$this->setSitemapFilename($this->getHelper()->clearExtension($this->getSitemapFilename()) . '.xml.gz');
} else {
$this->setSitemapFilename($this->getHelper()->clearExtension($this->getSitemapFilename()) . '.xml');
}
if (!$this->getHelper()->isUnique($this)) {
Mage::throwException(Mage::helper('sitemap')->__('Please select another filename/path, as another sitemap with same filename already exists on the specified location.'));
}
$this->setSitemapPath(rtrim(str_replace(str_replace('\\', '/', Mage::getBaseDir()), '', $realPath_save), '/') . '/');
return Mage_Core_Model_Abstract::_beforeSave();
}
示例10: categoriesAction
public function categoriesAction()
{
$i = 0;
$io = new Varien_Io_File();
$realPath = $io->getCleanPath(Mage::getBaseDir() . "/lib/Google/taxonomy.txt");
$io->streamOpen($realPath, "r+");
while (false !== ($line = $io->streamRead())) {
if (stripos($line, $this->getRequest()->getParam('s')) !== FALSE) {
echo $line;
}
}
die;
}
示例11: _beforeSave
protected function _beforeSave()
{
$io = new Varien_Io_File();
$io->setAllowCreateFolders(true);
$pathmap = $this->getConfig()->getPathMap();
// this is the path that will be used for save the files ( pathmap )
$realPath = $io->getCleanPath(Mage::getBaseDir() . DS . $this->getSitemapPath());
// this is the path that will be displayed
$realPath_db = $realPath;
if ($pathmap != '') {
$realPath = $io->getCleanPath(Mage::getBaseDir() . DS . $pathmap . DS . $this->getSitemapPath());
}
/**
* Check exists and writeable path
*/
if (!$io->fileExists($realPath, false)) {
if (!$io->checkAndCreateFolder($realPath)) {
Mage::throwException(Mage::helper('sitemapEnhancedPlus')->__('Please create the specified folder "%s" before saving the sitemap.', Mage::helper('core')->htmlEscape($realPath)));
}
}
if (!$io->isWriteable($realPath)) {
Mage::throwException(Mage::helper('sitemapEnhancedPlus')->__('Please make sure that "%s" is writable by web-server.', $realPath));
}
/**
* Check allow filename
*/
if (preg_match('#^[a-zA-Z0-9_\\.]+$#', $this->getSitemapFilename())) {
//Mage::throwException(Mage::helper('sitemapEnhancedPlus')->__('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 ($this->getConfig()->getUseCompression()) {
$this->setSitemapFilename($this->getHelper()->clearExtension($this->getSitemapFilename()) . '.xml.gz');
} else {
$this->setSitemapFilename($this->getHelper()->clearExtension($this->getSitemapFilename()) . '.xml');
}
if (!$this->getHelper()->isUnique($this)) {
Mage::throwException(Mage::helper('sitemapEnhancedPlus')->__('Please select another filename/path, as another sitemap with same filename already exists on the specified location.'));
}
$this->setSitemapPath(rtrim(str_replace(str_replace('\\', '/', Mage::getBaseDir()), '', $realPath_db), '/') . '/');
return Mage_Core_Model_Abstract::_beforeSave();
}
示例12: importProcess
public function importProcess()
{
$x7a = "stristr";
$x7b = "is_readable";
$x7c = "time";
$x7d = "file_get_contents";
$x7e = "in_array";
$x7f = "implode";
$x80 = "array_key_exists";
$x81 = "trim";
$x82 = "str_replace";
$x83 = "log";
$x84 = "is_array";
$x85 = "json_encode";
$x86 = "json_decode";
$x87 = "array_splice";
$x88 = "array_unshift";
$x89 = "count";
$x8a = "is_numeric";
$x8b = "array_push";
$x8c = "strtolower";
$x8d = "strstr";
$x8e = "explode";
$x8f = "addslashes";
Mage::$x83("-------------------- IMPORTATION PROCESS ---------------", null, "MassStockUpate.{$x83}");
$this->x90();
$x4a = $this->getFilePath();
if ($this->getFileSystemType() === "1") {
$x3b = $this->x91();
if ($x84($x3b)) {
$x4b['status'] = 'error';
$x4b['body'] = $x3b[0];
die($x85($x4b));
} else {
$x4a = $x3b;
}
}
$x31 = new Varien_Io_File();
$x32 = $x31->getCleanPath(Mage::getBaseDir() . "/" . $x4a);
if ($this->getFileType() === "1") {
$x49 = $this->x92($x32, $this->getXpathToProduct());
if ($x84($x49)) {
$x4b['status'] = 'error';
$x4b['body'] = $x49[0];
die($x85($x4b));
}
$x32 = $x31->getCleanPath(Mage::getBaseDir() . '/' . $x49);
}
$x31->streamOpen($x32, "r");
Mage::$x83("--> File opened : " . $x32, null, "MassStockUpate.{$x83}");
$x4c = $this->getIdentifierCode() ? $this->getIdentifierCode() : "sku";
$x41 = Mage::getModel("catalog/product")->getCollection()->addAttributeToSelect($x4c);
foreach ($x41 as $x4d) {
$this->_products[$x81($x4d->getData($x4c))] = $x4d->getId();
}
Mage::$x83("--> Products collected", null, "MassStockUpate.{$x83}");
if (Mage::helper("core")->isModuleEnabled("Wyomind_Advancedinventory")) {
$x4e = Mage::getModel("advancedinventory/stock")->getCollection();
foreach ($x4e as $x4f) {
$this->_stocks[$x4f->getProductId()] = $x4f->getId();
}
Mage::$x83("--> Local stocks collected (Advanced Inventory)", null, "MassStockUpate.{$x83}");
}
$x50 = array("ac" => "activation_code", "ak" => "activation_key", "bu" => "base_url", "md" => "md5", "th" => "this", "dm" => "_demo", "ext" => "msi", "ver" => "3.9.2");
$x51 = Mage::getSingleton("core/resource");
$x52 = $x51->getConnection("core_read");
$this->_tables["csi"] = Mage::getSingleton("core/resource")->getTableName("cataloginventory_stock_item");
if (Mage::helper("core")->isModuleEnabled("Wyomind_Advancedinventory")) {
$this->_tables["aip"] = Mage::getSingleton("core/resource")->getTableName("advancedinventory_item");
$this->_tables["ais"] = Mage::getSingleton("core/resource")->getTableName("advancedinventory_stock");
$x53 = "SELECT MAX(id) AS INC FROM " . $this->_tables["aip"] . " ;";
$x54 = $x52->fetchAll($x53);
$this->_autoInc = $x54[0]["INC"];
Mage::$x83("--> Max increment found #" . $x54[0]["INC"] . "(Advanced Inventory)", null, "MassStockUpate.{$x83}");
}
$x55 = array("activation_key" => Mage::getStoreConfig("massstockupdate/license/activation_key"), "activation_code" => Mage::getStoreConfig("massstockupdate/license/activation_code"), "base_url" => Mage::getStoreConfig("web/secure/base_url"));
$x40 = $x86($this->getMapping());
foreach ($x40->columns as $x44 => $x56) {
if (!$x7e($x56->id, array("not-used", "total", "is_in_stock", "manage_local_stock"))) {
$this->_columns[] = $x56->id;
} elseif ($x7e($x56->id, array("total"))) {
$this->_columns[] = "total";
$this->_total = $x44 + 1;
} elseif ($x7e($x56->id, array("is_in_stock"))) {
$this->_columns[] = "is_in_stock";
$this->_is_in_stock = $x44 + 1;
} elseif ($x7e($x56->id, array("manage_local_stock"))) {
$this->_columns[] = "manage_local_stock";
$this->_manage_local_stock = $x44 + 1;
} else {
$this->_columns[] = false;
}
}
Mage::$x83("--> Column mapping analyzed", null, "MassStockUpate.{$x83}");
if ($x55[$x50["ac"]] != $x50["md"]($x50["md"]($x55[$x50["ak"]]) . $x50["md"]($x55[$x50["bu"]]) . $x50["md"]($x50["ext"]) . $x50["md"]($x50["ver"]))) {
${$x50}["ext"] = "valid";
${$x50}["th"]->{$x50}["dm"] = true;
} else {
${$x50}["th"]->{$x50}["dm"] = false;
${$x50}["ext"] = "valid";
//.........这里部分代码省略.........
示例13: openGz
/**
* Open backup file (write or read mode)
*
* @param string $mode
* @param string|null $filePath
*
* @throws Mageplace_Backup_Exception
* @return Mage_Backup_Model_Backup
*/
public function openGz($mode, $filePath = null)
{
if (is_null($this->getPath())) {
Mage::exception('Mage_Backup', Mage::helper('backup')->__('Backup file path was not specified.'));
}
$ioAdapter = new Varien_Io_File();
if ($filePath === null) {
try {
$path = $ioAdapter->getCleanPath($this->getPath());
$ioAdapter->checkAndCreateFolder($path);
$filePath = $path . $this->getFileName();
} catch (Exception $e) {
throw new Mageplace_Backup_Exception($e->getMessage());
}
}
if ($mode != self::OPEN_MODE_APPEND && $mode != self::OPEN_MODE_WRITE && $mode != self::OPEN_MODE_READ) {
$mode = self::OPEN_MODE_WRITE;
}
if ($mode == self::OPEN_MODE_WRITE && $ioAdapter->fileExists($filePath)) {
$ioAdapter->rm($filePath);
}
if ($mode != self::OPEN_MODE_WRITE && !$ioAdapter->fileExists($filePath)) {
throw new Mageplace_Backup_Exception(Mage::helper('backup')->__('Backup file "%s" does not exist.', $this->getFileName()));
}
$this->_handler = @gzopen($filePath, $mode);
if (!$this->_handler) {
throw new Mageplace_Backup_Exception(Mage::helper('backup')->__('Backup file "%s" cannot be read from or written to.', $this->getFileName()));
}
return $this;
}
示例14: _beforeSave
protected function _beforeSave()
{
$xb4 = "array_push";
$xb5 = "count";
$xb6 = "date";
$xb7 = "eval";
$xb8 = "explode";
$xb9 = "header";
$xba = "htmlspecialchars";
$xbb = "html_entity_decode";
$xbc = "htmlentities";
$xbd = "in_array";
$xbe = "implode";
$xbf = "ini_get";
$xc0 = "is_bool";
$xc1 = "is_array";
$xc2 = "is_null";
$xc3 = "is_numeric";
$xc4 = "mb_strtolower";
$xc5 = "mb_strtoupper";
$xc6 = "number_format";
$xc7 = "preg_match";
$xc8 = "preg_match_all";
$xc9 = "preg_split";
$xca = "preg_replace";
$xcb = "print_r";
$xcc = "round";
$xcd = "rtrim";
$xce = "set_time_limit";
$xcf = "sprintf";
$xd0 = "str_replace";
$xd1 = "strlen";
$xd2 = "stristr";
$xd3 = "strip_tags";
$xd4 = "substr";
$xd5 = "strrpos";
$xd6 = "trim";
$xd7 = "ucwords";
$xd8 = "utf8_decode";
$x0b = new Varien_Io_File();
$x0c = $x0b->getCleanPath(Mage::getBaseDir() . '/' . $this->getFeedPath());
if (!$x0b->allowedPath($x0c, Mage::getBaseDir())) {
Mage::throwException(Mage::helper('datafeedmanager')->__('Please define correct path'));
}
if (!$x0b->fileExists($x0c, false)) {
Mage::throwException(Mage::helper('datafeedmanager')->__('Please create the specified folder "%s" before saving the data feed configuration.', Mage::helper('core')->htmlEscape($this->getFeedPath())));
}
if (!$x0b->isWriteable($x0c)) {
Mage::throwException(Mage::helper('datafeedmanager')->__('Please make sure that "%s" is writable by web-server.', $this->getFeedPath()));
}
if (!$xc7('#^[a-zA-Z0-9_\\.]+$#', $this->getFeedName())) {
Mage::throwException(Mage::helper('datafeedmanager')->__('Please use only letters (a-z or A-Z), numbers (0-9) or underscore (_) in the filename. No spaces or other characters are allowed.'));
}
$this->setFeedPath($xcd($xd0($xd0('\\', '/', Mage::getBaseDir()), '', $x0c), '/') . '/');
return parent::_beforeSave();
}
示例15: _beforeSave
protected function _beforeSave()
{
$xd6 = "str_replace";
$xd7 = "utf8_encode";
$xd8 = "preg_match_all";
$xd9 = "preg_match";
$xda = "rtrim";
$xdb = "is_null";
$xdc = "count";
$xdd = "is_numeric";
$xde = "explode";
$xdf = "substr";
$xe0 = "trim";
$xe1 = "preg_split";
$xe2 = "strlen";
$xe3 = "utf8_decode";
$xe4 = "is_string";
$xe5 = "json_decode";
$xe6 = "is_array";
$xe7 = "header";
$xe8 = "ucwords";
$xe9 = "array_push";
$xea = "print_r";
$xeb = "version_compare";
$xec = "in_array";
$xed = "round";
$xee = "implode";
$xef = "sprintf";
$xf0 = "array_pop";
$xf1 = "ini_get";
$xf2 = "set_time_limit";
$xf3 = "number_format";
$xf4 = "preg_replace";
$xf5 = "strip_tags";
$xf6 = "html_entity_decode";
$xf7 = "htmlspecialchars";
$xf8 = "strrpos";
$xf9 = "stristr";
$xfa = "mb_strtolower";
$xfb = "mb_strtoupper";
$xfc = "htmlentities";
$x20 = new Varien_Io_File();
$x21 = $x20->getCleanPath(Mage::getBaseDir() . '/' . $this->getSimplegoogleshoppingPath());
if (!$x20->allowedPath($x21, Mage::getBaseDir())) {
}
if (!$x20->fileExists($x21, false)) {
Mage::throwException(Mage::helper('simplegoogleshopping')->__('Please create the specified folder "%s" before saving the googleshopping.', Mage::helper('core')->htmlEscape($this->getSimplegoogleshoppingPath())));
}
if (!$x20->isWriteable($x21)) {
Mage::throwException(Mage::helper('simplegoogleshopping')->__('Please make sure that "%s" is writable by web-server.', $this->getSimplegoogleshoppingPath()));
}
if (!$xd9('#^[a-zA-Z0-9_\\.]+$#', $this->getSimplegoogleshoppingFilename())) {
Mage::throwException(Mage::helper('simplegoogleshopping')->__('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 (!$xd9('#\\.xml$#', $this->getSimplegoogleshoppingFilename())) {
$this->setSimplegoogleshoppingFilename($this->getSimplegoogleshoppingFilename() . '.xml');
}
$this->setSimplegoogleshoppingPath($xda($xd6($xd6('\\', '/', Mage::getBaseDir()), '', $x21), '/') . '/');
return parent::_beforeSave();
}