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


PHP User::isLocalUUID方法代码示例

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


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

示例1: postContent

 function postContent()
 {
     $this->createGatekeeper();
     $user = \Idno\Core\site()->session()->currentUser();
     if ($uuid = $this->getInput('uuid')) {
         if (!($new_user = \Idno\Entities\User::getByUUID($uuid)) && !($new_user = \Idno\Entities\User::getByProfileURL($uuid)) && !($new_user = \Idno\Entities\RemoteUser::getByUUID($uuid)) && !($new_user = \Idno\Entities\RemoteUser::getByProfileURL($uuid))) {
             // No user found, so create it if it's remote
             if (!\Idno\Entities\User::isLocalUUID($uuid)) {
                 \Idno\Core\site()->logging->log("Creating new remote user", LOGLEVEL_DEBUG);
                 $new_user = new \Idno\Entities\RemoteUser();
                 // Populate with data
                 $new_user->setTitle($this->getInput('name'));
                 $new_user->setHandle($this->getInput('nickname'));
                 $new_user->email = $this->getInput('email');
                 $new_user->setUrl($uuid);
                 // TODO: Get a profile URL - get it from passed photo variable, upload to local and treat as avatar.
                 if (!$new_user->save()) {
                     throw new \Exception("There was a problem saving the new remote user.");
                 }
             }
         } else {
             \Idno\Core\site()->logging->log("New user found as " . $new_user->uuid, LOGLEVEL_DEBUG);
         }
         if ($new_user) {
             \Idno\Core\site()->logging->log("Trying a follow", LOGLEVEL_DEBUG);
             if ($user->addFollowing($new_user)) {
                 \Idno\Core\site()->logging->log("User added to following", LOGLEVEL_DEBUG);
                 if ($user->save()) {
                     \Idno\Core\site()->logging->log("Following saved", LOGLEVEL_DEBUG);
                     // Ok, we've saved the new user, now, lets subscribe to their feeds
                     if ($feed = \Idno\Core\site()->reader()->getFeedObject($new_user->getURL())) {
                         \Idno\Core\site()->session()->addMessage("You are now following " . $new_user->getTitle() . ', would you like to subscribe to their feed?');
                         $this->forward(\Idno\Core\site()->config()->getURL() . 'following/confirm/?feed=' . urlencode($new_user->getURL()));
                     }
                     \Idno\Core\site()->session()->addMessage("You are now following " . $new_user->getTitle());
                 }
             } else {
                 \Idno\Core\site()->logging->log('Could not follow user for some reason (probably already following)', LOGLEVEL_DEBUG);
                 \Idno\Core\site()->session()->addErrorMessage('You\'re already following ' . $this->getInput('name'));
             }
         } else {
             throw new \Exception('Sorry, that user doesn\'t exist!');
         }
     } else {
         throw new \Exception("No UUID, please try that again!");
     }
 }
开发者ID:hank,项目名称:Known,代码行数:47,代码来源:Bookmarklet.php

示例2: postContent

 function postContent()
 {
     $this->createGatekeeper();
     $user = \Idno\Core\site()->session()->currentUser();
     if ($uuid = $this->getInput('uuid')) {
         if (!($new_user = \Idno\Entities\User::getByUUID($uuid)) && !($new_user = \Idno\Entities\User::getByProfileURL($uuid)) && !($new_user = \Idno\Entities\RemoteUser::getByUUID($uuid)) && !($new_user = \Idno\Entities\RemoteUser::getByProfileURL($uuid))) {
             // No user found, so create it if it's remote
             if (!\Idno\Entities\User::isLocalUUID($uuid)) {
                 \Idno\Core\site()->logging->log("Creating new remote user", LOGLEVEL_DEBUG);
                 $new_user = new \Idno\Entities\RemoteUser();
                 // Populate with data
                 $new_user->setTitle($this->getInput('name'));
                 $new_user->setHandle($this->getInput('nickname'));
                 $new_user->email = $this->getInput('email');
                 $new_user->setUrl($uuid);
                 if (!$new_user->save()) {
                     throw new \Exception("There was a problem saving the new remote user.");
                 }
             }
         } else {
             \Idno\Core\site()->logging->log("New user found as " . $new_user->uuid, LOGLEVEL_DEBUG);
         }
         if ($new_user) {
             \Idno\Core\site()->logging->log("Trying a follow", LOGLEVEL_DEBUG);
             if ($user->addFollowing($new_user)) {
                 \Idno\Core\site()->logging->log("User added to following", LOGLEVEL_DEBUG);
                 if ($user->save()) {
                     \Idno\Core\site()->logging->log("Following saved", LOGLEVEL_DEBUG);
                     \Idno\Core\site()->session()->addMessage("You are now following " . $new_user->getTitle());
                 }
             } else {
                 \Idno\Core\site()->logging->log('Could not follow user for some reason (probably already following)', LOGLEVEL_DEBUG);
             }
         } else {
             throw new \Exception('Sorry, that user doesn\'t exist!');
         }
     } else {
         throw new \Exception("No UUID, please try that again!");
     }
 }
开发者ID:avewrigley,项目名称:idno,代码行数:40,代码来源:Bookmarklet.php


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