Beispiel #1
0
function ts_fab_shortcode($atts)
{
    extract(shortcode_atts(array('authorid' => '', 'tabs' => '', 'avatar' => ''), $atts));
    if ($authorid) {
        $authorid = absint($authorid);
    } else {
        return;
    }
    // List of allowed tabs
    $default_tabs = ts_fab_default_tabs();
    // default tabs
    $additional_tabs = array_keys(ts_fab_additional_tabs());
    // additional tabs
    $allowed_tabs = array_merge($default_tabs, $additional_tabs);
    // all tabs
    if ($tabs) {
        $selected_tabs = explode(',', $tabs);
        foreach ($selected_tabs as $selected_tab) {
            // Remove empty spaces
            $selected_tab = str_replace(' ', '', $selected_tab);
            // If tab name is one of allowed tab names, add it to $show_tabs array
            if (in_array($selected_tab, $allowed_tabs)) {
                $show_tabs[] = $selected_tab;
            }
        }
    }
    // Check if photo needs to be above text
    if ('above' == $avatar) {
        $float_attr = 'above';
    } else {
        $float_attr = 'floated';
    }
    // If no tabs are passed, use the ones set in Tabs Settings in plugin settings page
    if (!isset($show_tabs)) {
        $show_tabs = array_keys(ts_fab_get_tabs_settings(), 1);
    }
    $a = rand(100, 999);
    $b = rand(100, 999);
    $c = rand(100, 999);
    return ts_fab_construct_fab('shortcode-' . $a . '-' . $b . '-' . $c, $authorid, $show_tabs, $float_attr);
}
/**
 * Construct Fanciest Author Box
 * Used as helper function, to generate Fanciest Author Box before or after posts, as shortcode, widget or template tag
 *
 * @since 1.0
 */
function ts_fab_construct_fab($context = '', $authorid = '', $show_tabs = array('bio', 'twitter', 'facebook', 'googleplus', 'linkedin', 'latest_posts', 'custom'))
{
    if ($authorid == '') {
        global $authordata;
        $author = $authordata;
    } else {
        $author = get_userdata($authorid);
    }
    $options = ts_fab_get_tabs_settings();
    $display_options = ts_fab_get_display_settings();
    if (isset($display_options['tabs_style']) && $display_options['tabs_style'] == 'icons') {
        $tabs_class = 'ts-fab-icons-only';
    } else {
        $tabs_class = 'ts-fab-icons-text';
    }
    // Set custom tab title, based on whether users can override it
    if (isset($options['custom_tab_override']) && $options['custom_tab_override'] == 1) {
        if (get_user_meta($author->ID, 'ts_fab_custom_tab_title', true)) {
            $custom_title = get_user_meta($author->ID, 'ts_fab_custom_tab_title', true);
        } elseif ($options['custom_tab_title'] != '') {
            $custom_title = $options['custom_tab_title'];
        }
    } elseif (isset($options['custom_tab_title'])) {
        $custom_title = $options['custom_tab_title'];
    }
    $ts_fab = '<!-- Fanciest Author Box v' . FAB_VERSION . ' -->';
    $ts_fab .= '<div id="ts-fab-' . $context . '" class="ts-fab-wrapper ' . $tabs_class . '">';
    // Do not show tabs list if there's only one tab
    if (count($show_tabs) > 1) {
        // Construct tabs list
        $ts_fab .= '<ul class="ts-fab-list">';
        foreach ($show_tabs as $show_tab) {
            // Check if it's a default tab
            if (in_array($show_tab, ts_fab_default_tabs())) {
                switch ($show_tab) {
                    case 'bio':
                        $ts_fab .= '<li class="ts-fab-bio-link"><a href="#ts-fab-bio-' . $context . '">' . __('Bio', 'ts-fab') . '</a></li>';
                        break;
                    case 'twitter':
                        // Check if Twitter tab needs to be shown and user has entered Twitter details
                        if (in_array('twitter', $show_tabs) && get_user_meta($author->ID, 'ts_fab_twitter', true)) {
                            $ts_fab .= '<li class="ts-fab-twitter-link"><a href="#ts-fab-twitter-' . $context . '">Twitter</a></li>';
                        }
                        break;
                    case 'googleplus':
                        // Check if Google+ tab needs to be shown and user has entered Google+ details
                        if (in_array('googleplus', $show_tabs) && get_user_meta($author->ID, 'ts_fab_googleplus', true)) {
                            add_action('wp_print_footer_scripts', 'ts_fab_googleplus_head');
                            $ts_fab .= '<li class="ts-fab-googleplus-link"><a href="#ts-fab-googleplus-' . $context . '">Google+</a></li>';
                        }
                        break;
                    case 'facebook':
                        // Check if Facebook tab needs to be shown and user has entered Facebook details
                        if (in_array('facebook', $show_tabs) && get_user_meta($author->ID, 'ts_fab_facebook', true)) {
                            $ts_fab .= '<li class="ts-fab-facebook-link"><a href="#ts-fab-facebook-' . $context . '">Facebook</a></li>';
                        }
                        break;
                    case 'linkedin':
                        // Check if LinkedIn tab needs to be shown and user has entered LinkedIn details
                        if (in_array('linkedin', $show_tabs) && get_user_meta($author->ID, 'ts_fab_linkedin', true)) {
                            $ts_fab .= '<li class="ts-fab-linkedin-link"><a href="#ts-fab-linkedin-' . $context . '">LinkedIn</a></li>';
                        }
                        break;
                    case 'latest_posts':
                        $ts_fab .= '<li class="ts-fab-latest-posts-link"><a href="#ts-fab-latest-posts-' . $context . '">' . __('Latest Posts', 'ts-fab') . '</a></li>';
                        break;
                    case 'custom':
                        if ($options['custom'] == 1) {
                            if (in_array('custom', $show_tabs)) {
                                if (isset($custom_title)) {
                                    $ts_fab .= '<li class="ts-fab-custom-link"><a href="#ts-fab-custom-' . $context . '">' . strip_tags(stripslashes($custom_title)) . '</a></li>';
                                }
                            }
                        }
                        break;
                }
                // end switch
                // else it's an additional tab
            } else {
                // Tabs added by themes or other plugins
                $additional_tabs = ts_fab_additional_tabs();
                // Check if there are any additional tabs
                if (!empty($additional_tabs)) {
                    foreach ($additional_tabs as $additional_tab_key => $additional_tab_value) {
                        // Check if checkbox for this tab is checked
                        if (isset($options[$additional_tab_key]) && $show_tab == $additional_tab_key) {
                            // Check tab conditional function to determine whether tab should be shown for this user
                            if (isset($additional_tab_value['conditional_callback'])) {
                                // Sets a flag based on what conditional function returns
                                $conditional_function_output = $additional_tab_value['conditional_callback']($author->ID);
                            }
                            // end conditional function check
                            // Show tab if conditional function doesn't return false
                            if (isset($conditional_function_output) && !$conditional_function_output == false) {
                                $ts_fab .= '<li class="ts-fab-' . $additional_tab_key . '-link ts-fab-additional-link"><a href="#ts-fab-' . $additional_tab_key . '-' . $context . '">' . strip_tags(stripslashes($additional_tab_value['name'])) . '</a></li>';
                            }
                            // End conditional flag check
                        }
                        // end check if option is checked
                    }
                    // end foreach
                }
                // end if
            }
        }
        // end foreach
        $ts_fab .= '</ul>';
    }
    // End if only one tab check
    // Construct individual tabs
    $ts_fab .= '<div class="ts-fab-tabs">';
    foreach ($show_tabs as $show_tab) {
        // Check if it's a default tab
        if (in_array($show_tab, ts_fab_default_tabs())) {
            switch ($show_tab) {
                case 'bio':
                    $ts_fab .= ts_fab_show_bio($context, $author->ID);
                    break;
                case 'twitter':
                    // Check if Twitter tab needs to be shown and user has entered Twitter details
                    if (get_user_meta($author->ID, 'ts_fab_twitter', true)) {
                        $ts_fab .= ts_fab_show_twitter($context, $author->ID);
                    }
                    break;
                case 'facebook':
                    // Check if Facebook tab needs to be shown and user has entered Facebook details
                    if (get_user_meta($author->ID, 'ts_fab_facebook', true)) {
                        $ts_fab .= ts_fab_show_facebook($context, $author->ID);
                    }
                    break;
                case 'googleplus':
                    // Check if Google+ tab needs to be shown and user has entered Google+ details
                    if (get_user_meta($author->ID, 'ts_fab_googleplus', true)) {
                        $ts_fab .= ts_fab_show_googleplus($context, $author->ID);
                    }
                    break;
                case 'linkedin':
                    // Check if LinkedIn tab needs to be shown and user has entered LinkedIn details
                    if (get_user_meta($author->ID, 'ts_fab_linkedin', true)) {
                        $ts_fab .= ts_fab_show_linkedin($context, $author->ID);
                    }
                    break;
                case 'latest_posts':
                    $ts_fab .= ts_fab_show_latest_posts($context, $author->ID);
                    break;
                case 'custom':
                    $ts_fab .= ts_fab_show_custom($context, $author->ID);
                    break;
            }
            // end switch
            // else, it's an additional tab
        } else {
            // Tabs added by themes or other plugins
            $additional_tabs = ts_fab_additional_tabs();
            // Check if there are any additional tabs
            if (!empty($additional_tabs)) {
                foreach ($additional_tabs as $additional_tab_key => $additional_tab_value) {
                    if ($show_tab == $additional_tab_key) {
                        // Check tab conditional function to determine whether tab should be shown for this user
                        if (isset($additional_tab_value['conditional_callback'])) {
                            // Sets a flag based on what conditional function returns
                            $conditional_function_output = $additional_tab_value['conditional_callback']($author->ID);
                        }
                        // end conditional function check
                        // Show tab if conditional function doesn't return false
                        if (isset($conditional_function_output) && !$conditional_function_output == false) {
                            $ts_fab .= '
									<div class="ts-fab-tab ts-fab-additional-tab" id="ts-fab-' . $additional_tab_key . '-' . $context . '">';
                            // Additional tab callback function
                            $ts_fab .= $additional_tab_value['callback']();
                            $ts_fab .= '</div>';
                        }
                        // End conditional flag check
                    }
                }
                // end foreach
            }
            // end if
        }
    }
    // end foreach
    $ts_fab .= '
		</div>
	</div>';
    return $ts_fab;
}
function ts_fab_initialize_plugin_options()
{
    // If the theme options don't exist, create them.
    if (false == get_option('ts_fab_display_settings')) {
        add_option('ts_fab_display_settings');
    }
    if (false == get_option('ts_fab_tabs_settings')) {
        add_option('ts_fab_tabs_settings');
    }
    // Add Display Settings section
    add_settings_section('ts_fab_display_settings_section', __('Display Settings', 'ts-fab'), 'ts_fab_display_settings_callback', 'ts_fab_display_settings');
    // Add Display Settings fields
    add_settings_field('show_in_posts', __('Show in posts', 'ts-fab'), 'ts_fab_show_in_posts_callback', 'ts_fab_display_settings', 'ts_fab_display_settings_section', array(__('Select where to display.', 'ts-fab')));
    add_settings_field('show_in_pages', __('Show in pages', 'ts-fab'), 'ts_fab_show_in_pages_callback', 'ts_fab_display_settings', 'ts_fab_display_settings_section', array(__('Select where to display.', 'ts-fab')));
    // Add a settings field for each public custom post type
    $args = array('public' => true, '_builtin' => false);
    $output = 'names';
    $operator = 'and';
    $custom_post_types = get_post_types($args, $output, $operator);
    foreach ($custom_post_types as $custom_post_type) {
        $custom_post_type_object = get_post_type_object($custom_post_type);
        add_settings_field('show_in_' . $custom_post_type, __('Show in', 'ts-fab') . ' ' . $custom_post_type_object->label, 'ts_fab_show_in_custom_post_type_callback', 'ts_fab_display_settings', 'ts_fab_display_settings_section', array(__('Display Fanciest Author Box in ' . $custom_post_type_object->label . ' custom post type.', 'ts-fab'), $custom_post_type));
    }
    add_settings_field('show_in_feeds', __('Show in feeds', 'ts-fab'), 'ts_fab_show_in_feeds_callback', 'ts_fab_display_settings', 'ts_fab_display_settings_section', array(__('Display simplified author box in RSS feeds', 'ts-fab')));
    add_settings_field('execution_priority', __('Execution priority', 'ts-fab'), 'ts_fab_execution_priority_callback', 'ts_fab_display_settings', 'ts_fab_display_settings_section', array(__('If everything is working fine and Fanciest Author Box is showing in your posts, no need to touch this. If author box is not displaying, try lowering or raising this number.', 'ts-fab')));
    add_settings_field('tabs_style', __('Tabs style', 'ts-fab'), 'ts_fab_tabs_style_callback', 'ts_fab_display_settings', 'ts_fab_display_settings_section', array(__('Show only icons or icons and text in tabs', 'ts-fab')));
    // Add Display Settings section
    add_settings_section('ts_fab_color_settings_section', __('Color Settings', 'ts-fab'), 'ts_fab_color_settings_callback', 'ts_fab_display_settings');
    add_settings_field('inactive_tab', __('Inactive tab colors', 'ts-fab'), 'ts_fab_color_picker_callback', 'ts_fab_display_settings', 'ts_fab_color_settings_section', array('inactive_tab', array('_background' => __('Background', 'ts-fab'), '_border' => __('Border', 'ts-fab'), '_color' => __('Text', 'ts-fab'))));
    add_settings_field('active_tab', __('Active tab colors', 'ts-fab'), 'ts_fab_color_picker_callback', 'ts_fab_display_settings', 'ts_fab_color_settings_section', array('active_tab', array('_background' => __('Background', 'ts-fab'), '_border' => __('Border', 'ts-fab'), '_color' => __('Text', 'ts-fab'))));
    add_settings_field('tab_content', __('Tab content colors', 'ts-fab'), 'ts_fab_color_picker_callback', 'ts_fab_display_settings', 'ts_fab_color_settings_section', array('tab_content', array('_background' => __('Background', 'ts-fab'), '_border' => __('Border', 'ts-fab'), '_color' => __('Text', 'ts-fab'))));
    // End adding Display Settings fields
    // Register Display Settings setting
    register_setting('ts_fab_display_settings', 'ts_fab_display_settings', 'ts_fab_validate_fields');
    // Add Tabs Settings section
    add_settings_section('ts_fab_tabs_settings_section', __('Tabs Settings', 'ts-fab'), 'ts_fab_tabs_settings_callback', 'ts_fab_tabs_settings');
    // Add Tabs Settings fields
    add_settings_field('show_bio_tab', __('Bio', 'ts-fab'), 'ts_fab_show_bio_tab_callback', 'ts_fab_tabs_settings', 'ts_fab_tabs_settings_section', array(__('Display bio tab', 'ts-fab')));
    add_settings_field('show_twitter_tab', 'Twitter', 'ts_fab_show_twitter_tab_callback', 'ts_fab_tabs_settings', 'ts_fab_tabs_settings_section', array(__('Display Twitter tab', 'ts-fab'), __('Twitter cache interval (minutes): ', 'ts-fab'), __('Show Twitter bio', 'ts-fab'), __('Show latest tweet', 'ts-fab'), __('Show follower count', 'ts-fab'), 'style="margin-right:15px; display: inline-block"'));
    add_settings_field('facebook', 'Facebook', 'ts_fab_show_facebook_tab_callback', 'ts_fab_tabs_settings', 'ts_fab_tabs_settings_section', array(__('Display Facebook tab', 'ts-fab'), __('Do not load Facebook Javascript SDK script (useful if other plugins already do it and there is a conflict)', 'ts-fab')));
    add_settings_field('googleplus', 'Google+', 'ts_fab_show_googleplus_tab_callback', 'ts_fab_tabs_settings', 'ts_fab_tabs_settings_section', array(__('Display Google+ tab', 'ts-fab')));
    add_settings_field('linkedin', 'LinkedIn', 'ts_fab_show_linkedin_tab_callback', 'ts_fab_tabs_settings', 'ts_fab_tabs_settings_section', array(__('Display LinkedIn tab', 'ts-fab')));
    add_settings_field('latest_posts', __('Latest posts', 'ts-fab'), 'ts_fab_show_latest_posts_tab_callback', 'ts_fab_tabs_settings', 'ts_fab_tabs_settings_section', array(__('Display latest posts tab', 'ts-fab'), __('Number of latest posts to show:', 'ts-fab')));
    add_settings_field('custom_tab', __('Custom tab', 'ts-fab'), 'ts_fab_show_custom_tab_callback', 'ts_fab_tabs_settings', 'ts_fab_tabs_settings_section', array(__('Display custom tab', 'ts-fab'), __('Custom tab heading', 'ts-fab'), __('Custom tab content', 'ts-fab'), __('Allow authors to override custom tab in their user profiles', 'ts-fab'), __('(if not provided in either plugin or user settings, custom tab will not be visible)', 'ts-fab')));
    // Add setting fields for tabs added by theme or other plugins
    $additional_tabs = ts_fab_additional_tabs();
    // Check if there are any additional tabs
    if (!empty($additional_tabs)) {
        foreach ($additional_tabs as $additional_tab_key => $additional_tab_value) {
            add_settings_field($additional_tab_key, $additional_tab_value['name'], $additional_tab_value['field_callback'], 'ts_fab_tabs_settings', 'ts_fab_tabs_settings_section', array(__('Display ' . $additional_tab_value['name'] . ' tab', 'ts-fab')));
        }
        // end foreach
    }
    // Hidden field to determine if settings have been saved already
    add_settings_field('tabs_settings_saved', '', 'ts_fab_tabs_settings_saved_callback', 'ts_fab_tabs_settings', 'ts_fab_tabs_settings_section');
    // End adding Tabs Settings fields
    // Register Tabs Settings setting
    register_setting('ts_fab_tabs_settings', 'ts_fab_tabs_settings', 'ts_fab_validate_fields');
}
Beispiel #4
0
function ts_fab_initialize_plugin_options()
{
    // If the theme options don't exist, create them.
    if (false == get_option('ts_fab_display_settings')) {
        add_option('ts_fab_display_settings');
    }
    if (false == get_option('ts_fab_tabs_settings')) {
        add_option('ts_fab_tabs_settings');
    }
    // Add Display Settings section
    add_settings_section('ts_fab_display_settings_section', __('Display Settings', 'ts-fab'), 'ts_fab_display_settings_callback', 'ts_fab_display_settings');
    // Add Display Settings fields
    add_settings_field('show_in_posts', __('Show in posts', 'ts-fab'), 'ts_fab_show_in_posts_callback', 'ts_fab_display_settings', 'ts_fab_display_settings_section', array(__('Select where to display.', 'ts-fab')));
    add_settings_field('show_in_pages', __('Show in pages', 'ts-fab'), 'ts_fab_show_in_pages_callback', 'ts_fab_display_settings', 'ts_fab_display_settings_section', array(__('Select where to display.', 'ts-fab')));
    // Add a settings field for each public custom post type
    $args = array('public' => true, '_builtin' => false);
    $output = 'names';
    $operator = 'and';
    $custom_post_types = get_post_types($args, $output, $operator);
    foreach ($custom_post_types as $custom_post_type) {
        $custom_post_type_object = get_post_type_object($custom_post_type);
        add_settings_field('show_in_' . $custom_post_type, __('Show in', 'ts-fab') . ' ' . $custom_post_type_object->label, 'ts_fab_show_in_custom_post_type_callback', 'ts_fab_display_settings', 'ts_fab_display_settings_section', array(__('Display Fanciest Author Box in ' . $custom_post_type_object->label . ' custom post type.', 'ts-fab'), $custom_post_type));
    }
    add_settings_field('show_in_feeds', __('Show in feeds', 'ts-fab'), 'ts_fab_show_in_feeds_callback', 'ts_fab_display_settings', 'ts_fab_display_settings_section', array(__('Display simplified author box in RSS feeds', 'ts-fab')));
    add_settings_field('execution_priority', __('Execution priority', 'ts-fab'), 'ts_fab_execution_priority_callback', 'ts_fab_display_settings', 'ts_fab_display_settings_section', array(__('If everything is working fine and Fanciest Author Box is showing in your posts, no need to touch this. If author box is not displaying, try lowering or raising this number.', 'ts-fab')));
    add_settings_field('tabs_style', __('Tabs style', 'ts-fab'), 'ts_fab_tabs_style_callback', 'ts_fab_display_settings', 'ts_fab_display_settings_section', array(__('Show only icons or icons and text in tabs', 'ts-fab')));
    add_settings_field('float_photo', __('Avatar position', 'ts-fab'), 'ts_fab_float_photo_callback', 'ts_fab_display_settings', 'ts_fab_display_settings_section', array(__('Avatar can be shown left to the text or above it', 'ts-fab')));
    // Add Display Settings section
    add_settings_section('ts_fab_color_settings_section', __('Color Settings', 'ts-fab'), 'ts_fab_color_settings_callback', 'ts_fab_display_settings');
    add_settings_field('inactive_tab', __('Inactive tab colors', 'ts-fab'), 'ts_fab_color_picker_callback', 'ts_fab_display_settings', 'ts_fab_color_settings_section', array('inactive_tab', array('_background' => __('Background', 'ts-fab'), '_border' => __('Border', 'ts-fab'), '_color' => __('Text', 'ts-fab'))));
    add_settings_field('active_tab', __('Active tab colors', 'ts-fab'), 'ts_fab_color_picker_callback', 'ts_fab_display_settings', 'ts_fab_color_settings_section', array('active_tab', array('_background' => __('Background', 'ts-fab'), '_border' => __('Border', 'ts-fab'), '_color' => __('Text', 'ts-fab'))));
    add_settings_field('tab_content', __('Tab content colors', 'ts-fab'), 'ts_fab_color_picker_callback', 'ts_fab_display_settings', 'ts_fab_color_settings_section', array('tab_content', array('_background' => __('Background', 'ts-fab'), '_border' => __('Border', 'ts-fab'), '_color' => __('Text', 'ts-fab'))));
    // End adding Display Settings fields
    // Register Display Settings setting
    register_setting('ts_fab_display_settings', 'ts_fab_display_settings', 'ts_fab_validate_fields');
    // Add Tabs Settings section
    add_settings_section('ts_fab_tabs_settings_section', __('Tabs Settings', 'ts-fab'), 'ts_fab_tabs_settings_callback', 'ts_fab_tabs_settings');
    // Add Tabs Settings fields
    add_settings_field('show_bio_tab', __('Bio', 'ts-fab'), 'ts_fab_show_bio_tab_callback', 'ts_fab_tabs_settings', 'ts_fab_tabs_settings_section', array(__('Display bio tab', 'ts-fab')));
    add_settings_field('show_twitter_tab', 'Twitter', 'ts_fab_show_twitter_tab_callback', 'ts_fab_tabs_settings', 'ts_fab_tabs_settings_section', array(__('Display Twitter tab', 'ts-fab'), __('Twitter Consumer Key', 'ts-fab'), __('Twitter Consumer Secret', 'ts-fab'), __('Twitter cache interval (minutes): ', 'ts-fab'), __('Show Twitter bio', 'ts-fab'), __('Show latest tweet', 'ts-fab'), __('Show follower count', 'ts-fab'), 'style="margin-right:15px; display: inline-block"', __('Since Twitter has made the transition to API 1.1 it is necessary to jump through a few extra hoops to get latest tweet and Twitter bio to show. You need to go to <a href="https://dev.twitter.com/apps/new">https://dev.twitter.com/apps/new</a> and log in, if necessary, supply the necessary required fields, accept the TOS, and solve the CAPTCHA. Then submit the form, copy the consumer key (API key) and consumer secret from the screen into fields above this text and you\'re done. Cause we all love simplicity, right?.', 'ts-fab')));
    add_settings_field('facebook', 'Facebook', 'ts_fab_show_facebook_tab_callback', 'ts_fab_tabs_settings', 'ts_fab_tabs_settings_section', array(__('Display Facebook tab', 'ts-fab'), __('Do not load Facebook Javascript SDK script (useful if other plugins already do it and there is a conflict)', 'ts-fab')));
    add_settings_field('googleplus', 'Google+', 'ts_fab_show_googleplus_tab_callback', 'ts_fab_tabs_settings', 'ts_fab_tabs_settings_section', array(__('Display Google+ tab', 'ts-fab')));
    add_settings_field('linkedin', 'LinkedIn', 'ts_fab_show_linkedin_tab_callback', 'ts_fab_tabs_settings', 'ts_fab_tabs_settings_section', array(__('Display LinkedIn tab', 'ts-fab')));
    add_settings_field('latest_posts', __('Latest posts', 'ts-fab'), 'ts_fab_show_latest_posts_tab_callback', 'ts_fab_tabs_settings', 'ts_fab_tabs_settings_section', array(__('Display latest posts tab', 'ts-fab'), __('Number of latest posts to show:', 'ts-fab')));
    add_settings_field('custom_tab', __('Custom tab', 'ts-fab'), 'ts_fab_show_custom_tab_callback', 'ts_fab_tabs_settings', 'ts_fab_tabs_settings_section', array(__('Display custom tab', 'ts-fab'), __('Custom tab heading', 'ts-fab'), __('Custom tab content', 'ts-fab'), __('Allow authors to override custom tab in their user profiles', 'ts-fab'), __('(if not provided in either plugin or user settings, custom tab will not be visible)', 'ts-fab')));
    // Add setting fields for tabs added by theme or other plugins
    $additional_tabs = ts_fab_additional_tabs();
    // Check if there are any additional tabs
    if (!empty($additional_tabs)) {
        foreach ($additional_tabs as $additional_tab_key => $additional_tab_value) {
            add_settings_field($additional_tab_key, $additional_tab_value['name'], $additional_tab_value['field_callback'], 'ts_fab_tabs_settings', 'ts_fab_tabs_settings_section', array(__('Display ' . $additional_tab_value['name'] . ' tab', 'ts-fab')));
        }
        // end foreach
    }
    // Hidden field to determine if settings have been saved already
    add_settings_field('tabs_settings_saved', '', 'ts_fab_tabs_settings_saved_callback', 'ts_fab_tabs_settings', 'ts_fab_tabs_settings_section');
    // End adding Tabs Settings fields
    // Register Tabs Settings setting
    register_setting('ts_fab_tabs_settings', 'ts_fab_tabs_settings', 'ts_fab_validate_fields');
}