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


PHP guid_to_uuid函数代码示例

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


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

示例1: get_uuid_from_object

/**
 * Get a UUID from a given object.
 *
 * @param mixed $object The object either an ElggEntity, ElggRelationship or ElggExtender
 *
 * @return the UUID or false
 */
function get_uuid_from_object($object)
{
    if ($object instanceof ElggEntity) {
        return guid_to_uuid($object->guid);
    } else {
        if ($object instanceof ElggExtender) {
            $type = $object->type;
            if ($type == 'volatile') {
                $uuid = guid_to_uuid($object->entity_guid) . $type . "/{$object->name}/";
            } else {
                $uuid = guid_to_uuid($object->entity_guid) . $type . "/{$object->id}/";
            }
            return $uuid;
        } else {
            if ($object instanceof ElggRelationship) {
                return guid_to_uuid($object->guid_one) . "relationship/{$object->id}/";
            }
        }
    }
    return false;
}
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:28,代码来源:export.php

示例2: elgg_view

    if (!$entity) {
        $query = "GUID:" . $guid . " could not be found, or you can not access it.";
        throw new \InvalidParameterException($query);
    }
    $title = "GUID:{$guid}";
    $body = elgg_view("export/entity", array("entity" => $entity, "uuid" => guid_to_uuid($guid)));
    // Export an individual attribute
} else {
    if ($guid != "" && $type != "" && $id_or_name != "") {
        // Get a uuid
        $entity = get_entity($guid);
        if (!$entity) {
            $msg = "GUID:" . $guid . " could not be found, or you can not access it.";
            throw new \InvalidParameterException($msg);
        }
        $uuid = guid_to_uuid($entity->getGUID()) . "{$type}/{$id_or_name}/";
        switch ($type) {
            case 'attr':
                // @todo: Do this better? - This is a bit of a hack...
                $v = $entity->get($id_or_name);
                if (!$v) {
                    $msg = "Sorry, '" . $id_or_name . "' does not exist for guid:" . $guid;
                    throw new \InvalidParameterException($msg);
                }
                $m = new \ElggMetadata();
                $m->value = $v;
                $m->name = $id_or_name;
                $m->entity_guid = $guid;
                $m->time_created = $entity->time_created;
                $m->time_updated = $entity->time_updated;
                $m->owner_guid = $entity->owner_guid;
开发者ID:ibou77,项目名称:elgg,代码行数:31,代码来源:export_handler.php

示例3: get_uuid_from_object

/**
 * Get a UUID from a given object.
 *
 * @param mixed $object The object either an \ElggEntity, \ElggRelationship or \ElggExtender
 *
 * @return string|false the UUID or false
 * @deprecated 1.9
 */
function get_uuid_from_object($object)
{
    elgg_deprecated_notice(__FUNCTION__ . ' is deprecated', 1.9);
    if ($object instanceof \ElggEntity) {
        return guid_to_uuid($object->guid);
    } else {
        if ($object instanceof \ElggExtender) {
            $type = $object->type;
            if ($type == 'volatile') {
                $uuid = guid_to_uuid($object->entity_guid) . $type . "/{$object->name}/";
            } else {
                $uuid = guid_to_uuid($object->entity_guid) . $type . "/{$object->id}/";
            }
            return $uuid;
        } else {
            if ($object instanceof \ElggRelationship) {
                return guid_to_uuid($object->guid_one) . "relationship/{$object->id}/";
            }
        }
    }
    return false;
}
开发者ID:gzachos,项目名称:elgg_ellak,代码行数:30,代码来源:deprecated-1.9.php

示例4: export

 /**
  * Export this object
  *
  * @return array
  * @deprecated 1.9 Use toObject()
  */
 public function export()
 {
     elgg_deprecated_notice(__METHOD__ . ' has been deprecated', 1.9);
     $uuid = get_uuid_from_object($this);
     $meta = new ODDMetaData($uuid, guid_to_uuid($this->entity_guid), $this->attributes['name'], $this->attributes['value'], $this->attributes['type'], guid_to_uuid($this->owner_guid));
     $meta->setAttribute('published', date("r", $this->time_created));
     return $meta;
 }
开发者ID:cyrixhero,项目名称:Elgg,代码行数:14,代码来源:ElggExtender.php

示例5: export

 /**
  * Export this class into an array of ODD Elements containing all necessary fields.
  * Override if you wish to return more information than can be found in
  * $this->attributes (shouldn't happen)
  *
  * @return array
  * @deprecated 1.9
  */
 public function export()
 {
     elgg_deprecated_notice(__METHOD__ . ' has been deprecated', 1.9);
     $tmp = array();
     // Generate uuid
     $uuid = guid_to_uuid($this->getGUID());
     // Create entity
     $odd = new ODDEntity($uuid, $this->attributes['type'], get_subtype_from_id($this->attributes['subtype']));
     $tmp[] = $odd;
     $exportable_values = $this->getExportableValues();
     // Now add its attributes
     foreach ($this->attributes as $k => $v) {
         $meta = null;
         if (in_array($k, $exportable_values)) {
             switch ($k) {
                 case 'guid':
                     // Dont use guid in OpenDD
                 // Dont use guid in OpenDD
                 case 'type':
                     // Type and subtype already taken care of
                 // Type and subtype already taken care of
                 case 'subtype':
                     break;
                 case 'time_created':
                     // Created = published
                     $odd->setAttribute('published', date("r", $v));
                     break;
                 case 'site_guid':
                     // Container
                     $k = 'site_uuid';
                     $v = guid_to_uuid($v);
                     $meta = new ODDMetaData($uuid . "attr/{$k}/", $uuid, $k, $v);
                     break;
                 case 'container_guid':
                     // Container
                     $k = 'container_uuid';
                     $v = guid_to_uuid($v);
                     $meta = new ODDMetaData($uuid . "attr/{$k}/", $uuid, $k, $v);
                     break;
                 case 'owner_guid':
                     // Convert owner guid to uuid, this will be stored in metadata
                     $k = 'owner_uuid';
                     $v = guid_to_uuid($v);
                     $meta = new ODDMetaData($uuid . "attr/{$k}/", $uuid, $k, $v);
                     break;
                 default:
                     $meta = new ODDMetaData($uuid . "attr/{$k}/", $uuid, $k, $v);
             }
             // set the time of any metadata created
             if ($meta) {
                 $meta->setAttribute('published', date("r", $this->time_created));
                 $tmp[] = $meta;
             }
         }
     }
     // Now we do something a bit special.
     /*
      * This provides a rendered view of the entity to foreign sites.
      */
     elgg_set_viewtype('default');
     $view = elgg_view_entity($this, array('full_view' => true));
     elgg_set_viewtype();
     $tmp[] = new ODDMetaData($uuid . "volatile/renderedentity/", $uuid, 'renderedentity', $view, 'volatile');
     return $tmp;
 }
开发者ID:nirajkaushal,项目名称:Elgg,代码行数:73,代码来源:ElggEntity.php

示例6: export

 /**
  * Export this relationship
  *
  * @return array
  */
 public function export()
 {
     $uuid = get_uuid_from_object($this);
     $relationship = new ODDRelationship(guid_to_uuid($this->guid_one), $this->relationship, guid_to_uuid($this->guid_two));
     $relationship->setAttribute('uuid', $uuid);
     return $relationship;
 }
开发者ID:redvabel,项目名称:Vabelgg,代码行数:12,代码来源:ElggRelationship.php

示例7: export

 /**
  * Export this relationship
  *
  * @return array
  * @deprecated 1.9 Use toObject()
  */
 public function export()
 {
     elgg_deprecated_notice(__METHOD__ . ' has been deprecated', 1.9);
     $uuid = get_uuid_from_object($this);
     $relationship = new ODDRelationship(guid_to_uuid($this->guid_one), $this->relationship, guid_to_uuid($this->guid_two));
     $relationship->setAttribute('uuid', $uuid);
     return $relationship;
 }
开发者ID:ibou77,项目名称:elgg,代码行数:14,代码来源:ElggRelationship.php

示例8: export

 /**
  * Export this object
  *
  * @return array
  */
 public function export()
 {
     $uuid = get_uuid_from_object($this);
     $meta = new ODDMetaData($uuid, guid_to_uuid($this->entity_guid), $this->attributes['name'], $this->attributes['value'], $this->attributes['type'], guid_to_uuid($this->owner_guid));
     $meta->setAttribute('published', date("r", $this->time_created));
     return $meta;
 }
开发者ID:duanhv,项目名称:mdg-social,代码行数:12,代码来源:ElggExtender.php

示例9: get_river_entries_as_opendd

/**
 * Extract entities from the system log and produce them as an OpenDD stream.
 * This stream can be subscribed to and reconstructed on another system as an activity stream.
 *
 * @param int $by_user The user who initiated the event.
 * @param string $relationship Limit return results to only those users who $by_user has $relationship with.
 * @param int $limit Maximum number of events to show
 * @param int $offset An offset
 * @return ODDDocument
 */
function get_river_entries_as_opendd($by_user = "", $relationship = "", $limit = 10, $offset = 0)
{
    global $CONFIG;
    $limit = (int) $limit;
    $offset = (int) $offset;
    $relationship = sanitise_string($relationship);
    if (is_array($by_user) && sizeof($by_user) > 0) {
        foreach ($by_user as $key => $val) {
            $by_user[$key] = (int) $val;
        }
    } else {
        $by_user = array((int) $by_user);
    }
    // Get river data
    $log_data = __get_river_from_log($by_user, $relationship, $limit, $offset);
    // River objects
    $river = new ODDDocument();
    if ($log_data) {
        foreach ($log_data as $log) {
            $event = $log->event;
            $class = $log->object_class;
            $type = $log->object_type;
            $subtype = $log->object_subtype;
            $tmp = new $class();
            $object = $tmp->getObjectFromID($log->object_id);
            $by_user_obj = get_entity($log->performed_by_guid);
            // Belts and braces
            if ($object instanceof $class) {
                $relationship_obj = NULL;
                // Handle updates of entities
                if ($object instanceof ElggEntity) {
                    $relationship_obj = new ODDRelationship(guid_to_uuid($log->performed_by_guid), $log->event, guid_to_uuid($log->object_id));
                }
                // Handle updates of metadata
                if ($object instanceof ElggExtender) {
                    $odd = $object->export();
                    $relationship_obj = new ODDRelationship(guid_to_uuid($log->performed_by_guid), $log->event, $odd->getAttribute('uuid'));
                }
                // Handle updates of relationships
                if ($object instanceof ElggRelationship) {
                    $odd = $object->export();
                    $relationship_obj = new ODDRelationship(guid_to_uuid($log->performed_by_guid), $log->event, $odd->getAttribute('uuid'));
                }
                // If we have handled it then add it to the document
                if ($relationship_obj) {
                    $relationship_obj->setPublished($log->time_created);
                    $river->addElement($relationship_obj);
                }
            }
        }
    }
    return $river;
}
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:63,代码来源:river.php


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