/**
 * Configuration tab for buddypress plugins
 *
 * @package SeoPress
 * @author Sven Wagener
 * @copyright Copyright (C) Themekraft
 **/
function sp_admin_bp_plugins_tab()
{
    global $bp, $seopress_plugin_url;
    // Getting saved data
    $bp_seo_components = get_blog_option(SITE_ID_CURRENT_SITE, 'bp_seo_plugins');
    // <===== Have to be replaced with framework !!!
    // Adding tab header
    $html .= sp_admin_tab_header(__('Buddypress Plugins', 'seopress'), __('Setup your title and meta tags of the buddypress plugins you have installed.', 'seopress'), $seopress_plugin_url . 'includes/images/logo-buddypress.png');
    // Showing component configuration
    $html .= sp_admin_bp_plugins_tabs();
    // Configurating Buddypress plugins
    $button = '<p class="submit"><input class="button-primary" type="submit" name="save" value="' . __('Save settings', 'seopress') . '" /></p>';
    $html .= $button;
    return $html;
}
/**
 * Configuration tab for general seo settings
 *
 * @package SeoPress
 * @author Sven Wagener
 * @copyright Copyright (C) Themekraft
 **/
function sp_admin_settings_tab()
{
    global $seopress_plugin_url;
    $html .= sp_admin_tab_header(__('Global Seo options', 'seopress'), __('Setup the global settings of the Seo part of the plugin.', 'seopress'), $seopress_plugin_url . 'includes/images/logo-wordpress.png');
    $html .= '<table class="widefat">';
    $html .= '<tbody>';
    $html .= '<tr>';
    $html .= '<td colspan="2"><div class="components_extend" colspan="2"><strong>' . __('Title', 'seopress') . '</strong></td>';
    $html .= '</tr>';
    $html .= '<tr>';
    $html .= '<td><div class="components_extend">' . __('Show pagination', 'seopress') . '</div></td>';
    $html .= '<td><div class="components_extend">' . tk_wp_form_checkbox('show_pagination', 'seopress_options', 'show_pagination') . '</div></td>';
    $html .= '</tr>';
    $html .= '<tr>';
    $html .= '<td><div class="components_extend">' . __('Standard length of title', 'seopress') . '</div></td>';
    // $html.= '<td><div class="components_extend"><input type="text" name="bp_seo_metadesc_length" length="4" size="3" value="' . get_option('bp_seo_metadesc_length') . '" /> (' . __('number of chars', 'seopress' ) . ')</div></td>';
    $html .= '<td><div class="components_extend">' . tk_wp_form_textfield('std_title_legth', 'seopress_options', 'std_title_legth') . ' (' . __('number of chars', 'seopress') . ')</div></td>';
    $html .= '</tr>';
    $html .= '<tr>';
    $html .= '<td><div class="components_extend">' . __('Standard length of meta description', 'seopress') . '</div></td>';
    // $html.= '<td><div class="components_extend"><input type="text" name="bp_seo_metadesc_length" length="4" size="3" value="' . get_option('bp_seo_metadesc_length') . '" /> (' . __('number of chars', 'seopress' ) . ')</div></td>';
    $html .= '<td><div class="components_extend">' . tk_wp_form_textfield('std_metadesc_legth', 'seopress_options', 'std_metadesc_legth') . ' (' . __('number of chars', 'seopress') . ')</div></td>';
    $html .= '</tr>';
    $html .= '<tr>';
    $html .= '<td colspan="2"><div class="components_extend" colspan="2"><strong>' . __('Meta boxes in posts and pages', 'seopress') . '</strong></td>';
    $html .= '</tr>';
    $html .= '<tr>';
    $html .= '<td><div class="components_extend">' . __('Hide meta boxes in posts:', 'seopress') . '</div></td>';
    // $html.= '<td><div class="components_extend"><input type="checkbox" name="bp_seo_meta_box_post" ' . $meta_box_post_checked . ' value="1" /></div></td>';
    $html .= '<td><div class="components_extend">' . tk_wp_form_checkbox('metabox_post', 'seopress_options', 'metabox_post') . '</div></td>';
    $html .= '</tr>';
    $html .= '<tr>';
    $html .= '<td><div class="components_extend">' . __('Hide meta boxes in pages:', 'seopress') . '</div></td>';
    // $html.= '<td><div class="components_extend"><input type="checkbox" name="bp_seo_meta_box_page" ' . $meta_box_page_checked . ' value="1" /></div></td>';
    $html .= '<td><div class="components_extend">' . tk_wp_form_checkbox('metabox_page', 'seopress_options', 'metabox_page') . '</div></td>';
    $html .= '</tr>';
    do_action('seopress_seo_options');
    $html .= '</tbody>';
    $html .= '</table>';
    $button = '<p class="submit"><input class="button-primary" type="submit" name="save" value="' . __('Save', 'seopress') . '" /></p>';
    $html .= $button;
    return $html;
}
/**
 * Configuration tab for buddypress
 *
 * @package SeoPress
 * @author Sven Wagener
 * @copyright Copyright (C) Themekraft
 **/
function sp_admin_bp_tab()
{
    global $bp, $seopress_plugin_url;
    $html .= sp_admin_tab_header(__('Buddypress', 'seopress'), __('Setup your title and meta tags of the buddypress pages.', 'seopress'), $seopress_plugin_url . 'includes/images/logo-buddypress.png');
    $bp_seo_components = get_blog_option(SITE_ID_CURRENT_SITE, 'bp_seo_plugins');
    // Searching for component slugs and adding to array
    $bp_components = array();
    foreach ((array) $bp as $key => $value) {
        if ($bp->{$key}->slug != '') {
            array_push($bp_components, $bp->{$key}->slug);
        }
    }
    /*
     * Adding jqueryui tabs
     */
    $html .= '<h3>' . __('Setup Buddypress pages', 'seopress') . '</h3>';
    $tabs = new TK_WP_JQUERYUI_TABS();
    if (tk_bp_is_active_component('activity')) {
        $tabs->add_tab('cap_bp_activities', __('Activity', 'seopress'), sp_admin_bp_activities_tab());
    }
    $tabs->add_tab('cap_bp_members', __('Members', 'seopress'), sp_admin_bp_members_tab());
    $tabs->add_tab('cap_bp_profiles', __('Profiles', 'seopress'), sp_admin_bp_profiles_tab());
    if (tk_bp_is_active_component('groups')) {
        $tabs->add_tab('cap_bp_groups', __('Groups', 'seopress'), sp_admin_bp_groups_tab());
    }
    if (tk_bp_is_active_component('forums')) {
        $tabs->add_tab('cap_bp_forums', __('Forums', 'seopress'), sp_admin_bp_forums());
    }
    if (tk_bp_is_active_component('blogs')) {
        $tabs->add_tab('cap_bp_blogs', __('Blogs', 'seopress'), sp_admin_bp_blogs());
    }
    if (get_option('users_can_register')) {
        $tabs->add_tab('cap_bp_registration', __('Registration', 'seopress'), sp_admin_bp_register());
    }
    $html .= $tabs->get_html();
    $button = '<p class="submit"><input class="button-primary" type="submit" name="save" value="' . __('Save', 'seopress') . '" /></p>';
    $html .= $button;
    return $html;
}
/**
 * Configuration page for wordpress main blog
 *
 * @package SeoPress
 * @author Sven Wagener
 * @copyright Copyright (C) Themekraft
 **/
function sp_admin_wp_tab()
{
    global $seopress_plugin_url;
    $html .= sp_admin_tab_header(__('Wordpress Blog', 'seopress'), __('Setup your title and meta tags of your Wordpress blog.', 'seopress'), $seopress_plugin_url . 'includes/images/logo-wordpress.png');
    $sections = array();
    array_push($sections, array('type' => 'wp-home', 'title' => __('Home', 'seopress'), 'content' => $content, 'extra_title' => ' class="home"'));
    array_push($sections, array('type' => 'wp-post', 'title' => __('Posts', 'seopress'), 'content' => $content, 'extra_title' => ' class="posts"'));
    array_push($sections, array('type' => 'wp-page', 'title' => __('Pages', 'seopress'), 'content' => $content, 'extra_title' => ' class="pages"'));
    array_push($sections, array('type' => 'wp-archive', 'title' => __('Archive', 'seopress'), 'content' => $content));
    array_push($sections, array('type' => 'wp-category', 'title' => __('Categories', 'seopress'), 'content' => $content));
    array_push($sections, array('type' => 'wp-tag', 'title' => __('Tags', 'seopress'), 'content' => $content));
    array_push($sections, array('type' => 'wp-author', 'title' => __('Author', 'seopress'), 'content' => $content));
    array_push($sections, array('type' => 'wp-search', 'title' => __('Search result', 'seopress'), 'content' => $content));
    apply_filters('sp_admin_wp_sections', $sections);
    $accordion = new TK_WP_JQUERYUI_ACCORDION();
    foreach ($sections as $section) {
        $accordion->add_section($section['type'], $section['title'], sp_type_box($section['type']), $section['extra_title']);
    }
    $html .= $accordion->get_html();
    $button = '<p class="submit"><input class="button-primary" type="submit" name="save" value="' . __('Save', 'seopress') . '" /></p>';
    $html .= $button;
    do_action('sp_admin_wp_tab_bottom');
    return $html;
}