| @@ -1,14 +1,11 @@ | ||
| 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 |
| 9 | 6 | * |
| 10 | - * Properties: | |
| 7 | + * properties: | |
| 11 | 8 | * options => inherited, reference to Polylang options array |
| 12 | 9 | * model => inherited, reference to PLL_Model object |
| 13 | 10 | * links_model => inherited, reference to PLL_Links_Model object |
| 14 | 11 | * links => inherited, reference to PLL_Admin_Links 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 | * |
| @@ -44,21 +28,22 @@ | ||
| 44 | 28 | */ |
| 45 | 29 | public function __construct( &$links_model ) { |
| 46 | 30 | parent::__construct( $links_model ); |
| 47 | 31 | |
| 48 | - if ( isset( $_GET['page'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification | |
| 49 | - $this->active_tab = 'mlang' === $_GET['page'] ? 'lang' : substr( sanitize_key( $_GET['page'] ), 6 ); // phpcs:ignore WordPress.Security.NonceVerification | |
| 32 | + if ( isset( $_GET['page'] ) ) { | |
| 33 | + $this->active_tab = 'mlang' === $_GET['page'] ? 'lang' : substr( $_GET['page'], 6 ); | |
| 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 | - // Adds screen options and the about box in the languages admin panel | |
| 57 | - add_action( 'load-toplevel_page_mlang', array( $this, 'load_page' ) ); | |
| 58 | - add_action( 'load-languages_page_mlang_strings', array( $this, 'load_page_strings' ) ); | |
| 41 | + // adds screen options and the about box in the languages admin panel | |
| 42 | + add_action( 'load-toplevel_page_mlang', array( $this, 'load_page' ) ); | |
| 43 | + add_action( 'load-languages_page_mlang_strings', array( $this, 'load_page_strings' ) ); | |
| 59 | 44 | |
| 60 | - // Saves per-page value in screen option | |
| 45 | + // saves per-page value in screen option | |
| 61 | 46 | add_filter( 'set-screen-option', array( $this, 'set_screen_option' ), 10, 3 ); |
| 62 | 47 | } |
| 63 | 48 | |
| 64 | 49 | /** |
| @@ -66,21 +51,26 @@ | ||
| 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( | |
| 61 | + $modules = array_merge( array( | |
| 74 | 62 | 'PLL_Settings_Url', |
| 75 | 63 | 'PLL_Settings_Browser', |
| 76 | 64 | 'PLL_Settings_Media', |
| 77 | 65 | 'PLL_Settings_CPT', |
| 78 | - ); | |
| 66 | + 'PLL_Settings_Sync', | |
| 67 | + 'PLL_Settings_WPML', | |
| 68 | + 'PLL_Settings_Share_Slug', | |
| 69 | + 'PLL_Settings_Translate_Slugs', | |
| 70 | + ), $modules ); | |
| 79 | 71 | } |
| 80 | 72 | |
| 81 | - $modules[] = 'PLL_Settings_Licenses'; | |
| 82 | - | |
| 83 | 73 | /** |
| 84 | 74 | * Filter the list of setting modules |
| 85 | 75 | * |
| 86 | 76 | * @since 1.8 |
| @@ -100,9 +90,9 @@ | ||
| 100 | 90 | * |
| 101 | 91 | * @since 0.8 |
| 102 | 92 | */ |
| 103 | 93 | public function metabox_about() { |
| 104 | - include __DIR__ . '/view-about.php'; | |
| 94 | + include( PLL_SETTINGS_INC.'/view-about.php' ); | |
| 105 | 95 | } |
| 106 | 96 | |
| 107 | 97 | /** |
| 108 | 98 | * Adds screen options and the about box in the languages admin panel |
| @@ -114,21 +104,18 @@ | ||
| 114 | 104 | add_meta_box( |
| 115 | 105 | 'pll-about-box', |
| 116 | 106 | __( 'About Polylang', 'polylang' ), |
| 117 | 107 | array( $this, 'metabox_about' ), |
| 118 | - 'toplevel_page_mlang', | |
| 108 | + 'settings_page_mlang', // FIXME not shown in screen options | |
| 119 | 109 | 'normal' |
| 120 | 110 | ); |
| 121 | 111 | } |
| 122 | 112 | |
| 123 | - add_screen_option( | |
| 124 | - 'per_page', | |
| 125 | - array( | |
| 126 | - 'label' => __( 'Languages', 'polylang' ), | |
| 127 | - 'default' => 10, | |
| 128 | - 'option' => 'pll_lang_per_page', | |
| 129 | - ) | |
| 130 | - ); | |
| 113 | + add_screen_option( 'per_page', array( | |
| 114 | + 'label' => __( 'Languages', 'polylang' ), | |
| 115 | + 'default' => 10, | |
| 116 | + 'option' => 'pll_lang_per_page', | |
| 117 | + ) ); | |
| 131 | 118 | |
| 132 | 119 | add_action( 'admin_notices', array( $this, 'notice_objects_with_no_lang' ) ); |
| 133 | 120 | } |
| 134 | 121 | |
| @@ -137,16 +124,13 @@ | ||
| 137 | 124 | * |
| 138 | 125 | * @since 2.1 |
| 139 | 126 | */ |
| 140 | 127 | public function load_page_strings() { |
| 141 | - add_screen_option( | |
| 142 | - 'per_page', | |
| 143 | - array( | |
| 144 | - 'label' => __( 'Strings translations', 'polylang' ), | |
| 145 | - 'default' => 10, | |
| 146 | - 'option' => 'pll_strings_per_page', | |
| 147 | - ) | |
| 148 | - ); | |
| 128 | + add_screen_option( 'per_page', array( | |
| 129 | + 'label' => __( 'Strings translations', 'polylang' ), | |
| 130 | + 'default' => 10, | |
| 131 | + 'option' => 'pll_strings_per_page', | |
| 132 | + ) ); | |
| 149 | 133 | } |
| 150 | 134 | |
| 151 | 135 | /** |
| 152 | 136 | * Save the "Views/Uploads per page" option set by this user |
| @@ -152,11 +136,11 @@ | ||
| 152 | 136 | * Save the "Views/Uploads per page" option set by this user |
| 153 | 137 | * |
| 154 | 138 | * @since 0.9.5 |
| 155 | 139 | * |
| 156 | - * @param mixed $status false or value returned by previous filter | |
| 157 | - * @param string $option Name of the option being changed | |
| 158 | - * @param string $value Value of the option | |
| 140 | + * @param mixed $status false or value returned by previous filter | |
| 141 | + * @param string $option Name of the option being changed | |
| 142 | + * @param string $value Value of the option | |
| 159 | 143 | * |
| 160 | 144 | * @return string New value if this is our option, otherwise nothing |
| 161 | 145 | */ |
| 162 | 146 | public function set_screen_option( $status, $option, $value ) { |
| @@ -173,58 +157,39 @@ | ||
| 173 | 157 | public function handle_actions( $action ) { |
| 174 | 158 | switch ( $action ) { |
| 175 | 159 | case 'add': |
| 176 | 160 | check_admin_referer( 'add-lang', '_wpnonce_add-lang' ); |
| 177 | - $errors = $this->model->add_language( $_POST ); | |
| 178 | 161 | |
| 179 | - if ( is_wp_error( $errors ) ) { | |
| 180 | - foreach ( $errors->get_error_messages() as $message ) { | |
| 181 | - add_settings_error( 'general', 'pll_add_language', $message ); | |
| 162 | + if ( $this->model->add_language( $_POST ) && 'en_US' !== $_POST['locale'] ) { | |
| 163 | + // attempts to install the language pack | |
| 164 | + require_once( ABSPATH . 'wp-admin/includes/translation-install.php' ); | |
| 165 | + if ( ! wp_download_language_pack( $_POST['locale'] ) ) { | |
| 166 | + add_settings_error( 'general', 'pll_download_mo', __( 'The language was created, but the WordPress language file was not downloaded. Please install it manually.', 'polylang' ) ); | |
| 182 | 167 | } |
| 183 | - } else { | |
| 184 | - add_settings_error( 'general', 'pll_languages_created', __( 'Language added.', 'polylang' ), 'updated' ); | |
| 185 | - $locale = sanitize_text_field( wp_unslash( $_POST['locale'] ) ); // phpcs:ignore WordPress.Security | |
| 186 | 168 | |
| 187 | - if ( 'en_US' !== $locale && current_user_can( 'install_languages' ) ) { | |
| 188 | - // Attempts to install the language pack | |
| 189 | - require_once ABSPATH . 'wp-admin/includes/translation-install.php'; | |
| 190 | - if ( ! wp_download_language_pack( $locale ) ) { | |
| 191 | - add_settings_error( 'general', 'pll_download_mo', __( 'The language was created, but the WordPress language file was not downloaded. Please install it manually.', 'polylang' ) ); | |
| 192 | - } | |
| 193 | - | |
| 194 | - // Force checking for themes and plugins translations updates | |
| 195 | - wp_clean_themes_cache(); | |
| 196 | - wp_clean_plugins_cache(); | |
| 197 | - } | |
| 169 | + // force checking for themes and plugins translations updates | |
| 170 | + wp_clean_themes_cache(); | |
| 171 | + wp_clean_plugins_cache(); | |
| 198 | 172 | } |
| 199 | - self::redirect(); // To refresh the page ( possible thanks to the $_GET['noheader']=true ) | |
| 200 | - break; | |
| 173 | + self::redirect(); // to refresh the page ( possible thanks to the $_GET['noheader']=true ) | |
| 174 | + break; | |
| 201 | 175 | |
| 202 | 176 | case 'delete': |
| 203 | 177 | check_admin_referer( 'delete-lang' ); |
| 204 | 178 | |
| 205 | - if ( ! empty( $_GET['lang'] ) && $this->model->delete_language( (int) $_GET['lang'] ) ) { | |
| 206 | - add_settings_error( 'general', 'pll_languages_deleted', __( 'Language deleted.', 'polylang' ), 'updated' ); | |
| 179 | + if ( ! empty( $_GET['lang'] ) ) { | |
| 180 | + $this->model->delete_language( (int) $_GET['lang'] ); | |
| 207 | 181 | } |
| 208 | 182 | |
| 209 | - self::redirect(); // To refresh the page ( possible thanks to the $_GET['noheader']=true ) | |
| 210 | - break; | |
| 183 | + self::redirect(); // to refresh the page ( possible thanks to the $_GET['noheader']=true ) | |
| 184 | + break; | |
| 211 | 185 | |
| 212 | 186 | case 'update': |
| 213 | 187 | check_admin_referer( 'add-lang', '_wpnonce_add-lang' ); |
| 214 | - $errors = $this->model->update_language( $_POST ); | |
| 188 | + $error = $this->model->update_language( $_POST ); | |
| 189 | + self::redirect(); // to refresh the page ( possible thanks to the $_GET['noheader']=true ) | |
| 190 | + break; | |
| 215 | 191 | |
| 216 | - if ( is_wp_error( $errors ) ) { | |
| 217 | - foreach ( $errors->get_error_messages() as $message ) { | |
| 218 | - add_settings_error( 'general', 'pll_update_language', $message ); | |
| 219 | - } | |
| 220 | - } else { | |
| 221 | - add_settings_error( 'general', 'pll_languages_updated', __( 'Language updated.', 'polylang' ), 'updated' ); | |
| 222 | - } | |
| 223 | - | |
| 224 | - self::redirect(); // To refresh the page ( possible thanks to the $_GET['noheader']=true ) | |
| 225 | - break; | |
| 226 | - | |
| 227 | 192 | case 'default-lang': |
| 228 | 193 | check_admin_referer( 'default-lang' ); |
| 229 | 194 | |
| 230 | 195 | if ( $lang = $this->model->get_language( (int) $_GET['lang'] ) ) { |
| @@ -230,10 +195,10 @@ | ||
| 230 | 195 | if ( $lang = $this->model->get_language( (int) $_GET['lang'] ) ) { |
| 231 | 196 | $this->model->update_default_lang( $lang->slug ); |
| 232 | 197 | } |
| 233 | 198 | |
| 234 | - self::redirect(); // To refresh the page ( possible thanks to the $_GET['noheader']=true ) | |
| 235 | - break; | |
| 199 | + self::redirect(); // to refresh the page ( possible thanks to the $_GET['noheader']=true ) | |
| 200 | + break; | |
| 236 | 201 | |
| 237 | 202 | case 'content-default-lang': |
| 238 | 203 | check_admin_referer( 'content-default-lang' ); |
| 239 | 204 | |
| @@ -245,32 +210,22 @@ | ||
| 245 | 210 | $this->model->set_language_in_mass( 'term', $nolang['terms'], $this->options['default_lang'] ); |
| 246 | 211 | } |
| 247 | 212 | } |
| 248 | 213 | |
| 249 | - self::redirect(); // To refresh the page ( possible thanks to the $_GET['noheader']=true ) | |
| 250 | - break; | |
| 214 | + self::redirect(); // to refresh the page ( possible thanks to the $_GET['noheader']=true ) | |
| 215 | + break; | |
| 251 | 216 | |
| 252 | 217 | case 'activate': |
| 253 | 218 | check_admin_referer( 'pll_activate' ); |
| 254 | - if ( isset( $_GET['module'] ) ) { | |
| 255 | - $module = sanitize_key( $_GET['module'] ); | |
| 256 | - if ( isset( $this->modules[ $module ] ) ) { | |
| 257 | - $this->modules[ $module ]->activate(); | |
| 258 | - } | |
| 259 | - } | |
| 219 | + $this->modules[ $_GET['module'] ]->activate(); | |
| 260 | 220 | self::redirect(); |
| 261 | - break; | |
| 221 | + break; | |
| 262 | 222 | |
| 263 | 223 | case 'deactivate': |
| 264 | 224 | check_admin_referer( 'pll_deactivate' ); |
| 265 | - if ( isset( $_GET['module'] ) ) { | |
| 266 | - $module = sanitize_key( $_GET['module'] ); | |
| 267 | - if ( isset( $this->modules[ $module ] ) ) { | |
| 268 | - $this->modules[ $module ]->deactivate(); | |
| 269 | - } | |
| 270 | - } | |
| 225 | + $this->modules[ $_GET['module'] ]->deactivate(); | |
| 271 | 226 | self::redirect(); |
| 272 | - break; | |
| 227 | + break; | |
| 273 | 228 | |
| 274 | 229 | default: |
| 275 | 230 | /** |
| 276 | 231 | * Fires when a non default action has been sent to Polylang settings |
| @@ -277,15 +232,15 @@ | ||
| 277 | 232 | * |
| 278 | 233 | * @since 1.8 |
| 279 | 234 | */ |
| 280 | 235 | do_action( "mlang_action_$action" ); |
| 281 | - break; | |
| 236 | + break; | |
| 282 | 237 | } |
| 283 | 238 | } |
| 284 | 239 | |
| 285 | 240 | /** |
| 286 | 241 | * Displays the 3 tabs pages: languages, strings translations, settings |
| 287 | - * Also manages user input for these pages | |
| 242 | + * also manages user input for these pages | |
| 288 | 243 | * |
| 289 | 244 | * @since 0.1 |
| 290 | 245 | */ |
| 291 | 246 | public function languages_page() { |
| @@ -290,30 +245,29 @@ | ||
| 290 | 245 | */ |
| 291 | 246 | public function languages_page() { |
| 292 | 247 | switch ( $this->active_tab ) { |
| 293 | 248 | case 'lang': |
| 294 | - // Prepare the list table of languages | |
| 249 | + // prepare the list table of languages | |
| 295 | 250 | $list_table = new PLL_Table_Languages(); |
| 296 | 251 | $list_table->prepare_items( $this->model->get_languages_list() ); |
| 297 | - break; | |
| 252 | + break; | |
| 298 | 253 | |
| 299 | 254 | case 'strings': |
| 300 | 255 | $string_table = new PLL_Table_String( $this->model->get_languages_list() ); |
| 301 | 256 | $string_table->prepare_items(); |
| 302 | - break; | |
| 257 | + break; | |
| 303 | 258 | } |
| 304 | 259 | |
| 305 | - // Handle user input | |
| 306 | - $action = isset( $_REQUEST['pll_action'] ) ? sanitize_key( $_REQUEST['pll_action'] ) : ''; // phpcs:ignore WordPress.Security.NonceVerification | |
| 307 | - if ( 'edit' === $action && ! empty( $_GET['lang'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification | |
| 308 | - // phpcs:ignore WordPress.Security.NonceVerification, VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable | |
| 260 | + // handle user input | |
| 261 | + $action = isset( $_REQUEST['pll_action'] ) ? $_REQUEST['pll_action'] : ''; | |
| 262 | + if ( 'edit' === $action && ! empty( $_GET['lang'] ) ) { | |
| 309 | 263 | $edit_lang = $this->model->get_language( (int) $_GET['lang'] ); |
| 310 | 264 | } else { |
| 311 | 265 | $this->handle_actions( $action ); |
| 312 | 266 | } |
| 313 | 267 | |
| 314 | - // Displays the page | |
| 315 | - include __DIR__ . '/view-languages.php'; | |
| 268 | + // displays the page | |
| 269 | + include( PLL_SETTINGS_INC . '/view-languages.php' ); | |
| 316 | 270 | } |
| 317 | 271 | |
| 318 | 272 | /** |
| 319 | 273 | * Enqueues scripts and styles |
| @@ -322,11 +276,10 @@ | ||
| 322 | 276 | parent::admin_enqueue_scripts(); |
| 323 | 277 | |
| 324 | 278 | $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
| 325 | 279 | |
| 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 ); | |
| 280 | + 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 | 281 | 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 | 282 | |
| 330 | 283 | wp_enqueue_style( 'pll_selectmenu', plugins_url( '/css/selectmenu' . $suffix . '.css', POLYLANG_FILE ), array(), POLYLANG_VERSION ); |
| 331 | 284 | } |
| 332 | 285 | |
| @@ -335,13 +288,13 @@ | ||
| 335 | 288 | * |
| 336 | 289 | * @since 1.8 |
| 337 | 290 | */ |
| 338 | 291 | public function notice_objects_with_no_lang() { |
| 339 | - if ( ! empty( $this->options['default_lang'] ) && $this->model->get_objects_with_no_lang( 1 ) ) { | |
| 292 | + if ( ! empty( $this->options['default_lang'] ) && $this->model->get_objects_with_no_lang() ) { | |
| 340 | 293 | printf( |
| 341 | 294 | '<div class="error"><p>%s <a href="%s">%s</a></p></div>', |
| 342 | 295 | esc_html__( 'There are posts, pages, categories or tags without language.', 'polylang' ), |
| 343 | - esc_url( wp_nonce_url( '?page=mlang&pll_action=content-default-lang&noheader=true', 'content-default-lang' ) ), | |
| 296 | + wp_nonce_url( '?page=mlang&pll_action=content-default-lang&noheader=true', 'content-default-lang' ), | |
| 344 | 297 | esc_html__( 'You can set them all to the default language.', 'polylang' ) |
| 345 | 298 | ); |
| 346 | 299 | } |
| 347 | 300 | } |
| @@ -353,53 +306,14 @@ | ||
| 353 | 306 | * @since 1.5 |
| 354 | 307 | * |
| 355 | 308 | * @param array $args query arguments to add to the url |
| 356 | 309 | */ |
| 357 | - public static function redirect( $args = array() ) { | |
| 310 | + static public function redirect( $args = array() ) { | |
| 358 | 311 | if ( $errors = get_settings_errors() ) { |
| 359 | 312 | set_transient( 'settings_errors', $errors, 30 ); |
| 360 | 313 | $args['settings-updated'] = 1; |
| 361 | 314 | } |
| 362 | - // Remove possible 'pll_action' and 'lang' query args from the referer before redirecting | |
| 363 | - wp_safe_redirect( add_query_arg( $args, remove_query_arg( array( 'pll_action', 'lang' ), wp_get_referer() ) ) ); | |
| 315 | + // remove possible 'pll_action' and 'lang' query args from the referer before redirecting | |
| 316 | + wp_safe_redirect( add_query_arg( $args, remove_query_arg( array( 'pll_action', 'lang' ), wp_get_referer() ) ) ); | |
| 364 | 317 | exit; |
| 365 | - } | |
| 366 | - | |
| 367 | - /** | |
| 368 | - * Get the list of predefined languages | |
| 369 | - * | |
| 370 | - * @since 2.3 | |
| 371 | - */ | |
| 372 | - public static function get_predefined_languages() { | |
| 373 | - require_once ABSPATH . 'wp-admin/includes/translation-install.php'; | |
| 374 | - | |
| 375 | - $languages = include __DIR__ . '/languages.php'; | |
| 376 | - $translations = wp_get_available_translations(); | |
| 377 | - | |
| 378 | - // Keep only languages with existing WP language pack | |
| 379 | - // Unless the transient has expired and we don't have an internet connection to refresh it | |
| 380 | - if ( ! empty( $translations ) ) { | |
| 381 | - $translations['en_US'] = ''; // Languages packs don't include en_US | |
| 382 | - $languages = array_intersect_key( $languages, $translations ); | |
| 383 | - } | |
| 384 | - | |
| 385 | - /** | |
| 386 | - * Filter the list of predefined languages | |
| 387 | - * | |
| 388 | - * @since 1.7.10 | |
| 389 | - * @since 2.3 The languages arrays use associative keys instead of numerical keys | |
| 390 | - * @see https://github.com/polylang/polylang/blob/2.8.2/settings/languages.php the list of predefined languages | |
| 391 | - * | |
| 392 | - * @param array $languages | |
| 393 | - */ | |
| 394 | - $languages = apply_filters( 'pll_predefined_languages', $languages ); | |
| 395 | - | |
| 396 | - // Keep only languages with all necessary informations | |
| 397 | - foreach ( $languages as $k => $lang ) { | |
| 398 | - if ( ! isset( $lang['code'], $lang['locale'], $lang['name'], $lang['dir'], $lang['flag'] ) ) { | |
| 399 | - unset( $languages[ $k ] ); | |
| 400 | - } | |
| 401 | - } | |
| 402 | - | |
| 403 | - return $languages; | |
| 404 | 318 | } |
| 405 | 319 | } |