| @@ -1,5 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | +/** | |
| 3 | + * @package Polylang | |
| 4 | + */ | |
| 2 | 5 | |
| 3 | 6 | /** |
| 4 | 7 | * Polylang activation / de-activation class |
| 5 | 8 | * |
| @@ -10,8 +13,10 @@ | ||
| 10 | 13 | /** |
| 11 | 14 | * Checks min PHP and WP version, displays a notice if a requirement is not met. |
| 12 | 15 | * |
| 13 | 16 | * @since 2.6.7 |
| 17 | + * | |
| 18 | + * @return bool | |
| 14 | 19 | */ |
| 15 | 20 | public function can_activate() { |
| 16 | 21 | global $wp_version; |
| 17 | 22 | |
| @@ -31,11 +36,13 @@ | ||
| 31 | 36 | /** |
| 32 | 37 | * Displays a notice if PHP min version is not met. |
| 33 | 38 | * |
| 34 | 39 | * @since 2.6.7 |
| 40 | + * | |
| 41 | + * @return void | |
| 35 | 42 | */ |
| 36 | 43 | public function php_version_notice() { |
| 37 | - load_plugin_textdomain( 'polylang', false, basename( POLYLANG_DIR ) . '/languages' ); // Plugin i18n. | |
| 44 | + load_plugin_textdomain( 'polylang' ); // Plugin i18n. | |
| 38 | 45 | |
| 39 | 46 | printf( |
| 40 | 47 | '<div class="error"><p>%s</p></div>', |
| 41 | 48 | sprintf( |
| @@ -51,13 +58,15 @@ | ||
| 51 | 58 | /** |
| 52 | 59 | * Displays a notice if WP min version is not met. |
| 53 | 60 | * |
| 54 | 61 | * @since 2.6.7 |
| 62 | + * | |
| 63 | + * @return void | |
| 55 | 64 | */ |
| 56 | 65 | public function wp_version_notice() { |
| 57 | 66 | global $wp_version; |
| 58 | 67 | |
| 59 | - load_plugin_textdomain( 'polylang', false, basename( POLYLANG_DIR ) . '/languages' ); // Plugin i18n. | |
| 68 | + load_plugin_textdomain( 'polylang' ); // Plugin i18n. | |
| 60 | 69 | |
| 61 | 70 | printf( |
| 62 | 71 | '<div class="error"><p>%s</p></div>', |
| 63 | 72 | sprintf( |
| @@ -70,24 +79,24 @@ | ||
| 70 | 79 | ); |
| 71 | 80 | } |
| 72 | 81 | |
| 73 | 82 | /** |
| 74 | - * Get default Polylang options | |
| 83 | + * Get default Polylang options. | |
| 75 | 84 | * |
| 76 | 85 | * @since 1.8 |
| 77 | 86 | * |
| 78 | - * return array | |
| 87 | + * @return array | |
| 79 | 88 | */ |
| 80 | 89 | public static function get_default_options() { |
| 81 | 90 | return array( |
| 82 | - 'browser' => 1, // Default language for the front page is set by browser preference | |
| 83 | - 'rewrite' => 1, // Remove /language/ in permalinks ( was the opposite before 0.7.2 ) | |
| 84 | - 'hide_default' => 1, // Remove URL language information for default language ( was the opposite before 2.1.5 ) | |
| 85 | - 'force_lang' => 1, // Add URL language information ( was 0 before 1.7 ) | |
| 86 | - 'redirect_lang' => 0, // Do not redirect the language page to the homepage | |
| 87 | - 'media_support' => 1, // Support languages and translation for media by default | |
| 88 | - 'uninstall' => 0, // Do not remove data when uninstalling Polylang | |
| 89 | - 'sync' => array(), // Synchronisation is disabled by default ( was the opposite before 1.2 ) | |
| 91 | + 'browser' => 0, // Default language for the front page is not set by browser preference (was the opposite before 3.1). | |
| 92 | + 'rewrite' => 1, // Remove /language/ in permalinks (was the opposite before 0.7.2). | |
| 93 | + 'hide_default' => 1, // Remove URL language information for default language (was the opposite before 2.1.5). | |
| 94 | + 'force_lang' => 1, // Add URL language information (was 0 before 1.7). | |
| 95 | + 'redirect_lang' => 0, // Do not redirect the language page to the homepage. | |
| 96 | + 'media_support' => 0, // Do not support languages and translation for media by default (was the opposite before 3.1). | |
| 97 | + 'uninstall' => 0, // Do not remove data when uninstalling Polylang. | |
| 98 | + 'sync' => array(), // Synchronisation is disabled by default (was the opposite before 1.2). | |
| 90 | 99 | 'post_types' => array(), |
| 91 | 100 | 'taxonomies' => array(), |
| 92 | 101 | 'domains' => array(), |
| 93 | 102 | 'version' => POLYLANG_VERSION, |
| @@ -98,8 +107,10 @@ | ||
| 98 | 107 | /** |
| 99 | 108 | * Plugin activation |
| 100 | 109 | * |
| 101 | 110 | * @since 0.5 |
| 111 | + * | |
| 112 | + * @return void | |
| 102 | 113 | */ |
| 103 | 114 | protected function _activate() { |
| 104 | 115 | if ( $options = get_option( 'polylang' ) ) { |
| 105 | 116 | // Check if we will be able to upgrade |
| @@ -127,8 +138,10 @@ | ||
| 127 | 138 | /** |
| 128 | 139 | * Plugin deactivation |
| 129 | 140 | * |
| 130 | 141 | * @since 0.5 |
| 142 | + * | |
| 143 | + * @return void | |
| 131 | 144 | */ |
| 132 | 145 | protected function _deactivate() { |
| 133 | 146 | delete_option( 'rewrite_rules' ); // Don't use flush_rewrite_rules at network activation. See #32471 |
| 134 | 147 | } |