From 83f50d25c093c2c440a34546186c3cf9ac670223 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Sun, 2 Mar 2014 23:06:21 +0100 Subject: [PATCH] Cosmetic changes to SubMirror actions --- plugins/SubMirror/actions/addmirror.php | 8 +++----- plugins/SubMirror/actions/basemirror.php | 10 ++++------ plugins/SubMirror/actions/editmirror.php | 10 ++++------ 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/plugins/SubMirror/actions/addmirror.php b/plugins/SubMirror/actions/addmirror.php index 4e2e1a0c52..51d141c289 100644 --- a/plugins/SubMirror/actions/addmirror.php +++ b/plugins/SubMirror/actions/addmirror.php @@ -26,9 +26,7 @@ * @link http://status.net/ */ -if (!defined('STATUSNET')) { - exit(1); -} +if (!defined('GNUSOCIAL') && !defined('STATUSNET')) { exit(1); } /** * Takes parameters: @@ -56,7 +54,7 @@ class AddMirrorAction extends BaseMirrorAction * * @return boolean success flag */ - function prepare($args) + protected function prepare(array $args=array()) { parent::prepare($args); $feedurl = $this->getFeedUrl(); @@ -77,7 +75,7 @@ class AddMirrorAction extends BaseMirrorAction } } - function saveMirror() + protected function saveMirror() { if ($this->oprofile->subscribe()) { SubMirror::saveMirror($this->user, $this->profile); diff --git a/plugins/SubMirror/actions/basemirror.php b/plugins/SubMirror/actions/basemirror.php index 95e2f91597..b3dc1a0517 100644 --- a/plugins/SubMirror/actions/basemirror.php +++ b/plugins/SubMirror/actions/basemirror.php @@ -26,9 +26,7 @@ * @link http://status.net/ */ -if (!defined('STATUSNET')) { - exit(1); -} +if (!defined('GNUSOCIAL') && !defined('STATUSNET')) { exit(1); } /** * Takes parameters: @@ -57,7 +55,7 @@ abstract class BaseMirrorAction extends Action * * @return boolean success flag */ - function prepare($args) + protected function prepare(array $args=array()) { parent::prepare($args); return $this->sharedBoilerplate(); @@ -152,7 +150,7 @@ abstract class BaseMirrorAction extends Action * * @return void */ - function handle($args) + protected function handle() { // Throws exception on error $this->saveMirror(); @@ -174,5 +172,5 @@ abstract class BaseMirrorAction extends Action } } - abstract function saveMirror(); + abstract protected function saveMirror(); } diff --git a/plugins/SubMirror/actions/editmirror.php b/plugins/SubMirror/actions/editmirror.php index 1119e8718f..d3d79966b9 100644 --- a/plugins/SubMirror/actions/editmirror.php +++ b/plugins/SubMirror/actions/editmirror.php @@ -26,9 +26,7 @@ * @link http://status.net/ */ -if (!defined('STATUSNET')) { - exit(1); -} +if (!defined('GNUSOCIAL') && !defined('STATUSNET')) { exit(1); } /** * Takes parameters: @@ -54,7 +52,7 @@ class EditMirrorAction extends BaseMirrorAction * * @return boolean success flag */ - function prepare($args) + protected function prepare(array $args=array()) { parent::prepare($args); @@ -63,7 +61,7 @@ class EditMirrorAction extends BaseMirrorAction $this->mirror = SubMirror::pkeyGet(array('subscriber' => $this->user->id, 'subscribed' => $this->profile->id)); - if (!$this->mirror) { + if (!$this->mirror instanceof SubMirror) { // TRANS: Client error displayed when trying to edit an object that is not a feed mirror. $this->clientError(_m('Requested invalid profile to edit.')); } @@ -88,7 +86,7 @@ class EditMirrorAction extends BaseMirrorAction } } - function saveMirror() + protected function saveMirror() { $mirror = SubMirror::getMirror($this->user, $this->profile); if (!$mirror) { -- 2.39.5