Widget Customizer: Remove leading underscores from public methods.
Fix also an incorrect hook name in `stop_capturing_option_updates()`. props DrewAPicture. see #27534. Built from https://develop.svn.wordpress.org/trunk@27910 git-svn-id: http://core.svn.wordpress.org/trunk@27741 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
944fba8e2f
commit
ecee3bcb67
|
@ -1368,7 +1368,7 @@ final class WP_Customize_Widgets {
|
|||
|
||||
$this->_is_capturing_option_updates = true;
|
||||
|
||||
add_filter( 'pre_update_option', array( $this, '_capture_filter_pre_update_option' ), 10, 3 );
|
||||
add_filter( 'pre_update_option', array( $this, 'capture_filter_pre_update_option' ), 10, 3 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1382,13 +1382,13 @@ final class WP_Customize_Widgets {
|
|||
* @param mixed $old_value
|
||||
* @return mixed
|
||||
*/
|
||||
public function _capture_filter_pre_update_option( $new_value, $option_name, $old_value ) {
|
||||
public function capture_filter_pre_update_option( $new_value, $option_name, $old_value ) {
|
||||
if ( $this->is_option_capture_ignored( $option_name ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! isset( $this->_captured_options[$option_name] ) ) {
|
||||
add_filter( "pre_option_{$option_name}", array( $this, '_capture_filter_pre_get_option' ) );
|
||||
add_filter( "pre_option_{$option_name}", array( $this, 'capture_filter_pre_get_option' ) );
|
||||
}
|
||||
|
||||
$this->_captured_options[$option_name] = $new_value;
|
||||
|
@ -1405,7 +1405,7 @@ final class WP_Customize_Widgets {
|
|||
* @param mixed $value Option
|
||||
* @return mixed
|
||||
*/
|
||||
public function _capture_filter_pre_get_option( $value ) {
|
||||
public function capture_filter_pre_get_option( $value ) {
|
||||
$option_name = preg_replace( '/^pre_option_/', '', current_filter() );
|
||||
|
||||
if ( isset( $this->_captured_options[$option_name] ) ) {
|
||||
|
@ -1427,9 +1427,10 @@ final class WP_Customize_Widgets {
|
|||
return;
|
||||
}
|
||||
|
||||
remove_filter( '_capture_filter_pre_update_option', array( $this, '_capture_filter_pre_update_option' ), 10, 3 );
|
||||
remove_filter( 'pre_update_option', array( $this, 'capture_filter_pre_update_option' ), 10, 3 );
|
||||
|
||||
foreach ( array_keys( $this->_captured_options ) as $option_name ) {
|
||||
remove_filter( "pre_option_{$option_name}", array( $this, '_capture_filter_pre_get_option' ) );
|
||||
remove_filter( "pre_option_{$option_name}", array( $this, 'capture_filter_pre_get_option' ) );
|
||||
}
|
||||
|
||||
$this->_captured_options = array();
|
||||
|
|
Loading…
Reference in New Issue