/**
 *  Main function to register all of the plugin settings
 *
 * @since 2.0.0
 */
function gce_register_settings()
{
    $gce_settings = array('general' => array('api_key' => array('id' => 'api_key', 'name' => __('Google API Key', 'gce'), 'desc' => __('If left blank all displayed Google calendars will use a public Google API key shared across all plugin users.', 'gce') . ' ' . __('Currently the shared key is limited to 500,000 requests per day and 5 requests per second.', 'gce') . '<br/>' . sprintf(__('To avoid these limits <a href="%s" target="_blank">click here for instructions on how to generate and use your own Google API key.</a>', 'gce'), gce_ga_campaign_url('http://wpdocs.philderksen.com/google-calendar-events/getting-started/api-key-settings/', 'gce_lite', 'settings_link', 'docs')), 'size' => 'regular-text', 'type' => 'text'), 'always_enqueue' => array('id' => 'always_enqueue', 'name' => __('Always Enqueue Scripts & Styles', 'gce'), 'desc' => __('Enqueue this plugin\'s scripts and styles on every post and page.', 'gce') . '<br/>' . '<p class="description">' . __('Useful if using shortcodes in widgets or other non-standard locations.', 'gce') . '</p>', 'type' => 'checkbox'), 'disable_css' => array('id' => 'disable_css', 'name' => __('Disable Plugin CSS', 'gce'), 'desc' => __("If this option is checked, this plugin's CSS file will not be referenced.", 'gce'), 'type' => 'checkbox'), 'save_settings' => array('id' => 'save_settings', 'name' => __('Save Settings', 'gce'), 'desc' => __('Save your settings when uninstalling this plugin.', 'gce') . '<br/>' . '<p class="description">' . __('Useful when upgrading or re-installing.', 'gce') . '</p>', 'type' => 'checkbox')));
    /* If the options do not exist then create them for each section */
    if (false == get_option('gce_settings_general')) {
        add_option('gce_settings_general');
    }
    /* Add the General Settings section */
    add_settings_section('gce_settings_general', __('General Settings', 'gce'), '__return_false', 'gce_settings_general');
    foreach ($gce_settings['general'] as $option) {
        add_settings_field('gce_settings_general[' . $option['id'] . ']', $option['name'], function_exists('gce_' . $option['type'] . '_callback') ? 'gce_' . $option['type'] . '_callback' : 'gce_missing_callback', 'gce_settings_general', 'gce_settings_general', gce_get_settings_field_args($option, 'general'));
    }
    /* Register all settings or we will get an error when trying to save */
    register_setting('gce_settings_general', 'gce_settings_general', 'gce_settings_sanitize');
}
/**
 *  Main function to register all of the plugin settings
 *
 * @since 2.0.0
 */
function gce_register_settings()
{
    $gce_settings = array('general' => array('save_settings' => array('id' => 'save_settings', 'name' => __('Save Settings', 'gce'), 'desc' => __('Save your settings when uninstalling this plugin. Useful when upgrading or re-installing.', 'gce'), 'type' => 'checkbox')));
    /* If the options do not exist then create them for each section */
    if (false == get_option('gce_settings_general')) {
        add_option('gce_settings_general');
    }
    /* Add the General Settings section */
    add_settings_section('gce_settings_general', __('General Settings', 'gce'), '__return_false', 'gce_settings_general');
    foreach ($gce_settings['general'] as $option) {
        add_settings_field('gce_settings_general[' . $option['id'] . ']', $option['name'], function_exists('gce_' . $option['type'] . '_callback') ? 'gce_' . $option['type'] . '_callback' : 'gce_missing_callback', 'gce_settings_general', 'gce_settings_general', gce_get_settings_field_args($option, 'general'));
    }
    /* Register all settings or we will get an error when trying to save */
    register_setting('gce_settings_general', 'gce_settings_general', 'gce_settings_sanitize');
}