本文整理汇总了PHP中get_entity_as_row函数的典型用法代码示例。如果您正苦于以下问题:PHP get_entity_as_row函数的具体用法?PHP get_entity_as_row怎么用?PHP get_entity_as_row使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_entity_as_row函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: create_object_entity
/**
* Create or update the extras table for a given object.
* Call create_entity first.
*
* @param int $guid The guid of the entity you're creating (as obtained by create_entity)
* @param string $title The title of the object
* @param string $description The object's description
*
* @return bool
*/
function create_object_entity($guid, $title, $description)
{
global $CONFIG;
$guid = (int) $guid;
$title = sanitise_string($title);
$description = sanitise_string($description);
$row = get_entity_as_row($guid);
if ($row) {
// Core entities row exists and we have access to it
$query = "SELECT guid from {$CONFIG->dbprefix}objects_entity where guid = {$guid}";
if ($exists = get_data_row($query)) {
$query = "UPDATE {$CONFIG->dbprefix}objects_entity\n\t\t\t\tset title='{$title}', description='{$description}' where guid={$guid}";
$result = update_data($query);
if ($result != false) {
// Update succeeded, continue
$entity = get_entity($guid);
elgg_trigger_event('update', $entity->type, $entity);
return $guid;
}
} else {
// Update failed, attempt an insert.
$query = "INSERT into {$CONFIG->dbprefix}objects_entity\n\t\t\t\t(guid, title, description) values ({$guid}, '{$title}','{$description}')";
$result = insert_data($query);
if ($result !== false) {
$entity = get_entity($guid);
if (elgg_trigger_event('create', $entity->type, $entity)) {
return $guid;
} else {
$entity->delete();
}
}
}
}
return false;
}
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:45,代码来源:objects.php
示例2: __construct
public function __construct($guid = null)
{
if ($guid && !is_object($guid)) {
$guid = get_entity_as_row($guid);
}
parent::__construct($guid);
}
开发者ID:nlybe,项目名称:elgg-sharemaps,代码行数:7,代码来源:SharemapsPluginMap.php
示例3: validateEntity
/**
* Check if an entity_guid is valid for sending tag notifications
*
* @param int $entity_guid the entity GUID
*
* @return bool
*/
protected static function validateEntity($entity_guid)
{
$entity_guid = sanitize_int($entity_guid, false);
if (empty($entity_guid)) {
return false;
}
// cache plugin
self::cachePlugin();
if (check_entity_relationship(self::$plugin->getGUID(), 'tag_tools:notification', $entity_guid)) {
// already enqueued
return false;
}
// can't use elgg get entity because cache is not correctly updated
$entity_row = get_entity_as_row($entity_guid);
if ($entity_row === false) {
// invalid entity
return false;
}
$entity_access = sanitise_int($entity_row->access_id);
if ($entity_access === ACCESS_PRIVATE) {
// private entity
return false;
}
if (!tag_tools_is_notification_entity($entity_guid)) {
// not supported entity type/subtype
return false;
}
return true;
}
开发者ID:coldtrick,项目名称:tag_tools,代码行数:36,代码来源:Enqueue.php
示例4: tag_tools_create_metadata_event_handler
/**
* Listen to the creation of metadata
*
* @param string $event the name of the event
* @param string $type the type of the event
* @param ElggMetadata $metadata supplied metadata
*
* @return void
*/
function tag_tools_create_metadata_event_handler($event, $type, $metadata)
{
if (empty($metadata) || !$metadata instanceof ElggMetadata) {
return;
}
// is it a tag
if ($metadata->name != 'tags') {
return;
}
// get the entity for further use
$ia = elgg_set_ignore_access(true);
$entity_guid = $metadata->entity_guid;
// can't use elgg get entity because cache is not correctly updated
$entity_row = get_entity_as_row($entity_guid);
elgg_set_ignore_access($ia);
// shortcut for private entities
if ($entity_row->access_id == ACCESS_PRIVATE) {
return;
}
// only send notifications on creation of the entity
$time_created_treshold = 5;
if ($entity_row->time_created < time() - $time_created_treshold) {
// assume it is an update
return;
}
// check of the entity is allowed for notifications
if (!tag_tools_is_notification_entity($entity_row->guid)) {
return;
}
$tag = $metadata->value;
$options = ['type' => 'user', 'annotation_name_value_pairs' => ['name' => 'follow_tag', 'value' => $tag], 'limit' => false];
$ia = elgg_set_ignore_access(true);
$dbprefix = elgg_get_config('dbprefix');
$entities = new ElggBatch('elgg_get_entities_from_annotations', $options);
foreach ($entities as $user) {
// check if not trying to notify the owner
if ($user->getGUID() == $entity_row->owner_guid) {
continue;
}
// force a correct access bit
elgg_set_ignore_access(false);
// check access for the user, can't use has_access_to_entity
// because that requires a full entity
$access_bit = _elgg_get_access_where_sql(['user_guid' => $user->getGUID()]);
// ignore access to get the correct next user
elgg_set_ignore_access(true);
// build correct query to check access
$query = "SELECT guid FROM {$dbprefix}entities e\n\t\t\t WHERE e.guid = {$entity_guid}\n\t\t\t AND {$access_bit}";
if (get_data($query)) {
// regsiter shutdown function because we need the full entity
// this is a workaround and should be reviewed in the near future
register_shutdown_function('tag_tools_notify_user', $user->getGUID(), $entity_row->guid, $tag);
}
}
elgg_set_ignore_access($ia);
}
开发者ID:coldtrick,项目名称:tag_tools,代码行数:65,代码来源:events.php
示例5: __construct
/**
* Class constructor
*
* @param integer $guid The object guid
* @param integer $user_guid The users guid
* @param string $description The description (reason) for these points
*/
public function __construct($guid = null, $user_guid = null, $description = null)
{
if ($guid && !is_object($guid)) {
$guid = get_entity_as_row($guid);
}
parent::__construct($guid);
if ($guid) {
return true;
}
if (!($user = get_entity($user_guid))) {
return false;
}
$this->attributes['owner_guid'] = $user_guid;
$this->attributes['container_guid'] = $user_guid;
$this->attributes['description'] = $description;
}
开发者ID:iionly,项目名称:elggx_userpoints,代码行数:23,代码来源:Userpoint.php
示例6: create_group_entity
/**
* Create or update the entities table for a given group.
* Call create_entity first.
*
* @param int $guid GUID
* @param string $name Name
* @param string $description Description
*
* @return bool
*/
function create_group_entity($guid, $name, $description)
{
global $CONFIG;
$guid = (int) $guid;
$name = sanitise_string($name);
$description = sanitise_string($description);
$row = get_entity_as_row($guid);
if ($row) {
// Exists and you have access to it
$exists = get_data_row("SELECT guid from {$CONFIG->dbprefix}groups_entity WHERE guid = {$guid}");
if ($exists) {
} else {
}
}
return false;
}
开发者ID:nogsus,项目名称:Elgg,代码行数:26,代码来源:group.php
示例7: create_user_entity
/**
* Create or update the entities table for a given user.
* Call create_entity first.
*
* @param int $guid The user's GUID
* @param string $name The user's display name
* @param string $username The username
* @param string $password The password
* @param string $salt A salt for the password
* @param string $email The user's email address
* @param string $language The user's default language
* @param string $code A code
*
* @return bool
*/
function create_user_entity($guid, $name, $username, $password, $salt, $email, $language, $code)
{
global $CONFIG;
$guid = (int) $guid;
$name = sanitise_string($name);
$username = sanitise_string($username);
$password = sanitise_string($password);
$salt = sanitise_string($salt);
$email = sanitise_string($email);
$language = sanitise_string($language);
$code = sanitise_string($code);
$row = get_entity_as_row($guid);
if ($row) {
// Exists and you have access to it
$query = "SELECT guid from {$CONFIG->dbprefix}users_entity where guid = {$guid}";
if ($exists = get_data_row($query)) {
$query = "UPDATE {$CONFIG->dbprefix}users_entity\n\t\t\t\tset name='{$name}', username='{$username}', password='{$password}', salt='{$salt}',\n\t\t\t\temail='{$email}', language='{$language}', code='{$code}', last_action = " . time() . " where guid = {$guid}";
$result = update_data($query);
if ($result != false) {
// Update succeeded, continue
$entity = get_entity($guid);
if (elgg_trigger_event('update', $entity->type, $entity)) {
return $guid;
} else {
$entity->delete();
}
}
} else {
// Update failed, attempt an insert.
$query = "INSERT into {$CONFIG->dbprefix}users_entity\n\t\t\t\t(guid, name, username, password, salt, email, language, code)\n\t\t\t\tvalues ({$guid}, '{$name}', '{$username}', '{$password}', '{$salt}', '{$email}', '{$language}', '{$code}')";
$result = insert_data($query);
if ($result !== false) {
$entity = get_entity($guid);
if (elgg_trigger_event('create', $entity->type, $entity)) {
return $guid;
} else {
$entity->delete();
//delete_entity($guid);
}
}
}
}
return false;
}
开发者ID:rasul,项目名称:Elgg,代码行数:59,代码来源:users.php
示例8: create_site_entity
/**
* Create or update the entities table for a given site.
* Call create_entity first.
*
* @param int $guid Site GUID
* @param string $name Site name
* @param string $description Site Description
* @param string $url URL of the site
*
* @return bool
* @access private
*/
function create_site_entity($guid, $name, $description, $url)
{
global $CONFIG;
$guid = (int) $guid;
$name = sanitise_string($name);
$description = sanitise_string($description);
$url = sanitise_string($url);
$row = get_entity_as_row($guid);
if ($row) {
// Exists and you have access to it
$query = "SELECT guid from {$CONFIG->dbprefix}sites_entity where guid = {$guid}";
if ($exists = get_data_row($query)) {
$query = "UPDATE {$CONFIG->dbprefix}sites_entity\n\t\t\t\tset name='{$name}', description='{$description}', url='{$url}' where guid={$guid}";
$result = update_data($query);
if ($result != false) {
// Update succeeded, continue
$entity = get_entity($guid);
if (elgg_trigger_event('update', $entity->type, $entity)) {
return $guid;
} else {
$entity->delete();
//delete_entity($guid);
}
}
} else {
// Update failed, attempt an insert.
$query = "INSERT into {$CONFIG->dbprefix}sites_entity\n\t\t\t\t(guid, name, description, url) values ({$guid}, '{$name}', '{$description}', '{$url}')";
$result = insert_data($query);
if ($result !== false) {
$entity = get_entity($guid);
if (elgg_trigger_event('create', $entity->type, $entity)) {
return $guid;
} else {
$entity->delete();
//delete_entity($guid);
}
}
}
}
return false;
}
开发者ID:duanhv,项目名称:mdg-social,代码行数:53,代码来源:sites.php
示例9: create_user_entity
/**
* Create or update the entities table for a given user.
* Call create_entity first.
*
* @param int $guid The user's GUID
* @param string $name The user's display name
* @param string $username The username
* @param string $password The password
* @param string $salt A salt for the password
* @param string $email The user's email address
* @param string $language The user's default language
* @param string $code A code
*
* @return bool
*/
function create_user_entity($guid, $name, $username, $password, $salt, $email, $language, $code)
{
global $CONFIG;
$guid = (int) $guid;
$name = sanitise_string($name);
$username = sanitise_string($username);
$password = sanitise_string($password);
$salt = sanitise_string($salt);
$email = sanitise_string($email);
$language = sanitise_string($language);
$code = sanitise_string($code);
$row = get_entity_as_row($guid);
if ($row) {
// Exists and you have access to it
$query = "SELECT guid from {$CONFIG->dbprefix}users_entity where guid = {$guid}";
if ($exists = get_data_row($query)) {
} else {
// Exists query failed, attempt an insert.
}
}
return false;
}
开发者ID:riggo,项目名称:Elgg,代码行数:37,代码来源:users.php
示例10: get_entity
/**
* Loads and returns an entity object from a guid.
*
* @param int $guid The GUID of the entity
*
* @return ElggEntity The correct Elgg or custom object based upon entity type and subtype
*/
function get_entity($guid)
{
// This should not be a static local var. Notice that cache writing occurs in a completely
// different instance outside this function.
// @todo We need a single Memcache instance with a shared pool of namespace wrappers. This function would pull an instance from the pool.
static $shared_cache;
// We could also use: if (!(int) $guid) { return false },
// but that evaluates to a false positive for $guid = true.
// This is a bit slower, but more thorough.
if (!is_numeric($guid) || $guid === 0 || $guid === '0') {
return false;
}
// Check local cache first
$new_entity = _elgg_retrieve_cached_entity($guid);
if ($new_entity) {
return $new_entity;
}
// Check shared memory cache, if available
if (null === $shared_cache) {
if (is_memcache_available()) {
$shared_cache = new ElggMemcache('new_entity_cache');
} else {
$shared_cache = false;
}
}
// until ACLs in memcache, DB query is required to determine access
$entity_row = get_entity_as_row($guid);
if (!$entity_row) {
return false;
}
if ($shared_cache) {
$cached_entity = $shared_cache->load($guid);
// @todo store ACLs in memcache https://github.com/elgg/elgg/issues/3018#issuecomment-13662617
if ($cached_entity) {
// @todo use ACL and cached entity access_id to determine if user can see it
return $cached_entity;
}
}
// don't let incomplete entities cause fatal exceptions
try {
$new_entity = entity_row_to_elggstar($entity_row);
} catch (IncompleteEntityException $e) {
return false;
}
if ($new_entity) {
_elgg_cache_entity($new_entity);
}
return $new_entity;
}
开发者ID:gzachos,项目名称:elgg_ellak,代码行数:56,代码来源:entities.php
示例11: get_entity
/**
* Loads and returns an entity object from a guid.
*
* @param int $guid The GUID of the entity
*
* @return ElggEntity The correct Elgg or custom object based upon entity type and subtype
* @link http://docs.elgg.org/DataModel/Entities
*/
function get_entity($guid)
{
static $newentity_cache;
$new_entity = false;
// We could also use: if (!(int) $guid) { return FALSE },
// but that evaluates to a false positive for $guid = TRUE.
// This is a bit slower, but more thorough.
if (!is_numeric($guid) || $guid === 0 || $guid === '0') {
return FALSE;
}
if (!$newentity_cache && is_memcache_available()) {
$newentity_cache = new ElggMemcache('new_entity_cache');
}
if ($newentity_cache) {
$new_entity = $newentity_cache->load($guid);
}
if ($new_entity) {
return $new_entity;
}
return entity_row_to_elggstar(get_entity_as_row($guid));
}
开发者ID:nhunaro,项目名称:Elgg,代码行数:29,代码来源:entities.php
示例12: load
/**
* Loads attributes from the entities table into the object.
*
* @param int $guid GUID of Entity
*
* @return bool
*/
protected function load($guid)
{
$row = get_entity_as_row($guid);
if ($row) {
// Create the array if necessary - all subclasses should test before creating
if (!is_array($this->attributes)) {
$this->attributes = array();
}
// Now put these into the attributes array as core values
$objarray = (array) $row;
foreach ($objarray as $key => $value) {
$this->attributes[$key] = $value;
}
// Increment the portion counter
if (!$this->isFullyLoaded()) {
$this->attributes['tables_loaded']++;
}
// Cache object handle
if ($this->attributes['guid']) {
cache_entity($this);
}
return true;
}
return false;
}
开发者ID:rasul,项目名称:Elgg,代码行数:32,代码来源:ElggEntity.php
示例13: subsite_manager_create_metadata_hook
/**
* Create metadata on the correct site
*
* @param string $hook
* @param string $type
* @param int $returnvalue
* @param mixed $params
* @return int $site_guid
*/
function subsite_manager_create_metadata_hook($hook, $type, $returnvalue, $params)
{
$result = $returnvalue;
$entity_guid = elgg_extract("entity_guid", $params);
$metadata_name = elgg_extract("metadata_name", $params);
$site_guid = elgg_extract("site_guid", $params);
if (!empty($entity_guid)) {
if ($entity_row = get_entity_as_row($entity_guid)) {
if ($entity_row->type != "user") {
// default set metadata to the site of the entity
$result = (int) $entity_row->site_guid;
} elseif (subsite_manager_on_subsite()) {
global $SUBSITE_MANAGER_MAIN_PROFILE_FIELDS;
$global_metadata_fields = array("validated", "validation_method", "validated_official", "icontime", "x1", "x2", "y1", "y2");
if (!empty($SUBSITE_MANAGER_MAIN_PROFILE_FIELDS) && is_array($SUBSITE_MANAGER_MAIN_PROFILE_FIELDS)) {
$global_metadata_fields = array_merge($global_metadata_fields, array_keys($SUBSITE_MANAGER_MAIN_PROFILE_FIELDS));
}
if (in_array($metadata_name, $global_metadata_fields)) {
$result = elgg_get_site_entity()->getOwnerGUID();
}
}
}
}
return $result;
}
开发者ID:pleio,项目名称:subsite_manager,代码行数:34,代码来源:hooks.php
示例14: tag_tools_is_notification_entity
/**
* Check is notifications for this entity are allowed
*
* @param int $entity_guid the entity guid
*
* @return bool
*/
function tag_tools_is_notification_entity($entity_guid)
{
$entity_guid = sanitise_int($entity_guid);
$entity_row = get_entity_as_row($entity_guid);
if (empty($entity_row)) {
return false;
}
$type_subtypes = tag_tools_get_notification_type_subtypes();
if (empty($type_subtypes) || !is_array($type_subtypes)) {
return false;
}
$type = $entity_row->type;
if (empty($type) || !isset($type_subtypes[$type])) {
return false;
}
$subtype = get_subtype_from_id($entity_row->subtype);
if (empty($subtype)) {
// user, group, site
return true;
}
return in_array($subtype, elgg_extract($type, $type_subtypes));
}
开发者ID:coldtrick,项目名称:tag_tools,代码行数:29,代码来源:functions.php
示例15: load
/**
* Loads attributes from the entities table into the object.
*
* @param mixed $guid GUID of entity or stdClass object from entities table
*
* @return bool
*/
protected function load($guid)
{
if ($guid instanceof stdClass) {
$row = $guid;
} else {
$row = get_entity_as_row($guid);
}
if ($row) {
// Create the array if necessary - all subclasses should test before creating
if (!is_array($this->attributes)) {
$this->attributes = array();
}
// Now put these into the attributes array as core values
$objarray = (array) $row;
foreach ($objarray as $key => $value) {
$this->attributes[$key] = $value;
}
// Increment the portion counter
if (!$this->isFullyLoaded()) {
$this->attributes['tables_loaded']++;
}
// guid needs to be an int http://trac.elgg.org/ticket/4111
$this->attributes['guid'] = (int) $this->attributes['guid'];
// Cache object handle
if ($this->attributes['guid']) {
cache_entity($this);
}
return true;
}
return false;
}
开发者ID:rcolomoc,项目名称:Master-Red-Social,代码行数:38,代码来源:ElggEntity.php
示例16: remove_all_private_settings
/**
* Deletes all private settings for an entity.
*
* @param int $entity_guid The Entity GUID
*
* @return bool
* @see get_private_setting()
* @see get_all_private_settings()
* @see set_private_setting()
* @see remove_private_settings()
* @link http://docs.elgg.org/DataModel/Entities/PrivateSettings
*/
function remove_all_private_settings($entity_guid)
{
global $PRIVATE_SETTINGS_CACHE;
static $private_setting_memcache;
$dbprefix = elgg_get_config("dbprefix");
$entity_guid = (int) $entity_guid;
// check if you have access to the entity
if (!get_entity_as_row($entity_guid)) {
return false;
}
if (!isset($private_setting_memcache) && is_memcache_available()) {
$private_setting_memcache = new ElggMemcache("private_settings");
}
$query = "DELETE FROM {$dbprefix}private_settings";
$query .= " WHERE entity_guid = {$entity_guid}";
$result = delete_data($query);
if ($result !== false) {
// unset local cache
if (isset($PRIVATE_SETTINGS_CACHE[$entity_guid])) {
unset($PRIVATE_SETTINGS_CACHE[$entity_guid]);
}
// unset memcache
if ($private_setting_memcache) {
// invalidate the settings in Memcache
$private_setting_memcache->delete($entity_guid);
}
}
return $result !== false;
}
开发者ID:pleio,项目名称:subsite_manager,代码行数:41,代码来源:private_settings.php
示例17: get_entity
/**
* Loads and returns an entity object from a guid.
*
* @param int $guid The GUID of the entity
*
* @return ElggEntity The correct Elgg or custom object based upon entity type and subtype
* @link http://docs.elgg.org/DataModel/Entities
*/
function get_entity($guid)
{
static $newentity_cache;
$new_entity = false;
if (!is_numeric($guid)) {
return FALSE;
}
if (!$newentity_cache && is_memcache_available()) {
$newentity_cache = new ElggMemcache('new_entity_cache');
}
if ($newentity_cache) {
$new_entity = $newentity_cache->load($guid);
}
if ($new_entity) {
return $new_entity;
}
return entity_row_to_elggstar(get_entity_as_row($guid));
}
开发者ID:nachopavon,项目名称:Elgg,代码行数:26,代码来源:entities.php
示例18: load
/**
* Overridden from ElggEntity and ElggObject::load(). Core always inits plugins with
* a query joined to the objects_entity table, so all the info is there.
*
* @param mixed $guid GUID of an ElggObject or the stdClass object from entities table
*
* @return bool
* @throws InvalidClassException
*/
protected function load($guid)
{
$expected_attributes = $this->attributes;
unset($expected_attributes['tables_split']);
unset($expected_attributes['tables_loaded']);
// this was loaded with a full join
$needs_loaded = false;
if ($guid instanceof stdClass) {
$row = (array) $guid;
$missing_attributes = array_diff_key($expected_attributes, $row);
if ($missing_attributes) {
$needs_loaded = true;
$old_guid = $guid;
$guid = $row['guid'];
} else {
$this->attributes = $row;
}
} else {
$needs_loaded = true;
}
if ($needs_loaded) {
$entity = (array) get_entity_as_row($guid);
$object = (array) get_object_entity_as_row($guid);
if (!$entity || !$object) {
return false;
}
$this->attributes = array_merge($this->attributes, $entity, $object);
}
$this->attributes['tables_loaded'] = 2;
// Check the type
if ($this->attributes['type'] != 'object') {
$msg = elgg_echo('InvalidClassException:NotValidElggStar', array($guid, get_class()));
throw new InvalidClassException($msg);
}
// guid needs to be an int http://trac.elgg.org/ticket/4111
$this->attributes['guid'] = (int) $this->attributes['guid'];
// cache the entity
if ($this->attributes['guid']) {
cache_entity($this);
}
return true;
}
开发者ID:rcolomoc,项目名称:Master-Red-Social,代码行数:51,代码来源:ElggPlugin.php
示例19: load
/**
* Loads attributes from the entities table into the object.
*
* @param mixed $guid GUID of entity or \stdClass object from entities table
*
* @return bool
*/
protected function load($guid)
{
if ($guid instanceof \stdClass) {
$row = $guid;
} else {
$row = get_entity_as_row($guid);
}
if ($row) {
// Create the array if necessary - all subclasses should test before creating
if (!is_array($this->attributes)) {
$this->attributes = array();
}
// Now put these into the attributes array as core values
$objarray = (array) $row;
foreach ($objarray as $key => $value) {
$this->attributes[$key] = $value;
}
// guid needs to be an int https://github.com/elgg/elgg/issues/4111
$this->attributes['guid'] = (int) $this->attributes['guid'];
// for BC with 1.8, ->subtype always returns ID, ->getSubtype() the string
$this->attributes['subtype'] = (int) $this->attributes['subtype'];
// Cache object handle
if ($this->attributes['guid']) {
_elgg_services()->entityCache->set($this);
}
return true;
}
return false;
}
开发者ID:elgg,项目名称:elgg,代码行数:36,代码来源:ElggEntity.php
示例20: create_group_entity
/**
* Create or update the extras table for a given group.
* Call create_entity first.
*
* @param int $guid
* @param string $name
* @param string $description
*/
function create_group_entity($guid, $name, $description)
{
global $CONFIG;
$guid = (int) $guid;
$name = sanitise_string($name);
$description = sanitise_string($description);
$row = get_entity_as_row($guid);
if ($row) {
// Exists and you have access to it
if ($exists = get_data_row("SELECT guid from {$CONFIG->dbprefix}groups_entity WHERE guid = {$guid}")) {
$result = update_data("UPDATE {$CONFIG->dbprefix}groups_entity set name='{$name}', description='{$description}' where guid={$guid}");
if ($result != false) {
// Update succeeded, continue
$entity = get_entity($guid);
if (trigger_elgg_event('update', $entity->type, $entity)) {
return $guid;
} else {
$entity->delete();
//delete_entity($guid);
}
}
} else {
// Update failed, attempt an insert.
$result = insert_data("INSERT into {$CONFIG->dbprefix}groups_entity (guid, name, description) values ({$guid}, '{$name}','{$description}')");
if ($result !== false) {
$entity = get_entity($guid);
if (trigger_elgg_event('create', $entity->type, $entity)) {
return $guid;
} else {
$entity->delete();
//delete_entity($guid);
}
}
}
}
return false;
}
开发者ID:eokyere,项目名称:elgg,代码行数:45,代码来源:group.php
注:本文中的get_entity_as_row函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论