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


PHP Widgets::deleteWidget方法代码示例

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


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

示例1: deleteAction

 public function deleteAction()
 {
     // Get, check and setup the parameters
     $widget_id = $this->getRequest()->getParam("id");
     // Do we own the widget ?
     $widgets = new Widgets();
     if (!($widget = $widgets->getWidget($widget_id))) {
         throw new Stuffpress_Exception("Unknown widget with id {$widget_id}");
     }
     if ($widget['user_id'] != $this->_application->user->id) {
         throw new Stuffpress_AccessDeniedException("Not the owner of widget {$widget_id}");
     }
     $widgets->deleteWidget($widget_id);
     // Delete the widget properties
     $properties = new WidgetsProperties(array(Properties::KEY => $widget_id));
     $properties->deleteAllProperties();
     return $this->_helper->json->sendJson(false);
 }
开发者ID:kreativmind,项目名称:storytlr,代码行数:18,代码来源:WidgetsController.php

示例2: foreach

$files = $fdb->getFiles();
if ($files && count($files) > 0) {
    foreach ($files as $file) {
        $fdb->deleteFile($file->key);
    }
}
// Delete all stories
$stdb = new Stories();
$stories = $stdb->getStories();
if ($stories && count($stories) > 0) {
    foreach ($stories as $story) {
        $stdb->deleteStory($story['id']);
    }
}
// Delete all widgets
$wdb = new Widgets();
$widgets = $wdb->getWidgets();
if ($widgets && count($widgets) > 0) {
    foreach ($widgets as $widget) {
        $wdb->deleteWidget($widget['id']);
    }
}
// Delete all properties
$up = new Properties(array(Properties::KEY => $user->id));
$up->deleteAllProperties();
$wp = new WidgetsProperties(array(Properties::KEY => $user->id));
$wp->deleteAllProperties();
// Delete the user
$udb->deleteUser($user->id);
// Exit with proper message
die("User {$user->username} has been deleted.\r\n");
开发者ID:kreativmind,项目名称:storytlr,代码行数:31,代码来源:delete.php


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