remoteprofile.php 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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 = null;
  39. if (Event::handle('ShowStreamNoticeList', array($this->notice, $this, &$pnl))) {
  40. $pnl = new ProfileNoticeList($this->notice, $this);
  41. }
  42. $cnt = $pnl->show();
  43. if (0 == $cnt) {
  44. $this->showEmptyListMessage();
  45. }
  46. $args = array('id' => $this->target->id);
  47. if (!empty($this->tag))
  48. {
  49. $args['tag'] = $this->tag;
  50. }
  51. $this->pagination($this->page>1, $cnt>NOTICES_PER_PAGE, $this->page,
  52. 'remoteprofile', $args);
  53. }
  54. }
  55. function getFeeds()
  56. {
  57. // none
  58. }
  59. /**
  60. * Don't do various extra stuff, and also trim some things to avoid crawlers.
  61. */
  62. function extraHead()
  63. {
  64. $this->element('meta', array('name' => 'robots',
  65. 'content' => 'noindex,nofollow'));
  66. }
  67. function showLocalNav()
  68. {
  69. // skip
  70. }
  71. function showSections()
  72. {
  73. // skip
  74. }
  75. function showStatistics()
  76. {
  77. // skip
  78. }
  79. }