PluginProbe
Polylang / 2.6.2
Polylang v2.6.2
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.php +24 -33 2.8.22.6.2 View file →
@@ -1,8 +1,5 @@
1 1 <?php
2 -/**
3 - * @package Polylang
4 - */
5 2
6 3 /**
7 4 * A class for the Polylang settings pages
8 5 * accessible in $polylang global object
@@ -19,24 +16,11 @@
19 16 *
20 17 * @since 1.2
21 18 */
22 19 class PLL_Settings extends PLL_Admin_Base {
20 + protected $active_tab, $modules;
23 21
24 22 /**
25 - * Name of the active module
26 - *
27 - * @var string $active_tab
28 - */
29 - protected $active_tab;
30 -
31 - /**
32 - * Array of modules classes
33 - *
34 - * @var array $modules
35 - */
36 - protected $modules;
37 -
38 - /**
39 23 * Constructor
40 24 *
41 25 * @since 1.2
42 26 *
@@ -50,8 +34,9 @@
50 34 }
51 35
52 36 PLL_Admin_Strings::init();
53 37
38 + // FIXME put this as late as possible
54 39 add_action( 'admin_init', array( $this, 'register_settings_modules' ) );
55 40
56 41 // Adds screen options and the about box in the languages admin panel
57 42 add_action( 'load-toplevel_page_mlang', array( $this, 'load_page' ) );
@@ -66,21 +51,29 @@
66 51 *
67 52 * @since 1.8
68 53 */
69 54 public function register_settings_modules() {
70 - $modules = array();
55 + $modules = array(
56 + 'PLL_Settings_Tools',
57 + 'PLL_Settings_Licenses',
58 + );
71 59
72 60 if ( $this->model->get_languages_list() ) {
73 - $modules = array(
74 - 'PLL_Settings_Url',
75 - 'PLL_Settings_Browser',
76 - 'PLL_Settings_Media',
77 - 'PLL_Settings_CPT',
61 + $modules = array_merge(
62 + array(
63 + 'PLL_Settings_Url',
64 + 'PLL_Settings_Browser',
65 + 'PLL_Settings_Media',
66 + 'PLL_Settings_CPT',
67 + 'PLL_Settings_Sync',
68 + 'PLL_Settings_WPML',
69 + 'PLL_Settings_Share_Slug',
70 + 'PLL_Settings_Translate_Slugs',
71 + ),
72 + $modules
78 73 );
79 74 }
80 75
81 - $modules[] = 'PLL_Settings_Licenses';
82 -
83 76 /**
84 77 * Filter the list of setting modules
85 78 *
86 79 * @since 1.8
@@ -100,9 +93,9 @@
100 93 *
101 94 * @since 0.8
102 95 */
103 96 public function metabox_about() {
104 - include __DIR__ . '/view-about.php';
97 + include PLL_SETTINGS_INC . '/view-about.php';
105 98 }
106 99
107 100 /**
108 101 * Adds screen options and the about box in the languages admin panel
@@ -114,9 +107,9 @@
114 107 add_meta_box(
115 108 'pll-about-box',
116 109 __( 'About Polylang', 'polylang' ),
117 110 array( $this, 'metabox_about' ),
118 - 'toplevel_page_mlang',
111 + 'settings_page_mlang', // FIXME not shown in screen options
119 112 'normal'
120 113 );
121 114 }
122 115
@@ -304,16 +297,15 @@
304 297
305 298 // Handle user input
306 299 $action = isset( $_REQUEST['pll_action'] ) ? sanitize_key( $_REQUEST['pll_action'] ) : ''; // phpcs:ignore WordPress.Security.NonceVerification
307 300 if ( 'edit' === $action && ! empty( $_GET['lang'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
308 - // phpcs:ignore WordPress.Security.NonceVerification, WordPressVIPMinimum.Variables.VariableAnalysis.UnusedVariable
309 - $edit_lang = $this->model->get_language( (int) $_GET['lang'] );
301 + $edit_lang = $this->model->get_language( (int) $_GET['lang'] ); // phpcs:ignore WordPress.Security.NonceVerification
310 302 } else {
311 303 $this->handle_actions( $action );
312 304 }
313 305
314 306 // Displays the page
315 - include __DIR__ . '/view-languages.php';
307 + include PLL_SETTINGS_INC . '/view-languages.php';
316 308 }
317 309
318 310 /**
319 311 * Enqueues scripts and styles
@@ -324,9 +316,8 @@
324 316 $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
325 317
326 318 wp_enqueue_script( 'pll_admin', plugins_url( '/js/admin' . $suffix . '.js', POLYLANG_FILE ), array( 'jquery', 'wp-ajax-response', 'postbox', 'jquery-ui-selectmenu' ), POLYLANG_VERSION );
327 319 wp_localize_script( 'pll_admin', 'pll_flag_base_url', plugins_url( '/flags/', POLYLANG_FILE ) );
328 - wp_localize_script( 'pll_admin', 'pll_dismiss_notice', esc_html__( 'Dismiss this notice.', 'polylang' ) );
329 320
330 321 wp_enqueue_style( 'pll_selectmenu', plugins_url( '/css/selectmenu' . $suffix . '.css', POLYLANG_FILE ), array(), POLYLANG_VERSION );
331 322 }
332 323
@@ -368,12 +359,12 @@
368 359 * Get the list of predefined languages
369 360 *
370 361 * @since 2.3
371 362 */
372 - public static function get_predefined_languages() {
363 + public function get_predefined_languages() {
373 364 require_once ABSPATH . 'wp-admin/includes/translation-install.php';
374 365
375 - $languages = include __DIR__ . '/languages.php';
366 + $languages = include PLL_SETTINGS_INC . '/languages.php';
376 367 $translations = wp_get_available_translations();
377 368
378 369 // Keep only languages with existing WP language pack
379 370 // Unless the transient has expired and we don't have an internet connection to refresh it