Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Support for old curl versions
- add_action('http_api_curl', 'curl_settings', 10, 3);
- function curl_settings( &$cr, $request, $url ) {
- if(wp_fusion()->settings->get('override_curl') != true || $url != WPF_STORE_URL)
- return;
- curl_setopt($cr, CURLOPT_SSLVERSION, 1);
- }
- // Ajax activate
- function edd_activate($retry = false) {
- $license_key = trim($_POST['key']);
- // data to send in our API request
- $api_params = array(
- 'edd_action'=> 'activate_license',
- 'license' => $license_key,
- 'item_name' => urlencode( 'WP Fusion' ), // the name of our product in EDD
- 'url' => home_url()
- );
- // Call the custom API.
- $response = wp_remote_post( WPF_STORE_URL, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
- // make sure the response came back okay
- if ( is_wp_error( $response ) ) {
- if($response->get_error_code() == 'http_request_failed' && $retry == false) {
- wp_fusion()->settings->set('override_curl', true);
- edd_activate(true);
- } else {
- wp_send_json_error( $response->get_error_message() );
- die();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement