'; 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 ''; $firstHeader = true; } elseif( strpos( $field['callback'], 'header' ) !== false && $firstHeader === true ) { // Header has been created previously so we have to close the first opened div echo '
    '; echo ''; } if( strpos( $field['callback'], 'header' ) !== false ){ // Do not return header_callback Its only needed for creating the navigation entries } // The headline else if( strpos( $field['callback'], 'headline' ) !== false ) { echo ''; echo ''; echo ''; // The Settings } else { echo ''; echo ''; echo ''; } } echo '
    '; echo '

    ' . esc_html($field['title']) . '

    '; echo '
    '; call_user_func( $field['callback'], $field['args'] ); echo '
    '; echo '
    ' . esc_html($field['title']); // Do not show the helper text when its empty if (!empty($field['args']['desc']) ){ echo ''; echo '
    ' . wp_kses_post($field['args']['desc']) . '
    '; } echo '
    '; echo '
    '; call_user_func( $field['callback'], $field['args'] ); 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(); ?>
    template->get_template('sidebar'); } ?>