Make WordPress Core


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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.