PluginProbe
Polylang / 3.1.4
Polylang v3.1.4
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 | settings/settings-browser.php +25 -12 2.73.1.4 View file →
@@ -1,5 +1,8 @@
1 1 <?php
2 +/**
3 + * @package Polylang
4 + */
2 5
3 6 /**
4 7 * Settings class for browser language preference detection
5 8 *
@@ -5,8 +8,14 @@
5 8 *
6 9 * @since 1.8
7 10 */
8 11 class PLL_Settings_Browser extends PLL_Settings_Module {
12 + /**
13 + * Stores the display order priority.
14 + *
15 + * @var int
16 + */
17 + public $priority = 20;
9 18
10 19 /**
11 20 * Constructor
12 21 *
@@ -20,9 +29,9 @@
20 29 $polylang,
21 30 array(
22 31 'module' => 'browser',
23 32 'title' => __( 'Detect browser language', 'polylang' ),
24 - 'description' => __( 'When the front page is visited, set the language according to the browser preference', 'polylang' ),
33 + 'description' => __( 'When the front page is visited, redirects to itself in the browser preferred language. As this doesn\'t work if it is cached, Polylang will attempt to disable the front page cache for known cache plugins.', 'polylang' ),
25 34 'active_option' => $this->is_available() ? 'browser' : false,
26 35 )
27 36 );
28 37
@@ -57,8 +66,10 @@
57 66 * Displays the javascript to handle dynamically the change in url modifications
58 67 * as the preferred browser language is not used when the language is set from different domains
59 68 *
60 69 * @since 1.8
70 + *
71 + * @return void
61 72 */
62 73 public function print_js() {
63 74 wp_enqueue_script( 'jquery' );
64 75
@@ -75,19 +86,21 @@
75 86
76 87 ?>
77 88 <script type='text/javascript'>
78 89 //<![CDATA[
79 - ( function( $ ){
80 - $( "input[name='force_lang']" ).change( function() {
81 - var value = $( this ).val();
82 - if ( 3 > value ) {
83 - $( "#pll-module-browser" ).<?php echo $func; // phpcs:ignore WordPress.Security.EscapeOutput ?>.children( "td" ).children( ".row-actions" ).html( '<?php echo $link; // phpcs:ignore WordPress.Security.EscapeOutput ?>' );
84 - }
85 - else {
86 - $( "#pll-module-browser" ).removeClass( "active" ).addClass( "inactive" ).children( "td" ).children( ".row-actions" ).html( '<?php echo $deactivated; // phpcs:ignore WordPress.Security.EscapeOutput ?>' );
87 - }
88 - } );
89 - } )( jQuery );
90 + jQuery(
91 + function( $ ){
92 + $( "input[name='force_lang']" ).on( 'change', function() {
93 + var value = $( this ).val();
94 + if ( 3 > value ) {
95 + $( "#pll-module-browser" ).<?php echo $func; // phpcs:ignore WordPress.Security.EscapeOutput ?>.children( "td" ).children( ".row-actions" ).html( '<?php echo $link; // phpcs:ignore WordPress.Security.EscapeOutput ?>' );
96 + }
97 + else {
98 + $( "#pll-module-browser" ).removeClass( "active" ).addClass( "inactive" ).children( "td" ).children( ".row-actions" ).html( '<?php echo $deactivated; // phpcs:ignore WordPress.Security.EscapeOutput ?>' );
99 + }
100 + } );
101 + }
102 + );
90 103 // ]]>
91 104 </script>
92 105 <?php
93 106 }