]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/ModPlus/actions/remoteprofile.php
Only serve tagprofile HTML if we aren't POSTing via ajax
[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 = new NoticeList($this->notice, $this);
43             $cnt = $pnl->show();
44             if (0 == $cnt) {
45                 $this->showEmptyListMessage();
46             }
47
48             $args = array('id' => $this->target->id);
49             if (!empty($this->tag))
50             {
51                 $args['tag'] = $this->tag;
52             }
53             $this->pagination($this->page>1, $cnt>NOTICES_PER_PAGE, $this->page,
54                               'remoteprofile', $args);
55
56         }
57     }
58
59     function getFeeds()
60     {
61         // none
62     }
63
64     /**
65      * Don't do various extra stuff, and also trim some things to avoid crawlers.
66      */
67     function extraHead()
68     {
69         $this->element('meta', array('name' => 'robots',
70                                      'content' => 'noindex,nofollow'));
71     }
72
73     function showLocalNav()
74     {
75         // skip
76     }
77
78     function showSections()
79     {
80         // skip
81     }
82
83     function showStatistics()
84     {
85         // skip
86     }
87 }