Skip to:
Content

bbPress.org


Ignore:
Timestamp:
12/05/2025 03:03:50 AM (4 months ago)
Author:
johnjamesjacoby
Message:

Tools - Code Improvement: un-indent last remaining _get_ functions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/admin/tools.php

    r7380 r7381  
    525525}
    526526
    527     /**
    528      * Output the tabs in the admin area.
    529      *
    530      * @since 2.1.0 bbPress (r3872)
    531      *
    532      * @param string $active_tab Name of the tab that is active.
    533      */
    534     function bbp_get_tools_admin_tabs( $active_tab = '' ) {
    535 
    536         // Declare local variables
    537         $tabs_html    = '';
    538         $idle_class   = 'nav-tab';
    539         $active_class = 'nav-tab nav-tab-active';
    540 
    541         // Setup core admin tabs
    542         $tabs = bbp_get_tools_admin_pages();
    543 
    544         // Loop through tabs and build navigation
    545         foreach ( $tabs as $tab ) {
    546 
    547             // Skip if user cannot visit page
    548             if ( ! current_user_can( $tab['cap'] ) ) {
    549                 continue;
    550             }
    551 
    552             // Setup tab HTML
    553             $is_current = (bool) ( $tab['page'] === $active_tab );
    554             $tab_class  = $is_current ? $active_class : $idle_class;
    555             $tab_url    = add_query_arg( array( 'page' => $tab['page'] ), admin_url( 'tools.php' ) );
    556 
    557             // Tab name is not escaped - may contain HTML
    558             $tabs_html .= '<a href="' . esc_url( $tab_url ) . '" class="' . esc_attr( $tab_class ) . '">' . $tab['name'] . '</a>';
     527/**
     528 * Output the tabs in the admin area.
     529 *
     530 * @since 2.1.0 bbPress (r3872)
     531 *
     532 * @param string $active_tab Name of the tab that is active.
     533 */
     534function bbp_get_tools_admin_tabs( $active_tab = '' ) {
     535
     536    // Declare local variables
     537    $tabs_html    = '';
     538    $idle_class   = 'nav-tab';
     539    $active_class = 'nav-tab nav-tab-active';
     540
     541    // Setup core admin tabs
     542    $tabs = bbp_get_tools_admin_pages();
     543
     544    // Loop through tabs and build navigation
     545    foreach ( $tabs as $tab ) {
     546
     547        // Skip if user cannot visit page
     548        if ( ! current_user_can( $tab['cap'] ) ) {
     549            continue;
    559550        }
    560551
    561         // Output the tabs
    562         return $tabs_html;
     552        // Setup tab HTML
     553        $is_current = (bool) ( $tab['page'] === $active_tab );
     554        $tab_class  = $is_current ? $active_class : $idle_class;
     555        $tab_url    = add_query_arg( array( 'page' => $tab['page'] ), admin_url( 'tools.php' ) );
     556
     557        // Tab name is not escaped - may contain HTML
     558        $tabs_html .= '<a href="' . esc_url( $tab_url ) . '" class="' . esc_attr( $tab_class ) . '">' . $tab['name'] . '</a>';
    563559    }
     560
     561    // Output the tabs
     562    return $tabs_html;
     563}
    564564
    565565/**
Note: See TracChangeset for help on using the changeset viewer.