| @@ -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 |
| @@ -35,8 +32,15 @@ | ||
| 35 | 32 | */ |
| 36 | 33 | protected $modules; |
| 37 | 34 | |
| 38 | 35 | /** |
| 36 | + * Reference to PLL_Import_Export | |
| 37 | + * | |
| 38 | + * @var PLL_Import_Export $import_export | |
| 39 | + */ | |
| 40 | + protected $import_export; | |
| 41 | + | |
| 42 | + /** | |
| 39 | 43 | * Constructor |
| 40 | 44 | * |
| 41 | 45 | * @since 1.2 |
| 42 | 46 | * |
| @@ -50,8 +54,13 @@ | ||
| 50 | 54 | } |
| 51 | 55 | |
| 52 | 56 | PLL_Admin_Strings::init(); |
| 53 | 57 | |
| 58 | + if ( class_exists( 'PLL_Import_Export' ) ) { | |
| 59 | + $this->import_export = new PLL_Import_Export( $this ); | |
| 60 | + } | |
| 61 | + | |
| 62 | + // FIXME put this as late as possible | |
| 54 | 63 | add_action( 'admin_init', array( $this, 'register_settings_modules' ) ); |
| 55 | 64 | |
| 56 | 65 | // Adds screen options and the about box in the languages admin panel |
| 57 | 66 | add_action( 'load-toplevel_page_mlang', array( $this, 'load_page' ) ); |
| @@ -66,21 +75,28 @@ | ||
| 66 | 75 | * |
| 67 | 76 | * @since 1.8 |
| 68 | 77 | */ |
| 69 | 78 | public function register_settings_modules() { |
| 70 | - $modules = array(); | |
| 79 | + $modules = array( | |
| 80 | + 'PLL_Settings_Licenses', | |
| 81 | + ); | |
| 71 | 82 | |
| 72 | 83 | 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', | |
| 84 | + $modules = array_merge( | |
| 85 | + array( | |
| 86 | + 'PLL_Settings_Url', | |
| 87 | + 'PLL_Settings_Browser', | |
| 88 | + 'PLL_Settings_Media', | |
| 89 | + 'PLL_Settings_CPT', | |
| 90 | + 'PLL_Settings_Sync', | |
| 91 | + 'PLL_Settings_WPML', | |
| 92 | + 'PLL_Settings_Share_Slug', | |
| 93 | + 'PLL_Settings_Translate_Slugs', | |
| 94 | + ), | |
| 95 | + $modules | |
| 78 | 96 | ); |
| 79 | 97 | } |
| 80 | 98 | |
| 81 | - $modules[] = 'PLL_Settings_Licenses'; | |
| 82 | - | |
| 83 | 99 | /** |
| 84 | 100 | * Filter the list of setting modules |
| 85 | 101 | * |
| 86 | 102 | * @since 1.8 |
| @@ -100,9 +116,9 @@ | ||
| 100 | 116 | * |
| 101 | 117 | * @since 0.8 |
| 102 | 118 | */ |
| 103 | 119 | public function metabox_about() { |
| 104 | - include __DIR__ . '/view-about.php'; | |
| 120 | + include PLL_SETTINGS_INC . '/view-about.php'; | |
| 105 | 121 | } |
| 106 | 122 | |
| 107 | 123 | /** |
| 108 | 124 | * Adds screen options and the about box in the languages admin panel |
| @@ -311,9 +327,9 @@ | ||
| 311 | 327 | $this->handle_actions( $action ); |
| 312 | 328 | } |
| 313 | 329 | |
| 314 | 330 | // Displays the page |
| 315 | - include __DIR__ . '/view-languages.php'; | |
| 331 | + include PLL_SETTINGS_INC . '/view-languages.php'; | |
| 316 | 332 | } |
| 317 | 333 | |
| 318 | 334 | /** |
| 319 | 335 | * Enqueues scripts and styles |
| @@ -370,9 +386,9 @@ | ||
| 370 | 386 | */ |
| 371 | 387 | public static function get_predefined_languages() { |
| 372 | 388 | require_once ABSPATH . 'wp-admin/includes/translation-install.php'; |
| 373 | 389 | |
| 374 | - $languages = include __DIR__ . '/languages.php'; | |
| 390 | + $languages = include PLL_SETTINGS_INC . '/languages.php'; | |
| 375 | 391 | $translations = wp_get_available_translations(); |
| 376 | 392 | |
| 377 | 393 | // Keep only languages with existing WP language pack |
| 378 | 394 | // Unless the transient has expired and we don't have an internet connection to refresh it |