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


PHP UUID::get方法代码示例

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


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

示例1: action_ajax_update

 public function action_ajax_update($handler)
 {
     $users = Users::get();
     $payload = $handler->handler_vars->raw('payload');
     $decoded_payload = json_decode($payload);
     if (isset($decoded_payload)) {
         // Invalid decoded JSON is NULL.
         $commit_sha = $decoded_payload->after;
         $owner = isset($decoded_payload->repository->organization) ? $decoded_payload->repository->organization : $decoded_payload->repository->owner->name;
         $repo_URL = $decoded_payload->repository->url;
         $tree_URL = "https://api.github.com/repos/" . $owner . "/" . $decoded_payload->repository->name . "/git/trees/{$commit_sha}";
         $decoded_tree = json_decode(file_get_contents($tree_URL, 0, null, null));
         $xml_urls = array_map(function ($a) {
             if (strpos($a->path, ".plugin.xml") !== false || $a->path === 'theme.xml') {
                 return $a->url;
                 // path was just the filename, url is the API endpoint for the file itself
             }
         }, $decoded_tree->tree);
         $xml_urls = array_filter($xml_urls);
         // remove NULLs
         if (count($xml_urls) === 1) {
             $xml_URL = array_pop($xml_urls);
             $decoded_blob = json_decode(file_get_contents($xml_URL, 0, null, null));
             if ($decoded_blob->encoding === 'base64') {
                 $xml_data = base64_decode($decoded_blob->content);
             } else {
                 if ($decoded_blob->encoding === 'utf-8') {
                     // does it need to be decoded?
                 } else {
                     // there's an invalid encoding.
                     return;
                 }
             }
             $xml_object = simplexml_load_string($xml_data, 'SimpleXMLElement');
             /* can't hurt to hold onto these */
             $xml_object->addChild("xml_string", $xml_object->asXML());
             /* won't always need these */
             $xml_object->addChild("tree_url", $tree_URL);
             $xml_object->addChild("blob_url", $xml_URL);
             $xml_object->addChild("ping_contents", $payload);
             /* might need this. Or should it go in downloadurl? */
             $xml_object->addChild("repo_url", $repo_URL);
             /* need to check if there's already a posts with this guid */
             if (!isset($xml_object->guid) || trim($xml_object->guid) == '') {
                 // You must have a GUID or we can't find your plugin...
                 // @todo Send the owner an error message/file an issue on the repo
                 $this->file_issue($owner, $decoded_payload->repository->name, 'Info XML needs a GUID', "Habari addons require a GUID to be listed in the Addons Directory.<br>Please create and add a GUID to your xml file. You can use this one, which is new:<br><b>" . UUID::get() . "</b>");
             } else {
                 EventLog::log(_t('Making post for GUID %s', array(trim($xml_object->guid))), 'info');
                 self::make_post_from_XML($xml_object);
             }
         } else {
             // Wrong number of xml files.
             $this->file_issue($owner, $decoded_payload->repository->name, 'Too many XML files', "Habari addons should have a single XML file containing addon information.<br>");
         }
     } else {
         // Something has gone wrong with the json_decode. Do nothing, since there is nothing that can really be done.
     }
 }
开发者ID:ringmaster,项目名称:post_receive,代码行数:59,代码来源:post_receive.plugin.php

示例2: action_auth_ajax_generate_guid

 /**
  * Provide a quick AJAX method to return a GUID for the post page.
  *
  * @param ActionHandler $handler The handler being executed.
  */
 public function action_auth_ajax_generate_guid($handler)
 {
     echo UUID::get();
 }
开发者ID:habari-extras,项目名称:addon_catalog,代码行数:9,代码来源:addon_catalog.plugin.php

示例3: create

 /**
  * Create a new session - that is, generate an ID and set the session cookie
  */
 public static function create()
 {
     self::$session_id = UUID::get();
     self::cookie(self::$session_id);
 }
开发者ID:habari,项目名称:system,代码行数:8,代码来源:session.php

示例4: test_preset_override

 /**
  * Test to make sure that a parameter in a preset can be overridden
  * Issue habari/habari#355
  */
 public function test_preset_override()
 {
     $preset_name = UUID::get();
     Plugins::register(function ($presets) use($preset_name) {
         $presets[$preset_name] = array('content_type' => 1);
         return $presets;
     }, 'filter', 'posts_get_all_presets');
     $q1 = Posts::get($preset_name);
     $expected1 = array('preset' => array(0 => $preset_name), 'content_type' => 1);
     $this->assert_associative_equal($q1->get_param_cache, $expected1, "The parameters defined for the preset aren't the same as those returned by the preset", array($q1->get_param_cache, $expected1));
     $q2 = Posts::get(array('preset' => $preset_name, 'content_type' => 2, 'status' => 'published'));
     $expected2 = array('status' => 'published', 'content_type' => 2, 'preset' => array(0 => $preset_name));
     $this->assert_associative_equal($q2->get_param_cache, $expected2, "The parameters provided to Posts::get() aren't the same as those returned", array($q2->get_param_cache, $expected2));
 }
开发者ID:habari,项目名称:tests,代码行数:18,代码来源:test_posts.php

示例5: test_get

 public function test_get()
 {
     // @TODO: figure out if there's a way to make this less dependent on randomness
     $this->assert_not_equal($this->uuid->get_hex(), UUID::get());
 }
开发者ID:habari,项目名称:tests,代码行数:5,代码来源:test_uuid.php

示例6: Generate

 public static function Generate()
 {
     $uuid = new UUID();
     return $uuid->get();
 }
开发者ID:alcexhim,项目名称:PhoenixSNS,代码行数:5,代码来源:UUID.inc.php


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