當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Varien_Io_File::dirsep方法代碼示例

本文整理匯總了PHP中Varien_Io_File::dirsep方法的典型用法代碼示例。如果您正苦於以下問題:PHP Varien_Io_File::dirsep方法的具體用法?PHP Varien_Io_File::dirsep怎麽用?PHP Varien_Io_File::dirsep使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Varien_Io_File的用法示例。


在下文中一共展示了Varien_Io_File::dirsep方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: moveFileFromTmp

 /**
  * Move file from tmp path to base path
  *
  * @param string $baseTmpPath
  * @param string $basePath
  * @param string $file
  * @return string
  */
 public function moveFileFromTmp($baseTmpPath, $basePath, $file)
 {
     $ioObject = new Varien_Io_File();
     $destDirectory = dirname($this->getFilePath($basePath, $file));
     try {
         $ioObject->open(array('path' => $destDirectory));
     } catch (Exception $e) {
         $ioObject->mkdir($destDirectory, 0777, true);
         $ioObject->open(array('path' => $destDirectory));
     }
     if (strrpos($file, '.tmp') == strlen($file) - 4) {
         $file = substr($file, 0, strlen($file) - 4);
     }
     $destFile = dirname($file) . $ioObject->dirsep() . Varien_File_Uploader::getNewFileName($this->getFilePath($basePath, $file));
     $result = $ioObject->mv($this->getFilePath($baseTmpPath, $file), $this->getFilePath($basePath, $file));
     return str_replace($ioObject->dirsep(), '/', $destFile);
 }
開發者ID:HelioFreitas,項目名稱:magento-pt_br,代碼行數:25,代碼來源:File.php

示例2: _copyImage

 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);
 }
開發者ID:jokusafet,項目名稱:MagentoSource,代碼行數:24,代碼來源:Copyimg.php

示例3: _moveFileFromTmp

 protected function _moveFileFromTmp($baseTmpPath, $basePath, $file)
 {
     $ioObject = new Varien_Io_File();
     $destDirectory = dirname($this->getFilePath($basePath, $file));
     try {
         $ioObject->open(array('path' => $destDirectory));
     } catch (Exception $e) {
         $ioObject->mkdir($destDirectory, 0777, true);
         $ioObject->open(array('path' => $destDirectory));
     }
     if (strrpos($file, '.tmp') == strlen($file) - 4) {
         $file = substr($file, 0, strlen($file) - 4);
     }
     // DO NOT rename file if it exists. Overwrite it. Custumer request in ticket#2012120510000418 — Magento is losing connection to files
     $destFile = $file;
     //$destFile = dirname($file) . $ioObject->dirsep()
     //          . Mage_Core_Model_File_Uploader::getNewFileName($this->getFilePath($basePath, $file));
     //die ("destFile: $destFile<br>file: $file<br>basePath: $basePath<br>dirname: ".dirname($file));
     Mage::helper('core/file_storage_database')->copyFile($this->getFilePath($baseTmpPath, $file), $this->getFilePath($basePath, $destFile));
     $result = $ioObject->mv($this->getFilePath($baseTmpPath, $file), $this->getFilePath($basePath, $destFile));
     return str_replace($ioObject->dirsep(), '/', $destFile);
 }
開發者ID:ankita-parashar,項目名稱:magento,代碼行數:22,代碼來源:ICC_Downloadable_Helper_File.php

示例4: _moveFileFromTmp

 /**
  * Move file from tmp path to base path
  *
  * @param string $baseTmpPath
  * @param string $basePath
  * @param string $file
  * @return string
  */
 protected function _moveFileFromTmp($baseTmpPath, $basePath, $file)
 {
     $ioObject = new Varien_Io_File();
     $destDirectory = dirname($this->getFilePath($basePath, $file));
     try {
         $ioObject->open(array('path' => $destDirectory));
     } catch (Exception $e) {
         $ioObject->mkdir($destDirectory, 0777, true);
         $ioObject->open(array('path' => $destDirectory));
     }
     if (strrpos($file, '.tmp') == strlen($file) - 4) {
         $file = substr($file, 0, strlen($file) - 4);
     }
     $destFile = dirname($file) . $ioObject->dirsep() . Mage_Core_Model_File_Uploader::getNewFileName($this->getFilePath($basePath, $file));
     Mage::helper('Mage_Core_Helper_File_Storage_Database')->copyFile($this->getFilePath($baseTmpPath, $file), $this->getFilePath($basePath, $destFile));
     $result = $ioObject->mv($this->getFilePath($baseTmpPath, $file), $this->getFilePath($basePath, $destFile));
     return str_replace($ioObject->dirsep(), '/', $destFile);
 }
開發者ID:natxetee,項目名稱:magento2,代碼行數:26,代碼來源:File.php

示例5: _copyImage

 /**
  * Copy image and return new filename.
  *
  * @param string $file
  * @return string
  */
 protected function _copyImage($file)
 {
     try {
         $ioObject = new Varien_Io_File();
         $destDirectory = dirname($this->_getConfig()->getMediaPath($file));
         $ioObject->open(array('path' => $destDirectory));
         $destFile = dirname($file) . $ioObject->dirsep() . Varien_File_Uploader::getNewFileName($this->_getConfig()->getMediaPath($file));
         if (!$ioObject->fileExists($this->_getConfig()->getMediaPath($file), true)) {
             throw new Exception();
         }
         $ioObject->cp($this->_getConfig()->getMediaPath($file), $this->_getConfig()->getMediaPath($destFile));
     } catch (Exception $e) {
         Mage::throwException(Mage::helper('catalog')->__('Failed to copy file %s. Please, delete media with non-existing images and try again.', $this->_getConfig()->getMediaPath($file)));
     }
     return str_replace($ioObject->dirsep(), '/', $destFile);
 }
開發者ID:jpbender,項目名稱:mage_virtual,代碼行數:22,代碼來源:Media.php

示例6: _moveImageFromTmp

 /**
  * Move image from temporary directory to normal
  *
  * @param string $file
  * @return string
  */
 protected function _moveImageFromTmp($file)
 {
     $ioObject = new Varien_Io_File();
     $destDirectory = dirname($this->_getConfig()->getMediaPath($file));
     try {
         $ioObject->open(array('path' => $destDirectory));
     } catch (Exception $e) {
         $ioObject->mkdir($destDirectory, 0777, true);
         $ioObject->open(array('path' => $destDirectory));
     }
     $destFile = dirname($file) . $ioObject->dirsep() . Varien_File_Uploader::getNewFileName($this->_getConfig()->getMediaPath($file));
     $ioObject->mv($this->_getConfig()->getTmpMediaPath($file), $this->_getConfig()->getMediaPath($destFile));
     return $destFile;
 }
開發者ID:arslbbt,項目名稱:mangentovies,代碼行數:20,代碼來源:Media.php

示例7: copyImage

 /**
  * Copy image from temp folder
  *
  * @param array $image
  * @return string
  */
 public function copyImage($image)
 {
     $ioObject = new Varien_Io_File();
     $file = $image['file'];
     $destDirectory = dirname($this->_getConfig()->getMediaPath($file));
     try {
         $ioObject->open(array('path' => $destDirectory));
     } catch (Exception $e) {
         $ioObject->mkdir($destDirectory, 0777, true);
         $ioObject->open(array('path' => $destDirectory));
     }
     if (strrpos($file, '.tmp') == strlen($file) - 4) {
         $file = substr($file, 0, strlen($file) - 4);
     }
     $destFile = $this->_getUniqueFileName($file, $ioObject->dirsep());
     /** @var $storageHelper Mage_Core_Helper_File_Storage_Database */
     $storageHelper = Mage::helper('core/file_storage_database');
     if ($storageHelper->checkDbUsage()) {
         $storageHelper->renameFile($this->_getConfig()->getTmpMediaShortUrl($file), $this->_getConfig()->getMediaShortUrl($destFile));
         $ioObject->rm($this->_getConfig()->getTmpMediaPath($file));
         $ioObject->rm($this->_getConfig()->getMediaPath($destFile));
     } else {
         $ioObject->mv($this->_getConfig()->getTmpMediaPath($file), $this->_getConfig()->getMediaPath($destFile));
     }
     return str_replace($ioObject->dirsep(), '/', $destFile);
 }
開發者ID:kalburgimanjunath,項目名稱:magento-dealers,代碼行數:32,代碼來源:Gallery.php

示例8: _copyImage

 /**
  * Copy image and return new filename.
  *
  * @param string $file
  * @return string
  */
 protected function _copyImage($file)
 {
     $ioObject = new Varien_Io_File();
     $destDirectory = dirname($this->_getConfig()->getMediaPath($file));
     $ioObject->open(array('path' => $destDirectory));
     $destFile = dirname($file) . $ioObject->dirsep() . Varien_File_Uploader::getNewFileName($this->_getConfig()->getMediaPath($file));
     $ioObject->cp($this->_getConfig()->getMediaPath($file), $this->_getConfig()->getMediaPath($destFile));
     return str_replace($ioObject->dirsep(), '/', $destFile);
 }
開發者ID:ronseigel,項目名稱:agent-ohm,代碼行數:15,代碼來源:Product_Attribute_Backend_Media.php


注:本文中的Varien_Io_File::dirsep方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。