• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP get_subtype_id函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: delete_event_handler

/**
 * Clean up operations on calendar delete
 *
 * @param string     $event  "delete"
 * @param string     $type   "object"
 * @param ElggEntity $entity Entity being deleted
 */
function delete_event_handler($event, $type, $entity)
{
    if ($entity instanceof Calendar) {
        // Do not allow users to delete publi calendars
        if ($entity->isPublicCalendar() && !elgg_is_admin_logged_in()) {
            register_error(elgg_echo('events:error:public_calendar_delete'));
            return false;
        }
        // Move all orphaned events to the public calendar
        $owner = $entity->getContainerEntity();
        $public_calendar = Calendar::getPublicCalendar($owner);
        if (!$public_calendar) {
            register_error(elgg_echo('events:error:no_public_for_orphans'));
            return false;
        }
        $dbprefix = elgg_get_config('dbprefix');
        $relationship_name = sanitize_string(Calendar::EVENT_CALENDAR_RELATIONSHIP);
        $calendar_subtype_id = (int) get_subtype_id('object', Calendar::SUBTYPE);
        // Get all events that do not appear on container's other calendars
        $events = new ElggBatch('elgg_get_entities_from_relationship', array('types' => 'object', 'subtypes' => Event::SUBTYPE, 'relationship' => Calendar::EVENT_CALENDAR_RELATIONSHIP, 'relationship_guid' => $entity->guid, 'inverse_relationship' => true, 'limit' => 0, 'wheres' => array("NOT EXISTS(SELECT * FROM {$dbprefix}entity_relationships er2\n\t\t\t\t\tJOIN {$dbprefix}entities e2 ON er2.guid_two = e2.guid\n\t\t\t\t\tWHERE er2.relationship = '{$relationship_name}'\n\t\t\t\t\t\tAND er2.guid_one = e.guid\n\t\t\t\t\t\tAND er2.guid_two != {$entity->guid}\n\t\t\t\t\t\tAND e2.container_guid = {$entity->container_guid}\n\t\t\t\t\t\tAND e2.type = 'object' AND e2.subtype = {$calendar_subtype_id})")));
        foreach ($events as $event) {
            /* @var Event $event */
            $public_calendar->addEvent($event);
        }
    }
    return true;
}
开发者ID:arckinteractive,项目名称:events_api,代码行数:34,代码来源:events.php


示例2: profile_manager_run_once

function profile_manager_run_once()
{
    global $CONFIG;
    // upgrade
    $profile_field_class_name = "ProfileManagerCustomProfileField";
    $group_field_class_name = "ProfileManagerCustomGroupField";
    $field_type_class_name = "ProfileManagerCustomProfileType";
    $field_category_class_name = "ProfileManagerCustomFieldCategory";
    if ($id = get_subtype_id('object', ProfileManagerCustomProfileField::SUBTYPE)) {
        update_data("UPDATE {$CONFIG->dbprefix}entity_subtypes set class='{$profile_field_class_name}' WHERE id={$id}");
    } else {
        add_subtype('object', ProfileManagerCustomProfileField::SUBTYPE, $profile_field_class_name);
    }
    if ($id = get_subtype_id('object', ProfileManagerCustomGroupField::SUBTYPE)) {
        update_data("UPDATE {$CONFIG->dbprefix}entity_subtypes set class='{$group_field_class_name}' WHERE id={$id}");
    } else {
        add_subtype('object', ProfileManagerCustomGroupField::SUBTYPE, $group_field_class_name);
    }
    if ($id = get_subtype_id('object', ProfileManagerCustomProfileType::SUBTYPE)) {
        update_data("UPDATE {$CONFIG->dbprefix}entity_subtypes set class='{$field_type_class_name}' WHERE id={$id}");
    } else {
        add_subtype('object', ProfileManagerCustomProfileType::SUBTYPE, $field_type_class_name);
    }
    if ($id = get_subtype_id('object', ProfileManagerCustomFieldCategory::SUBTYPE)) {
        update_data("UPDATE {$CONFIG->dbprefix}entity_subtypes set class='{$field_category_class_name}' WHERE id={$id}");
    } else {
        add_subtype('object', ProfileManagerCustomFieldCategory::SUBTYPE, $field_category_class_name);
    }
}
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:29,代码来源:start.php


示例3: blog2groups_push_post

/**
 * Push the blog post to the configured site
 */
function blog2groups_push_post($event, $object_type, $object)
{
    // work around Elgg bug with subtype
    $id = get_subtype_id('object', 'blog');
    if ($object->subtype !== 'blog' && $object->subtype !== $id) {
        return;
    }
    if ($object->access_id == ACCESS_PRIVATE) {
        return;
    }
    $url = get_plugin_setting('url', 'blog2groups');
    if (!$url) {
        return;
    }
    // work around a Elgg bug with encoding parameters
    $url = str_replace('&', '&', $url);
    $body = $object->summary . "\n\n" . $object->description;
    $params = array('username' => $object->getOwnerEntity()->username, 'title' => $object->title, 'body' => $body);
    $post_data = http_build_query($params);
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $json = curl_exec($ch);
    curl_close($ch);
    $result = json_decode($json);
    if ($result->status != 0) {
        error_log("Failed to send blog post: {$result->message}");
    }
}
开发者ID:Elgg,项目名称:blog2groups,代码行数:34,代码来源:start.php


示例4: search

 public function search($string, $search_type, $type, $subtypes = array(), $limit = 10, $offset = 0, $sort = "", $order = "", $container_guid = 0, $profile_fields = array())
 {
     if ($search_type == 'tags') {
         $search_type = SEARCH_TAGS;
     } else {
         $search_type = SEARCH_DEFAULT;
     }
     $query = new ESQuery($this->index, $search_type);
     $query->setOffset($offset);
     $query->setLimit($limit);
     if ($type) {
         $query->filterType($type);
     }
     if ($subtypes) {
         $search_subtypes = array();
         if (is_array($subtypes)) {
             foreach ($subtypes as $subtype) {
                 $search_subtypes[] = get_subtype_id('object', $subtype);
             }
         } else {
             $search_subtypes[] = get_subtype_id('object', $subtypes);
         }
         $query->filterSubtypes($search_subtypes);
     }
     if ($container_guid) {
         $query->filterContainer($container_guid);
     }
     if ($profile_fields && count($profile_fields) > 0) {
         $query->filterProfileFields($profile_fields);
     }
     try {
         $results = $this->client->search($query->search($string));
     } catch (Exception $e) {
         elgg_log('Elasticsearch search exception ' . $e->getMessage(), 'ERROR');
         return array('count' => 0, 'count_per_type' => array(), 'count_per_subtype' => array(), 'hits' => array());
     }
     $hits = array();
     foreach ($results['hits']['hits'] as $hit) {
         if ($hit['_type'] == 'annotation') {
             $object = elgg_get_annotation_from_id($hit['_id']);
         } else {
             $object = get_entity($hit['_id']);
         }
         if ($object) {
             $hits[] = $object;
         }
     }
     $count_per_type = array();
     foreach ($results['facets']['type']['terms'] as $type) {
         $count_per_type[$type['term']] = $type['count'];
     }
     $count_per_subtype = array();
     foreach ($results['facets']['subtype']['terms'] as $subtype) {
         if ($subtype['term']) {
             $key = get_subtype_from_id($subtype['term']);
             $count_per_subtype[$key] = $subtype['count'];
         }
     }
     return array('count' => $results['hits']['total'], 'count_per_type' => $count_per_type, 'count_per_subtype' => $count_per_subtype, 'hits' => $hits);
 }
开发者ID:rubenve,项目名称:elasticsearch,代码行数:60,代码来源:ESInterface.php


示例5: setGroupMailClassHandler

 /**
  * Set the correct class for the GroupMail subtype
  *
  * @param string $event  the name of the event
  * @param string $type   the type of the event
  * @param mixed  $object supplied object
  *
  * @return void
  */
 public static function setGroupMailClassHandler($event, $type, $object)
 {
     if (get_subtype_id('object', \GroupMail::SUBTYPE)) {
         update_subtype('object', \GroupMail::SUBTYPE, 'GroupMail');
     } else {
         add_subtype('object', \GroupMail::SUBTYPE, 'GroupMail');
     }
 }
开发者ID:coldtrick,项目名称:group_tools,代码行数:17,代码来源:Upgrade.php


示例6: setClassHandler

 /**
  * Listen to the upgrade event to set the correct class handler
  *
  * @param string $event  the name of the event
  * @param string $type   the type of the event
  * @param null   $object supplied param
  *
  * @return void
  */
 public static function setClassHandler($event, $type, $object)
 {
     if (get_subtype_id('object', \CSVExport::SUBTYPE)) {
         update_subtype('object', \CSVExport::SUBTYPE, 'CSVExport');
     } else {
         add_subtype('object', \CSVExport::SUBTYPE, 'CSVExport');
     }
 }
开发者ID:coldtrick,项目名称:csv_exporter,代码行数:17,代码来源:Upgrade.php


示例7: setClassHandler

 /**
  * Update the class for publication subtype
  *
  * @param string $event  the name of the event
  * @param string $type   the type of the event
  * @param mixed  $object supplied params
  *
  * @return void
  */
 public static function setClassHandler($event, $type, $object)
 {
     // set correct class handler for Publication
     if (get_subtype_id('object', \Publication::SUBTYPE)) {
         update_subtype('object', \Publication::SUBTYPE, 'Publication');
     } else {
         add_subtype('object', \Publication::SUBTYPE, 'Publication');
     }
 }
开发者ID:Beaufort8,项目名称:elgg-publication,代码行数:18,代码来源:Upgrade.php


示例8: pages_2012061800

/**
 * Update subtype
 *
 * @param ElggObject $page
 */
function pages_2012061800($page)
{
    $dbprefix = elgg_get_config('dbprefix');
    $subtype_id = (int) get_subtype_id('object', 'page_top');
    $page_guid = (int) $page->guid;
    update_data("UPDATE {$dbprefix}entities\n\t\tSET subtype = {$subtype_id} WHERE guid = {$page_guid}");
    error_log("called");
    return true;
}
开发者ID:duanhv,项目名称:mdg-social,代码行数:14,代码来源:2012061800.php


示例9: setClassHandler

 /**
  * Make sure the class handler for QuickLink is correct
  *
  * @param string $event  the name of the event
  * @param string $type   the type of the event
  * @param mixed  $object misc params
  *
  * @return void
  */
 public static function setClassHandler($event, $type, $object)
 {
     // set correct class handler for QuickLink
     if (get_subtype_id('object', \QuickLink::SUBTYPE)) {
         update_subtype('object', \QuickLink::SUBTYPE, 'QuickLink');
     } else {
         add_subtype('object', \QuickLink::SUBTYPE, 'QuickLink');
     }
 }
开发者ID:coldtrick,项目名称:quicklinks,代码行数:18,代码来源:Upgrade.php


示例10: apiadmin_delete_key

/**
 * Event handler for when an API key is deleted
 * 
 * @param unknown_type $event
 * @param unknown_type $object_type
 * @param unknown_type $object
 */
function apiadmin_delete_key($event, $object_type, $object = null)
{
    global $CONFIG;
    if ($object && $object->subtype === get_subtype_id('object', 'api_key')) {
        // Delete secret key
        return remove_api_user($CONFIG->site_id, $object->public);
    }
    return true;
}
开发者ID:elgg,项目名称:apiadmin,代码行数:16,代码来源:start.php


示例11: addSortQuery

 /**
  * {@inheritdoc}
  */
 public static function addSortQuery(array $options = [], $field = 'time_created', $direction = 'DESC')
 {
     $dbprefix = elgg_get_config('dbprefix');
     $order_by = explode(',', elgg_extract('order_by', $options, ''));
     array_walk($order_by, 'trim');
     $options['joins']['objects_entity'] = "\n\t\t\tJOIN {$dbprefix}objects_entity AS objects_entity\n\t\t\t\tON objects_entity.guid = e.guid\n\t\t\t";
     switch ($field) {
         case 'type':
         case 'subtype':
         case 'guid':
         case 'owner_guid':
         case 'container_guid':
         case 'site_guid':
         case 'enabled':
         case 'time_created':
         case 'time_updated':
         case 'access_id':
             array_unshift($order_by, "e.{$field} {$direction}");
             break;
         case 'title':
         case 'description':
             array_unshift($order_by, "objects_entity.{$field} {$direction}");
             break;
         case 'last_action':
             $options['selects']['last_action'] = "\n\t\t\t\t\tGREATEST (e.time_created, e.last_action, e.time_updated) AS last_action\n\t\t\t\t\t";
             array_unshift($order_by, "last_action {$direction}");
             break;
         case 'likes_count':
             $name_id = elgg_get_metastring_id('likes');
             $options['joins']['likes_count'] = "\n\t\t\t\t\tLEFT JOIN {$dbprefix}annotations AS likes\n\t\t\t\t\t\tON likes.entity_guid = e.guid AND likes.name_id = {$name_id}\n\t\t\t\t\t";
             $options['selects']['likes_count'] = "COUNT(likes.id) as likes_count";
             $options['group_by'] = 'e.guid';
             array_unshift($order_by, "likes_count {$direction}");
             $order_by[] = 'e.time_created DESC';
             // show newest first if count is the same
             break;
         case 'responses_count':
             $ids = array();
             $ids[] = (int) get_subtype_id('object', 'comment');
             $ids[] = (int) get_subtype_id('object', 'discussion_reply');
             $ids_in = implode(',', $ids);
             $options['joins']['responses_count'] = "\n\t\t\t\t\tLEFT JOIN {$dbprefix}entities AS responses\n\t\t\t\t\t\tON responses.container_guid = e.guid\n\t\t\t\t\t\tAND responses.type = 'object'\n\t\t\t\t\t\tAND responses.subtype IN ({$ids_in})\n\t\t\t\t\t";
             $options['selects']['responses_count'] = "COUNT(responses.guid) as responses_count";
             $options['group_by'] = 'e.guid';
             array_unshift($order_by, "responses_count {$direction}");
             $order_by[] = 'e.time_created DESC';
             // show newest first if count is the same
             break;
     }
     if ($field == 'alpha') {
         array_unshift($order_by, "objects_entity.title {$direction}");
     }
     $options['order_by'] = implode(', ', array_unique(array_filter($order_by)));
     $params = array('field' => $field, 'direction' => $direction);
     return elgg_trigger_plugin_hook('sort_options', 'object', $params, $options);
 }
开发者ID:hypejunction,项目名称:hypelists,代码行数:59,代码来源:ObjectList.php


示例12: get_tags

/**
 * Get an array of tags with weights for use with the output/tagcloud view.
 *
 * @param int $threshold Get the threshold of minimum number of each tags to bother with (ie only show tags where there are more than $threshold occurances)
 * @param int $limit Number of tags to return
 * @param string $metadata_name Optionally, the name of the field you want to grab for
 * @param string $entity_type Optionally, the entity type ('object' etc)
 * @param string $entity_subtype The entity subtype, optionally
 * @param int $owner_guid The GUID of the tags owner, optionally
 * @param int $site_guid Optionally, the site to restrict to (default is the current site)
 * @return array|false Array of objects with ->tag and ->total values, or false on failure
 */
function get_tags($threshold = 1, $limit = 10, $metadata_name = "", $entity_type = "object", $entity_subtype = "", $owner_guid = "", $site_guid = -1)
{
    global $CONFIG;
    $threshold = (int) $threshold;
    $limit = (int) $limit;
    if (!empty($metadata_name)) {
        $metadata_name = (int) get_metastring_id($metadata_name);
    } else {
        $metadata_name = 0;
    }
    $entity_subtype = get_subtype_id($entity_type, $entity_subtype);
    $entity_type = sanitise_string($entity_type);
    if ($owner_guid != "") {
        if (is_array($owner_guid)) {
            foreach ($owner_guid as $key => $val) {
                $owner_guid[$key] = (int) $val;
            }
        } else {
            $owner_guid = (int) $owner_guid;
        }
    }
    if ($site_guid < 0) {
        $site_guid = $CONFIG->site_id;
    }
    //$access = get_access_list();
    $query = "SELECT msvalue.string as tag, count(msvalue.id) as total ";
    $query .= "FROM {$CONFIG->dbprefix}entities e join {$CONFIG->dbprefix}metadata md on md.entity_guid = e.guid ";
    $query .= " join {$CONFIG->dbprefix}entity_subtypes subtype on subtype.id = e.subtype ";
    $query .= " join {$CONFIG->dbprefix}metastrings msvalue on msvalue.id = md.value_id ";
    $query .= " where msvalue.string != '' ";
    if ($metadata_name > 0) {
        $query .= " and md.name_id = {$metadata_name} ";
    }
    if ($site_guid > 0) {
        $query .= " and e.site_guid = {$site_guid} ";
    }
    if ($entity_subtype > 0) {
        $query .= " and e.subtype = {$entity_subtype} ";
    }
    if ($entity_type != "") {
        $query .= " and e.type = '{$entity_type}' ";
    }
    if (is_array($owner_guid)) {
        $query .= " and e.container_guid in (" . implode(",", $owner_guid) . ")";
    } else {
        if (is_int($owner_guid)) {
            $query .= " and e.container_guid = {$owner_guid} ";
        }
    }
    //$userid = get_loggedin_userid();
    //$query .= " and (e.access_id in {$access} or (e.access_id = " . ACCESS_PRIVATE . " and e.owner_guid = {$userid}))";
    $query .= ' and ' . get_access_sql_suffix("e");
    // Add access controls
    $query .= " group by msvalue.string having total > {$threshold} order by total desc limit {$limit} ";
    return get_data($query);
}
开发者ID:eokyere,项目名称:elgg,代码行数:68,代码来源:tags.php


示例13: upgrade_1395096061

function upgrade_1395096061()
{
    $subtypes = array(HYPEGAMEMECHANICS_BADGE_SUBTYPE, HYPEGAMEMECHANICS_BADGERULE_SUBTYPE, HYPEGAMEMECHANICS_SCORE_SUBTYPE);
    foreach ($subtypes as $subtype) {
        if (get_subtype_id('object', $subtype)) {
            update_subtype('object', $subtype);
        } else {
            add_subtype('object', $subtype);
        }
    }
}
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:11,代码来源:upgrade.php


示例14: wizard_upgrade_system_handler

/**
 * Listen to upgrade event
 *
 * @param string $event  the name of the event
 * @param string $type   the type of the event
 * @param mixed  $object supplied params
 *
 * @return void
 */
function wizard_upgrade_system_handler($event, $type, $object)
{
    $id = get_subtype_id('object', Wizard::SUBTYPE);
    if (empty($id)) {
        // add subtype registration
        add_subtype('object', Wizard::SUBTYPE, 'Wizard');
    } elseif (get_subtype_class_from_id($id) !== 'Wizard') {
        // update subtype registration
        update_subtype('object', Wizard::SUBTYPE, 'Wizard');
    }
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:20,代码来源:events.php


示例15: testSubtypeAddRemove

 public function testSubtypeAddRemove()
 {
     $test_subtype = 'test_1389988642';
     $object = new \ElggObject();
     $object->subtype = $test_subtype;
     $object->save();
     $this->assertTrue(is_numeric(get_subtype_id('object', $test_subtype)));
     $object->delete();
     remove_subtype('object', $test_subtype);
     $this->assertFalse(get_subtype_id('object', $test_subtype));
 }
开发者ID:Twizanex,项目名称:GuildWoW,代码行数:11,代码来源:ElggEntityTest.php


示例16: haarlem_tangram_upgrade

/**
 * Listen to the upgrade event
 *
 * @param string $event  the name of the event
 * @param string $type   the type of the event
 * @param mixed  $object supplied params
 */
function haarlem_tangram_upgrade($event, $type, $object)
{
    // register correct class for future use
    if (get_subtype_id('object', TangramVacancy::SUBTYPE)) {
        update_subtype('object', TangramVacancy::SUBTYPE, 'TangramVacancy');
    } else {
        add_subtype('object', TangramVacancy::SUBTYPE, 'TangramVacancy');
    }
    // reset xml cache
    haarlem_tangram_clear_cached_xml();
}
开发者ID:coldtrick,项目名称:haarlem_tangram,代码行数:18,代码来源:events.php


示例17: twitterservice_wire_listener

/**
 * Listen for thewire and push messages accordingly.
 */
function twitterservice_wire_listener($event, $object_type, $object)
{
    if ($object && $object->subtype == get_subtype_id('object', 'thewire')) {
        if (get_plugin_usersetting('sendtowire', $object->owner_guid, 'twitterservice') == 'yes') {
            $twittername = get_plugin_usersetting('twittername', $object->owner_guid, 'twitterservice');
            $twitterpass = get_plugin_usersetting('twitterpass', $object->owner_guid, 'twitterservice');
            if ($twittername && $twitterpass) {
                twitterservice_send($twittername, $twitterpass, $object->description);
            }
        }
    }
}
开发者ID:ashwiniravi,项目名称:Elgg-Social-Network-Single-Sign-on-and-Web-Statistics,代码行数:15,代码来源:start.php


示例18: checkClasses

 /**
  * Check the class assosiation
  *
  * @param string $event  the name of the event
  * @param string $type   the type of the event
  * @param mixed  $object supplied params
  *
  * @return void
  */
 public static function checkClasses($event, $type, $object)
 {
     if (get_subtype_id('object', \APIApplication::SUBTYPE)) {
         update_subtype('object', \APIApplication::SUBTYPE, 'APIApplication');
     } else {
         add_subtype('object', \APIApplication::SUBTYPE, 'APIApplication');
     }
     if (get_subtype_id('object', \APIApplicationUserSetting::SUBTYPE)) {
         update_subtype('object', \APIApplicationUserSetting::SUBTYPE, 'APIApplicationUserSetting');
     } else {
         add_subtype('object', \APIApplicationUserSetting::SUBTYPE, 'APIApplicationUserSetting');
     }
 }
开发者ID:coldtrick,项目名称:ws_pack,代码行数:22,代码来源:Upgrade.php


示例19: load

 /**
  * Loads the full ElggPodcast when given a guid.
  *
  * @param mixed $guid GUID of an ElggObject or the stdClass object from entities table
  *
  * @return bool
  * @throws InvalidClassException
  */
 protected function load($guid)
 {
     $attr_loader = new ElggAttributeLoader(get_class(), 'object', $this->attributes);
     $attr_loader->requires_access_control = true;
     $attr_loader->secondary_loader = 'get_object_entity_as_row';
     $attrs = $attr_loader->getRequiredAttributes($guid);
     if (!$attrs) {
         return false;
     }
     // Force subtype to podcast for this loaded entity
     $attrs['subtype'] = get_subtype_id('object', 'podcast');
     $this->attributes = $attrs;
     $this->attributes['tables_loaded'] = 2;
     return true;
 }
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:23,代码来源:ElggPodcast.php


示例20: setup

 /**
  * Setup a mock entity
  *
  * @param int    $guid       GUID of the mock entity
  * @param string $type       Type of the mock entity
  * @param string $subtype    Subtype of the mock entity
  * @param array  $attributes Attributes of the mock entity
  * @return ElggEntity
  */
 public function setup($guid, $type, $subtype, array $attributes = [])
 {
     while (!isset($guid)) {
         $this->iterator++;
         if (!isset($this->row[$this->iterator])) {
             $guid = $this->iterator;
         }
     }
     if ($subtype) {
         $subtype_id = get_subtype_id($type, $subtype);
         if (!$subtype_id) {
             $subtype_id = add_subtype($type, $subtype);
         }
     } else {
         if (isset($attributes['subtype_id'])) {
             $subtype_id = $attributes['subtype_id'];
             $subtype = get_subtype_from_id($subtype_id);
         }
     }
     $attributes['guid'] = $guid;
     $attributes['type'] = $type;
     $attributes['subtype'] = $subtype_id;
     $time = $this->getCurrentTime()->getTimestamp();
     $primary_attributes = array('owner_guid' => 0, 'container_guid' => 0, 'access_id' => ACCESS_PUBLIC, 'time_created' => $time, 'time_updated' => $time, 'last_action' => $time, 'enabled' => 'yes');
     switch ($type) {
         case 'object':
             $external_attributes = ['title' => null, 'description' => null];
             break;
         case 'user':
             $external_attributes = ['name' => "John Doe {$guid}", 'username' => "john_doe_{$guid}", 'password_hash' => null, 'email' => "john_doe_{$guid}@example.com", 'language' => 'en', 'banned' => "no", 'admin' => 'no', 'prev_last_action' => null, 'last_login' => null, 'prev_last_login' => null];
             break;
         case 'group':
             $external_attributes = ['name' => null, 'description' => null];
             break;
     }
     $map = array_merge($primary_attributes, $external_attributes, $attributes);
     $attrs = (object) $map;
     $this->rows[$guid] = $attrs;
     $this->addQuerySpecs($attrs);
     $entity = $this->rowToElggStar($this->rows[$guid]);
     foreach ($attrs as $name => $value) {
         if (!isset($entity->{$name}) || $entity->{$name} != $value) {
             // not an attribute, so needs to be set again
             $entity->{$name} = $value;
         }
     }
     return $entity;
 }
开发者ID:elgg,项目名称:elgg,代码行数:57,代码来源:EntityTable.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_sugar_config_defaults函数代码示例发布时间:2022-05-15
下一篇:
PHP get_subtype_from_id函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap