← All changes
|
jetpack_vendor/automattic/jetpack-stats/src/class-xmlrpc-provider.php
+11
-5
12.5.2
→
16.3
View file →
| @@ -37,12 +37,14 @@ | ||
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | 39 | * Initialize class and get back a singleton instance. |
| 40 | 40 | * |
| 41 | + * @param bool $new_instance Force create new instance. | |
| 42 | + * | |
| 41 | 43 | * @return XMLRPC_Provider |
| 42 | 44 | */ |
| 43 | - public static function init() { | |
| 44 | - if ( null === self::$instance ) { | |
| 45 | + public static function init( $new_instance = false ) { | |
| 46 | + if ( null === self::$instance || $new_instance ) { | |
| 45 | 47 | self::$instance = new XMLRPC_Provider(); |
| 46 | 48 | } |
| 47 | 49 | |
| 48 | 50 | return self::$instance; |
| @@ -93,11 +95,14 @@ | ||
| 93 | 95 | ); |
| 94 | 96 | $blog = array_merge( Options::get_options(), $blog ); |
| 95 | 97 | unset( $blog['roles'], $blog['blog_id'] ); |
| 96 | 98 | |
| 97 | - add_filter( 'esc_html', array( $this, 'filter_esc_html_check_if_string' ), 10, 2 ); | |
| 98 | - $blog = map_deep( $blog, 'esc_html' ); | |
| 99 | - remove_filter( 'esc_html', array( $this, 'filter_esc_html_check_if_string' ) ); | |
| 99 | + $blog = map_deep( | |
| 100 | + $blog, | |
| 101 | + function ( $value ) { | |
| 102 | + return is_string( $value ) ? esc_html( $value ) : $value; | |
| 103 | + } | |
| 104 | + ); | |
| 100 | 105 | |
| 101 | 106 | return $blog; |
| 102 | 107 | } |
| 103 | 108 | |
| @@ -104,8 +109,9 @@ | ||
| 104 | 109 | /** |
| 105 | 110 | * Make sure we are only escaping html if the input is a string. |
| 106 | 111 | * Used for `esc_html` filter-hook. |
| 107 | 112 | * |
| 113 | + * @deprecated since 0.20.3 | |
| 108 | 114 | * @param string $safe_text The output after esc_html has been applied. |
| 109 | 115 | * @param mixed $text The initial input. |
| 110 | 116 | * @return mixed |
| 111 | 117 | */ |