';
foreach ( ( array ) $wp_settings_fields[$page][$section] as $field ) {
$sanitizedID = str_replace( '[', '', $field['id'] );
$sanitizedID = str_replace( ']', '', $sanitizedID );
if( strpos( $field['callback'], 'header' ) !== false ) {
echo '
' . wp_kses_post($field['title']) . '';
}
}
echo '';
}
/**
* Print out the settings fields for a particular settings section
*
* Part of the Settings API. Use this in a settings page to output
* a specific section. Should normally be called by do_settings_sections()
* rather than directly.
*
* @global $wp_settings_fields Storage array of settings fields and their pages/sections
* @return string
*
* @since 2.1.2
*
* @param string $page Slug title of the admin page who's settings fields you want to show.
* @param section $section Slug title of the settings section who's fields you want to show.
*
* Copied from WP Core 4.0 /wp-admin/includes/template.php do_settings_fields()
* We use our own function to be able to create jQuery tabs with easytabs()
*
* We dont use tables here any longer. Are we stuck in the nineties?
* @todo Use sprintf to sanitize $field['id'] instead using str_replace() Should be faster?
* @todo some media queries for better responisbility
*/
function mashsb_do_settings_fields( $page, $section ) {
global $wp_settings_fields;
$header = false;
$firstHeader = false;
if( !isset( $wp_settings_fields[$page][$section] ) )
return;
// Check first if any callback header registered
foreach ( ( array ) $wp_settings_fields[$page][$section] as $field ) {
strpos( $field['callback'], 'header' ) !== false ? $header = true : $header = false;
if( $header === true )
break;
}
foreach ( ( array ) $wp_settings_fields[$page][$section] as $field ) {
$sanitizedID = str_replace( '[', '', $field['id'] );
$sanitizedID = str_replace( ']', '', $sanitizedID );
// Check if header has been created previously
if( strpos( $field['callback'], 'header' ) !== false && $firstHeader === false ) {
echo '';
echo '
';
if( $header === true ) {
echo '
';
}
}
/**
* Options Page
*
* Renders the options page contents.
*
* @since 1.0
* @global $mashsb_options Array of all the MASHSB Options
* @return void
*/
function mashsb_options_page() {
global $mashsb_options;
$active_tab = isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], mashsb_get_settings_tabs() ) ? $_GET['tab'] : 'general';
ob_start();
?>
$tab_name ) {
$tab_url = esc_url( add_query_arg( array(
'settings-updated' => false,
'tab' => $tab_id
) ) );
$active = $active_tab == $tab_id ? ' nav-tab-active' : '';
echo '';
echo esc_html( $tab_name );
echo '';
}
?>