Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/sitepres.../res/js
File: languages.js
/*jslint browser: true, nomen: true, laxbreak: true*/
[0] Fix | Delete
/*global ajaxurl, iclSaveForm, iclSaveForm_success_cb, jQuery, alert, confirm, icl_ajx_url, icl_ajx_saved, icl_ajxloaderimg, icl_default_mark, icl_ajx_error, fadeInAjxResp */
[1] Fix | Delete
[2] Fix | Delete
(function () {
[3] Fix | Delete
"use strict";
[4] Fix | Delete
[5] Fix | Delete
jQuery(document).ready(function(){
[6] Fix | Delete
var icl_hide_languages;
[7] Fix | Delete
[8] Fix | Delete
var compatibilityNextButton = jQuery('#icl_setup_next_5');
[9] Fix | Delete
var installerComponentSetting = jQuery('.otgs-installer-component-setting');
[10] Fix | Delete
var hasCheckedValue = installerComponentSetting.find('input[type="radio"]:checked').length === 1;
[11] Fix | Delete
[12] Fix | Delete
compatibilityNextButton.prop('disabled', !hasCheckedValue);
[13] Fix | Delete
installerComponentSetting
[14] Fix | Delete
.find('input[type="radio"]')
[15] Fix | Delete
.click(function () {
[16] Fix | Delete
compatibilityNextButton.prop('disabled', false);
[17] Fix | Delete
});
[18] Fix | Delete
[19] Fix | Delete
jQuery('.toggle:checkbox').click(iclHandleToggle);
[20] Fix | Delete
jQuery('#icl_change_default_button').click(editingDefaultLanguage);
[21] Fix | Delete
jQuery('#icl_save_default_button').click(saveDefaultLanguage);
[22] Fix | Delete
jQuery('#icl_cancel_default_button').click(doneEditingDefaultLanguage);
[23] Fix | Delete
jQuery('#icl_add_remove_button').click(showLanguagePicker);
[24] Fix | Delete
jQuery('#icl_cancel_language_selection').click(hideLanguagePicker);
[25] Fix | Delete
jQuery('#icl_save_language_selection').click(saveLanguageSelection);
[26] Fix | Delete
jQuery('#icl_enabled_languages').find('input').attr('disabled', 'disabled');
[27] Fix | Delete
jQuery('#icl_save_language_negotiation_type').submit(iclSaveLanguageNegotiationType);
[28] Fix | Delete
jQuery('#icl_admin_language_options').submit(iclSaveForm);
[29] Fix | Delete
jQuery('#icl_lang_more_options').submit(iclSaveForm);
[30] Fix | Delete
jQuery('#icl_blog_posts').submit(iclSaveForm);
[31] Fix | Delete
icl_hide_languages = jQuery('#icl_hide_languages');
[32] Fix | Delete
icl_hide_languages.submit(iclHideLanguagesCallback);
[33] Fix | Delete
icl_hide_languages.submit(iclSaveForm);
[34] Fix | Delete
jQuery('#icl_adjust_ids').submit(iclSaveForm);
[35] Fix | Delete
jQuery('#icl_automatic_redirect').submit(iclSaveForm);
[36] Fix | Delete
jQuery('#icl_automatic_redirect input[name="icl_automatic_redirect"]').on('click', function() {
[37] Fix | Delete
var $redirect_warn = jQuery(this).parents('#icl_automatic_redirect').find('.js-redirect-warning');
[38] Fix | Delete
if (0 != jQuery(this).val()) {
[39] Fix | Delete
$redirect_warn.fadeIn();
[40] Fix | Delete
} else {
[41] Fix | Delete
$redirect_warn.fadeOut();
[42] Fix | Delete
}
[43] Fix | Delete
});
[44] Fix | Delete
jQuery('input[name="icl_language_negotiation_type"]').change(iclLntDomains);
[45] Fix | Delete
jQuery('#icl_use_directory').change(iclUseDirectoryToggle);
[46] Fix | Delete
[47] Fix | Delete
jQuery('input[name="show_on_root"]').change(iclToggleShowOnRoot);
[48] Fix | Delete
jQuery('#wpml_show_page_on_root_details').find('a').click(function () {
[49] Fix | Delete
if (!jQuery('#wpml_show_on_root_page').hasClass('active')) {
[50] Fix | Delete
alert(jQuery('#wpml_show_page_on_root_x').html());
[51] Fix | Delete
return false;
[52] Fix | Delete
}
[53] Fix | Delete
});
[54] Fix | Delete
[55] Fix | Delete
jQuery('#icl_seo_options').submit(iclSaveForm);
[56] Fix | Delete
jQuery('#icl_seo_head_langs').on('click', update_seo_head_langs_priority);
[57] Fix | Delete
jQuery('#icl_setup_back_1').click({step: '1'}, iclSetupStep);
[58] Fix | Delete
jQuery('#icl_setup_back_2').click({step: '2'}, iclSetupStep);
[59] Fix | Delete
jQuery('#icl_setup_back_3').click({step: "3"}, iclSetupStep);
[60] Fix | Delete
compatibilityNextButton.click({step: "5"}, iclSetupStep);
[61] Fix | Delete
[62] Fix | Delete
function iclSetupStep(event) {
[63] Fix | Delete
var step = event.data.step;
[64] Fix | Delete
jQuery.ajax({
[65] Fix | Delete
type: "POST",
[66] Fix | Delete
url: icl_ajx_url,
[67] Fix | Delete
data: "icl_ajx_action=setup_got_to_step" + step + "&_icl_nonce=" + jQuery('#_icl_nonce_gts' + step).val(),
[68] Fix | Delete
success: function () {
[69] Fix | Delete
location.href = location.href.replace(/#[\w\W]*/, '');
[70] Fix | Delete
}
[71] Fix | Delete
});
[72] Fix | Delete
[73] Fix | Delete
return false;
[74] Fix | Delete
}
[75] Fix | Delete
[76] Fix | Delete
jQuery('#icl_setup_next_1').click(saveLanguageSelection);
[77] Fix | Delete
[78] Fix | Delete
jQuery('#icl_avail_languages_picker').find('li input:checkbox').click(function () {
[79] Fix | Delete
if (jQuery('#icl_avail_languages_picker').find('li input:checkbox:checked').length > 1) {
[80] Fix | Delete
jQuery('#icl_setup_next_1').removeAttr('disabled');
[81] Fix | Delete
} else {
[82] Fix | Delete
jQuery('#icl_setup_next_1').attr('disabled', 'disabled');
[83] Fix | Delete
}
[84] Fix | Delete
});
[85] Fix | Delete
[86] Fix | Delete
jQuery('#icl_promote_form').submit(iclSaveForm);
[87] Fix | Delete
[88] Fix | Delete
jQuery('#icl_reset_languages').click(icl_reset_languages);
[89] Fix | Delete
[90] Fix | Delete
jQuery(':radio[name=icl_translation_option]').change(function () {
[91] Fix | Delete
jQuery('#icl_enable_content_translation').removeAttr('disabled');
[92] Fix | Delete
});
[93] Fix | Delete
jQuery('#icl_enable_content_translation, .icl_noenable_content_translation').click(iclEnableContentTranslation);
[94] Fix | Delete
[95] Fix | Delete
jQuery(document).on('submit', '#installer_registration_form', installer_registration_form_submit);
[96] Fix | Delete
jQuery(document).on('click', '#installer_registration_form :submit', function(){
[97] Fix | Delete
jQuery('#installer_registration_form').find('input[name=button_action]').val(jQuery(this).attr('name'));
[98] Fix | Delete
});
[99] Fix | Delete
[100] Fix | Delete
manageWizardButtonStatesSpinner();
[101] Fix | Delete
[102] Fix | Delete
jQuery(document).on('click', '#sso_information', function (e) {
[103] Fix | Delete
e.preventDefault();
[104] Fix | Delete
jQuery('#language_per_domain_sso_description').dialog({
[105] Fix | Delete
modal: true,
[106] Fix | Delete
width: 'auto',
[107] Fix | Delete
height: 'auto'
[108] Fix | Delete
});
[109] Fix | Delete
});
[110] Fix | Delete
});
[111] Fix | Delete
[112] Fix | Delete
function manageWizardButtonStatesSpinner(){
[113] Fix | Delete
var buttons = jQuery( '#icl_setup_back_1, #icl_setup_next_1, #icl_setup_back_2' );
[114] Fix | Delete
var submit_buttons = jQuery( '#icl_initial_language .buttons-wrap .button-primary, #icl_setup_back_2, #icl_setup_nav_3 .button-primary, #installer_registration_form div .button-primary' );
[115] Fix | Delete
var forms = jQuery( '#icl_initial_language, #wpml-ls-settings-form, #installer_registration_form' );
[116] Fix | Delete
var spinner = jQuery( '<span class="spinner"></span>' );
[117] Fix | Delete
var spinner_location = '#icl_initial_language .buttons-wrap input, #icl_setup_back_1, #icl_setup_back_2, #icl_save_language_switcher_options, #installer_registration_form div .button-primary:visible';
[118] Fix | Delete
[119] Fix | Delete
spinner.insertBefore( spinner_location );
[120] Fix | Delete
[121] Fix | Delete
jQuery( forms ).submit(function(){
[122] Fix | Delete
spinner.addClass( 'is-active' );
[123] Fix | Delete
jQuery( submit_buttons ).attr( 'disabled', 'disabled' );
[124] Fix | Delete
});
[125] Fix | Delete
[126] Fix | Delete
jQuery( buttons ).click(function(){
[127] Fix | Delete
spinner.addClass( 'is-active' );
[128] Fix | Delete
buttons.attr( 'disabled', 'disabled');
[129] Fix | Delete
});
[130] Fix | Delete
}
[131] Fix | Delete
[132] Fix | Delete
function iclHandleToggle() {
[133] Fix | Delete
/* jshint validthis: true */
[134] Fix | Delete
var self = this;
[135] Fix | Delete
var toggleElement = jQuery(self);
[136] Fix | Delete
var toggle_value_name = toggleElement.data('toggle_value_name');
[137] Fix | Delete
var toggle_value_checked = toggleElement.data('toggle_checked_value');
[138] Fix | Delete
var toggle_value_unchecked = toggleElement.data('toggle_unchecked_value');
[139] Fix | Delete
var toggle_value = jQuery('[name="' + toggle_value_name + '"]');
[140] Fix | Delete
if (toggle_value.length === 0) {
[141] Fix | Delete
toggle_value = jQuery('<input type="hidden" name="' + toggle_value_name + '">');
[142] Fix | Delete
toggle_value.insertAfter(self);
[143] Fix | Delete
}
[144] Fix | Delete
if (toggleElement.is(':checked')) {
[145] Fix | Delete
toggle_value.val(toggle_value_checked);
[146] Fix | Delete
} else {
[147] Fix | Delete
toggle_value.val(toggle_value_unchecked);
[148] Fix | Delete
}
[149] Fix | Delete
}
[150] Fix | Delete
[151] Fix | Delete
function editingDefaultLanguage() {
[152] Fix | Delete
jQuery('#icl_change_default_button').hide();
[153] Fix | Delete
jQuery('#icl_save_default_button').show();
[154] Fix | Delete
jQuery('#icl_cancel_default_button').show();
[155] Fix | Delete
var enabled_languages = jQuery('#icl_enabled_languages').find('input');
[156] Fix | Delete
enabled_languages.show();
[157] Fix | Delete
enabled_languages.prop('disabled', false);
[158] Fix | Delete
jQuery('#icl_add_remove_button').hide();
[159] Fix | Delete
[160] Fix | Delete
}
[161] Fix | Delete
function doneEditingDefaultLanguage() {
[162] Fix | Delete
jQuery('#icl_change_default_button').show();
[163] Fix | Delete
jQuery('#icl_save_default_button').hide();
[164] Fix | Delete
jQuery('#icl_cancel_default_button').hide();
[165] Fix | Delete
var enabled_languages = jQuery('#icl_enabled_languages').find('input');
[166] Fix | Delete
enabled_languages.hide();
[167] Fix | Delete
enabled_languages.prop('disabled', true);
[168] Fix | Delete
jQuery('#icl_add_remove_button').show();
[169] Fix | Delete
}
[170] Fix | Delete
[171] Fix | Delete
function saveDefaultLanguage() {
[172] Fix | Delete
var enabled_languages, arr, def_lang;
[173] Fix | Delete
enabled_languages = jQuery('#icl_enabled_languages');
[174] Fix | Delete
arr = enabled_languages.find('input[type="radio"]');
[175] Fix | Delete
def_lang = '';
[176] Fix | Delete
jQuery.each(arr, function () {
[177] Fix | Delete
if (this.checked) {
[178] Fix | Delete
def_lang = this.value;
[179] Fix | Delete
}
[180] Fix | Delete
});
[181] Fix | Delete
jQuery.ajax({
[182] Fix | Delete
type: "POST",
[183] Fix | Delete
url: ajaxurl,
[184] Fix | Delete
data: {
[185] Fix | Delete
'action': 'wpml_set_default_language',
[186] Fix | Delete
'nonce': jQuery('#set_default_language_nonce').val(),
[187] Fix | Delete
'language': def_lang
[188] Fix | Delete
},
[189] Fix | Delete
success: function (response) {
[190] Fix | Delete
if (response.success) {
[191] Fix | Delete
var enabled_languages_items, spl, selected_language, avail_languages_picker, selected_language_item;
[192] Fix | Delete
selected_language = enabled_languages.find('li input[value="' + def_lang + '"]');
[193] Fix | Delete
[194] Fix | Delete
fadeInAjxResp(icl_ajx_saved);
[195] Fix | Delete
avail_languages_picker = jQuery('#icl_avail_languages_picker');
[196] Fix | Delete
avail_languages_picker.find('input[value="' + response.data.previousLanguage + '"]').prop('disabled', false);
[197] Fix | Delete
avail_languages_picker.find('input[value="' + def_lang + '"]').prop('disabled', true);
[198] Fix | Delete
enabled_languages_items = jQuery('#icl_enabled_languages').find('li');
[199] Fix | Delete
enabled_languages_items.removeClass('selected');
[200] Fix | Delete
selected_language_item = selected_language.closest('li');
[201] Fix | Delete
selected_language_item.addClass('selected');
[202] Fix | Delete
selected_language_item.find('label').append(' (' + icl_default_mark + ')');
[203] Fix | Delete
enabled_languages_items.find('input').removeAttr('checked');
[204] Fix | Delete
selected_language.attr('checked', 'checked');
[205] Fix | Delete
enabled_languages.find('input[value="' + response.data.previousLanguage + '"]').parent().html(enabled_languages.find('input[value="' + response.data.previousLanguage + '"]').parent().html().replace('(' + icl_default_mark + ')', ''));
[206] Fix | Delete
doneEditingDefaultLanguage();
[207] Fix | Delete
fadeInAjxResp('#icl_ajx_response', icl_ajx_saved);
[208] Fix | Delete
location.href = location.href.replace(/#[\w\W]*/, '') + '&setup=2';
[209] Fix | Delete
} else {
[210] Fix | Delete
fadeInAjxResp('#icl_ajx_response', icl_ajx_error);
[211] Fix | Delete
}
[212] Fix | Delete
}
[213] Fix | Delete
});
[214] Fix | Delete
}
[215] Fix | Delete
function showLanguagePicker() {
[216] Fix | Delete
jQuery('#icl_avail_languages_picker').slideDown();
[217] Fix | Delete
jQuery('#icl_add_remove_button').hide();
[218] Fix | Delete
jQuery('#icl_change_default_button').hide();
[219] Fix | Delete
}
[220] Fix | Delete
function hideLanguagePicker() {
[221] Fix | Delete
jQuery('#icl_avail_languages_picker').slideUp();
[222] Fix | Delete
jQuery('#icl_add_remove_button').fadeIn();
[223] Fix | Delete
jQuery('#icl_change_default_button').fadeIn();
[224] Fix | Delete
}
[225] Fix | Delete
function saveLanguageSelection() {
[226] Fix | Delete
fadeInAjxResp('#icl_ajx_response', icl_ajxloaderimg);
[227] Fix | Delete
var arr = jQuery('#icl_avail_languages_picker').find('ul input[type="checkbox"]'), sel_lang = [];
[228] Fix | Delete
jQuery.each(arr, function () {
[229] Fix | Delete
if (this.checked) {
[230] Fix | Delete
sel_lang.push(this.value);
[231] Fix | Delete
}
[232] Fix | Delete
});
[233] Fix | Delete
jQuery.ajax({
[234] Fix | Delete
type: "POST",
[235] Fix | Delete
url: ajaxurl,
[236] Fix | Delete
data: {
[237] Fix | Delete
'action': 'wpml_set_active_languages',
[238] Fix | Delete
'nonce': jQuery('#set_active_languages_nonce').val(),
[239] Fix | Delete
'languages': sel_lang
[240] Fix | Delete
},
[241] Fix | Delete
success: function (response) {
[242] Fix | Delete
if (response.success) {
[243] Fix | Delete
if (!response.data.noLanguages) {
[244] Fix | Delete
fadeInAjxResp('#icl_ajx_response', icl_ajx_saved);
[245] Fix | Delete
jQuery('#icl_enabled_languages').html(response.data.enabledLanguages);
[246] Fix | Delete
location.href = location.href.replace(/#[\w\W]*/, '');
[247] Fix | Delete
} else {
[248] Fix | Delete
location.href = location.href.replace(/(#|&)[\w\W]*/, '');
[249] Fix | Delete
}
[250] Fix | Delete
} else {
[251] Fix | Delete
fadeInAjxResp('#icl_ajx_response', icl_ajx_error, true);
[252] Fix | Delete
location.href = location.href.replace(/(#|&)[\w\W]*/, '');
[253] Fix | Delete
}
[254] Fix | Delete
}
[255] Fix | Delete
});
[256] Fix | Delete
hideLanguagePicker();
[257] Fix | Delete
}
[258] Fix | Delete
[259] Fix | Delete
function iclLntDomains() {
[260] Fix | Delete
var language_negotiation_type, icl_lnt_domains_box, icl_lnt_domains_options, icl_lnt_xdomain_options;
[261] Fix | Delete
icl_lnt_domains_box = jQuery('#icl_lnt_domains_box');
[262] Fix | Delete
icl_lnt_domains_options = jQuery('#icl_lnt_domains');
[263] Fix | Delete
icl_lnt_xdomain_options = jQuery('#language_domain_xdomain_options');
[264] Fix | Delete
[265] Fix | Delete
if (icl_lnt_domains_options.attr('checked')) {
[266] Fix | Delete
icl_lnt_domains_box.html(icl_ajxloaderimg);
[267] Fix | Delete
icl_lnt_domains_box.show();
[268] Fix | Delete
language_negotiation_type = jQuery('#icl_save_language_negotiation_type').find('input[type="submit"]');
[269] Fix | Delete
language_negotiation_type.prop('disabled', true);
[270] Fix | Delete
jQuery.ajax({
[271] Fix | Delete
type: "POST",
[272] Fix | Delete
url: icl_ajx_url,
[273] Fix | Delete
data: 'icl_ajx_action=language_domains' + '&_icl_nonce=' + jQuery('#_icl_nonce_ldom').val(),
[274] Fix | Delete
success: function (resp) {
[275] Fix | Delete
icl_lnt_domains_box.html(resp);
[276] Fix | Delete
language_negotiation_type.prop('disabled', false);
[277] Fix | Delete
icl_lnt_xdomain_options.show();
[278] Fix | Delete
}
[279] Fix | Delete
});
[280] Fix | Delete
} else if (icl_lnt_domains_box.length) {
[281] Fix | Delete
icl_lnt_domains_box.fadeOut('fast');
[282] Fix | Delete
icl_lnt_xdomain_options.fadeOut('fast');
[283] Fix | Delete
}
[284] Fix | Delete
/*jshint validthis: true */
[285] Fix | Delete
if (jQuery(this).val() !== "1") {
[286] Fix | Delete
jQuery('#icl_use_directory_wrap').hide();
[287] Fix | Delete
} else {
[288] Fix | Delete
jQuery('#icl_use_directory_wrap').fadeIn();
[289] Fix | Delete
}
[290] Fix | Delete
[291] Fix | Delete
[292] Fix | Delete
}
[293] Fix | Delete
[294] Fix | Delete
function iclToggleShowOnRoot() {
[295] Fix | Delete
/*jshint validthis: true */
[296] Fix | Delete
if (jQuery(this).val() === 'page') {
[297] Fix | Delete
jQuery('#wpml_show_page_on_root_details').fadeIn();
[298] Fix | Delete
jQuery('#icl_hide_language_switchers').fadeIn();
[299] Fix | Delete
} else {
[300] Fix | Delete
jQuery('#wpml_show_page_on_root_details').fadeOut();
[301] Fix | Delete
jQuery('#icl_hide_language_switchers').fadeOut();
[302] Fix | Delete
}
[303] Fix | Delete
}
[304] Fix | Delete
[305] Fix | Delete
function iclUseDirectoryToggle() {
[306] Fix | Delete
if (jQuery(this).attr('checked')) {
[307] Fix | Delete
jQuery('#icl_use_directory_details').fadeIn();
[308] Fix | Delete
} else {
[309] Fix | Delete
jQuery('#icl_use_directory_details').fadeOut();
[310] Fix | Delete
}
[311] Fix | Delete
}
[312] Fix | Delete
[313] Fix | Delete
function iclSaveLanguageNegotiationType() {
[314] Fix | Delete
var validSettings = true;
[315] Fix | Delete
var ajaxResponse;
[316] Fix | Delete
var usedUrls;
[317] Fix | Delete
var formErrors;
[318] Fix | Delete
var formName;
[319] Fix | Delete
[320] Fix | Delete
var languageNegotiationType;
[321] Fix | Delete
var rootHtmlFile;
[322] Fix | Delete
var showOnRoot;
[323] Fix | Delete
var useDirectories;
[324] Fix | Delete
var validatedDomains;
[325] Fix | Delete
var domainsToValidateCount;
[326] Fix | Delete
var domainsToValidate;
[327] Fix | Delete
var validDomains;
[328] Fix | Delete
[329] Fix | Delete
var form = jQuery('#icl_save_language_negotiation_type');
[330] Fix | Delete
[331] Fix | Delete
var useDirectoryWrapper = jQuery('#icl_use_directory_wrap');
[332] Fix | Delete
languageNegotiationType = parseInt(form.find('input[name=icl_language_negotiation_type]:checked').val());
[333] Fix | Delete
useDirectoryWrapper.find('.icl_error_text').hide();
[334] Fix | Delete
[335] Fix | Delete
formName = form.attr('name');
[336] Fix | Delete
formErrors = false;
[337] Fix | Delete
usedUrls = [jQuery('#icl_ln_home').html()];
[338] Fix | Delete
jQuery('form[name="' + formName + '"] .icl_form_errors').html('').hide();
[339] Fix | Delete
ajaxResponse = jQuery('form[name="' + formName + '"] .icl_ajx_response').attr('id');
[340] Fix | Delete
fadeInAjxResp('#' + ajaxResponse, icl_ajxloaderimg);
[341] Fix | Delete
[342] Fix | Delete
if (1 === languageNegotiationType) {
[343] Fix | Delete
useDirectories = form.find('[name=use_directory]').is(':checked');
[344] Fix | Delete
showOnRoot = form.find('[name=show_on_root]:checked').val();
[345] Fix | Delete
rootHtmlFile = form.find('[name=root_html_file_path]').val();
[346] Fix | Delete
[347] Fix | Delete
if (useDirectories) {
[348] Fix | Delete
if ('html' === showOnRoot && !rootHtmlFile) {
[349] Fix | Delete
validSettings = false;
[350] Fix | Delete
useDirectoryWrapper.find('.icl_error_text.icl_error_1').fadeIn();
[351] Fix | Delete
}
[352] Fix | Delete
}
[353] Fix | Delete
[354] Fix | Delete
if(true === validSettings) {
[355] Fix | Delete
saveLanguageForm();
[356] Fix | Delete
}
[357] Fix | Delete
}
[358] Fix | Delete
[359] Fix | Delete
if (3 === languageNegotiationType) {
[360] Fix | Delete
saveLanguageForm();
[361] Fix | Delete
}
[362] Fix | Delete
[363] Fix | Delete
if (2 === languageNegotiationType) {
[364] Fix | Delete
domainsToValidate = jQuery('.validate_language_domain');
[365] Fix | Delete
domainsToValidateCount = domainsToValidate.length;
[366] Fix | Delete
validatedDomains = 0;
[367] Fix | Delete
validDomains = 0;
[368] Fix | Delete
[369] Fix | Delete
if (0 < domainsToValidateCount) {
[370] Fix | Delete
domainsToValidate.filter(':visible').each(function (index, element) {
[371] Fix | Delete
var languageDomainURL;
[372] Fix | Delete
var domainValidationCheckbox = jQuery(element);
[373] Fix | Delete
var langDomainInput, lang, languageDomain;
[374] Fix | Delete
lang = domainValidationCheckbox.attr('value');
[375] Fix | Delete
languageDomain = jQuery('.spinner.spinner-' + lang);
[376] Fix | Delete
langDomainInput = jQuery('#language_domain_' + lang);
[377] Fix | Delete
var validation = new WpmlDomainValidation(langDomainInput, domainValidationCheckbox);
[378] Fix | Delete
validation.run();
[379] Fix | Delete
var subdirMatches = langDomainInput.parent().html().match(/<code>\/(.+)<\/code>/);
[380] Fix | Delete
languageDomainURL = langDomainInput.parent().html().match(/<code>(.+)<\/code>/)[1] + langDomainInput.val() + '/' + ( subdirMatches !== null ? subdirMatches[1] : '' );
[381] Fix | Delete
if (domainValidationCheckbox.prop('checked')) {
[382] Fix | Delete
languageDomain.addClass('is-active');
[383] Fix | Delete
if (-1 !== usedUrls.indexOf(languageDomainURL)) {
[384] Fix | Delete
languageDomain.empty();
[385] Fix | Delete
formErrors = true;
[386] Fix | Delete
} else {
[387] Fix | Delete
usedUrls.push(languageDomainURL);
[388] Fix | Delete
langDomainInput.css('color', '#000');
[389] Fix | Delete
jQuery.ajax({
[390] Fix | Delete
method: "POST",
[391] Fix | Delete
url: ajaxurl,
[392] Fix | Delete
data: {
[393] Fix | Delete
url: languageDomainURL,
[394] Fix | Delete
action: 'validate_language_domain',
[395] Fix | Delete
nonce: jQuery('#validate_language_domain_nonce').val()
[396] Fix | Delete
},
[397] Fix | Delete
success: function (resp) {
[398] Fix | Delete
var ajaxLanguagePlaceholder = jQuery('#ajx_ld_' + lang);
[399] Fix | Delete
ajaxLanguagePlaceholder.html(resp.data);
[400] Fix | Delete
ajaxLanguagePlaceholder.removeClass('icl_error_text');
[401] Fix | Delete
ajaxLanguagePlaceholder.removeClass('icl_valid_text');
[402] Fix | Delete
if (resp.success) {
[403] Fix | Delete
ajaxLanguagePlaceholder.addClass('icl_valid_text');
[404] Fix | Delete
validDomains++;
[405] Fix | Delete
} else {
[406] Fix | Delete
ajaxLanguagePlaceholder.addClass('icl_error_text');
[407] Fix | Delete
}
[408] Fix | Delete
validatedDomains++;
[409] Fix | Delete
},
[410] Fix | Delete
error: function (jqXHR, textStatus) {
[411] Fix | Delete
jQuery('#ajx_ld_' + lang).html('');
[412] Fix | Delete
if ('0' === jqXHR) {
[413] Fix | Delete
fadeInAjxResp('#' + textStatus, icl_ajx_error, true);
[414] Fix | Delete
}
[415] Fix | Delete
},
[416] Fix | Delete
complete: function () {
[417] Fix | Delete
languageDomain.removeClass('is-active');
[418] Fix | Delete
if (domainsToValidateCount === validDomains) {
[419] Fix | Delete
saveLanguageForm();
[420] Fix | Delete
}
[421] Fix | Delete
}
[422] Fix | Delete
});
[423] Fix | Delete
}
[424] Fix | Delete
} else {
[425] Fix | Delete
saveLanguageForm();
[426] Fix | Delete
}
[427] Fix | Delete
});
[428] Fix | Delete
}
[429] Fix | Delete
}
[430] Fix | Delete
[431] Fix | Delete
return false;
[432] Fix | Delete
}
[433] Fix | Delete
[434] Fix | Delete
function saveLanguageForm() {
[435] Fix | Delete
var domains;
[436] Fix | Delete
var xdomain = 0;
[437] Fix | Delete
var useDirectory = false;
[438] Fix | Delete
var hideSwitcher = false;
[439] Fix | Delete
var data;
[440] Fix | Delete
var form = jQuery('#icl_save_language_negotiation_type');
[441] Fix | Delete
var formName = jQuery(form).attr('name');
[442] Fix | Delete
var ajxResponse = jQuery(form).find('.icl_ajx_response').attr('id');
[443] Fix | Delete
var sso_enabled = jQuery('#sso_enabled').is(':checked');
[444] Fix | Delete
var sso_notice = jQuery('#sso_enabled_notice');
[445] Fix | Delete
[446] Fix | Delete
if (form.find('input[name=use_directory]').is(':checked')) {
[447] Fix | Delete
useDirectory = 1;
[448] Fix | Delete
}
[449] Fix | Delete
if (form.find('input[name=hide_language_switchers]').is(':checked')) {
[450] Fix | Delete
hideSwitcher = 1;
[451] Fix | Delete
}
[452] Fix | Delete
if (form.find('input[name=icl_xdomain_data]:checked').val()) {
[453] Fix | Delete
xdomain = parseInt(form.find('input[name=icl_xdomain_data]:checked').val());
[454] Fix | Delete
}
[455] Fix | Delete
domains = {};
[456] Fix | Delete
form.find('input[name^=language_domains]').each(function () {
[457] Fix | Delete
var item = jQuery(this);
[458] Fix | Delete
domains[item.data('language')] = item.val();
[459] Fix | Delete
});
[460] Fix | Delete
[461] Fix | Delete
data = {
[462] Fix | Delete
action: 'save_language_negotiation_type',
[463] Fix | Delete
nonce: jQuery('#save_language_negotiation_type_nonce').val(),
[464] Fix | Delete
icl_language_negotiation_type: form.find('input[name=icl_language_negotiation_type]:checked').val(),
[465] Fix | Delete
language_domains: domains,
[466] Fix | Delete
use_directory: useDirectory,
[467] Fix | Delete
show_on_root: form.find('input[name=show_on_root]:checked').val(),
[468] Fix | Delete
root_html_file_path: form.find('input[name=root_html_file_path]').val(),
[469] Fix | Delete
hide_language_switchers: hideSwitcher,
[470] Fix | Delete
xdomain: xdomain,
[471] Fix | Delete
sso_enabled: sso_enabled
[472] Fix | Delete
};
[473] Fix | Delete
[474] Fix | Delete
jQuery.ajax({
[475] Fix | Delete
[476] Fix | Delete
method: "POST",
[477] Fix | Delete
url: ajaxurl,
[478] Fix | Delete
data: data,
[479] Fix | Delete
success: function (response) {
[480] Fix | Delete
var formErrors, rootHtmlFile, rootPage, spl;
[481] Fix | Delete
if (response.success) {
[482] Fix | Delete
fadeInAjxResp('#' + ajxResponse, icl_ajx_saved);
[483] Fix | Delete
if ( sso_enabled ) {
[484] Fix | Delete
sso_notice.addClass('updated').fadeIn();
[485] Fix | Delete
} else {
[486] Fix | Delete
sso_notice.removeClass('updated').fadeOut();
[487] Fix | Delete
}
[488] Fix | Delete
[489] Fix | Delete
if(response.data) {
[490] Fix | Delete
var formMessage = jQuery('form[name="' + formName + '"]').find('.wpml-form-message');
[491] Fix | Delete
formMessage.addClass('updated');
[492] Fix | Delete
formMessage.html(response.data);
[493] Fix | Delete
formMessage.fadeIn();
[494] Fix | Delete
}
[495] Fix | Delete
[496] Fix | Delete
if (jQuery('input[name=show_on_root]').length) {
[497] Fix | Delete
rootHtmlFile = jQuery('#wpml_show_on_root_html_file');
[498] Fix | Delete
rootPage = jQuery('#wpml_show_on_root_page');
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function