get_active_languages() ); $settings = array(); foreach ( $active_languages as $lang ) { $settings[ $lang ] = 'on' === $REQUEST[ $lang ] ? WPMLLanguageStatus::VISIBLE : WPMLLanguageStatus::HIDDEN; } update_option( 'fb_wmpl_language_visibility', $settings, false ); self::$settings = $settings; } } /** * Prints the content for Facebook Visibility section. * * The section is shown at the bottom of the WPML > Languages settings page. */ public function wpml_support() { /** @var SitePress $sitepress */ global $sitepress; // there is no nonce to check here and the value of $_GET['page] is being compared against a known and safe string // phpcs:ignore WordPress.Security.NonceVerification.Recommended if ( isset( $_GET['page'] ) && false !== strpos( esc_url_raw( wp_unslash( $_GET['page'] ) ), 'languages.php' ) ) { /** @var array $active_languages */ $active_languages = $sitepress->get_active_languages(); $settings = get_option( self::OPTION ); // Default setting is only show default lang. if ( ! $settings ) { $settings = array_fill_keys( array_keys( $active_languages ), WPMLLanguageStatus::HIDDEN ); if ( self::$default_lang ) { $settings[ self::$default_lang ] = WPMLLanguageStatus::VISIBLE; } } // Count how many languages are currently set to VISIBLE $visible_languages_count = count( array_filter( $settings, function ( $status ) { return WPMLLanguageStatus::VISIBLE === $status; } ) ); // Check if user has legacy multi-language setup (2+ languages visible) $has_legacy_setup = $visible_languages_count >= 2; // Don't show the section at all for new/eligible users if ( ! $has_legacy_setup ) { return; } ?>