: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
/* var WPML_Language_Switcher $wpml_language_switcher */
global $sitepress, $sitepress_settings, $wpdb, $wpml_language_switcher;
if ( ! is_plugin_active( WPML_PLUGIN_BASENAME ) ) {
<h2><?php esc_html_e( 'Setup WPML', 'sitepress' ) ?></h2>
<div class="updated fade">
<p style="line-height:1.5"><?php esc_html_e( 'The WPML Multilingual CMS plugin is not currently enabled.', 'sitepress' ) ?></p>
<p style="line-height:1.5">
esc_html__( 'Please go to the %sPlugins%s page and enable the WPML Multilingual CMS plugin before trying to configure the plugin.', 'sitepress' ),
'<a href="plugins.php">', '</a>'
if ( isset( $_GET[ 'trop' ] ) ) {
require_once dirname( __FILE__ ) . '/edit-languages.php';
global $icl_edit_languages;
$flags_factory = new WPML_Flags_Factory( $wpdb );
$icl_edit_languages = new SitePress_EditLanguages( $flags_factory->create() );
$icl_edit_languages->render();
$sitepress_settings = get_option( 'icl_sitepress_settings' );
$setup_wizard_step = (int) $sitepress->get_setting( 'setup_wizard_step' );
$setup_complete = $sitepress->get_setting( 'setup_complete' );
$active_languages = $sitepress->get_active_languages();
$hidden_languages = $sitepress->get_setting( 'hidden_languages' );
$show_untranslated_blog_posts = $sitepress->get_setting( 'show_untranslated_blog_posts' );
$automatic_redirect = $sitepress->get_setting( 'automatic_redirect' );
$setting_urls = $sitepress->get_setting( 'urls' );
$existing_content_language_verified = $sitepress->get_setting( 'existing_content_language_verified' );
$language_negotiation_type = $sitepress->get_setting( 'language_negotiation_type' );
$seo = $sitepress->get_setting( 'seo' );
$default_language = $sitepress->get_default_language();
$all_languages = $sitepress->get_languages( $sitepress->get_admin_language() );
$default_language_details = false;
$wp_api = $sitepress->get_wp_api();
$should_hide_admin_language = $wp_api->version_compare_naked( get_bloginfo( 'version' ), '4.7', '>=' );
$encryptor = new WPML_Data_Encryptor();
$inactive_content = null;
if(!$existing_content_language_verified ){
// try to determine the blog language
if($blog_lang = get_option('WPLANG')){
$exp = explode('_',$blog_lang);
$blog_current_lang = $wpdb->get_var(
$wpdb->prepare("SELECT code FROM {$wpdb->prefix}icl_languages WHERE code= %s",
if(!$blog_current_lang && defined('WPLANG') && WPLANG != ''){
$blog_current_lang = $wpdb->get_var($wpdb->prepare("SELECT code FROM {$wpdb->prefix}icl_languages WHERE default_locale=%s", WPLANG));
$exp = explode('_',$blog_lang);
$blog_current_lang = $wpdb->get_var(
$wpdb->prepare("SELECT code FROM {$wpdb->prefix}icl_languages WHERE code= %s",
$blog_current_lang = 'en';
$languages = $sitepress->get_languages( $blog_current_lang, false, true, false, 'display_name' );
$languages = $sitepress->get_languages( $sitepress->get_admin_language(), false, true, false, 'display_name' );
foreach($active_languages as $lang){
if($lang['code'] != $default_language ){
$default_language_details = $sitepress->get_language_details( $default_language );
$inactive_content = new WPML_Inactive_Content( $wpdb, $sitepress->get_current_language() );
global $language_switcher_defaults, $language_switcher_defaults_alt;
$theme_wpml_config_file = WPML_Config::get_theme_wpml_config_file();
<?php $sitepress->noscript_notice() ?>
<?php if($setup_complete || SitePress_Setup::languages_table_is_complete()) { ?>
<div class="wrap wpml-settings-container<?php if( empty( $setup_complete ) ): ?> wpml-wizard<?php endif; ?>">
<h2><?php esc_html_e( 'Setup WPML', 'sitepress' ) ?></h2>
$compatibility_reports_args = array(
'plugin_uri' => 'http://wpml.org',
'plugin_site' => 'wpml.org',
'privacy_policy_url' => 'https://wpml.org/documentation/privacy-policy-and-gdpr-compliance/?utm_source=wpmlplugin&utm_campaign=compatibility-reporting&utm_medium=wpml-setup&utm_term=privacy-policy-and-gdpr-compliance',
'plugin_repository' => 'wpml',
if ( ! $sitepress->is_setup_complete() ) {
$wizard_progress = new WPML_Setup_Wizard_Progress( $setup_wizard_step, array(
1 => __( '1. Content language', 'sitepress' ),
2 => __( '2. Translation languages', 'sitepress' ),
3 => __( '3. Language switcher', 'sitepress' ),
4 => __( '4. Compatibility', 'sitepress' ),
5 => __( '5. Registration', 'sitepress' ),
$wizard_progress->render();
if ( ! $existing_content_language_verified || $setup_wizard_step <= 1 ): ?>
$setup_step = new WPML_Setup_Step_One_Menu( $sitepress );
echo $setup_step->render();
if(!empty( $setup_complete ) || $setup_wizard_step == 2): ?>
<?php if ( count( $active_languages ) > 1 ): ?>
<strong><?php esc_html_e( 'This screen contains the language settings for your site.', 'sitepress' ) ?></strong>
<ul class="wpml-navigation-links js-wpml-navigation-links">
$navigation_items = array(
'#lang-sec-11' => __( 'Theme and plugins reporting', 'sitepress' ),
'#lang-sec-1' => __( 'Site Languages', 'sitepress' ),
'#lang-sec-2' => __( 'Language URL format', 'sitepress' ),
'#lang-sec-4' => __( 'Admin language', 'sitepress' ),
'#lang-sec-7' => __( 'Hide languages', 'sitepress' ),
'#lang-sec-8' => __( 'Make themes work multilingual', 'sitepress' ),
'#lang-sec-9' => __( 'Browser language redirect', 'sitepress' ),
'#lang-sec-9-5' => __( 'SEO Options', 'sitepress' ),
'#cookie' => __( 'Language filtering for AJAX operations', 'sitepress' ),
'#lang-sec-10' => __( 'WPML love', 'sitepress' ),
if( $should_hide_admin_language && array_key_exists( '#lang-sec-4', $navigation_items ) ) {
unset( $navigation_items['#lang-sec-4'] );
* @param array $navigation_items
$navigation_items = apply_filters( 'wpml_admin_languages_navigation_items', $navigation_items );
foreach ( $navigation_items as $link => $text ) {
echo '<li><a href="' . esc_attr( $link ) . '">' . esc_html( $text ) . '</a></li>';
<div class="wpml-section wpml-section-wpml-theme-and-plugins-reporting" id="lang-sec-11">
<div class="wpml-section-header">
<h3><?php esc_html_e( 'Reporting to wpml.org', 'sitepress' ) ?></h3>
<div class="wpml-section-content">
$compatibility_reports_after_setup_args = $compatibility_reports_args;
$compatibility_reports_after_setup_args['custom_heading'] = '';
$compatibility_reports_after_setup_args['use_radio'] = false;
do_action( 'otgs_installer_render_local_components_setting', $compatibility_reports_after_setup_args );
<div id="lang-sec-1" class="wpml-section wpml-section-languages">
<div class="wpml-section-header">
<h3><?php _e('Site Languages', 'sitepress') ?></h3>
<div class="wpml-section-content">
<div class="wpml-section-content-inner">
<?php if(!empty( $setup_complete )): ?>
<h4><?php _e('These languages are enabled for this site:','sitepress'); ?></h4>
<?php do_action( 'wpml_before_active_languages_display' ); ?>
<ul id="icl_enabled_languages" class="enabled-languages">
<?php foreach($active_languages as $lang): $is_default = ( $default_language ==$lang['code']); ?>
if(!empty( $hidden_languages ) && in_array($lang['code'], $hidden_languages )){
$hidden = ' <strong style="color:#f00">(' . esc_html__( 'hidden', 'sitepress' ) . ')</strong>';
<li <?php if($is_default):?>class="selected"<?php endif;?>>
<input id="default_language_<?php echo esc_attr( $lang['code'] ) ?>"
name="default_language" type="radio"
value="<?php echo esc_attr( $lang['code'] ) ?>" <?php checked( $is_default ) ?> />
<label for="default_language_<?php echo esc_attr( $lang['code'] ) ?>">
<?php echo esc_html( $lang['display_name'] ) . $hidden ?>
<?php if ( $is_default ): ?>(<?php esc_html_e( 'default', 'sitepress' ) ?>)<?php endif ?>
<?php do_action( 'wpml_after_active_languages_display' ); ?>
<p class="wpml-wizard-instruction">
<?php esc_html_e( 'Select the languages to enable for your site (you can also add and remove languages later).', 'sitepress' ) ?>
<?php wp_nonce_field('wpml_set_default_language', 'set_default_language_nonce'); ?>
<button id="icl_cancel_default_button" class="button-secondary action"><?php esc_html_e( 'Cancel', 'sitepress' ) ?></button>
<button id="icl_save_default_button" class="button-primary action"><?php esc_html_e( 'Save', 'sitepress' ) ?></button>
<?php if(!empty( $setup_complete )): ?>
<button id="icl_change_default_button" class="button-secondary action <?php if(count($active_languages) < 2): ?>hidden<?php endif ?>">
<?php esc_html_e( 'Change default language', 'sitepress' ) ?>
<button id="icl_add_remove_button" class="button-secondary action">
<?php esc_html_e( 'Add / Remove languages', 'sitepress' ) ?>
<p class="icl_ajx_response" id="icl_ajx_response"></p>
<div id="icl_avail_languages_picker" class="<?php if( !empty( $setup_complete ) ) echo 'hidden'; ?>">
<ul class="available-languages">
foreach ( $languages as $lang ) {
$checked = checked( '1', $lang['active'], false );
$disabled = disabled( $default_language, $lang['code'], false );
$language_item_classes = array();
if ( (bool) $lang['active'] ) {
$language_item_classes[] = 'wpml-selected';
<li class="<?php echo implode( ' ', $language_item_classes ); ?>">
<label for="wpml-language-<?php echo $lang['code'] ?>">
<input type="checkbox" id="wpml-language-<?php echo esc_attr( $lang['code'] ) ?>"
value="<?php echo esc_attr( $lang['code'] ) ?>" <?php echo $checked . ' ' . $disabled; ?>/>
<img src="<?php echo $sitepress->get_flag_url( $lang['code'] ) ?>" width="18" height="12">
<?php echo esc_html( $lang['display_name'] ) ?>
<?php if(!empty( $setup_complete )): ?>
<input id="icl_cancel_language_selection" type="button" class="button-secondary action"
value="<?php esc_attr_e( 'Cancel', 'sitepress' ) ?>" />
<input id="icl_save_language_selection" type="button" class="button-primary action"
value="<?php esc_attr_e( 'Save', 'sitepress' ) ?>" />
<?php wp_nonce_field('wpml_set_active_languages', 'set_active_languages_nonce'); ?>
<?php if (!empty( $setup_complete )): ?>
<a href="admin.php?page=<?php echo WPML_PLUGIN_FOLDER ?>/menu/languages.php&trop=1">
<?php esc_html_e( 'Edit Languages', 'sitepress' ) ?>
</div> <!-- wpml-section-content-inner -->
<?php if ( $setup_complete && $inactive_content && $inactive_content->has_entries() ) : ?>
<div class="wpml-section-content-inner">
$render_inactive_content = new WPML_Inactive_Content_Render(
array( WPML_PLUGIN_PATH . '/templates/languages/' )
echo $render_inactive_content->render();
</div> <!-- wpml-section-content-inner -->
<?php if ( 2 === (int) $setup_wizard_step ): ?>
<footer class="clearfix text-right">
<input id="icl_setup_back_1" class="button-secondary alignleft" name="save" value="<?php esc_attr_e( 'Back', 'sitepress' ) ?>" type="button" />
<?php wp_nonce_field('setup_got_to_step1_nonce', '_icl_nonce_gts1'); ?>
<input id="icl_setup_next_1" class="button-primary alignright" name="save"
value="<?php esc_attr_e( 'Next', 'sitepress' ) ?>" type="button"
<?php disabled( count( $active_languages ) < 2 ) ?> />
</div> <!-- .wcml-section-content -->
</div> <!-- .wpml-section-languages -->
<?php elseif ( $setup_wizard_step === 4 ): ?>
<div class="wpml-section wpml-section-wpml-theme-and-plugins-reporting" id="lang-sec-compatibility">
<div class="wpml-section-header">
<?php esc_html_e( 'Compatibility reporting', 'sitepress' ); ?>
<div class="wpml-section-content">
<p class="wpml-wizard-instruction">
<?php esc_html_e( 'The WPML plugin can send a list of active plugins and theme used in your site to wpml.org. This allows our support team to help you much faster and to contact you in advance about potential compatibility problems and their solutions.',
$compatibility_reports_before_setup_args = $compatibility_reports_args;
$compatibility_reports_before_setup_args['use_radio'] = true;
do_action( 'otgs_installer_render_local_components_setting', $compatibility_reports_before_setup_args );
<footer class="clearfix text-right">
<input id="icl_setup_back_3"
class="button-secondary alignleft"
value="<?php esc_attr_e( 'Back', 'sitepress' ) ?>"
<?php wp_nonce_field( 'setup_got_to_step3_nonce', '_icl_nonce_gts3' ); ?>
<input id="icl_setup_next_5" class="button-primary alignright" name="save"
value="<?php esc_attr_e( 'Next', 'sitepress' ) ?>" type="button"
<?php wp_nonce_field( 'setup_got_to_step5_nonce', '_icl_nonce_gts5' ); ?>
elseif ( $setup_wizard_step === 5 ): ?>
<?php $site_key = WP_Installer()->get_site_key('wpml'); ?>
<div class="wpml-section" id="lang-sec-0">
<div class="wpml-section-header">
<h3><?php esc_html_e( 'Registration', 'sitepress' ) ?></h3>
<div class="wpml-section-content">
<?php if(is_multisite() && !empty($site_key)): ?>
<p class="wpml-wizard-instruction"><?php esc_html_e( 'WPML is already registered network-wide.', 'sitepress' ) ?></p>
<footer class="clearfix text-right">
<form id="installer_registration_form">
<input type="hidden" name="action" value="installer_save_key" />
<input type="hidden" name="button_action" value="installer_save_key" />
<input <?php if(empty($site_key)): ?>style="display: none;"<?php endif; ?> class="button-primary button-large"
name="finish" value="<?php esc_attr_e( 'Finish', 'sitepress' ) ?>" type="submit" />
<?php wp_nonce_field('registration_form_submit_nonce', '_icl_nonce'); ?>
<p class="wpml-wizard-instruction">
<?php esc_html_e( 'Enter the site key, from your wpml.org account, to receive automatic updates for WPML on this site.', 'sitepress' ) ?>
<form id="installer_registration_form">
<input type="hidden" name="action" value="installer_save_key" />
<input type="hidden" name="button_action" value="installer_save_key" />
<label for="installer_site_key">
<?php esc_html_e( 'Site key:', 'sitepress' ) ?>
<input type="text" name="installer_site_key" value="<?php echo esc_attr( $site_key ) ?>" <?php disabled( ! empty( $site_key ) ) ?> />
<div class="status_msg<?php if ( ! empty( $site_key ) ): ?> icl_valid_text<?php endif; ?>">
esc_html_e( 'Thank you for registering WPML on this site. You will receive automatic updates when new versions are available.', 'sitepress' );
<?php if ( empty( $site_key ) ): ?>
<input class="button-primary" name="register" value="<?php esc_attr_e( 'Register', 'sitepress' ) ?>" type="submit" />
<input class="button-secondary" name="later" value="<?php esc_attr_e( 'Remind me later', 'sitepress' ) ?>" type="submit" />
<input <?php if(empty($site_key)): ?>style="display: none;"<?php endif; ?> class="button-primary button-large button" name="finish"
value="<?php esc_attr_e( 'Finish', 'sitepress' ) ?>" type="submit" />
<?php wp_nonce_field('registration_form_submit_nonce', '_icl_nonce'); ?>
<?php if(empty($site_key)): ?>
<hr class="wpml-margin-top-base">
esc_html__( "Don't have a key for this site? %sGenerate a key for this site%s", 'sitepress' ),
'<a class="button-primary" href="https://wpml.org/my-account/sites/?add=' . urlencode( get_site_url() ) . '" target="_blank">', '</a>'
esc_html__( "If you don't have a WPML.org account or a valid subscription, you can %spurchase%s one and get later upgrades, full support and 30 days money-back guarantee.", 'sitepress' ),
'<a href="http://wpml.org/purchase/" target="_blank">', '</a>'
<?php if(!empty( $setup_complete )): ?>
if ( !class_exists ( 'WP_Http' ) ) {
include_once ABSPATH . WPINC . '/class-http.php';
* @var WPML_URL_Converter $wpml_url_converter
* @var WPML_Request $wpml_request_handler
global $wpml_url_converter, $wpml_request_handler;
$validator = wpml_get_langs_in_dirs_val ( new WP_Http(), $wpml_url_converter );
<?php if(count($active_languages) > 1): ?>
<div class="wpml-section wpml-section-url-format" id="lang-sec-2">
<div class="wpml-section-header">
<h3><?php esc_html_e( 'Language URL format', 'sitepress' ) ?></h3>
<div class="wpml-section-content">
<h4><?php esc_html_e( 'Choose how to determine which language visitors see contents in', 'sitepress' ) ?></h4>
<form id="icl_save_language_negotiation_type" name="icl_save_language_negotiation_type" action="">
<?php wp_nonce_field('save_language_negotiation_type', 'save_language_negotiation_type_nonce') ?>
$abs_home = $wpml_url_converter->get_abs_home();
$icl_folder_url_disabled = $validator->validate_langs_in_dirs ( $sample_lang['code'] );
<input type="radio" name="icl_language_negotiation_type" value="1" <?php checked( 1 == $language_negotiation_type ) ?> />
<?php esc_html_e( 'Different languages in directories', 'sitepress' ) ?>
<span class="explanation-text">
$root = !empty( $setting_urls['directory_for_default_language']);
echo $validator->print_explanation( $sample_lang['code'], $root );?>)
<div id="icl_use_directory_wrap" style="<?php if( $language_negotiation_type != 1): ?>display:none;<?php endif; ?>" >
<input type="checkbox" name="use_directory" id="icl_use_directory" value="1"
<?php checked( ! empty( $setting_urls['directory_for_default_language'] ) ) ?> />
<?php esc_html_e( 'Use directory for default language', 'sitepress' ) ?>
<div id="icl_use_directory_details" class="sub-section" <?php if(empty( $setting_urls['directory_for_default_language'])) echo ' style="display:none"' ?> >
<p><?php esc_html_e( 'What to show for the root url:', 'sitepress' ) ?></p>
<label for="wpml_show_on_root_html_file">
<input id="wpml_show_on_root_html_file" type="radio" name="show_on_root"
value="html_file" <?php checked( 'html_file' === $setting_urls['show_on_root'] ) ?> />
<?php esc_html_e( 'HTML file', 'sitepress' ) ?> –
<span class="explanation-text">
<?php esc_html_e( 'please enter path: absolute or relative to the WordPress installation folder', 'sitepress' ) ?>
<input type="text" id="root_html_file_path" name="root_html_file_path" value="<?php echo esc_attr( $setting_urls['root_html_file_path'] ) ?>" />
<label class="icl_error_text icl_error_1" for="root_html_file_path" style="display: none;">
<?php esc_html_e( 'Please select what to show for the root url.', 'sitepress' ) ?>
<input id="wpml_show_on_root_page" type="radio" name="show_on_root" value="page"
<?php checked( 'page' === $setting_urls['show_on_root'] ) ?>
<?php if($setting_urls['show_on_root'] === 'page'):?>class="active"<?php endif; ?>
<?php esc_html_e( 'A page', 'sitepress' ) ?>