' . ' - NOTE: A NEW VERSION OF THIS PLUGIN IS AVAILABLE. [Details]' . ''; * } * } */ function plugin_version_check_for_updates($plugin_file_id = 0, $version_string_to_compare = '', $strict_zc_version_compare = false) { // for v1.5.6 and newer if ($plugin_file_id === 0) return false; $versionServer = new VersionServer(); $data = json_decode($versionServer->getPluginVersion($plugin_file_id), true); if (null === $data || isset($data['error'])) { trigger_error('CURL error checking plugin versions: ' . $data['error']); return false; } if (!is_array($data)) $data = json_decode($data, true); if (strcmp($data[0]['latest_plugin_version'], $version_string_to_compare) > 0) $new_version_available = true; // check whether present ZC version is compatible with the latest available plugin version $zc_version = PROJECT_VERSION_MAJOR . '.' . preg_replace('/[^0-9.]/', '', PROJECT_VERSION_MINOR); if ($strict_zc_version_compare) $zc_version = PROJECT_VERSION_MAJOR . '.' . PROJECT_VERSION_MINOR; if (!in_array('v' . $zc_version, $data[0]['zcversions'], false)) $new_version_available = false; return ($new_version_available) ? $data[0] : false; }