當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。