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


PHP delete_entity函数代码示例

本文整理汇总了PHP中delete_entity函数的典型用法代码示例。如果您正苦于以下问题:PHP delete_entity函数的具体用法?PHP delete_entity怎么用?PHP delete_entity使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: delete

 /**
  *
  * @param   <boolean>  $force. True will ignore the media deletion and just drop the entity
  * 
  * @return  <boolean>          True on success else false
  */
 public function delete($force = false)
 {
     if ($this->izap_delete_files(unserialize($this->related_media)) || $force) {
         $challenge_object = get_entity($this->container_guid);
         $quizzes = unserialize($challenge_object->quizzes);
         foreach ($quizzes as $key => $guid) {
             if ($guid != $this->guid) {
                 $new_quizzes[] = $guid;
             }
         }
         $challenge_object->total_questions = count($new_quizzes);
         $quizzes_string = serialize($new_quizzes);
         $challenge_object->quizzes = $quizzes_string;
         return delete_entity($this->guid, true);
     }
     return false;
 }
开发者ID:socialweb,项目名称:PiGo,代码行数:23,代码来源:IzapQuiz.php

示例2: delete

 /**
  *
  * @param  <boolean>  $force. True will ignore the media deletion and just drop the entity
  * @return <boolean>          True on success else false
  */
 public function delete($force = false)
 {
     if ($this->izap_delete_files(unserialize($this->related_media)) || $force) {
         $quizzes_array = unserialize($this->quizzes);
         // deleting all related quizzes
         if (count($quizzes_array) > 0) {
             foreach ($quizzes_array as $quiz_guid => $quiz_val) {
                 $quiz = get_entity($quiz_val);
                 if ($quiz) {
                     $quiz->delete();
                 }
             }
         }
         return delete_entity($this->guid, true);
     }
     return false;
 }
开发者ID:socialweb,项目名称:PiGo,代码行数:22,代码来源:IzapChallenge.php

示例3: clear_admin_message

/**
 * Remove an admin message.
 *
 * @param int $guid The 
 */
function clear_admin_message($guid)
{
    return delete_entity($guid);
}
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:9,代码来源:admin.php

示例4: array

    }
    $users = array();
    $pending_users = array();
    $deleted_users = array();
    // remove all pending, deleted, and archived everythings
    $out[] = '<h2>Entered nonlive entity deletion phase</h2>';
    $q = 'SELECT `id`,`name`,`state` FROM `entity` WHERE `state` != "Live"';
    if ($limit > 0) {
        $q .= ' LIMIT 0,' . $limit;
    }
    $r = db_query($q);
    while ($row = mysql_fetch_array($r, MYSQL_ASSOC)) {
        if (!empty($row['id'])) {
            if ($test_mode) {
                $out[] = 'Would have deleted: ' . strip_tags($row['name']) . ' (id: ' . $row['id'] . '; state: ' . $row['state'] . ')';
            } else {
                delete_entity($row['id']);
                $out[] = 'Deleted: ' . strip_tags($row['name']) . ' (id: ' . $row['id'] . '; state: ' . $row['state'] . ')';
            }
        }
    }
    pray($out);
    echo '<p><a href="?">Return to form</a></p>';
    if ($limit == -1) {
        echo '<p><a href="minimize_3.php">Go to step 3</a></p>';
    }
}
?>
</body>
</html>
开发者ID:hunter2814,项目名称:reason_package,代码行数:30,代码来源:minimize_2.php

示例5: delete

 /**
  * Delete this entity.
  */
 public function delete()
 {
     return delete_entity($this->get('guid'));
 }
开发者ID:jricher,项目名称:Elgg,代码行数:7,代码来源:entities.php

示例6: get_input

$previous_guid = get_input('expage_guid');
// Cache to the session
$_SESSION['expages_content'] = $contents;
$_SESSION['expagestype'] = $type;
$_SESSION['expagestags'] = $tags;
// Convert string of tags into a preformatted array
$tagarray = string_to_tag_array($tags);
// Make sure the content exists
if (empty($contents)) {
    register_error(elgg_echo("expages:blank"));
    forward("mod/expages/add.php");
    // Otherwise, save the new external page
} else {
    //remove the old external page
    if (get_entity($previous_guid)) {
        delete_entity($previous_guid);
    }
    // Initialise a new ElggObject
    $expages = new ElggObject();
    // Tell the system what type of external page it is
    $expages->subtype = $type;
    // Set its owner to the current user
    $expages->owner_guid = $_SESSION['user']->getGUID();
    // For now, set its access to public
    $expages->access_id = 2;
    // Set its title and description appropriately
    $expages->title = $type;
    $expages->description = $contents;
    // Before we can set metadata, save
    if (!$expages->save()) {
        register_error(elgg_echo("expages:error"));
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:31,代码来源:add.php

示例7: elgg_echo

    echo elgg_echo('tidypics:baduploadform');
    exit;
}
// probably POST limit exceeded
if (empty($_FILES)) {
    trigger_error('Tidypics warning: user exceeded post limit on image upload', E_USER_WARNING);
    register_error(elgg_echo('tidypics:exceedpostlimit'));
    elgg_log("ZHError ,tidypics:image:ajax_upload exceedpostlimit, user_id " . elgg_get_logged_in_user_guid(), "ERROR");
    exit;
}
$file = $_FILES[$file_var_name];
$image = new TidypicsImage();
$image->container_guid = $album->getGUID();
$image->setMimeType($file['type']);
$image->access_id = $album->access_id;
$image->batch = $batch;
try {
    $result = $image->save($file);
} catch (Exception $e) {
    // remove the bits that were saved
    delete_entity($image->getGUID());
    $result = false;
    echo $e->getMessage();
}
if ($result) {
    $album->prependImageList(array($image->guid));
    if (elgg_get_plugin_setting('img_river_view', 'tidypics') === "all") {
        add_to_river('river/object/image/create', 'create', $image->getOwnerGUID(), $image->getGUID());
    }
}
exit;
开发者ID:pingwangcs,项目名称:51zhaohu,代码行数:31,代码来源:ajax_upload.php

示例8: db_query

             $out[] = 'Would have deleted table: ' . $table;
         } else {
             $r = db_query('DROP TABLE `' . $table . '`');
             $out[] = 'Deleted table: ' . $table;
         }
     }
 }
 $out[] = '<h2>Entered table entity deletion phase</h2>';
 $es = new entity_selector();
 $all_reason_tables = $es->run_one(id_of('content_table'));
 foreach ($all_reason_tables as $table_id => $table_entity) {
     if (!array_key_exists($table_id, $all_used_tables)) {
         if ($test_mode) {
             $out[] = 'Would have deleted table entity: ' . $table_entity->get_value('name') . ' (id: ' . $table_id . ')';
         } else {
             delete_entity($table_id);
             $out[] = 'Deleted table entity: ' . $table_entity->get_value('name') . ' (id: ' . $table_id . ')';
         }
     }
 }
 // All fields not used by Reason
 // This part is not quite ready for prime time
 /* $out[] = '<h2>Entered field deletion phase</h2>';
 	foreach($all_used_tables as $table_id=>$table_name)
 	{
 		if(!in_array($table_name,$protected_tables))
 		{
 			$es = new entity_selector();
 			$es->add_left_relationship($table_id, relationship_id_of('field_to_entity_table'));
 			$field_entities = $es->run_one(id_of('field'));
 			
开发者ID:hunter2814,项目名称:reason_package,代码行数:30,代码来源:minimize_3.php

示例9: delete

 /**
  * deletes a video, override for the parent delete
  *
  * @return boolean
  */
 public function delete()
 {
     global $CONFIG;
     if ($this->videotype == 'uploaded' && $this->converted == 'no') {
         // delete entity from queue and trash with related media
         $queue_object = new izapQueue();
         $queue_object->delete_from_trash($this->guid, true);
         $queue_object->delete($this->guid, true);
     }
     $imagesrc = $this->imagesrc;
     $filesrc = $this->videofile;
     $ofilesrc = $this->orignalfile;
     $orignal_thumb = $this->orignal_thumb;
     //delete entity from elgg db and corresponding files if exist
     $this->setFilename($imagesrc);
     $image_file = $this->getFilenameOnFilestore();
     file_exists($image_file) && @unlink($image_file);
     $this->setFilename($filesrc);
     $video_file = $this->getFilenameOnFilestore();
     file_exists($video_file) && @unlink($video_file);
     $this->setFilename($ofilesrc);
     $orignal_file = $this->getFilenameOnFilestore();
     file_exists($orignal_file) && @unlink($orignal_file);
     $this->setFilename($orignal_thumb);
     $orignal_thumb_file = $this->getFilenameOnFilestore();
     file_exists($orignal_thumb_file) && @unlink($orignal_thumb_file);
     return delete_entity($this->guid, TRUE);
 }
开发者ID:rimpy,项目名称:izap_videos,代码行数:33,代码来源:izap_videos.php

示例10: forward

<?php

//delete only if admin login
if (!isadminloggedin()) {
    forward('pg/collaboration/admin');
}
$guids_to_delete = get_input('to_delete');
foreach ($guids_to_delete as $guid) {
    delete_entity($guid);
}
forward('pg/collaboration/admin');
开发者ID:rkvsraman,项目名称:elgg_external_sites,代码行数:11,代码来源:delete.php

示例11: testElggEntityRecursiveDisableWhenLoggedOut

 public function testElggEntityRecursiveDisableWhenLoggedOut()
 {
     $e1 = new ElggObject();
     $e1->access_id = ACCESS_PUBLIC;
     $e1->owner_guid = 0;
     $e1->container_guid = 0;
     $e1->save();
     $guid1 = $e1->getGUID();
     $e2 = new ElggObject();
     $e2->container_guid = $guid1;
     $e2->access_id = ACCESS_PUBLIC;
     $e2->owner_guid = 0;
     $e2->save();
     $guid2 = $e2->getGUID();
     // fake being logged out
     $user = $_SESSION['user'];
     unset($_SESSION['user']);
     $ia = elgg_set_ignore_access(true);
     $this->assertTrue(disable_entity($guid1, null, true));
     // "log in" original user
     $_SESSION['user'] = $user;
     elgg_set_ignore_access($ia);
     $this->assertFalse(get_entity($guid1));
     $this->assertFalse(get_entity($guid2));
     $db_prefix = get_config('dbprefix');
     $q = "SELECT * FROM {$db_prefix}entities WHERE guid = {$guid1}";
     $r = get_data_row($q);
     $this->assertEqual('no', $r->enabled);
     $q = "SELECT * FROM {$db_prefix}entities WHERE guid = {$guid2}";
     $r = get_data_row($q);
     $this->assertEqual('no', $r->enabled);
     access_show_hidden_entities(true);
     delete_entity($guid1);
     delete_entity($guid2);
     access_show_hidden_entities(false);
 }
开发者ID:elainenaomi,项目名称:labxp2014,代码行数:36,代码来源:objects.php

示例12: delete_site

function delete_site($site_id, $do_it = false, $types = array(), $limit_dels = -1)
{
    static $all_types = array();
    if (empty($all_types)) {
        $es = new entity_selector();
        $es->add_type(id_of('type'));
        $all_types = $es->run_one();
    }
    $out = array();
    $site = new entity($site_id);
    if ($site->get_value('type') == id_of('site')) {
        $out[] = '<h2>Started deletion process for ' . $site->get_value('name') . ' (id: ' . $site_id . ')</h2>';
    } else {
        trigger_error('id given not the id of a site');
        return false;
    }
    /* $es = new entity_selector();
    	$es->add_type(id_of('type'));
    	$es->add_right_relationship($site_id, relationship_id_of('site_to_type'));
    	$types = $es->run_one(); */
    $es = new entity_selector($site_id);
    $es->set_sharing('owns');
    $es->set_num($limit_dels);
    /* foreach($types as $type_id=>$type)
    	{
    		$es->add_type($type_id);
    	} */
    if (!empty($types)) {
        foreach ($types as $type_id) {
            if (!empty($all_types[$type_id])) {
                $types_to_delete[$type_id] = $all_types[$type_id];
            }
        }
    } else {
        $types_to_delete = $all_types;
    }
    foreach ($types_to_delete as $type_id => $type) {
        $out[] = '<h3>Entered ' . $type->get_value('name') . '</h3>';
        $entities = $es->run_one($type_id);
        $pendings = $es->run_one($type_id, 'Pending');
        $deleteds = $es->run($type_id, 'Deleted');
        if (!empty($pendings)) {
            $entities += $pendings;
        }
        if (!empty($deleteds)) {
            $entities += $deleteds;
        }
        foreach ($entities as $entity_id => $entity) {
            if ($do_it) {
                delete_entity($entity_id);
                $out[] = 'Deleted ' . $entity->get_value('name') . ' (id: ' . $entity_id . ')';
            } else {
                $out[] = 'Would have deleted ' . $entity->get_value('name') . ' (id: ' . $entity_id . ')';
            }
        }
    }
    if ($do_it && empty($types) && $limit_dels == -1) {
        delete_entity($site_id);
        $out[] = '<h3>Deleted Site: ' . $site->get_value('name') . '</h3>';
    } else {
        $out[] = '<h3>Would have deleted site: ' . $site->get_value('name') . '</h3>';
    }
    // should probably delete .htaccess file here
    $htaccess = '/' . trim_slashes(WEB_PATH) . $site->get_value('base_url') . '.htaccess';
    if (file_exists($htaccess)) {
        if ($do_it && empty($types) && $limit_dels == -1) {
            unlink($htaccess);
            $out[] = '<h3>Deleted ' . $htaccess . '</h3>';
        } else {
            $out[] = '<h3>Would have deleted ' . $htaccess . '</h3>';
        }
    }
    return $out;
}
开发者ID:hunter2814,项目名称:reason_package,代码行数:74,代码来源:minimize.php

示例13: delete

 /**
  * Delete this podcast.
  *
  * @return bool
  */
 public function delete($recursive = TRUE)
 {
     // Try regular ElggFile delete first
     $fs = $this->getFilestore();
     if ($fs->delete($this)) {
         return parent::delete();
     } else {
         // Couldn't delete the ElggFile
         $filename = $this->getFilenameOnFilestore($file);
         $success = true;
         // Check for a directory this time, and try again
         if (file_exists($filename) && !is_dir($filename)) {
             $success = unlink($filename);
         }
         // Good? Ok, delete it
         if ($success) {
             return delete_entity($this->get('guid'), $recursive);
         } else {
             // Still an issue..
             return FALSE;
         }
     }
 }
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:28,代码来源:ElggPodcast.php

示例14: elgg_echo

         break;
 }
 // is the user removal type the same as the system removal type
 if ($type == $action) {
     // check if we can do the user action
     if (!empty($confirm_token) && acount_removal_validate_confirm_token($confirm_token, $type, $user_guid)) {
         // prepend the reason with users own request
         $reason = elgg_echo("account_removal:disable:default") . ". " . $reason;
         // send a thank you e-mail
         account_removal_send_thank_notification($action, $user_guid);
         // user has supplied a token, so we can do the action
         if ($action == "disable") {
             $user->ban($reason, false);
             logout();
         } elseif ($action == "remove") {
             delete_entity($user->getGUID(), false);
         }
         system_message(elgg_echo("account_removal:actions:remove:success:" . $action));
         $forward_url = "";
     } elseif (!empty($confirm_token) && !acount_removal_validate_confirm_token($confirm_token, $action, $user_guid)) {
         // token mismatch
         register_error(elgg_echo("account_removal:actions:remove:error:token_mismatch"));
     } else {
         // user requests removal, generate token and sent confirm mail
         account_removal_send_notification($action, $user_guid);
         system_message(elgg_echo("account_removal:actions:remove:success:request"));
         $forward_url = "settings/user/" . $user->username;
     }
 } else {
     register_error(elgg_echo("account_removal:actions:remove:error:type_match"));
 }
开发者ID:lorea,项目名称:Hydra-dev,代码行数:31,代码来源:remove.php

示例15: delete

 /**
  * Delete this entity.
  *
  * @param bool $recursive Whether to delete all the entities contained by this entity
  *
  * @return bool
  */
 public function delete($recursive = true)
 {
     return delete_entity($this->get('guid'), $recursive);
 }
开发者ID:rasul,项目名称:Elgg,代码行数:11,代码来源:ElggEntity.php


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