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


PHP Entity::getByUUID方法代码示例

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


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

示例1: postContent

 function postContent()
 {
     $body = strip_tags($this->getInput('body'));
     $name = strip_tags($this->getInput('name'));
     $url = trim($this->getInput('url'));
     $url2 = trim($this->getInput('url-2'));
     $validator = $this->getInput('validator');
     if (!empty($url2)) {
         $this->deniedContent();
     }
     $this->referrerGatekeeper();
     if (!empty($body) && !empty($name) && !empty($validator)) {
         if ($object = Entity::getByUUID($validator)) {
             if ($url = Webservice::sanitizeURL($url)) {
                 if ($content = Webservice::get($url)) {
                     if ($content['response'] == '200') {
                         $icon = Webmention::getIconFromWebsiteContent($content['content'], $url);
                     }
                 }
             }
             if (empty($icon)) {
                 $bn = hexdec(substr(md5($url), 0, 15));
                 $number = 1 + $bn % 5;
                 $icon = \Idno\Core\site()->config()->url . 'gfx/users/default-' . str_pad($number, 2, '0', STR_PAD_LEFT) . '.png';
             }
             $object->addAnnotation('reply', $name, $url, $icon, $body);
             $this->forward($object->getDisplayURL());
         }
     }
 }
开发者ID:emory,项目名称:Known,代码行数:30,代码来源:Post.php

示例2: postContent

 function postContent()
 {
     $this->createGatekeeper();
     // User is logged in and can post content
     // Get variables
     $body = $this->getInput('body');
     $object_uuid = $this->getInput('object');
     $type = $this->getInput('type');
     $user = \Idno\Core\site()->session()->currentUser();
     if ($type != 'like') {
         $type = 'reply';
     }
     if ($object = Entity::getByUUID($object_uuid)) {
         $has_liked = false;
         if ($type == 'like') {
             if ($like_annotations = $object->getAnnotations('like')) {
                 foreach ($like_annotations as $like) {
                     if ($like['owner_url'] == \Idno\Core\site()->session()->currentUser()->getURL()) {
                         $object->removeAnnotation($like['permalink']);
                         $object->save();
                         $has_liked = true;
                     }
                 }
             }
         }
         if (!$has_liked) {
             if ($object->addAnnotation($type, $user->getTitle(), $user->getURL(), $user->getIcon(), $body)) {
                 $object->save();
             }
         }
         $this->forward($object->getURL() . '#comments');
     }
 }
开发者ID:hank,项目名称:Known,代码行数:33,代码来源:Post.php

示例3: getActor

 /**
  * Get the actor associated with this entity
  */
 function getActor()
 {
     return \Idno\Common\Entity::getByUUID($this->actor);
 }
开发者ID:sintoris,项目名称:Known,代码行数:7,代码来源:ActivityStreamPost.php

示例4: getTarget

 /**
  * Get the target object associated with this entry
  * @return \Idno\Common\Entity
  */
 function getTarget()
 {
     return \Idno\Common\Entity::getByUUID($this->target);
 }
开发者ID:uniteddiversity,项目名称:Known,代码行数:8,代码来源:ActivityStreamPost.php

示例5: getTarget

 /**
  * Retrieve the indirect object of the action
  * @return bool|Entity
  */
 function getTarget()
 {
     if (is_string($this->target)) {
         return Entity::getByUUID($this->target);
     }
     return $this->target;
 }
开发者ID:kreativmind,项目名称:Known,代码行数:11,代码来源:Notification.php


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