1 parent
9737a7c310
commit
358542eef5
1078 files changed
+33799
-65099
No files matched your search
@@ -588,7 +588,7 @@ function activate_plugin( $plugin, $redirect = '', $network_wide = false, $silen
|
||||
* @param bool $network_wide Whether to enable the plugin for all sites in the network
|
||||
* or just the current site. Multisite only. Default is false.
|
||||
*/
|
||||
do_action( "activate_{$plugin}", $network_wide );
|
||||
do_action( 'activate_' . $plugin, $network_wide );
|
||||
}
|
||||
|
||||
if ( $network_wide ) {
|
||||
@@ -701,7 +701,7 @@ function deactivate_plugins( $plugins, $silent = false, $network_wide = null ) {
|
||||
* @param bool $network_deactivating Whether the plugin is deactivated for all sites in the network
|
||||
* or just the current site. Multisite only. Default is false.
|
||||
*/
|
||||
do_action( "deactivate_{$plugin}", $network_deactivating );
|
||||
do_action( 'deactivate_' . $plugin, $network_deactivating );
|
||||
|
||||
/**
|
||||
* Fires after a plugin is deactivated.
|
||||
@@ -1764,6 +1764,67 @@ function user_can_access_admin_page() {
|
||||
|
||||
/* Whitelist functions */
|
||||
|
||||
/**
|
||||
* Register a setting and its sanitization callback
|
||||
*
|
||||
* @since 2.7.0
|
||||
*
|
||||
* @global array $new_whitelist_options
|
||||
*
|
||||
* @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 callable $sanitize_callback A callback function that sanitizes the option's value.
|
||||
*/
|
||||
function register_setting( $option_group, $option_name, $sanitize_callback = '' ) {
|
||||
global $new_whitelist_options;
|
||||
|
||||
if ( 'misc' == $option_group ) {
|
||||
_deprecated_argument( __FUNCTION__, '3.0.0', sprintf( __( 'The "%s" options group has been removed. Use another settings group.' ), 'misc' ) );
|
||||
$option_group = 'general';
|
||||
}
|
||||
|
||||
if ( 'privacy' == $option_group ) {
|
||||
_deprecated_argument( __FUNCTION__, '3.5.0', sprintf( __( 'The "%s" options group has been removed. Use another settings group.' ), 'privacy' ) );
|
||||
$option_group = 'reading';
|
||||
}
|
||||
|
||||
$new_whitelist_options[ $option_group ][] = $option_name;
|
||||
if ( $sanitize_callback != '' )
|
||||
add_filter( "sanitize_option_{$option_name}", $sanitize_callback );
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregister a setting
|
||||
*
|
||||
* @since 2.7.0
|
||||
*
|
||||
* @global array $new_whitelist_options
|
||||
*
|
||||
* @param string $option_group
|
||||
* @param string $option_name
|
||||
* @param callable $sanitize_callback
|
||||
*/
|
||||
function unregister_setting( $option_group, $option_name, $sanitize_callback = '' ) {
|
||||
global $new_whitelist_options;
|
||||
|
||||
if ( 'misc' == $option_group ) {
|
||||
_deprecated_argument( __FUNCTION__, '3.0.0', sprintf( __( 'The "%s" options group has been removed. Use another settings group.' ), 'misc' ) );
|
||||
$option_group = 'general';
|
||||
}
|
||||
|
||||
if ( 'privacy' == $option_group ) {
|
||||
_deprecated_argument( __FUNCTION__, '3.5.0', sprintf( __( 'The "%s" options group has been removed. Use another settings group.' ), 'privacy' ) );
|
||||
$option_group = 'reading';
|
||||
}
|
||||
|
||||
$pos = array_search( $option_name, (array) $new_whitelist_options[ $option_group ] );
|
||||
if ( $pos !== false )
|
||||
unset( $new_whitelist_options[ $option_group ][ $pos ] );
|
||||
if ( $sanitize_callback != '' )
|
||||
remove_filter( "sanitize_option_{$option_name}", $sanitize_callback );
|
||||
}
|
||||
|
||||
/**
|
||||
* Refreshes the value of the options whitelist available via the 'whitelist_options' hook.
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user