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: post-edit-terms.js
/*globals jQuery, WPML_core, ajaxurl, icl_post_edit_messages */
[0] Fix | Delete
(function () {
[1] Fix | Delete
'use strict';
[2] Fix | Delete
[3] Fix | Delete
/** @namespace icl_post_edit_messages.switch_language_title */
[4] Fix | Delete
/** @namespace icl_post_edit_messages.switch_language_alert */
[5] Fix | Delete
/** @namespace icl_post_edit_messages.connection_loss_alert */
[6] Fix | Delete
/** @namespace icl_post_edit_messages.switch_language_message */
[7] Fix | Delete
/** @namespace icl_post_edit_messages.switch_language_confirm */
[8] Fix | Delete
/** @namespace icl_post_edit_messages._nonce */
[9] Fix | Delete
[10] Fix | Delete
jQuery(document).ready(function () {
[11] Fix | Delete
var language_selector;
[12] Fix | Delete
/* Check if we have a language switcher present. */
[13] Fix | Delete
language_selector = jQuery('select[name="icl_post_language"]');
[14] Fix | Delete
if (jQuery('[name="_wpml_root_page"]').length !== 0) {
[15] Fix | Delete
jQuery('#edit-slug-box').hide();
[16] Fix | Delete
}
[17] Fix | Delete
[18] Fix | Delete
if (language_selector.length !== 0) {
[19] Fix | Delete
language_selector.on('change', iclPostLanguageAskConfirmation);
[20] Fix | Delete
iclSwitchPostLanguage();
[21] Fix | Delete
} else {
[22] Fix | Delete
// just add a hidden field with the information and the same id as the language switcher to the dom
[23] Fix | Delete
jQuery.ajax({
[24] Fix | Delete
type: "POST",
[25] Fix | Delete
url: ajaxurl,
[26] Fix | Delete
dataType: 'json',
[27] Fix | Delete
data: {
[28] Fix | Delete
action: 'wpml_get_default_lang'
[29] Fix | Delete
},
[30] Fix | Delete
success: function (response) {
[31] Fix | Delete
var hidden_language_field = jQuery('<input id="icl_post_language" type="hidden"/>');
[32] Fix | Delete
hidden_language_field.val(response.data);
[33] Fix | Delete
jQuery(".wrap").append(hidden_language_field);
[34] Fix | Delete
iclSwitchPostLanguage();
[35] Fix | Delete
}
[36] Fix | Delete
});
[37] Fix | Delete
}
[38] Fix | Delete
});
[39] Fix | Delete
[40] Fix | Delete
function iclGetSwitchLanguageConfirmation() {
[41] Fix | Delete
var lang_switch_confirm_html;
[42] Fix | Delete
var defer = jQuery.Deferred();
[43] Fix | Delete
[44] Fix | Delete
lang_switch_confirm_html = '<div id="icl_confirm_lang_switch">';
[45] Fix | Delete
lang_switch_confirm_html += '<h2>{switch_language_title}</h2>';
[46] Fix | Delete
lang_switch_confirm_html += '<p>{switch_language_message}</p>';
[47] Fix | Delete
lang_switch_confirm_html += '<p>{switch_language_confirm}</p>';
[48] Fix | Delete
lang_switch_confirm_html += '</div>';
[49] Fix | Delete
[50] Fix | Delete
// make sure the title is html entities encoded.
[51] Fix | Delete
var post_name = WPML_core.htmlentities(jQuery('#title').val());
[52] Fix | Delete
if (post_name.length == 0) {
[53] Fix | Delete
post_name = icl_post_edit_messages.empty_post_title;
[54] Fix | Delete
}
[55] Fix | Delete
[56] Fix | Delete
lang_switch_confirm_html = lang_switch_confirm_html.replace('{switch_language_title}', icl_post_edit_messages.switch_language_title);
[57] Fix | Delete
lang_switch_confirm_html = lang_switch_confirm_html.replace('{switch_language_message}', icl_post_edit_messages.switch_language_message);
[58] Fix | Delete
lang_switch_confirm_html = lang_switch_confirm_html.replace('{switch_language_confirm}', icl_post_edit_messages.switch_language_confirm);
[59] Fix | Delete
lang_switch_confirm_html = lang_switch_confirm_html.replace('{post_name}', '<i>' + post_name + '</i>');
[60] Fix | Delete
[61] Fix | Delete
jQuery(lang_switch_confirm_html).dialog({
[62] Fix | Delete
modal: true,
[63] Fix | Delete
width: 'auto',
[64] Fix | Delete
buttons: [
[65] Fix | Delete
{
[66] Fix | Delete
text : icl_post_edit_messages.ok_button_label,
[67] Fix | Delete
id : "ok",
[68] Fix | Delete
click: function () {
[69] Fix | Delete
defer.resolve();
[70] Fix | Delete
jQuery(this).dialog("close");
[71] Fix | Delete
[72] Fix | Delete
}
[73] Fix | Delete
},
[74] Fix | Delete
{
[75] Fix | Delete
text : icl_post_edit_messages.cancel_button_label,
[76] Fix | Delete
id : "cancel",
[77] Fix | Delete
click: function () {
[78] Fix | Delete
defer.reject();
[79] Fix | Delete
jQuery(this).dialog("close");
[80] Fix | Delete
[81] Fix | Delete
}
[82] Fix | Delete
}
[83] Fix | Delete
]
[84] Fix | Delete
});
[85] Fix | Delete
return defer.promise();
[86] Fix | Delete
}
[87] Fix | Delete
[88] Fix | Delete
function iclPostLanguageAskConfirmation() {
[89] Fix | Delete
[90] Fix | Delete
var post_language_switcher = jQuery('#icl_post_language');
[91] Fix | Delete
var previous_post_language = post_language_switcher.data('last_lang');
[92] Fix | Delete
[93] Fix | Delete
jQuery('#edit-slug-buttons').find('> .cancel').click();
[94] Fix | Delete
[95] Fix | Delete
iclGetSwitchLanguageConfirmation().done(function () {
[96] Fix | Delete
iclSwitchPostLanguage();
[97] Fix | Delete
}).fail(function () {
[98] Fix | Delete
post_language_switcher.val(previous_post_language);
[99] Fix | Delete
});
[100] Fix | Delete
}
[101] Fix | Delete
[102] Fix | Delete
function iclSwitchPostLanguage() {
[103] Fix | Delete
var post_language_switcher = jQuery('#icl_post_language');
[104] Fix | Delete
var parent = post_language_switcher.parent();
[105] Fix | Delete
var nonce = parent.find('[name="nonce"]').val();
[106] Fix | Delete
var new_post_language = post_language_switcher.val();
[107] Fix | Delete
var previous_post_language = post_language_switcher.data('last_lang');
[108] Fix | Delete
var post_id = jQuery('#post_ID').val();
[109] Fix | Delete
if (!previous_post_language) {
[110] Fix | Delete
post_language_switcher.data('last_lang', new_post_language);
[111] Fix | Delete
} else {
[112] Fix | Delete
jQuery.ajax({
[113] Fix | Delete
type: "POST",
[114] Fix | Delete
url: ajaxurl,
[115] Fix | Delete
dataType: 'json',
[116] Fix | Delete
data: {
[117] Fix | Delete
wpml_from: previous_post_language,
[118] Fix | Delete
action: 'wpml_switch_post_language',
[119] Fix | Delete
nonce: nonce,
[120] Fix | Delete
/** @todo: remove the following line as most likely obsolete */
[121] Fix | Delete
_icl_nonce: icl_post_edit_messages._nonce,
[122] Fix | Delete
wpml_to: new_post_language,
[123] Fix | Delete
wpml_post_id: post_id
[124] Fix | Delete
},
[125] Fix | Delete
success: function () {
[126] Fix | Delete
post_language_switcher.data('last_lang', new_post_language);
[127] Fix | Delete
var url = jQuery(location).attr('href');
[128] Fix | Delete
if (/lang=/.test(url)) {
[129] Fix | Delete
url = url.replace(/([\?&])(lang=)[^&#]*/, '$1$2' + new_post_language);
[130] Fix | Delete
} else {
[131] Fix | Delete
var sep = (url.indexOf('?') > -1) ? '&' : '?';
[132] Fix | Delete
url = url + sep + 'lang=' + new_post_language;
[133] Fix | Delete
}
[134] Fix | Delete
[135] Fix | Delete
window.location.replace(url);
[136] Fix | Delete
}
[137] Fix | Delete
});
[138] Fix | Delete
}
[139] Fix | Delete
}
[140] Fix | Delete
})();
[141] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function