We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Newest EDD sample plugin uses this after the request is made. It includes more elaborated status messages, as well as a non 200 response handler.
// make sure the response came back okay if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) { if ( is_wp_error( $response ) ) { $message = $response->get_error_message(); } else { $message = __( 'An error occurred, please try again.' ); } } else { $license_data = json_decode( wp_remote_retrieve_body( $response ) ); if ( false === $license_data->success ) { switch ( $license_data->error ) { case 'expired': $message = sprintf( /* translators: the license key expiration date */ __( 'Your license key expired on %s.', 'edd-sample-plugin' ), date_i18n( get_option( 'date_format' ), strtotime( $license_data->expires, current_time( 'timestamp' ) ) ) ); break; case 'disabled': case 'revoked': $message = __( 'Your license key has been disabled.', 'edd-sample-plugin' ); break; case 'missing': $message = __( 'Invalid license.', 'edd-sample-plugin' ); break; case 'invalid': case 'site_inactive': $message = __( 'Your license is not active for this URL.', 'edd-sample-plugin' ); break; case 'item_name_mismatch': /* translators: the plugin name */ $message = sprintf( __( 'This appears to be an invalid license key for %s.', 'edd-sample-plugin' ), EDD_SAMPLE_ITEM_NAME ); break; case 'no_activations_left': $message = __( 'Your license key has reached its activation limit.', 'edd-sample-plugin' ); break; default: $message = __( 'An error occurred, please try again.', 'edd-sample-plugin' ); break; } } }
The text was updated successfully, but these errors were encountered:
danieliser
No branches or pull requests
Newest EDD sample plugin uses this after the request is made. It includes more elaborated status messages, as well as a non 200 response handler.
The text was updated successfully, but these errors were encountered: