Version Description
- Updated CSS to add some top-margin above the update/save changed buttons
- Added php syntax check
- Added Send button so you can email the selected theme and parent theme (if any) to yourself or a colleague.
- Implemented theme files to be listed recursively (i.e. all files from the selected theme)
- Fixed JS error on Settings page.
- Added uninstall.php file to clean after itself
- Added a check and the notice that shows up on the plugins page won't show up after 24h
- Added Edit Themes link to the Plugin's -> Action links
- Improved and better organized the plugin's settings page
Download this release
Release Info
Developer | lordspace |
Plugin | Child Theme Creator by Orbisius |
Version | 1.1.3 |
Comparing to | |
See all releases |
Code changes from version 1.1.2 to 1.1.3
- assets/main.css +4 -0
- assets/main.js +187 -0
- assets/main.min.css +1 -0
- assets/main.min.js +1 -1
- nbproject/private/private.xml +14 -7
- orbisius-child-theme-creator.php +698 -117
- readme.txt +23 -3
- uninstall.php +27 -0
assets/main.css
CHANGED
@@ -122,3 +122,7 @@
|
|
122 |
.orbisius_ctc_theme_editor_container #theme_1_file, .orbisius_ctc_theme_editor_container #theme_2_file {
|
123 |
max-width:40%;
|
124 |
}
|
|
|
|
|
|
|
|
122 |
.orbisius_ctc_theme_editor_container #theme_1_file, .orbisius_ctc_theme_editor_container #theme_2_file {
|
123 |
max-width:40%;
|
124 |
}
|
125 |
+
|
126 |
+
.orbisius_ctc_theme_editor_container .primary_buttons {
|
127 |
+
margin-top:5px;
|
128 |
+
}
|
assets/main.js
CHANGED
@@ -161,6 +161,187 @@ function orbisius_ctc_theme_editor_setup() {
|
|
161 |
});
|
162 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
163 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
// Change theme selection
|
165 |
$('#theme_1').on("change", function () {
|
166 |
app_load('#orbisius_ctc_theme_editor_theme_1_form', 'generate_dropdown', '#theme_1_file', app_handle_theme_change);
|
@@ -198,6 +379,12 @@ function orbisius_ctc_theme_editor_setup() {
|
|
198 |
*/
|
199 |
function app_handle_theme_change(form_id, action, target_container, result) {
|
200 |
var form_prefix = jQuery(form_id) ? jQuery(form_id).attr('id') : ''; // orbisius_ctc_theme_editor_theme_1_form
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
form_prefix = form_prefix.replace(/.+(theme[-_]*\d+).*/, '$1');
|
202 |
form_prefix = '#' + form_prefix + '_'; // jQuery ID prefix. Res: #theme_2_
|
203 |
|
161 |
});
|
162 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
163 |
|
164 |
+
///////////////////////////////////////////////////////////////////////////////////////////////////
|
165 |
+
// Syntax check button
|
166 |
+
///////////////////////////////////////////////////////////////////////////////////////////////////
|
167 |
+
$('#theme_1_syntax_chk_btn').on("click", function () {
|
168 |
+
var form_id = '#orbisius_ctc_theme_editor_theme_1_form';
|
169 |
+
var action = 'syntax_check';
|
170 |
+
var target_container = '.orbisius_ctc_theme_editor_theme_1_primary_buttons .status';
|
171 |
+
|
172 |
+
jQuery(target_container)
|
173 |
+
.empty()
|
174 |
+
.removeClass('app-alert-success app-alert-error app-alert-notice')
|
175 |
+
.addClass( 'app-alert-notice')
|
176 |
+
.html('Checking ...');
|
177 |
+
|
178 |
+
jQuery.ajax({
|
179 |
+
type : "post",
|
180 |
+
//dataType : "json",
|
181 |
+
url : ajaxurl, // WP defines it and it contains all the necessary params
|
182 |
+
data : jQuery(form_id).serialize() + '&action=orbisius_ctc_theme_editor_ajax&sub_cmd=' + escape(action),
|
183 |
+
|
184 |
+
success : function (json) {
|
185 |
+
jQuery(target_container)
|
186 |
+
.empty()
|
187 |
+
.removeClass('app-alert-notice')
|
188 |
+
.html(json.msg)
|
189 |
+
.addClass( json.status ? 'app-alert-success' : 'app-alert-error' );
|
190 |
+
|
191 |
+
if (json.status) { // auto hide on success
|
192 |
+
setTimeout(function () {
|
193 |
+
jQuery(target_container).empty().removeClass('app-alert-success app-alert-error');
|
194 |
+
}, 2000);
|
195 |
+
}
|
196 |
+
} // success
|
197 |
+
}); // ajax
|
198 |
+
}); // click
|
199 |
+
|
200 |
+
///////////////////////////////////////////////////////////////////////////////////////////////////
|
201 |
+
// Send
|
202 |
+
///////////////////////////////////////////////////////////////////////////////////////////////////
|
203 |
+
$('#theme_1_send_btn').on("click", function () {
|
204 |
+
$('#theme_1_send_container').toggle('slow');
|
205 |
+
$('#theme_1_send_to').focus();
|
206 |
+
});
|
207 |
+
|
208 |
+
// This is when the cancel button is clicked so the user doesn't want a new folder.
|
209 |
+
$('#theme_1_send_btn_cancel').on("click", function () {
|
210 |
+
//$('#theme_1_send_to').val(''); //??
|
211 |
+
$('#theme_1_send_container').hide('slow');
|
212 |
+
});
|
213 |
+
|
214 |
+
$('#theme_1_send_btn_ok').on("click", function () {
|
215 |
+
var to = jQuery('#theme_1_send_to').val().trim();
|
216 |
+
|
217 |
+
if (to.indexOf('@') == -1 || to.indexOf('.') < 1) {
|
218 |
+
alert('Invalid email(s).');
|
219 |
+
$('#theme_1_send_to').focus();
|
220 |
+
return;
|
221 |
+
}
|
222 |
+
|
223 |
+
var form_id = '#orbisius_ctc_theme_editor_theme_1_form';
|
224 |
+
var action = 'send_theme';
|
225 |
+
var target_container = '.orbisius_ctc_theme_editor_theme_1_primary_buttons .status';
|
226 |
+
|
227 |
+
jQuery(target_container)
|
228 |
+
.empty()
|
229 |
+
.removeClass('app-alert-success app-alert-error app-alert-notice')
|
230 |
+
.addClass( 'app-alert-notice')
|
231 |
+
.html('Processing ...');
|
232 |
+
|
233 |
+
jQuery.ajax({
|
234 |
+
type : "post",
|
235 |
+
//dataType : "json",
|
236 |
+
url : ajaxurl, // WP defines it and it contains all the necessary params
|
237 |
+
data : jQuery(form_id).serialize() + '&action=orbisius_ctc_theme_editor_ajax&sub_cmd=' + escape(action),
|
238 |
+
|
239 |
+
success : function (json) {
|
240 |
+
jQuery(target_container)
|
241 |
+
.empty()
|
242 |
+
.removeClass('app-alert-notice')
|
243 |
+
.html(json.msg)
|
244 |
+
.addClass( json.status ? 'app-alert-success' : 'app-alert-error' );
|
245 |
+
|
246 |
+
if (json.status) { // auto hide on success
|
247 |
+
setTimeout(function () {
|
248 |
+
jQuery(target_container).empty().removeClass('app-alert-success app-alert-error');
|
249 |
+
$('#theme_1_send_btn_cancel').click();
|
250 |
+
}, 2000);
|
251 |
+
}
|
252 |
+
} // success
|
253 |
+
}); // ajax
|
254 |
+
}); // click
|
255 |
+
///////////////////////////////////////////////////////////////////////////////////////////////////
|
256 |
+
|
257 |
+
|
258 |
+
|
259 |
+
|
260 |
+
///////////////////////////////////////////////////////////////////////////////////////////////////
|
261 |
+
// New Folder
|
262 |
+
///////////////////////////////////////////////////////////////////////////////////////////////////
|
263 |
+
$('#theme_1_new_folder_btn').on("click", function () {
|
264 |
+
$('#theme_1_new_folder_container').toggle('slow');
|
265 |
+
$('#theme_1_new_folder').focus();
|
266 |
+
});
|
267 |
+
|
268 |
+
// The user enters a folder name. Let's check if it exists.
|
269 |
+
$('#theme_1_new_folder').on("input", function (event) {
|
270 |
+
var new_folder = $('#theme_1_new_folder').val();
|
271 |
+
new_folder = orbisius_child_theme_creator.sanitize_file_name(new_folder);
|
272 |
+
|
273 |
+
var ok = 1; // let's by positive by default
|
274 |
+
|
275 |
+
// Let's check if that folder exists by checking if there is an entry in the options
|
276 |
+
$("#theme_1_file option").each(function() { // idx, val
|
277 |
+
var cur_val = $(this).val();
|
278 |
+
|
279 |
+
if (cur_val == new_folder) {
|
280 |
+
ok = 0;
|
281 |
+
return ;
|
282 |
+
}
|
283 |
+
});
|
284 |
+
|
285 |
+
if (ok) {
|
286 |
+
$('.status', $('#theme_1_new_folder_container')).text('').removeClass('app-alert-error');
|
287 |
+
} else {
|
288 |
+
var err = 'File/folder with that name already exists.';
|
289 |
+
$('.status', $('#theme_1_new_folder_container')).text(err).addClass('app-alert-error');
|
290 |
+
}
|
291 |
+
});
|
292 |
+
|
293 |
+
/**
|
294 |
+
* New Folder: On OK this will hide the form but will add a new element
|
295 |
+
* to the theme files dropdown.
|
296 |
+
* @TODO
|
297 |
+
*/
|
298 |
+
$('#theme_1_new_folder_btn_ok').on("click", function () {
|
299 |
+
var val = $('#theme_1_new_folder').val();
|
300 |
+
val = orbisius_child_theme_creator.sanitize_file_name(val);
|
301 |
+
var text = val;
|
302 |
+
|
303 |
+
if (val == '') {
|
304 |
+
alert('Invalid or empty value for folder name.');
|
305 |
+
$('#theme_1_new_folder').focus();
|
306 |
+
return ;
|
307 |
+
}
|
308 |
+
|
309 |
+
var ok = 1; // let's by positive by default
|
310 |
+
|
311 |
+
// Let's check if that file exists by checking if there is an entry in the options
|
312 |
+
$("#theme_1_folder option").each(function() { // idx, val
|
313 |
+
var cur_val = $(this).val();
|
314 |
+
|
315 |
+
if (cur_val == val) {
|
316 |
+
ok = 0;
|
317 |
+
return ;
|
318 |
+
}
|
319 |
+
});
|
320 |
+
|
321 |
+
if (!ok) {
|
322 |
+
alert('File with that name already exists.');
|
323 |
+
$('#theme_1_new_folder').focus();
|
324 |
+
return ;
|
325 |
+
}
|
326 |
+
|
327 |
+
// unselects current element from the dropdown.
|
328 |
+
$("select theme_1_folder").prop("selected", false);
|
329 |
+
var new_option = $('<option></option>').val(val).html(text).prop("selected", true);
|
330 |
+
|
331 |
+
$('#theme_1_folder').append( new_option ); // select
|
332 |
+
$('#theme_1_new_folder_container').hide('slow');
|
333 |
+
$('#theme_1_new_folder').val(''); // text box for new folder
|
334 |
+
$('#theme_1_folder_contents').val('').focus(); // textarea
|
335 |
+
});
|
336 |
+
|
337 |
+
// This is when the cancel button is clicked so the user doesn't want a new folder.
|
338 |
+
$('#theme_1_new_folder_btn_cancel').on("click", function () {
|
339 |
+
$('#theme_1_new_folder').val('');
|
340 |
+
$('#theme_1_new_folder_container').hide('slow');
|
341 |
+
$('.status', $('#theme_1_new_folder_container')).text('').removeClass('app-alert-error');
|
342 |
+
});
|
343 |
+
///////////////////////////////////////////////////////////////////////////////////////////////////
|
344 |
+
|
345 |
// Change theme selection
|
346 |
$('#theme_1').on("change", function () {
|
347 |
app_load('#orbisius_ctc_theme_editor_theme_1_form', 'generate_dropdown', '#theme_1_file', app_handle_theme_change);
|
379 |
*/
|
380 |
function app_handle_theme_change(form_id, action, target_container, result) {
|
381 |
var form_prefix = jQuery(form_id) ? jQuery(form_id).attr('id') : ''; // orbisius_ctc_theme_editor_theme_1_form
|
382 |
+
form_prefix = form_prefix || '';
|
383 |
+
|
384 |
+
if (form_prefix == '') {
|
385 |
+
return;
|
386 |
+
}
|
387 |
+
|
388 |
form_prefix = form_prefix.replace(/.+(theme[-_]*\d+).*/, '$1');
|
389 |
form_prefix = '#' + form_prefix + '_'; // jQuery ID prefix. Res: #theme_2_
|
390 |
|
assets/main.min.css
CHANGED
@@ -15,6 +15,7 @@
|
|
15 |
.orbisius_child_theme_creator_container .available-theme:hover{border:2px solid #444;background:#ccc}
|
16 |
.orbisius_child_theme_creator_container .saving_action{background:#ccc}
|
17 |
.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:40%}
|
|
|
18 |
.orbisius_child_theme_creator_container .highlight,.orbisius_ctc_theme_editor_container .highlight{background:#FF3}
|
19 |
.orbisius_child_theme_creator_container .app-dialog-button-ok,.orbisius_ctc_theme_editor_container .app-dialog-button-ok{background:green!important;color:#FFF!important}
|
20 |
.orbisius_child_theme_creator_container .app-dialog-button-cancel,.orbisius_ctc_theme_editor_container .app-dialog-button-cancel{background:red!important;color:#FFF!important}
|
15 |
.orbisius_child_theme_creator_container .available-theme:hover{border:2px solid #444;background:#ccc}
|
16 |
.orbisius_child_theme_creator_container .saving_action{background:#ccc}
|
17 |
.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:40%}
|
18 |
+
.orbisius_ctc_theme_editor_container .primary_buttons{margin-top:5px}
|
19 |
.orbisius_child_theme_creator_container .highlight,.orbisius_ctc_theme_editor_container .highlight{background:#FF3}
|
20 |
.orbisius_child_theme_creator_container .app-dialog-button-ok,.orbisius_ctc_theme_editor_container .app-dialog-button-ok{background:green!important;color:#FFF!important}
|
21 |
.orbisius_child_theme_creator_container .app-dialog-button-cancel,.orbisius_ctc_theme_editor_container .app-dialog-button-cancel{background:red!important;color:#FFF!important}
|
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_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_1").on("change",function(){app_load("#orbisius_ctc_theme_editor_theme_1_form","generate_dropdown","#theme_1_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.replace(/.+(theme[-_]*\d+).*/,"$1");i="#"+i+"_";var s=jQuery(i+"_file").val();if(s!==""){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){jQuery("#theme_1_file option:selected").remove();jQuery("#theme_1_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_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_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_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_1_new_folder_btn").on("click",function(){e("#theme_1_new_folder_container").toggle("slow");e("#theme_1_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_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_1").on("change",function(){app_load("#orbisius_ctc_theme_editor_theme_1_form","generate_dropdown","#theme_1_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+"_";var s=jQuery(i+"_file").val();if(s!==""){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){jQuery("#theme_1_file option:selected").remove();jQuery("#theme_1_file").trigger("change")}})}};jQuery(document).ready(function(e){orbisius_ctc_theme_editor_setup()})
|
nbproject/private/private.xml
CHANGED
@@ -1,6 +1,6 @@
|
|
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="2">
|
@@ -9,11 +9,18 @@
|
|
9 |
<key/>
|
10 |
</bookmark>
|
11 |
</file>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
</editor-bookmarks>
|
13 |
-
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/1">
|
14 |
-
<file>file:/C:/projects/default/htdocs/wordpress313/wp-content/plugins/orbisius-child-theme-creator/orbisius-child-theme-creator.php</file>
|
15 |
-
<file>file:/C:/projects/default/htdocs/wordpress313/wp-content/plugins/orbisius-child-theme-creator/readme.txt</file>
|
16 |
-
<file>file:/C:/projects/default/htdocs/wordpress313/wp-content/plugins/orbisius-child-theme-creator/assets/main.css</file>
|
17 |
-
<file>file:/C:/projects/default/htdocs/wordpress313/wp-content/plugins/orbisius-child-theme-creator/assets/main.js</file>
|
18 |
-
</open-files>
|
19 |
</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="4">
|
4 |
<file>
|
5 |
<url>orbisius-child_theme_creator.php</url>
|
6 |
<bookmark id="2">
|
9 |
<key/>
|
10 |
</bookmark>
|
11 |
</file>
|
12 |
+
<file>
|
13 |
+
<url>orbisius-child-theme-creator.php</url>
|
14 |
+
<bookmark id="4">
|
15 |
+
<name/>
|
16 |
+
<line>1516</line>
|
17 |
+
<key/>
|
18 |
+
</bookmark>
|
19 |
+
<bookmark id="3">
|
20 |
+
<name/>
|
21 |
+
<line>1744</line>
|
22 |
+
<key/>
|
23 |
+
</bookmark>
|
24 |
+
</file>
|
25 |
</editor-bookmarks>
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
</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.1.
|
7 |
Author: Svetoslav Marinov (Slavi)
|
8 |
Author URI: http://orbisius.com
|
9 |
*/
|
@@ -27,6 +27,7 @@
|
|
27 |
|
28 |
// Set up plugin
|
29 |
add_action('admin_init', 'orbisius_child_theme_creator_admin_init');
|
|
|
30 |
add_action('admin_enqueue_scripts', 'orbisius_child_theme_creator_admin_enqueue_scripts');
|
31 |
add_action('admin_menu', 'orbisius_child_theme_creator_setup_admin');
|
32 |
add_action('network_admin_menu', 'orbisius_child_theme_creator_setup_admin');
|
@@ -37,16 +38,35 @@ add_action('network_admin_notices', 'orbisius_child_theme_creator_admin_notice_m
|
|
37 |
add_action( 'wp_ajax_orbisius_ctc_theme_editor_ajax', 'orbisius_ctc_theme_editor_ajax');
|
38 |
add_action( 'wp_ajax_nopriv_orbisius_ctc_theme_editor_ajax', 'orbisius_ctc_theme_editor_ajax');
|
39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
/**
|
41 |
* Show a notice in the plugins area to let the user know how to work with the plugin.
|
42 |
* On multisite the message is shown only on the network site.
|
43 |
*/
|
44 |
function orbisius_child_theme_creator_admin_notice_message() {
|
45 |
global $pagenow;
|
|
|
46 |
|
47 |
$plugin_data = orbisius_child_theme_creator_get_plugin_data();
|
48 |
$name = $plugin_data['Name'];
|
49 |
-
|
|
|
|
|
50 |
|
51 |
if ($show_notice
|
52 |
&& ( stripos($pagenow, 'plugins.php') !== false )
|
@@ -65,6 +85,68 @@ function orbisius_child_theme_creator_admin_init() {
|
|
65 |
|
66 |
}
|
67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
/**
|
69 |
* @package Orbisius Child Theme Creator
|
70 |
* @since 1.0
|
@@ -97,24 +179,33 @@ function orbisius_child_theme_creator_admin_enqueue_scripts($current_page = '')
|
|
97 |
* @since 0.1
|
98 |
*/
|
99 |
function orbisius_child_theme_creator_setup_admin() {
|
100 |
-
add_options_page('Orbisius Child Theme Creator', 'Orbisius Child Theme Creator', 'manage_options',
|
101 |
-
|
102 |
-
|
|
|
|
|
|
|
|
|
|
|
103 |
|
104 |
// when plugins are show add a settings link near my plugin for a quick access to the settings page.
|
105 |
add_filter('plugin_action_links', 'orbisius_child_theme_creator_add_plugin_settings_link', 10, 2);
|
106 |
|
107 |
// Theme Editor
|
108 |
-
add_theme_page( 'Orbisius Theme Editor', 'Orbisius Theme Editor', 'manage_options',
|
|
|
109 |
add_filter('theme_action_links', 'orbisius_child_theme_creator_add_edit_theme_link', 50, 2);
|
110 |
}
|
111 |
|
112 |
// Add the ? settings link in Plugins page very good
|
113 |
function orbisius_child_theme_creator_add_plugin_settings_link($links, $file) {
|
114 |
if ($file == plugin_basename(__FILE__)) {
|
115 |
-
$link = orbisius_child_theme_creator_util::
|
|
|
|
|
116 |
|
117 |
-
$
|
|
|
118 |
array_unshift($links, $link_html);
|
119 |
}
|
120 |
|
@@ -141,6 +232,8 @@ function orbisius_child_theme_creator_settings_page() {
|
|
141 |
?>
|
142 |
|
143 |
<div class="wrap orbisius_child_theme_creator_container">
|
|
|
|
|
144 |
<h2>Orbisius Child Theme Creator</h2>
|
145 |
|
146 |
<div class="updated"><p>
|
@@ -156,84 +249,277 @@ function orbisius_child_theme_creator_settings_page() {
|
|
156 |
|
157 |
<div class="updated0"><p>
|
158 |
This plugin doesn't currently have any configuration options. To use it go to <strong>Appearance → Orbisius Child Theme Creator</strong>
|
159 |
-
|
160 |
-
|
161 |
-
<h2>Video Demo</h2>
|
162 |
-
|
163 |
-
<p class="orbisius_child_theme_creator_demo_video hide00">
|
164 |
-
<iframe width="560" height="315" src="http://www.youtube.com/embed/BZUVq6ZTv-o" frameborder="0" allowfullscreen></iframe>
|
165 |
-
|
166 |
-
<br/>Video Link: <a href="www.youtube.com/watch?v=BZUVq6ZTv-o"
|
167 |
-
target="_blank">www.youtube.com/watch?v=BZUVq6ZTv-o</a>
|
168 |
-
</p>
|
169 |
-
|
170 |
-
<?php
|
171 |
-
$plugin_data = orbisius_child_theme_creator_get_plugin_data();
|
172 |
-
|
173 |
-
$app_link = urlencode($plugin_data['PluginURI']);
|
174 |
-
$app_title = urlencode($plugin_data['Name']);
|
175 |
-
$app_descr = urlencode($plugin_data['Description']);
|
176 |
-
?>
|
177 |
-
<h2>Share</h2>
|
178 |
-
<p>
|
179 |
-
<!-- AddThis Button BEGIN -->
|
180 |
-
<div class="addthis_toolbox addthis_default_style addthis_32x32_style">
|
181 |
-
<a class="addthis_button_facebook" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
182 |
-
<a class="addthis_button_twitter" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
183 |
-
<a class="addthis_button_google_plusone" g:plusone:count="false" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
184 |
-
<a class="addthis_button_linkedin" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
185 |
-
<a class="addthis_button_email" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
186 |
-
<a class="addthis_button_myspace" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
187 |
-
<a class="addthis_button_google" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
188 |
-
<a class="addthis_button_digg" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
189 |
-
<a class="addthis_button_delicious" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
190 |
-
<a class="addthis_button_stumbleupon" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
191 |
-
<a class="addthis_button_tumblr" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
192 |
-
<a class="addthis_button_favorites" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
193 |
-
<a class="addthis_button_compact"></a>
|
194 |
-
</div>
|
195 |
-
<!-- The JS code is in the footer -->
|
196 |
-
|
197 |
-
<script type="text/javascript">
|
198 |
-
var addthis_config = {"data_track_clickback": true};
|
199 |
-
var addthis_share = {
|
200 |
-
templates: {twitter: 'Check out {{title}} #WordPress #plugin at {{lurl}} (via @orbisius)'}
|
201 |
-
}
|
202 |
-
</script>
|
203 |
-
<!-- AddThis Button START part2 -->
|
204 |
-
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=lordspace"></script>
|
205 |
-
<!-- AddThis Button END part2 -->
|
206 |
-
</p>
|
207 |
-
|
208 |
-
<h2>Troubleshooting</h2>
|
209 |
-
If your site becomes broken due to a child theme (mis)configuration. Please check another plugin of ours:
|
210 |
-
<a href="http://club.orbisius.com/products/wordpress-plugins/orbisius-theme-fixer/?utm_source=orbisius-child-theme-creator&utm_medium=settings_troubleshooting&utm_campaign=product" target="_blank" title="[new window]">Orbisius Theme Fixer</a>
|
211 |
|
212 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
213 |
<div class="updated"><p>
|
214 |
** NOTE: ** Support is handled on our site: <a href="http://club.orbisius.com/forums/forum/community-support-forum/wordpress-plugins/orbisius-child-theme-creator/?utm_source=orbisius-child-theme-editor&utm_medium=action_screen&utm_campaign=product" target="_blank" title="[new window]">http://club.orbisius.com/support/</a>.
|
215 |
Please do NOT use the WordPress forums or other places to seek support.
|
216 |
-
|
217 |
-
|
218 |
-
<h2>Mailing List</h2>
|
219 |
-
<p>
|
220 |
-
Get the latest news and updates about this and future cool
|
221 |
-
<a href="http://profiles.wordpress.org/lordspace/"
|
222 |
-
target="_blank" title="Opens a page with the pugins we developed. [New Window/Tab]">plugins we develop</a>.
|
223 |
-
</p>
|
224 |
-
<p>
|
225 |
-
<!-- // MAILCHIMP SUBSCRIBE CODE \\ -->
|
226 |
-
1) <a href="http://eepurl.com/guNzr" target="_blank">Subscribe to our newsletter</a>
|
227 |
-
<!-- \\ MAILCHIMP SUBSCRIBE CODE // -->
|
228 |
-
</p>
|
229 |
-
<p>OR</p>
|
230 |
-
<p>
|
231 |
-
2) Subscribe using our QR code. [Scan it with your mobile device].<br/>
|
232 |
-
<img src="<?php echo plugin_dir_url(__FILE__); ?>/i/guNzr.qr.2.png" alt="" />
|
233 |
-
</p>
|
234 |
|
235 |
<?php orbisius_child_theme_creator_generate_ext_content(); ?>
|
236 |
-
</div>
|
237 |
<?php
|
238 |
}
|
239 |
|
@@ -407,7 +693,10 @@ function orbisius_child_theme_creator_tools_action() {
|
|
407 |
Test themes and plugins before you actually put them on your site">Free Test Site</a> <small>(2 sec setup)</small>
|
408 |
|
409 |
| <a href="http://orbisius.com/page/free-quote/?utm_source=child-theme-creator&utm_medium=plugin-links&utm_campaign=plugin-update"
|
410 |
-
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>
|
|
|
|
|
|
|
411 |
|
412 |
| <a href="http://club.orbisius.com/forums/forum/community-support-forum/wordpress-plugins/orbisius-child-theme-creator/?utm_source=orbisius-child-theme-editor&utm_medium=action_screen&utm_campaign=product" target="_blank" title="[new window]">Support Forums</a>
|
413 |
|
@@ -985,6 +1274,33 @@ class orbisius_child_theme_creator {
|
|
985 |
* Util funcs
|
986 |
*/
|
987 |
class orbisius_child_theme_creator_util {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
988 |
/**
|
989 |
* Uses wp_kses to sanitize the data
|
990 |
* @param str/array $value
|
@@ -1083,10 +1399,53 @@ class orbisius_child_theme_creator_util {
|
|
1083 |
}
|
1084 |
|
1085 |
/**
|
1086 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1087 |
*/
|
1088 |
-
public static function load_files($dir) {
|
1089 |
$files = array();
|
|
|
|
|
1090 |
$all_files = scandir($dir);
|
1091 |
|
1092 |
foreach ($all_files as $file) {
|
@@ -1094,7 +1453,16 @@ class orbisius_child_theme_creator_util {
|
|
1094 |
continue;
|
1095 |
}
|
1096 |
|
1097 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1098 |
}
|
1099 |
|
1100 |
return $files;
|
@@ -1226,7 +1594,10 @@ function orbisius_ctc_theme_editor() {
|
|
1226 |
Test themes and plugins before you actually put them on your site">Free Test Site</a> <small>(2 sec setup)</small>
|
1227 |
|
1228 |
| <a href="http://orbisius.com/page/free-quote/?utm_source=child-theme-editor&utm_medium=plugin-links&utm_campaign=plugin-update"
|
1229 |
-
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>
|
|
|
|
|
|
|
1230 |
|
1231 |
| <a href="http://club.orbisius.com/forums/forum/community-support-forum/wordpress-plugins/orbisius-child-theme-creator/?utm_source=orbisius-child-theme-editor&utm_medium=action_screen&utm_campaign=product" target="_blank" title="[new window]">Support Forums</a>
|
1232 |
|
@@ -1289,28 +1660,66 @@ function orbisius_ctc_theme_editor() {
|
|
1289 |
</span>
|
1290 |
|
1291 |
<textarea id="theme_1_file_contents" name="theme_1_file_contents" rows="22" class="widefat"></textarea>
|
1292 |
-
|
1293 |
-
|
|
|
1294 |
<span class="status"></span>
|
1295 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1296 |
</form>
|
1297 |
|
1298 |
-
<hr />
|
1299 |
-
<div>
|
1300 |
-
<button type="button" class='button' id="theme_1_new_file_btn" name="theme_1_new_file_btn">New File</button>
|
1301 |
-
<a href='javascript:void(0)' class='app-button-right app-button-negative' id="theme_1_delete_file_btn" name="theme_1_delete_file_btn">Delete File</a>
|
1302 |
-
|
1303 |
-
<div id='theme_1_new_file_container' class="theme_1_new_file_container app-hide">
|
1304 |
-
<strong>New File</strong>
|
1305 |
-
<input type="text" id="theme_1_new_file" name="theme_1_new_file" value="" />
|
1306 |
-
<span>e.g. test.js, extra.css etc</span>
|
1307 |
-
<span class="status"></span>
|
1308 |
-
|
1309 |
-
<br/>
|
1310 |
-
<button type='button' class='button button-primary' id="theme_1_new_file_btn_ok" name="theme_1_submit">Save</button>
|
1311 |
-
<a href='javascript:void(0)' class='app-button-negative00 button delete' id="theme_1_new_file_btn_cancel" name="theme_1_submit">Cancel</a>
|
1312 |
-
</div>
|
1313 |
-
</div>
|
1314 |
</td>
|
1315 |
<td width="50%">
|
1316 |
<form id="orbisius_ctc_theme_editor_theme_2_form" class="orbisius_ctc_theme_editor_theme_2_form">
|
@@ -1323,8 +1732,8 @@ function orbisius_ctc_theme_editor() {
|
|
1323 |
</span>
|
1324 |
|
1325 |
<textarea id="theme_2_file_contents" name="theme_2_file_contents" rows="22" class="widefat"></textarea>
|
1326 |
-
<div>
|
1327 |
-
<button type='submit' class='button button-primary' id="theme_2_submit" name="theme_2_submit">
|
1328 |
<span class="status"></span>
|
1329 |
</div>
|
1330 |
</form>
|
@@ -1364,14 +1773,157 @@ function orbisius_ctc_theme_editor_ajax() {
|
|
1364 |
|
1365 |
break;
|
1366 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1367 |
default:
|
1368 |
break;
|
1369 |
}
|
1370 |
|
1371 |
-
|
1372 |
die($buff);
|
1373 |
}
|
1374 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1375 |
/**
|
1376 |
* It seems WP intentionally adds slashes for consistency with php.
|
1377 |
* Please note: WordPress Core and most plugins will still be expecting slashes, and the above code will confuse and break them.
|
@@ -1436,31 +1988,35 @@ function orbisius_ctc_theme_editor_generate_dropdown() {
|
|
1436 |
* @return string
|
1437 |
*/
|
1438 |
function orbisius_ctc_theme_editor_manage_file($cmd_id = 1) {
|
1439 |
-
$buff = $theme_base_dir = $theme_file = '';
|
1440 |
|
1441 |
$req = orbisius_ctc_theme_editor_get_request();
|
1442 |
|
|
|
|
|
1443 |
if (!empty($req['theme_1']) && !empty($req['theme_1_file'])) {
|
1444 |
-
$theme_base_dir = empty($req['theme_1']) ? '' : preg_replace('#[^\w-]#si', '', $req['theme_1']);
|
1445 |
-
$
|
|
|
1446 |
$theme_file_contents = empty($req['theme_1_file_contents']) ? '' : $req['theme_1_file_contents'];
|
1447 |
} elseif (!empty($req['theme_2']) && !empty($req['theme_2_file'])) {
|
1448 |
-
$theme_base_dir = empty($req['theme_2']) ? '' : preg_replace('#[^\w-]#si', '', $req['theme_2']);
|
1449 |
-
$
|
|
|
1450 |
$theme_file_contents = empty($req['theme_2_file_contents']) ? '' : $req['theme_2_file_contents'];
|
1451 |
} else {
|
1452 |
return 'Missing data!';
|
1453 |
}
|
1454 |
-
|
1455 |
-
|
1456 |
-
|
1457 |
if (empty($theme_base_dir) || !is_dir($theme_dir)) {
|
1458 |
return 'Selected theme is invalid.';
|
1459 |
-
} elseif (!file_exists($
|
|
|
1460 |
return 'Selected file is invalid.';
|
1461 |
}
|
1462 |
|
1463 |
-
|
1464 |
|
1465 |
if ($cmd_id == 1) {
|
1466 |
$buff = file_get_contents($theme_file);
|
@@ -1469,7 +2025,32 @@ function orbisius_ctc_theme_editor_manage_file($cmd_id = 1) {
|
|
1469 |
$buff = !empty($status) ? $theme_file_contents : '';
|
1470 |
} elseif ($cmd_id == 3 && (!empty($req['theme_1_file']) || !empty($req['theme_2_file']))) {
|
1471 |
$status = unlink($theme_file);
|
1472 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1473 |
|
1474 |
}
|
1475 |
|
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.1.3
|
7 |
Author: Svetoslav Marinov (Slavi)
|
8 |
Author URI: http://orbisius.com
|
9 |
*/
|
27 |
|
28 |
// Set up plugin
|
29 |
add_action('admin_init', 'orbisius_child_theme_creator_admin_init');
|
30 |
+
add_action('admin_init', 'orbisius_child_theme_creator_register_settings');
|
31 |
add_action('admin_enqueue_scripts', 'orbisius_child_theme_creator_admin_enqueue_scripts');
|
32 |
add_action('admin_menu', 'orbisius_child_theme_creator_setup_admin');
|
33 |
add_action('network_admin_menu', 'orbisius_child_theme_creator_setup_admin');
|
38 |
add_action( 'wp_ajax_orbisius_ctc_theme_editor_ajax', 'orbisius_ctc_theme_editor_ajax');
|
39 |
add_action( 'wp_ajax_nopriv_orbisius_ctc_theme_editor_ajax', 'orbisius_ctc_theme_editor_ajax');
|
40 |
|
41 |
+
|
42 |
+
register_activation_hook( __FILE__, 'orbisius_child_theme_creator_on_activate' );
|
43 |
+
|
44 |
+
/**
|
45 |
+
*
|
46 |
+
*/
|
47 |
+
function orbisius_child_theme_creator_on_activate() {
|
48 |
+
$opts = orbisius_child_theme_creator_get_options();
|
49 |
+
|
50 |
+
// Let's set the activation time so we can hide the notice in the plugins area.
|
51 |
+
if (empty($opts['setup_time'])) {
|
52 |
+
$opts['setup_time'] = time();
|
53 |
+
orbisius_child_theme_creator_set_options($opts);
|
54 |
+
}
|
55 |
+
}
|
56 |
+
|
57 |
/**
|
58 |
* Show a notice in the plugins area to let the user know how to work with the plugin.
|
59 |
* On multisite the message is shown only on the network site.
|
60 |
*/
|
61 |
function orbisius_child_theme_creator_admin_notice_message() {
|
62 |
global $pagenow;
|
63 |
+
$opts = orbisius_child_theme_creator_get_options();
|
64 |
|
65 |
$plugin_data = orbisius_child_theme_creator_get_plugin_data();
|
66 |
$name = $plugin_data['Name'];
|
67 |
+
|
68 |
+
// show notice only the first 24h
|
69 |
+
$show_notice = empty($opts['setup_time']) || ( time() - $opts['setup_time'] < 24 * 3600 );
|
70 |
|
71 |
if ($show_notice
|
72 |
&& ( stripos($pagenow, 'plugins.php') !== false )
|
85 |
|
86 |
}
|
87 |
|
88 |
+
/**
|
89 |
+
* Sets the setting variables
|
90 |
+
*/
|
91 |
+
function orbisius_child_theme_creator_register_settings() { // whitelist options
|
92 |
+
register_setting('orbisius_child_theme_creator_settings', 'orbisius_child_theme_creator_options',
|
93 |
+
'orbisius_child_theme_creator_validate_settings');
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* This is called by WP after the user hits the submit button.
|
98 |
+
* The variables are trimmed first and then passed to the who ever wantsto filter them.
|
99 |
+
* @param array the entered data from the settings page.
|
100 |
+
* @return array the modified input array
|
101 |
+
*/
|
102 |
+
function orbisius_child_theme_creator_validate_settings($input) { // whitelist options
|
103 |
+
$input = array_map('trim', $input);
|
104 |
+
|
105 |
+
// let extensions do their thing
|
106 |
+
$input_filtered = apply_filters('orbisius_child_theme_creator_ext_filter_settings', $input);
|
107 |
+
|
108 |
+
// did the extension break stuff?
|
109 |
+
$input = is_array($input_filtered) ? $input_filtered : $input;
|
110 |
+
|
111 |
+
return $input;
|
112 |
+
}
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Retrieves the plugin options. It inserts some defaults.
|
116 |
+
* The saving is handled by the settings page. Basically, we submit to WP and it takes
|
117 |
+
* care of the saving.
|
118 |
+
*
|
119 |
+
* @return array
|
120 |
+
*/
|
121 |
+
function orbisius_child_theme_creator_get_options() {
|
122 |
+
$defaults = array(
|
123 |
+
'status' => 1,
|
124 |
+
'setup_time' => '',
|
125 |
+
);
|
126 |
+
|
127 |
+
$opts = get_option('orbisius_child_theme_creator_options');
|
128 |
+
|
129 |
+
$opts = (array) $opts;
|
130 |
+
$opts = array_merge($defaults, $opts);
|
131 |
+
|
132 |
+
return $opts;
|
133 |
+
}
|
134 |
+
|
135 |
+
/**
|
136 |
+
* Updates options but it merges them unless $override is set to 1
|
137 |
+
* that way we could just update one variable of the settings.
|
138 |
+
*/
|
139 |
+
function orbisius_child_theme_creator_set_options($opts = array(), $override = 0) {
|
140 |
+
if (!$override) {
|
141 |
+
$old_opts = orbisius_child_theme_creator_get_options();
|
142 |
+
$opts = array_merge($old_opts, $opts);
|
143 |
+
}
|
144 |
+
|
145 |
+
update_option('orbisius_child_theme_creator_options', $opts);
|
146 |
+
|
147 |
+
return $opts;
|
148 |
+
}
|
149 |
+
|
150 |
/**
|
151 |
* @package Orbisius Child Theme Creator
|
152 |
* @since 1.0
|
179 |
* @since 0.1
|
180 |
*/
|
181 |
function orbisius_child_theme_creator_setup_admin() {
|
182 |
+
add_options_page('Orbisius Child Theme Creator', 'Orbisius Child Theme Creator', 'manage_options',
|
183 |
+
'orbisius_child_theme_creator_settings_page', 'orbisius_child_theme_creator_settings_page');
|
184 |
+
|
185 |
+
add_theme_page('Orbisius Child Theme Creator', 'Orbisius Child Theme Creator', 'manage_options',
|
186 |
+
'orbisius_child_theme_creator_themes_action', 'orbisius_child_theme_creator_tools_action');
|
187 |
+
|
188 |
+
add_submenu_page('tools.php', 'Orbisius Child Theme Creator', 'Orbisius Child Theme Creator', 'manage_options',
|
189 |
+
'orbisius_child_theme_creator_tools_action', 'orbisius_child_theme_creator_tools_action');
|
190 |
|
191 |
// when plugins are show add a settings link near my plugin for a quick access to the settings page.
|
192 |
add_filter('plugin_action_links', 'orbisius_child_theme_creator_add_plugin_settings_link', 10, 2);
|
193 |
|
194 |
// Theme Editor
|
195 |
+
add_theme_page( 'Orbisius Theme Editor', 'Orbisius Theme Editor', 'manage_options',
|
196 |
+
'orbisius_child_theme_creator_theme_editor_action', 'orbisius_ctc_theme_editor' );
|
197 |
add_filter('theme_action_links', 'orbisius_child_theme_creator_add_edit_theme_link', 50, 2);
|
198 |
}
|
199 |
|
200 |
// Add the ? settings link in Plugins page very good
|
201 |
function orbisius_child_theme_creator_add_plugin_settings_link($links, $file) {
|
202 |
if ($file == plugin_basename(__FILE__)) {
|
203 |
+
$link = orbisius_child_theme_creator_util::get_theme_editor_link();
|
204 |
+
$link_html = "<a href='$link'>Edit Themes</a>";
|
205 |
+
array_unshift($links, $link_html);
|
206 |
|
207 |
+
$link = orbisius_child_theme_creator_util::get_create_child_pages_link();
|
208 |
+
$link_html = "<a href='$link'>Create Child Theme</a>";
|
209 |
array_unshift($links, $link_html);
|
210 |
}
|
211 |
|
232 |
?>
|
233 |
|
234 |
<div class="wrap orbisius_child_theme_creator_container">
|
235 |
+
|
236 |
+
<div id="icon-options-general" class="icon32"></div>
|
237 |
<h2>Orbisius Child Theme Creator</h2>
|
238 |
|
239 |
<div class="updated"><p>
|
249 |
|
250 |
<div class="updated0"><p>
|
251 |
This plugin doesn't currently have any configuration options. To use it go to <strong>Appearance → Orbisius Child Theme Creator</strong>
|
252 |
+
</p></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
253 |
|
254 |
+
<div id="poststuff">
|
255 |
+
|
256 |
+
<div id="post-body" class="metabox-holder columns-2">
|
257 |
+
|
258 |
+
<!-- main content -->
|
259 |
+
<div id="post-body-content">
|
260 |
+
|
261 |
+
<div class="meta-box-sortables ui-sortable">
|
262 |
+
|
263 |
+
|
264 |
+
<div class="postbox">
|
265 |
+
|
266 |
+
<h3><span>Usage / Help</span></h3>
|
267 |
+
<div class="inside">
|
268 |
+
|
269 |
+
<strong>Process</strong><br/>
|
270 |
+
<ul>
|
271 |
+
<li>Download a Theme that you like</li>
|
272 |
+
<li>Create a child theme based on it</li>
|
273 |
+
<li>Activate the child theme</li>
|
274 |
+
<li>Customize the child theme</li>
|
275 |
+
</ul>
|
276 |
+
|
277 |
+
<iframe width="560" height="315" src="http://www.youtube.com/embed/BZUVq6ZTv-o" frameborder="0" allowfullscreen></iframe>
|
278 |
+
|
279 |
+
</div> <!-- .inside -->
|
280 |
+
|
281 |
+
</div> <!-- .postbox -->
|
282 |
+
|
283 |
+
<div class="postbox">
|
284 |
+
<?php
|
285 |
+
$plugin_data = orbisius_child_theme_creator_get_plugin_data();
|
286 |
+
|
287 |
+
$app_link = urlencode($plugin_data['PluginURI']);
|
288 |
+
$app_title = urlencode($plugin_data['Name']);
|
289 |
+
$app_descr = urlencode($plugin_data['Description']);
|
290 |
+
?>
|
291 |
+
<h3>Share</h3>
|
292 |
+
<p>
|
293 |
+
<!-- AddThis Button BEGIN -->
|
294 |
+
<div class="addthis_toolbox addthis_default_style addthis_32x32_style">
|
295 |
+
<a class="addthis_button_facebook" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
296 |
+
<a class="addthis_button_twitter" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
297 |
+
<a class="addthis_button_google_plusone" g:plusone:count="false" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
298 |
+
<a class="addthis_button_linkedin" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
299 |
+
<a class="addthis_button_email" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
300 |
+
<a class="addthis_button_myspace" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
301 |
+
<a class="addthis_button_google" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
302 |
+
<a class="addthis_button_digg" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
303 |
+
<a class="addthis_button_delicious" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
304 |
+
<a class="addthis_button_stumbleupon" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
305 |
+
<a class="addthis_button_tumblr" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
306 |
+
<a class="addthis_button_favorites" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
307 |
+
<a class="addthis_button_compact"></a>
|
308 |
+
</div>
|
309 |
+
<!-- The JS code is in the footer -->
|
310 |
+
|
311 |
+
<script type="text/javascript">
|
312 |
+
var addthis_config = {"data_track_clickback": true};
|
313 |
+
var addthis_share = {
|
314 |
+
templates: {twitter: 'Check out {{title}} #WordPress #plugin at {{lurl}} (via @orbisius)'}
|
315 |
+
}
|
316 |
+
</script>
|
317 |
+
<!-- AddThis Button START part2 -->
|
318 |
+
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=lordspace"></script>
|
319 |
+
<!-- AddThis Button END part2 -->
|
320 |
+
</div> <!-- .postbox -->
|
321 |
+
|
322 |
+
</div> <!-- .meta-box-sortables .ui-sortable -->
|
323 |
+
|
324 |
+
</div> <!-- post-body-content -->
|
325 |
+
|
326 |
+
<!-- sidebar -->
|
327 |
+
<div id="postbox-container-1" class="postbox-container">
|
328 |
+
|
329 |
+
<div class="meta-box-sortables">
|
330 |
+
|
331 |
+
<div class="postbox">
|
332 |
+
<h3><span>Hire Us</span></h3>
|
333 |
+
<div class="inside">
|
334 |
+
Hire us to create a plugin/web/mobile app for your business.
|
335 |
+
<br/><a href="http://orbisius.com/page/free-quote/?utm_source=orbisius-child-theme-creator&utm_medium=plugin-settings&utm_campaign=product"
|
336 |
+
title="If you want a custom web/mobile app/plugin developed contact us. This opens in a new window/tab"
|
337 |
+
class="button-primary" target="_blank">Get a Free Quote</a>
|
338 |
+
</div> <!-- .inside -->
|
339 |
+
</div> <!-- .postbox -->
|
340 |
+
|
341 |
+
<div class="postbox">
|
342 |
+
<h3><span>Newsletter</span></h3>
|
343 |
+
<div class="inside">
|
344 |
+
<!-- Begin MailChimp Signup Form -->
|
345 |
+
<div id="mc_embed_signup">
|
346 |
+
<?php
|
347 |
+
$current_user = wp_get_current_user();
|
348 |
+
$email = empty($current_user->user_email) ? '' : $current_user->user_email;
|
349 |
+
?>
|
350 |
+
|
351 |
+
<form action="http://WebWeb.us2.list-manage.com/subscribe/post?u=005070a78d0e52a7b567e96df&id=1b83cd2093" method="post"
|
352 |
+
id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank">
|
353 |
+
<input type="hidden" value="settings" name="SRC2" />
|
354 |
+
<input type="hidden" value="orbisius-child-theme-creator" name="SRC" />
|
355 |
+
|
356 |
+
<span>Get notified about cool plugins we release</span>
|
357 |
+
<!--<div class="indicates-required"><span class="app_asterisk">*</span> indicates required
|
358 |
+
</div>-->
|
359 |
+
<div class="mc-field-group">
|
360 |
+
<label for="mce-EMAIL">Email <span class="app_asterisk">*</span></label>
|
361 |
+
<input type="email" value="<?php echo esc_attr($email); ?>" name="EMAIL" class="required email" id="mce-EMAIL">
|
362 |
+
</div>
|
363 |
+
<div id="mce-responses" class="clear">
|
364 |
+
<div class="response" id="mce-error-response" style="display:none"></div>
|
365 |
+
<div class="response" id="mce-success-response" style="display:none"></div>
|
366 |
+
</div> <div class="clear"><input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button-primary"></div>
|
367 |
+
</form>
|
368 |
+
</div>
|
369 |
+
<!--End mc_embed_signup-->
|
370 |
+
</div> <!-- .inside -->
|
371 |
+
</div> <!-- .postbox -->
|
372 |
+
|
373 |
+
<div class="postbox">
|
374 |
+
<div class="inside">
|
375 |
+
<!-- Twitter: code -->
|
376 |
+
<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="http://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
|
377 |
+
<!-- /Twitter: code -->
|
378 |
+
|
379 |
+
<!-- Twitter: Orbisius_Follow:js -->
|
380 |
+
<a href="https://twitter.com/orbisius" class="twitter-follow-button"
|
381 |
+
data-align="right" data-show-count="false">Follow @orbisius</a>
|
382 |
+
<!-- /Twitter: Orbisius_Follow:js -->
|
383 |
+
|
384 |
+
|
385 |
+
|
386 |
+
<!-- Twitter: Tweet:js -->
|
387 |
+
<a href="https://twitter.com/share" class="twitter-share-button"
|
388 |
+
data-lang="en" data-text="Checkout Like Gate Pro #WordPress #plugin.Increase your site & fb page's likes"
|
389 |
+
data-count="none" data-via="orbisius" data-related="orbisius"
|
390 |
+
data-url="http://club.orbisius.com/products/wordpress-plugins/orbisius-child-theme-creator/">Tweet</a>
|
391 |
+
<!-- /Twitter: Tweet:js -->
|
392 |
+
|
393 |
+
<br/>
|
394 |
+
<span>Support: <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=plugin-settings&utm_campaign=product"
|
395 |
+
target="_blank" title="[new window]">Forums</a>
|
396 |
+
|
397 |
+
<!--|
|
398 |
+
<a href="http://docs.google.com/viewer?url=https%3A%2F%2Fdl.dropboxusercontent.com%2Fs%2Fwz83vm9841lz3o9%2FOrbisius_LikeGate_Documentation.pdf" target="_blank">Documentation</a>
|
399 |
+
-->
|
400 |
+
</span>
|
401 |
+
</div>
|
402 |
+
|
403 |
+
<h3><span>Troubleshooting</span></h3>
|
404 |
+
<div class="inside">
|
405 |
+
If your site becomes broken because of a child theme check:
|
406 |
+
<a href="http://club.orbisius.com/products/wordpress-plugins/orbisius-theme-fixer/?utm_source=orbisius-child-theme-creator&utm_medium=settings_troubleshooting&utm_campaign=product"
|
407 |
+
target="_blank" title="[new window]">Orbisius Theme Fixer</a>
|
408 |
+
</div>
|
409 |
+
</div> <!-- .postbox -->
|
410 |
+
|
411 |
+
|
412 |
+
<div class="postbox"> <!-- quick-contact -->
|
413 |
+
<?php
|
414 |
+
$current_user = wp_get_current_user();
|
415 |
+
$email = empty($current_user->user_email) ? '' : $current_user->user_email;
|
416 |
+
$quick_form_action = is_ssl()
|
417 |
+
? 'https://ssl.orbisius.com/apps/quick-contact/'
|
418 |
+
: 'http://apps.orbisius.com/quick-contact/';
|
419 |
+
|
420 |
+
if (!empty($_SERVER['DEV_ENV'])) {
|
421 |
+
$quick_form_action = 'http://localhost/projects/quick-contact/';
|
422 |
+
}
|
423 |
+
?>
|
424 |
+
<script>
|
425 |
+
var like_gate_pro_quick_contact = {
|
426 |
+
validate_form : function () {
|
427 |
+
try {
|
428 |
+
var msg = jQuery('#like_gate_pro_msg').val().trim();
|
429 |
+
var email = jQuery('#like_gate_pro_email').val().trim();
|
430 |
+
|
431 |
+
email = email.replace(/\s+/, '');
|
432 |
+
email = email.replace(/\.+/, '.');
|
433 |
+
email = email.replace(/\@+/, '@');
|
434 |
+
|
435 |
+
if ( msg == '' ) {
|
436 |
+
alert('Enter your message.');
|
437 |
+
jQuery('#like_gate_pro_msg').focus().val(msg).css('border', '1px solid red');
|
438 |
+
return false;
|
439 |
+
} else {
|
440 |
+
// all is good clear borders
|
441 |
+
jQuery('#like_gate_pro_msg').css('border', '');
|
442 |
+
}
|
443 |
+
|
444 |
+
if ( email == '' || email.indexOf('@') <= 2 || email.indexOf('.') == -1) {
|
445 |
+
alert('Enter your email and make sure it is valid.');
|
446 |
+
jQuery('#like_gate_pro_email').focus().val(email).css('border', '1px solid red');
|
447 |
+
return false;
|
448 |
+
} else {
|
449 |
+
// all is good clear borders
|
450 |
+
jQuery('#like_gate_pro_email').css('border', '');
|
451 |
+
}
|
452 |
+
|
453 |
+
return true;
|
454 |
+
} catch(e) {};
|
455 |
+
}
|
456 |
+
};
|
457 |
+
</script>
|
458 |
+
<h3><span>Quick Question or Suggestion</span></h3>
|
459 |
+
<div class="inside">
|
460 |
+
<div>
|
461 |
+
<form method="post" action="<?php echo $quick_form_action; ?>" target="_blank">
|
462 |
+
<?php
|
463 |
+
global $wp_version;
|
464 |
+
$plugin_data = get_plugin_data(__FILE__);
|
465 |
+
|
466 |
+
$hidden_data = array(
|
467 |
+
'site_url' => site_url(),
|
468 |
+
'wp_ver' => $wp_version,
|
469 |
+
'first_name' => $current_user->first_name,
|
470 |
+
'last_name' => $current_user->last_name,
|
471 |
+
'product_name' => $plugin_data['Name'],
|
472 |
+
'product_ver' => $plugin_data['Version'],
|
473 |
+
'woocommerce_ver' => defined('WOOCOMMERCE_VERSION') ? WOOCOMMERCE_VERSION : 'n/a',
|
474 |
+
);
|
475 |
+
$hid_data = http_build_query($hidden_data);
|
476 |
+
echo "<input type='hidden' name='data[sys_info]' value='$hid_data' />\n";
|
477 |
+
?>
|
478 |
+
<textarea class="widefat" id='like_gate_pro_msg' name='data[msg]' required="required"></textarea>
|
479 |
+
<br/>Your Email: <input type="text" class=""
|
480 |
+
id="like_gate_pro_email" name='data[sender_email]' placeholder="Email" required="required"
|
481 |
+
value="<?php echo esc_attr($email); ?>"
|
482 |
+
/>
|
483 |
+
<br/><input type="submit" class="button-primary" value="<?php _e('Send Feedback') ?>"
|
484 |
+
onclick="return like_gate_pro_quick_contact.validate_form();" />
|
485 |
+
<br/>
|
486 |
+
What data will be sent
|
487 |
+
<a href='javascript:void(0);'
|
488 |
+
onclick='jQuery(".like_gate_pro_data_to_be_sent").toggle();'>(show/hide)</a>
|
489 |
+
<div class="hide app_hide like_gate_pro_data_to_be_sent">
|
490 |
+
<textarea class="widefat" rows="4" readonly="readonly" disabled="disabled"><?php
|
491 |
+
foreach ($hidden_data as $key => $val) {
|
492 |
+
if (is_array($val)) {
|
493 |
+
$val = var_export($val, 1);
|
494 |
+
}
|
495 |
+
|
496 |
+
echo "$key: $val\n";
|
497 |
+
}
|
498 |
+
?></textarea>
|
499 |
+
</div>
|
500 |
+
</form>
|
501 |
+
</div>
|
502 |
+
</div> <!-- .inside -->
|
503 |
+
</div> <!-- .postbox --> <!-- /quick-contact -->
|
504 |
+
|
505 |
+
</div> <!-- .meta-box-sortables -->
|
506 |
+
|
507 |
+
</div> <!-- #postbox-container-1 .postbox-container -->
|
508 |
+
|
509 |
+
</div> <!-- #post-body .metabox-holder .columns-2 -->
|
510 |
+
|
511 |
+
<br class="clear">
|
512 |
+
</div> <!-- #poststuff -->
|
513 |
+
|
514 |
+
</div> <!-- .wrap -->
|
515 |
+
|
516 |
+
<!--<h2>Support & Feature Requests</h2>
|
517 |
<div class="updated"><p>
|
518 |
** NOTE: ** Support is handled on our site: <a href="http://club.orbisius.com/forums/forum/community-support-forum/wordpress-plugins/orbisius-child-theme-creator/?utm_source=orbisius-child-theme-editor&utm_medium=action_screen&utm_campaign=product" target="_blank" title="[new window]">http://club.orbisius.com/support/</a>.
|
519 |
Please do NOT use the WordPress forums or other places to seek support.
|
520 |
+
</p></div>-->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
521 |
|
522 |
<?php orbisius_child_theme_creator_generate_ext_content(); ?>
|
|
|
523 |
<?php
|
524 |
}
|
525 |
|
693 |
Test themes and plugins before you actually put them on your site">Free Test Site</a> <small>(2 sec setup)</small>
|
694 |
|
695 |
| <a href="http://orbisius.com/page/free-quote/?utm_source=child-theme-creator&utm_medium=plugin-links&utm_campaign=plugin-update"
|
696 |
+
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>
|
697 |
+
|
698 |
+
| <a href="http://orbisius.us2.list-manage.com/subscribe?u=005070a78d0e52a7b567e96df&id=1b83cd2093" target="_blank"
|
699 |
+
title="This opens in a new window/tab">Newsletter</a>
|
700 |
|
701 |
| <a href="http://club.orbisius.com/forums/forum/community-support-forum/wordpress-plugins/orbisius-child-theme-creator/?utm_source=orbisius-child-theme-editor&utm_medium=action_screen&utm_campaign=product" target="_blank" title="[new window]">Support Forums</a>
|
702 |
|
1274 |
* Util funcs
|
1275 |
*/
|
1276 |
class orbisius_child_theme_creator_util {
|
1277 |
+
/**
|
1278 |
+
* This cleans filenames but leaves some of the / because some files can be dir1/file.txt.
|
1279 |
+
* $jail_root must be added because it will also prefix the path with a directory i.e. jail
|
1280 |
+
*
|
1281 |
+
* @param type $file_name
|
1282 |
+
* @param type $jail_root
|
1283 |
+
* @return string
|
1284 |
+
*/
|
1285 |
+
public static function sanitize_file_name($file_name = null, $jail_root = '') {
|
1286 |
+
if (empty($jail_root)) {
|
1287 |
+
$file_name = sanitize_file_name($file_name); // wp func
|
1288 |
+
} else {
|
1289 |
+
$file_name = str_replace('/', '__SLASH__', $file_name);
|
1290 |
+
$file_name = sanitize_file_name($file_name); // wp func
|
1291 |
+
$file_name = str_replace('__SLASH__', '/', $file_name);
|
1292 |
+
}
|
1293 |
+
|
1294 |
+
$file_name = preg_replace('#(?:\/+|\\+)#si', '/', $file_name);
|
1295 |
+
$file_name = ltrim($file_name, '/'); // rm leading /
|
1296 |
+
|
1297 |
+
if (!empty($jail_root)) {
|
1298 |
+
$file_name = $jail_root . $file_name;
|
1299 |
+
}
|
1300 |
+
|
1301 |
+
return $file_name;
|
1302 |
+
}
|
1303 |
+
|
1304 |
/**
|
1305 |
* Uses wp_kses to sanitize the data
|
1306 |
* @param str/array $value
|
1399 |
}
|
1400 |
|
1401 |
/**
|
1402 |
+
* Create an zip file. Requires ZipArchive class to exist.
|
1403 |
+
* Usage: $result = create_zip($files_to_zip, 'my-archive.zip', true, $prefix_to_strip, 'Slavi created this archive at ' . date('r') );
|
1404 |
+
*
|
1405 |
+
* @param array $files
|
1406 |
+
* @param str $destination zip file
|
1407 |
+
* @param str $overwrite
|
1408 |
+
* @param str $prefix_to_strip
|
1409 |
+
* @param str $comment
|
1410 |
+
* @return boolean
|
1411 |
+
*/
|
1412 |
+
function create_zip($files = array(), $destination = '', $overwrite = false, $prefix_to_strip = '', $comment = '' ) {
|
1413 |
+
if ((file_exists($destination) && !$overwrite) || !class_exists('ZipArchive')) {
|
1414 |
+
return false;
|
1415 |
+
}
|
1416 |
+
|
1417 |
+
$zip = new ZipArchive();
|
1418 |
+
|
1419 |
+
if ($zip->open($destination, $overwrite ? ZIPARCHIVE::OVERWRITE : ZIPARCHIVE::CREATE) !== true) {
|
1420 |
+
return false;
|
1421 |
+
}
|
1422 |
+
|
1423 |
+
foreach ($files as $file) {
|
1424 |
+
// if we specify abs path to the dir we'll add a relative folder in the archive.
|
1425 |
+
$file_in_archive = str_ireplace($prefix_to_strip, '', $file);
|
1426 |
+
$zip->addFile($file, $file_in_archive);
|
1427 |
+
}
|
1428 |
+
|
1429 |
+
if (!empty($comment)) {
|
1430 |
+
$zip->setArchiveComment($comment);
|
1431 |
+
}
|
1432 |
+
|
1433 |
+
$zip->close();
|
1434 |
+
|
1435 |
+
return file_exists($destination);
|
1436 |
+
}
|
1437 |
+
|
1438 |
+
/**
|
1439 |
+
* Loads files from a directory and skips . and ..
|
1440 |
+
* By default it retuns files relativ to the theme's folder.
|
1441 |
+
*
|
1442 |
+
* @since 1.1.3 it supports recusiveness
|
1443 |
+
* @param bool $ret_full_paths
|
1444 |
*/
|
1445 |
+
public static function load_files($dir, $ret_full_paths = 0) {
|
1446 |
$files = array();
|
1447 |
+
|
1448 |
+
$dir = rtrim($dir, '/') . '/';
|
1449 |
$all_files = scandir($dir);
|
1450 |
|
1451 |
foreach ($all_files as $file) {
|
1453 |
continue;
|
1454 |
}
|
1455 |
|
1456 |
+
if (is_dir($dir . $file)) {
|
1457 |
+
$dir_in_themes_folder = $file;
|
1458 |
+
$sub_dir_files = self::load_files($dir . $dir_in_themes_folder, $ret_full_paths);
|
1459 |
+
|
1460 |
+
foreach ($sub_dir_files as $sub_dir_file) {
|
1461 |
+
$files[] = $ret_full_paths ? $sub_dir_file : $dir_in_themes_folder . '/' . $sub_dir_file;
|
1462 |
+
}
|
1463 |
+
} else {
|
1464 |
+
$files[] = ($ret_full_paths ? $dir : '') . $file;
|
1465 |
+
}
|
1466 |
}
|
1467 |
|
1468 |
return $files;
|
1594 |
Test themes and plugins before you actually put them on your site">Free Test Site</a> <small>(2 sec setup)</small>
|
1595 |
|
1596 |
| <a href="http://orbisius.com/page/free-quote/?utm_source=child-theme-editor&utm_medium=plugin-links&utm_campaign=plugin-update"
|
1597 |
+
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>
|
1598 |
+
|
1599 |
+
| <a href="http://orbisius.us2.list-manage.com/subscribe?u=005070a78d0e52a7b567e96df&id=1b83cd2093" target="_blank"
|
1600 |
+
title="This opens in a new window/tab">Newsletter</a>
|
1601 |
|
1602 |
| <a href="http://club.orbisius.com/forums/forum/community-support-forum/wordpress-plugins/orbisius-child-theme-creator/?utm_source=orbisius-child-theme-editor&utm_medium=action_screen&utm_campaign=product" target="_blank" title="[new window]">Support Forums</a>
|
1603 |
|
1660 |
</span>
|
1661 |
|
1662 |
<textarea id="theme_1_file_contents" name="theme_1_file_contents" rows="22" class="widefat"></textarea>
|
1663 |
+
|
1664 |
+
<div class="orbisius_ctc_theme_editor_theme_1_primary_buttons primary_buttons">
|
1665 |
+
<button type='submit' class='button button-primary' id="theme_1_submit" name="theme_1_submit">Save Changes</button>
|
1666 |
<span class="status"></span>
|
1667 |
</div>
|
1668 |
+
|
1669 |
+
<hr />
|
1670 |
+
<div class="orbisius_ctc_theme_editor_theme_1_secondary_buttons secondary_buttons">
|
1671 |
+
<button type="button" class='button' id="theme_1_new_file_btn" name="theme_1_new_file_btn">New File</button>
|
1672 |
+
<button type="button" class='button' id="theme_1_syntax_chk_btn" name="theme_1_syntax_chk_btn">PHP Syntax Check</button>
|
1673 |
+
<button type="button" class='button' id="theme_1_send_btn" name="theme_1_send_btn">Send</button>
|
1674 |
+
|
1675 |
+
<!--
|
1676 |
+
<button type="button" class='button' id="theme_1_new_folder_btn" name="theme_1_new_folder_btn">New Folder</button>-->
|
1677 |
+
|
1678 |
+
<a href='javascript:void(0)' class='app-button-right app-button-negative' id="theme_1_delete_file_btn" name="theme_1_delete_file_btn">Delete File</a>
|
1679 |
+
|
1680 |
+
<div id='theme_1_new_file_container' class="theme_1_new_file_container app-hide">
|
1681 |
+
<strong>New File</strong>
|
1682 |
+
<input type="text" id="theme_1_new_file" name="theme_1_new_file" value="" />
|
1683 |
+
<span>e.g. test.js, extra.css etc</span>
|
1684 |
+
<span class="status"></span>
|
1685 |
+
|
1686 |
+
<br/>
|
1687 |
+
<button type='button' class='button button-primary' id="theme_1_new_file_btn_ok" name="theme_1_new_file_btn_ok">Save</button>
|
1688 |
+
<a href='javascript:void(0)' class='app-button-negative00 button delete' id="theme_1_new_file_btn_cancel" name="theme_1_new_file_btn_cancel">Cancel</a>
|
1689 |
+
</div>
|
1690 |
+
|
1691 |
+
<!-- send -->
|
1692 |
+
<div id='theme_1_send_container' class="theme_1_send_container app-hide">
|
1693 |
+
<p>
|
1694 |
+
Email selected theme and parent theme (if any) to yourself or a colleague.
|
1695 |
+
Separate multiple emails with commas.<br/>
|
1696 |
+
<strong>To:</strong>
|
1697 |
+
<input type="text" id="theme_1_send_to" name="email" value="" placeholder="Enter email" />
|
1698 |
+
|
1699 |
+
<button type='button' class='button button-primary' id="theme_1_send_btn_ok" name="theme_1_send_btn_ok">Send</button>
|
1700 |
+
<a href='javascript:void(0)' class='app-button-negative00 button delete'
|
1701 |
+
id="theme_1_send_btn_cancel" name="theme_1_send_btn_cancel">Cancel</a>
|
1702 |
+
</p>
|
1703 |
+
</div>
|
1704 |
+
<!-- /send -->
|
1705 |
+
|
1706 |
+
|
1707 |
+
<!-- new folder -->
|
1708 |
+
<!--
|
1709 |
+
<div id='theme_1_new_folder_container' class="theme_1_new_folder_container app-hide">
|
1710 |
+
<strong>New Folder</strong>
|
1711 |
+
<input type="text" id="theme_1_new_folder" name="theme_1_new_folder" value="" />
|
1712 |
+
<span>e.g. includes, data</span>
|
1713 |
+
<span class="status"></span>
|
1714 |
+
|
1715 |
+
<br/>
|
1716 |
+
<button type='button' class='button button-primary' id="theme_1_new_folder_btn_ok" name="theme_1_new_folder_btn_ok">Save</button>
|
1717 |
+
<a href='javascript:void(0)' class='app-button-negative00 button delete' id="theme_1_new_folder_btn_cancel" name="theme_1_new_folder_btn_cancel">Cancel</a>
|
1718 |
+
</div>-->
|
1719 |
+
<!-- /new folder -->
|
1720 |
+
</div> <!-- /secondary_buttons -->
|
1721 |
</form>
|
1722 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1723 |
</td>
|
1724 |
<td width="50%">
|
1725 |
<form id="orbisius_ctc_theme_editor_theme_2_form" class="orbisius_ctc_theme_editor_theme_2_form">
|
1732 |
</span>
|
1733 |
|
1734 |
<textarea id="theme_2_file_contents" name="theme_2_file_contents" rows="22" class="widefat"></textarea>
|
1735 |
+
<div class="primary_buttons">
|
1736 |
+
<button type='submit' class='button button-primary' id="theme_2_submit" name="theme_2_submit">Save Changes</button>
|
1737 |
<span class="status"></span>
|
1738 |
</div>
|
1739 |
</form>
|
1773 |
|
1774 |
break;
|
1775 |
|
1776 |
+
case 'syntax_check':
|
1777 |
+
$buff = orbisius_ctc_theme_editor_manage_file(4);
|
1778 |
+
|
1779 |
+
break;
|
1780 |
+
|
1781 |
+
case 'send_theme':
|
1782 |
+
$buff = orbisius_ctc_theme_editor_manage_file(5);
|
1783 |
+
|
1784 |
+
break;
|
1785 |
+
|
1786 |
default:
|
1787 |
break;
|
1788 |
}
|
1789 |
|
|
|
1790 |
die($buff);
|
1791 |
}
|
1792 |
|
1793 |
+
/**
|
1794 |
+
*
|
1795 |
+
* @param string $theme_base_dir
|
1796 |
+
*/
|
1797 |
+
function orbisius_ctc_theme_editor_zip_theme($theme_base_dir, $to) {
|
1798 |
+
$status_rec = array(
|
1799 |
+
'status' => 0,
|
1800 |
+
'msg' => '',
|
1801 |
+
);
|
1802 |
+
|
1803 |
+
$status_rec['msg'] = 'Sent.';
|
1804 |
+
|
1805 |
+
$theme_obj = wp_get_theme( $theme_base_dir ); // since 3.4
|
1806 |
+
|
1807 |
+
$all_themes_root = get_theme_root();
|
1808 |
+
$theme_dir = get_theme_root() . "/$theme_base_dir/";
|
1809 |
+
|
1810 |
+
if (empty($theme_base_dir) || empty($theme_obj) || !$theme_obj->exists() || !is_dir($theme_dir)) {
|
1811 |
+
$status_rec['msg'] = 'Selected theme is invalid.';
|
1812 |
+
return $status_rec;
|
1813 |
+
}
|
1814 |
+
|
1815 |
+
$host = empty($_SERVER['HTTP_HOST']) ? '' : $_SERVER['HTTP_HOST'];
|
1816 |
+
$host = preg_replace('#^w+\.#si', '', $host);
|
1817 |
+
$host_suff = empty($host) ? '' : '' . $host . '_';
|
1818 |
+
|
1819 |
+
$parent_theme_base_dir = $theme_obj->get('Template');
|
1820 |
+
|
1821 |
+
$id = !empty($parent_theme_base_dir) ? 'child_theme_' : '';
|
1822 |
+
|
1823 |
+
$theme_name = $theme_obj->get( 'Name' );
|
1824 |
+
$all_files = orbisius_child_theme_creator_util::load_files($theme_dir, 1);
|
1825 |
+
|
1826 |
+
$upload_dir = wp_upload_dir();
|
1827 |
+
$dir = $upload_dir['basedir'] . '/'; // C:\path\to\wordpress\wp-content\uploads
|
1828 |
+
$target_zip_file = $dir . $host_suff . $id . $theme_base_dir . '__' . date('Y-m-d__H_m_s') . '.zip';
|
1829 |
+
|
1830 |
+
$prefix_to_strip = $all_themes_root . '/';
|
1831 |
+
$result = orbisius_child_theme_creator_util::create_zip($all_files, $target_zip_file, true,
|
1832 |
+
$prefix_to_strip, 'Created by Orbisius Child Theme Creator at ' . date('r') . "\nSite: " . site_url() );
|
1833 |
+
|
1834 |
+
$status_rec['status'] = $result;
|
1835 |
+
|
1836 |
+
$site_str = "Site: " . site_url();
|
1837 |
+
|
1838 |
+
if ($result) {
|
1839 |
+
$attachments = array( $target_zip_file );
|
1840 |
+
|
1841 |
+
if (!empty($parent_theme_base_dir)) { // Parent theme Zipping
|
1842 |
+
$id = 'parent_theme_';
|
1843 |
+
$target_parent_zip_file = $dir . $host_suff . $id . $parent_theme_base_dir . '__' . date('Y-m-d__H_m_s') . '.zip';
|
1844 |
+
|
1845 |
+
$theme_dir = get_theme_root() . "/$parent_theme_base_dir/";
|
1846 |
+
$all_files = orbisius_child_theme_creator_util::load_files($theme_dir, 1);
|
1847 |
+
$result = orbisius_child_theme_creator_util::create_zip($all_files, $target_parent_zip_file, true,
|
1848 |
+
$prefix_to_strip, 'Created by Orbisius Child Theme Creator at ' . date('r') . "\n" . $site_str);
|
1849 |
+
|
1850 |
+
if ($result) {
|
1851 |
+
$attachments[] = $target_parent_zip_file;
|
1852 |
+
}
|
1853 |
+
}
|
1854 |
+
|
1855 |
+
$host = empty($_SERVER['HTTP_HOST']) ? '' : str_ireplace('www.', '', $_SERVER['HTTP_HOST']);
|
1856 |
+
$subject = 'Theme (zip): ' . $theme_name;
|
1857 |
+
$headers = array();
|
1858 |
+
$message = "Hi,\n\nPlease find the attached theme file(s).
|
1859 |
+
" . $site_str . "\n\nSent from Orbisius Child Theme Creator.\n";
|
1860 |
+
$headers = "From: $host WordPress <wordpress@$host>" . "\r\n";
|
1861 |
+
wp_mail($to, $subject, $message, $headers, $attachments );
|
1862 |
+
|
1863 |
+
foreach ($attachments as $attachment) {
|
1864 |
+
unlink($attachment);
|
1865 |
+
}
|
1866 |
+
}
|
1867 |
+
|
1868 |
+
return $status_rec;
|
1869 |
+
}
|
1870 |
+
|
1871 |
+
/**
|
1872 |
+
* Receives and argument (string) that will be checked by php for syntax errors.
|
1873 |
+
* A temp file is created and then php binary is called with -l (that's lowercase L).
|
1874 |
+
* With exec() we check the return status but with shell_exec() we parse the output
|
1875 |
+
* (not reliable due to locale).
|
1876 |
+
*
|
1877 |
+
* @requires exec() or shell_exec() functions.
|
1878 |
+
* @param string $theme_file_contents
|
1879 |
+
* @return array
|
1880 |
+
*/
|
1881 |
+
function orbisius_ctc_theme_editor_check_syntax($theme_file_contents) {
|
1882 |
+
$status_rec = array(
|
1883 |
+
'status' => 0,
|
1884 |
+
'msg' => '',
|
1885 |
+
);
|
1886 |
+
|
1887 |
+
$temp = tmpfile();
|
1888 |
+
fwrite($temp, $theme_file_contents);
|
1889 |
+
|
1890 |
+
if (function_exists('shell_exec') || function_exists('exec')) {
|
1891 |
+
$ok = 0;
|
1892 |
+
$meta_data = stream_get_meta_data($temp);
|
1893 |
+
$file = $meta_data['uri'];
|
1894 |
+
$file = escapeshellarg($file);
|
1895 |
+
$cmd = "php -l $file";
|
1896 |
+
|
1897 |
+
// we're relying on exec's return value so we can tell
|
1898 |
+
// if the syntax is OK
|
1899 |
+
if (function_exists('exec')) {
|
1900 |
+
$exit_code = $output = 0;
|
1901 |
+
$last_line = exec($cmd, $output, $exit_code);
|
1902 |
+
$output = join('', $output); // this is an array with multiple lines including new lines
|
1903 |
+
|
1904 |
+
$ok = empty($exit_code); // in linux 0 means success
|
1905 |
+
} else { // this relies on parsing the php output but if a non-english locale is used this will fail.
|
1906 |
+
$output = shell_exec($cmd . " 2>&1");
|
1907 |
+
$ok = stripos($output, 'No syntax errors detected') !== false;
|
1908 |
+
}
|
1909 |
+
|
1910 |
+
$error = $output;
|
1911 |
+
|
1912 |
+
if ($ok) {
|
1913 |
+
$status_rec['status'] = 1;
|
1914 |
+
$status_rec['msg'] = 'Syntax OK.';
|
1915 |
+
} else {
|
1916 |
+
$status_rec['msg'] = 'Syntax check failed. Error: ' . $error;
|
1917 |
+
}
|
1918 |
+
} else {
|
1919 |
+
$status_rec['msg'] = 'Syntax check: n/a. functiona: exec() and shell_exec() are not available.';
|
1920 |
+
}
|
1921 |
+
|
1922 |
+
fclose($temp); // this removes the file
|
1923 |
+
|
1924 |
+
return $status_rec;
|
1925 |
+
}
|
1926 |
+
|
1927 |
/**
|
1928 |
* It seems WP intentionally adds slashes for consistency with php.
|
1929 |
* Please note: WordPress Core and most plugins will still be expecting slashes, and the above code will confuse and break them.
|
1988 |
* @return string
|
1989 |
*/
|
1990 |
function orbisius_ctc_theme_editor_manage_file($cmd_id = 1) {
|
1991 |
+
$buff = $theme_base_dir = $theme_dir = $theme_file = '';
|
1992 |
|
1993 |
$req = orbisius_ctc_theme_editor_get_request();
|
1994 |
|
1995 |
+
$theme_root = trailingslashit( get_theme_root() );
|
1996 |
+
|
1997 |
if (!empty($req['theme_1']) && !empty($req['theme_1_file'])) {
|
1998 |
+
$theme_base_dir = empty($req['theme_1']) ? '______________' : preg_replace('#[^\w-]#si', '', $req['theme_1']);
|
1999 |
+
$theme_dir = $theme_root . "$theme_base_dir/";
|
2000 |
+
$theme_file = empty($req['theme_1_file']) ? $theme_dir . 'style.css' : orbisius_child_theme_creator_util::sanitize_file_name($req['theme_1_file'], $theme_dir);
|
2001 |
$theme_file_contents = empty($req['theme_1_file_contents']) ? '' : $req['theme_1_file_contents'];
|
2002 |
} elseif (!empty($req['theme_2']) && !empty($req['theme_2_file'])) {
|
2003 |
+
$theme_base_dir = empty($req['theme_2']) ? '______________' : preg_replace('#[^\w-]#si', '', $req['theme_2']);
|
2004 |
+
$theme_dir = $theme_root . "$theme_base_dir/";
|
2005 |
+
$theme_file = empty($req['theme_2_file']) ? $theme_dir . 'style.css' : orbisius_child_theme_creator_util::sanitize_file_name($req['theme_2_file'], $theme_dir);
|
2006 |
$theme_file_contents = empty($req['theme_2_file_contents']) ? '' : $req['theme_2_file_contents'];
|
2007 |
} else {
|
2008 |
return 'Missing data!';
|
2009 |
}
|
2010 |
+
|
2011 |
+
//$theme_dir = $theme_root . "$theme_base_dir/";
|
|
|
2012 |
if (empty($theme_base_dir) || !is_dir($theme_dir)) {
|
2013 |
return 'Selected theme is invalid.';
|
2014 |
+
} elseif (!file_exists($theme_file) && $cmd_id == 1) {
|
2015 |
+
//} elseif (!file_exists($theme_dir . $theme_file) && $cmd_id == 1) {
|
2016 |
return 'Selected file is invalid.';
|
2017 |
}
|
2018 |
|
2019 |
+
//$theme_file = $theme_dir . $theme_file; //
|
2020 |
|
2021 |
if ($cmd_id == 1) {
|
2022 |
$buff = file_get_contents($theme_file);
|
2025 |
$buff = !empty($status) ? $theme_file_contents : '';
|
2026 |
} elseif ($cmd_id == 3 && (!empty($req['theme_1_file']) || !empty($req['theme_2_file']))) {
|
2027 |
$status = unlink($theme_file);
|
2028 |
+
}
|
2029 |
+
|
2030 |
+
elseif ($cmd_id == 4) { // syntax check. create a tmp file and ask php to check it.
|
2031 |
+
$status_rec = orbisius_ctc_theme_editor_check_syntax($theme_file_contents);
|
2032 |
+
|
2033 |
+
if (function_exists('wp_send_json')) { // since WP 3.5
|
2034 |
+
wp_send_json($status_rec);
|
2035 |
+
} else {
|
2036 |
+
@header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
|
2037 |
+
$buff = json_encode($status_rec);
|
2038 |
+
}
|
2039 |
+
}
|
2040 |
+
|
2041 |
+
elseif ($cmd_id == 5) { // zip
|
2042 |
+
$to = empty($req['email']) ? '' : preg_replace('#[^\w-\.@,\'"]#si', '', $req['email']);
|
2043 |
+
$status_rec = orbisius_ctc_theme_editor_zip_theme($theme_base_dir, $to);
|
2044 |
+
|
2045 |
+
if (function_exists('wp_send_json')) { // since WP 3.5
|
2046 |
+
wp_send_json($status_rec);
|
2047 |
+
} else {
|
2048 |
+
@header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
|
2049 |
+
$buff = json_encode($status_rec);
|
2050 |
+
}
|
2051 |
+
}
|
2052 |
+
|
2053 |
+
else {
|
2054 |
|
2055 |
}
|
2056 |
|
readme.txt
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
Contributors: lordspace,orbisius
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=7APYDVPBCSY9A
|
4 |
Tags: child theme, childtheme,childthemes,child themes,CSS, styling,resposive design,design,custom themeing, shared hosting, theme,themes,wp,wordpress,orbisius,theme creator
|
5 |
-
Requires at least: 3.
|
6 |
Tested up to: 3.8
|
7 |
-
Stable tag: 1.1.
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
This plugin allows you to quickly create child themes from any theme that you have currently installed on your site/blog.
|
@@ -39,9 +39,12 @@ It features two editors and you can pick snippets from one theme and paste into
|
|
39 |
* Ajax -> No page refresh
|
40 |
* Easy to use interface
|
41 |
* Supports WordPress Multisite
|
42 |
-
* Create a
|
43 |
* Delete file
|
44 |
* Respects the DISALLOW_FILE_EDIT constant, which if set to true will disable the Theme editor
|
|
|
|
|
|
|
45 |
|
46 |
= Usage : To create a child theme go to =
|
47 |
Go to Admin > Appearance > Orbisius Child Theme Creator then click on the theme you like and the child theme will be created for you.
|
@@ -112,8 +115,25 @@ If your site becomes broken due to a child theme (mis)configuration. Please chec
|
|
112 |
= What to do next? =
|
113 |
Go to http://club.orbisius.com and post suggestions in our forum for new features that you'd like to see in this plugin or its extensions.
|
114 |
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
== Changelog ==
|
116 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
= 1.1.2 =
|
118 |
* Reduced the height of the editors (to 22 rows) so the save/delete buttons are visible
|
119 |
* Restricted the width of the dropdowns in the theme editor so they don't push the editor and the buttons down.
|
2 |
Contributors: lordspace,orbisius
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=7APYDVPBCSY9A
|
4 |
Tags: child theme, childtheme,childthemes,child themes,CSS, styling,resposive design,design,custom themeing, shared hosting, theme,themes,wp,wordpress,orbisius,theme creator
|
5 |
+
Requires at least: 3.4
|
6 |
Tested up to: 3.8
|
7 |
+
Stable tag: 1.1.3
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
This plugin allows you to quickly create child themes from any theme that you have currently installed on your site/blog.
|
39 |
* Ajax -> No page refresh
|
40 |
* Easy to use interface
|
41 |
* Supports WordPress Multisite
|
42 |
+
* Create a New File (+ checks if the file exists)
|
43 |
* Delete file
|
44 |
* Respects the DISALLOW_FILE_EDIT constant, which if set to true will disable the Theme editor
|
45 |
+
* Since (v1.1.3) PHP syntax check
|
46 |
+
* Since (v1.1.3) Send selected theme and parent theme (if any) to yourself or a colleague.
|
47 |
+
* Since (v1.1.3) Implemented theme files to be listed recursively (i.e. all files from the selected theme)
|
48 |
|
49 |
= Usage : To create a child theme go to =
|
50 |
Go to Admin > Appearance > Orbisius Child Theme Creator then click on the theme you like and the child theme will be created for you.
|
115 |
= What to do next? =
|
116 |
Go to http://club.orbisius.com and post suggestions in our forum for new features that you'd like to see in this plugin or its extensions.
|
117 |
|
118 |
+
= Need a custom plugin? =
|
119 |
+
Let's talk.
|
120 |
+
<a href="http://orbisius.com/page/free-quote/?utm_source=orbisius-child-theme-creator&utm_medium=plugin-readme-faq&utm_campaign=product"
|
121 |
+
title="If you want a custom web/mobile app/plugin developed contact us. This opens in a new window/tab"
|
122 |
+
class="button-primary" target="_blank">Get a Free Quote</a>
|
123 |
+
|
124 |
== Changelog ==
|
125 |
|
126 |
+
= 1.1.3 =
|
127 |
+
* Updated CSS to add some top-margin above the update/save changed buttons
|
128 |
+
* Added php syntax check
|
129 |
+
* Added Send button so you can email the selected theme and parent theme (if any) to yourself or a colleague.
|
130 |
+
* Implemented theme files to be listed recursively (i.e. all files from the selected theme)
|
131 |
+
* Fixed JS error on Settings page.
|
132 |
+
* Added uninstall.php file to clean after itself
|
133 |
+
* Added a check and the notice that shows up on the plugins page won't show up after 24h
|
134 |
+
* Added Edit Themes link to the Plugin's -> Action links
|
135 |
+
* Improved and better organized the plugin's settings page
|
136 |
+
|
137 |
= 1.1.2 =
|
138 |
* Reduced the height of the editors (to 22 rows) so the save/delete buttons are visible
|
139 |
* Restricted the width of the dropdowns in the theme editor so they don't push the editor and the buttons down.
|
uninstall.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Removes the settings created by the plugin for single and multi site.
|
5 |
+
*/
|
6 |
+
if ( !defined('ABSPATH') || !defined('WP_UNINSTALL_PLUGIN') ) {
|
7 |
+
exit();
|
8 |
+
}
|
9 |
+
|
10 |
+
// if you change the key update the plugin too
|
11 |
+
$option_name = 'orbisius_child_theme_creator_options';
|
12 |
+
|
13 |
+
if ( is_multisite() ) {
|
14 |
+
global $wpdb;
|
15 |
+
|
16 |
+
$blog_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
|
17 |
+
$original_blog_id = get_current_blog_id();
|
18 |
+
|
19 |
+
foreach ($blog_ids as $blog_id) {
|
20 |
+
switch_to_blog($blog_id);
|
21 |
+
delete_site_option($option_name);
|
22 |
+
}
|
23 |
+
|
24 |
+
switch_to_blog($original_blog_id);
|
25 |
+
} else { // For Single site
|
26 |
+
delete_option($option_name);
|
27 |
+
}
|