In `class-wp-customize-*`, clarify/add some `@param`/`@return` blocks. Disambiguate some functions that are trying to return the `void` response of another function they call internally.
See #32444. Built from https://develop.svn.wordpress.org/trunk@32535 git-svn-id: http://core.svn.wordpress.org/trunk@32505 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f7098c8c2e
commit
b2bbbf9759
|
@ -215,7 +215,7 @@ class WP_Customize_Control {
|
|||
* @since 4.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return bool Always true.
|
||||
* @return true Always true.
|
||||
*/
|
||||
public function active_callback() {
|
||||
return true;
|
||||
|
@ -679,6 +679,8 @@ class WP_Customize_Media_Control extends WP_Customize_Control {
|
|||
* @since 4.2.0 Moved from WP_Customize_Upload_Control.
|
||||
*
|
||||
* @param WP_Customize_Manager $manager {@see WP_Customize_Manager} instance.
|
||||
* @param string $id
|
||||
* @param array $args
|
||||
*/
|
||||
public function __construct( $manager, $id, $args = array() ) {
|
||||
parent::__construct( $manager, $id, $args );
|
||||
|
@ -1123,13 +1125,15 @@ class WP_Customize_Header_Image_Control extends WP_Customize_Image_Control {
|
|||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function get_current_image_src() {
|
||||
$src = $this->value();
|
||||
if ( isset( $this->get_url ) ) {
|
||||
$src = call_user_func( $this->get_url, $src );
|
||||
return $src;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function render_content() {
|
||||
|
|
|
@ -647,6 +647,8 @@ final class WP_Customize_Manager {
|
|||
* Removes the signature in case we experience a case where the Customizer was not properly executed.
|
||||
*
|
||||
* @since 3.4.0
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function remove_preview_signature( $return = null ) {
|
||||
remove_action( 'shutdown', array( $this, 'customize_preview_signature' ), 1000 );
|
||||
|
@ -841,7 +843,7 @@ final class WP_Customize_Manager {
|
|||
*
|
||||
* @since 4.2.0
|
||||
*
|
||||
* @param string $setting_ids The setting IDs to add.
|
||||
* @param array $setting_ids The setting IDs to add.
|
||||
* @return WP_Customize_Setting The settings added.
|
||||
*/
|
||||
public function add_dynamic_settings( $setting_ids ) {
|
||||
|
@ -897,7 +899,7 @@ final class WP_Customize_Manager {
|
|||
* @since 3.4.0
|
||||
*
|
||||
* @param string $id Customize Setting ID.
|
||||
* @return WP_Customize_Setting
|
||||
* @return WP_Customize_Setting|null The setting, if set.
|
||||
*/
|
||||
public function get_setting( $id ) {
|
||||
if ( isset( $this->settings[ $id ] ) ) {
|
||||
|
@ -942,7 +944,7 @@ final class WP_Customize_Manager {
|
|||
* @access public
|
||||
*
|
||||
* @param string $id Panel ID to get.
|
||||
* @return WP_Customize_Panel Requested panel instance.
|
||||
* @return WP_Customize_Panel|null Requested panel instance, if set.
|
||||
*/
|
||||
public function get_panel( $id ) {
|
||||
if ( isset( $this->panels[ $id ] ) ) {
|
||||
|
@ -985,7 +987,7 @@ final class WP_Customize_Manager {
|
|||
* @since 3.4.0
|
||||
*
|
||||
* @param string $id Section ID.
|
||||
* @return WP_Customize_Section
|
||||
* @return WP_Customize_Section|null The section, if set.
|
||||
*/
|
||||
public function get_section( $id ) {
|
||||
if ( isset( $this->sections[ $id ] ) )
|
||||
|
@ -1027,7 +1029,7 @@ final class WP_Customize_Manager {
|
|||
* @since 3.4.0
|
||||
*
|
||||
* @param string $id ID of the control.
|
||||
* @return WP_Customize_Control $control The control object.
|
||||
* @return WP_Customize_Control|null The control object, if set.
|
||||
*/
|
||||
public function get_control( $id ) {
|
||||
if ( isset( $this->controls[ $id ] ) )
|
||||
|
@ -1513,7 +1515,7 @@ final class WP_Customize_Manager {
|
|||
* @since 3.4.0
|
||||
*
|
||||
* @param string $color
|
||||
* @return string
|
||||
* @return mixed
|
||||
*/
|
||||
public function _sanitize_header_textcolor( $color ) {
|
||||
if ( 'blank' === $color )
|
||||
|
@ -1545,8 +1547,6 @@ function sanitize_hex_color( $color ) {
|
|||
// 3 or 6 hex digits, or the empty string.
|
||||
if ( preg_match('|^#([A-Fa-f0-9]{3}){1,2}$|', $color ) )
|
||||
return $color;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -207,7 +207,7 @@ class WP_Customize_Section {
|
|||
* @since 4.1.0
|
||||
* @access public
|
||||
*
|
||||
* @return bool Always true.
|
||||
* @return true Always true.
|
||||
*/
|
||||
public function active_callback() {
|
||||
return true;
|
||||
|
|
|
@ -133,7 +133,7 @@ class WP_Customize_Setting {
|
|||
*/
|
||||
public function is_current_blog_previewed() {
|
||||
if ( ! isset( $this->_previewed_blog_id ) ) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
return ( get_current_blog_id() === $this->_previewed_blog_id );
|
||||
}
|
||||
|
@ -275,8 +275,8 @@ class WP_Customize_Setting {
|
|||
*
|
||||
* @since 3.4.0
|
||||
*
|
||||
* @param mixed $value The value to sanitize.
|
||||
* @return mixed Null if an input isn't valid, otherwise the sanitized value.
|
||||
* @param string|array $value The value to sanitize.
|
||||
* @return string|array|null Null if an input isn't valid, otherwise the sanitized value.
|
||||
*/
|
||||
public function sanitize( $value ) {
|
||||
$value = wp_unslash( $value );
|
||||
|
@ -331,18 +331,19 @@ class WP_Customize_Setting {
|
|||
* @since 3.4.0
|
||||
*
|
||||
* @param mixed $value The value to update.
|
||||
* @return mixed The result of saving the value.
|
||||
*/
|
||||
protected function _update_theme_mod( $value ) {
|
||||
// Handle non-array theme mod.
|
||||
if ( empty( $this->id_data[ 'keys' ] ) )
|
||||
return set_theme_mod( $this->id_data[ 'base' ], $value );
|
||||
|
||||
if ( empty( $this->id_data[ 'keys' ] ) ) {
|
||||
set_theme_mod( $this->id_data[ 'base' ], $value );
|
||||
return;
|
||||
}
|
||||
// Handle array-based theme mod.
|
||||
$mods = get_theme_mod( $this->id_data[ 'base' ] );
|
||||
$mods = $this->multidimensional_replace( $mods, $this->id_data[ 'keys' ], $value );
|
||||
if ( isset( $mods ) )
|
||||
return set_theme_mod( $this->id_data[ 'base' ], $mods );
|
||||
if ( isset( $mods ) ) {
|
||||
set_theme_mod( $this->id_data[ 'base' ], $mods );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -351,7 +352,7 @@ class WP_Customize_Setting {
|
|||
* @since 3.4.0
|
||||
*
|
||||
* @param mixed $value The value to update.
|
||||
* @return bool|null The result of saving the value.
|
||||
* @return bool The result of saving the value.
|
||||
*/
|
||||
protected function _update_option( $value ) {
|
||||
// Handle non-array option.
|
||||
|
|
|
@ -122,7 +122,6 @@ final class WP_Customize_Widgets {
|
|||
return $type;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -236,6 +235,7 @@ final class WP_Customize_Widgets {
|
|||
* @access public
|
||||
*
|
||||
* @param array $old_sidebars_widgets
|
||||
* @return array
|
||||
*/
|
||||
public function filter_customize_value_old_sidebars_widgets_data( $old_sidebars_widgets ) {
|
||||
return $this->old_sidebars_widgets;
|
||||
|
@ -253,6 +253,7 @@ final class WP_Customize_Widgets {
|
|||
* @access public
|
||||
*
|
||||
* @param array $sidebars_widgets
|
||||
* @return array
|
||||
*/
|
||||
public function filter_option_sidebars_widgets_for_theme_switch( $sidebars_widgets ) {
|
||||
$sidebars_widgets = $GLOBALS['sidebars_widgets'];
|
||||
|
@ -918,6 +919,7 @@ final class WP_Customize_Widgets {
|
|||
* @access public
|
||||
*
|
||||
* @param array $sidebars_widgets List of widgets for the current sidebar.
|
||||
* @return array
|
||||
*/
|
||||
public function preview_sidebars_widgets( $sidebars_widgets ) {
|
||||
$sidebars_widgets = get_option( 'sidebars_widgets' );
|
||||
|
@ -1040,6 +1042,7 @@ final class WP_Customize_Widgets {
|
|||
*
|
||||
* @param bool $is_active Whether the sidebar is active.
|
||||
* @param string $sidebar_id Sidebar ID.
|
||||
* @return bool
|
||||
*/
|
||||
public function tally_sidebars_via_is_active_sidebar_calls( $is_active, $sidebar_id ) {
|
||||
if ( isset( $GLOBALS['wp_registered_sidebars'][$sidebar_id] ) ) {
|
||||
|
@ -1065,6 +1068,7 @@ final class WP_Customize_Widgets {
|
|||
*
|
||||
* @param bool $has_widgets Whether the current sidebar has widgets.
|
||||
* @param string $sidebar_id Sidebar ID.
|
||||
* @return bool
|
||||
*/
|
||||
public function tally_sidebars_via_dynamic_sidebar_calls( $has_widgets, $sidebar_id ) {
|
||||
if ( isset( $GLOBALS['wp_registered_sidebars'][$sidebar_id] ) ) {
|
||||
|
@ -1105,7 +1109,7 @@ final class WP_Customize_Widgets {
|
|||
* @access public
|
||||
*
|
||||
* @param array $value Widget instance to sanitize.
|
||||
* @return array Sanitized widget instance.
|
||||
* @return array|null Sanitized widget instance.
|
||||
*/
|
||||
public function sanitize_widget_instance( $value ) {
|
||||
if ( $value === array() ) {
|
||||
|
@ -1116,21 +1120,21 @@ final class WP_Customize_Widgets {
|
|||
|| empty( $value['instance_hash_key'] )
|
||||
|| empty( $value['encoded_serialized_instance'] ) )
|
||||
{
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
$decoded = base64_decode( $value['encoded_serialized_instance'], true );
|
||||
if ( false === $decoded ) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
if ( $this->get_instance_hash_key( $decoded ) !== $value['instance_hash_key'] ) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
$instance = unserialize( $decoded );
|
||||
if ( false === $instance ) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
return $instance;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.3-alpha-32534';
|
||||
$wp_version = '4.3-alpha-32535';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue