| @@ -23,16 +23,18 @@ | ||
| 23 | 23 | * |
| 24 | 24 | * @param object $polylang polylang object |
| 25 | 25 | */ |
| 26 | 26 | public function __construct( &$polylang ) { |
| 27 | + // Needed for `$this->is_available()`, which is used before calling the parent's constructor. | |
| 27 | 28 | $this->options = &$polylang->options; |
| 29 | + | |
| 28 | 30 | parent::__construct( |
| 29 | 31 | $polylang, |
| 30 | 32 | array( |
| 31 | 33 | 'module' => 'browser', |
| 32 | 34 | 'title' => __( 'Detect browser language', 'polylang' ), |
| 33 | - 'description' => __( 'When the front page is visited, set the language according to the browser preference', 'polylang' ), | |
| 34 | - 'active_option' => $this->is_available() ? 'browser' : false, | |
| 35 | + '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' ), | |
| 36 | + 'active_option' => $this->is_available() ? 'browser' : 'none', | |
| 35 | 37 | ) |
| 36 | 38 | ); |
| 37 | 39 | |
| 38 | 40 | if ( ! class_exists( 'PLL_Xdata_Domain', true ) ) { |
| @@ -84,10 +86,9 @@ | ||
| 84 | 86 | |
| 85 | 87 | $deactivated = sprintf( '<span class="deactivated">%s</span>', $this->action_links['deactivated'] ); |
| 86 | 88 | |
| 87 | 89 | ?> |
| 88 | - <script type='text/javascript'> | |
| 89 | - //<![CDATA[ | |
| 90 | + <script> | |
| 90 | 91 | jQuery( |
| 91 | 92 | function( $ ){ |
| 92 | 93 | $( "input[name='force_lang']" ).on( 'change', function() { |
| 93 | 94 | var value = $( this ).val(); |
| @@ -99,9 +100,8 @@ | ||
| 99 | 100 | } |
| 100 | 101 | } ); |
| 101 | 102 | } |
| 102 | 103 | ); |
| 103 | - // ]]> | |
| 104 | 104 | </script> |
| 105 | 105 | <?php |
| 106 | 106 | } |
| 107 | 107 | } |