Version Description
- Changed twitter non-ssl links to protocol relative URLs.
- Added LOCK_SH for the file read operation
- Added a flag to tell if the content editors are 'dirty' i.e. their content was modified.
- Added a border to the content box if modified.
- Warn the user if there's unsaved content in either of the editors. The browser won't display the actual message I've provided which is stupid.
- TODO: check php syntax before saving for php files - remove button to check syntax?
- Users now can create new files in non-existing folders e.g. headers/header-two.php
- When the admin creates a new file we'll scroll to the element so he/she can start typing
- Tested with WP 4.7
Download this release
Release Info
Developer | lordspace |
Plugin | Child Theme Creator by Orbisius |
Version | 1.3.5 |
Comparing to | |
See all releases |
Code changes from version 1.3.4 to 1.3.5
- assets/main.css +5 -0
- assets/main.js +67 -1
- assets/main.min.css +1 -1
- assets/main.min.js +1 -1
- nbproject/private/private.xml +43 -9
- orbisius-child-theme-creator.php +46 -17
- readme.txt +22 -2
assets/main.css
CHANGED
@@ -134,3 +134,8 @@
|
|
134 |
.orbisius_ctc_theme_editor_container .primary_buttons {
|
135 |
margin-top:5px;
|
136 |
}
|
|
|
|
|
|
|
|
|
|
134 |
.orbisius_ctc_theme_editor_container .primary_buttons {
|
135 |
margin-top:5px;
|
136 |
}
|
137 |
+
|
138 |
+
.orbisius_ctc_theme_editor_theme_1_form .modified_content,
|
139 |
+
.orbisius_ctc_theme_editor_theme_2_form .modified_content {
|
140 |
+
border: 1px dashed #D54E21/* !important*/;
|
141 |
+
}
|
assets/main.js
CHANGED
@@ -15,7 +15,7 @@ var orbisius_child_theme_creator = {
|
|
15 |
* @returns str
|
16 |
*/
|
17 |
sanitize_file_name : function (val) {
|
18 |
-
val = val.replace(/[^\w
|
19 |
val = val.replace(/\s+/ig, '-');
|
20 |
val = val.replace(/\.+/ig, '.');
|
21 |
val = val.replace(/-+/ig, '-');
|
@@ -78,6 +78,26 @@ jQuery(document).ready(function($) {
|
|
78 |
*/
|
79 |
function orbisius_ctc_theme_editor_setup() {
|
80 |
var $ = jQuery;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
|
82 |
var current_theme_dir = $('#theme_1').val();
|
83 |
|
@@ -86,6 +106,25 @@ function orbisius_ctc_theme_editor_setup() {
|
|
86 |
app_load('#orbisius_ctc_theme_editor_theme_1_form', 'generate_dropdown', '#theme_1_file', app_handle_theme_change);
|
87 |
}
|
88 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
90 |
// Delete File #1
|
91 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
@@ -184,8 +223,21 @@ function orbisius_ctc_theme_editor_setup() {
|
|
184 |
$('#theme_1_new_file_container').hide('slow');
|
185 |
$('#theme_1_new_file').val(''); // text box for new file
|
186 |
$('#theme_1_file_contents').val('').focus(); // textarea
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
187 |
});
|
188 |
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
// This is when the cancel button is clicked so the user doesn't want a new file.
|
190 |
$('#theme_1_new_file_btn_cancel').on("click", function () {
|
191 |
$('#theme_1_new_file').val('');
|
@@ -269,6 +321,13 @@ function orbisius_ctc_theme_editor_setup() {
|
|
269 |
$('#theme_2_new_file_container').hide('slow');
|
270 |
$('#theme_2_new_file').val(''); // text box for new file
|
271 |
$('#theme_2_file_contents').val('').focus(); // textarea
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
272 |
});
|
273 |
|
274 |
// This is when the cancel button is clicked so the user doesn't want a new file.
|
@@ -811,6 +870,13 @@ function app_load(form_id, action, target_container, callback) {
|
|
811 |
setTimeout(function () {
|
812 |
jQuery('.status', jQuery(target_container).parent()).empty().removeClass('app-alert-success app-alert-error');
|
813 |
}, 2000);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
814 |
}
|
815 |
} else if (is_save_action) { // save action
|
816 |
jQuery('.status', jQuery(target_container).parent()).html('Oops. Cannot save.').addClass('app-alert-error');
|
15 |
* @returns str
|
16 |
*/
|
17 |
sanitize_file_name : function (val) {
|
18 |
+
val = val.replace(/[^\w\-\.\s\/\\]/ig, '');
|
19 |
val = val.replace(/\s+/ig, '-');
|
20 |
val = val.replace(/\.+/ig, '.');
|
21 |
val = val.replace(/-+/ig, '-');
|
78 |
*/
|
79 |
function orbisius_ctc_theme_editor_setup() {
|
80 |
var $ = jQuery;
|
81 |
+
var onbeforeunload_old = window.onbeforeunload;
|
82 |
+
|
83 |
+
// Let's warn the user if there's unsaved content.
|
84 |
+
// The browser don't display the actual message I've provided which is stupid.
|
85 |
+
$(window).on('beforeunload', function(e) {
|
86 |
+
var message = '';
|
87 |
+
|
88 |
+
if ( jQuery( '#theme_1_file_contents' ).data( 'orb_ctc_modified_content' ) ) {
|
89 |
+
message = "Left Editor: Content was modified. Are you sure you want to leave without saving?";
|
90 |
+
} else if ( jQuery( '#theme_2_file_contents' ).data( 'orb_ctc_modified_content' ) ) {
|
91 |
+
message = "Right Editor: Content was modified. Are you sure you want to leave without saving?";
|
92 |
+
}
|
93 |
+
|
94 |
+
if ( message != '' ) {
|
95 |
+
e.returnValue = message;
|
96 |
+
return message;
|
97 |
+
} else if ( typeof onbeforeunload_old != 'undefined' ) {
|
98 |
+
return onbeforeunload_old(e);
|
99 |
+
}
|
100 |
+
});
|
101 |
|
102 |
var current_theme_dir = $('#theme_1').val();
|
103 |
|
106 |
app_load('#orbisius_ctc_theme_editor_theme_1_form', 'generate_dropdown', '#theme_1_file', app_handle_theme_change);
|
107 |
}
|
108 |
|
109 |
+
$( '#theme_1_file_contents,#theme_2_file_contents' ).on( 'keyup keypress input paste', function (e) { // keydown propertychange change click
|
110 |
+
var custm_event_data = {
|
111 |
+
target : $( this ),
|
112 |
+
event : e
|
113 |
+
};
|
114 |
+
|
115 |
+
jQuery(document).trigger('orbisius_child_theme_editor_event_content_updated', [ custm_event_data ] );
|
116 |
+
} );
|
117 |
+
|
118 |
+
jQuery(document).on('orbisius_child_theme_editor_event_content_updated', function ( e, ctx_data ) {
|
119 |
+
jQuery( ctx_data.target ).data( 'orb_ctc_modified_content', 1 );
|
120 |
+
jQuery( ctx_data.target ).addClass( 'modified_content' );
|
121 |
+
} );
|
122 |
+
|
123 |
+
jQuery(document).on('orbisius_child_theme_editor_event_content_saved', function ( e, ctx_data ) {
|
124 |
+
jQuery( ctx_data.target ).removeData( 'orb_ctc_modified_content' );
|
125 |
+
jQuery( ctx_data.target ).removeClass( 'modified_content' );
|
126 |
+
} );
|
127 |
+
|
128 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
129 |
// Delete File #1
|
130 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
223 |
$('#theme_1_new_file_container').hide('slow');
|
224 |
$('#theme_1_new_file').val(''); // text box for new file
|
225 |
$('#theme_1_file_contents').val('').focus(); // textarea
|
226 |
+
|
227 |
+
var custum_event_data = {
|
228 |
+
file : val,
|
229 |
+
file_selector : '#theme_1_file',
|
230 |
+
content_selector : '#theme_1_file_contents'
|
231 |
+
};
|
232 |
+
jQuery(document).trigger( 'orbisius_child_theme_editor_event_new_file', [ custum_event_data ] );
|
233 |
});
|
234 |
|
235 |
+
// When the admin creates a new file we'll scroll to the element so he/she can start typing
|
236 |
+
// http://stackoverflow.com/questions/6682451/animate-scroll-to-id-on-page-load
|
237 |
+
jQuery(document).on( 'orbisius_child_theme_editor_event_new_file', function(obj, custom_data) {
|
238 |
+
$("html, body").animate({ scrollTop: jQuery( custom_data.file_selector ).offset().top - 50 }, 1000);
|
239 |
+
} );
|
240 |
+
|
241 |
// This is when the cancel button is clicked so the user doesn't want a new file.
|
242 |
$('#theme_1_new_file_btn_cancel').on("click", function () {
|
243 |
$('#theme_1_new_file').val('');
|
321 |
$('#theme_2_new_file_container').hide('slow');
|
322 |
$('#theme_2_new_file').val(''); // text box for new file
|
323 |
$('#theme_2_file_contents').val('').focus(); // textarea
|
324 |
+
|
325 |
+
var custum_event_data = {
|
326 |
+
file : val,
|
327 |
+
file_selector : '#theme_2_file',
|
328 |
+
content_selector : '#theme_2_file_contents'
|
329 |
+
};
|
330 |
+
jQuery(document).trigger( 'orbisius_child_theme_editor_event_new_file', [ custum_event_data ] );
|
331 |
});
|
332 |
|
333 |
// This is when the cancel button is clicked so the user doesn't want a new file.
|
870 |
setTimeout(function () {
|
871 |
jQuery('.status', jQuery(target_container).parent()).empty().removeClass('app-alert-success app-alert-error');
|
872 |
}, 2000);
|
873 |
+
|
874 |
+
var custm_event_data = {
|
875 |
+
target : jQuery( target_container ),
|
876 |
+
event : {}
|
877 |
+
};
|
878 |
+
jQuery(document).trigger('orbisius_child_theme_editor_event_content_saved', [ custm_event_data ] );
|
879 |
+
|
880 |
}
|
881 |
} else if (is_save_action) { // save action
|
882 |
jQuery('.status', jQuery(target_container).parent()).html('Oops. Cannot save.').addClass('app-alert-error');
|
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 #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}
|
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}.orbisius_ctc_theme_editor_theme_1_form .modified_content,.orbisius_ctc_theme_editor_theme_2_form .modified_content{border:1px dashed #D54E21}
|
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),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()})
|
1 |
+
function orbisius_ctc_theme_editor_setup(){var a=jQuery,b=window.onbeforeunload;a(window).on("beforeunload",function(a){var c="";return jQuery("#theme_1_file_contents").data("orb_ctc_modified_content")?c="Left Editor: Content was modified. Are you sure you want to leave without saving?":jQuery("#theme_2_file_contents").data("orb_ctc_modified_content")&&(c="Right Editor: Content was modified. Are you sure you want to leave without saving?"),""!=c?(a.returnValue=c,c):"undefined"!=typeof b?b(a):void 0});var c=a("#theme_1").val();""!=c&&app_load("#orbisius_ctc_theme_editor_theme_1_form","generate_dropdown","#theme_1_file",app_handle_theme_change),a("#theme_1_file_contents,#theme_2_file_contents").on("keyup keypress input paste",function(b){var c={target:a(this),event:b};jQuery(document).trigger("orbisius_child_theme_editor_event_content_updated",[c])}),jQuery(document).on("orbisius_child_theme_editor_event_content_updated",function(a,b){jQuery(b.target).data("orb_ctc_modified_content",1),jQuery(b.target).addClass("modified_content")}),jQuery(document).on("orbisius_child_theme_editor_event_content_saved",function(a,b){jQuery(b.target).removeData("orb_ctc_modified_content"),jQuery(b.target).removeClass("modified_content")}),a("#theme_1_delete_file_btn").on("click",function(){var b=a("#theme_1_file").val();confirm("Delete: ["+b+"] ? Are you sure?","")&&orbisius_child_theme_creator.delete_file(b,"#orbisius_ctc_theme_editor_theme_1_form")}),a("#theme_2_delete_file_btn").on("click",function(){var b=a("#theme_2_file").val();confirm("Delete: ["+b+"] ? Are you sure?","")&&orbisius_child_theme_creator.delete_file(b,"#orbisius_ctc_theme_editor_theme_2_form")}),a("#theme_1_new_file_btn").on("click",function(){a("#theme_1_new_file_container").toggle("slow"),a("#theme_1_new_file").focus()}),a("#theme_1_new_file").on("input",function(b){var c=a("#theme_1_new_file").val();c=orbisius_child_theme_creator.sanitize_file_name(c);var d=1;if(a("#theme_1_file option").each(function(){var b=a(this).val();if(b==c)return void(d=0)}),d)a(".status",a("#theme_1_new_file_container")).text("").removeClass("app-alert-error");else{var e="File with that name already exists.";a(".status",a("#theme_1_new_file_container")).text(e).addClass("app-alert-error")}}),a("#theme_1_new_file_btn_ok").on("click",function(){var b=a("#theme_1_new_file").val();b=orbisius_child_theme_creator.sanitize_file_name(b);var c=b;if(""==b)return alert("Invalid or empty value for filename."),void a("#theme_1_new_file").focus();var d=1;if(a("#theme_1_file option").each(function(){var c=a(this).val();if(c==b)return void(d=0)}),!d)return alert("File with that name already exists."),void a("#theme_1_new_file").focus();a("select theme_1_file").prop("selected",!1);var e=a("<option></option>").val(b).html(c).prop("selected",!0);a("#theme_1_file").append(e),a("#theme_1_new_file_container").hide("slow"),a("#theme_1_new_file").val(""),a("#theme_1_file_contents").val("").focus();var f={file:b,file_selector:"#theme_1_file",content_selector:"#theme_1_file_contents"};jQuery(document).trigger("orbisius_child_theme_editor_event_new_file",[f])}),jQuery(document).on("orbisius_child_theme_editor_event_new_file",function(b,c){a("html, body").animate({scrollTop:jQuery(c.file_selector).offset().top-50},1e3)}),a("#theme_1_new_file_btn_cancel").on("click",function(){a("#theme_1_new_file").val(""),a("#theme_1_new_file_container").hide("slow"),a(".status",a("#theme_1_new_file_container")).text("").removeClass("app-alert-error")}),a("#theme_2_new_file_btn").on("click",function(){a("#theme_2_new_file_container").toggle("slow"),a("#theme_2_new_file").focus()}),a("#theme_2_new_file").on("input",function(b){var c=a("#theme_2_new_file").val();c=orbisius_child_theme_creator.sanitize_file_name(c);var d=1;if(a("#theme_2_file option").each(function(){var b=a(this).val();if(b==c)return void(d=0)}),d)a(".status",a("#theme_2_new_file_container")).text("").removeClass("app-alert-error");else{var e="File with that name already exists.";a(".status",a("#theme_2_new_file_container")).text(e).addClass("app-alert-error")}}),a("#theme_2_new_file_btn_ok").on("click",function(){var b=a("#theme_2_new_file").val();b=orbisius_child_theme_creator.sanitize_file_name(b);var c=b;if(""==b)return alert("Invalid or empty value for filename."),void a("#theme_2_new_file").focus();var d=1;if(a("#theme_2_file option").each(function(){var c=a(this).val();if(c==b)return void(d=0)}),!d)return alert("File with that name already exists."),void a("#theme_2_new_file").focus();a("select theme_2_file").prop("selected",!1);var e=a("<option></option>").val(b).html(c).prop("selected",!0);a("#theme_2_file").append(e),a("#theme_2_new_file_container").hide("slow"),a("#theme_2_new_file").val(""),a("#theme_2_file_contents").val("").focus();var f={file:b,file_selector:"#theme_2_file",content_selector:"#theme_2_file_contents"};jQuery(document).trigger("orbisius_child_theme_editor_event_new_file",[f])}),a("#theme_2_new_file_btn_cancel").on("click",function(){a("#theme_2_new_file").val(""),a("#theme_2_new_file_container").hide("slow"),a(".status",a("#theme_2_new_file_container")).text("").removeClass("app-alert-error")}),a("#theme_1_syntax_chk_btn").on("click",function(){var a="#orbisius_ctc_theme_editor_theme_1_form",b="syntax_check",c=".orbisius_ctc_theme_editor_theme_1_primary_buttons .status";jQuery(c).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(a).serialize()+"&action=orbisius_ctc_theme_editor_ajax&sub_cmd="+escape(b),beforeSend:function(){orbisius_child_theme_creator.loader(1)},complete:function(){orbisius_child_theme_creator.loader(0)},success:function(a){jQuery(c).empty().removeClass("app-alert-notice").html(a.msg).addClass(a.status?"app-alert-success":"app-alert-error"),a.status&&setTimeout(function(){jQuery(c).empty().removeClass("app-alert-success app-alert-error")},2e3)}})}),a("#theme_2_syntax_chk_btn").on("click",function(){var a="#orbisius_ctc_theme_editor_theme_2_form",b="syntax_check",c=".orbisius_ctc_theme_editor_theme_2_primary_buttons .status";jQuery(c).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(a).serialize()+"&action=orbisius_ctc_theme_editor_ajax&sub_cmd="+escape(b),beforeSend:function(){orbisius_child_theme_creator.loader(1)},complete:function(){orbisius_child_theme_creator.loader(0)},success:function(a){jQuery(c).empty().removeClass("app-alert-notice").html(a.msg).addClass(a.status?"app-alert-success":"app-alert-error"),a.status&&setTimeout(function(){jQuery(c).empty().removeClass("app-alert-success app-alert-error")},2e3)}})}),a("#theme_1_send_btn").on("click",function(){a("#theme_1_send_container").toggle("slow"),a("#theme_1_send_to").focus()}),a("#theme_1_send_btn_cancel").on("click",function(){a("#theme_1_send_container").hide("slow")}),a("#theme_1_send_btn_ok").on("click",function(){var b=jQuery("#theme_1_send_to").val().trim();if(b.indexOf("@")==-1||b.indexOf(".")<1)return alert("Invalid email(s)."),void a("#theme_1_send_to").focus();var c="#orbisius_ctc_theme_editor_theme_1_form",d="send_theme",e=".orbisius_ctc_theme_editor_theme_1_primary_buttons .status";jQuery(e).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(c).serialize()+"&action=orbisius_ctc_theme_editor_ajax&sub_cmd="+escape(d),beforeSend:function(){orbisius_child_theme_creator.loader(1)},complete:function(){orbisius_child_theme_creator.loader(0)},success:function(b){jQuery(e).empty().removeClass("app-alert-notice").html(b.msg).addClass(b.status?"app-alert-success":"app-alert-error"),b.status&&setTimeout(function(){jQuery(e).empty().removeClass("app-alert-success app-alert-error"),a("#theme_1_send_btn_cancel").click()},2e3)}})}),a("#theme_2_send_btn").on("click",function(){a("#theme_2_send_container").toggle("slow"),a("#theme_2_send_to").focus()}),a("#theme_2_send_btn_cancel").on("click",function(){a("#theme_2_send_container").hide("slow")}),a("#theme_2_send_btn_ok").on("click",function(){var b=jQuery("#theme_2_send_to").val().trim();if(b.indexOf("@")==-1||b.indexOf(".")<1)return alert("Invalid email(s)."),void a("#theme_2_send_to").focus();var c="#orbisius_ctc_theme_editor_theme_2_form",d="send_theme",e=".orbisius_ctc_theme_editor_theme_2_primary_buttons .status";jQuery(e).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(c).serialize()+"&action=orbisius_ctc_theme_editor_ajax&sub_cmd="+escape(d),beforeSend:function(){orbisius_child_theme_creator.loader(1)},complete:function(){orbisius_child_theme_creator.loader(0)},success:function(b){jQuery(e).empty().removeClass("app-alert-notice").html(b.msg).addClass(b.status?"app-alert-success":"app-alert-error"),b.status&&setTimeout(function(){jQuery(e).empty().removeClass("app-alert-success app-alert-error"),a("#theme_2_send_btn_cancel").click()},2e3)}})}),a("#theme_1_new_folder_btn").on("click",function(){a("#theme_1_new_folder_container").toggle("slow"),a("#theme_1_new_folder").focus()}),a("#theme_2_new_folder_btn").on("click",function(){a("#theme_2_new_folder_container").toggle("slow"),a("#theme_2_new_folder").focus()}),a("#theme_1_new_folder").on("input",function(b){var c=a("#theme_1_new_folder").val();c=orbisius_child_theme_creator.sanitize_file_name(c);var d=1;if(a("#theme_1_file option").each(function(){var b=a(this).val();if(b==c)return void(d=0)}),d)a(".status",a("#theme_1_new_folder_container")).text("").removeClass("app-alert-error");else{var e="File/folder with that name already exists.";a(".status",a("#theme_1_new_folder_container")).text(e).addClass("app-alert-error")}}),a("#theme_2_new_folder").on("input",function(b){var c=a("#theme_2_new_folder").val();c=orbisius_child_theme_creator.sanitize_file_name(c);var d=1;if(a("#theme_2_file option").each(function(){var b=a(this).val();if(b==c)return void(d=0)}),d)a(".status",a("#theme_2_new_folder_container")).text("").removeClass("app-alert-error");else{var e="File/folder with that name already exists.";a(".status",a("#theme_2_new_folder_container")).text(e).addClass("app-alert-error")}}),a("#theme_1_new_folder_btn_ok").on("click",function(){var b=a("#theme_1_new_folder").val();b=orbisius_child_theme_creator.sanitize_file_name(b);var c=b;if(""==b)return alert("Invalid or empty value for folder name."),void a("#theme_1_new_folder").focus();var d=1;if(a("#theme_1_folder option").each(function(){var c=a(this).val();if(c==b)return void(d=0)}),!d)return alert("File with that name already exists."),void a("#theme_1_new_folder").focus();a("select theme_1_folder").prop("selected",!1);var e=a("<option></option>").val(b).html(c).prop("selected",!0);a("#theme_1_folder").append(e),a("#theme_1_new_folder_container").hide("slow"),a("#theme_1_new_folder").val(""),a("#theme_1_folder_contents").val("").focus()}),a("#theme_1_new_folder_btn_cancel").on("click",function(){a("#theme_1_new_folder").val(""),a("#theme_1_new_folder_container").hide("slow"),a(".status",a("#theme_1_new_folder_container")).text("").removeClass("app-alert-error")}),a("#theme_2_new_folder_btn_ok").on("click",function(){var b=a("#theme_2_new_folder").val();b=orbisius_child_theme_creator.sanitize_file_name(b);var c=b;if(""==b)return alert("Invalid or empty value for folder name."),void a("#theme_2_new_folder").focus();var d=1;if(a("#theme_2_folder option").each(function(){var c=a(this).val();if(c==b)return void(d=0)}),!d)return alert("File with that name already exists."),void a("#theme_2_new_folder").focus();a("select theme_2_folder").prop("selected",!1);var e=a("<option></option>").val(b).html(c).prop("selected",!0);a("#theme_2_folder").append(e),a("#theme_2_new_folder_container").hide("slow"),a("#theme_2_new_folder").val(""),a("#theme_2_folder_contents").val("").focus()}),a("#theme_2_new_folder_btn_cancel").on("click",function(){a("#theme_2_new_folder").val(""),a("#theme_2_new_folder_container").hide("slow"),a(".status",a("#theme_2_new_folder_container")).text("").removeClass("app-alert-error")}),a("#theme_1").on("change",function(){app_load("#orbisius_ctc_theme_editor_theme_1_form","generate_dropdown","#theme_1_file",app_handle_theme_change)}),a("#theme_2").on("change",function(){app_load("#orbisius_ctc_theme_editor_theme_2_form","generate_dropdown","#theme_2_file",app_handle_theme_change)}),a("#orbisius_ctc_theme_editor_theme_1_form").submit(function(a){return app_load("#orbisius_ctc_theme_editor_theme_1_form","save_file","#theme_1_file_contents"),!1});var c=a("#theme_2").val();""!=c&&app_load("#orbisius_ctc_theme_editor_theme_2_form","generate_dropdown","#theme_2_file",app_handle_theme_change),a("#theme_2").on("change",function(){app_load("#orbisius_ctc_theme_editor_theme_2_form","generate_dropdown","#theme_2_file",app_handle_theme_change)}),a("#orbisius_ctc_theme_editor_theme_2_form").submit(function(){return app_load("#orbisius_ctc_theme_editor_theme_2_form","save_file","#theme_2_file_contents"),!1})}function app_handle_theme_change(a,b,c,d){var e=jQuery(a)?jQuery(a).attr("id"):"";if(e=e||"",""!=e){if(e=e.replace(/.+(theme[-_]*\d+).*/,"$1"),e="#"+e+"_","undefined"!=typeof OrbisiusChildThemeCreatorExt&&"undefined"!=typeof OrbisiusChildThemeCreatorExt.Editors&&"undefined"!=typeof OrbisiusChildThemeCreatorExt.Editors.onThemeChange){var f=e,f=f.replace(/_+$/g,"");OrbisiusChildThemeCreatorExt.Editors.onThemeChange(f,jQuery(f).val())}var g=jQuery(e+"_file").val();""!==g&&app_load(a,"load_file",e+"file_contents"),jQuery(e+"file").on("change",function(){app_load(a,"load_file",e+"file_contents")})}}function app_load(a,b,c,d){var e='<span class="app-alert-notice">Loading...</span>',f="Loading...",h=b.indexOf("save")>=0;h?(jQuery(c).is("input,textarea")&&(jQuery(c).attr("readonly","readonly"),jQuery(c).addClass("saving_action")),jQuery(".status",jQuery(c).parent()).html(e)):jQuery(c).is("input,textarea")?jQuery(c).addClass("saving_action"):jQuery(c).is("select")?jQuery(c+" option").text(f):jQuery(c).html(e),jQuery.ajax({type:"post",url:ajaxurl,data:jQuery(a).serialize()+"&action=orbisius_ctc_theme_editor_ajax&sub_cmd="+escape(b),success:function(e){var f={form_id:a,sub_cmd:b,result:e};if(""!=e){if(jQuery(c).is("input,textarea")?(jQuery(c).val(e),jQuery(c).is("textarea")&&jQuery(c).trigger("orbisius_child_theme_editor_event_file_loaded",f)):(jQuery(c).html(e),jQuery(c).trigger("orbisius_child_theme_editor_event_content_loaded",f)),h){jQuery(".status",jQuery(c).parent()).html("Saved.").addClass("app-alert-success"),setTimeout(function(){jQuery(".status",jQuery(c).parent()).empty().removeClass("app-alert-success app-alert-error")},2e3);var f={target:jQuery(c),event:{}};jQuery(document).trigger("orbisius_child_theme_editor_event_content_saved",[f])}}else h&&jQuery(".status",jQuery(c).parent()).html("Oops. Cannot save.").addClass("app-alert-error");"undefined"!=typeof d&&d(a,b,c,e)},beforeSend:function(){orbisius_child_theme_creator.loader(1)},complete:function(a){orbisius_child_theme_creator.loader(0),jQuery(c).removeClass("saving_action"),h&&jQuery(c).is("input,textarea")&&jQuery(c).removeAttr("readonly")}})}var orbisius_child_theme_creator={loader:function(a){var b=jQuery(".orbisius_child_theme_creator_container .loader");a?jQuery(b).html("Please Wait ...").show():jQuery(b).html("").hide()},sanitize_file_name:function(a){return a=a.replace(/[^\w\-\.\s\/\\]/gi,""),a=a.replace(/\s+/gi,"-"),a=a.replace(/\.+/gi,"."),a=a.replace(/-+/gi,"-"),a=a.replace(/_+/gi,"_"),a=a.replace(/^[._-]+/gi,""),a=a.replace(/[._-]+$/gi,""),a=jQuery.trim(a)},delete_file:function(a,b){jQuery.ajax({type:"post",url:ajaxurl,data:jQuery(b).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(a){var c=b.indexOf("theme_1")>=0?1:2;jQuery("#theme_"+c+"_file option:selected").remove(),jQuery("#theme_"+c+"_file").trigger("change")}})}};jQuery(document).ready(function(a){orbisius_ctc_theme_editor_setup()});
|
nbproject/private/private.xml
CHANGED
@@ -1,41 +1,74 @@
|
|
1 |
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
|
3 |
-
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
<file>
|
5 |
<url>orbisius-child-theme-creator.php</url>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
<bookmark id="6">
|
7 |
<name/>
|
8 |
-
<line>
|
|
|
|
|
|
|
|
|
|
|
9 |
<key/>
|
10 |
</bookmark>
|
11 |
<bookmark id="12">
|
12 |
<name/>
|
13 |
-
<line>
|
14 |
<key/>
|
15 |
</bookmark>
|
16 |
<bookmark id="9">
|
17 |
<name/>
|
18 |
-
<line>
|
19 |
<key/>
|
20 |
</bookmark>
|
21 |
<bookmark id="5">
|
22 |
<name/>
|
23 |
-
<line>
|
|
|
|
|
|
|
|
|
|
|
24 |
<key/>
|
25 |
</bookmark>
|
26 |
<bookmark id="4">
|
27 |
<name/>
|
28 |
-
<line>
|
|
|
|
|
|
|
|
|
|
|
29 |
<key/>
|
30 |
</bookmark>
|
31 |
<bookmark id="13">
|
32 |
<name/>
|
33 |
-
<line>
|
34 |
<key/>
|
35 |
</bookmark>
|
36 |
<bookmark id="3">
|
37 |
<name/>
|
38 |
-
<line>
|
39 |
<key/>
|
40 |
</bookmark>
|
41 |
</file>
|
@@ -50,9 +83,10 @@
|
|
50 |
</editor-bookmarks>
|
51 |
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
|
52 |
<group name="qsandbox"/>
|
53 |
-
<group>
|
54 |
<file>file:/C:/Copy/Dropbox/cloud/projects/default/htdocs/wordpress313/wp-content/plugins/orbisius-child-theme-creator/orbisius-child-theme-creator.php</file>
|
55 |
<file>file:/C:/Copy/Dropbox/cloud/projects/default/htdocs/wordpress313/wp-content/plugins/orbisius-child-theme-creator/readme.txt</file>
|
56 |
</group>
|
|
|
57 |
</open-files>
|
58 |
</project-private>
|
1 |
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
|
3 |
+
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="19">
|
4 |
+
<file>
|
5 |
+
<url>assets/main.js</url>
|
6 |
+
<bookmark id="19">
|
7 |
+
<name/>
|
8 |
+
<line>109</line>
|
9 |
+
<key/>
|
10 |
+
</bookmark>
|
11 |
+
</file>
|
12 |
<file>
|
13 |
<url>orbisius-child-theme-creator.php</url>
|
14 |
+
<bookmark id="15">
|
15 |
+
<name/>
|
16 |
+
<line>1372</line>
|
17 |
+
<key/>
|
18 |
+
</bookmark>
|
19 |
+
<bookmark id="16">
|
20 |
+
<name/>
|
21 |
+
<line>1513</line>
|
22 |
+
<key/>
|
23 |
+
</bookmark>
|
24 |
<bookmark id="6">
|
25 |
<name/>
|
26 |
+
<line>1585</line>
|
27 |
+
<key/>
|
28 |
+
</bookmark>
|
29 |
+
<bookmark id="14">
|
30 |
+
<name/>
|
31 |
+
<line>1663</line>
|
32 |
<key/>
|
33 |
</bookmark>
|
34 |
<bookmark id="12">
|
35 |
<name/>
|
36 |
+
<line>2082</line>
|
37 |
<key/>
|
38 |
</bookmark>
|
39 |
<bookmark id="9">
|
40 |
<name/>
|
41 |
+
<line>2087</line>
|
42 |
<key/>
|
43 |
</bookmark>
|
44 |
<bookmark id="5">
|
45 |
<name/>
|
46 |
+
<line>2129</line>
|
47 |
+
<key/>
|
48 |
+
</bookmark>
|
49 |
+
<bookmark id="18">
|
50 |
+
<name/>
|
51 |
+
<line>2139</line>
|
52 |
<key/>
|
53 |
</bookmark>
|
54 |
<bookmark id="4">
|
55 |
<name/>
|
56 |
+
<line>2289</line>
|
57 |
+
<key/>
|
58 |
+
</bookmark>
|
59 |
+
<bookmark id="17">
|
60 |
+
<name/>
|
61 |
+
<line>2322</line>
|
62 |
<key/>
|
63 |
</bookmark>
|
64 |
<bookmark id="13">
|
65 |
<name/>
|
66 |
+
<line>2504</line>
|
67 |
<key/>
|
68 |
</bookmark>
|
69 |
<bookmark id="3">
|
70 |
<name/>
|
71 |
+
<line>2549</line>
|
72 |
<key/>
|
73 |
</bookmark>
|
74 |
</file>
|
83 |
</editor-bookmarks>
|
84 |
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
|
85 |
<group name="qsandbox"/>
|
86 |
+
<group name="Go359">
|
87 |
<file>file:/C:/Copy/Dropbox/cloud/projects/default/htdocs/wordpress313/wp-content/plugins/orbisius-child-theme-creator/orbisius-child-theme-creator.php</file>
|
88 |
<file>file:/C:/Copy/Dropbox/cloud/projects/default/htdocs/wordpress313/wp-content/plugins/orbisius-child-theme-creator/readme.txt</file>
|
89 |
</group>
|
90 |
+
<group/>
|
91 |
</open-files>
|
92 |
</project-private>
|
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.3.
|
7 |
Author: Svetoslav Marinov (Slavi)
|
8 |
Author URI: http://orbisius.com
|
9 |
*/
|
@@ -473,7 +473,7 @@ function orbisius_child_theme_creator_settings_page() {
|
|
473 |
<div class="postbox">
|
474 |
<div class="inside">
|
475 |
<!-- Twitter: code -->
|
476 |
-
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="
|
477 |
<!-- /Twitter: code -->
|
478 |
|
479 |
<!-- Twitter: Orbisius_Follow:js -->
|
@@ -484,7 +484,7 @@ function orbisius_child_theme_creator_settings_page() {
|
|
484 |
|
485 |
|
486 |
<!-- Twitter: Tweet:js -->
|
487 |
-
<a href="
|
488 |
data-lang="en" data-text="Checkout Orbisius Child Theme Creator #WordPress #plugin.Create Child Themes in Seconds"
|
489 |
data-count="none" data-via="orbisius" data-related="orbisius"
|
490 |
data-url="<?php echo $product_page_tweet_link;?>">Tweet</a>
|
@@ -1127,18 +1127,18 @@ function orbisius_child_theme_creator_tools_action() {
|
|
1127 |
<div class="postbox">
|
1128 |
<div class="inside">
|
1129 |
<!-- Twitter: code -->
|
1130 |
-
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="
|
1131 |
<!-- /Twitter: code -->
|
1132 |
|
1133 |
<!-- Twitter: Orbisius_Follow:js -->
|
1134 |
-
<a href="
|
1135 |
data-align="right" data-show-count="false">Follow @orbisius</a>
|
1136 |
<!-- /Twitter: Orbisius_Follow:js -->
|
1137 |
|
1138 |
|
1139 |
|
1140 |
<!-- Twitter: Tweet:js -->
|
1141 |
-
<a href="
|
1142 |
data-lang="en" data-text="Checkout Orbisius Child Theme Creator #WordPress #plugin.Create Child Themes in Seconds"
|
1143 |
data-count="none" data-via="orbisius" data-related="orbisius"
|
1144 |
data-url="<?php echo $product_page_tweet_link;?>">Tweet</a>
|
@@ -2139,6 +2139,7 @@ function orbisius_ctc_theme_editor() {
|
|
2139 |
<span class="orbisius_ctc_theme_editor_theme_1_primary_buttons primary_buttons">
|
2140 |
<button type='submit' class='button button-primary' id="theme_1_submit" name="theme_1_submit">Save</button>
|
2141 |
<span class="status"></span>
|
|
|
2142 |
</span>
|
2143 |
|
2144 |
<div id="theme_1_file_contents_container">
|
@@ -2168,7 +2169,7 @@ function orbisius_ctc_theme_editor() {
|
|
2168 |
<div id='theme_1_new_file_container' class="theme_1_new_file_container app-hide">
|
2169 |
<strong>New File</strong>
|
2170 |
<input type="text" id="theme_1_new_file" name="theme_1_new_file" value="" />
|
2171 |
-
<span>e.g. test.js, extra.css etc</span>
|
2172 |
|
2173 |
<!--<br/>
|
2174 |
<label>
|
@@ -2198,10 +2199,17 @@ function orbisius_ctc_theme_editor() {
|
|
2198 |
</div>
|
2199 |
<!-- /send -->
|
2200 |
|
|
|
|
|
|
|
2201 |
<div style="border:1px solid #ccc;margin:10px 0;padding:3px 5px;">
|
2202 |
<h3>Pro Addon
|
2203 |
<?php if ( ! orbisius_child_theme_creator_is_pro_installed() ) : ?>
|
2204 |
-
|
|
|
|
|
|
|
|
|
2205 |
<?php endif; ?>
|
2206 |
</h3>
|
2207 |
|
@@ -2239,7 +2247,6 @@ function orbisius_ctc_theme_editor() {
|
|
2239 |
<!-- /new folder -->
|
2240 |
</div> <!-- /secondary_buttons -->
|
2241 |
</form>
|
2242 |
-
|
2243 |
</td>
|
2244 |
<td width="50%">
|
2245 |
<form id="orbisius_ctc_theme_editor_theme_2_form" class="orbisius_ctc_theme_editor_theme_2_form">
|
@@ -2253,6 +2260,7 @@ function orbisius_ctc_theme_editor() {
|
|
2253 |
|
2254 |
<span class="orbisius_ctc_theme_editor_theme_2_primary_buttons primary_buttons">
|
2255 |
<button type='submit' class='button button-primary' id="theme_2_submit" name="theme_2_submit">Save</button>
|
|
|
2256 |
<span class="status"></span>
|
2257 |
</span>
|
2258 |
|
@@ -2310,6 +2318,8 @@ function orbisius_ctc_theme_editor() {
|
|
2310 |
</tr>
|
2311 |
</table>
|
2312 |
|
|
|
|
|
2313 |
<br/>
|
2314 |
<?php orbisius_child_theme_creator_util::output_orb_widget(); ?>
|
2315 |
<?php
|
@@ -2473,7 +2483,7 @@ function orbisius_ctc_theme_editor_check_syntax($theme_file_contents) {
|
|
2473 |
'status' => 0,
|
2474 |
);
|
2475 |
|
2476 |
-
// Not a php
|
2477 |
if (stripos($theme_file_contents, '<?') === false) {
|
2478 |
$status_rec['msg'] = 'Syntax OK.';
|
2479 |
$status_rec['status'] = 1;
|
@@ -2595,20 +2605,29 @@ function orbisius_ctc_theme_editor_manage_file( $cmd_id = 1 ) {
|
|
2595 |
|
2596 |
$theme_root = trailingslashit( get_theme_root() );
|
2597 |
|
|
|
|
|
2598 |
if (!empty($req['theme_1']) && !empty($req['theme_1_file'])) {
|
2599 |
-
$theme_base_dir = empty($req['theme_1']) ? '______________' : preg_replace(
|
2600 |
$theme_dir = $theme_root . "$theme_base_dir/";
|
2601 |
-
$theme_file = empty($req['theme_1_file'])
|
|
|
|
|
|
|
2602 |
$theme_file_contents = empty($req['theme_1_file_contents']) ? '' : $req['theme_1_file_contents'];
|
2603 |
} elseif (!empty($req['theme_2']) && !empty($req['theme_2_file'])) {
|
2604 |
-
$theme_base_dir = empty($req['theme_2'])
|
|
|
|
|
2605 |
$theme_dir = $theme_root . "$theme_base_dir/";
|
2606 |
-
$theme_file = empty($req['theme_2_file'])
|
|
|
|
|
2607 |
$theme_file_contents = empty($req['theme_2_file_contents']) ? '' : $req['theme_2_file_contents'];
|
2608 |
} else {
|
2609 |
return 'Missing data!';
|
2610 |
}
|
2611 |
-
|
2612 |
if (empty($theme_base_dir) || !is_dir($theme_dir)) {
|
2613 |
return 'Selected theme is invalid.';
|
2614 |
} elseif (!file_exists($theme_file) && $cmd_id == 1) {
|
@@ -2616,10 +2635,10 @@ function orbisius_ctc_theme_editor_manage_file( $cmd_id = 1 ) {
|
|
2616 |
}
|
2617 |
|
2618 |
if ($cmd_id == 1) {
|
2619 |
-
$buff = file_get_contents($theme_file);
|
2620 |
} elseif ($cmd_id == 2) {
|
2621 |
$suff = '';
|
2622 |
-
|
2623 |
// This should prevent people from crashing their WP by missing something.
|
2624 |
// The changes will be saved in another file.
|
2625 |
$syntax_check_rec = orbisius_ctc_theme_editor_check_syntax($theme_file_contents);
|
@@ -2630,6 +2649,16 @@ function orbisius_ctc_theme_editor_manage_file( $cmd_id = 1 ) {
|
|
2630 |
$suff = '_error_' . date('Y-m-d') . '_' . $suff;
|
2631 |
}
|
2632 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2633 |
$status = file_put_contents($theme_file . $suff, $theme_file_contents, LOCK_EX);
|
2634 |
$buff = $theme_file_contents;
|
2635 |
} elseif ($cmd_id == 3 && (!empty($req['theme_1_file']) || !empty($req['theme_2_file']))) {
|
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.3.5
|
7 |
Author: Svetoslav Marinov (Slavi)
|
8 |
Author URI: http://orbisius.com
|
9 |
*/
|
473 |
<div class="postbox">
|
474 |
<div class="inside">
|
475 |
<!-- Twitter: code -->
|
476 |
+
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
|
477 |
<!-- /Twitter: code -->
|
478 |
|
479 |
<!-- Twitter: Orbisius_Follow:js -->
|
484 |
|
485 |
|
486 |
<!-- Twitter: Tweet:js -->
|
487 |
+
<a href="//twitter.com/share" class="twitter-share-button"
|
488 |
data-lang="en" data-text="Checkout Orbisius Child Theme Creator #WordPress #plugin.Create Child Themes in Seconds"
|
489 |
data-count="none" data-via="orbisius" data-related="orbisius"
|
490 |
data-url="<?php echo $product_page_tweet_link;?>">Tweet</a>
|
1127 |
<div class="postbox">
|
1128 |
<div class="inside">
|
1129 |
<!-- Twitter: code -->
|
1130 |
+
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
|
1131 |
<!-- /Twitter: code -->
|
1132 |
|
1133 |
<!-- Twitter: Orbisius_Follow:js -->
|
1134 |
+
<a href="//twitter.com/orbisius" class="twitter-follow-button"
|
1135 |
data-align="right" data-show-count="false">Follow @orbisius</a>
|
1136 |
<!-- /Twitter: Orbisius_Follow:js -->
|
1137 |
|
1138 |
|
1139 |
|
1140 |
<!-- Twitter: Tweet:js -->
|
1141 |
+
<a href="//twitter.com/share" class="twitter-share-button"
|
1142 |
data-lang="en" data-text="Checkout Orbisius Child Theme Creator #WordPress #plugin.Create Child Themes in Seconds"
|
1143 |
data-count="none" data-via="orbisius" data-related="orbisius"
|
1144 |
data-url="<?php echo $product_page_tweet_link;?>">Tweet</a>
|
2139 |
<span class="orbisius_ctc_theme_editor_theme_1_primary_buttons primary_buttons">
|
2140 |
<button type='submit' class='button button-primary' id="theme_1_submit" name="theme_1_submit">Save</button>
|
2141 |
<span class="status"></span>
|
2142 |
+
<?php do_action('orbisius_child_theme_creator_editors_ext_action_left_primary_buttons', array( 'place' => 'left' ) ); ?>
|
2143 |
</span>
|
2144 |
|
2145 |
<div id="theme_1_file_contents_container">
|
2169 |
<div id='theme_1_new_file_container' class="theme_1_new_file_container app-hide">
|
2170 |
<strong>New File</strong>
|
2171 |
<input type="text" id="theme_1_new_file" name="theme_1_new_file" value="" />
|
2172 |
+
<span>e.g. test.js, extra.css, headers/header-two.php etc</span>
|
2173 |
|
2174 |
<!--<br/>
|
2175 |
<label>
|
2199 |
</div>
|
2200 |
<!-- /send -->
|
2201 |
|
2202 |
+
<?php do_action('orbisius_child_theme_creator_editors_ext_action_left_start', array( 'place' => 'left' ) ); ?>
|
2203 |
+
<?php do_action('orbisius_child_theme_creator_editors_ext_action_left_end', array( 'place' => 'left' ) ); ?>
|
2204 |
+
|
2205 |
<div style="border:1px solid #ccc;margin:10px 0;padding:3px 5px;">
|
2206 |
<h3>Pro Addon
|
2207 |
<?php if ( ! orbisius_child_theme_creator_is_pro_installed() ) : ?>
|
2208 |
+
<ul>
|
2209 |
+
<li>Syntax Highlighting</li>
|
2210 |
+
<li>Better dropdown for selecting themes and files</li>
|
2211 |
+
<li></li>
|
2212 |
+
</ul>
|
2213 |
<?php endif; ?>
|
2214 |
</h3>
|
2215 |
|
2247 |
<!-- /new folder -->
|
2248 |
</div> <!-- /secondary_buttons -->
|
2249 |
</form>
|
|
|
2250 |
</td>
|
2251 |
<td width="50%">
|
2252 |
<form id="orbisius_ctc_theme_editor_theme_2_form" class="orbisius_ctc_theme_editor_theme_2_form">
|
2260 |
|
2261 |
<span class="orbisius_ctc_theme_editor_theme_2_primary_buttons primary_buttons">
|
2262 |
<button type='submit' class='button button-primary' id="theme_2_submit" name="theme_2_submit">Save</button>
|
2263 |
+
<?php do_action('orbisius_child_theme_creator_editors_ext_action_right_primary_buttons', array( 'place' => 'right' ) ); ?>
|
2264 |
<span class="status"></span>
|
2265 |
</span>
|
2266 |
|
2318 |
</tr>
|
2319 |
</table>
|
2320 |
|
2321 |
+
<?php do_action('orbisius_child_theme_creator_editors_ext_action_footer', array() ); ?>
|
2322 |
+
|
2323 |
<br/>
|
2324 |
<?php orbisius_child_theme_creator_util::output_orb_widget(); ?>
|
2325 |
<?php
|
2483 |
'status' => 0,
|
2484 |
);
|
2485 |
|
2486 |
+
// Not a php file so don't do a syntax check.
|
2487 |
if (stripos($theme_file_contents, '<?') === false) {
|
2488 |
$status_rec['msg'] = 'Syntax OK.';
|
2489 |
$status_rec['status'] = 1;
|
2605 |
|
2606 |
$theme_root = trailingslashit( get_theme_root() );
|
2607 |
|
2608 |
+
$theme_dir_regex = '#[^\w\-]#si';
|
2609 |
+
|
2610 |
if (!empty($req['theme_1']) && !empty($req['theme_1_file'])) {
|
2611 |
+
$theme_base_dir = empty($req['theme_1']) ? '______________' : preg_replace( $theme_dir_regex, '', $req['theme_1']);
|
2612 |
$theme_dir = $theme_root . "$theme_base_dir/";
|
2613 |
+
$theme_file = empty($req['theme_1_file'])
|
2614 |
+
? $theme_dir . 'style.css'
|
2615 |
+
: orbisius_child_theme_creator_util::sanitize_file_name($req['theme_1_file'], $theme_dir);
|
2616 |
+
|
2617 |
$theme_file_contents = empty($req['theme_1_file_contents']) ? '' : $req['theme_1_file_contents'];
|
2618 |
} elseif (!empty($req['theme_2']) && !empty($req['theme_2_file'])) {
|
2619 |
+
$theme_base_dir = empty($req['theme_2'])
|
2620 |
+
? '______________'
|
2621 |
+
: preg_replace( $theme_dir_regex, '', $req['theme_2']);
|
2622 |
$theme_dir = $theme_root . "$theme_base_dir/";
|
2623 |
+
$theme_file = empty($req['theme_2_file'])
|
2624 |
+
? $theme_dir . 'style.css'
|
2625 |
+
: orbisius_child_theme_creator_util::sanitize_file_name($req['theme_2_file'], $theme_dir);
|
2626 |
$theme_file_contents = empty($req['theme_2_file_contents']) ? '' : $req['theme_2_file_contents'];
|
2627 |
} else {
|
2628 |
return 'Missing data!';
|
2629 |
}
|
2630 |
+
|
2631 |
if (empty($theme_base_dir) || !is_dir($theme_dir)) {
|
2632 |
return 'Selected theme is invalid.';
|
2633 |
} elseif (!file_exists($theme_file) && $cmd_id == 1) {
|
2635 |
}
|
2636 |
|
2637 |
if ($cmd_id == 1) {
|
2638 |
+
$buff = file_get_contents($theme_file, LOCK_SH);
|
2639 |
} elseif ($cmd_id == 2) {
|
2640 |
$suff = '';
|
2641 |
+
|
2642 |
// This should prevent people from crashing their WP by missing something.
|
2643 |
// The changes will be saved in another file.
|
2644 |
$syntax_check_rec = orbisius_ctc_theme_editor_check_syntax($theme_file_contents);
|
2649 |
$suff = '_error_' . date('Y-m-d') . '_' . $suff;
|
2650 |
}
|
2651 |
|
2652 |
+
// This a case where the file resides in a new folder that doesn't exist yet.
|
2653 |
+
// e.g. headers/header-two.php
|
2654 |
+
$cur_file_parent_dir = dirname( $theme_file );
|
2655 |
+
|
2656 |
+
if ( ! is_dir( $cur_file_parent_dir ) ) {
|
2657 |
+
if ( ! mkdir( $cur_file_parent_dir, 0755, 1 ) ) {
|
2658 |
+
trigger_error( "Cannot create folder: [$cur_file_parent_dir]. Please, check folder permissions.", E_USER_NOTICE );
|
2659 |
+
}
|
2660 |
+
}
|
2661 |
+
|
2662 |
$status = file_put_contents($theme_file . $suff, $theme_file_contents, LOCK_EX);
|
2663 |
$buff = $theme_file_contents;
|
2664 |
} elseif ($cmd_id == 3 && (!empty($req['theme_1_file']) || !empty($req['theme_2_file']))) {
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: lordspace,orbisius
|
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=7APYDVPBCSY9A
|
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.
|
7 |
-
Stable tag: 1.3.
|
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.
|
@@ -45,6 +45,7 @@ It features two editors and you can pick snippets from one theme and paste into
|
|
45 |
* Since (v1.1.3) Implemented theme files to be listed recursively (i.e. all files from the selected theme)
|
46 |
* Since (v1.1.9) Both editors have the same buttons (in older versions only the left editor had all of the buttons).
|
47 |
* Since (v1.2.2) Can create a blank functions.php file (Thanks Tobias Kaupat for the suggestion)
|
|
|
48 |
|
49 |
= Important Reasons to Create Child Themes =
|
50 |
* Keep your changes when the parent theme is updated.
|
@@ -111,6 +112,9 @@ n/a
|
|
111 |
|
112 |
== Frequently Asked Questions ==
|
113 |
|
|
|
|
|
|
|
114 |
= How to use this plugin? =
|
115 |
Just install the plugin and activate it. Then go to Admin > Appearance > Orbisius Child Theme Creator.
|
116 |
Then click on a theme and the plugin will create a child theme for you.
|
@@ -124,6 +128,11 @@ Just put this line right after the first <?php tag in the wp-config.php. This wi
|
|
124 |
|
125 |
define('DISALLOW_FILE_EDIT', true);
|
126 |
|
|
|
|
|
|
|
|
|
|
|
127 |
= The child theme is created but doesn't have some styles or doesn't show the admin panel of the parent theme =
|
128 |
OK. Please contact the theme author if his/her theme is child theme friendly.
|
129 |
Also which files does the theme need in order to work well.
|
@@ -156,6 +165,17 @@ Todo
|
|
156 |
|
157 |
== Changelog ==
|
158 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
159 |
= 1.3.4 =
|
160 |
* Uses the recommended approach for loading css (since v.1.3.4)
|
161 |
* Fixes, updated FAQ
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=7APYDVPBCSY9A
|
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.7
|
7 |
+
Stable tag: 1.3.5
|
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.
|
45 |
* Since (v1.1.3) Implemented theme files to be listed recursively (i.e. all files from the selected theme)
|
46 |
* Since (v1.1.9) Both editors have the same buttons (in older versions only the left editor had all of the buttons).
|
47 |
* Since (v1.2.2) Can create a blank functions.php file (Thanks Tobias Kaupat for the suggestion)
|
48 |
+
* Since (v1.3.5)* Users can create new files in non-existing folders e.g. headers/header-two.php
|
49 |
|
50 |
= Important Reasons to Create Child Themes =
|
51 |
* Keep your changes when the parent theme is updated.
|
112 |
|
113 |
== Frequently Asked Questions ==
|
114 |
|
115 |
+
= How to change Child thme screenshot? =
|
116 |
+
currently, only via ftp.
|
117 |
+
|
118 |
= How to use this plugin? =
|
119 |
Just install the plugin and activate it. Then go to Admin > Appearance > Orbisius Child Theme Creator.
|
120 |
Then click on a theme and the plugin will create a child theme for you.
|
128 |
|
129 |
define('DISALLOW_FILE_EDIT', true);
|
130 |
|
131 |
+
= How to edit a logo or colours? =
|
132 |
+
The theme should have an option to do that.
|
133 |
+
Please, check the customizer or within the admin area for a menu that matches the theme's name.
|
134 |
+
Our plugin doesn't know how each theme works so it's better to direct those kind of questions to the theme designer.
|
135 |
+
|
136 |
= The child theme is created but doesn't have some styles or doesn't show the admin panel of the parent theme =
|
137 |
OK. Please contact the theme author if his/her theme is child theme friendly.
|
138 |
Also which files does the theme need in order to work well.
|
165 |
|
166 |
== Changelog ==
|
167 |
|
168 |
+
= 1.3.5 =
|
169 |
+
* Changed twitter non-ssl links to protocol relative URLs.
|
170 |
+
* Added LOCK_SH for the file read operation
|
171 |
+
* Added a flag to tell if the content editors are 'dirty' i.e. their content was modified.
|
172 |
+
* Added a border to the content box if modified.
|
173 |
+
* Warn the user if there's unsaved content in either of the editors. The browser won't display the actual message I've provided which is stupid.
|
174 |
+
* TODO: check php syntax before saving for php files - remove button to check syntax?
|
175 |
+
* Users now can create new files in non-existing folders e.g. headers/header-two.php
|
176 |
+
* When the admin creates a new file we'll scroll to the element so he/she can start typing
|
177 |
+
* Tested with WP 4.7
|
178 |
+
|
179 |
= 1.3.4 =
|
180 |
* Uses the recommended approach for loading css (since v.1.3.4)
|
181 |
* Fixes, updated FAQ
|