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