From 19c7350770788edf3ae0bb1fd6d95876667adbf6 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 23 Dec 2012 14:52:18 +0400 Subject: experimental new plugin system --- include/functions.php | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'include/functions.php') diff --git a/include/functions.php b/include/functions.php index 53aaa92b3..da6767986 100644 --- a/include/functions.php +++ b/include/functions.php @@ -7,13 +7,6 @@ function __autoload($class) { $class_file = str_replace("_", "/", strtolower(basename($class))); - $file = dirname(__FILE__)."/../plugins/$class_file.php"; - - if (file_exists($file)) { - require $file; - return; - } - $file = dirname(__FILE__)."/../classes/$class_file.php"; if (file_exists($file)) { @@ -3265,15 +3258,10 @@ onclick=\"postOpenInNewTab(event, $id)\" alt='Zoom' title='".__('Open article in new tab')."'>"; - $button_plugins = explode(",", ARTICLE_BUTTON_PLUGINS); + global $pluginhost; - foreach ($button_plugins as $p) { - $pclass = "button_" . trim($p); - - if (class_exists($pclass)) { - $plugin = new $pclass($link); - $rv['content'] .= $plugin->render($id, $line); - } + foreach ($pluginhost->get_hooks($pluginhost::HOOK_ARTICLE_BUTTON) as $p) { + $rv['content'] .= $p->hook_article_button($line); } $rv['content'] .= "load(PLUGINS); + return true; } else { print "Unable to connect to database:" . db_last_error(); -- cgit v1.2.3-54-g00ecf