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


PHP Comments::deleteComments方法代码示例

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


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

示例1: deleteAction

 public function deleteAction()
 {
     // Get the source from the request and initialize the model
     $id = $this->_getParam('id');
     // Get the sources database
     $sources = new Sources();
     // Check if the source exists
     if (!($source = $sources->getSource($id))) {
         return $this->_helper->json->sendJson(true);
     }
     // Check if we own the source
     if ($source['user_id'] != $this->_application->user->id) {
         return $this->_helper->json->sendJson(true);
     }
     // Instantiate a model and remove all the data
     $model = SourceModel::newInstance($source['service']);
     $model->setSource($source);
     $model->deleteItems();
     // Delete the duplicated from the Data table
     $data = new Data();
     $data->deleteItems($source['id']);
     // Delete the source settings
     $properties = new SourcesProperties(array(Properties::KEY => $source['id']));
     $properties->deleteAllProperties();
     // Delete the tags
     $tags = new Tags();
     $tags->deleteSource($source['id']);
     // Remove the source
     $sources->deleteSource($id);
     // We should also delete the associated comments
     $comments = new Comments();
     $comments->deleteComments($source['id']);
     // Forward to the list view with a success message
     return $this->_helper->json->sendJson(false);
 }
开发者ID:segphault,项目名称:storytlr,代码行数:35,代码来源:ServicesController.php

示例2: deleteAction

	public function deleteAction() {
		// Get, check and setup the parameters
		$item_id = $this->getRequest()->getParam("id");
		
		// Get the source
		$source_id	= $this->_properties->getProperty('stuffpress_source');
		
		//Verify if the requested item exist
		$data		= new Data();
		if (!($item	= $data->getItem($source_id, $item_id))) {
			throw new Stuffpress_NotFoundException("This item does not exist.");
		}
		
		// Get the user
		$users 			= new Users();
		$attributes		= $item->getAttributes();
		$user			= $users->getUser($attributes['user_id']);
		
		// Check if we are the owner
		if ($this->_application->user->id != $user->id) {
			throw new Stuffpress_NotFoundException("Not the owner");
		}
				
		// Create the source
		$source		= StuffpressModel::forUser($user->id);
		
		// If an image or audio file, delete the files
		$file = $item->getFile();
		if ($file) {
			$files = new Files();
			$files->deleteFile($file);
		}
		
		// All checks ok, we can delete !
		$data->deleteItem($source_id, $item_id);
		$source->deleteItem($item_id);

		// We should also delete the associated comments
		$comments = new Comments();
		$comments->deleteComments($source->getID(), $item_id);

		// return that everything is fine
		return $this->_helper->json->sendJson(true);
	}
开发者ID:rjdjohnston,项目名称:core,代码行数:44,代码来源:PostController.php

示例3: foreach

    foreach ($sources as $source) {
        // Instantiate a model and remove all the data
        $model = SourceModel::newInstance($source['service']);
        $model->setSource($source);
        $model->deleteItems();
        // Delete the duplicated from the Data table
        $data = new Data();
        $data->deleteItems($source['id']);
        // Delete the source settings
        $properties = new SourcesProperties(array(Properties::KEY => $source['id']));
        $properties->deleteAllProperties();
        // Remove the source
        $sdb->deleteSource($source['id']);
        // We should also delete the associated comments
        $comments = new Comments();
        $comments->deleteComments($source['id']);
    }
}
// Delete all user files
$fdb = new Files();
$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) {
开发者ID:kreativmind,项目名称:storytlr,代码行数:31,代码来源:delete.php


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