当前位置: 首页>>代码示例>>PHP>>正文


PHP Fox::getUploadDirectoryPath方法代码示例

本文整理汇总了PHP中Fox::getUploadDirectoryPath方法的典型用法代码示例。如果您正苦于以下问题:PHP Fox::getUploadDirectoryPath方法的具体用法?PHP Fox::getUploadDirectoryPath怎么用?PHP Fox::getUploadDirectoryPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Fox的用法示例。


在下文中一共展示了Fox::getUploadDirectoryPath方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: openStream

 /**
  * Open backup file
  *
  * @throws Exception
  */
 public function openStream()
 {
     if (is_null($this->getFileName())) {
         throw new Exception('Backup file path was not specified.');
     }
     $path = Fox::getUploadDirectoryPath() . DIRECTORY_SEPARATOR . self::BACKUP_PATH;
     if (!file_exists($path)) {
         if (!@mkdir($path, 0777, true)) {
             throw new Exception('backups folder does not exist in uploads directory.');
         }
         @chmod($path, 0777);
     }
     $this->_filePath = $path . DIRECTORY_SEPARATOR . $this->getFileName();
     $mode = 'wb' . self::COMPRESS_RATE;
     try {
         $this->_handler = gzopen($this->_filePath, $mode);
     } catch (Exception $e) {
         throw new Exception('Backup file "' . $this->getFileName() . '" cannot be read from or written to.');
     }
 }
开发者ID:UnicodeSystems-PrivateLimited,项目名称:Zendfox,代码行数:25,代码来源:Backup.php

示例2: groupDeleteAction

 /**
  * Bulk delete action
  */
 public function groupDeleteAction()
 {
     try {
         $model = Fox::getModel('backup/backup');
         $ids = $this->getGroupActionIds($model);
         $totalIds = count($ids);
         $filePath = Fox::getUploadDirectoryPath() . DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR . Fox_Backup_Model_Backup::BACKUP_PATH . DIRECTORY_SEPARATOR;
         if ($totalIds) {
             foreach ($ids as $d) {
                 $model->load($d);
                 @unlink($filePath . $model->getFileName());
                 $model->unSetData();
             }
             $model->delete($model->getPrimaryField() . ' IN (' . implode(',', $ids) . ')');
         }
         Fox::getHelper('core/message')->setInfo('Total ' . $totalIds . ' record(s) successfully deleted.');
     } catch (Exception $e) {
         Fox::getHelper('core/message')->setError($e->getMessage());
     }
     echo Zend_Json_Encoder::encode(array('redirect' => Fox::getUrl('*/*/')));
 }
开发者ID:UnicodeSystems-PrivateLimited,项目名称:Zendfox,代码行数:24,代码来源:BackupController.php

示例3: getFavicon

 /**
  * Get favicon image path
  * 
  * @return string
  */
 public function getFavicon()
 {
     $imgName = Fox::getPreference('web/head/favicon_image');
     if ($imgName && file_exists(Fox::getUploadDirectoryPath() . DIRECTORY_SEPARATOR . Fox_Core_Model_Preference::CORE_UPLOAD_FOLDER . DIRECTORY_SEPARATOR . $imgName)) {
         return Fox::getUploadDirectoryUrl() . '/' . Fox_Core_Model_Preference::CORE_UPLOAD_FOLDER . '/' . $imgName;
     } else {
         return $this->themeUrl('images/default_favicon.ico');
     }
 }
开发者ID:UnicodeSystems-PrivateLimited,项目名称:Zendfox,代码行数:14,代码来源:Head.php

示例4: _preSave

 /**
  * Process data before save
  * 
  * @param array $data
  * @return array 
  * @throws Exception if uploads directory not found
  */
 protected function _preSave(array $data)
 {
     if (!empty($_FILES)) {
         $path = Fox::getUploadDirectoryPath() . DIRECTORY_SEPARATOR . $this->_eav_entity_type;
         if (!file_exists($path)) {
             if (!@mkdir($path, 777, TRUE)) {
                 throw new Exception('uploads directory was not found.');
             }
         }
         foreach ($_FILES as $key => $file) {
             if (isset($file['tmp_name']) && $file['tmp_name']) {
                 if (($pos = strrpos($file['name'], '.')) > -1) {
                     $ext = substr($file['name'], $pos + 1);
                     $fileName = 'FILE-' . time() . '.' . $ext;
                     $filePath = $path . DIRECTORY_SEPARATOR;
                     $upload = new Zend_File_Transfer_Adapter_Http();
                     $upload->setDestination($filePath);
                     $upload->receive($key);
                     $uploadedfilepath = $upload->getFileName($key);
                     $filterFileRename = new Zend_Filter_File_Rename(array('target' => $filePath . $fileName, 'overwrite' => true));
                     $filterFileRename->filter($uploadedfilepath);
                     $method = Uni_Core_Model::SET . Fox::getCamelCase($key);
                     $this->{$method}($fileName);
                 }
             }
         }
     }
     return parent::_preSave($data);
 }
开发者ID:UnicodeSystems-PrivateLimited,项目名称:Zendfox,代码行数:36,代码来源:Abstract.php

示例5: getImageUploadPath

 /**
  * Retrieve upload path for member images
  * 
  * @return string
  */
 public static function getImageUploadPath()
 {
     return Fox::getUploadDirectoryPath() . DIRECTORY_SEPARATOR . self::ENTITY_TYPE_MEMBER;
 }
开发者ID:UnicodeSystems-PrivateLimited,项目名称:Zendfox,代码行数:9,代码来源:Member.php

示例6: saveAction

 /**
  * Save action
  */
 public function saveAction()
 {
     if ($this->getRequest()->isPost()) {
         $data = $this->getRequest()->getPost();
         $preferenceModel = Fox::getModel('core/preference');
         $preferenceModel->getAdapter()->beginTransaction();
         try {
             if (!empty($_FILES)) {
                 $path = Fox::getUploadDirectoryPath() . DIRECTORY_SEPARATOR . Fox_Core_Model_Preference::CORE_UPLOAD_FOLDER;
                 if (!file_exists($path)) {
                     if (!@mkdir($path, 0777, TRUE)) {
                         throw new Exception('uploads directory was not found.');
                     }
                     @chmod($path, 0777);
                 }
                 foreach ($_FILES as $mainKey => $value) {
                     if (is_array($value) && isset($value['name']) || isset($value['tmp_name'])) {
                         $i = 0;
                         foreach ($value as $section => $field) {
                             foreach ($field as $key => $fieldValue) {
                                 if ($section == 'name') {
                                     foreach ($fieldValue as $fieldName => $fileField) {
                                         $fieldKey = $mainKey . '/' . $key . '/' . $fieldName;
                                         $preferenceModel->load($fieldKey, 'name');
                                         if (isset($_FILES[$mainKey]) && isset($_FILES[$mainKey]['name']) && isset($_FILES[$mainKey]['name'][$key]) && isset($_FILES[$mainKey]['name'][$key][$fieldName])) {
                                             $fileName = $_FILES[$mainKey]['name'][$key][$fieldName];
                                             if (($pos = strrpos($fileName, '.')) > -1) {
                                                 if (file_exists($path . DIRECTORY_SEPARATOR . $preferenceModel->getValue())) {
                                                     @unlink($path . DIRECTORY_SEPARATOR . $preferenceModel->getValue());
                                                 }
                                                 $ext = substr($fileName, $pos + 1);
                                                 $fileName = 'FILE-' . time() . $i++ . '.' . $ext;
                                                 $filePath = $path . DIRECTORY_SEPARATOR . $fileName;
                                                 move_uploaded_file($_FILES[$mainKey]['tmp_name'][$key][$fieldName], $filePath);
                                                 @chmod($filePath, 0777);
                                                 $preferenceModel->setName($fieldKey);
                                                 $preferenceModel->setValue($fileName);
                                                 $preferenceModel->save();
                                                 $preferenceModel->unsetData();
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
             foreach ($data as $mainKey => $value) {
                 if (is_array($value)) {
                     foreach ($value as $section => $field) {
                         foreach ($field as $key => $fieldValue) {
                             $fieldKey = $mainKey . '/' . $section . '/' . $key;
                             $preferenceModel->load($fieldKey, 'name');
                             $preferenceModel->setName($fieldKey);
                             if (is_array($fieldValue)) {
                                 $val = implode(',', $fieldValue);
                             } else {
                                 $val = $fieldValue;
                             }
                             $preferenceModel->setValue($val);
                             $preferenceModel->save();
                             $preferenceModel->unsetData();
                         }
                     }
                 }
             }
             $preferenceModel->getAdapter()->commit();
             Uni_Core_Preferences::loadPreferences(TRUE);
             Fox::initializePreferences();
             Fox::getHelper('core/message')->setInfo('Data was successfully saved.');
         } catch (Exception $e) {
             Fox::getModel('core/session')->setFormData($data);
             Fox::getHelper('core/message')->setError($e->getMessage());
             $preferenceModel->getAdapter()->rollback();
             $this->sendRedirect('*/*/edit', array('item' => $mainKey));
         }
     }
     if (isset($mainKey)) {
         $this->sendRedirect('*/*/edit', array('item' => $mainKey));
     } else {
         $this->sendRedirect('*/*/');
     }
 }
开发者ID:UnicodeSystems-PrivateLimited,项目名称:Zendfox,代码行数:87,代码来源:SettingController.php


注:本文中的Fox::getUploadDirectoryPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。