Deprecate mu_options. Integrate directly into options.php. see #11644
git-svn-id: http://svn.automattic.com/wordpress/trunk@12825 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f3939dd8fd
commit
9469c9f02a
|
@ -28,4 +28,12 @@ function wpmu_checkAvailableSpace() {
|
|||
wp_die( __('Sorry, you must delete files before you can upload any more.') );
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 3.0
|
||||
*/
|
||||
function mu_options( $options ) {
|
||||
_deprecated_function(__FUNCTION__, '3.0', '' );
|
||||
return $options;
|
||||
}
|
||||
|
||||
?>
|
|
@ -562,29 +562,6 @@ function redirect_user_to_blog() {
|
|||
}
|
||||
add_action( 'admin_page_access_denied', 'redirect_user_to_blog', 99 );
|
||||
|
||||
function mu_options( $options ) {
|
||||
if ( defined( 'POST_BY_EMAIL' ) ) {
|
||||
$writing = array( 'ping_sites' );
|
||||
} else {
|
||||
$writing = array( 'ping_sites', 'mailserver_login', 'mailserver_pass', 'default_email_category', 'mailserver_port', 'mailserver_url' );
|
||||
}
|
||||
$removed = array(
|
||||
'general' => array( 'siteurl', 'home', 'admin_email', 'users_can_register', 'default_role' ),
|
||||
'reading' => array( 'gzipcompression' ),
|
||||
'writing' => $writing,
|
||||
);
|
||||
|
||||
$added = array( 'general' => array( 'new_admin_email', 'WPLANG', 'language' ) );
|
||||
|
||||
$options[ 'misc' ] = array();
|
||||
|
||||
$options = remove_option_whitelist( $removed, $options );
|
||||
$options = add_option_whitelist( $added, $options );
|
||||
|
||||
return $options;
|
||||
}
|
||||
add_filter( 'whitelist_options', 'mu_options' );
|
||||
|
||||
function check_import_new_users( $permission ) {
|
||||
if ( !is_super_admin() )
|
||||
return false;
|
||||
|
|
|
@ -1064,13 +1064,13 @@ add_filter( 'whitelist_options', 'option_update_filter' );
|
|||
* @return unknown
|
||||
*/
|
||||
function add_option_whitelist( $new_options, $options = '' ) {
|
||||
if ( $options == '' ) {
|
||||
if ( $options == '' )
|
||||
global $whitelist_options;
|
||||
} else {
|
||||
else
|
||||
$whitelist_options = $options;
|
||||
}
|
||||
foreach( $new_options as $page => $keys ) {
|
||||
foreach( $keys as $key ) {
|
||||
|
||||
foreach ( $new_options as $page => $keys ) {
|
||||
foreach ( $keys as $key ) {
|
||||
if ( !isset($whitelist_options[ $page ]) || !is_array($whitelist_options[ $page ]) ) {
|
||||
$whitelist_options[ $page ] = array();
|
||||
$whitelist_options[ $page ][] = $key;
|
||||
|
@ -1081,6 +1081,7 @@ function add_option_whitelist( $new_options, $options = '' ) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $whitelist_options;
|
||||
}
|
||||
|
||||
|
@ -1094,13 +1095,13 @@ function add_option_whitelist( $new_options, $options = '' ) {
|
|||
* @return unknown
|
||||
*/
|
||||
function remove_option_whitelist( $del_options, $options = '' ) {
|
||||
if ( $options == '' ) {
|
||||
if ( $options == '' )
|
||||
global $whitelist_options;
|
||||
} else {
|
||||
else
|
||||
$whitelist_options = $options;
|
||||
}
|
||||
foreach( $del_options as $page => $keys ) {
|
||||
foreach( $keys as $key ) {
|
||||
|
||||
foreach ( $del_options as $page => $keys ) {
|
||||
foreach ( $keys as $key ) {
|
||||
if ( isset($whitelist_options[ $page ]) && is_array($whitelist_options[ $page ]) ) {
|
||||
$pos = array_search( $key, $whitelist_options[ $page ] );
|
||||
if ( $pos !== false )
|
||||
|
@ -1108,6 +1109,7 @@ function remove_option_whitelist( $del_options, $options = '' ) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $whitelist_options;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,23 +22,45 @@ $parent_file = 'options-general.php';
|
|||
wp_reset_vars(array('action'));
|
||||
|
||||
$whitelist_options = array(
|
||||
'general' => array( 'blogname', 'blogdescription', 'admin_email', 'users_can_register', 'gmt_offset', 'date_format', 'time_format', 'start_of_week', 'default_role', 'timezone_string' ),
|
||||
'general' => array( 'blogname', 'blogdescription', 'gmt_offset', 'date_format', 'time_format', 'start_of_week', 'timezone_string' ),
|
||||
'discussion' => array( 'default_pingback_flag', 'default_ping_status', 'default_comment_status', 'comments_notify', 'moderation_notify', 'comment_moderation', 'require_name_email', 'comment_whitelist', 'comment_max_links', 'moderation_keys', 'blacklist_keys', 'show_avatars', 'avatar_rating', 'avatar_default', 'close_comments_for_old_posts', 'close_comments_days_old', 'thread_comments', 'thread_comments_depth', 'page_comments', 'comments_per_page', 'default_comments_page', 'comment_order', 'comment_registration' ),
|
||||
'misc' => array( 'use_linksupdate', 'uploads_use_yearmonth_folders', 'upload_path', 'upload_url_path' ),
|
||||
'media' => array( 'thumbnail_size_w', 'thumbnail_size_h', 'thumbnail_crop', 'medium_size_w', 'medium_size_h', 'large_size_w', 'large_size_h', 'image_default_size', 'image_default_align', 'image_default_link_type', 'embed_autourls', 'embed_size_w', 'embed_size_h' ),
|
||||
'privacy' => array( 'blog_public' ),
|
||||
'reading' => array( 'posts_per_page', 'posts_per_rss', 'rss_use_excerpt', 'blog_charset', 'show_on_front', 'page_on_front', 'page_for_posts' ),
|
||||
'writing' => array( 'default_post_edit_rows', 'use_smilies', 'ping_sites', 'mailserver_url', 'mailserver_port', 'mailserver_login', 'mailserver_pass', 'default_category', 'default_email_category', 'use_balanceTags', 'default_link_category', 'enable_app', 'enable_xmlrpc' ),
|
||||
'writing' => array( 'default_post_edit_rows', 'use_smilies', 'default_category', 'default_email_category', 'use_balanceTags', 'default_link_category', 'enable_app', 'enable_xmlrpc' ),
|
||||
'options' => array( '' ) );
|
||||
if ( !defined( 'WP_SITEURL' ) ) $whitelist_options['general'][] = 'siteurl';
|
||||
if ( !defined( 'WP_HOME' ) ) $whitelist_options['general'][] = 'home';
|
||||
|
||||
$mail_options = array('mailserver_url', 'mailserver_port', 'mailserver_login', 'mailserver_pass');
|
||||
|
||||
if ( !is_multisite() ) {
|
||||
if ( !defined( 'WP_SITEURL' ) ) $whitelist_options['general'][] = 'siteurl';
|
||||
if ( !defined( 'WP_HOME' ) ) $whitelist_options['general'][] = 'home';
|
||||
$whitelist_options['general'][] = 'admin_email';
|
||||
$whitelist_options['general'][] = 'users_can_register';
|
||||
$whitelist_options['general'][] = 'default_role';
|
||||
|
||||
$whitelist_options['writing'] = array_merge($whitelist_options['writing'], $mail_options);
|
||||
$whitelist_options['writing'][] = 'ping_sites';
|
||||
} else {
|
||||
$whitelist_options['general'][] = 'new_admin_email';
|
||||
$whitelist_options['general'][] = 'WPLANG';
|
||||
$whitelist_options['general'][] = 'language';
|
||||
|
||||
$whitelist_options[ 'misc' ] = array();
|
||||
|
||||
if ( defined( 'POST_BY_EMAIL' ) )
|
||||
$whitelist_options['writing'] = array_merge($whitelist_options['writing'], $mail_options);
|
||||
|
||||
$whitelist_options[ 'misc' ] = array();
|
||||
}
|
||||
|
||||
$whitelist_options = apply_filters( 'whitelist_options', $whitelist_options );
|
||||
|
||||
if ( !current_user_can('manage_options') )
|
||||
wp_die(__('Cheatin’ uh?'));
|
||||
|
||||
if ( is_multisite() && is_super_admin() && $_GET[ 'adminhash' ] ) {
|
||||
if ( is_multisite() && is_super_admin() && isset($_GET[ 'adminhash' ]) && $_GET[ 'adminhash' ] ) {
|
||||
$new_admin_details = get_option( 'adminhash' );
|
||||
if ( is_array( $new_admin_details ) && $new_admin_details[ 'hash' ] == $_GET[ 'adminhash' ] && $new_admin_details[ 'newemail' ] != '' ) {
|
||||
update_option( "admin_email", $new_admin_details[ 'newemail' ] );
|
||||
|
|
Loading…
Reference in New Issue