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


PHP Gdn_Upload::delete方法代码示例

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


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

示例1: removePicture

 /**
  * Remove the photo from a user.
  *
  * @param int $UserID
  */
 public function removePicture($UserID)
 {
     // Grab the current photo.
     $User = $this->getID($UserID, DATASET_TYPE_ARRAY);
     $Photo = $User['Photo'];
     // Only attempt to delete a physical file, not a URL.
     if (!isUrl($Photo)) {
         $ProfilePhoto = changeBasename($Photo, 'p%s');
         $Upload = new Gdn_Upload();
         $Upload->delete($ProfilePhoto);
     }
     // Wipe the Photo field.
     $this->setField($UserID, 'Photo', null);
 }
开发者ID:vanilla,项目名称:vanilla,代码行数:19,代码来源:class.usermodel.php

示例2: deleteDefaultAvatars

 /**
  * Deletes uploaded default avatars.
  *
  * @param string $avatar The avatar to delete.
  */
 private function deleteDefaultAvatars($avatar = '')
 {
     if ($avatar && $this->isUploadedDefaultAvatar($avatar)) {
         $upload = new Gdn_Upload();
         $upload->delete(self::DEFAULT_AVATAR_FOLDER . '/' . basename($avatar));
         $upload->delete(self::DEFAULT_AVATAR_FOLDER . '/' . basename(changeBasename($avatar, 'p%s')));
         $upload->delete(self::DEFAULT_AVATAR_FOLDER . '/' . basename(changeBasename($avatar, 'n%s')));
     }
 }
开发者ID:mcnasby,项目名称:datto-vanilla,代码行数:14,代码来源:class.settingscontroller.php

示例3: removeShareImage

 /**
  * Remove the share image from config & delete it.
  *
  * @since 2.1
  * @param string $TransientKey Security token.
  */
 public function removeShareImage($TransientKey = '')
 {
     $this->permission('Garden.Community.Manage');
     if (Gdn::request()->isAuthenticatedPostBack()) {
         $ShareImage = c('Garden.ShareImage', '');
         removeFromConfig('Garden.ShareImage');
         $Upload = new Gdn_Upload();
         $Upload->delete($ShareImage);
     }
     $this->RedirectUrl = '/settings/banner';
     $this->render('Blank', 'Utility');
 }
开发者ID:karanjitsingh,项目名称:iecse-forum,代码行数:18,代码来源:class.settingscontroller.php

示例4: deletePicture

 /**
  * Delete a screenshot from an addon.
  *
  * @param string $AddonPictureID Picture id to remove.
  * @throws Gdn_UserException No permission to delete this picture.
  */
 public function deletePicture($AddonPictureID = '')
 {
     $AddonPictureModel = new Gdn_Model('AddonPicture');
     $Picture = $AddonPictureModel->getWhere(array('AddonPictureID' => $AddonPictureID))->firstRow();
     $AddonModel = new AddonModel();
     $Addon = $AddonModel->getID($Picture->AddonID);
     $Session = Gdn::session();
     if ($Session->UserID != $Addon['InsertUserID'] && !$Session->checkPermission('Addons.Addon.Manage')) {
         throw permissionException();
     }
     if ($this->Form->authenticatedPostBack() && $this->Form->getFormValue('Yes')) {
         if ($Picture) {
             $Upload = new Gdn_Upload();
             $Upload->delete(changeBasename($Picture->File, 'ao%s'));
             $Upload->delete(changeBasename($Picture->File, 'at%s'));
             $AddonPictureModel->delete(array('AddonPictureID' => $AddonPictureID));
         }
         $this->RedirectUrl = url('/addon/' . $Picture->AddonID);
     }
     $this->render('deletepicture');
 }
开发者ID:vanilla,项目名称:community,代码行数:27,代码来源:class.addoncontroller.php

示例5: removePicture

 /**
  * Remove the photo from a user.
  *
  * @param $UserID
  */
 public function removePicture($UserID)
 {
     // Grab the current photo.
     $User = $this->getID($UserID, DATASET_TYPE_ARRAY);
     if ($Photo = $User['Photo']) {
         $ProfilePhoto = changeBasename($Photo, 'p%s');
         $Upload = new Gdn_Upload();
         $Upload->delete($ProfilePhoto);
         $this->setField($UserID, 'Photo', null);
     }
 }
开发者ID:dimassrio,项目名称:vanilla,代码行数:16,代码来源:class.usermodel.php

示例6: deleteAvatars

 /**
  * Deletes uploaded avatars in the profile size format.
  *
  * @param string $avatar The avatar to delete.
  */
 private function deleteAvatars($avatar = '')
 {
     if ($avatar && $this->isUploadedAvatar($avatar)) {
         $upload = new Gdn_Upload();
         $subdir = stringBeginsWith(dirname($avatar), PATH_UPLOADS . '/', false, true);
         $upload->delete($subdir . '/' . basename(changeBasename($avatar, 'p%s')));
     }
 }
开发者ID:vanilla,项目名称:vanilla,代码行数:13,代码来源:class.profilecontroller.php


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