function mycred_remote_save_settings($new_data, $post, $mycred_general)
{
    $current = mycred_get_remote();
    $new_remote = array();
    // Enabled
    if (isset($post['allow_remote'])) {
        $new_remote['enabled'] = 1;
        if (isset($post['remote']['key'])) {
            $new_remote['key'] = sanitize_text_field($post['remote']['key']);
        } else {
            $new_remote['key'] = $current['key'];
        }
        if (isset($post['remote']['uri'])) {
            $new_remote['uri'] = sanitize_text_field($post['remote']['uri']);
        } else {
            $new_remote['uri'] = $current['uri'];
        }
        if (isset($post['remote']['debug'])) {
            $new_remote['debug'] = 1;
        } else {
            $new_remote['debug'] = 0;
        }
        // Let others play
        $new_remote = apply_filters('mycred_remote_save_prefs', $new_remote, $current, $post, $mycred_general);
    } else {
        $new_remote['enabled'] = 0;
        $new_remote['key'] = $current['key'];
        $new_remote['uri'] = $current['uri'];
        $new_remote['debug'] = $current['debug'];
    }
    update_option('mycred_pref_remote', $new_remote);
    return $new_data;
}
 /**
  * Settings Header
  * Inserts the export styling
  * @since 1.3
  * @version 1.1
  */
 public function settings_header()
 {
     global $wp_filter;
     // Allows to link to the settings page with a defined module to be opened
     // in the accordion. Request must be made under the "open-tab" key and should
     // be the module name in lowercase with the myCRED_ removed.
     $this->accordion_tabs = array('core' => 0, 'management' => 1, 'point-types' => 2);
     // Check if there are registered action hooks for mycred_after_core_prefs
     if (isset($wp_filter['mycred_after_core_prefs'])) {
         $count = count($this->accordion_tabs);
         // If remove access is enabled
         $settings = mycred_get_remote();
         if ($settings['enabled']) {
             $this->accordion_tabs['remote'] = $count++;
         }
         foreach ($wp_filter['mycred_after_core_prefs'] as $priority) {
             foreach ($priority as $key => $data) {
                 if (!isset($data['function'])) {
                     continue;
                 }
                 if (!is_array($data['function'])) {
                     $this->accordion_tabs[$data['function']] = $count++;
                 } else {
                     foreach ($data['function'] as $id => $object) {
                         if (isset($object->module_id)) {
                             $module_id = str_replace('myCRED_', '', $object->module_id);
                             $module_id = strtolower($module_id);
                             $this->accordion_tabs[$module_id] = $count++;
                         }
                     }
                 }
             }
         }
     }
     // If the requested tab exists, localize the accordion script to open this tab.
     // For this to work, the variable "active" must be set to the position of the
     // tab starting with zero for "Core".
     if (isset($_REQUEST['open-tab']) && array_key_exists($_REQUEST['open-tab'], $this->accordion_tabs)) {
         wp_localize_script('mycred-admin', 'myCRED', array('active' => $this->accordion_tabs[$_REQUEST['open-tab']]));
     }
     wp_enqueue_script('mycred-manage');
     wp_enqueue_style('mycred-inline-edit');
 }