Make WordPress Core


Ignore:
Timestamp:
01/29/2020 12:43:23 AM (5 years ago)
Author:
SergeyBiryukov
Message:

Docs: Improve inline comments per the documentation standards.

Includes minor code layout fixes for better readability.

See #48303.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentyeleven/inc/theme-options.php

    r45932 r47122  
    3838
    3939    register_setting(
    40         'twentyeleven_options',       // Options group, see settings_fields() call in twentyeleven_theme_options_render_page()
    41         'twentyeleven_theme_options', // Database option, see twentyeleven_get_theme_options()
    42         'twentyeleven_theme_options_validate' // The sanitization callback, see twentyeleven_theme_options_validate()
    43     );
    44 
    45     // Register our settings field group
     40        'twentyeleven_options',               // Options group, see settings_fields() call in twentyeleven_theme_options_render_page().
     41        'twentyeleven_theme_options',         // Database option, see twentyeleven_get_theme_options().
     42        'twentyeleven_theme_options_validate' // The sanitization callback, see twentyeleven_theme_options_validate().
     43    );
     44
     45    // Register our settings field group.
    4646    add_settings_section(
    47         'general', // Unique identifier for the settings section
    48         '', // Section title (we don't want one)
    49         '__return_false', // Section callback (we don't want anything)
    50         'theme_options' // Menu slug, used to uniquely identify the page; see twentyeleven_theme_options_add_page()
    51     );
    52 
    53     // Register our individual settings fields
     47        'general',        // Unique identifier for the settings section.
     48        '',               // Section title (we don't want one).
     49        '__return_false', // Section callback (we don't want anything).
     50        'theme_options'   // Menu slug, used to uniquely identify the page; see twentyeleven_theme_options_add_page().
     51    );
     52
     53    // Register our individual settings fields.
    5454    add_settings_field(
    55         'color_scheme',                             // Unique identifier for the field for this section
    56         __( 'Color Scheme', 'twentyeleven' ),       // Setting field label
    57         'twentyeleven_settings_field_color_scheme', // Function that renders the settings field
    58         'theme_options',                            // Menu slug, used to uniquely identify the page; see twentyeleven_theme_options_add_page()
    59         'general'                                   // Settings section. Same as the first argument in the add_settings_section() above
     55        'color_scheme',                             // Unique identifier for the field for this section.
     56        __( 'Color Scheme', 'twentyeleven' ),       // Setting field label.
     57        'twentyeleven_settings_field_color_scheme', // Function that renders the settings field.
     58        'theme_options',                            // Menu slug, used to uniquely identify the page; see twentyeleven_theme_options_add_page().
     59        'general'                                   // Settings section. Same as the first argument in the add_settings_section() above.
    6060    );
    6161
     
    9393function twentyeleven_theme_options_add_page() {
    9494    $theme_page = add_theme_page(
    95         __( 'Theme Options', 'twentyeleven' ),   // Name of page
    96         __( 'Theme Options', 'twentyeleven' ),   // Label in menu
    97         'edit_theme_options',                    // Capability required
    98         'theme_options',                         // Menu slug, used to uniquely identify the page
    99         'twentyeleven_theme_options_render_page' // Function that renders the options page
     95        __( 'Theme Options', 'twentyeleven' ),   // Name of page.
     96        __( 'Theme Options', 'twentyeleven' ),   // Label in menu.
     97        'edit_theme_options',                    // Capability required.
     98        'theme_options',                         // Menu slug, used to uniquely identify the page.
     99        'twentyeleven_theme_options_render_page' // Function that renders the options page.
    100100    );
    101101
     
    125125
    126126    if ( method_exists( $screen, 'add_help_tab' ) ) {
    127         // WordPress 3.3.0
     127        // WordPress 3.3.0.
    128128        $screen->add_help_tab(
    129129            array(
     
    136136        $screen->set_help_sidebar( $sidebar );
    137137    } else {
    138         // WordPress 3.2.0
     138        // WordPress 3.2.0.
    139139        add_contextual_help( $screen, $help . $sidebar );
    140140    }
     
    379379    $output   = $defaults;
    380380
    381     // Color scheme must be in our array of color scheme options
     381    // Color scheme must be in our array of color scheme options.
    382382    if ( isset( $input['color_scheme'] ) && array_key_exists( $input['color_scheme'], twentyeleven_color_schemes() ) ) {
    383383        $output['color_scheme'] = $input['color_scheme'];
     
    388388    $output['link_color']   = $defaults['link_color'];
    389389
    390     // Link color must be 3 or 6 hexadecimal characters
     390    // Link color must be 3 or 6 hexadecimal characters.
    391391    if ( isset( $input['link_color'] ) && preg_match( '/^#?([a-f0-9]{3}){1,2}$/i', $input['link_color'] ) ) {
    392392        $output['link_color'] = '#' . strtolower( ltrim( $input['link_color'], '#' ) );
    393393    }
    394394
    395     // Theme layout must be in our array of theme layout options
     395    // Theme layout must be in our array of theme layout options.
    396396    if ( isset( $input['theme_layout'] ) && array_key_exists( $input['theme_layout'], twentyeleven_layouts() ) ) {
    397397        $output['theme_layout'] = $input['theme_layout'];
     
    583583    );
    584584
    585     // Link Color (added to Color Scheme section in Customizer)
     585    // Link Color (added to Color Scheme section in Customizer).
    586586    $wp_customize->add_setting(
    587587        'twentyeleven_theme_options[link_color]',
     
    606606    );
    607607
    608     // Default Layout
     608    // Default Layout.
    609609    $wp_customize->add_section(
    610610        'twentyeleven_layout',
Note: See TracChangeset for help on using the changeset viewer.