get_plugin_version("{$slug}/bootstrap.php"); $has_update = $this->has_plugin_update("{$slug}/bootstrap.php", $version); return array( 'title' => 'Advanced Access Manager - Premium Add-On', 'version' => $version, 'hasUpdate' => $has_update, 'license' => $this->get_premium_license_key($slug), 'description' => __('The complete list of all premium features in one package. All the future features will be available for download for no additional cost as long as the subscription stays active.', 'advanced-access-manager'), 'url' => 'https://aamportal.com/premium?ref=plugin' ); } /** * Get list of all registered licenses * * @return string|null * @access public * * @version 7.0.0 */ public function get_premium_license_key() { $result = null; // New way to handle the licensing if (defined('AAM_COMPLETE_PACKAGE_LICENSE')) { $result = AAM_COMPLETE_PACKAGE_LICENSE; } return $result; } /** * Check if plugin has new version available * * @param string $id * @param string $current_version * * @return boolean * @access protected * * @version 7.0.0 */ protected function has_plugin_update($id, $current_version) { $has_update = false; $plugins = get_site_transient('update_plugins'); if (isset($plugins->response) && is_array($plugins->response)) { $has_update = array_key_exists($id, $plugins->response); } // Also check if current version lower than known if ($has_update === false && !empty($current_version)) { $has_update = version_compare( $current_version, self::LATEST_PREMIUM_VERSION ) === -1; } return $has_update; } /** * Get plugin version * * @param string $plugin * * @return string|null * @access protected * * @version 7.0.0 */ protected function get_plugin_version($plugin) { $data = $this->get_plugin_data($plugin); $version = (isset($data['Version']) ? $data['Version'] : null); return (!empty($version) ? $version : null); } /** * Get plugin details from the WP core * * @param string $plugin * * @return array|null * @access protected * * @version 7.0.0 */ protected function get_plugin_data($plugin) { $filename = WP_PLUGIN_DIR . '/' . $plugin; if (function_exists('get_plugin_data') && file_exists($filename)) { $data = get_plugin_data($filename); } else { $data = null; } return $data; } /** * Bootstrap the object * * @return AAM_Addon_Repository * @access public * * @version 7.0.0 */ public static function bootstrap() { if (is_null(self::$_instance)) { self::$_instance = new self; } return self::$_instance; } /** * Get single instance of itself * * @return AAM_Addon_Repository * @access public * * @version 7.0.0 */ public static function get_instance() { return self::bootstrap(); } }