[CORE] Move plugin superclasses from /lib/ to /lib/modules/
This commit is contained in:
parent
c18f26145c
commit
99fe3e5a52
|
@ -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' &&
|
||||
|
@ -143,10 +146,10 @@ spl_autoload_register('GNUsocial_class_autoload');
|
|||
* The namespaced based structure is called "PSR-0 autoloading standard":
|
||||
* \<Vendor Name>\(<Namespace>\)*<Class Name>
|
||||
* and is available here: http://www.php-fig.org/psr/psr-0/
|
||||
*/
|
||||
spl_autoload_register(function($class){
|
||||
*/
|
||||
spl_autoload_register(function ($class) {
|
||||
$class_base = preg_replace('{\\\\|_(?!.*\\\\)}', DIRECTORY_SEPARATOR, ltrim($class, '\\'));
|
||||
$file = INSTALLDIR."/extlib/{$class_base}.php";
|
||||
$file = INSTALLDIR . "/extlib/{$class_base}.php";
|
||||
if (file_exists($file)) {
|
||||
require_once $file;
|
||||
return;
|
||||
|
@ -159,9 +162,9 @@ spl_autoload_register(function($class){
|
|||
return;
|
||||
}
|
||||
});
|
||||
require_once INSTALLDIR.'/lib/util.php';
|
||||
require_once INSTALLDIR.'/lib/action.php';
|
||||
require_once INSTALLDIR.'/lib/mail.php';
|
||||
require_once INSTALLDIR . '/lib/util.php';
|
||||
require_once INSTALLDIR . '/lib/action.php';
|
||||
require_once INSTALLDIR . '/lib/mail.php';
|
||||
|
||||
//set PEAR error handling to use regular PHP exceptions
|
||||
function PEAR_ErrorToPEAR_Exception(PEAR_Error $err)
|
||||
|
@ -194,3 +197,4 @@ function PEAR_ErrorToPEAR_Exception(PEAR_Error $err)
|
|||
}
|
||||
throw new PEAR_Exception($err->getMessage());
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
|
@ -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
|
|
@ -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)
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user