Version Description
- Made the plugin more extendable (js).
- Added another Save button near the theme and file dropdowns (for lazy people).
- Added links to the Pro addon.
- Added a nice global wait for all ajax calls.
- Added an error message to be displayed when we're doing ajax and the user is not authenticated.
Download this release
Release Info
Developer | lordspace |
Plugin | Child Theme Creator by Orbisius |
Version | 1.2.4 |
Comparing to | |
See all releases |
Code changes from version 1.2.3 to 1.2.4
- assets/main.css +2 -2
- assets/main.js +71 -2
- assets/main.min.css +1 -1
- assets/main.min.js +1 -1
- orbisius-child-theme-creator.php +48 -17
- readme.txt +13 -1
assets/main.css
CHANGED
@@ -39,7 +39,7 @@
|
|
39 |
|
40 |
.orbisius_child_theme_creator_container .app-alert-notice {
|
41 |
background: #FFEC8B;
|
42 |
-
border: 1px solid #
|
43 |
padding: 3px;
|
44 |
text-align: center;
|
45 |
}
|
@@ -128,7 +128,7 @@
|
|
128 |
/* The dropdowns move to a new line when files are longer */
|
129 |
.orbisius_ctc_theme_editor_container #theme_1, .orbisius_ctc_theme_editor_container #theme_2,
|
130 |
.orbisius_ctc_theme_editor_container #theme_1_file, .orbisius_ctc_theme_editor_container #theme_2_file {
|
131 |
-
max-width:
|
132 |
}
|
133 |
|
134 |
.orbisius_ctc_theme_editor_container .primary_buttons {
|
39 |
|
40 |
.orbisius_child_theme_creator_container .app-alert-notice {
|
41 |
background: #FFEC8B;
|
42 |
+
border: 1px solid #666;
|
43 |
padding: 3px;
|
44 |
text-align: center;
|
45 |
}
|
128 |
/* The dropdowns move to a new line when files are longer */
|
129 |
.orbisius_ctc_theme_editor_container #theme_1, .orbisius_ctc_theme_editor_container #theme_2,
|
130 |
.orbisius_ctc_theme_editor_container #theme_1_file, .orbisius_ctc_theme_editor_container #theme_2_file {
|
131 |
+
max-width:35%;
|
132 |
}
|
133 |
|
134 |
.orbisius_ctc_theme_editor_container .primary_buttons {
|
assets/main.js
CHANGED
@@ -1,4 +1,14 @@
|
|
1 |
var orbisius_child_theme_creator = {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
/**
|
3 |
* This is a file name that the user enters. It will be cleaned of spaces and repeating chars.
|
4 |
* @param str val
|
@@ -37,6 +47,14 @@ var orbisius_child_theme_creator = {
|
|
37 |
url : ajaxurl, // WP defines it and it contains all the necessary params
|
38 |
data : jQuery(form_id).serialize() + '&action=orbisius_ctc_theme_editor_ajax&sub_cmd=' + escape('delete_file'),
|
39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
success : function (result) {
|
41 |
var form_num = form_id.indexOf('theme_1') >= 0 ? 1 : 2;
|
42 |
|
@@ -282,6 +300,14 @@ function orbisius_ctc_theme_editor_setup() {
|
|
282 |
url : ajaxurl, // WP defines it and it contains all the necessary params
|
283 |
data : jQuery(form_id).serialize() + '&action=orbisius_ctc_theme_editor_ajax&sub_cmd=' + escape(action),
|
284 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
285 |
success : function (json) {
|
286 |
jQuery(target_container)
|
287 |
.empty()
|
@@ -319,6 +345,14 @@ function orbisius_ctc_theme_editor_setup() {
|
|
319 |
url : ajaxurl, // WP defines it and it contains all the necessary params
|
320 |
data : jQuery(form_id).serialize() + '&action=orbisius_ctc_theme_editor_ajax&sub_cmd=' + escape(action),
|
321 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
322 |
success : function (json) {
|
323 |
jQuery(target_container)
|
324 |
.empty()
|
@@ -376,6 +410,14 @@ function orbisius_ctc_theme_editor_setup() {
|
|
376 |
url : ajaxurl, // WP defines it and it contains all the necessary params
|
377 |
data : jQuery(form_id).serialize() + '&action=orbisius_ctc_theme_editor_ajax&sub_cmd=' + escape(action),
|
378 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
379 |
success : function (json) {
|
380 |
jQuery(target_container)
|
381 |
.empty()
|
@@ -433,6 +475,14 @@ function orbisius_ctc_theme_editor_setup() {
|
|
433 |
url : ajaxurl, // WP defines it and it contains all the necessary params
|
434 |
data : jQuery(form_id).serialize() + '&action=orbisius_ctc_theme_editor_ajax&sub_cmd=' + escape(action),
|
435 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
436 |
success : function (json) {
|
437 |
jQuery(target_container)
|
438 |
.empty()
|
@@ -629,7 +679,8 @@ function orbisius_ctc_theme_editor_setup() {
|
|
629 |
app_load('#orbisius_ctc_theme_editor_theme_2_form', 'generate_dropdown', '#theme_2_file', app_handle_theme_change);
|
630 |
});
|
631 |
|
632 |
-
|
|
|
633 |
app_load('#orbisius_ctc_theme_editor_theme_1_form', 'save_file', '#theme_1_file_contents');
|
634 |
|
635 |
return false;
|
@@ -646,6 +697,7 @@ function orbisius_ctc_theme_editor_setup() {
|
|
646 |
app_load('#orbisius_ctc_theme_editor_theme_2_form', 'generate_dropdown', '#theme_2_file', app_handle_theme_change);
|
647 |
});
|
648 |
|
|
|
649 |
$('#orbisius_ctc_theme_editor_theme_2_form').submit(function () {
|
650 |
app_load('#orbisius_ctc_theme_editor_theme_2_form', 'save_file', '#theme_2_file_contents');
|
651 |
|
@@ -717,7 +769,7 @@ function app_load(form_id, action, target_container, callback) {
|
|
717 |
jQuery('.status', jQuery(target_container).parent()).html(loading_text);
|
718 |
} else {
|
719 |
if (jQuery(target_container).is("input,textarea")) {
|
720 |
-
jQuery(target_container).val(loading_text_just_text);
|
721 |
jQuery(target_container).addClass('saving_action');
|
722 |
} else if (jQuery(target_container).is("select")) { // for loading. we want to override options of the select
|
723 |
jQuery(target_container + ' option').text(loading_text_just_text);
|
@@ -733,12 +785,24 @@ function app_load(form_id, action, target_container, callback) {
|
|
733 |
data : jQuery(form_id).serialize() + '&action=orbisius_ctc_theme_editor_ajax&sub_cmd=' + escape(action),
|
734 |
|
735 |
success : function (result) {
|
|
|
|
|
|
|
|
|
|
|
|
|
736 |
// http://stackoverflow.com/questions/2432749/jquery-delay-not-delaying
|
737 |
if (result != '') {
|
738 |
if (jQuery(target_container).is("input,textarea")) {
|
739 |
jQuery(target_container).val(result);
|
|
|
|
|
|
|
|
|
|
|
740 |
} else {
|
741 |
jQuery(target_container).html(result);
|
|
|
742 |
}
|
743 |
|
744 |
if (is_save_action) { // save action
|
@@ -757,7 +821,12 @@ function app_load(form_id, action, target_container, callback) {
|
|
757 |
}
|
758 |
},
|
759 |
|
|
|
|
|
|
|
|
|
760 |
complete : function (result) { // this is always called
|
|
|
761 |
jQuery(target_container).removeClass('saving_action');
|
762 |
|
763 |
if (is_save_action) { // save action
|
1 |
var orbisius_child_theme_creator = {
|
2 |
+
loader: function (show_or_hide) {
|
3 |
+
var c = jQuery('.orbisius_child_theme_creator_container .loader');
|
4 |
+
|
5 |
+
if (show_or_hide) {
|
6 |
+
jQuery(c).html('Please Wait ...').show();
|
7 |
+
} else {
|
8 |
+
jQuery(c).html('').hide();
|
9 |
+
}
|
10 |
+
},
|
11 |
+
|
12 |
/**
|
13 |
* This is a file name that the user enters. It will be cleaned of spaces and repeating chars.
|
14 |
* @param str val
|
47 |
url : ajaxurl, // WP defines it and it contains all the necessary params
|
48 |
data : jQuery(form_id).serialize() + '&action=orbisius_ctc_theme_editor_ajax&sub_cmd=' + escape('delete_file'),
|
49 |
|
50 |
+
beforeSend: function() {
|
51 |
+
orbisius_child_theme_creator.loader(1);
|
52 |
+
},
|
53 |
+
|
54 |
+
complete: function() {
|
55 |
+
orbisius_child_theme_creator.loader(0);
|
56 |
+
},
|
57 |
+
|
58 |
success : function (result) {
|
59 |
var form_num = form_id.indexOf('theme_1') >= 0 ? 1 : 2;
|
60 |
|
300 |
url : ajaxurl, // WP defines it and it contains all the necessary params
|
301 |
data : jQuery(form_id).serialize() + '&action=orbisius_ctc_theme_editor_ajax&sub_cmd=' + escape(action),
|
302 |
|
303 |
+
beforeSend: function() {
|
304 |
+
orbisius_child_theme_creator.loader(1);
|
305 |
+
},
|
306 |
+
|
307 |
+
complete: function() {
|
308 |
+
orbisius_child_theme_creator.loader(0);
|
309 |
+
},
|
310 |
+
|
311 |
success : function (json) {
|
312 |
jQuery(target_container)
|
313 |
.empty()
|
345 |
url : ajaxurl, // WP defines it and it contains all the necessary params
|
346 |
data : jQuery(form_id).serialize() + '&action=orbisius_ctc_theme_editor_ajax&sub_cmd=' + escape(action),
|
347 |
|
348 |
+
beforeSend: function() {
|
349 |
+
orbisius_child_theme_creator.loader(1);
|
350 |
+
},
|
351 |
+
|
352 |
+
complete: function() {
|
353 |
+
orbisius_child_theme_creator.loader(0);
|
354 |
+
},
|
355 |
+
|
356 |
success : function (json) {
|
357 |
jQuery(target_container)
|
358 |
.empty()
|
410 |
url : ajaxurl, // WP defines it and it contains all the necessary params
|
411 |
data : jQuery(form_id).serialize() + '&action=orbisius_ctc_theme_editor_ajax&sub_cmd=' + escape(action),
|
412 |
|
413 |
+
beforeSend: function() {
|
414 |
+
orbisius_child_theme_creator.loader(1);
|
415 |
+
},
|
416 |
+
|
417 |
+
complete: function() {
|
418 |
+
orbisius_child_theme_creator.loader(0);
|
419 |
+
},
|
420 |
+
|
421 |
success : function (json) {
|
422 |
jQuery(target_container)
|
423 |
.empty()
|
475 |
url : ajaxurl, // WP defines it and it contains all the necessary params
|
476 |
data : jQuery(form_id).serialize() + '&action=orbisius_ctc_theme_editor_ajax&sub_cmd=' + escape(action),
|
477 |
|
478 |
+
beforeSend: function() {
|
479 |
+
orbisius_child_theme_creator.loader(1);
|
480 |
+
},
|
481 |
+
|
482 |
+
complete: function() {
|
483 |
+
orbisius_child_theme_creator.loader(0);
|
484 |
+
},
|
485 |
+
|
486 |
success : function (json) {
|
487 |
jQuery(target_container)
|
488 |
.empty()
|
679 |
app_load('#orbisius_ctc_theme_editor_theme_2_form', 'generate_dropdown', '#theme_2_file', app_handle_theme_change);
|
680 |
});
|
681 |
|
682 |
+
// Submit
|
683 |
+
$('#orbisius_ctc_theme_editor_theme_1_form').submit(function (e) {
|
684 |
app_load('#orbisius_ctc_theme_editor_theme_1_form', 'save_file', '#theme_1_file_contents');
|
685 |
|
686 |
return false;
|
697 |
app_load('#orbisius_ctc_theme_editor_theme_2_form', 'generate_dropdown', '#theme_2_file', app_handle_theme_change);
|
698 |
});
|
699 |
|
700 |
+
// Submit
|
701 |
$('#orbisius_ctc_theme_editor_theme_2_form').submit(function () {
|
702 |
app_load('#orbisius_ctc_theme_editor_theme_2_form', 'save_file', '#theme_2_file_contents');
|
703 |
|
769 |
jQuery('.status', jQuery(target_container).parent()).html(loading_text);
|
770 |
} else {
|
771 |
if (jQuery(target_container).is("input,textarea")) {
|
772 |
+
//jQuery(target_container).val(loading_text_just_text);
|
773 |
jQuery(target_container).addClass('saving_action');
|
774 |
} else if (jQuery(target_container).is("select")) { // for loading. we want to override options of the select
|
775 |
jQuery(target_container + ' option').text(loading_text_just_text);
|
785 |
data : jQuery(form_id).serialize() + '&action=orbisius_ctc_theme_editor_ajax&sub_cmd=' + escape(action),
|
786 |
|
787 |
success : function (result) {
|
788 |
+
var custm_event_data = {
|
789 |
+
form_id : form_id,
|
790 |
+
sub_cmd: action,
|
791 |
+
result : result
|
792 |
+
};
|
793 |
+
|
794 |
// http://stackoverflow.com/questions/2432749/jquery-delay-not-delaying
|
795 |
if (result != '') {
|
796 |
if (jQuery(target_container).is("input,textarea")) {
|
797 |
jQuery(target_container).val(result);
|
798 |
+
|
799 |
+
if (jQuery(target_container).is("textarea")) {
|
800 |
+
// #theme_1_file or #theme_1_file_contents
|
801 |
+
jQuery(target_container).trigger('orbisius_child_theme_editor_event_file_loaded', custm_event_data);
|
802 |
+
}
|
803 |
} else {
|
804 |
jQuery(target_container).html(result);
|
805 |
+
jQuery(target_container).trigger('orbisius_child_theme_editor_event_content_loaded', custm_event_data);
|
806 |
}
|
807 |
|
808 |
if (is_save_action) { // save action
|
821 |
}
|
822 |
},
|
823 |
|
824 |
+
beforeSend: function() {
|
825 |
+
orbisius_child_theme_creator.loader(1);
|
826 |
+
},
|
827 |
+
|
828 |
complete : function (result) { // this is always called
|
829 |
+
orbisius_child_theme_creator.loader(0);
|
830 |
jQuery(target_container).removeClass('saving_action');
|
831 |
|
832 |
if (is_save_action) { // save action
|
assets/main.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.orbisius_child_theme_creator_container .app-hide{display:none}.orbisius_child_theme_creator_container .app-hide-force{display:none!important}.orbisius_child_theme_creator_container .app-form-field-error{border-color:red}.orbisius_child_theme_creator_container .app-serious-notice{color:red;font-weight:700}.orbisius_child_theme_creator_container .app-alert-error{background:#D54E21;border:1px solid #eee;color:#fff;padding:3px;text-align:center}.orbisius_child_theme_creator_container .app-alert-success{background:green;border:1px solid #eee;color:#fff;padding:3px;text-align:center}.orbisius_child_theme_creator_container .app-alert-success a,.orbisius_child_theme_creator_container .app-alert-error a{color:#fff}.orbisius_child_theme_creator_container .app-alert-notice{background:#FFEC8B;border:1px solid #
|
1 |
+
.orbisius_child_theme_creator_container .app-hide{display:none}.orbisius_child_theme_creator_container .app-hide-force{display:none!important}.orbisius_child_theme_creator_container .app-form-field-error{border-color:red}.orbisius_child_theme_creator_container .app-serious-notice{color:red;font-weight:700}.orbisius_child_theme_creator_container .app-alert-error{background:#D54E21;border:1px solid #eee;color:#fff;padding:3px;text-align:center}.orbisius_child_theme_creator_container .app-alert-success{background:green;border:1px solid #eee;color:#fff;padding:3px;text-align:center}.orbisius_child_theme_creator_container .app-alert-success a,.orbisius_child_theme_creator_container .app-alert-error a{color:#fff}.orbisius_child_theme_creator_container .app-alert-notice{background:#FFEC8B;border:1px solid #666;padding:3px;text-align:center}.orbisius_child_theme_creator_container .app-button-positive{background:green;color:#fff;padding:3px;text-decoration:none}.orbisius_child_theme_creator_container .app-button-negative{background:red;color:#fff;padding:3px;text-decoration:none}.orbisius_child_theme_creator_container .highlight{background:#FF3}.orbisius_child_theme_creator_container .app-dialog-button-ok{background:green!important;color:#fff!important}.orbisius_child_theme_creator_container .app-dialog-button-cancel{background:red!important;color:#fff!important}.orbisius_child_theme_creator_container .app-button-left,.app-align-left{float:left}.orbisius_child_theme_creator_container .app-button-right,.orbisius_child_theme_creator_container .app-align-right{float:right}.orbisius_child_theme_creator_container .app-button-container{padding:10px;background:#ccc;margin-top:15px;margin-bottom:15px}.orbisius_child_theme_creator_container .available-theme{padding:10px;margin:5px;border:2px solid #fff;display:inline-block;width:28%}.orbisius_child_theme_creator_container .available-theme img.screenshot{max-height:75%;max-width:75%}.orbisius_child_theme_creator_container .available-theme:hover{border:2px solid #444;background:#ccc}.orbisius_child_theme_creator_container .saving_action{background:#ccc}.orbisius_ctc_theme_editor_container .highlight{background:#FF3}.orbisius_ctc_theme_editor_container .app-dialog-button-ok{background:green!important;color:#fff!important}.orbisius_ctc_theme_editor_container .app-dialog-button-cancel{background:red!important;color:#fff!important}.orbisius_ctc_theme_editor_container #theme_1,.orbisius_ctc_theme_editor_container #theme_2,.orbisius_ctc_theme_editor_container #theme_1_file,.orbisius_ctc_theme_editor_container #theme_2_file{max-width:35%}.orbisius_ctc_theme_editor_container .primary_buttons{margin-top:5px}
|
assets/main.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
function orbisius_ctc_theme_editor_setup(){var e=jQuery;var t=e("#theme_1").val();if(t!=""){app_load("#orbisius_ctc_theme_editor_theme_1_form","generate_dropdown","#theme_1_file",app_handle_theme_change)}e("#theme_1_delete_file_btn").on("click",function(){var t=e("#theme_1_file").val();if(confirm("Delete: ["+t+"] ? Are you sure?","")){orbisius_child_theme_creator.delete_file(t,"#orbisius_ctc_theme_editor_theme_1_form")}});e("#theme_2_delete_file_btn").on("click",function(){var t=e("#theme_2_file").val();if(confirm("Delete: ["+t+"] ? Are you sure?","")){orbisius_child_theme_creator.delete_file(t,"#orbisius_ctc_theme_editor_theme_2_form")}});e("#theme_1_new_file_btn").on("click",function(){e("#theme_1_new_file_container").toggle("slow");e("#theme_1_new_file").focus()});e("#theme_1_new_file").on("input",function(t){var n=e("#theme_1_new_file").val();n=orbisius_child_theme_creator.sanitize_file_name(n);var r=1;e("#theme_1_file option").each(function(){var t=e(this).val();if(t==n){r=0;return}});if(r){e(".status",e("#theme_1_new_file_container")).text("").removeClass("app-alert-error")}else{var i="File with that name already exists.";e(".status",e("#theme_1_new_file_container")).text(i).addClass("app-alert-error")}});e("#theme_1_new_file_btn_ok").on("click",function(){var t=e("#theme_1_new_file").val();t=orbisius_child_theme_creator.sanitize_file_name(t);var n=t;if(t==""){alert("Invalid or empty value for filename.");e("#theme_1_new_file").focus();return}var r=1;e("#theme_1_file option").each(function(){var n=e(this).val();if(n==t){r=0;return}});if(!r){alert("File with that name already exists.");e("#theme_1_new_file").focus();return}e("select theme_1_file").prop("selected",false);var i=e("<option></option>").val(t).html(n).prop("selected",true);e("#theme_1_file").append(i);e("#theme_1_new_file_container").hide("slow");e("#theme_1_new_file").val("");e("#theme_1_file_contents").val("").focus()});e("#theme_1_new_file_btn_cancel").on("click",function(){e("#theme_1_new_file").val("");e("#theme_1_new_file_container").hide("slow");e(".status",e("#theme_1_new_file_container")).text("").removeClass("app-alert-error")});e("#theme_2_new_file_btn").on("click",function(){e("#theme_2_new_file_container").toggle("slow");e("#theme_2_new_file").focus()});e("#theme_2_new_file").on("input",function(t){var n=e("#theme_2_new_file").val();n=orbisius_child_theme_creator.sanitize_file_name(n);var r=1;e("#theme_2_file option").each(function(){var t=e(this).val();if(t==n){r=0;return}});if(r){e(".status",e("#theme_2_new_file_container")).text("").removeClass("app-alert-error")}else{var i="File with that name already exists.";e(".status",e("#theme_2_new_file_container")).text(i).addClass("app-alert-error")}});e("#theme_2_new_file_btn_ok").on("click",function(){var t=e("#theme_2_new_file").val();t=orbisius_child_theme_creator.sanitize_file_name(t);var n=t;if(t==""){alert("Invalid or empty value for filename.");e("#theme_2_new_file").focus();return}var r=1;e("#theme_2_file option").each(function(){var n=e(this).val();if(n==t){r=0;return}});if(!r){alert("File with that name already exists.");e("#theme_2_new_file").focus();return}e("select theme_2_file").prop("selected",false);var i=e("<option></option>").val(t).html(n).prop("selected",true);e("#theme_2_file").append(i);e("#theme_2_new_file_container").hide("slow");e("#theme_2_new_file").val("");e("#theme_2_file_contents").val("").focus()});e("#theme_2_new_file_btn_cancel").on("click",function(){e("#theme_2_new_file").val("");e("#theme_2_new_file_container").hide("slow");e(".status",e("#theme_2_new_file_container")).text("").removeClass("app-alert-error")});e("#theme_1_syntax_chk_btn").on("click",function(){var e="#orbisius_ctc_theme_editor_theme_1_form";var t="syntax_check";var n=".orbisius_ctc_theme_editor_theme_1_primary_buttons .status";jQuery(n).empty().removeClass("app-alert-success app-alert-error app-alert-notice").addClass("app-alert-notice").html("Checking ...");jQuery.ajax({type:"post",url:ajaxurl,data:jQuery(e).serialize()+"&action=orbisius_ctc_theme_editor_ajax&sub_cmd="+escape(t),success:function(e){jQuery(n).empty().removeClass("app-alert-notice").html(e.msg).addClass(e.status?"app-alert-success":"app-alert-error");if(e.status){setTimeout(function(){jQuery(n).empty().removeClass("app-alert-success app-alert-error")},2e3)}}})});e("#theme_2_syntax_chk_btn").on("click",function(){var e="#orbisius_ctc_theme_editor_theme_2_form";var t="syntax_check";var n=".orbisius_ctc_theme_editor_theme_2_primary_buttons .status";jQuery(n).empty().removeClass("app-alert-success app-alert-error app-alert-notice").addClass("app-alert-notice").html("Checking ...");jQuery.ajax({type:"post",url:ajaxurl,data:jQuery(e).serialize()+"&action=orbisius_ctc_theme_editor_ajax&sub_cmd="+escape(t),success:function(e){jQuery(n).empty().removeClass("app-alert-notice").html(e.msg).addClass(e.status?"app-alert-success":"app-alert-error");if(e.status){setTimeout(function(){jQuery(n).empty().removeClass("app-alert-success app-alert-error")},2e3)}}})});e("#theme_1_send_btn").on("click",function(){e("#theme_1_send_container").toggle("slow");e("#theme_1_send_to").focus()});e("#theme_1_send_btn_cancel").on("click",function(){e("#theme_1_send_container").hide("slow")});e("#theme_1_send_btn_ok").on("click",function(){var t=jQuery("#theme_1_send_to").val().trim();if(t.indexOf("@")==-1||t.indexOf(".")<1){alert("Invalid email(s).");e("#theme_1_send_to").focus();return}var n="#orbisius_ctc_theme_editor_theme_1_form";var r="send_theme";var i=".orbisius_ctc_theme_editor_theme_1_primary_buttons .status";jQuery(i).empty().removeClass("app-alert-success app-alert-error app-alert-notice").addClass("app-alert-notice").html("Processing ...");jQuery.ajax({type:"post",url:ajaxurl,data:jQuery(n).serialize()+"&action=orbisius_ctc_theme_editor_ajax&sub_cmd="+escape(r),success:function(t){jQuery(i).empty().removeClass("app-alert-notice").html(t.msg).addClass(t.status?"app-alert-success":"app-alert-error");if(t.status){setTimeout(function(){jQuery(i).empty().removeClass("app-alert-success app-alert-error");e("#theme_1_send_btn_cancel").click()},2e3)}}})});e("#theme_2_send_btn").on("click",function(){e("#theme_2_send_container").toggle("slow");e("#theme_2_send_to").focus()});e("#theme_2_send_btn_cancel").on("click",function(){e("#theme_2_send_container").hide("slow")});e("#theme_2_send_btn_ok").on("click",function(){var t=jQuery("#theme_2_send_to").val().trim();if(t.indexOf("@")==-1||t.indexOf(".")<1){alert("Invalid email(s).");e("#theme_2_send_to").focus();return}var n="#orbisius_ctc_theme_editor_theme_2_form";var r="send_theme";var i=".orbisius_ctc_theme_editor_theme_2_primary_buttons .status";jQuery(i).empty().removeClass("app-alert-success app-alert-error app-alert-notice").addClass("app-alert-notice").html("Processing ...");jQuery.ajax({type:"post",url:ajaxurl,data:jQuery(n).serialize()+"&action=orbisius_ctc_theme_editor_ajax&sub_cmd="+escape(r),success:function(t){jQuery(i).empty().removeClass("app-alert-notice").html(t.msg).addClass(t.status?"app-alert-success":"app-alert-error");if(t.status){setTimeout(function(){jQuery(i).empty().removeClass("app-alert-success app-alert-error");e("#theme_2_send_btn_cancel").click()},2e3)}}})});e("#theme_1_new_folder_btn").on("click",function(){e("#theme_1_new_folder_container").toggle("slow");e("#theme_1_new_folder").focus()});e("#theme_2_new_folder_btn").on("click",function(){e("#theme_2_new_folder_container").toggle("slow");e("#theme_2_new_folder").focus()});e("#theme_1_new_folder").on("input",function(t){var n=e("#theme_1_new_folder").val();n=orbisius_child_theme_creator.sanitize_file_name(n);var r=1;e("#theme_1_file option").each(function(){var t=e(this).val();if(t==n){r=0;return}});if(r){e(".status",e("#theme_1_new_folder_container")).text("").removeClass("app-alert-error")}else{var i="File/folder with that name already exists.";e(".status",e("#theme_1_new_folder_container")).text(i).addClass("app-alert-error")}});e("#theme_2_new_folder").on("input",function(t){var n=e("#theme_2_new_folder").val();n=orbisius_child_theme_creator.sanitize_file_name(n);var r=1;e("#theme_2_file option").each(function(){var t=e(this).val();if(t==n){r=0;return}});if(r){e(".status",e("#theme_2_new_folder_container")).text("").removeClass("app-alert-error")}else{var i="File/folder with that name already exists.";e(".status",e("#theme_2_new_folder_container")).text(i).addClass("app-alert-error")}});e("#theme_1_new_folder_btn_ok").on("click",function(){var t=e("#theme_1_new_folder").val();t=orbisius_child_theme_creator.sanitize_file_name(t);var n=t;if(t==""){alert("Invalid or empty value for folder name.");e("#theme_1_new_folder").focus();return}var r=1;e("#theme_1_folder option").each(function(){var n=e(this).val();if(n==t){r=0;return}});if(!r){alert("File with that name already exists.");e("#theme_1_new_folder").focus();return}e("select theme_1_folder").prop("selected",false);var i=e("<option></option>").val(t).html(n).prop("selected",true);e("#theme_1_folder").append(i);e("#theme_1_new_folder_container").hide("slow");e("#theme_1_new_folder").val("");e("#theme_1_folder_contents").val("").focus()});e("#theme_1_new_folder_btn_cancel").on("click",function(){e("#theme_1_new_folder").val("");e("#theme_1_new_folder_container").hide("slow");e(".status",e("#theme_1_new_folder_container")).text("").removeClass("app-alert-error")});e("#theme_2_new_folder_btn_ok").on("click",function(){var t=e("#theme_2_new_folder").val();t=orbisius_child_theme_creator.sanitize_file_name(t);var n=t;if(t==""){alert("Invalid or empty value for folder name.");e("#theme_2_new_folder").focus();return}var r=1;e("#theme_2_folder option").each(function(){var n=e(this).val();if(n==t){r=0;return}});if(!r){alert("File with that name already exists.");e("#theme_2_new_folder").focus();return}e("select theme_2_folder").prop("selected",false);var i=e("<option></option>").val(t).html(n).prop("selected",true);e("#theme_2_folder").append(i);e("#theme_2_new_folder_container").hide("slow");e("#theme_2_new_folder").val("");e("#theme_2_folder_contents").val("").focus()});e("#theme_2_new_folder_btn_cancel").on("click",function(){e("#theme_2_new_folder").val("");e("#theme_2_new_folder_container").hide("slow");e(".status",e("#theme_2_new_folder_container")).text("").removeClass("app-alert-error")});e("#theme_1").on("change",function(){app_load("#orbisius_ctc_theme_editor_theme_1_form","generate_dropdown","#theme_1_file",app_handle_theme_change)});e("#theme_2").on("change",function(){app_load("#orbisius_ctc_theme_editor_theme_2_form","generate_dropdown","#theme_2_file",app_handle_theme_change)});e("#orbisius_ctc_theme_editor_theme_1_form").submit(function(){app_load("#orbisius_ctc_theme_editor_theme_1_form","save_file","#theme_1_file_contents");return false});var t=e("#theme_2").val();if(t!=""){app_load("#orbisius_ctc_theme_editor_theme_2_form","generate_dropdown","#theme_2_file",app_handle_theme_change)}e("#theme_2").on("change",function(){app_load("#orbisius_ctc_theme_editor_theme_2_form","generate_dropdown","#theme_2_file",app_handle_theme_change)});e("#orbisius_ctc_theme_editor_theme_2_form").submit(function(){app_load("#orbisius_ctc_theme_editor_theme_2_form","save_file","#theme_2_file_contents");return false})}function app_handle_theme_change(e,t,n,r){var i=jQuery(e)?jQuery(e).attr("id"):"";i=i||"";if(i==""){return}i=i.replace(/.+(theme[-_]*\d+).*/,"$1");i="#"+i+"_";if(typeof OrbisiusChildThemeCreatorExt!="undefined"&&typeof OrbisiusChildThemeCreatorExt.Editors!="undefined"&&typeof OrbisiusChildThemeCreatorExt.Editors.onThemeChange!="undefined"){var s=i;var s=s.replace(/_+$/g,"");OrbisiusChildThemeCreatorExt.Editors.onThemeChange(s,jQuery(s).val())}var o=jQuery(i+"_file").val();if(o!==""){app_load(e,"load_file",i+"file_contents")}jQuery(i+"file").on("change",function(){app_load(e,"load_file",i+"file_contents")})}function app_load(e,t,n,r){var i='<span class="app-alert-notice">Loading...</span>';var s="Loading...";var o=0;var u=t.indexOf("save")>=0;if(u){if(jQuery(n).is("input,textarea")){jQuery(n).attr("readonly","readonly");jQuery(n).addClass("saving_action")}jQuery(".status",jQuery(n).parent()).html(i)}else{if(jQuery(n).is("input,textarea")){jQuery(n).val(s);jQuery(n).addClass("saving_action")}else if(jQuery(n).is("select")){jQuery(n+" option").text(s)}else{jQuery(n).html(i)}}jQuery.ajax({type:"post",url:ajaxurl,data:jQuery(e).serialize()+"&action=orbisius_ctc_theme_editor_ajax&sub_cmd="+escape(t),success:function(i){if(i!=""){if(jQuery(n).is("input,textarea")){jQuery(n).val(i)}else{jQuery(n).html(i)}if(u){jQuery(".status",jQuery(n).parent()).html("Saved.").addClass("app-alert-success");setTimeout(function(){jQuery(".status",jQuery(n).parent()).empty().removeClass("app-alert-success app-alert-error")},2e3)}}else if(u){jQuery(".status",jQuery(n).parent()).html("Oops. Cannot save.").addClass("app-alert-error")}if(typeof r!="undefined"){r(e,t,n,i)}},complete:function(e){jQuery(n).removeClass("saving_action");if(u){if(jQuery(n).is("input,textarea")){jQuery(n).removeAttr("readonly")}}}})}var orbisius_child_theme_creator={sanitize_file_name:function(e){e=e.replace(/[^\w-.\s]/ig,"");e=e.replace(/\s+/ig,"-");e=e.replace(/\.+/ig,".");e=e.replace(/-+/ig,"-");e=e.replace(/_+/ig,"_");e=e.replace(/^[._-]+/ig,"");e=e.replace(/[._-]+$/ig,"");e=jQuery.trim(e);return e},delete_file:function(e,t){jQuery.ajax({type:"post",url:ajaxurl,data:jQuery(t).serialize()+"&action=orbisius_ctc_theme_editor_ajax&sub_cmd="+escape("delete_file"),success:function(e){var n=t.indexOf("theme_1")>=0?1:2;jQuery("#theme_"+n+"_file option:selected").remove();jQuery("#theme_"+n+"_file").trigger("change")}})}};jQuery(document).ready(function(e){orbisius_ctc_theme_editor_setup()})
|
1 |
+
function orbisius_ctc_theme_editor_setup(){var e=jQuery;var t=e("#theme_1").val();if(t!=""){app_load("#orbisius_ctc_theme_editor_theme_1_form","generate_dropdown","#theme_1_file",app_handle_theme_change)}e("#theme_1_delete_file_btn").on("click",function(){var t=e("#theme_1_file").val();if(confirm("Delete: ["+t+"] ? Are you sure?","")){orbisius_child_theme_creator.delete_file(t,"#orbisius_ctc_theme_editor_theme_1_form")}});e("#theme_2_delete_file_btn").on("click",function(){var t=e("#theme_2_file").val();if(confirm("Delete: ["+t+"] ? Are you sure?","")){orbisius_child_theme_creator.delete_file(t,"#orbisius_ctc_theme_editor_theme_2_form")}});e("#theme_1_new_file_btn").on("click",function(){e("#theme_1_new_file_container").toggle("slow");e("#theme_1_new_file").focus()});e("#theme_1_new_file").on("input",function(t){var n=e("#theme_1_new_file").val();n=orbisius_child_theme_creator.sanitize_file_name(n);var r=1;e("#theme_1_file option").each(function(){var t=e(this).val();if(t==n){r=0;return}});if(r){e(".status",e("#theme_1_new_file_container")).text("").removeClass("app-alert-error")}else{var i="File with that name already exists.";e(".status",e("#theme_1_new_file_container")).text(i).addClass("app-alert-error")}});e("#theme_1_new_file_btn_ok").on("click",function(){var t=e("#theme_1_new_file").val();t=orbisius_child_theme_creator.sanitize_file_name(t);var n=t;if(t==""){alert("Invalid or empty value for filename.");e("#theme_1_new_file").focus();return}var r=1;e("#theme_1_file option").each(function(){var n=e(this).val();if(n==t){r=0;return}});if(!r){alert("File with that name already exists.");e("#theme_1_new_file").focus();return}e("select theme_1_file").prop("selected",false);var i=e("<option></option>").val(t).html(n).prop("selected",true);e("#theme_1_file").append(i);e("#theme_1_new_file_container").hide("slow");e("#theme_1_new_file").val("");e("#theme_1_file_contents").val("").focus()});e("#theme_1_new_file_btn_cancel").on("click",function(){e("#theme_1_new_file").val("");e("#theme_1_new_file_container").hide("slow");e(".status",e("#theme_1_new_file_container")).text("").removeClass("app-alert-error")});e("#theme_2_new_file_btn").on("click",function(){e("#theme_2_new_file_container").toggle("slow");e("#theme_2_new_file").focus()});e("#theme_2_new_file").on("input",function(t){var n=e("#theme_2_new_file").val();n=orbisius_child_theme_creator.sanitize_file_name(n);var r=1;e("#theme_2_file option").each(function(){var t=e(this).val();if(t==n){r=0;return}});if(r){e(".status",e("#theme_2_new_file_container")).text("").removeClass("app-alert-error")}else{var i="File with that name already exists.";e(".status",e("#theme_2_new_file_container")).text(i).addClass("app-alert-error")}});e("#theme_2_new_file_btn_ok").on("click",function(){var t=e("#theme_2_new_file").val();t=orbisius_child_theme_creator.sanitize_file_name(t);var n=t;if(t==""){alert("Invalid or empty value for filename.");e("#theme_2_new_file").focus();return}var r=1;e("#theme_2_file option").each(function(){var n=e(this).val();if(n==t){r=0;return}});if(!r){alert("File with that name already exists.");e("#theme_2_new_file").focus();return}e("select theme_2_file").prop("selected",false);var i=e("<option></option>").val(t).html(n).prop("selected",true);e("#theme_2_file").append(i);e("#theme_2_new_file_container").hide("slow");e("#theme_2_new_file").val("");e("#theme_2_file_contents").val("").focus()});e("#theme_2_new_file_btn_cancel").on("click",function(){e("#theme_2_new_file").val("");e("#theme_2_new_file_container").hide("slow");e(".status",e("#theme_2_new_file_container")).text("").removeClass("app-alert-error")});e("#theme_1_syntax_chk_btn").on("click",function(){var e="#orbisius_ctc_theme_editor_theme_1_form";var t="syntax_check";var n=".orbisius_ctc_theme_editor_theme_1_primary_buttons .status";jQuery(n).empty().removeClass("app-alert-success app-alert-error app-alert-notice").addClass("app-alert-notice").html("Checking ...");jQuery.ajax({type:"post",url:ajaxurl,data:jQuery(e).serialize()+"&action=orbisius_ctc_theme_editor_ajax&sub_cmd="+escape(t),beforeSend:function(){orbisius_child_theme_creator.loader(1)},complete:function(){orbisius_child_theme_creator.loader(0)},success:function(e){jQuery(n).empty().removeClass("app-alert-notice").html(e.msg).addClass(e.status?"app-alert-success":"app-alert-error");if(e.status){setTimeout(function(){jQuery(n).empty().removeClass("app-alert-success app-alert-error")},2e3)}}})});e("#theme_2_syntax_chk_btn").on("click",function(){var e="#orbisius_ctc_theme_editor_theme_2_form";var t="syntax_check";var n=".orbisius_ctc_theme_editor_theme_2_primary_buttons .status";jQuery(n).empty().removeClass("app-alert-success app-alert-error app-alert-notice").addClass("app-alert-notice").html("Checking ...");jQuery.ajax({type:"post",url:ajaxurl,data:jQuery(e).serialize()+"&action=orbisius_ctc_theme_editor_ajax&sub_cmd="+escape(t),beforeSend:function(){orbisius_child_theme_creator.loader(1)},complete:function(){orbisius_child_theme_creator.loader(0)},success:function(e){jQuery(n).empty().removeClass("app-alert-notice").html(e.msg).addClass(e.status?"app-alert-success":"app-alert-error");if(e.status){setTimeout(function(){jQuery(n).empty().removeClass("app-alert-success app-alert-error")},2e3)}}})});e("#theme_1_send_btn").on("click",function(){e("#theme_1_send_container").toggle("slow");e("#theme_1_send_to").focus()});e("#theme_1_send_btn_cancel").on("click",function(){e("#theme_1_send_container").hide("slow")});e("#theme_1_send_btn_ok").on("click",function(){var t=jQuery("#theme_1_send_to").val().trim();if(t.indexOf("@")==-1||t.indexOf(".")<1){alert("Invalid email(s).");e("#theme_1_send_to").focus();return}var n="#orbisius_ctc_theme_editor_theme_1_form";var r="send_theme";var i=".orbisius_ctc_theme_editor_theme_1_primary_buttons .status";jQuery(i).empty().removeClass("app-alert-success app-alert-error app-alert-notice").addClass("app-alert-notice").html("Processing ...");jQuery.ajax({type:"post",url:ajaxurl,data:jQuery(n).serialize()+"&action=orbisius_ctc_theme_editor_ajax&sub_cmd="+escape(r),beforeSend:function(){orbisius_child_theme_creator.loader(1)},complete:function(){orbisius_child_theme_creator.loader(0)},success:function(t){jQuery(i).empty().removeClass("app-alert-notice").html(t.msg).addClass(t.status?"app-alert-success":"app-alert-error");if(t.status){setTimeout(function(){jQuery(i).empty().removeClass("app-alert-success app-alert-error");e("#theme_1_send_btn_cancel").click()},2e3)}}})});e("#theme_2_send_btn").on("click",function(){e("#theme_2_send_container").toggle("slow");e("#theme_2_send_to").focus()});e("#theme_2_send_btn_cancel").on("click",function(){e("#theme_2_send_container").hide("slow")});e("#theme_2_send_btn_ok").on("click",function(){var t=jQuery("#theme_2_send_to").val().trim();if(t.indexOf("@")==-1||t.indexOf(".")<1){alert("Invalid email(s).");e("#theme_2_send_to").focus();return}var n="#orbisius_ctc_theme_editor_theme_2_form";var r="send_theme";var i=".orbisius_ctc_theme_editor_theme_2_primary_buttons .status";jQuery(i).empty().removeClass("app-alert-success app-alert-error app-alert-notice").addClass("app-alert-notice").html("Processing ...");jQuery.ajax({type:"post",url:ajaxurl,data:jQuery(n).serialize()+"&action=orbisius_ctc_theme_editor_ajax&sub_cmd="+escape(r),beforeSend:function(){orbisius_child_theme_creator.loader(1)},complete:function(){orbisius_child_theme_creator.loader(0)},success:function(t){jQuery(i).empty().removeClass("app-alert-notice").html(t.msg).addClass(t.status?"app-alert-success":"app-alert-error");if(t.status){setTimeout(function(){jQuery(i).empty().removeClass("app-alert-success app-alert-error");e("#theme_2_send_btn_cancel").click()},2e3)}}})});e("#theme_1_new_folder_btn").on("click",function(){e("#theme_1_new_folder_container").toggle("slow");e("#theme_1_new_folder").focus()});e("#theme_2_new_folder_btn").on("click",function(){e("#theme_2_new_folder_container").toggle("slow");e("#theme_2_new_folder").focus()});e("#theme_1_new_folder").on("input",function(t){var n=e("#theme_1_new_folder").val();n=orbisius_child_theme_creator.sanitize_file_name(n);var r=1;e("#theme_1_file option").each(function(){var t=e(this).val();if(t==n){r=0;return}});if(r){e(".status",e("#theme_1_new_folder_container")).text("").removeClass("app-alert-error")}else{var i="File/folder with that name already exists.";e(".status",e("#theme_1_new_folder_container")).text(i).addClass("app-alert-error")}});e("#theme_2_new_folder").on("input",function(t){var n=e("#theme_2_new_folder").val();n=orbisius_child_theme_creator.sanitize_file_name(n);var r=1;e("#theme_2_file option").each(function(){var t=e(this).val();if(t==n){r=0;return}});if(r){e(".status",e("#theme_2_new_folder_container")).text("").removeClass("app-alert-error")}else{var i="File/folder with that name already exists.";e(".status",e("#theme_2_new_folder_container")).text(i).addClass("app-alert-error")}});e("#theme_1_new_folder_btn_ok").on("click",function(){var t=e("#theme_1_new_folder").val();t=orbisius_child_theme_creator.sanitize_file_name(t);var n=t;if(t==""){alert("Invalid or empty value for folder name.");e("#theme_1_new_folder").focus();return}var r=1;e("#theme_1_folder option").each(function(){var n=e(this).val();if(n==t){r=0;return}});if(!r){alert("File with that name already exists.");e("#theme_1_new_folder").focus();return}e("select theme_1_folder").prop("selected",false);var i=e("<option></option>").val(t).html(n).prop("selected",true);e("#theme_1_folder").append(i);e("#theme_1_new_folder_container").hide("slow");e("#theme_1_new_folder").val("");e("#theme_1_folder_contents").val("").focus()});e("#theme_1_new_folder_btn_cancel").on("click",function(){e("#theme_1_new_folder").val("");e("#theme_1_new_folder_container").hide("slow");e(".status",e("#theme_1_new_folder_container")).text("").removeClass("app-alert-error")});e("#theme_2_new_folder_btn_ok").on("click",function(){var t=e("#theme_2_new_folder").val();t=orbisius_child_theme_creator.sanitize_file_name(t);var n=t;if(t==""){alert("Invalid or empty value for folder name.");e("#theme_2_new_folder").focus();return}var r=1;e("#theme_2_folder option").each(function(){var n=e(this).val();if(n==t){r=0;return}});if(!r){alert("File with that name already exists.");e("#theme_2_new_folder").focus();return}e("select theme_2_folder").prop("selected",false);var i=e("<option></option>").val(t).html(n).prop("selected",true);e("#theme_2_folder").append(i);e("#theme_2_new_folder_container").hide("slow");e("#theme_2_new_folder").val("");e("#theme_2_folder_contents").val("").focus()});e("#theme_2_new_folder_btn_cancel").on("click",function(){e("#theme_2_new_folder").val("");e("#theme_2_new_folder_container").hide("slow");e(".status",e("#theme_2_new_folder_container")).text("").removeClass("app-alert-error")});e("#theme_1").on("change",function(){app_load("#orbisius_ctc_theme_editor_theme_1_form","generate_dropdown","#theme_1_file",app_handle_theme_change)});e("#theme_2").on("change",function(){app_load("#orbisius_ctc_theme_editor_theme_2_form","generate_dropdown","#theme_2_file",app_handle_theme_change)});e("#orbisius_ctc_theme_editor_theme_1_form").submit(function(e){app_load("#orbisius_ctc_theme_editor_theme_1_form","save_file","#theme_1_file_contents");return false});var t=e("#theme_2").val();if(t!=""){app_load("#orbisius_ctc_theme_editor_theme_2_form","generate_dropdown","#theme_2_file",app_handle_theme_change)}e("#theme_2").on("change",function(){app_load("#orbisius_ctc_theme_editor_theme_2_form","generate_dropdown","#theme_2_file",app_handle_theme_change)});e("#orbisius_ctc_theme_editor_theme_2_form").submit(function(){app_load("#orbisius_ctc_theme_editor_theme_2_form","save_file","#theme_2_file_contents");return false})}function app_handle_theme_change(e,t,n,r){var i=jQuery(e)?jQuery(e).attr("id"):"";i=i||"";if(i==""){return}i=i.replace(/.+(theme[-_]*\d+).*/,"$1");i="#"+i+"_";if(typeof OrbisiusChildThemeCreatorExt!="undefined"&&typeof OrbisiusChildThemeCreatorExt.Editors!="undefined"&&typeof OrbisiusChildThemeCreatorExt.Editors.onThemeChange!="undefined"){var s=i;var s=s.replace(/_+$/g,"");OrbisiusChildThemeCreatorExt.Editors.onThemeChange(s,jQuery(s).val())}var o=jQuery(i+"_file").val();if(o!==""){app_load(e,"load_file",i+"file_contents")}jQuery(i+"file").on("change",function(){app_load(e,"load_file",i+"file_contents")})}function app_load(e,t,n,r){var i='<span class="app-alert-notice">Loading...</span>';var s="Loading...";var o=0;var u=t.indexOf("save")>=0;if(u){if(jQuery(n).is("input,textarea")){jQuery(n).attr("readonly","readonly");jQuery(n).addClass("saving_action")}jQuery(".status",jQuery(n).parent()).html(i)}else{if(jQuery(n).is("input,textarea")){jQuery(n).addClass("saving_action")}else if(jQuery(n).is("select")){jQuery(n+" option").text(s)}else{jQuery(n).html(i)}}jQuery.ajax({type:"post",url:ajaxurl,data:jQuery(e).serialize()+"&action=orbisius_ctc_theme_editor_ajax&sub_cmd="+escape(t),success:function(i){var s={form_id:e,sub_cmd:t,result:i};if(i!=""){if(jQuery(n).is("input,textarea")){jQuery(n).val(i);if(jQuery(n).is("textarea")){jQuery(n).trigger("orbisius_child_theme_editor_event_file_loaded",s)}}else{jQuery(n).html(i);jQuery(n).trigger("orbisius_child_theme_editor_event_content_loaded",s)}if(u){jQuery(".status",jQuery(n).parent()).html("Saved.").addClass("app-alert-success");setTimeout(function(){jQuery(".status",jQuery(n).parent()).empty().removeClass("app-alert-success app-alert-error")},2e3)}}else if(u){jQuery(".status",jQuery(n).parent()).html("Oops. Cannot save.").addClass("app-alert-error")}if(typeof r!="undefined"){r(e,t,n,i)}},beforeSend:function(){orbisius_child_theme_creator.loader(1)},complete:function(e){orbisius_child_theme_creator.loader(0);jQuery(n).removeClass("saving_action");if(u){if(jQuery(n).is("input,textarea")){jQuery(n).removeAttr("readonly")}}}})}var orbisius_child_theme_creator={loader:function(e){var t=jQuery(".orbisius_child_theme_creator_container .loader");if(e){jQuery(t).html("Please Wait ...").show()}else{jQuery(t).html("").hide()}},sanitize_file_name:function(e){e=e.replace(/[^\w-.\s]/ig,"");e=e.replace(/\s+/ig,"-");e=e.replace(/\.+/ig,".");e=e.replace(/-+/ig,"-");e=e.replace(/_+/ig,"_");e=e.replace(/^[._-]+/ig,"");e=e.replace(/[._-]+$/ig,"");e=jQuery.trim(e);return e},delete_file:function(e,t){jQuery.ajax({type:"post",url:ajaxurl,data:jQuery(t).serialize()+"&action=orbisius_ctc_theme_editor_ajax&sub_cmd="+escape("delete_file"),beforeSend:function(){orbisius_child_theme_creator.loader(1)},complete:function(){orbisius_child_theme_creator.loader(0)},success:function(e){var n=t.indexOf("theme_1")>=0?1:2;jQuery("#theme_"+n+"_file option:selected").remove();jQuery("#theme_"+n+"_file").trigger("change")}})}};jQuery(document).ready(function(e){orbisius_ctc_theme_editor_setup()})
|
orbisius-child-theme-creator.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Orbisius Child Theme Creator
|
4 |
Plugin URI: http://club.orbisius.com/products/wordpress-plugins/orbisius-child-theme-creator/
|
5 |
Description: This plugin allows you to quickly create child themes from any theme that you have currently installed on your site/blog.
|
6 |
-
Version: 1.2.
|
7 |
Author: Svetoslav Marinov (Slavi)
|
8 |
Author URI: http://orbisius.com
|
9 |
*/
|
@@ -38,7 +38,7 @@ add_action('network_admin_notices', 'orbisius_child_theme_creator_admin_notice_m
|
|
38 |
add_action('wp_before_admin_bar_render', 'orbisius_child_theme_creator_admin_bar_render', 100);
|
39 |
|
40 |
add_action( 'wp_ajax_orbisius_ctc_theme_editor_ajax', 'orbisius_ctc_theme_editor_ajax');
|
41 |
-
add_action( 'wp_ajax_nopriv_orbisius_ctc_theme_editor_ajax', '
|
42 |
|
43 |
|
44 |
register_activation_hook( __FILE__, 'orbisius_child_theme_creator_on_activate' );
|
@@ -758,17 +758,20 @@ function orbisius_child_theme_creator_tools_action() {
|
|
758 |
target="_blank" title="Opens in new tab/window. qSandbox is a FREE service that allows you to setup a test/sandbox WordPress site in 2 seconds. No technical knowledge is required.
|
759 |
Test themes and plugins before you actually put them on your site">Free Test Site</a> <small>(2 sec setup)</small>
|
760 |
|
|
|
|
|
|
|
761 |
| <a href="http://orbisius.com/page/free-quote/?utm_source=child-theme-creator&utm_medium=plugin-links&utm_campaign=plugin-update"
|
762 |
target="_blank" title="If you want a custom web/mobile app or a plugin developed contact us. This opens in a new window/tab">Hire Us</a>
|
763 |
|
764 |
-
| <a href="http://orbisius.
|
765 |
-
title="This opens in a new window/tab">Newsletter</a>
|
766 |
|
767 |
-
| <a href="http://club.orbisius.com/
|
768 |
|
769 |
-
| <a href="http://
|
|
|
770 |
|
771 |
-
|
772 |
</div>
|
773 |
|
774 |
<?php echo $msg; ?>
|
@@ -1919,6 +1922,9 @@ function orbisius_ctc_theme_editor() {
|
|
1919 |
<a href="http://qsandbox.com/?utm_source=orbisius-child-theme-editor&utm_medium=action_screen&utm_campaign=product"
|
1920 |
target="_blank" title="Opens in new tab/window. qSandbox is a FREE service that allows you to setup a test/sandbox WordPress site in 2 seconds. No technical knowledge is required.
|
1921 |
Test themes and plugins before you actually put them on your site">Free Test Site</a> <small>(2 sec setup)</small>
|
|
|
|
|
|
|
1922 |
|
1923 |
| <a href="http://orbisius.com/page/free-quote/?utm_source=child-theme-editor&utm_medium=plugin-links&utm_campaign=plugin-update"
|
1924 |
target="_blank" title="If you want a custom web/mobile app or a plugin developed contact us. This opens in a new window/tab">Hire Us</a>
|
@@ -1931,7 +1937,10 @@ function orbisius_ctc_theme_editor() {
|
|
1931 |
| <a href="http://club.orbisius.com/products/wordpress-plugins/orbisius-child-theme-creator/?utm_source=orbisius-child-theme-editor&utm_medium=action_screen&utm_campaign=product" target="_blank" title="[new window]">Product Page</a>
|
1932 |
</div>
|
1933 |
|
1934 |
-
<div class="updated"><p
|
|
|
|
|
|
|
1935 |
|
1936 |
<?php
|
1937 |
$buff = $theme_1_file = $theme_2_file = '';
|
@@ -1986,7 +1995,14 @@ function orbisius_ctc_theme_editor() {
|
|
1986 |
<?php echo orbisius_child_theme_creator_html::html_select('theme_1_file', $theme_1_file, $html_dropdown_theme_1_files); ?>
|
1987 |
</span>
|
1988 |
|
1989 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1990 |
|
1991 |
<div class="orbisius_ctc_theme_editor_theme_1_primary_buttons primary_buttons">
|
1992 |
<button type='submit' class='button button-primary' id="theme_1_submit" name="theme_1_submit">Save Changes</button>
|
@@ -2034,13 +2050,17 @@ function orbisius_ctc_theme_editor() {
|
|
2034 |
</div>
|
2035 |
<!-- /send -->
|
2036 |
|
2037 |
-
<div>
|
2038 |
-
<h3>
|
2039 |
-
<span>
|
2040 |
-
|
|
|
|
|
|
|
|
|
2041 |
<li><a href="http://club.orbisius.com/products/wordpress-plugins/orbisius-theme-switcher/?utm_source=orbisius-child-theme-creator&utm_medium=editors&utm_campaign=product"
|
2042 |
target="_blank" title="Opens in a new tab/window">Orbisius Theme Switcher</a> - Allows you to preview any of the installed themes on your site.</li>
|
2043 |
-
</ul
|
2044 |
</div>
|
2045 |
|
2046 |
<!-- new folder -->
|
@@ -2070,7 +2090,15 @@ function orbisius_ctc_theme_editor() {
|
|
2070 |
<?php echo orbisius_child_theme_creator_html::html_select('theme_2_file', $theme_2_file, $html_dropdown_theme_1_files); ?>
|
2071 |
</span>
|
2072 |
|
2073 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2074 |
<div class="orbisius_ctc_theme_editor_theme_2_primary_buttons primary_buttons">
|
2075 |
<button type='submit' class='button button-primary' id="theme_2_submit" name="theme_2_submit">Save Changes</button>
|
2076 |
<span class="status"></span>
|
@@ -2120,15 +2148,18 @@ function orbisius_ctc_theme_editor() {
|
|
2120 |
</td>
|
2121 |
</tr>
|
2122 |
</table>
|
2123 |
-
|
2124 |
<br/>
|
2125 |
<?php orbisius_child_theme_creator_util::output_orb_widget(); ?>
|
2126 |
<?php
|
2127 |
}
|
2128 |
|
|
|
|
|
|
|
|
|
2129 |
/**
|
2130 |
* This is called via ajax. Depending on the sub_cmd param a different method will be called.
|
2131 |
-
*
|
2132 |
*/
|
2133 |
function orbisius_ctc_theme_editor_ajax() {
|
2134 |
$buff = 'INVALID AJAX SUB_CMD';
|
3 |
Plugin Name: Orbisius Child Theme Creator
|
4 |
Plugin URI: http://club.orbisius.com/products/wordpress-plugins/orbisius-child-theme-creator/
|
5 |
Description: This plugin allows you to quickly create child themes from any theme that you have currently installed on your site/blog.
|
6 |
+
Version: 1.2.4
|
7 |
Author: Svetoslav Marinov (Slavi)
|
8 |
Author URI: http://orbisius.com
|
9 |
*/
|
38 |
add_action('wp_before_admin_bar_render', 'orbisius_child_theme_creator_admin_bar_render', 100);
|
39 |
|
40 |
add_action( 'wp_ajax_orbisius_ctc_theme_editor_ajax', 'orbisius_ctc_theme_editor_ajax');
|
41 |
+
add_action( 'wp_ajax_nopriv_orbisius_ctc_theme_editor_ajax', 'orbisius_ctc_theme_editor_no_auth_ajax');
|
42 |
|
43 |
|
44 |
register_activation_hook( __FILE__, 'orbisius_child_theme_creator_on_activate' );
|
758 |
target="_blank" title="Opens in new tab/window. qSandbox is a FREE service that allows you to setup a test/sandbox WordPress site in 2 seconds. No technical knowledge is required.
|
759 |
Test themes and plugins before you actually put them on your site">Free Test Site</a> <small>(2 sec setup)</small>
|
760 |
|
761 |
+
| <a href="http://club.orbisius.com/products/wordpress-plugins/orbisius-child-theme-creator-pro/?utm_source=orbisius-child-theme-creator&utm_medium=action_screen&utm_campaign=product"
|
762 |
+
target="_blank" title="[new window]" style="font-weight: bolder;color:red;">Pro Addon <sup>New!</sup></a>
|
763 |
+
|
764 |
| <a href="http://orbisius.com/page/free-quote/?utm_source=child-theme-creator&utm_medium=plugin-links&utm_campaign=plugin-update"
|
765 |
target="_blank" title="If you want a custom web/mobile app or a plugin developed contact us. This opens in a new window/tab">Hire Us</a>
|
766 |
|
767 |
+
| <a href="http://club.orbisius.com/forums/forum/community-support-forum/wordpress-plugins/orbisius-child-theme-creator/?utm_source=orbisius-child-theme-creator&utm_medium=action_screen&utm_campaign=product" target="_blank" title="[new window]">Support Forums</a>
|
|
|
768 |
|
769 |
+
| <a href="http://club.orbisius.com/products/wordpress-plugins/orbisius-child-theme-creator/?utm_source=orbisius-child-theme-creator&utm_medium=action_screen&utm_campaign=product" target="_blank" title="[new window]">Product Page</a>
|
770 |
|
771 |
+
| <a href="http://orbisius.us2.list-manage.com/subscribe?u=005070a78d0e52a7b567e96df&id=1b83cd2093" target="_blank"
|
772 |
+
title="This opens in a new window/tab">Newsletter</a>
|
773 |
|
774 |
+
<!--| <a href="#help" title="">Help</a>-->
|
775 |
</div>
|
776 |
|
777 |
<?php echo $msg; ?>
|
1922 |
<a href="http://qsandbox.com/?utm_source=orbisius-child-theme-editor&utm_medium=action_screen&utm_campaign=product"
|
1923 |
target="_blank" title="Opens in new tab/window. qSandbox is a FREE service that allows you to setup a test/sandbox WordPress site in 2 seconds. No technical knowledge is required.
|
1924 |
Test themes and plugins before you actually put them on your site">Free Test Site</a> <small>(2 sec setup)</small>
|
1925 |
+
|
1926 |
+
| <a href="http://club.orbisius.com/products/wordpress-plugins/orbisius-child-theme-creator-pro/?utm_source=orbisius-child-theme-editor&utm_medium=action_screen&utm_campaign=product"
|
1927 |
+
target="_blank" title="[new window]" style="font-weight: bolder;color:red;">Pro Addon <sup>New!</sup></a>
|
1928 |
|
1929 |
| <a href="http://orbisius.com/page/free-quote/?utm_source=child-theme-editor&utm_medium=plugin-links&utm_campaign=plugin-update"
|
1930 |
target="_blank" title="If you want a custom web/mobile app or a plugin developed contact us. This opens in a new window/tab">Hire Us</a>
|
1937 |
| <a href="http://club.orbisius.com/products/wordpress-plugins/orbisius-child-theme-creator/?utm_source=orbisius-child-theme-editor&utm_medium=action_screen&utm_campaign=product" target="_blank" title="[new window]">Product Page</a>
|
1938 |
</div>
|
1939 |
|
1940 |
+
<div class="updated"><p>
|
1941 |
+
<?php echo $msg; ?>
|
1942 |
+
<span class="loader app-alert-notice"></span>
|
1943 |
+
</p></div>
|
1944 |
|
1945 |
<?php
|
1946 |
$buff = $theme_1_file = $theme_2_file = '';
|
1995 |
<?php echo orbisius_child_theme_creator_html::html_select('theme_1_file', $theme_1_file, $html_dropdown_theme_1_files); ?>
|
1996 |
</span>
|
1997 |
|
1998 |
+
<span class="orbisius_ctc_theme_editor_theme_1_primary_buttons primary_buttons">
|
1999 |
+
<button type='submit' class='button button-primary' id="theme_1_submit" name="theme_1_submit">Save</button>
|
2000 |
+
<span class="status"></span>
|
2001 |
+
</span>
|
2002 |
+
|
2003 |
+
<div id="theme_1_file_contents_container">
|
2004 |
+
<textarea id="theme_1_file_contents" name="theme_1_file_contents" rows="22" class="widefat"></textarea>
|
2005 |
+
</div>
|
2006 |
|
2007 |
<div class="orbisius_ctc_theme_editor_theme_1_primary_buttons primary_buttons">
|
2008 |
<button type='submit' class='button button-primary' id="theme_1_submit" name="theme_1_submit">Save Changes</button>
|
2050 |
</div>
|
2051 |
<!-- /send -->
|
2052 |
|
2053 |
+
<div style="border:1px solid #ccc;margin:10px 0;padding:3px 5px;">
|
2054 |
+
<h3>Pro Addon is now available!</h3>
|
2055 |
+
<span>Get more cool features by purchasing the </span>
|
2056 |
+
|
2057 |
+
<a href="http://club.orbisius.com/products/wordpress-plugins/orbisius-child-theme-creator-pro/?utm_source=orbisius-child-theme-editor&utm_medium=footer&utm_campaign=product"
|
2058 |
+
target="_blank" title="[new window]" style="font-weight: bolder;color:red;text-decoration: underline;">Pro Addon</a> <sup>New!</sup>
|
2059 |
+
|
2060 |
+
<!--<ul>
|
2061 |
<li><a href="http://club.orbisius.com/products/wordpress-plugins/orbisius-theme-switcher/?utm_source=orbisius-child-theme-creator&utm_medium=editors&utm_campaign=product"
|
2062 |
target="_blank" title="Opens in a new tab/window">Orbisius Theme Switcher</a> - Allows you to preview any of the installed themes on your site.</li>
|
2063 |
+
</ul>-->
|
2064 |
</div>
|
2065 |
|
2066 |
<!-- new folder -->
|
2090 |
<?php echo orbisius_child_theme_creator_html::html_select('theme_2_file', $theme_2_file, $html_dropdown_theme_1_files); ?>
|
2091 |
</span>
|
2092 |
|
2093 |
+
<span class="orbisius_ctc_theme_editor_theme_2_primary_buttons primary_buttons">
|
2094 |
+
<button type='submit' class='button button-primary' id="theme_2_submit" name="theme_2_submit">Save</button>
|
2095 |
+
<span class="status"></span>
|
2096 |
+
</span>
|
2097 |
+
|
2098 |
+
<div id="theme_2_file_contents_container">
|
2099 |
+
<textarea id="theme_2_file_contents" name="theme_2_file_contents" rows="22" class="widefat"></textarea>
|
2100 |
+
</div>
|
2101 |
+
|
2102 |
<div class="orbisius_ctc_theme_editor_theme_2_primary_buttons primary_buttons">
|
2103 |
<button type='submit' class='button button-primary' id="theme_2_submit" name="theme_2_submit">Save Changes</button>
|
2104 |
<span class="status"></span>
|
2148 |
</td>
|
2149 |
</tr>
|
2150 |
</table>
|
2151 |
+
|
2152 |
<br/>
|
2153 |
<?php orbisius_child_theme_creator_util::output_orb_widget(); ?>
|
2154 |
<?php
|
2155 |
}
|
2156 |
|
2157 |
+
function orbisius_ctc_theme_editor_no_auth_ajax() {
|
2158 |
+
wp_die('You need to be logged in. To call this ajax method.');
|
2159 |
+
}
|
2160 |
+
|
2161 |
/**
|
2162 |
* This is called via ajax. Depending on the sub_cmd param a different method will be called.
|
|
|
2163 |
*/
|
2164 |
function orbisius_ctc_theme_editor_ajax() {
|
2165 |
$buff = 'INVALID AJAX SUB_CMD';
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
|
|
4 |
Tags: theme,child theme,childtheme,childthemes,parent theme,child themes,CSS,styling,resposive design,design,custom themeing, shared hosting,theme editor theme,themes,wp,wordpress,orbisius,theme creator,custom theme,theme generator,css,css editor
|
5 |
Requires at least: 3.4
|
6 |
Tested up to: 4.1
|
7 |
-
Stable tag: 1.2.
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Create Child Themes quickly and easily from any theme that you have currently installed on your site/blog.
|
@@ -47,6 +47,11 @@ It features two editors and you can pick snippets from one theme and paste into
|
|
47 |
* Lots of cool and professional people do it
|
48 |
* ... and a lot more
|
49 |
|
|
|
|
|
|
|
|
|
|
|
50 |
= Important =
|
51 |
> We have noticed that some child themes created by this plugin do not work as expected.
|
52 |
> This is not a bug in this plugin but could be caused by theme authors using custom theme frameworks and/or do not using WordPress' recommended functions for themes that support child themes.
|
@@ -136,6 +141,13 @@ Let's talk.
|
|
136 |
|
137 |
== Changelog ==
|
138 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
= 1.2.3 =
|
140 |
* Tested with WP 4.1
|
141 |
|
4 |
Tags: theme,child theme,childtheme,childthemes,parent theme,child themes,CSS,styling,resposive design,design,custom themeing, shared hosting,theme editor theme,themes,wp,wordpress,orbisius,theme creator,custom theme,theme generator,css,css editor
|
5 |
Requires at least: 3.4
|
6 |
Tested up to: 4.1
|
7 |
+
Stable tag: 1.2.4
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Create Child Themes quickly and easily from any theme that you have currently installed on your site/blog.
|
47 |
* Lots of cool and professional people do it
|
48 |
* ... and a lot more
|
49 |
|
50 |
+
= Pro Addon is Now Available =
|
51 |
+
We've just released the
|
52 |
+
<a href="http://club.orbisius.com/products/wordpress-plugins/orbisius-child-theme-creator-pro/?utm_source=orbisius-child-theme-creator&utm_medium=readme&utm_campaign=product"
|
53 |
+
target="_blank" title="[new window]" style="font-weight: bolder;color:red;">Pro Addon</a> which improves on the current functionality.
|
54 |
+
|
55 |
= Important =
|
56 |
> We have noticed that some child themes created by this plugin do not work as expected.
|
57 |
> This is not a bug in this plugin but could be caused by theme authors using custom theme frameworks and/or do not using WordPress' recommended functions for themes that support child themes.
|
141 |
|
142 |
== Changelog ==
|
143 |
|
144 |
+
= 1.2.4 =
|
145 |
+
* Made the plugin more extendable (js).
|
146 |
+
* Added another Save button near the theme and file dropdowns (for lazy people).
|
147 |
+
* Added links to the Pro addon.
|
148 |
+
* Added a nice global wait for all ajax calls.
|
149 |
+
* Added an error message to be displayed when we're doing ajax and the user is not authenticated.
|
150 |
+
|
151 |
= 1.2.3 =
|
152 |
* Tested with WP 4.1
|
153 |
|