コード例 #1
0
ファイル: TagSub.php プロジェクト: bashrc/gnusocial-debian
 /**
  * End a tag subscription!
  *
  * @param profile $profile subscriber
  * @param string $tag subscribee
  */
 static function cancel(Profile $profile, $tag)
 {
     $ts = TagSub::pkeyGet(array('tag' => $tag, 'profile_id' => $profile->id));
     if ($ts) {
         $ts->delete();
         self::blow('tagsub:by_profile:%d', $profile->id);
     }
 }
コード例 #2
0
ファイル: TagSubPlugin.php プロジェクト: Grasia/bolotweet
 /**
  *
  * @param TagAction $action
  * @return boolean hook result
  */
 function onStartTagShowContent(TagAction $action)
 {
     $user = common_current_user();
     if ($user) {
         $tag = $action->trimmed('tag');
         $tagsub = TagSub::pkeyGet(array('tag' => $tag, 'profile_id' => $user->id));
         if ($tagsub) {
             $form = new TagUnsubForm($action, $tag);
         } else {
             $form = new TagSubForm($action, $tag);
         }
         $action->elementStart('div', 'entity_actions');
         $action->elementStart('ul');
         $action->elementStart('li', 'entity_subscribe');
         $form->show();
         $action->elementEnd('li');
         $action->elementEnd('ul');
         $action->elementEnd('div');
     }
     return true;
 }