git.gnu.io has moved to IP address 209.51.188.249 -- please double check where you are logging in.

Commit 419c2cd5 authored by Roland Haeder's avatar Roland Haeder Committed by mmn

Some fixes/improvements - added getter getGroup() for...

Some fixes/improvements - added getter getGroup() for https://bugz.foocorp.net/T44 - added type-hints in method signatures

---------------------------------------------------------
WARNING: Some plugins attempt to get a property 'group' from (basicly) a Menu
class which does NOT have such property. This badly needs fixing.
---------------------------------------------------------
Signed-off-by: Roland Haeder's avatarRoland Haeder <roland@mxchange.org>
parent 57b5e248
......@@ -284,6 +284,11 @@ class GroupAction extends Action
return $options;
}
function getGroup()
{
return $this->group;
}
}
class GroupAdminSection extends ProfileSection
......
......@@ -56,7 +56,7 @@ class Menu extends Widget
*
* @param Action $action current action, used for output
*/
function __construct($action=null)
function __construct(Action $action=null)
{
parent::__construct($action);
......@@ -104,7 +104,7 @@ class Menu extends Widget
}
}
function item($actionName, $args, $label, $description, $id=null, $cls=null)
function item($actionName, array $args, $label, $description, $id=null, $cls=null)
{
if (empty($id)) {
$id = $this->menuItemID($actionName, $args);
......@@ -120,7 +120,7 @@ class Menu extends Widget
$cls);
}
function isCurrent($actionName, $args)
function isCurrent($actionName, array $args)
{
if ($actionName != $this->actionName) {
return false;
......
......@@ -61,7 +61,7 @@ class PeopletagGroupNav extends Widget
*
* @param Action $action current action, used for output
*/
function __construct($action=null)
function __construct(Action $action=null)
{
parent::__construct($action);
$this->action = $action;
......
......@@ -51,7 +51,7 @@ class SearchGroupNav extends Menu
*
* @param Action $action current action, used for output
*/
function __construct($action=null, $q = null)
function __construct(Action $action=null, $q = null)
{
parent::__construct($action);
$this->q = $q;
......
......@@ -50,8 +50,9 @@ class SubGroupNav extends Menu
* Construction
*
* @param Action $action current action, used for output
* @param User $user Current user or NULL if "guest"
*/
function __construct($action=null, $user=null)
function __construct(Action $action=null, User $user=null)
{
parent::__construct($action);
$this->user = $user;
......
......@@ -32,7 +32,7 @@ class GroupFavoritedPlugin extends Plugin
* @param Net_URL_Mapper $m path-to-action mapper
* @return boolean hook return
*/
function onRouterInitialized($m)
function onRouterInitialized(Net_URL_Mapper $m)
{
$m->connect('group/:nickname/favorited',
array('action' => 'groupfavorited'),
......@@ -41,7 +41,7 @@ class GroupFavoritedPlugin extends Plugin
return true;
}
function onEndGroupGroupNav(GroupNav $nav)
function onEndGroupGroupNav(Menu $nav)
{
$action_name = $nav->action->trimmed('action');
$nickname = $nav->group->nickname;
......@@ -65,7 +65,7 @@ class GroupFavoritedPlugin extends Plugin
*
* @return boolean hook value
*/
function onPluginVersion(&$versions)
function onPluginVersion(array &$versions)
{
$url = 'http://status.net/wiki/Plugin:GroupFavorited';
......
......@@ -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,19 @@ class GroupPrivateMessagePlugin extends Plugin
return true;
}
function onEndGroupSaveForm($action)
function onEndGroupSaveForm(GroupAction $action)
{
$gps = null;
if (!empty($action->group)) {
$gps = Group_privacy_settings::getKV('group_id', $action->group->id);
if (!empty($action->getGroup())) {
$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 +230,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 +264,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 +299,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 +378,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 +390,10 @@ class GroupPrivateMessagePlugin extends Plugin
return true;
}
function onStartShowExportData($action)
function onStartShowExportData(GroupAction $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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment