Make WordPress Core

Changeset 13805


Ignore:
Timestamp:
03/22/2010 11:03:31 PM (15 years ago)
Author:
nacin
Message:

Deprecate add_option_update_handler() and remove_option_update_handler() in favor of register_setting() and unregister_setting(). #11730

Location:
trunk/wp-admin/includes
Files:
3 edited

Legend:

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

    r13097 r13805  
    126126}
    127127
     128/**
     129 * Register a setting and its sanitization callback
     130 *
     131 * @since 2.7.0
     132 * @deprecated 3.0.0
     133 * @deprecated Use register_setting()
     134 * @see register_setting()
     135 *
     136 * @param string $option_group A settings group name.  Should correspond to a whitelisted option key name.
     137 *  Default whitelisted option key names include "general," "discussion," and "reading," among others.
     138 * @param string $option_name The name of an option to sanitize and save.
     139 * @param unknown_type $sanitize_callback A callback function that sanitizes the option's value.
     140 * @return unknown
     141 */
     142function add_option_update_handler( $option_group, $option_name, $sanitize_callback = '' ) {
     143    _deprecated_function( __FUNCTION__, '3.0', 'register_setting()' );
     144    return register_setting( $option_group, $option_name, $sanitize_callback );
     145}
     146
     147/**
     148 * Unregister a setting
     149 *
     150 * @since 2.7.0
     151 * @deprecated 3.0.0
     152 * @deprecated Use unregister_setting()
     153 * @see unregister_setting()
     154 *
     155 * @param unknown_type $option_group
     156 * @param unknown_type $option_name
     157 * @param unknown_type $sanitize_callback
     158 * @return unknown
     159 */
     160function remove_option_update_handler( $option_group, $option_name, $sanitize_callback = '' ) {
     161    _deprecated_function( __FUNCTION__, '3.0', 'unregister_setting()' );
     162    return unregister_setting( $option_group, $option_name, $sanitize_callback );
     163}
     164
    128165?>
  • trunk/wp-admin/includes/ms.php

    r13792 r13805  
    754754add_action( 'admin_notices', 'ms_deprecated_blogs_file' );
    755755
     756/**
     757 * Outputs the notice message for multisite regarding activation of plugin page.
     758 *
     759 * @since 3.0
     760 * @return none
     761 */
     762function _admin_notice_multisite_activate_plugins_page() {
     763    $message = sprintf( __( 'The plugins page is not visible to normal users. It must be activated first. %s' ), '<a href="ms-options.php#menu">' . __( 'Activate' ) . '</a>' );
     764    echo "<div class='error'><p>$message</p></div>";
     765}
     766
    756767?>
  • trunk/wp-admin/includes/plugin.php

    r13770 r13805  
    14231423 * @return unknown
    14241424 */
    1425 function register_setting($option_group, $option_name, $sanitize_callback = '') {
    1426     if ( 'misc' == $option_group )
     1425function register_setting( $option_group, $option_name, $sanitize_callback = '' ) {
     1426    global $new_whitelist_options;
     1427
     1428    if ( 'misc' == $option_group ) {
    14271429        _deprecated_argument( __FUNCTION__, '3.0', __( 'The miscellaneous options group has been removed. Use another settings group.' ) );
    1428     return add_option_update_handler($option_group, $option_name, $sanitize_callback);
     1430        $option_group = 'general';
     1431    }
     1432
     1433    $new_whitelist_options[ $option_group ][] = $option_name;
     1434    if ( $sanitize_callback != '' )
     1435        add_filter( "sanitize_option_{$option_name}", $sanitize_callback );
    14291436}
    14301437
     
    14391446 * @return unknown
    14401447 */
    1441 function unregister_setting($option_group, $option_name, $sanitize_callback = '') {
    1442     return remove_option_update_handler($option_group, $option_name, $sanitize_callback);
    1443 }
    1444 
    1445 /**
    1446  * {@internal Missing Short Description}}
    1447  *
    1448  * @since unknown
    1449  *
    1450  * @param unknown_type $option_group
    1451  * @param unknown_type $option_name
    1452  * @param unknown_type $sanitize_callback
    1453  */
    1454 function add_option_update_handler($option_group, $option_name, $sanitize_callback = '') {
     1448function unregister_setting( $option_group, $option_name, $sanitize_callback = '' ) {
    14551449    global $new_whitelist_options;
    14561450
    1457     if ( 'misc' == $option_group )
     1451    if ( 'misc' == $option_group ) {
     1452        _deprecated_argument( __FUNCTION__, '3.0', __( 'The miscellaneous options group has been removed. Use another settings group.' ) );
    14581453        $option_group = 'general';
    1459 
    1460     $new_whitelist_options[ $option_group ][] = $option_name;
    1461     if ( $sanitize_callback != '' )
    1462         add_filter( "sanitize_option_{$option_name}", $sanitize_callback );
    1463 }
    1464 
    1465 /**
    1466  * {@internal Missing Short Description}}
    1467  *
    1468  * @since unknown
    1469  *
    1470  * @param unknown_type $option_group
    1471  * @param unknown_type $option_name
    1472  * @param unknown_type $sanitize_callback
    1473  */
    1474 function remove_option_update_handler($option_group, $option_name, $sanitize_callback = '') {
    1475     global $new_whitelist_options;
    1476 
    1477     if ( 'misc' == $option_group )
    1478         $option_group = 'general';
     1454    }
    14791455
    14801456    $pos = array_search( $option_name, (array) $new_whitelist_options );
     
    15751551}
    15761552
    1577 /**
    1578  * Outputs the notice message for multisite regarding activation of plugin page.
    1579  *
    1580  * @since 3.0
    1581  * @return none
    1582  */
    1583 function _admin_notice_multisite_activate_plugins_page() {
    1584     $message = sprintf( __( 'The plugins page is not visible to normal users. It must be activated first. %s' ), '<a href="ms-options.php#menu">' . __( 'Activate' ) . '</a>' );
    1585     echo "<div class='error'><p>$message</p></div>";
    1586 }
    1587 
    15881553?>
Note: See TracChangeset for help on using the changeset viewer.