X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FGroupPrivateMessage%2FGroupPrivateMessagePlugin.php;h=61828239cac793a19549de9e390f4927e3dc2ec9;hb=5167b1fa408aa486ad75c8ddd3c71cb568dc84a3;hp=28a1ab989e8785640b4ce446ef32db368cfeb395;hpb=1ee79dc3791162f7ef9b92befaef597328266ce1;p=quix0rs-gnu-social.git diff --git a/plugins/GroupPrivateMessage/GroupPrivateMessagePlugin.php b/plugins/GroupPrivateMessage/GroupPrivateMessagePlugin.php index 28a1ab989e..61828239ca 100644 --- a/plugins/GroupPrivateMessage/GroupPrivateMessagePlugin.php +++ b/plugins/GroupPrivateMessage/GroupPrivateMessagePlugin.php @@ -70,11 +70,11 @@ class GroupPrivateMessagePlugin extends Plugin /** * Map URLs to actions * - * @param Net_URL_Mapper $m path-to-action mapper + * @param URLMapper $m path-to-action mapper * * @return boolean hook value */ - function onRouterInitialized($m) + public function onRouterInitialized(URLMapper $m) { $m->connect('group/:nickname/inbox', array('action' => 'groupinbox'), @@ -101,7 +101,7 @@ class GroupPrivateMessagePlugin extends Plugin * * @see Action */ - function onEndGroupGroupNav($groupnav) + function onEndGroupGroupNav(Menu $groupnav) { $action = $groupnav->action; $group = $groupnav->group; @@ -146,7 +146,7 @@ class GroupPrivateMessagePlugin extends Plugin * * @param GroupEditForm $form form being shown */ - function onEndGroupEditFormData($form) + function onEndGroupEditFormData(GroupEditForm $form) { $gps = null; @@ -187,19 +187,22 @@ class GroupPrivateMessagePlugin extends Plugin return true; } - function onEndGroupSaveForm($action) + function onEndGroupSaveForm(Action $action) { + // The Action class must contain this method + assert(is_callable(array($action, 'getGroup'))); + $gps = null; - if (!empty($action->group)) { - $gps = Group_privacy_settings::getKV('group_id', $action->group->id); + if ($action->getGroup() instanceof User_group) { + $gps = Group_privacy_settings::getKV('group_id', $action->getGroup()->id); } $orig = null; if (empty($gps)) { $gps = new Group_privacy_settings(); - $gps->group_id = $action->group->id; + $gps->group_id = $action->getGroup()->id; } else { $orig = clone($gps); } @@ -230,7 +233,7 @@ class GroupPrivateMessagePlugin extends Plugin * * @return boolean hook value */ - function onStartInterpretCommand($cmd, $arg, $user, &$result) + function onStartInterpretCommand($cmd, $arg, User $user, &$result) { if ($cmd == 'd' || $cmd == 'dm') { @@ -264,7 +267,7 @@ class GroupPrivateMessagePlugin extends Plugin * * @return boolean hook value */ - function onEndGroupActionsList($widget, $group) + function onEndGroupActionsList(Widget $widget, User_group $group) { $cur = common_current_user(); $action = $widget->out; @@ -299,7 +302,7 @@ class GroupPrivateMessagePlugin extends Plugin * * @param */ - function onStartNoticeSave(&$notice) { + function onStartNoticeSave(Notice &$notice) { // Look for group tags // FIXME: won't work for remote groups // @fixme if Notice::saveNew is refactored so we can just pull its list @@ -378,7 +381,7 @@ class GroupPrivateMessagePlugin extends Plugin * * @return boolean hook value */ - function onEndGroupProfileElements($action, $group) + function onEndGroupProfileElements(Action $action, User_group $group) { $gps = Group_privacy_settings::forGroup($group); @@ -390,10 +393,10 @@ class GroupPrivateMessagePlugin extends Plugin return true; } - function onStartShowExportData($action) + function onStartShowExportData(Action $action) { if ($action instanceof ShowgroupAction) { - $gps = Group_privacy_settings::forGroup($action->group); + $gps = Group_privacy_settings::forGroup($action->getGroup()); if ($gps->allow_privacy == Group_privacy_settings::ALWAYS) { return false; @@ -402,7 +405,7 @@ class GroupPrivateMessagePlugin extends Plugin return true; } - function onPluginVersion(&$versions) + function onPluginVersion(array &$versions) { $versions[] = array('name' => 'GroupPrivateMessage', 'version' => GNUSOCIAL_VERSION,