コード例 #1
0
ファイル: tagunsub.php プロジェクト: bashrc/gnusocial-debian
 /**
  * Handle request
  *
  * Does the subscription and returns results.
  *
  * @param Array $args unused.
  *
  * @return void
  */
 function handle($args)
 {
     // Throws exception on error
     TagSub::cancel($this->user->getProfile(), $this->tag);
     if ($this->boolean('ajax')) {
         $this->startHTML('text/xml;charset=utf-8');
         $this->elementStart('head');
         // TRANS: Page title when tag unsubscription succeeded.
         $this->element('title', null, _m('Unsubscribed'));
         $this->elementEnd('head');
         $this->elementStart('body');
         $subscribe = new TagSubForm($this, $this->tag);
         $subscribe->show();
         $this->elementEnd('body');
         $this->endHTML();
     } else {
         $url = common_local_url('tag', array('tag' => $this->tag));
         common_redirect($url, 303);
     }
 }
コード例 #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;
 }