PluginProbe
Polylang / 2.3.6
Polylang v2.3.6
3.8.9 3.8.8 3.8.7 3.8.6 3.8.5 3.8.4 3.8.3 2.7 2.7.0.1 2.7.1 2.7.2 2.7.3 2.7.4 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.9 2.9.1 2.9.2 3.0 3.0.1 3.0.2 3.0.3 All 233 releases
← All changes | include/olt-manager.php +8 -8 2.7.22.3.6 View file →
@@ -9,9 +9,9 @@
9 9 *
10 10 * @since 1.2
11 11 */
12 12 class PLL_OLT_Manager {
13 - protected static $instance; // For singleton
13 + static protected $instance; // For singleton
14 14 protected $default_locale;
15 15 protected $list_textdomains = array(); // All text domains
16 16 public $labels = array(); // Post types and taxonomies labels to translate
17 17
@@ -26,9 +26,9 @@
26 26 add_filter( 'pre_update_option_active_sitewide_plugins', array( $this, 'make_polylang_first' ) );
27 27
28 28 // Overriding load text domain only on front since WP 4.7
29 29 // FIXME test get_user_locale for backward compatibility with WP < 4.7
30 - if ( is_admin() && ! Polylang::is_ajax_on_front() && function_exists( 'get_user_locale' ) ) {
30 + if ( is_admin() && function_exists( 'get_user_locale' ) ) {
31 31 return;
32 32 }
33 33
34 34 // Saves the default locale before we start any language manipulation
@@ -38,11 +38,13 @@
38 38 add_filter( 'load_textdomain_mofile', array( $this, 'load_textdomain_mofile' ), 10, 2 );
39 39 add_filter( 'gettext', array( $this, 'gettext' ), 10, 3 );
40 40 add_filter( 'gettext_with_context', array( $this, 'gettext_with_context' ), 10, 4 );
41 41
42 - // Loads text domains
43 - add_action( 'pll_language_defined', array( $this, 'load_textdomains' ), 2 ); // After PLL_Frontend::pll_language_defined
44 - add_action( 'pll_no_language_defined', array( $this, 'load_textdomains' ) );
42 + if ( ! Polylang::is_ajax_on_front() ) {
43 + // Loads text domains
44 + add_action( 'pll_language_defined', array( $this, 'load_textdomains' ), 2 ); // After PLL_Frontend::pll_language_defined
45 + add_action( 'pll_no_language_defined', array( $this, 'load_textdomains' ) );
46 + }
45 47 }
46 48
47 49 /**
48 50 * Access to the single instance of the class
@@ -50,9 +52,9 @@
50 52 * @since 1.7
51 53 *
52 54 * @return object
53 55 */
54 - public static function instance() {
56 + static public function instance() {
55 57 if ( empty( self::$instance ) ) {
56 58 self::$instance = new self();
57 59 }
58 60
@@ -215,13 +217,11 @@
215 217
216 218 foreach ( $type->labels as $key => $label ) {
217 219 if ( is_string( $label ) && isset( $this->labels[ $label ] ) ) {
218 220 if ( empty( $translated[ $label ] ) ) {
219 - // PHPCS:disable WordPress.WP.I18n
220 221 $type->labels->$key = $translated[ $label ] = isset( $this->labels[ $label ]['context'] ) ?
221 222 _x( $label, $this->labels[ $label ]['context'], $this->labels[ $label ]['domain'] ) :
222 223 __( $label, $this->labels[ $label ]['domain'] );
223 - // PHPCS:enable
224 224 }
225 225 else {
226 226 $type->labels->$key = $translated[ $label ];
227 227 }