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


PHP TagURI::mint方法代码示例

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


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

示例1: create

 /**
  * Factory method for creating a new conversation.
  *
  * Use this for locally initiated conversations. Remote notices should
  * preferrably supply their own conversation URIs in the OStatus feed.
  *
  * @return Conversation the new conversation DO
  */
 static function create(Notice $notice, $uri = null)
 {
     if (empty($notice->id)) {
         throw new ServerException(_('Tried to create conversation for not yet inserted notice'));
     }
     $conv = new Conversation();
     $conv->created = common_sql_now();
     $conv->id = $notice->id;
     $conv->uri = $uri ?: sprintf('%s%s=%d:%s=%s:%s=%x', TagURI::mint(), 'noticeId', $notice->id, 'objectType', 'thread', 'crc32', crc32($notice->content));
     $result = $conv->insert();
     if ($result === false) {
         common_log_db_error($conv, 'INSERT', __FILE__);
         throw new ServerException(_('Failed to create conversation for notice'));
     }
     return $conv;
 }
开发者ID:phpsource,项目名称:gnu-social,代码行数:24,代码来源:Conversation.php

示例2: asActivity

 function asActivity()
 {
     $notice = Notice::staticGet('id', $this->notice_id);
     $profile = Profile::staticGet('id', $this->user_id);
     $act = new Activity();
     $act->verb = ActivityVerb::FAVORITE;
     // FIXME: rationalize this with URL below
     $act->id = TagURI::mint('favor:%d:%d:%s', $profile->id, $notice->id, common_date_iso8601($this->modified));
     $act->time = strtotime($this->modified);
     // TRANS: Activity title when marking a notice as favorite.
     $act->title = _("Favor");
     // TRANS: Ntofication given when a user marks a notice as favorite.
     // TRANS: %1$s is a user nickname or full name, %2$s is a notice URI.
     $act->content = sprintf(_('%1$s marked notice %2$s as a favorite.'), $profile->getBestName(), $notice->uri);
     $act->actor = ActivityObject::fromProfile($profile);
     $act->objects[] = ActivityObject::fromNotice($notice);
     $url = common_local_url('AtomPubShowFavorite', array('profile' => $this->user_id, 'notice' => $this->notice_id));
     $act->selfLink = $url;
     $act->editLink = $url;
     return $act;
 }
开发者ID:harriewang,项目名称:InnertieWebsite,代码行数:21,代码来源:Fave.php

示例3: newURI

 static function newURI($profile_id, $notice_id, $modified)
 {
     return TagURI::mint('favor:%d:%d:%s', $profile_id, $notice_id, common_date_iso8601($modified));
 }
开发者ID:Grasia,项目名称:bolotweet,代码行数:4,代码来源:Fave.php

示例4: onEndLeaveGroup

 function onEndLeaveGroup($group, $profile)
 {
     // Only do this if config is enabled
     if (!$this->LeaveGroup) {
         return true;
     }
     if (!$profile->isLocal()) {
         return true;
     }
     // TRANS: Text for "left group" item in activity plugin.
     // TRANS: %1$s is a profile URL, %2$s is a profile name,
     // TRANS: %3$s is a group URL, %4$s is a group name.
     $rendered = sprintf(_m('<a href="%1$s">%2$s</a> left the group <a href="%3$s">%4$s</a>.'), $profile->getUrl(), $profile->getBestName(), $group->homeUrl(), $group->getBestName());
     // TRANS: Text for "left group" item in activity plugin.
     // TRANS: %1$s is a profile name, %2$s is a profile URL,
     // TRANS: %3$s is a group name, %4$s is a group URL.
     $content = sprintf(_m('%1$s (%2$s) left the group %3$s (%4$s).'), $profile->getBestName(), $profile->getUrl(), $group->getBestName(), $group->homeUrl());
     $uri = TagURI::mint('leave:%d:%d:%s', $profile->id, $group->id, common_date_iso8601(common_sql_now()));
     $notice = Notice::saveNew($profile->id, $content, ActivityPlugin::SOURCE, array('rendered' => $rendered, 'urls' => array(), 'groups' => array($group->id), 'uri' => $uri, 'verb' => ActivityVerb::LEAVE, 'object_type' => ActivityObject::GROUP));
     return true;
 }
开发者ID:phpsource,项目名称:gnu-social,代码行数:21,代码来源:ActivityPlugin.php

示例5: onEndBroadcastProfile

 /**
  * Ping remote profiles with updates to this profile.
  * Salmon pings are queued for background processing.
  */
 function onEndBroadcastProfile(Profile $profile)
 {
     $user = User::staticGet('id', $profile->id);
     // Find foreign accounts I'm subscribed to that support Salmon pings.
     //
     // @fixme we could run updates through the PuSH feed too,
     // in which case we can skip Salmon pings to folks who
     // are also subscribed to me.
     $sql = "SELECT * FROM ostatus_profile " . "WHERE profile_id IN " . "(SELECT subscribed FROM subscription WHERE subscriber=%d) " . "OR group_id IN " . "(SELECT group_id FROM group_member WHERE profile_id=%d)";
     $oprofile = new Ostatus_profile();
     $oprofile->query(sprintf($sql, $profile->id, $profile->id));
     if ($oprofile->N == 0) {
         common_log(LOG_DEBUG, "No OStatus remote subscribees for {$profile->nickname}");
         return true;
     }
     $act = new Activity();
     $act->verb = ActivityVerb::UPDATE_PROFILE;
     $act->id = TagURI::mint('update-profile:%d:%s', $profile->id, common_date_iso8601(time()));
     $act->time = time();
     // TRANS: Title for activity.
     $act->title = _m('Profile update');
     // TRANS: Ping text for remote profile update through OStatus.
     // TRANS: %s is user that updated their profile.
     $act->content = sprintf(_m('%s has updated their profile page.'), $profile->getBestName());
     $act->actor = ActivityObject::fromProfile($profile);
     $act->object = $act->actor;
     while ($oprofile->fetch()) {
         $oprofile->notifyDeferred($act, $profile);
     }
     return true;
 }
开发者ID:harriewang,项目名称:InnertieWebsite,代码行数:35,代码来源:OStatusPlugin.php

示例6: newUri

 static function newUri(Profile $actor, Managed_DataObject $object, $created = null)
 {
     if (is_null($created)) {
         $created = common_sql_now();
     }
     return TagURI::mint(strtolower(get_called_class()) . ':%d:%s:%d:%s', $actor->getID(), ActivityUtils::resolveUri($object->getObjectType(), true), $object->getID(), common_date_iso8601($created));
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:7,代码来源:Managed_DataObject.php

示例7: create

 /**
  * Factory method for creating a new conversation.
  *
  * Use this for locally initiated conversations. Remote notices should
  * preferrably supply their own conversation URIs in the OStatus feed.
  *
  * @return Conversation the new conversation DO
  */
 static function create($uri = null, $created = null)
 {
     // Be aware that the Notice does not have an id yet since it's not inserted!
     $conv = new Conversation();
     $conv->created = $created ?: common_sql_now();
     $conv->uri = $uri ?: sprintf('%s%s=%s:%s=%s', TagURI::mint(), 'objectType', 'thread', 'nonce', common_random_hexstr(8));
     // This insert throws exceptions on failure
     $conv->insert();
     return $conv;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:18,代码来源:Conversation.php

示例8: insert

 function insert()
 {
     $result = parent::insert();
     if ($result === false) {
         common_log_db_error($this, 'INSERT', __FILE__);
         // TRANS: Server exception thrown when a stored object entry cannot be saved.
         throw new ServerException('Could not save Notice');
     }
     // Profile::hasRepeated() abuses pkeyGet(), so we
     // have to clear manually
     if (!empty($this->repeat_of)) {
         $c = self::memcache();
         if (!empty($c)) {
             $ck = self::multicacheKey('Notice', array('profile_id' => $this->profile_id, 'repeat_of' => $this->repeat_of));
             $c->delete($ck);
         }
     }
     // Update possibly ID-dependent columns: URI, conversation
     // (now that INSERT has added the notice's local id)
     $orig = clone $this;
     $changed = false;
     // We can only get here if it's a local notice, since remote notices
     // should've bailed out earlier due to lacking a URI.
     if (empty($this->uri)) {
         $this->uri = sprintf('%s%s=%d:%s=%s', TagURI::mint(), 'noticeId', $this->id, 'objectType', $this->getObjectType(true));
         $changed = true;
     }
     if ($changed && $this->update($orig) === false) {
         common_log_db_error($notice, 'UPDATE', __FILE__);
         // TRANS: Server exception thrown when a notice cannot be updated.
         throw new ServerException(_('Problem saving notice.'));
     }
     $this->blowOnInsert();
     return $result;
 }
开发者ID:a780201,项目名称:gnu-social,代码行数:35,代码来源:Notice.php

示例9: asActivity

 function asActivity()
 {
     $member = $this->getMember();
     $group = $this->getGroup();
     $act = new Activity();
     $act->id = TagURI::mint('join:%d:%d:%s', $member->id, $group->id, common_date_iso8601($this->created));
     $act->actor = ActivityObject::fromProfile($member);
     $act->verb = ActivityVerb::JOIN;
     $act->objects[] = ActivityObject::fromGroup($group);
     $act->time = strtotime($this->created);
     // TRANS: Activity title.
     $act->title = _("Join");
     // TRANS: Success message for subscribe to group attempt through OStatus.
     // TRANS: %1$s is the member name, %2$s is the subscribed group's name.
     $act->content = sprintf(_('%1$s has joined group %2$s.'), $member->getBestName(), $group->getBestName());
     return $act;
 }
开发者ID:stevertiqo,项目名称:StatusNet,代码行数:17,代码来源:Group_member.php

示例10: asActivity

 /**
  * Convert a notice into an activity for export.
  *
  * @param User $cur Current user
  *
  * @return Activity activity object representing this Notice.
  */
 function asActivity($cur)
 {
     $act = self::cacheGet(Cache::codeKey('notice:as-activity:' . $this->id));
     if (!empty($act)) {
         return $act;
     }
     $act = new Activity();
     if (Event::handle('StartNoticeAsActivity', array($this, &$act))) {
         $act->id = TagURI::mint("post:" . $this->id);
         $act->time = strtotime($this->created);
         $act->content = common_xml_safe_str($this->rendered);
         $profile = $this->getProfile();
         $act->actor = ActivityObject::fromProfile($profile);
         $act->actor->extra[] = $profile->profileInfo($cur);
         $act->verb = $this->verb;
         if ($this->repeat_of) {
             $repeated = Notice::staticGet('id', $this->repeat_of);
             if (!empty($repeated)) {
                 $act->objects[] = $repeated->asActivity($cur);
             }
         } else {
             $act->objects[] = ActivityObject::fromNotice($this);
         }
         // XXX: should this be handled by default processing for object entry?
         // Categories
         $tags = $this->getTags();
         foreach ($tags as $tag) {
             $cat = new AtomCategory();
             $cat->term = $tag;
             $act->categories[] = $cat;
         }
         // Enclosures
         // XXX: use Atom Media and/or File activity objects instead
         $attachments = $this->attachments();
         foreach ($attachments as $attachment) {
             // Save local attachments
             if (!empty($attachment->filename)) {
                 $act->attachments[] = ActivityObject::fromFile($attachment);
             }
         }
         $ctx = new ActivityContext();
         if (!empty($this->reply_to)) {
             $reply = Notice::staticGet('id', $this->reply_to);
             if (!empty($reply)) {
                 $ctx->replyToID = $reply->uri;
                 $ctx->replyToUrl = $reply->bestUrl();
             }
         }
         $ctx->location = $this->getLocation();
         $conv = null;
         if (!empty($this->conversation)) {
             $conv = Conversation::staticGet('id', $this->conversation);
             if (!empty($conv)) {
                 $ctx->conversation = $conv->uri;
             }
         }
         $reply_ids = $this->getReplies();
         foreach ($reply_ids as $id) {
             $rprofile = Profile::staticGet('id', $id);
             if (!empty($rprofile)) {
                 $ctx->attention[] = $rprofile->getUri();
                 $ctx->attentionType[$rprofile->getUri()] = ActivityObject::PERSON;
             }
         }
         $groups = $this->getGroups();
         foreach ($groups as $group) {
             $ctx->attention[] = $group->getUri();
             $ctx->attentionType[$group->getUri()] = ActivityObject::GROUP;
         }
         switch ($this->scope) {
             case Notice::PUBLIC_SCOPE:
                 $ctx->attention[] = "http://activityschema.org/collection/public";
                 $ctx->attentionType["http://activityschema.org/collection/public"] = ActivityObject::COLLECTION;
                 break;
             case Notice::FOLLOWER_SCOPE:
                 $surl = common_local_url("subscribers", array('nickname' => $profile->nickname));
                 $ctx->attention[] = $surl;
                 $ctx->attentionType[$surl] = ActivityObject::COLLECTION;
                 break;
         }
         // XXX: deprecated; use ActivityVerb::SHARE instead
         $repeat = null;
         if (!empty($this->repeat_of)) {
             $repeat = Notice::staticGet('id', $this->repeat_of);
             if (!empty($repeat)) {
                 $ctx->forwardID = $repeat->uri;
                 $ctx->forwardUrl = $repeat->bestUrl();
             }
         }
         $act->context = $ctx;
         $source = $this->getSource();
         if ($source) {
             $act->generator = ActivityObject::fromNoticeSource($source);
//.........这里部分代码省略.........
开发者ID:Grasia,项目名称:bolotweet,代码行数:101,代码来源:Notice.php

示例11: asActivity

 function asActivity()
 {
     $notice = Notice::staticGet('id', $this->notice_id);
     $profile = Profile::staticGet('id', $this->user_id);
     $act = new Activity();
     $act->verb = ActivityVerb::FAVORITE;
     $act->id = TagURI::mint('favor:%d:%d:%s', $profile->id, $notice->id, common_date_iso8601($this->modified));
     $act->time = strtotime($this->modified);
     // TRANS: Activity title when marking a notice as favorite.
     $act->title = _("Favor");
     // TRANS: Ntofication given when a user marks a notice as favorite.
     // TRANS: %1$s is a user nickname or full name, %2$s is a notice URI.
     $act->content = sprintf(_('%1$s marked notice %2$s as a favorite.'), $profile->getBestName(), $notice->uri);
     $act->actor = ActivityObject::fromProfile($profile);
     $act->objects[] = ActivityObject::fromNotice($notice);
     return $act;
 }
开发者ID:stevertiqo,项目名称:StatusNet,代码行数:17,代码来源:Fave.php

示例12: asActivity

 function asActivity()
 {
     $act = new Activity();
     if (Event::handle('StartMessageAsActivity', array($this, &$act))) {
         $act->id = TagURI::mint(sprintf('activity:message:%d', $this->id));
         $act->time = strtotime($this->created);
         $act->link = $this->url;
         $profile = Profile::getKV('id', $this->from_profile);
         if (empty($profile)) {
             throw new Exception(sprintf("Sender profile not found: %d", $this->from_profile));
         }
         $act->actor = $profile->asActivityObject();
         $act->actor->extra[] = $profile->profileInfo();
         $act->verb = ActivityVerb::POST;
         $act->objects[] = ActivityObject::fromMessage($this);
         $ctx = new ActivityContext();
         $rprofile = Profile::getKV('id', $this->to_profile);
         if (empty($rprofile)) {
             throw new Exception(sprintf("Receiver profile not found: %d", $this->to_profile));
         }
         $ctx->attention[$rprofile->getUri()] = ActivityObject::PERSON;
         $act->context = $ctx;
         $source = $this->getSource();
         if ($source instanceof Notice_source) {
             $act->generator = ActivityObject::fromNoticeSource($source);
         }
         Event::handle('EndMessageAsActivity', array($this, &$act));
     }
     return $act;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:30,代码来源:Message.php

示例13: newURI

 static function newURI($subscriber_id, $subscribed_id, $created)
 {
     return TagURI::mint('follow:%d:%d:%s', $subscriber_id, $subscribed_id, common_date_iso8601($created));
 }
开发者ID:Grasia,项目名称:bolotweet,代码行数:4,代码来源:Subscription.php

示例14: newURI

 static function newURI($profile_id, $group_id, $created)
 {
     return TagURI::mint('join:%d:%d:%s', $profile_id, $group_id, common_date_iso8601($created));
 }
开发者ID:phpsource,项目名称:gnu-social,代码行数:4,代码来源:Group_member.php

示例15: registrationActivity

 function registrationActivity()
 {
     $profile = $this->getProfile();
     $service = new ActivityObject();
     $service->type = ActivityObject::SERVICE;
     $service->title = common_config('site', 'name');
     $service->link = common_root_url();
     $service->id = $service->link;
     $act = new Activity();
     $act->actor = ActivityObject::fromProfile($profile);
     $act->verb = ActivityVerb::JOIN;
     $act->objects[] = $service;
     $act->id = TagURI::mint('user:register:%d', $this->id);
     $act->time = strtotime($this->created);
     $act->title = _("Register");
     $act->content = sprintf(_('%1$s joined %2$s.'), $profile->getBestName(), $service->title);
     return $act;
 }
开发者ID:Grasia,项目名称:bolotweet,代码行数:18,代码来源:User.php


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