[CORE] Move plugin superclasses from /lib/ to /lib/modules/

This commit is contained in:
Diogo Cordeiro 2019-08-02 02:50:48 +01:00 committed by Diogo Peralta Cordeiro
parent c18f26145c
commit 99fe3e5a52
15 changed files with 32 additions and 28 deletions

View File

@ -19,10 +19,11 @@
*
* @package GNUsocial
* @author Evan Prodromou
* @author Shashi Gowda
* @author Neil E. Hodges
* @author Brion Vibber
* @author Shashi Gowda <connect2shashi@gmail.com>
* @author Neil E. Hodges <47hasbegun@gmail.com>
* @author Brion Vibber <brion@pobox.com>
* @author Mikael Nordfeldth <mmn@hethane.se>
* @author Diogo Cordeiro <diogo@fc.up.pt>
* @copyright 2010-2019 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
@ -99,15 +100,15 @@ require_once 'DB/DataObject/Cast.php'; # for dates
global $_DB;
$_DB = new DB;
require_once(INSTALLDIR.'/lib/language.php');
require_once INSTALLDIR . '/lib/language.php';
// This gets included before the config file, so that admin code and plugins
// can use it
require_once(INSTALLDIR.'/lib/event.php');
require_once(INSTALLDIR.'/lib/plugin.php');
require_once INSTALLDIR . '/lib/event.php';
require_once INSTALLDIR . '/lib/modules/Plugin.php';
function addPlugin($name, array $attrs=array())
function addPlugin($name, array $attrs = [])
{
return GNUsocial::addPlugin($name, $attrs);
}
@ -121,6 +122,8 @@ function GNUsocial_class_autoload($cls)
{
if (file_exists(INSTALLDIR.'/classes/' . $cls . '.php')) {
require_once(INSTALLDIR.'/classes/' . $cls . '.php');
} elseif (file_exists(INSTALLDIR . '/lib/modules/' . $cls . '.php')) {
require_once INSTALLDIR . '/lib/modules/' . $cls . '.php';
} else if (file_exists(INSTALLDIR.'/lib/' . strtolower($cls) . '.php')) {
require_once(INSTALLDIR.'/lib/' . strtolower($cls) . '.php');
} else if (mb_substr($cls, -6) == 'Action' &&
@ -194,3 +197,4 @@ function PEAR_ErrorToPEAR_Exception(PEAR_Error $err)
}
throw new PEAR_Exception($err->getMessage());
}

View File

@ -31,7 +31,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
}
/**
* Superclass for plugins that do authentication
* Superclass for plugins that do IM transport
*
* Implementations will likely want to override onStartIoManagerClasses() so that their
* IO manager is used

View File

@ -19,7 +19,7 @@ defined('GNUSOCIAL') || die();
/**
* Base class for plugins
*
* A base class for StatusNet plugins. Mostly a light wrapper around
* A base class for GNU social modules. Mostly a light wrapper around
* the Event framework.
*
* Subclasses of Plugin will automatically handle an event if they define

View File

@ -112,7 +112,7 @@ class ActivityModerationPlugin extends ActivityVerbHandlerPlugin
return true;
}
// FIXME: Put this in lib/activityhandlerplugin.php when we're ready
// FIXME: Put this in lib/modules/ActivityHandlerPlugin.php when we're ready
// with the other microapps/activityhandlers as well.
// Also it should be StartNoticeAsActivity (with a prepped Activity, including ->context etc.)
public function onEndNoticeAsActivity(Notice $stored, Activity $act, Profile $scoped=null)

View File

@ -38,7 +38,7 @@ class ActivityVerbPlugin extends Plugin
$unsupported = ['delete', 'share'];
foreach ($unsupported as $idx => $verb) {
$unsupported[$idx] = "(?!".$verb.")";
$unsupported[$idx] = "(?!{$verb})";
}
// not all verbs are currently handled by ActivityVerb Plugins,

View File

@ -50,7 +50,7 @@ class ActivityVerbPostPlugin extends ActivityVerbHandlerPlugin
return array(ActivityVerb::POST);
}
// FIXME: Set this to abstract public in lib/activityhandlerplugin.php when all plugins have migrated!
// FIXME: Set this to abstract public in lib/ActivityHandlerPlugin.php when all plugins have migrated!
protected function saveObjectFromActivity(Activity $act, Notice $stored, array $options=array())
{
assert($this->isMyActivity($act));

View File

@ -187,7 +187,7 @@ class FavoritePlugin extends ActivityVerbHandlerPlugin
'format' => '(xml|json)']);
}
// FIXME: Set this to abstract public in lib/activityhandlerplugin.php ddwhen all plugins have migrated!
// FIXME: Set this to abstract public in lib/modules/ActivityHandlerPlugin.php when all plugins have migrated!
protected function saveObjectFromActivity(Activity $act, Notice $stored, array $options=array())
{
assert($this->isMyActivity($act));
@ -200,7 +200,7 @@ class FavoritePlugin extends ActivityVerbHandlerPlugin
return $object;
}
// FIXME: Put this in lib/activityhandlerplugin.php when we're ready
// FIXME: Put this in lib/modules/ActivityHandlerPlugin.php when we're ready
// with the other microapps/activityhandlers as well.
// Also it should be StartNoticeAsActivity (with a prepped Activity, including ->context etc.)
public function onEndNoticeAsActivity(Notice $stored, Activity $act, Profile $scoped=null)

View File

@ -79,7 +79,7 @@ class SharePlugin extends ActivityVerbHandlerPlugin
'format' => '(xml|json)']);
}
// FIXME: Set this to abstract public in lib/activityhandlerplugin.php when all plugins have migrated!
// FIXME: Set this to abstract public in lib/modules/ActivityHandlerPlugin.php when all plugins have migrated!
protected function saveObjectFromActivity(Activity $act, Notice $stored, array $options=array())
{
assert($this->isMyActivity($act));
@ -139,7 +139,7 @@ class SharePlugin extends ActivityVerbHandlerPlugin
return true;
}
// FIXME: Put this in lib/activityhandlerplugin.php when we're ready
// FIXME: Put this in lib/modules/ActivityHandlerPlugin.php when we're ready
// with the other microapps/activityhandlers as well.
// Also it should be StartNoticeAsActivity (with a prepped Activity, including ->context etc.)
public function onEndNoticeAsActivity(Notice $stored, Activity $act, Profile $scoped=null)