You are here

public static function ShareaholicUtilities::reset_settings in Share Buttons, Related Posts, Content Analytics - Shareaholic 7.3

Same name and namespace in other branches
  1. 8 utilities.php \ShareaholicUtilities::reset_settings()

Restore the plugin settings

1 call to ShareaholicUtilities::reset_settings()
shareaholic_reset_plugin_form_submit in includes/shareaholic_reset_plugin_form.php
The submit handler for the reset plugin form When the user resets the plugin, destroy settings and get a new api key

File

./utilities.php, line 384

Class

ShareaholicUtilities

Code

public static function reset_settings() {
  $settings = self::get_settings();
  $api_key = self::get_option('api_key');
  $response = drupal_http_request(self::API_URL . '/publisher_tools/' . $api_key . '/reset/', array(
    'method' => 'POST',
    'headers' => array(
      'Content-Type' => 'application/json',
    ),
    'data' => json_encode($settings),
  ));

  // set the location on/off back to their defaults
  if (isset($settings['location_name_ids']) && is_array($settings['location_name_ids'])) {
    self::set_default_location_settings($settings['location_name_ids']);
  }
}