5, ]; return wp_remote_get( $test_url, $args ); } /** * Check LP beta version from remote config. * * @return bool|array */ public static function check_lp_beta_version() { $url = 'https://learnpress.github.io/learnpress/lp-beta-version.json'; $config = new stdClass(); try { $res = wp_remote_get( $url ); if ( is_wp_error( $res ) ) { throw new Exception( $res->get_error_message() ); } $config = LP_Helper::json_decode( wp_remote_retrieve_body( $res ) ); $version = $config->version ?? 0; if ( ! $version ) { throw new Exception( 'Version LP beta is invalid!' ); } if ( ! version_compare( $version, LEARNPRESS_VERSION, '>' ) ) { return false; } } catch ( Throwable $e ) { LP_Debug::error_log( $e ); } return $config; } }