diff -r 3d4e9c994f10 -r a86126ab1dd4 wp/wp-includes/class-wp-customize-setting.php --- a/wp/wp-includes/class-wp-customize-setting.php Tue Oct 22 16:11:46 2019 +0200 +++ b/wp/wp-includes/class-wp-customize-setting.php Tue Dec 15 13:49:49 2020 +0100 @@ -15,6 +15,7 @@ * @since 3.4.0 * * @see WP_Customize_Manager + * @link https://developer.wordpress.org/themes/customize-api */ class WP_Customize_Setting { /** @@ -50,10 +51,10 @@ public $capability = 'edit_theme_options'; /** - * Feature a theme is required to support to enable this setting. + * Theme features required to support the setting. * * @since 3.4.0 - * @var string + * @var string|string[] */ public $theme_supports = ''; @@ -71,8 +72,6 @@ * Set this value to 'postMessage' to enable a custom JavaScript handler to render changes to this setting * as opposed to reloading the whole page. * - * @link https://developer.wordpress.org/themes/customize-api - * * @since 3.4.0 * @var string */ @@ -98,7 +97,7 @@ * Callback to convert a Customize PHP setting value to a value that is JSON serializable. * * @since 3.4.0 - * @var string + * @var callable */ public $sanitize_js_callback = ''; @@ -154,10 +153,26 @@ * * @since 3.4.0 * - * @param WP_Customize_Manager $manager - * @param string $id An specific ID of the setting. Can be a - * theme mod or option name. - * @param array $args Setting arguments. + * @param WP_Customize_Manager $manager Customizer bootstrap instance. + * @param string $id A specific ID of the setting. + * Can be a theme mod or option name. + * @param array $args { + * Optional. Array of properties for the new Setting object. Default empty array. + * + * @type string $type Type of the setting. Default 'theme_mod'. + * @type string $capability Capability required for the setting. Default 'edit_theme_options' + * @type string|string[] $theme_supports Theme features required to support the panel. Default is none. + * @type string $default Default value for the setting. Default is empty string. + * @type string $transport Options for rendering the live preview of changes in Customizer. + * Using 'refresh' makes the change visible by reloading the whole preview. + * Using 'postMessage' allows a custom JavaScript to handle live changes. + * Default is 'refresh'. + * @type callable $validate_callback Server-side validation callback for the setting's value. + * @type callable $sanitize_callback Callback to filter a Customize setting value in un-slashed form. + * @type callable $sanitize_js_callback Callback to convert a Customize PHP setting value to a value that is + * JSON serializable. + * @type bool $dirty Whether or not the setting is initially dirty when created. + * } */ public function __construct( $manager, $id, $args = array() ) { $keys = array_keys( get_object_vars( $this ) ); @@ -498,7 +513,7 @@ * * @since 3.4.0 * - * @return false|void False if cap check fails or value isn't set or is invalid. + * @return void|false False if cap check fails or value isn't set or is invalid. */ final public function save() { $value = $this->post_value(); @@ -531,7 +546,7 @@ * * @since 3.4.0 * - * @param mixed $default A default value which is used as a fallback. Default is null. + * @param mixed $default A default value which is used as a fallback. Default null. * @return mixed The default value on failure, otherwise the sanitized and validated value. */ final public function post_value( $default = null ) { @@ -815,11 +830,11 @@ * @return bool False if theme doesn't support the setting or user can't change setting, otherwise true. */ final public function check_capabilities() { - if ( $this->capability && ! call_user_func_array( 'current_user_can', (array) $this->capability ) ) { + if ( $this->capability && ! current_user_can( $this->capability ) ) { return false; } - if ( $this->theme_supports && ! call_user_func_array( 'current_theme_supports', (array) $this->theme_supports ) ) { + if ( $this->theme_supports && ! current_theme_supports( ... (array) $this->theme_supports ) ) { return false; } @@ -831,9 +846,9 @@ * * @since 3.4.0 * - * @param $root - * @param $keys - * @param bool $create Default is false. + * @param array $root + * @param array $keys + * @param bool $create Default false. * @return array|void Keys are 'root', 'node', and 'key'. */ final protected function multidimensional( &$root, $keys, $create = false ) { @@ -862,7 +877,7 @@ if ( $create ) { if ( ! is_array( $node ) ) { - // account for an array overriding a string or object value + // Account for an array overriding a string or object value. $node = array(); } if ( ! isset( $node[ $last ] ) ) { @@ -886,8 +901,8 @@ * * @since 3.4.0 * - * @param $root - * @param $keys + * @param array $root + * @param array $keys * @param mixed $value The value to update. * @return mixed */ @@ -912,9 +927,9 @@ * * @since 3.4.0 * - * @param $root - * @param $keys - * @param mixed $default A default value which is used as a fallback. Default is null. + * @param array $root + * @param array $keys + * @param mixed $default A default value which is used as a fallback. Default null. * @return mixed The requested value or the default value. */ final protected function multidimensional_get( $root, $keys, $default = null ) { @@ -931,8 +946,8 @@ * * @since 3.4.0 * - * @param $root - * @param $keys + * @param array $root + * @param array $keys * @return bool True if value is set, false if not. */ final protected function multidimensional_isset( $root, $keys ) { @@ -944,24 +959,24 @@ /** * WP_Customize_Filter_Setting class. */ -require_once( ABSPATH . WPINC . '/customize/class-wp-customize-filter-setting.php' ); +require_once ABSPATH . WPINC . '/customize/class-wp-customize-filter-setting.php'; /** * WP_Customize_Header_Image_Setting class. */ -require_once( ABSPATH . WPINC . '/customize/class-wp-customize-header-image-setting.php' ); +require_once ABSPATH . WPINC . '/customize/class-wp-customize-header-image-setting.php'; /** * WP_Customize_Background_Image_Setting class. */ -require_once( ABSPATH . WPINC . '/customize/class-wp-customize-background-image-setting.php' ); +require_once ABSPATH . WPINC . '/customize/class-wp-customize-background-image-setting.php'; /** * WP_Customize_Nav_Menu_Item_Setting class. */ -require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-item-setting.php' ); +require_once ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-item-setting.php'; /** * WP_Customize_Nav_Menu_Setting class. */ -require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-setting.php' ); +require_once ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-setting.php';