From 2a3a171ba0f5059ca3e0e2ac62e6412e50cd6f76 Mon Sep 17 00:00:00 2001 From: paulr Date: Fri, 4 Nov 2011 16:54:18 +1100 Subject: [PATCH] implemented a plugin loader so i can add things like http://www.phpcaptcha.org/ without having to carry their code in my repo. hopefully should be quite simple --- gwvplib/gwvplib.php | 2 ++ gwvplib/gwvppluginloader.php | 32 ++++++++++++++++++++++++++++++++ gwvplib/plugins/test_plugin.php | 7 +++++++ www/index.php | 2 ++ 4 files changed, 43 insertions(+), 0 deletions(-) create mode 100644 gwvplib/gwvppluginloader.php create mode 100644 gwvplib/plugins/test_plugin.php diff --git a/gwvplib/gwvplib.php b/gwvplib/gwvplib.php index e0654bc..d24ec5c 100644 --- a/gwvplib/gwvplib.php +++ b/gwvplib/gwvplib.php @@ -1,5 +1,6 @@ 0) { + error_log("loading plugin $file"); + require_once("$path/$file"); + //echo "required $basedir/$file\n"; + } + } + } + } +} + +// we assume the config is loaded, but this is where it works: +error_log("begin plugin load"); +if(isset($plugin_path)) { + error_log("path set"); + if(is_dir($plugin_path)) { + error_log("is dir, beginning load"); + gwvp_PluginLoader($plugin_path); + } +} + +?> \ No newline at end of file diff --git a/gwvplib/plugins/test_plugin.php b/gwvplib/plugins/test_plugin.php new file mode 100644 index 0000000..8257f04 --- /dev/null +++ b/gwvplib/plugins/test_plugin.php @@ -0,0 +1,7 @@ + \ No newline at end of file diff --git a/www/index.php b/www/index.php index 1bc6bc7..792b52a 100644 --- a/www/index.php +++ b/www/index.php @@ -30,8 +30,10 @@ require_once("gwvplib.php"); gwvp_goWebBegin(); //goWebGitBackEnd(); + if(function_exists("gwvp_DebugEnabled")) { gwvp_DebugEnabled(); } + ?> -- 1.7.0.4