From 6b6bcf00bf1b479ae273bad612b12a6f2da4bf42 Mon Sep 17 00:00:00 2001 From: pdontthink Date: Tue, 19 Sep 2006 17:19:29 +0000 Subject: [PATCH] Enabling use of _info() function git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@11725 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/plugin.php | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/functions/plugin.php b/functions/plugin.php index 5576ab4d..4401a06f 100644 --- a/functions/plugin.php +++ b/functions/plugin.php @@ -260,21 +260,33 @@ function check_plugin_version($plugin_name, $force_inclusion = FALSE) { + $info_function = $plugin_name . '_info'; $version_function = $plugin_name . '_version'; + $plugin_info = array(); $plugin_version = FALSE; - // attempt to find version function and get version from plugin + // first attempt to find the plugin info function, wherein + // the plugin version should be available // - if (function_exists($version_function)) - $plugin_version = $version_function(); + if (function_exists($info_function)) + $plugin_info = $info_function(); else if ($force_inclusion && file_exists(SM_PATH . 'plugins/' . $plugin_name . '/setup.php')) { include_once(SM_PATH . 'plugins/' . $plugin_name . '/setup.php'); - if (function_exists($version_function)) - $plugin_version = $version_function(); + if (function_exists($info_function)) + $plugin_info = $info_function(); } + if (!empty($plugin_info['version'])) + $plugin_version = $plugin_info['version']; + + + // otherwise, look for older version function + // + if (!$plugin_version && function_exists($version_function)) + $plugin_version = $version_function(); + if (!$plugin_version) return FALSE; -- 2.25.1