use onAutoload instead of always requiring

This commit is contained in:
Craig Andrews 2010-04-22 18:03:05 -04:00
parent 809e597841
commit f91e992851

View File

@ -31,8 +31,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
require_once(INSTALLDIR.'/plugins/Autocomplete/autocomplete.php');
class AutocompletePlugin extends Plugin
{
function __construct()
@ -40,6 +38,16 @@ class AutocompletePlugin extends Plugin
parent::__construct();
}
function onAutoload($cls)
{
switch ($cls)
{
case 'AutocompleteAction':
require_once(INSTALLDIR.'/plugins/Autocomplete/autocomplete.php');
return false;
}
}
function onEndShowScripts($action){
if (common_logged_in()) {
$action->script('plugins/Autocomplete/jquery-autocomplete/jquery.autocomplete.pack.js');