diff options
Diffstat (limited to 'include/plugin.php')
-rwxr-xr-x | include/plugin.php | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/include/plugin.php b/include/plugin.php index 4da73dfd8..ccd88d963 100755 --- a/include/plugin.php +++ b/include/plugin.php @@ -348,19 +348,46 @@ function get_plugin_info($plugin){ } else { $info[$k][] = array('name' => $v); } - } else { -// if (array_key_exists($k, $info)){ - $info[$k] = $v; -// } + } + else { + $info[$k] = $v; } } } } - return $info; } +function check_plugin_versions($info) { + + if(! is_array($info)) + return true; + + if(array_key_exists('minversion',$info)) { + if(version_compare(trim($info['minversion']),STD_VERSION, '<')) { + logger('minversion limit: ' . $info['name'],LOGGER_NORMAL,LOG_WARNING); + return false; + } + } + if(array_key_exists('maxversion',$info)) { + if(version_compare(trim($info['maxversion']),STD_VERSION, '>')) { + logger('maxversion limit: ' . $info['name'],LOGGER_NORMAL,LOG_WARNING); + return false; + } + } + if(array_key_exists('minphpversion',$info)) { + if(version_compare(trim($info['minphpversion']),PHP_VERSION, '<')) { + logger('minphpversion limit: ' . $info['name'],LOGGER_NORMAL,LOG_WARNING); + return false; + } + } + + return true; +} + + + /** * @brief Parse theme comment in search of theme infos. |