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


PHP FD::exception方法代码示例

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


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

示例1: getFile

 public function getFile($name = null)
 {
     // Check if post_max_size is exceeded.
     if (empty($_FILES) && empty($_POST)) {
         return FD::exception('COM_EASYSOCIAL_EXCEPTION_UPLOAD_POST_SIZE');
     }
     // Get the file
     if (empty($name)) {
         $name = $this->name;
     }
     $file = JRequest::getVar($name, '', 'FILES');
     // Check for invalid file object
     if (empty($file)) {
         return FD::exception('COM_EASYSOCIAL_EXCEPTION_UPLOAD_NO_OBJECT');
     }
     // If there's an error in this file
     if ($file['error']) {
         return FD::exception($file, SOCIAL_EXCEPTION_UPLOAD);
     }
     // Check if file exceeds max upload filesize
     $maxsize = FD::math()->convertBytes($this->maxsize);
     if ($maxsize > 0 && $file['size'] > $maxsize) {
         return FD::exception(JText::sprintf('COM_EASYSOCIAL_EXCEPTION_UPLOAD_MAX_SIZE', FD::math()->convertUnits($maxsize, 'B', 'MB', false, true)));
     }
     // Return file
     return $file;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:27,代码来源:uploader.php

示例2: removeFile

 /**
  * Removes a file from a group.
  *
  * @since	1.2
  * @access	public
  * @return	mixed 	True if success, exception if false.
  */
 public function removeFile()
 {
     // Check if the user has access to delete files from this group
     if (!$this->group->isMember()) {
         return FD::exception(JText::_('COM_EASYSOCIAL_EXPLORER_NO_ACCESS_TO_DELETE'));
     }
     // Get the file id
     $ids = JRequest::getInt('id');
     $ids = FD::makeArray($ids);
     foreach ($ids as $id) {
         $file = FD::table('File');
         $file->load($id);
         if (!$id || !$file->id) {
             return FD::exception(JText::_('COM_EASYSOCIAL_EXPLORER_INVALID_FILE_ID_PROVIDED'));
         }
         $state = $file->delete();
         if (!$state) {
             return FD::exception(JText::_($file->getError()));
         }
     }
     return true;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:29,代码来源:user.php

示例3: hook

 /**
  * Service Hook for explorer
  *
  * @since   1.3
  * @access  public
  * @param   string
  * @return
  */
 public function hook()
 {
     // Check for request forgeries
     FD::checkToken();
     // Require the user to be logged in
     FD::requireLogin();
     // Get the event object
     $uid = $this->input->get('uid', 0, 'int');
     $type = $this->input->get('type', '', 'cmd');
     // Load up the explorer library
     $explorer = FD::explorer($uid, $type);
     // Determine if the viewer can really view items
     if (!$explorer->hook('canViewItem')) {
         return $this->view->call(__FUNCTION__);
     }
     // Get the hook
     $hook = $this->input->get('hook', '', 'cmd');
     // Get the result
     $result = $explorer->hook($hook);
     $exception = FD::exception('Folder retrieval successful', SOCIAL_MSG_SUCCESS);
     return $this->view->call(__FUNCTION__, $exception, $result);
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:30,代码来源:explorer.php

示例4: addFile

 /**
  * Allows caller to upload files
  *
  * @since	1.2
  * @access	public
  * @param	string
  * @return
  */
 public function addFile($title = null)
 {
     if (!$this->hasWriteAccess()) {
         return FD::exception(JText::_('COM_EASYSOCIAL_EXPLORER_NO_ACCESS_TO_UPLOAD'));
     }
     // Ensure that the storage path really exists on the site
     FD::makeFolder($this->storagePath);
     // Get the maximum size allowed from the child
     $max = $this->getMaxSize();
     // Define uploader options
     $options = array('name' => 'file', 'maxsize' => $max);
     // Get uploaded file from $_FILE
     $file = FD::uploader($options)->getFile();
     // If there was an error getting uploaded file, stop.
     if ($file instanceof SocialException) {
         return $file;
     }
     // Get filename
     $name = $file['name'];
     // Get the folder to store this item to.
     $collectionId = JRequest::getInt('id', 0);
     $table = FD::table('File');
     $table->name = $name;
     $table->collection_id = $collectionId;
     $table->hits = 0;
     $table->hash = md5('tmp');
     $table->uid = $this->uid;
     $table->type = $this->type;
     $table->created = JFactory::getDate()->toSql();
     $table->user_id = FD::user()->id;
     $table->size = filesize($file['tmp_name']);
     $table->mime = $file['type'];
     $table->state = SOCIAL_STATE_PUBLISHED;
     $table->storage = SOCIAL_STORAGE_JOOMLA;
     // Try to store the data on the database.
     $table->store();
     // Now we need to really upload the file.
     $state = $table->storeWithFile($file);
     // Format the data now
     $result = $this->format(array($table));
     return $result[0];
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:50,代码来源:abstract.php


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