Make WordPress Core

Changeset 15810


Ignore:
Timestamp:
10/14/2010 07:58:06 PM (13 years ago)
Author:
scribu
Message:

Introduce submit_button(). Props markjaquith for initial patch. See #15064

Location:
trunk/wp-admin
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/template.php

    r15802 r15810  
    20872087}
    20882088
     2089/**
     2090 * Echos a paragraph-wrapped submit button, with provided text and appropriate class
     2091 *
     2092 * @since 3.1.0
     2093 *
     2094 * @param string $text The text of the button (defaults to 'Save Changes')
     2095 * @param string $type The type of button. One of: primary, secondary, delete
     2096 * @param string $name The HTML name of the submit button. Defaults to "submit"
     2097 */
     2098function submit_button( $text = NULL, $type = 'primary', $name = 'submit' ) {
     2099    echo get_submit_button( $text, $type, $name );
     2100}
     2101
     2102/**
     2103 * Returns a paragraph-wrapped submit button, with provided text and appropriate class
     2104 *
     2105 * @since 3.1.0
     2106 *
     2107 * @param string $text The text of the button (defaults to 'Save Changes')
     2108 * @param string $type The type of button. One of: primary, secondary, delete
     2109 * @param string $name The HTML name of the submit button. Defaults to "submit"
     2110 */
     2111function get_submit_button( $text = NULL, $type = 'primary', $name = 'submit' ) {
     2112    switch ( $type ) :
     2113        case 'primary' :
     2114        case 'secondary' :
     2115            $class = 'button-' . $type;
     2116            break;
     2117        case 'delete' :
     2118            $class = 'button-secondary delete';
     2119            break;
     2120        default :
     2121            $class = $type; // Custom cases can just pass in the classes they want to be used
     2122    endswitch;
     2123    $text = ( NULL == $text ) ? __( 'Save Changes' ) : $text;
     2124    return '<p class="submit"><input type="submit" name="' . esc_attr( $name ) . '" class="' . esc_attr( $class ) . '" value="' . esc_attr( $text ) . '" /></p>';
     2125}
     2126
  • trunk/wp-admin/options-discussion.php

    r15448 r15810  
    241241<?php do_settings_sections('discussion'); ?>
    242242
    243 <p class="submit">
    244 <input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>" />
    245 </p>
     243<?php submit_button(); ?>
    246244</form>
    247245</div>
  • trunk/wp-admin/options-general.php

    r15757 r15810  
    348348<?php do_settings_sections('general'); ?>
    349349
    350 <p class="submit">
    351 <input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>" />
    352 </p>
     350<?php submit_button(); ?>
    353351</form>
    354352
  • trunk/wp-admin/options-media.php

    r15132 r15810  
    133133<?php do_settings_sections('media'); ?>
    134134
    135 <p class="submit">
    136     <input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>" />
    137 </p>
     135<?php submit_button(); ?>
    138136
    139137</form>
  • trunk/wp-admin/options-permalink.php

    r15279 r15810  
    222222<?php do_settings_sections('permalink'); ?>
    223223
    224 <p class="submit">
    225     <input type="submit" name="submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>" />
    226 </p>
     224<?php submit_button(); ?>
    227225  </form>
    228226<?php if ( !is_multisite() ) { ?>
  • trunk/wp-admin/options-privacy.php

    r15132 r15810  
    5151<?php do_settings_sections('privacy'); ?>
    5252
    53 <p class="submit">
    54     <input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>" />
    55 </p>
     53<?php submit_button(); ?>
    5654</form>
    5755
  • trunk/wp-admin/options-reading.php

    r15227 r15810  
    9595<?php do_settings_sections( 'reading' ); ?>
    9696
    97 <p class="submit">
    98     <input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e( 'Save Changes' ); ?>" />
    99 </p>
     97<?php submit_button(); ?>
    10098</form>
    10199</div>
  • trunk/wp-admin/options-writing.php

    r15132 r15810  
    149149<?php do_settings_sections('writing'); ?>
    150150
    151 <p class="submit">
    152     <input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>" />
    153 </p>
     151<?php submit_button(); ?>
    154152</form>
    155153</div>
Note: See TracChangeset for help on using the changeset viewer.