From 9376a6d75a5f85f473a3121c7b4c1f01d19d7187 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Fri, 5 Jun 2015 21:30:50 +0200 Subject: [PATCH] ModPlus plugin now links to remote profiles with UserbyidAction --- lib/profileaction.php | 5 ++ plugins/ModPlus/ModPlusPlugin.php | 24 +------ plugins/ModPlus/actions/remoteprofile.php | 87 ----------------------- 3 files changed, 7 insertions(+), 109 deletions(-) delete mode 100644 plugins/ModPlus/actions/remoteprofile.php diff --git a/lib/profileaction.php b/lib/profileaction.php index 4ed1e8ad83..b1a3b72a44 100644 --- a/lib/profileaction.php +++ b/lib/profileaction.php @@ -71,6 +71,11 @@ abstract class ProfileAction extends ManagedAction return true; } + public function getTarget() + { + return $this->target; + } + function isReadOnly($args) { return true; diff --git a/plugins/ModPlus/ModPlusPlugin.php b/plugins/ModPlus/ModPlusPlugin.php index 1ca024e9ac..2e1077c225 100644 --- a/plugins/ModPlus/ModPlusPlugin.php +++ b/plugins/ModPlus/ModPlusPlugin.php @@ -17,9 +17,7 @@ * along with this program. If not, see . */ -if (!defined('STATUSNET')) { - exit(1); -} +if (!defined('GNUSOCIAL')) { exit(1); } /** * Some UI extras for now... @@ -59,24 +57,6 @@ class ModPlusPlugin extends Plugin return true; } - /** - * Add ModPlus-related paths to the router table - * - * Hook for RouterInitialized event. - * - * @param URLMapper $m URL mapper - * - * @return boolean hook return - */ - public function onStartInitializeRouter(URLMapper $m) - { - $m->connect('user/remote/:id', - array('action' => 'remoteprofile'), - array('id' => '[\d]+')); - - return true; - } - /** * Add per-profile info popup menu for author on notice lists. * @@ -110,7 +90,7 @@ class ModPlusPlugin extends Plugin protected function showProfileOptions(HTMLOutputter $out, Profile $profile) { if (!$profile->isGroup() && !$profile->isLocal()) { - $target = common_local_url('remoteprofile', array('id' => $profile->id)); + $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'); diff --git a/plugins/ModPlus/actions/remoteprofile.php b/plugins/ModPlus/actions/remoteprofile.php deleted file mode 100644 index 4203672030..0000000000 --- a/plugins/ModPlus/actions/remoteprofile.php +++ /dev/null @@ -1,87 +0,0 @@ -target->getBestName(); - $host = parse_url($this->target->profileurl, PHP_URL_HOST); - // TRANS: Remote profile action page title. - // TRANS: %1$s is a username, %2$s is a hostname. - return sprintf(_m('%1$s on %2$s'), $base, $host); - } - - /** - * Instead of showing notices, link to the original offsite profile. - */ - function showNotices() - { - $url = $this->target->profileurl; - $host = parse_url($url, PHP_URL_HOST); - $markdown = sprintf( - // TRANS: Message on remote profile page. - // TRANS: This message contains Markdown links in the form [description](link). - // TRANS: %1$s is a profile nickname, %2$s is a hostname, %3$s is a URL. - _m('This remote profile is registered on another site; see [%1$s\'s original profile page on %2$s](%3$s).'), - $this->target->nickname, - $host, - $url); - $html = common_markup_to_html($markdown); - $this->raw($html); - - if ($this->target->hasRole(Profile_role::SILENCED)) { - // TRANS: Message on blocked remote profile page. - $markdown = _m('Site moderators have silenced this profile, which prevents delivery of new messages to any users on this site.'); - $this->raw(common_markup_to_html($markdown)); - }else{ - - $pnl = new NoticeList($this->notice, $this); - $cnt = $pnl->show(); - if (0 == $cnt) { - $this->showEmptyListMessage(); - } - - $args = array('id' => $this->target->id); - if (!empty($this->tag)) - { - $args['tag'] = $this->tag; - } - $this->pagination($this->page>1, $cnt>NOTICES_PER_PAGE, $this->page, - 'remoteprofile', $args); - - } - } - - function getFeeds() - { - // none - } - - /** - * Don't do various extra stuff, and also trim some things to avoid crawlers. - */ - function extraHead() - { - $this->element('meta', array('name' => 'robots', - 'content' => 'noindex,nofollow')); - } - - function showLocalNav() - { - // skip - } - - function showSections() - { - // skip - } - - function showStatistics() - { - // skip - } -} -- 2.39.5