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/clone/wp-conte.../plugins/advanced.../admin/assets/js
File: wizard.js
jQuery( document ).ready(function ($) {
[0] Fix | Delete
// ad wizard
[1] Fix | Delete
advads_wizard.init();
[2] Fix | Delete
});
[3] Fix | Delete
var advads_wizard = {
[4] Fix | Delete
box_order: [ // selectors of elements in the wizard in the correct order
[5] Fix | Delete
'#post-body-content, #ad-main-box', // show title and type together
[6] Fix | Delete
'#ad-parameters-box',
[7] Fix | Delete
// '#ad-output-box',
[8] Fix | Delete
'#ad-targeting-box', // display and visitor conditions
[9] Fix | Delete
// '#advanced_ads_groupsdiv',
[10] Fix | Delete
// '#submitdiv'
[11] Fix | Delete
],
[12] Fix | Delete
current_box: '#post-body-content, #ad-main-box', // current active box
[13] Fix | Delete
one_column: false, // whether the edit screen is in one-column mode
[14] Fix | Delete
status: false, // what is the current status? true if running, else false
[15] Fix | Delete
init: function ( status ) { // status can be "start" to start wizard or nothing to not start it
[16] Fix | Delete
var _this = this;
[17] Fix | Delete
jQuery( '#advads-wizard-controls-next' ).on( 'click', function () {
[18] Fix | Delete
_this.next();
[19] Fix | Delete
} );
[20] Fix | Delete
jQuery( '#advads-wizard-controls-prev' ).on( 'click', function () {
[21] Fix | Delete
_this.prev();
[22] Fix | Delete
} );
[23] Fix | Delete
jQuery( '#advads-wizard-controls-save' ).on( 'click', function ( e ) {
[24] Fix | Delete
e.preventDefault();
[25] Fix | Delete
jQuery( '#publish' ).trigger( 'click' );
[26] Fix | Delete
} ); // save ad
[27] Fix | Delete
jQuery( '#advads-wizard-display-conditions-show' ).on( 'click', function () {
[28] Fix | Delete
_this.show_conditions( '#ad-targeting-box' );
[29] Fix | Delete
} );
[30] Fix | Delete
jQuery( '#advads-wizard-visitor-conditions-show' ).on( 'click', function () {
[31] Fix | Delete
_this.show_conditions( '#ad-targeting-box' );
[32] Fix | Delete
} );
[33] Fix | Delete
jQuery( '.advads-show-in-wizard' ).hide();
[34] Fix | Delete
jQuery( '#advads-start-wizard' ).on( 'click', function () {
[35] Fix | Delete
_this.start();
[36] Fix | Delete
} );
[37] Fix | Delete
// end wizard when the button was clicked
[38] Fix | Delete
jQuery( '.advads-stop-wizard' ).on( 'click', function () {
[39] Fix | Delete
_this.close();
[40] Fix | Delete
} );
[41] Fix | Delete
// jump to next box when ad type is selected
[42] Fix | Delete
jQuery( '#advanced-ad-type input' ).on( 'change', function () {
[43] Fix | Delete
_this.next();
[44] Fix | Delete
} );
[45] Fix | Delete
},
[46] Fix | Delete
show_current_box: function(){
[47] Fix | Delete
jQuery( this.current_box ).removeClass('advads-hide');
[48] Fix | Delete
},
[49] Fix | Delete
start: function(){ // do stuff when wizard is started
[50] Fix | Delete
if ( ! this.is_form_valid() ) {
[51] Fix | Delete
return;
[52] Fix | Delete
}
[53] Fix | Delete
// show page in 1-column stype
[54] Fix | Delete
this.status = true;
[55] Fix | Delete
if( jQuery( '#post-body').hasClass('columns-1') ){
[56] Fix | Delete
this.one_column = true;
[57] Fix | Delete
} else {
[58] Fix | Delete
jQuery( '#post-body').addClass( 'columns-1' ).removeClass( 'columns-2' );
[59] Fix | Delete
}
[60] Fix | Delete
// hide all boxes, messages and the headline by adding a hide css class
[61] Fix | Delete
jQuery('#post-body-content, .postbox-container .postbox, h1 ~ div:not(.advads-admin-notice):not(#message.updated), h1').addClass( 'advads-hide' );
[62] Fix | Delete
// display first box
[63] Fix | Delete
this.show_current_box();
[64] Fix | Delete
// display close button and controls
[65] Fix | Delete
jQuery('#advads-stop-wizard, #advads-wizard-controls').removeClass('hidden')
[66] Fix | Delete
this.update_nav();
[67] Fix | Delete
// initially hide some elemente
[68] Fix | Delete
jQuery( '#advads-ad-description').addClass('advads-hide'); // ad description
[69] Fix | Delete
jQuery( '#advads-ad-info').addClass('advads-hide'); // shortcode and php function info
[70] Fix | Delete
// hide all elements with 'advads-hide-for-wizard' class
[71] Fix | Delete
jQuery( '.advads-hide-in-wizard').hide();
[72] Fix | Delete
jQuery( '.advads-show-in-wizard').show();
[73] Fix | Delete
jQuery( '#advads-start-wizard' ).hide();
[74] Fix | Delete
// remove close-class from ad type box
[75] Fix | Delete
jQuery( '#ad-main-box' ).removeClass('closed');
[76] Fix | Delete
this.save_hide_wizard( false );
[77] Fix | Delete
},
[78] Fix | Delete
close: function(){ // close the wizard by showing all elements again
[79] Fix | Delete
this.status = false;
[80] Fix | Delete
jQuery('.advads-hide').removeClass('advads-hide');
[81] Fix | Delete
jQuery('#advads-stop-wizard, #advads-wizard-controls').addClass('hidden');
[82] Fix | Delete
if( this.one_column !== true ){
[83] Fix | Delete
jQuery( '#post-body').addClass( 'columns-2' ).removeClass( 'columns-1' );
[84] Fix | Delete
}
[85] Fix | Delete
// reset current box
[86] Fix | Delete
this.current_box = this.box_order[0];
[87] Fix | Delete
jQuery('#advads-wizard-welcome').remove();// close wizard welcome message
[88] Fix | Delete
// show all elements with 'advads-hide-for-wizard' class
[89] Fix | Delete
jQuery( '.advads-hide-in-wizard').show();
[90] Fix | Delete
jQuery( '.advads-show-in-wizard').hide();
[91] Fix | Delete
jQuery( '#advads-start-wizard' ).show();
[92] Fix | Delete
this.save_hide_wizard( true );
[93] Fix | Delete
},
[94] Fix | Delete
update_nav: function(){ // update navigation, display only valid buttons
[95] Fix | Delete
// display all buttons
[96] Fix | Delete
jQuery('#advads-wizard-controls button').removeClass('hidden');
[97] Fix | Delete
// hide next button if there is no next widget
[98] Fix | Delete
var i = this.box_order.indexOf( this.current_box );
[99] Fix | Delete
if( i === this.box_order.length - 1 ){
[100] Fix | Delete
jQuery('#advads-wizard-controls-next').addClass('hidden');
[101] Fix | Delete
}
[102] Fix | Delete
if( i === 0 ){
[103] Fix | Delete
jQuery('#advads-wizard-controls-prev').addClass('hidden');
[104] Fix | Delete
}
[105] Fix | Delete
// hide save button for first boxes
[106] Fix | Delete
if( i <= 1 ){
[107] Fix | Delete
jQuery('#advads-wizard-controls-save').addClass('hidden');
[108] Fix | Delete
} else {
[109] Fix | Delete
jQuery('#advads-wizard-controls-save').removeClass('hidden');
[110] Fix | Delete
}
[111] Fix | Delete
},
[112] Fix | Delete
[113] Fix | Delete
/**
[114] Fix | Delete
* Check the form just before some of its fields become hidden.
[115] Fix | Delete
*
[116] Fix | Delete
* @param {HTMLFormElement} form Form.
[117] Fix | Delete
* @return bool
[118] Fix | Delete
*/
[119] Fix | Delete
is_form_valid: function() {
[120] Fix | Delete
var form = jQuery( 'form#post' )[0];
[121] Fix | Delete
[122] Fix | Delete
if ( form.checkValidity && form.reportValidity ) {
[123] Fix | Delete
if ( ! form.checkValidity() ) {
[124] Fix | Delete
// Highlight invalid fields.
[125] Fix | Delete
form.reportValidity()
[126] Fix | Delete
return false;
[127] Fix | Delete
}
[128] Fix | Delete
return true;
[129] Fix | Delete
} else {
[130] Fix | Delete
// Disable validation so that hidden invalid fields do not prevent the form from being sent.
[131] Fix | Delete
form.setAttribute( 'novalidate', true );
[132] Fix | Delete
return true;
[133] Fix | Delete
}
[134] Fix | Delete
[135] Fix | Delete
},
[136] Fix | Delete
next: function(){ // show next box
[137] Fix | Delete
if ( ! this.is_form_valid() ) {
[138] Fix | Delete
return;
[139] Fix | Delete
}
[140] Fix | Delete
if( ! this.status ){ return }
[141] Fix | Delete
// get index of current item in box-array
[142] Fix | Delete
var i = this.box_order.indexOf( this.current_box );
[143] Fix | Delete
// check if there is a next index
[144] Fix | Delete
if( this.box_order[ i + 1 ] === undefined ){
[145] Fix | Delete
return;
[146] Fix | Delete
}
[147] Fix | Delete
// hide current element
[148] Fix | Delete
jQuery( this.current_box ).addClass('advads-hide')
[149] Fix | Delete
// load next element into current
[150] Fix | Delete
this.current_box = this.box_order[ i + 1 ];
[151] Fix | Delete
this.show_current_box();
[152] Fix | Delete
this.update_nav();
[153] Fix | Delete
},
[154] Fix | Delete
prev: function(){ // show previous box
[155] Fix | Delete
if ( ! this.is_form_valid() ) {
[156] Fix | Delete
return;
[157] Fix | Delete
}
[158] Fix | Delete
// get index of current item in box-array
[159] Fix | Delete
var i = this.box_order.indexOf( this.current_box );
[160] Fix | Delete
// check if there is a previous index
[161] Fix | Delete
if( this.box_order[ i - 1 ] === undefined ){
[162] Fix | Delete
return;
[163] Fix | Delete
}
[164] Fix | Delete
// hide current element
[165] Fix | Delete
jQuery( this.current_box ).addClass('advads-hide')
[166] Fix | Delete
// load next element into current
[167] Fix | Delete
this.current_box = this.box_order[ i - 1 ];
[168] Fix | Delete
this.show_current_box();
[169] Fix | Delete
this.update_nav();
[170] Fix | Delete
},
[171] Fix | Delete
save_hide_wizard: function( hide_wizard ){ // update wizard state (started by default or not?)
[172] Fix | Delete
[173] Fix | Delete
jQuery.ajax({
[174] Fix | Delete
type: 'POST',
[175] Fix | Delete
url: ajaxurl,
[176] Fix | Delete
data: {
[177] Fix | Delete
action: 'advads-save-hide-wizard-state',
[178] Fix | Delete
hide_wizard: hide_wizard,
[179] Fix | Delete
nonce: advadsglobal.ajax_nonce,
[180] Fix | Delete
},
[181] Fix | Delete
});
[182] Fix | Delete
},
[183] Fix | Delete
show_conditions: function( box ){ // show the conditions options in display and visitor conditions
[184] Fix | Delete
jQuery( box ).find('.advads-show-in-wizard').hide();
[185] Fix | Delete
jQuery( box ).find('.advads-hide-in-wizard').show();
[186] Fix | Delete
},
[187] Fix | Delete
};
[188] Fix | Delete
[189] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function