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 <roland@mxchange.org>
This commit is contained in:
parent
57b5e2483d
commit
419c2cd5b3
@ -284,6 +284,11 @@ class GroupAction extends Action
|
|||||||
|
|
||||||
return $options;
|
return $options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getGroup()
|
||||||
|
{
|
||||||
|
return $this->group;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class GroupAdminSection extends ProfileSection
|
class GroupAdminSection extends ProfileSection
|
||||||
|
@ -56,7 +56,7 @@ class Menu extends Widget
|
|||||||
*
|
*
|
||||||
* @param Action $action current action, used for output
|
* @param Action $action current action, used for output
|
||||||
*/
|
*/
|
||||||
function __construct($action=null)
|
function __construct(Action $action=null)
|
||||||
{
|
{
|
||||||
parent::__construct($action);
|
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)) {
|
if (empty($id)) {
|
||||||
$id = $this->menuItemID($actionName, $args);
|
$id = $this->menuItemID($actionName, $args);
|
||||||
@ -120,7 +120,7 @@ class Menu extends Widget
|
|||||||
$cls);
|
$cls);
|
||||||
}
|
}
|
||||||
|
|
||||||
function isCurrent($actionName, $args)
|
function isCurrent($actionName, array $args)
|
||||||
{
|
{
|
||||||
if ($actionName != $this->actionName) {
|
if ($actionName != $this->actionName) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -61,7 +61,7 @@ class PeopletagGroupNav extends Widget
|
|||||||
*
|
*
|
||||||
* @param Action $action current action, used for output
|
* @param Action $action current action, used for output
|
||||||
*/
|
*/
|
||||||
function __construct($action=null)
|
function __construct(Action $action=null)
|
||||||
{
|
{
|
||||||
parent::__construct($action);
|
parent::__construct($action);
|
||||||
$this->action = $action;
|
$this->action = $action;
|
||||||
|
@ -51,7 +51,7 @@ class SearchGroupNav extends Menu
|
|||||||
*
|
*
|
||||||
* @param Action $action current action, used for output
|
* @param Action $action current action, used for output
|
||||||
*/
|
*/
|
||||||
function __construct($action=null, $q = null)
|
function __construct(Action $action=null, $q = null)
|
||||||
{
|
{
|
||||||
parent::__construct($action);
|
parent::__construct($action);
|
||||||
$this->q = $q;
|
$this->q = $q;
|
||||||
|
@ -50,8 +50,9 @@ class SubGroupNav extends Menu
|
|||||||
* Construction
|
* Construction
|
||||||
*
|
*
|
||||||
* @param Action $action current action, used for output
|
* @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);
|
parent::__construct($action);
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
|
@ -32,7 +32,7 @@ class GroupFavoritedPlugin extends Plugin
|
|||||||
* @param Net_URL_Mapper $m path-to-action mapper
|
* @param Net_URL_Mapper $m path-to-action mapper
|
||||||
* @return boolean hook return
|
* @return boolean hook return
|
||||||
*/
|
*/
|
||||||
function onRouterInitialized($m)
|
function onRouterInitialized(Net_URL_Mapper $m)
|
||||||
{
|
{
|
||||||
$m->connect('group/:nickname/favorited',
|
$m->connect('group/:nickname/favorited',
|
||||||
array('action' => 'groupfavorited'),
|
array('action' => 'groupfavorited'),
|
||||||
@ -41,7 +41,7 @@ class GroupFavoritedPlugin extends Plugin
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function onEndGroupGroupNav(GroupNav $nav)
|
function onEndGroupGroupNav(Menu $nav)
|
||||||
{
|
{
|
||||||
$action_name = $nav->action->trimmed('action');
|
$action_name = $nav->action->trimmed('action');
|
||||||
$nickname = $nav->group->nickname;
|
$nickname = $nav->group->nickname;
|
||||||
@ -65,7 +65,7 @@ class GroupFavoritedPlugin extends Plugin
|
|||||||
*
|
*
|
||||||
* @return boolean hook value
|
* @return boolean hook value
|
||||||
*/
|
*/
|
||||||
function onPluginVersion(&$versions)
|
function onPluginVersion(array &$versions)
|
||||||
{
|
{
|
||||||
$url = 'http://status.net/wiki/Plugin:GroupFavorited';
|
$url = 'http://status.net/wiki/Plugin:GroupFavorited';
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ class GroupPrivateMessagePlugin extends Plugin
|
|||||||
*
|
*
|
||||||
* @see Action
|
* @see Action
|
||||||
*/
|
*/
|
||||||
function onEndGroupGroupNav($groupnav)
|
function onEndGroupGroupNav(Menu $groupnav)
|
||||||
{
|
{
|
||||||
$action = $groupnav->action;
|
$action = $groupnav->action;
|
||||||
$group = $groupnav->group;
|
$group = $groupnav->group;
|
||||||
@ -146,7 +146,7 @@ class GroupPrivateMessagePlugin extends Plugin
|
|||||||
*
|
*
|
||||||
* @param GroupEditForm $form form being shown
|
* @param GroupEditForm $form form being shown
|
||||||
*/
|
*/
|
||||||
function onEndGroupEditFormData($form)
|
function onEndGroupEditFormData(GroupEditForm $form)
|
||||||
{
|
{
|
||||||
$gps = null;
|
$gps = null;
|
||||||
|
|
||||||
@ -187,19 +187,19 @@ class GroupPrivateMessagePlugin extends Plugin
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function onEndGroupSaveForm($action)
|
function onEndGroupSaveForm(GroupAction $action)
|
||||||
{
|
{
|
||||||
$gps = null;
|
$gps = null;
|
||||||
|
|
||||||
if (!empty($action->group)) {
|
if (!empty($action->getGroup())) {
|
||||||
$gps = Group_privacy_settings::getKV('group_id', $action->group->id);
|
$gps = Group_privacy_settings::getKV('group_id', $action->getGroup()->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
$orig = null;
|
$orig = null;
|
||||||
|
|
||||||
if (empty($gps)) {
|
if (empty($gps)) {
|
||||||
$gps = new Group_privacy_settings();
|
$gps = new Group_privacy_settings();
|
||||||
$gps->group_id = $action->group->id;
|
$gps->group_id = $action->getGroup()->id;
|
||||||
} else {
|
} else {
|
||||||
$orig = clone($gps);
|
$orig = clone($gps);
|
||||||
}
|
}
|
||||||
@ -230,7 +230,7 @@ class GroupPrivateMessagePlugin extends Plugin
|
|||||||
*
|
*
|
||||||
* @return boolean hook value
|
* @return boolean hook value
|
||||||
*/
|
*/
|
||||||
function onStartInterpretCommand($cmd, $arg, $user, &$result)
|
function onStartInterpretCommand($cmd, $arg, User $user, &$result)
|
||||||
{
|
{
|
||||||
if ($cmd == 'd' || $cmd == 'dm') {
|
if ($cmd == 'd' || $cmd == 'dm') {
|
||||||
|
|
||||||
@ -264,7 +264,7 @@ class GroupPrivateMessagePlugin extends Plugin
|
|||||||
*
|
*
|
||||||
* @return boolean hook value
|
* @return boolean hook value
|
||||||
*/
|
*/
|
||||||
function onEndGroupActionsList($widget, $group)
|
function onEndGroupActionsList(Widget $widget, User_group $group)
|
||||||
{
|
{
|
||||||
$cur = common_current_user();
|
$cur = common_current_user();
|
||||||
$action = $widget->out;
|
$action = $widget->out;
|
||||||
@ -299,7 +299,7 @@ class GroupPrivateMessagePlugin extends Plugin
|
|||||||
*
|
*
|
||||||
* @param
|
* @param
|
||||||
*/
|
*/
|
||||||
function onStartNoticeSave(&$notice) {
|
function onStartNoticeSave(Notice &$notice) {
|
||||||
// Look for group tags
|
// Look for group tags
|
||||||
// FIXME: won't work for remote groups
|
// FIXME: won't work for remote groups
|
||||||
// @fixme if Notice::saveNew is refactored so we can just pull its list
|
// @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
|
* @return boolean hook value
|
||||||
*/
|
*/
|
||||||
function onEndGroupProfileElements($action, $group)
|
function onEndGroupProfileElements(Action $action, User_group $group)
|
||||||
{
|
{
|
||||||
$gps = Group_privacy_settings::forGroup($group);
|
$gps = Group_privacy_settings::forGroup($group);
|
||||||
|
|
||||||
@ -390,10 +390,10 @@ class GroupPrivateMessagePlugin extends Plugin
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function onStartShowExportData($action)
|
function onStartShowExportData(GroupAction $action)
|
||||||
{
|
{
|
||||||
if ($action instanceof ShowgroupAction) {
|
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) {
|
if ($gps->allow_privacy == Group_privacy_settings::ALWAYS) {
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user