diff options
author | friendica <info@friendica.com> | 2012-09-02 01:59:11 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2012-09-02 01:59:11 -0700 |
commit | 38344798f23c12db2409fb91d5e2aaf6c492c6f5 (patch) | |
tree | 122174b9aa3f975c76998a3afc3101c961799309 /include/plugin.php | |
parent | 4736fa5927b35ebd0b2fc337e9f4a3d1e1e0af0d (diff) | |
download | volse-hubzilla-38344798f23c12db2409fb91d5e2aaf6c492c6f5.tar.gz volse-hubzilla-38344798f23c12db2409fb91d5e2aaf6c492c6f5.tar.bz2 volse-hubzilla-38344798f23c12db2409fb91d5e2aaf6c492c6f5.zip |
rev update
Diffstat (limited to 'include/plugin.php')
-rw-r--r-- | include/plugin.php | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/include/plugin.php b/include/plugin.php index 7202ccaa9..c6d62f36e 100644 --- a/include/plugin.php +++ b/include/plugin.php @@ -8,7 +8,10 @@ function uninstall_plugin($plugin){ q("DELETE FROM `addon` WHERE `name` = '%s' ", dbesc($plugin) ); - + + // define THISPLUGIN, make life easy to plugin devs :-) + define("THISPLUGIN", 'addon/' . $plugin . '/' . $plugin . '.php'); + @include_once('addon/' . $plugin . '/' . $plugin . '.php'); if(function_exists($plugin . '_uninstall')) { $func = $plugin . '_uninstall'; @@ -18,9 +21,11 @@ function uninstall_plugin($plugin){ if (! function_exists('install_plugin')){ function install_plugin($plugin) { - // silently fail if plugin was removed + // define THISPLUGIN, make life easy to plugin devs :-) + define("THISPLUGIN", 'addon/' . $plugin . '/' . $plugin . '.php'); + if(! file_exists('addon/' . $plugin . '/' . $plugin . '.php')) return false; logger("Addons: installing " . $plugin); @@ -77,7 +82,10 @@ function reload_plugins() { $pl = trim($pl); $fname = 'addon/' . $pl . '/' . $pl . '.php'; - + + // define THISPLUGIN, make life easy to plugin devs :-) + define("THISPLUGIN", $fname); + if(file_exists($fname)) { $t = @filemtime($fname); foreach($installed as $i) { @@ -163,6 +171,8 @@ function call_hooks($name, &$data = null) { if((is_array($a->hooks)) && (array_key_exists($name,$a->hooks))) { foreach($a->hooks[$name] as $hook) { + // define THISPLUGIN, make life easy to plugin devs :-) + define("THISPLUGIN", $hook[0]); @include_once($hook[0]); if(function_exists($hook[1])) { $func = $hook[1]; |