From b0fae8aa2acabe871f9782c6acbb32877b3504ca Mon Sep 17 00:00:00 2001 From: "Dominik Schilling (ocean90)" Date: Wed, 2 Apr 2014 18:30:06 +0000 Subject: [PATCH] Widget Customizer: Remove leading underscores from public methods. Fix also an incorrect hook name in `stop_capturing_option_updates()`. props DrewAPicture. see #27534. git-svn-id: https://develop.svn.wordpress.org/trunk@27910 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/class-wp-customize-widgets.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/wp-includes/class-wp-customize-widgets.php b/src/wp-includes/class-wp-customize-widgets.php index ca3b56413e..4502e6d483 100644 --- a/src/wp-includes/class-wp-customize-widgets.php +++ b/src/wp-includes/class-wp-customize-widgets.php @@ -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();