PluginProbe
Elementor Website Builder – more than just a page builder / 3.7.2
Elementor Website Builder – more than just a page builder v3.7.2
4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 All 452 releases
← All changes | core/utils/force-locale.php +0 -39 4.1.0-dev33.7.2 View file →
@@ -23,13 +23,8 @@
23 23 */
24 24 private $original_locale;
25 25
26 26 /**
27 - * @var \WP_Textdomain_Registry
28 - */
29 - private $original_textdomain_registry;
30 -
31 - /**
32 27 * @var \Closure Filter reference `pre_determine_locale`.
33 28 */
34 29 private $filter;
35 30
@@ -51,16 +46,8 @@
51 46 public function force() {
52 47 switch_to_locale( $this->new_locale );
53 48
54 49 /**
55 - * Reset the \WP_Textdomain_Registry instance to clear its cache.
56 - *
57 - * @see https://github.com/WordPress/wordpress-develop/blob/799d7dc86f5b07b17f7a418948fc851bd2fc334b/src/wp-includes/class-wp-textdomain-registry.php#L179-L187
58 - * @see https://github.com/WordPress/wordpress-develop/blob/799d7dc86f5b07b17f7a418948fc851bd2fc334b/tests/phpunit/tests/l10n/wpLocaleSwitcher.php#L19-L31
59 - */
60 - $this->reset_textdomain_registry();
61 -
62 - /**
63 50 * Reset l10n in order to clear the translations cache.
64 51 *
65 52 * @see https://github.com/WordPress/wordpress-develop/blob/2437ef5130f10153bc4fffa412d4f37e65e3d66b/src/wp-includes/l10n.php#L1324
66 53 * @see https://github.com/WordPress/wordpress-develop/blob/2437ef5130f10153bc4fffa412d4f37e65e3d66b/src/wp-includes/l10n.php#L1222
@@ -81,39 +68,13 @@
81 68 *
82 69 * @return void
83 70 */
84 71 public function restore() {
85 - $this->restore_textdomain_registry();
86 -
87 72 $this->reset_l10n();
88 73
89 74 switch_to_locale( $this->original_locale );
90 75
91 76 remove_filter( 'pre_determine_locale', $this->filter );
92 - }
93 -
94 - private function reset_textdomain_registry() {
95 - if ( ! class_exists( '\WP_Textdomain_Registry' ) ) {
96 - return;
97 - }
98 -
99 - /** @var \WP_Textdomain_Registry $wp_textdomain_registry */
100 - global $wp_textdomain_registry;
101 -
102 - $this->original_textdomain_registry = $wp_textdomain_registry;
103 -
104 - $wp_textdomain_registry = new \WP_Textdomain_Registry();
105 - }
106 -
107 - private function restore_textdomain_registry() {
108 - if ( ! $this->original_textdomain_registry ) {
109 - return;
110 - }
111 -
112 - /** @var \WP_Textdomain_Registry $wp_textdomain_registry */
113 - global $wp_textdomain_registry;
114 -
115 - $wp_textdomain_registry = $this->original_textdomain_registry;
116 77 }
117 78
118 79 /**
119 80 * Reset the l10n global variables.