Esempio n. 1
0
 public function activateLicense($param)
 {
     global $guiform;
     // data to send in our API request
     $api_params = array('edd_action' => 'activate_license', 'license' => $param['license'], 'sslverify' => false, 'item_name' => urlencode($param['name']), 'url' => urlencode(home_url()));
     // Call the custom API.
     $response = wp_safe_remote_post(GuiForm_Plugin::SERVER, array('timeout' => 90, 'sslverify' => false, 'body' => $api_params));
     // make sure the response came back okay
     if (is_wp_error($response)) {
         return false;
     }
     $data = json_decode(wp_remote_retrieve_body($response));
     $data->expires = date('F d, Y', strtotime($data->expires));
     if ($data->license == 'valid') {
         $guiform->updateOption('license_status_' . $param['package'], $data->license, 'settings');
         $guiform->updateOption('license_key_' . $param['package'], $param['license'], 'settings');
         $guiform->updateOption('license_expires_' . $param['package'], $data->expires, 'settings');
         $output = GuiForm_Module_License::api();
     }
     return $data;
 }
Esempio n. 2
0
 /**
  * Deactivate license.
  *
  * @since 1.0
  * @access public
  */
 public function deactivateLicense()
 {
     $param = call_user_func('esc_sql', $_POST);
     self::_sendResponse(GuiForm_Module_License::deactivateLicense($param));
     die;
 }