<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[13805] trunk/wp-admin/includes: Deprecate add_option_update_handler()
and remove_option_update_handler() in favor of register_setting()
and unregister_setting().</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/13805">13805</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2010-03-22 23:03:31 +0000 (Mon, 22 Mar 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Deprecate add_option_update_handler() and remove_option_update_handler() in favor of register_setting() and unregister_setting(). <a href="http://trac.wordpress.org/ticket/11730">#11730</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminincludesdeprecatedphp">trunk/wp-admin/includes/deprecated.php</a></li>
<li><a href="#trunkwpadminincludesmsphp">trunk/wp-admin/includes/ms.php</a></li>
<li><a href="#trunkwpadminincludespluginphp">trunk/wp-admin/includes/plugin.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminincludesdeprecatedphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/deprecated.php (13804 => 13805)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/deprecated.php        2010-03-22 22:33:12 UTC (rev 13804)
+++ trunk/wp-admin/includes/deprecated.php        2010-03-22 23:03:31 UTC (rev 13805)
</span><span class="lines">@@ -125,4 +125,41 @@
</span><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+/**
+ * Register a setting and its sanitization callback
+ *
+ * @since 2.7.0
+ * @deprecated 3.0.0
+ * @deprecated Use register_setting()
+ * @see register_setting()
+ *
+ * @param string $option_group A settings group name. Should correspond to a whitelisted option key name.
+ *         Default whitelisted option key names include "general," "discussion," and "reading," among others.
+ * @param string $option_name The name of an option to sanitize and save.
+ * @param unknown_type $sanitize_callback A callback function that sanitizes the option's value.
+ * @return unknown
+ */
+function add_option_update_handler( $option_group, $option_name, $sanitize_callback = '' ) {
+        _deprecated_function( __FUNCTION__, '3.0', 'register_setting()' );
+        return register_setting( $option_group, $option_name, $sanitize_callback );
+}
+
+/**
+ * Unregister a setting
+ *
+ * @since 2.7.0
+ * @deprecated 3.0.0
+ * @deprecated Use unregister_setting()
+ * @see unregister_setting()
+ *
+ * @param unknown_type $option_group
+ * @param unknown_type $option_name
+ * @param unknown_type $sanitize_callback
+ * @return unknown
+ */
+function remove_option_update_handler( $option_group, $option_name, $sanitize_callback = '' ) {
+        _deprecated_function( __FUNCTION__, '3.0', 'unregister_setting()' );
+        return unregister_setting( $option_group, $option_name, $sanitize_callback );
+}
+
</ins><span class="cx"> ?>
</span><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpadminincludesmsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/ms.php (13804 => 13805)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/ms.php        2010-03-22 22:33:12 UTC (rev 13804)
+++ trunk/wp-admin/includes/ms.php        2010-03-22 23:03:31 UTC (rev 13805)
</span><span class="lines">@@ -753,4 +753,15 @@
</span><span class="cx"> }
</span><span class="cx"> add_action( 'admin_notices', 'ms_deprecated_blogs_file' );
</span><span class="cx">
</span><ins>+/**
+ * Outputs the notice message for multisite regarding activation of plugin page.
+ *
+ * @since 3.0
+ * @return none
+ */
+function _admin_notice_multisite_activate_plugins_page() {
+        $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>' );
+        echo "<div class='error'><p>$message</p></div>";
+}
+
</ins><span class="cx"> ?>
</span></span></pre></div>
<a id="trunkwpadminincludespluginphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/plugin.php (13804 => 13805)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/plugin.php        2010-03-22 22:33:12 UTC (rev 13804)
+++ trunk/wp-admin/includes/plugin.php        2010-03-22 23:03:31 UTC (rev 13805)
</span><span class="lines">@@ -1422,40 +1422,13 @@
</span><span class="cx"> * @param unknown_type $sanitize_callback A callback function that sanitizes the option's value.
</span><span class="cx"> * @return unknown
</span><span class="cx"> */
</span><del>-function register_setting($option_group, $option_name, $sanitize_callback = '') {
-        if ( 'misc' == $option_group )
-                _deprecated_argument( __FUNCTION__, '3.0', __( 'The miscellaneous options group has been removed. Use another settings group.' ) );
-        return add_option_update_handler($option_group, $option_name, $sanitize_callback);
-}
-
-/**
- * Unregister a setting
- *
- * @since 2.7.0
- *
- * @param unknown_type $option_group
- * @param unknown_type $option_name
- * @param unknown_type $sanitize_callback
- * @return unknown
- */
-function unregister_setting($option_group, $option_name, $sanitize_callback = '') {
-        return remove_option_update_handler($option_group, $option_name, $sanitize_callback);
-}
-
-/**
- * {@internal Missing Short Description}}
- *
- * @since unknown
- *
- * @param unknown_type $option_group
- * @param unknown_type $option_name
- * @param unknown_type $sanitize_callback
- */
-function add_option_update_handler($option_group, $option_name, $sanitize_callback = '') {
</del><ins>+function register_setting( $option_group, $option_name, $sanitize_callback = '' ) {
</ins><span class="cx">         global $new_whitelist_options;
</span><span class="cx">
</span><del>-        if ( 'misc' == $option_group )
</del><ins>+        if ( 'misc' == $option_group ) {
+                _deprecated_argument( __FUNCTION__, '3.0', __( 'The miscellaneous options group has been removed. Use another settings group.' ) );
</ins><span class="cx">                 $option_group = 'general';
</span><ins>+        }
</ins><span class="cx">
</span><span class="cx">         $new_whitelist_options[ $option_group ][] = $option_name;
</span><span class="cx">         if ( $sanitize_callback != '' )
</span><span class="lines">@@ -1463,19 +1436,22 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * {@internal Missing Short Description}}
</del><ins>+ * Unregister a setting
</ins><span class="cx"> *
</span><del>- * @since unknown
</del><ins>+ * @since 2.7.0
</ins><span class="cx"> *
</span><span class="cx"> * @param unknown_type $option_group
</span><span class="cx"> * @param unknown_type $option_name
</span><span class="cx"> * @param unknown_type $sanitize_callback
</span><ins>+ * @return unknown
</ins><span class="cx"> */
</span><del>-function remove_option_update_handler($option_group, $option_name, $sanitize_callback = '') {
</del><ins>+function unregister_setting( $option_group, $option_name, $sanitize_callback = '' ) {
</ins><span class="cx">         global $new_whitelist_options;
</span><span class="cx">
</span><del>-        if ( 'misc' == $option_group )
</del><ins>+        if ( 'misc' == $option_group ) {
+                _deprecated_argument( __FUNCTION__, '3.0', __( 'The miscellaneous options group has been removed. Use another settings group.' ) );
</ins><span class="cx">                 $option_group = 'general';
</span><ins>+        }
</ins><span class="cx">
</span><span class="cx">         $pos = array_search( $option_name, (array) $new_whitelist_options );
</span><span class="cx">         if ( $pos !== false )
</span><span class="lines">@@ -1574,15 +1550,4 @@
</span><span class="cx">         wp_nonce_field("$option_group-options");
</span><span class="cx"> }
</span><span class="cx">
</span><del>-/**
- * Outputs the notice message for multisite regarding activation of plugin page.
- *
- * @since 3.0
- * @return none
- */
-function _admin_notice_multisite_activate_plugins_page() {
-        $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>' );
-        echo "<div class='error'><p>$message</p></div>";
-}
-
</del><span class="cx"> ?>
</span></span></pre>
</div>
</div>
</body>
</html>