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: xdomain-data.js
/*globals jQuery, icl_vars, wpml_xdomain_data */
[0] Fix | Delete
[1] Fix | Delete
(function () {
[2] Fix | Delete
"use strict";
[3] Fix | Delete
[4] Fix | Delete
jQuery(document).ready(function () {
[5] Fix | Delete
jQuery('.' + wpml_xdomain_data.css_selector + ' a').on('click', function (event) {
[6] Fix | Delete
[7] Fix | Delete
var originalUrl;
[8] Fix | Delete
var currentUrl = window.location.href;
[9] Fix | Delete
var targetUrl = jQuery(this).attr('href');
[10] Fix | Delete
[11] Fix | Delete
if ('#' !== targetUrl && currentUrl !== targetUrl) {
[12] Fix | Delete
event.preventDefault();
[13] Fix | Delete
[14] Fix | Delete
originalUrl = jQuery(this).attr('href');
[15] Fix | Delete
// Filter out xdomain_data if already in the url
[16] Fix | Delete
originalUrl = originalUrl.replace(/&xdomain_data(=[^&]*)?(?=&|$)|xdomain_data(=[^&]*)?(&|$)/, '');
[17] Fix | Delete
originalUrl = originalUrl.replace(/\?$/, '');
[18] Fix | Delete
[19] Fix | Delete
/** @namespace icl_vars.current_language */
[20] Fix | Delete
jQuery.ajax({
[21] Fix | Delete
url: wpml_xdomain_data.ajax_url,
[22] Fix | Delete
type: 'post',
[23] Fix | Delete
dataType: 'json',
[24] Fix | Delete
data: {
[25] Fix | Delete
action: 'switching_language',
[26] Fix | Delete
from_language: wpml_xdomain_data.current_language
[27] Fix | Delete
},
[28] Fix | Delete
success: function (response) {
[29] Fix | Delete
var argsGlue;
[30] Fix | Delete
var url;
[31] Fix | Delete
var hash;
[32] Fix | Delete
var urlSplit;
[33] Fix | Delete
var xdomain;
[34] Fix | Delete
var form;
[35] Fix | Delete
[36] Fix | Delete
if (response.data.xdomain_data) {
[37] Fix | Delete
if (response.success) {
[38] Fix | Delete
if ('post' === response.data.method) {
[39] Fix | Delete
[40] Fix | Delete
// POST
[41] Fix | Delete
form = jQuery('<form method="post" action="' + originalUrl + '" >');
[42] Fix | Delete
xdomain = jQuery('<input type="hidden" name="xdomain_data" value="' + response.data.xdomain_data + '">');
[43] Fix | Delete
[44] Fix | Delete
form.append(xdomain);
[45] Fix | Delete
jQuery('body').append(form);
[46] Fix | Delete
[47] Fix | Delete
form.submit();
[48] Fix | Delete
[49] Fix | Delete
} else {
[50] Fix | Delete
// GET
[51] Fix | Delete
urlSplit = originalUrl.split('#');
[52] Fix | Delete
hash = '';
[53] Fix | Delete
if (1 < urlSplit.length) {
[54] Fix | Delete
hash = '#' + urlSplit[1];
[55] Fix | Delete
}
[56] Fix | Delete
url = urlSplit[0];
[57] Fix | Delete
if (url.indexOf('?') === -1) {argsGlue = '?';} else {argsGlue = '&';}
[58] Fix | Delete
/** @namespace response.data.xdomain_data */
[59] Fix | Delete
url = originalUrl + argsGlue + 'xdomain_data=' + response.data.xdomain_data + hash;
[60] Fix | Delete
location.href = url;
[61] Fix | Delete
}
[62] Fix | Delete
[63] Fix | Delete
} else {
[64] Fix | Delete
url = originalUrl;
[65] Fix | Delete
location.href = url;
[66] Fix | Delete
}
[67] Fix | Delete
} else {
[68] Fix | Delete
location.href = originalUrl;
[69] Fix | Delete
}
[70] Fix | Delete
},
[71] Fix | Delete
error: function () {
[72] Fix | Delete
location.href = originalUrl;
[73] Fix | Delete
}
[74] Fix | Delete
});
[75] Fix | Delete
}
[76] Fix | Delete
});
[77] Fix | Delete
});
[78] Fix | Delete
}());
[79] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function