| @@ -1,8 +1,5 @@ | ||
| 1 | 1 | <?php |
| 2 | -/** | |
| 3 | - * @package Polylang | |
| 4 | - */ | |
| 5 | 2 | |
| 6 | 3 | /** |
| 7 | 4 | * Settings class for browser language preference detection |
| 8 | 5 | * |
| @@ -8,14 +5,8 @@ | ||
| 8 | 5 | * |
| 9 | 6 | * @since 1.8 |
| 10 | 7 | */ |
| 11 | 8 | class PLL_Settings_Browser extends PLL_Settings_Module { |
| 12 | - /** | |
| 13 | - * Stores the display order priority. | |
| 14 | - * | |
| 15 | - * @var int | |
| 16 | - */ | |
| 17 | - public $priority = 20; | |
| 18 | 9 | |
| 19 | 10 | /** |
| 20 | 11 | * Constructor |
| 21 | 12 | * |
| @@ -23,18 +14,14 @@ | ||
| 23 | 14 | * |
| 24 | 15 | * @param object $polylang polylang object |
| 25 | 16 | */ |
| 26 | 17 | public function __construct( &$polylang ) { |
| 27 | - $this->options = &$polylang->options; | |
| 28 | - parent::__construct( | |
| 29 | - $polylang, | |
| 30 | - array( | |
| 31 | - 'module' => 'browser', | |
| 32 | - '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 | - ) | |
| 36 | - ); | |
| 18 | + parent::__construct( $polylang, array( | |
| 19 | + 'module' => 'browser', | |
| 20 | + 'title' => __( 'Detect browser language', 'polylang' ), | |
| 21 | + 'description' => __( 'When the front page is visited, set the language according to the browser preference', 'polylang' ), | |
| 22 | + 'active_option' => $this->is_available() ? 'browser' : false, | |
| 23 | + ) ); | |
| 37 | 24 | |
| 38 | 25 | if ( ! class_exists( 'PLL_Xdata_Domain', true ) ) { |
| 39 | 26 | add_action( 'admin_print_footer_scripts', array( $this, 'print_js' ) ); |
| 40 | 27 | } |
| @@ -84,21 +71,19 @@ | ||
| 84 | 71 | |
| 85 | 72 | ?> |
| 86 | 73 | <script type='text/javascript'> |
| 87 | 74 | //<![CDATA[ |
| 88 | - jQuery( | |
| 89 | - function( $ ){ | |
| 90 | - $( "input[name='force_lang']" ).on( 'change', function() { | |
| 91 | - var value = $( this ).val(); | |
| 92 | - if ( 3 > value ) { | |
| 93 | - $( "#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 ?>' ); | |
| 94 | - } | |
| 95 | - else { | |
| 96 | - $( "#pll-module-browser" ).removeClass( "active" ).addClass( "inactive" ).children( "td" ).children( ".row-actions" ).html( '<?php echo $deactivated; // phpcs:ignore WordPress.Security.EscapeOutput ?>' ); | |
| 97 | - } | |
| 98 | - } ); | |
| 99 | - } | |
| 100 | - ); | |
| 75 | + ( function( $ ){ | |
| 76 | + $( "input[name='force_lang']" ).change( function() { | |
| 77 | + var value = $( this ).val(); | |
| 78 | + if ( 3 > value ) { | |
| 79 | + $( "#pll-module-browser" ).<?php echo $func; ?>.children( "td" ).children( ".row-actions" ).html( '<?php echo $link; ?>' ); | |
| 80 | + } | |
| 81 | + else { | |
| 82 | + $( "#pll-module-browser" ).removeClass( "active" ).addClass( "inactive" ).children( "td" ).children( ".row-actions" ).html( '<?php echo $deactivated; ?>' ); | |
| 83 | + } | |
| 84 | + } ); | |
| 85 | + } )( jQuery ); | |
| 101 | 86 | // ]]> |
| 102 | 87 | </script> |
| 103 | 88 | <?php |
| 104 | 89 | } |