forked from GNUsocial/gnu-social
plugins onAutoload now only overloads if necessary (extlibs etc.)
lib/plugin.php now has a parent onAutoload function that finds most common files that are used in plugins (actions, dataobjects, forms, libs etc.) if they are put in the standardised directories ('actions', 'classes', 'forms', 'lib' and perhaps some others in the future).
This commit is contained in:
@@ -200,38 +200,6 @@ class OStatusPlugin extends Plugin
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Automatically load the actions and libraries used by the plugin
|
||||
*
|
||||
* @param Class $cls the class
|
||||
*
|
||||
* @return boolean hook return
|
||||
*
|
||||
*/
|
||||
function onAutoload($cls)
|
||||
{
|
||||
$base = dirname(__FILE__);
|
||||
$lower = strtolower($cls);
|
||||
$map = array('activityverb' => 'activity',
|
||||
'activityobject' => 'activity',
|
||||
'activityutils' => 'activity');
|
||||
if (isset($map[$lower])) {
|
||||
$lower = $map[$lower];
|
||||
}
|
||||
$files = array("$base/classes/$cls.php",
|
||||
"$base/lib/$lower.php");
|
||||
if (substr($lower, -6) == 'action') {
|
||||
$files[] = "$base/actions/" . substr($lower, 0, -6) . ".php";
|
||||
}
|
||||
foreach ($files as $file) {
|
||||
if (file_exists($file)) {
|
||||
include_once $file;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add in an OStatus subscribe button
|
||||
*/
|
||||
|
Reference in New Issue
Block a user