public function prependScopeInfo($filename) { if (!Mage::helper('magefm_cdn')->isEnabled()) { return parent::prependScoreInfo($filename); } if ($this->_addWhetherScopeInfo()) { $filename = $this->_prependScopeInfo($filename); } return $filename; }
/** * Save uploaded file before saving config value * * Save changes and delete file if "delete" option passed * * @return Codewix_Logo_Model_System_Config_Backend_Logo */ protected function _beforeSave() { $value = $this->getValue(); $deleteFlag = is_array($value) && !empty($value['delete']); $fileTmpName = $_FILES['groups']['tmp_name'][$this->getGroupId()]['fields'][$this->getField()]['value']; if ($this->getOldValue() && ($fileTmpName || $deleteFlag)) { $io = new Varien_Io_File(); $io->rm($this->_getUploadRoot(self::UPLOAD_ROOT_TOKEN) . DS . self::UPLOAD_DIR . DS . $this->getOldValue()); } return parent::_beforeSave(); }
protected function _beforeSave() { if ($_FILES['groups']['tmp_name'][$this->getGroupId()]['fields'][$this->getField()]['value']) { return parent::_beforeSave(); } $value = $this->getValue(); if (is_array($value) && !empty($value['delete'])) { $this->setValue(''); } // fix to save default config value on the first save /* else { $this->unsValue(); }*/ return $this; }