PluginProbe
Polylang / 3.1
Polylang v3.1
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 +40 -21 2.93.1 View file →
@@ -3,36 +3,30 @@
3 3 * @package Polylang
4 4 */
5 5
6 6 /**
7 - * A class for the Polylang settings pages
8 - * accessible in $polylang global object
7 + * A class for the Polylang settings pages, accessible from @see PLL().
9 8 *
10 - * Properties:
11 - * options => inherited, reference to Polylang options array
12 - * model => inherited, reference to PLL_Model object
13 - * links_model => inherited, reference to PLL_Links_Model object
14 - * links => inherited, reference to PLL_Admin_Links object
15 - * static_pages => inherited, reference to PLL_Admin_Static_Pages object
16 - * filters_links => inherited, reference to PLL_Filters_Links object
17 - * curlang => inherited, optional, current language used to filter admin content
18 - * pref_lang => inherited, preferred language used as default when saving posts or terms
19 - *
20 9 * @since 1.2
21 10 */
22 11 class PLL_Settings extends PLL_Admin_Base {
23 12
24 13 /**
25 - * Name of the active module
14 + * @var PLL_Admin_Model
15 + */
16 + public $model;
17 +
18 + /**
19 + * Name of the active module.
26 20 *
27 - * @var string $active_tab
21 + * @var string
28 22 */
29 23 protected $active_tab;
30 24
31 25 /**
32 - * Array of modules classes
26 + * Array of modules classes.
33 27 *
34 - * @var array $modules
28 + * @var PLL_Settings_Module[]
35 29 */
36 30 protected $modules;
37 31
38 32 /**
@@ -39,9 +33,9 @@
39 33 * Constructor
40 34 *
41 35 * @since 1.2
42 36 *
43 - * @param object $links_model
37 + * @param PLL_Links_Model $links_model Reference to the links model.
44 38 */
45 39 public function __construct( &$links_model ) {
46 40 parent::__construct( $links_model );
47 41
@@ -64,8 +58,10 @@
64 58 /**
65 59 * Initializes the modules
66 60 *
67 61 * @since 1.8
62 + *
63 + * @return void
68 64 */
69 65 public function register_settings_modules() {
70 66 $modules = array();
71 67
@@ -98,8 +94,10 @@
98 94 /**
99 95 * Loads the about metabox
100 96 *
101 97 * @since 0.8
98 + *
99 + * @return void
102 100 */
103 101 public function metabox_about() {
104 102 include __DIR__ . '/view-about.php';
105 103 }
@@ -107,8 +105,10 @@
107 105 /**
108 106 * Adds screen options and the about box in the languages admin panel
109 107 *
110 108 * @since 0.9.5
109 + *
110 + * @return void
111 111 */
112 112 public function load_page() {
113 113 if ( ! defined( 'PLL_DISPLAY_ABOUT' ) || PLL_DISPLAY_ABOUT ) {
114 114 add_meta_box(
@@ -135,8 +135,10 @@
135 135 /**
136 136 * Adds screen options in the strings translations admin panel
137 137 *
138 138 * @since 2.1
139 + *
140 + * @return void
139 141 */
140 142 public function load_page_strings() {
141 143 add_screen_option(
142 144 'per_page',
@@ -168,8 +170,9 @@
168 170 *
169 171 * @since 1.9
170 172 *
171 173 * @param string $action
174 + * @return void
172 175 */
173 176 public function handle_actions( $action ) {
174 177 switch ( $action ) {
175 178 case 'add':
@@ -286,8 +289,10 @@
286 289 * Displays the 3 tabs pages: languages, strings translations, settings
287 290 * Also manages user input for these pages
288 291 *
289 292 * @since 0.1
293 + *
294 + * @return void
290 295 */
291 296 public function languages_page() {
292 297 switch ( $this->active_tab ) {
293 298 case 'lang':
@@ -316,8 +321,10 @@
316 321 }
317 322
318 323 /**
319 324 * Enqueues scripts and styles
325 + *
326 + * @return void
320 327 */
321 328 public function admin_enqueue_scripts() {
322 329 parent::admin_enqueue_scripts();
323 330
@@ -322,13 +329,12 @@
322 329 parent::admin_enqueue_scripts();
323 330
324 331 $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
325 332
326 - 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 - 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' ) );
333 + wp_enqueue_script( 'pll_admin', plugins_url( '/js/build/admin' . $suffix . '.js', POLYLANG_ROOT_FILE ), array( 'jquery', 'wp-ajax-response', 'postbox', 'jquery-ui-selectmenu' ), POLYLANG_VERSION, true );
334 + wp_localize_script( 'pll_admin', 'pll_admin', array( 'dismiss_notice' => esc_html__( 'Dismiss this notice.', 'polylang' ) ) );
329 335
330 - wp_enqueue_style( 'pll_selectmenu', plugins_url( '/css/selectmenu' . $suffix . '.css', POLYLANG_FILE ), array(), POLYLANG_VERSION );
336 + wp_enqueue_style( 'pll_selectmenu', plugins_url( '/css/build/selectmenu' . $suffix . '.css', POLYLANG_ROOT_FILE ), array(), POLYLANG_VERSION );
331 337 }
332 338
333 339 /**
334 340 * Displays a notice when there are objects with no language assigned
@@ -333,8 +339,10 @@
333 339 /**
334 340 * Displays a notice when there are objects with no language assigned
335 341 *
336 342 * @since 1.8
343 + *
344 + * @return void
337 345 */
338 346 public function notice_objects_with_no_lang() {
339 347 if ( ! empty( $this->options['default_lang'] ) && $this->model->get_objects_with_no_lang( 1 ) ) {
340 348 printf(
@@ -352,8 +360,9 @@
352 360 *
353 361 * @since 1.5
354 362 *
355 363 * @param array $args query arguments to add to the url
364 + * @return void
356 365 */
357 366 public static function redirect( $args = array() ) {
358 367 if ( $errors = get_settings_errors() ) {
359 368 set_transient( 'settings_errors', $errors, 30 );
@@ -367,8 +376,18 @@
367 376 /**
368 377 * Get the list of predefined languages
369 378 *
370 379 * @since 2.3
380 + *
381 + * @return string[] {
382 + * @type string $code ISO 639-1 language code.
383 + * @type string $locale WordPress locale.
384 + * @type string $name Native language name.
385 + * @type string $dir Text direction: 'ltr' or 'rtl'.
386 + * @type string $flag Flag code, generally the country code.
387 + * @type string $w3c W3C locale.
388 + * @type string $facebook Facebook locale.
389 + * }
371 390 */
372 391 public static function get_predefined_languages() {
373 392 require_once ABSPATH . 'wp-admin/includes/translation-install.php';
374 393