aboutsummaryrefslogtreecommitdiffstats
path: root/include/plugin.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/plugin.php')
-rwxr-xr-xinclude/plugin.php36
1 files changed, 21 insertions, 15 deletions
diff --git a/include/plugin.php b/include/plugin.php
index 2bc363556..bd844442f 100755
--- a/include/plugin.php
+++ b/include/plugin.php
@@ -291,7 +291,7 @@ function call_hooks($name, &$data = null) {
$func = $hook[1];
$func($a, $data);
} else {
- // remove orphan hooks
+
q("DELETE FROM hook WHERE hook = '%s' AND file = '%s' AND function = '%s'",
dbesc($name),
dbesc($hook[0]),
@@ -325,7 +325,8 @@ function get_plugin_info($plugin){
'description' => '',
'author' => array(),
'maintainer' => array(),
- 'version' => ''
+ 'version' => '',
+ 'requires' => ''
);
if (!is_file("addon/$plugin/$plugin.php"))
@@ -365,7 +366,7 @@ function check_plugin_versions($info) {
return true;
if(array_key_exists('minversion',$info)) {
- if(version_compare(trim($info['minversion']),STD_VERSION, '>=')) {
+ if(! version_compare(STD_VERSION,trim($info['minversion']), '>=')) {
logger('minversion limit: ' . $info['name'],LOGGER_NORMAL,LOG_WARNING);
return false;
}
@@ -377,12 +378,28 @@ function check_plugin_versions($info) {
}
}
if(array_key_exists('minphpversion',$info)) {
- if(version_compare(trim($info['minphpversion']),PHP_VERSION, '>=')) {
+ if(! version_compare(PHP_VERSION,trim($info['minphpversion']), '>=')) {
logger('minphpversion limit: ' . $info['name'],LOGGER_NORMAL,LOG_WARNING);
return false;
}
}
+ if(array_key_exists('requires',$info)) {
+ $arr = explode(',',$info['requires']);
+ $found = true;
+ if($arr) {
+ foreach($arr as $test) {
+ $test = trim($test);
+ if(! $test)
+ continue;
+ if(! in_array($test,get_app()->plugins))
+ $found = false;
+ }
+ }
+ if(! $found)
+ return false;
+ }
+
return true;
}
@@ -653,17 +670,6 @@ function get_markup_template($s, $root = '') {
return $template;
}
-// return the standardised version. Since we can't easily compare
-// before the STD_VERSION definition was applied, we have to treat
-// all prior release versions the same. You can dig through them
-// with other means (such as RED_VERSION) if necessary.
-
-function get_std_version() {
- if(defined('STD_VERSION'))
- return STD_VERSION;
- return '0.0.0';
-}
-
function folder_exists($folder)
{