From ecee3bcb67649f54dbf24cebddaa1aa42ea2d8b2 Mon Sep 17 00:00:00 2001 From: Dominik Schilling Date: Wed, 2 Apr 2014 18:31:15 +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. Built from https://develop.svn.wordpress.org/trunk@27910 git-svn-id: http://core.svn.wordpress.org/trunk@27741 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-customize-widgets.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/wp-includes/class-wp-customize-widgets.php b/wp-includes/class-wp-customize-widgets.php index ca3b56413e..4502e6d483 100644 --- a/wp-includes/class-wp-customize-widgets.php +++ b/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();