Example #1
0
 /**
  * Set private flag for duplicate attachment
  * 
  * @param boolean                                                             $private Private flag
  * @param \XLite\Module\CDev\FileAttachments\Model\Product\Attachment\Storage $storage Original storage
  *  
  * @return void
  */
 public function setDuplicatePrivate($private, \XLite\Module\CDev\FileAttachments\Model\Product\Attachment\Storage $storage)
 {
     $this->getStorage()->setPath($storage->getPath());
     $this->getStorage()->setStorageType($storage->getStorageType());
     $this->private = $private;
     $this->oldScope = $private;
 }
Example #2
0
 /**
  * Get storage 
  * 
  * @return \XLite\Module\CDev\FileAttachments\Model\Product\Attachment\Storage
  */
 public function getStorage()
 {
     if (!$this->storage) {
         $this->setStorage(new \XLite\Module\CDev\FileAttachments\Model\Product\Attachment\Storage());
         $this->storage->setAttachment($this);
     }
     return $this->storage;
 }
Example #3
0
 /**
  * Get file extension
  *
  * @return string
  */
 public function getExtension()
 {
     $ext = null;
     if ($this->getAttachment()->getPrivate() && !$this->isURL()) {
         $ext = explode('.', pathinfo($this->getPath(), PATHINFO_FILENAME));
         $ext = $ext[count($ext) - 1];
     }
     return $ext ?: parent::getExtension();
 }