Changeset 6274 for trunk/src/includes/admin/functions.php
- Timestamp:
- 02/02/2017 11:08:01 PM (9 years ago)
- File:
-
- 1 edited
-
trunk/src/includes/admin/functions.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/admin/functions.php
r6115 r6274 278 278 279 279 // Setup core admin tabs 280 $tabs = apply_filters( 'bbp_tools_admin_tabs', array( 281 '0' => array( 282 'href' => get_admin_url( '', add_query_arg( array( 'page' => 'bbp-repair' ), 'tools.php' ) ), 283 'name' => __( 'Repair Forums', 'bbpress' ) 284 ), 285 '1' => array( 286 'href' => get_admin_url( '', add_query_arg( array( 'page' => 'bbp-converter' ), 'tools.php' ) ), 287 'name' => __( 'Import Forums', 'bbpress' ) 288 ), 289 '2' => array( 290 'href' => get_admin_url( '', add_query_arg( array( 'page' => 'bbp-reset' ), 'tools.php' ) ), 291 'name' => __( 'Reset Forums', 'bbpress' ) 292 ) 293 ) ); 280 $tabs = bbp_get_tools_admin_pages(); 294 281 295 282 // Loop through tabs and build navigation 296 foreach ( array_values( $tabs ) as $tab_data ) { 297 $is_current = (bool) ( $tab_data['name'] == $active_tab ); 283 foreach ( $tabs as $tab ) { 284 285 // Skip if user cannot visit page 286 if ( ! current_user_can( $tab['cap'] ) ) { 287 continue; 288 } 289 290 // Setup tab HTML 291 $is_current = (bool) ( $tab['name'] == $active_tab ); 298 292 $tab_class = $is_current ? $active_class : $idle_class; 299 $tabs_html .= '<a href="' . esc_url( $tab_data['href'] ) . '" class="' . esc_attr( $tab_class ) . '">' . esc_html( $tab_data['name'] ) . '</a>'; 293 $tab_url = get_admin_url( '', add_query_arg( array( 'page' => $tab['page'] ), 'tools.php' ) ); 294 $tabs_html .= '<a href="' . esc_url( $tab_url ) . '" class="' . esc_attr( $tab_class ) . '">' . esc_html( $tab['name'] ) . '</a>'; 300 295 } 301 296 … … 303 298 return $tabs_html; 304 299 } 300 301 /** 302 * Return possible tools pages 303 * 304 * @since 2.6.0 (r6273) 305 * 306 * @return array 307 */ 308 function bbp_get_tools_admin_pages() { 309 return apply_filters( 'bbp_tools_admin_tabs', array( 310 array( 311 'page' => 'bbp-repair', 312 'func' => 'bbp_admin_repair', 313 'cap' => 'bbp_tools_repair_page', 314 'name' => esc_html__( 'Repair Forums', 'bbpress' ), 315 316 // Deprecated 2.6.0 317 'href' => get_admin_url( '', add_query_arg( array( 'page' => 'bbp-repair' ), 'tools.php' ) ) 318 ), 319 array( 320 'page' => 'bbp-converter', 321 'func' => 'bbp_converter_settings', 322 'cap' => 'bbp_tools_import_page', 323 'name' => esc_html__( 'Import Forums', 'bbpress' ), 324 325 // Deprecated 2.6.0 326 'href' => get_admin_url( '', add_query_arg( array( 'page' => 'bbp-converter' ), 'tools.php' ) ) 327 ), 328 array( 329 'page' => 'bbp-reset', 330 'func' => 'bbp_admin_reset', 331 'cap' => 'bbp_tools_reset_page', 332 'name' => esc_html__( 'Reset Forums', 'bbpress' ), 333 334 // Deprecated 2.6.0 335 'href' => get_admin_url( '', add_query_arg( array( 'page' => 'bbp-reset' ), 'tools.php' ) ) 336 ) 337 ) ); 338 }
Note: See TracChangeset
for help on using the changeset viewer.