本文整理匯總了PHP中ElggObject::deleteIcon方法的典型用法代碼示例。如果您正苦於以下問題:PHP ElggObject::deleteIcon方法的具體用法?PHP ElggObject::deleteIcon怎麽用?PHP ElggObject::deleteIcon使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ElggObject
的用法示例。
在下文中一共展示了ElggObject::deleteIcon方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: deleteIcon
/**
* Deletes the previous uploaded icon
*
* @param string $type Icon type
* @return bool
*/
public function deleteIcon($type = 'icon')
{
if ($type == 'icon') {
$fh = new \ElggFile();
$fh->owner_guid = $this->guid;
$icon_sizes = elgg_get_icon_sizes('object', 'event');
foreach ($icon_sizes as $name => $info) {
$fh->setFilename("{$name}.jpg");
if ($fh->exists()) {
$fh->delete();
}
}
unset($this->icontime);
}
return parent::deleteIcon($type);
}
示例2: file_handle_object_delete
/**
* Handle an object being deleted
*
* @param string $event Event name
* @param string $type Event type
* @param ElggObject $file The object deleted
* @return void
*/
function file_handle_object_delete($event, $type, ElggObject $file)
{
if (!$file instanceof ElggFile) {
return;
}
if (!$file->guid) {
// this is an ElggFile used as temporary API
return;
}
$file->deleteIcon();
}