Пример #1
0
 private function showShareTarget(HTMLOutputter $out, NoticeShareTarget $target)
 {
     $class = $target->getClass();
     $text = $target->getText();
     $url = $target->targetUrl();
     $out->elementStart('li', array('class' => 'notice-share-' . $class));
     $out->elementStart('a', array('href' => $url, 'title' => $text, 'target' => '_blank'));
     $out->element('span', array(), $text);
     $out->elementEnd('a');
     $out->elementEnd('li');
 }
Пример #2
0
 /**
  * Build common remote-profile options structure.
  * Currently only adds output for remote profiles, nothing for local users.
  *
  * @param HTMLOutputter $out
  * @param Profile $profile
  */
 protected function showProfileOptions(HTMLOutputter $out, Profile $profile)
 {
     if (!$profile->isGroup() && !$profile->isLocal()) {
         $target = common_local_url('userbyid', array('id' => $profile->getID()));
         // TRANS: Label for access to remote profile options.
         $label = _m('Remote profile options...');
         $out->elementStart('div', 'remote-profile-options');
         $out->element('a', array('href' => $target), $label);
         $out->elementEnd('div');
     }
 }
Пример #3
0
 /**
  * Build common remote-profile options structure.
  * Currently only adds output for remote profiles, nothing for local users.
  *
  * @param HTMLOutputter $out
  * @param Profile $profile (may also be an ArrayWrapper... sigh)
  */
 protected function showProfileOptions(HTMLOutputter $out, $profile)
 {
     $isRemote = !User::staticGet('id', $profile->id);
     if ($isRemote) {
         $target = common_local_url('remoteprofile', array('id' => $profile->id));
         // TRANS: Label for access to remote profile options.
         $label = _m('Remote profile options...');
         $out->elementStart('div', 'remote-profile-options');
         $out->element('a', array('href' => $target), $label);
         $out->elementEnd('div');
     }
 }
Пример #4
0
 protected function showRSVP(Notice $stored, HTMLOutputter $out, Profile $scoped = null)
 {
     $rsvp = RSVP::fromNotice($stored);
     if (empty($rsvp)) {
         // TRANS: Content for a deleted RSVP list item (RSVP stands for "please respond").
         $out->element('p', null, _m('Deleted.'));
         return;
     }
     $out->elementStart('div', 'rsvp');
     $out->raw($rsvp->asHTML());
     $out->elementEnd('div');
 }
Пример #5
0
 /**
  * @fixme merge with common code for main OpenID login form
  * @param HTMLOutputter $action
  */
 protected function showOAuthLoginForm($action)
 {
     $action->elementStart('fieldset');
     // TRANS: OpenID plugin logon form legend.
     $action->element('legend', null, _m('LEGEND', 'OpenID login'));
     $action->elementStart('ul', 'form_data');
     $action->elementStart('li');
     $provider = common_config('openid', 'trusted_provider');
     $appendUsername = common_config('openid', 'append_username');
     if ($provider) {
         // TRANS: Field label.
         $action->element('label', array(), _m('OpenID provider'));
         $action->element('span', array(), $provider);
         if ($appendUsername) {
             $action->element('input', array('id' => 'openid_username', 'name' => 'openid_username', 'style' => 'float: none'));
         }
         $action->element('p', 'form_guide', ($appendUsername ? _m('Enter your username.') . ' ' : '') . _m('You will be sent to the provider\'s site for authentication.'));
         $action->hidden('openid_url', $provider);
     } else {
         // TRANS: OpenID plugin logon form field label.
         $action->input('openid_url', _m('OpenID URL'), '', _m('Your OpenID URL.'));
     }
     $action->elementEnd('li');
     $action->elementEnd('ul');
     $action->elementEnd('fieldset');
 }
Пример #6
0
 public function onEndShowAttachmentLink(HTMLOutputter $out, File $file)
 {
     $oembed = File_oembed::getKV('file_id', $file->id);
     if (empty($oembed->author_name) && empty($oembed->provider)) {
         return true;
     }
     $out->elementStart('div', array('id' => 'oembed_info', 'class' => 'e-content'));
     if (!empty($oembed->author_name)) {
         $out->elementStart('div', 'fn vcard author');
         if (empty($oembed->author_url)) {
             $out->text($oembed->author_name);
         } else {
             $out->element('a', array('href' => $oembed->author_url, 'class' => 'url'), $oembed->author_name);
         }
     }
     if (!empty($oembed->provider)) {
         $out->elementStart('div', 'fn vcard');
         if (empty($oembed->provider_url)) {
             $out->text($oembed->provider);
         } else {
             $out->element('a', array('href' => $oembed->provider_url, 'class' => 'url'), $oembed->provider);
         }
     }
     $out->elementEnd('div');
 }
Пример #7
0
 protected function showNoticeContent(Notice $stored, HTMLOutputter $out, Profile $scoped = null)
 {
     $nb = Bookmark::getByNotice($stored);
     if (empty($nb)) {
         common_log(LOG_ERR, "No bookmark for notice {$stored->id}");
         parent::showContent();
         return;
     } else {
         if (empty($nb->url)) {
             common_log(LOG_ERR, "No url for bookmark {$nb->id} for notice {$stored->id}");
             parent::showContent();
             return;
         }
     }
     $profile = $stored->getProfile();
     // Whether to nofollow
     $attrs = array('href' => $nb->url, 'class' => 'bookmark-title');
     $nf = common_config('nofollow', 'external');
     if ($nf == 'never' || ($nf == 'sometimes' and $out instanceof ShowstreamAction)) {
         $attrs['rel'] = 'external';
     } else {
         $attrs['rel'] = 'nofollow external';
     }
     $out->elementStart('h3');
     $out->element('a', $attrs, $nb->title);
     $out->elementEnd('h3');
     // Replies look like "for:" tags
     $replies = $stored->getReplies();
     $tags = $stored->getTags();
     if (!empty($nb->description)) {
         $out->element('p', array('class' => 'bookmark-description'), $nb->description);
     }
     if (!empty($replies) || !empty($tags)) {
         $out->elementStart('ul', array('class' => 'bookmark-tags'));
         foreach ($replies as $reply) {
             $other = Profile::getKV('id', $reply);
             if (!empty($other)) {
                 $out->elementStart('li');
                 $out->element('a', array('rel' => 'tag', 'href' => $other->profileurl, 'title' => $other->getBestName()), sprintf('for:%s', $other->nickname));
                 $out->elementEnd('li');
                 $out->text(' ');
             }
         }
         foreach ($tags as $tag) {
             $tag = trim($tag);
             if (!empty($tag)) {
                 $out->elementStart('li');
                 $out->element('a', array('rel' => 'tag', 'href' => Notice_tag::url($tag)), $tag);
                 $out->elementEnd('li');
                 $out->text(' ');
             }
         }
         $out->elementEnd('ul');
     }
 }
 public function onEndProfilePageActionsElements(HTMLOutputter $out, Profile $profile)
 {
     $scoped = Profile::current();
     if (!$scoped instanceof Profile) {
         return true;
     }
     if ($profile->isLocal() && $scoped->mutuallySubscribed($profile)) {
         $out->elementStart('li', 'entity_send-a-message');
         $out->element('a', array('href' => common_local_url('newmessage', array('to' => $profile->id)), 'title' => _('Send a direct message to this user.')), _m('BUTTON', 'Message'));
         $out->elementEnd('li');
     }
     return true;
 }
Пример #9
0
 protected function showNoticeContent(Notice $stored, HTMLOutputter $out, Profile $scoped = null)
 {
     $nb = Bookmark::fromStored($stored);
     // Whether to nofollow
     $attrs = array('href' => $nb->getUrl(), 'class' => 'bookmark-title');
     $nf = common_config('nofollow', 'external');
     if ($nf == 'never' || ($nf == 'sometimes' and $out instanceof ShowstreamAction)) {
         $attrs['rel'] = 'external';
     } else {
         $attrs['rel'] = 'nofollow external';
     }
     $out->elementStart('h3');
     $out->element('a', $attrs, $nb->getTitle());
     $out->elementEnd('h3');
     // Replies look like "for:" tags
     $replies = $stored->getReplies();
     $tags = $stored->getTags();
     if (!empty($nb->description)) {
         $out->element('p', array('class' => 'bookmark-description'), $nb->description);
     }
     if (!empty($replies) || !empty($tags)) {
         $out->elementStart('ul', array('class' => 'bookmark-tags'));
         foreach ($replies as $reply) {
             $other = Profile::getByPK($reply);
             $out->elementStart('li');
             $out->element('a', array('rel' => 'tag', 'href' => $other->getUrl(), 'title' => $other->getBestName()), sprintf('for:%s', $other->getNickname()));
             $out->elementEnd('li');
             $out->text(' ');
         }
         foreach ($tags as $tag) {
             $tag = trim($tag);
             if (!empty($tag)) {
                 $out->elementStart('li');
                 $out->element('a', array('rel' => 'tag', 'href' => Notice_tag::url($tag)), $tag);
                 $out->elementEnd('li');
                 $out->text(' ');
             }
         }
         $out->elementEnd('ul');
     }
 }