1, 'message'=>'Trial version is activated !' ); echo json_encode( $response ); die(); } /* * Function: abr_premium_version_activation * * Description: Activates PREMIUM Version of plugin and sends notification emails to both user as * well as plugin administration */ function abr_premium_version_activation($key,$domain){ $url ='https://whiteirondata.com/master/wp-admin/admin-ajax.php?action=activation_ajax&key='.$key.'&domain='.$domain; $request = wp_remote_get($url); $response = wp_remote_retrieve_body($request); $obj = json_decode($response,true); $response = $obj['response']; $key_status= $obj['key_status']; if($response==1) { // if response is ==1 if($key_status==0){ ## if key_status ==0 update_option('abtrv',1); // trial Version activate $response = array( 'response'=>0, 'message'=>'Your Premium pack is Disabled. Please contact with plugin administration ' ); } else{ $start_date = $obj['start_date']; // Package starting date just after publish/update post $newdate = strtotime ( '30 day' , strtotime ( $start_date ) ) ; $end_date = date ( 'Y-m-d' , $newdate ); update_option('abr_key',$key); // save key update_option('abr_domain',$domain); // save Domain update_option('abtrs_date',$start_date);// start_date update_option('abtre_date',$end_date);// end_date if(get_option('abtrv')){ update_option('abtrv',2); }else { add_option('abtrv',2); } /** Send notification mail to user and plugin support**/ abr_mail_to_plugin_support(); abr_send_mail_to_user(); $response = array( 'response'=>1, 'message'=>'Premium version is activated !' ); } } if($response==0) { $response = array( 'response'=>0, 'message'=>'Key Does not match Please try again !' ); } echo json_encode( $response ); die(); } /** * Mail to Plugin Support * @param */ function abr_mail_to_plugin_support(){ $user_info = get_userdata(get_current_user_id()); $user_email = $user_info->user_email; $display_name = $user_info->display_name; $to = 'info@whiteirondata.com'; //Plugin administration eamil $subject = 'New Subscription'; $body = '
Congratulations! '.$display_name.' has Successfuly activated About Rentals Plugin.
User Email: '. $user_email.'
User Website: '.get_site_url().'
Congratulations! you have successfuly activated About Rentals
For any further query please visit at: https://whiteirondata.com
'; $headers = array('Content-Type: text/html; charset=UTF-8','From: About Rentals: