$license_data ) { $license_details = $license_data['licenseDetails']; $is_expired = ( 'expired' === $license_data['licenseStatus'] ) ? true : false; if ( ! empty( $license_details ) ) { $is_expired = self::license_expired_check( $license_details['expire'] ); } if ( $is_expired ) { $license_list[$license_key]['licenseStatus'] = 'expired'; } } } self::set_license_data( 'license-list', $license_list ); } /** * [get_plugin_license_key description] * @param boolean $setting [description] * @param boolean $value [description] * @return [type] [description] */ public static function get_plugin_license_key( $plugin_slug ) { $license_list = self::get_license_data( 'license-list', [] ); $plugin_license_key = false; if ( ! empty( $license_list ) ) { foreach ( $license_list as $license_key => $license_data ) { if ( 'expired' === $license_data['licenseStatus'] ) { continue; } $license_details = $license_data['licenseDetails']; if ( empty( $license_details ) ) { continue; } $is_expired = self::license_expired_check( $license_details['expire'] ); if ( $is_expired ) { $license_list[$license_key]['licenseStatus'] = 'expired'; continue; } $license_plugins = $license_details['plugins']; if ( array_key_exists( $plugin_slug, $license_plugins ) ) { $plugin_license_key = $license_key; break; } } } if ( $plugin_license_key ) { return $plugin_license_key; } return false; } /** * [package_url description] * @param [type] $key [description] * @return [type] [description] */ public static function package_url( $plugin_slug = false ) { $license_key = self::get_plugin_license_key( $plugin_slug ); if ( ! $license_key ) { return false; } return add_query_arg( array( 'action' => 'get_plugin_update', 'license' => self::get_plugin_license_key( $plugin_slug ), 'plugin' => $plugin_slug, 'site_url' => urlencode( self::get_site_url() ), ), self::get_api_url() ); } /** * [if_license_expire_check description] * @param boolean $expire_date [description] * @return [type] [description] */ public static function license_expired_check( $expire_date = false ) { if ( '0000-00-00 00:00:00' === $expire_date || 'lifetime' === $expire_date ) { return false; } $current_time = time( 'Y-m-d H:i:s' ); $expire_time = strtotime( $expire_date ); if ( $current_time > $expire_time ) { return true; } return false; } }