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