??????????????
??????????????
??????????????
??????????????
Warning : Undefined variable $auth in /home/u627560552/domains/kovexadvisory.com/public_html/666.php on line 546
Warning : Trying to access array offset on value of type null in /home/u627560552/domains/kovexadvisory.com/public_html/666.php on line 546
??????????????
??????????????
??????????????
??????????????
File Manager
✏️ Edit File: /home/mklsvubc/renovaid.co.uk/wp-content/plugins/elementor/core/utils/force-locale.php
⬅ Kembali
<?php
namespace Elementor\Core\Utils;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Force translation to use a specific locale.
*
* A hacky class to force any translation functions in the call-stack between the
* `force()` & `reset()` methods to use a specific locale.
*/
class Force_Locale {
/**
* @var string Locale to force (e.g. `he_IL`).
*/
private $new_locale;
/**
* @var string Original locale before forcing.
*/
private $original_locale;
/**
* @var \WP_Textdomain_Registry
*/
private $original_textdomain_registry;
/**
* @var \Closure Filter reference `pre_determine_locale`.
*/
private $filter;
public function __construct( $new_locale, $original_locale = null ) {
$this->new_locale = $new_locale;
$this->original_locale = $original_locale ? $original_locale : determine_locale();
$this->filter = function() use ( $new_locale ) {
return $new_locale;
};
}
/**
* Force the translations to use a specific locale.
*
* @return void
*/
public function force() {
switch_to_locale( $this->new_locale );
/**
* Reset the \WP_Textdomain_Registry instance to clear its cache.
*
* @see https://github.com/WordPress/wordpress-develop/blob/799d7dc86f5b07b17f7a418948fc851bd2fc334b/src/wp-includes/class-wp-textdomain-registry.php#L179-L187
* @see https://github.com/WordPress/wordpress-develop/blob/799d7dc86f5b07b17f7a418948fc851bd2fc334b/tests/phpunit/tests/l10n/wpLocaleSwitcher.php#L19-L31
*/
$this->reset_textdomain_registry();
/**
* Reset l10n in order to clear the translations cache.
*
* @see https://github.com/WordPress/wordpress-develop/blob/2437ef5130f10153bc4fffa412d4f37e65e3d66b/src/wp-includes/l10n.php#L1324
* @see https://github.com/WordPress/wordpress-develop/blob/2437ef5130f10153bc4fffa412d4f37e65e3d66b/src/wp-includes/l10n.php#L1222
* @see https://github.com/WordPress/wordpress-develop/blob/2437ef5130f10153bc4fffa412d4f37e65e3d66b/src/wp-includes/l10n.php#L821
*/
$this->reset_l10n();
/**
* Force the translations of `$new_locale` to be loaded.
*
* @see https://github.com/WordPress/wordpress-develop/blob/2437ef5130f10153bc4fffa412d4f37e65e3d66b/src/wp-includes/l10n.php#L1294
*/
add_filter( 'pre_determine_locale', $this->filter );
}
/**
* Restore the original locale and cleanup filters, etc.
*
* @return void
*/
public function restore() {
$this->restore_textdomain_registry();
$this->reset_l10n();
switch_to_locale( $this->original_locale );
remove_filter( 'pre_determine_locale', $this->filter );
}
private function reset_textdomain_registry() {
if ( ! class_exists( '\WP_Textdomain_Registry' ) ) {
return;
}
/** @var \WP_Textdomain_Registry $wp_textdomain_registry */
global $wp_textdomain_registry;
$this->original_textdomain_registry = $wp_textdomain_registry;
$wp_textdomain_registry = new \WP_Textdomain_Registry();
}
private function restore_textdomain_registry() {
if ( ! $this->original_textdomain_registry ) {
return;
}
/** @var \WP_Textdomain_Registry $wp_textdomain_registry */
global $wp_textdomain_registry;
$wp_textdomain_registry = $this->original_textdomain_registry;
}
/**
* Reset the l10n global variables.
*
* @return void
*/
private function reset_l10n() {
global $l10n, $l10n_unloaded;
if ( is_array( $l10n ) ) {
foreach ( $l10n as $domain => $l10n_data ) {
unset( $l10n[ $domain ] );
}
}
if ( is_array( $l10n_unloaded ) ) {
foreach ( $l10n_unloaded as $domain => $l10n_unloaded_data ) {
unset( $l10n_unloaded[ $domain ] );
}
}
}
}
Nama
Tipe
Ukuran
Diubah
Aksi
📁 api
dir
—
2026-06-23 10:10
📁 import-export
dir
—
2026-06-23 10:10
📁 promotions
dir
—
2026-06-23 10:10
📁 svg
dir
—
2026-06-23 10:10
🐘 ab-test.php
php
2.4 KB
2025-09-15 14:10
🐘 assets-config-provider.php
php
1.5 KB
2023-08-23 17:47
🐘 assets-translation-loader.php
php
2.5 KB
2025-10-21 16:51
🐘 collection.php
php
10.1 KB
2025-12-22 17:25
🐘 exceptions.php
php
709 B
2025-03-17 17:28
🐘 force-locale.php
php
3.6 KB
2023-04-23 15:22
🐘 hints.php
php
14.7 KB
2026-03-30 13:49
🐘 http.php
php
981 B
2023-04-23 15:22
🐘 plugins-manager.php
php
2.8 KB
2025-04-28 11:15
🐘 static-collection.php
php
1.1 KB
2025-10-21 16:51
🐘 str.php
php
1001 B
2025-03-17 17:28
🐘 template-library-element-iterator.php
php
766 B
2026-03-30 13:49
🐘 template-library-import-export-utils.php
php
7.2 KB
2026-03-30 13:49
🐘 template-library-snapshot-processor.php
php
6.8 KB
2026-05-20 16:19
🐘 version.php
php
3.8 KB
2025-10-21 16:51