本文整理汇总了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);
}
示例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')));
}
}
示例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');
}
示例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');
}
示例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);
}
}
示例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')));
}
}