diff -r c7c0fbc09788 -r 5e8dcbe22c24 web/wp-content/plugins/bbpress/includes/admin/functions.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/wp-content/plugins/bbpress/includes/admin/functions.php Tue Dec 04 18:43:10 2012 -0800 @@ -0,0 +1,245 @@ + 'bbp-about' ), admin_url( 'index.php' ) ) ); +} + +/** + * This tells WP to highlight the Tools > Forums menu item, + * regardless of which actual bbPress Tools screen we are on. + * + * The conditional prevents the override when the user is viewing settings or + * any third-party plugins. + * + * @since bbPress (r3888) + * @global string $plugin_page + * @global array $submenu_file + */ +function bbp_tools_modify_menu_highlight() { + global $plugin_page, $submenu_file; + + // This tweaks the Tools subnav menu to only show one bbPress menu item + if ( ! in_array( $plugin_page, array( 'bbp-settings' ) ) ) + $submenu_file = 'bbp-repair'; +} + +/** + * Output the tabs in the admin area + * + * @since bbPress (r3872) + * @param string $active_tab Name of the tab that is active + */ +function bbp_tools_admin_tabs( $active_tab = '' ) { + echo bbp_get_tools_admin_tabs( $active_tab ); +} + + /** + * Output the tabs in the admin area + * + * @since bbPress (r3872) + * @param string $active_tab Name of the tab that is active + */ + function bbp_get_tools_admin_tabs( $active_tab = '' ) { + + // Declare local variables + $tabs_html = ''; + $idle_class = 'nav-tab'; + $active_class = 'nav-tab nav-tab-active'; + + // Setup core admin tabs + $tabs = apply_filters( 'bbp_tools_admin_tabs', array( + '0' => array( + 'href' => get_admin_url( '', add_query_arg( array( 'page' => 'bbp-repair' ), 'tools.php' ) ), + 'name' => __( 'Repair Forums', 'bbpress' ) + ), + '1' => array( + 'href' => get_admin_url( '', add_query_arg( array( 'page' => 'bbp-converter' ), 'tools.php' ) ), + 'name' => __( 'Import Forums', 'bbpress' ) + ), + '2' => array( + 'href' => get_admin_url( '', add_query_arg( array( 'page' => 'bbp-reset' ), 'tools.php' ) ), + 'name' => __( 'Reset Forums', 'bbpress' ) + ) + ) ); + + // Loop through tabs and build navigation + foreach( $tabs as $tab_id => $tab_data ) { + $is_current = (bool) ( $tab_data['name'] == $active_tab ); + $tab_class = $is_current ? $active_class : $idle_class; + $tabs_html .= '' . $tab_data['name'] . ''; + } + + // Output the tabs + return $tabs_html; + }