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:
Mikael Nordfeldth
2013-08-28 15:54:26 +02:00
parent b6cfcfbcaa
commit de55d8f83b
282 changed files with 227 additions and 1423 deletions

View File

@@ -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
*/