remoteprofile.php 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. /*
  3. * To change this template, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. class RemoteProfileAction extends ShowstreamAction
  7. {
  8. function title()
  9. {
  10. $base = $this->target->getBestName();
  11. $host = parse_url($this->target->profileurl, PHP_URL_HOST);
  12. // TRANS: Remote profile action page title.
  13. // TRANS: %1$s is a username, %2$s is a hostname.
  14. return sprintf(_m('%1$s on %2$s'), $base, $host);
  15. }
  16. /**
  17. * Instead of showing notices, link to the original offsite profile.
  18. */
  19. function showNotices()
  20. {
  21. $url = $this->target->profileurl;
  22. $host = parse_url($url, PHP_URL_HOST);
  23. $markdown = sprintf(
  24. // TRANS: Message on remote profile page.
  25. // TRANS: This message contains Markdown links in the form [description](link).
  26. // TRANS: %1$s is a profile nickname, %2$s is a hostname, %3$s is a URL.
  27. _m('This remote profile is registered on another site; see [%1$s\'s original profile page on %2$s](%3$s).'),
  28. $this->target->nickname,
  29. $host,
  30. $url);
  31. $html = common_markup_to_html($markdown);
  32. $this->raw($html);
  33. if ($this->target->hasRole(Profile_role::SILENCED)) {
  34. // TRANS: Message on blocked remote profile page.
  35. $markdown = _m('Site moderators have silenced this profile, which prevents delivery of new messages to any users on this site.');
  36. $this->raw(common_markup_to_html($markdown));
  37. }else{
  38. $pnl = new NoticeList($this->notice, $this);
  39. $cnt = $pnl->show();
  40. if (0 == $cnt) {
  41. $this->showEmptyListMessage();
  42. }
  43. $args = array('id' => $this->target->id);
  44. if (!empty($this->tag))
  45. {
  46. $args['tag'] = $this->tag;
  47. }
  48. $this->pagination($this->page>1, $cnt>NOTICES_PER_PAGE, $this->page,
  49. 'remoteprofile', $args);
  50. }
  51. }
  52. function getFeeds()
  53. {
  54. // none
  55. }
  56. /**
  57. * Don't do various extra stuff, and also trim some things to avoid crawlers.
  58. */
  59. function extraHead()
  60. {
  61. $this->element('meta', array('name' => 'robots',
  62. 'content' => 'noindex,nofollow'));
  63. }
  64. function showLocalNav()
  65. {
  66. // skip
  67. }
  68. function showSections()
  69. {
  70. // skip
  71. }
  72. function showStatistics()
  73. {
  74. // skip
  75. }
  76. }