Version Description
- Added: Theme Editor
- - New File, checks for existing file are made on typing.
- - Delete File
Download this release
Release Info
Developer | lordspace |
Plugin | Child Theme Creator by Orbisius |
Version | 1.0.7 |
Comparing to | |
See all releases |
Code changes from version 1.0.6 to 1.0.7
- assets/main.js +143 -1
- assets/main.min.js +1 -1
- orbisius-child-theme-creator.php +45 -13
- readme.txt +25 -7
assets/main.js
CHANGED
@@ -1,4 +1,50 @@
|
|
1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
jQuery(document).ready(function($) {
|
3 |
orbisius_ctc_theme_editor_setup();
|
4 |
});
|
@@ -19,6 +65,102 @@ function orbisius_ctc_theme_editor_setup() {
|
|
19 |
app_load('#orbisius_ctc_theme_editor_theme_1_form', 'generate_dropdown', '#theme_1_file', app_handle_theme_change);
|
20 |
}
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
// Change theme selection
|
23 |
$('#theme_1').on("change", function () {
|
24 |
app_load('#orbisius_ctc_theme_editor_theme_1_form', 'generate_dropdown', '#theme_1_file', app_handle_theme_change);
|
1 |
+
var orbisius_child_theme_creator = {
|
2 |
+
/**
|
3 |
+
* This is a file name that the user enters. It will be cleaned of spaces and repeating chars.
|
4 |
+
* @param str val
|
5 |
+
* @returns str
|
6 |
+
*/
|
7 |
+
sanitize_file_name : function (val) {
|
8 |
+
val = val.replace(/[^\w-.\s]/ig, '');
|
9 |
+
val = val.replace(/\s+/ig, '-');
|
10 |
+
val = val.replace(/\.+/ig, '.');
|
11 |
+
val = val.replace(/-+/ig, '-');
|
12 |
+
val = val.replace(/_+/ig, '_');
|
13 |
+
|
14 |
+
// rm leading/trailing chars
|
15 |
+
val = val.replace(/^[._-]+/ig, '');
|
16 |
+
val = val.replace(/[._-]+$/ig, '');
|
17 |
+
|
18 |
+
val = jQuery.trim(val);
|
19 |
+
|
20 |
+
return val;
|
21 |
+
},
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Deletes a file by sending an ajax request.
|
25 |
+
* The file should be the currently selected one from the dropdown menu.
|
26 |
+
* After the ajax call finishes the selected element is removed from the
|
27 |
+
* dropdown and a trigger event is triggered so the content box gets
|
28 |
+
* reloaded/refilled with new content.
|
29 |
+
*
|
30 |
+
* @param str file_name
|
31 |
+
* @param str form_id
|
32 |
+
* @returns void
|
33 |
+
*/
|
34 |
+
delete_file : function(file_name, form_id) {
|
35 |
+
jQuery.ajax({
|
36 |
+
type : "post",
|
37 |
+
url : ajaxurl, // WP defines it and it contains all the necessary params
|
38 |
+
data : jQuery(form_id).serialize() + '&action=orbisius_ctc_theme_editor_ajax&sub_cmd=' + escape('delete_file'),
|
39 |
+
|
40 |
+
success : function (result) {
|
41 |
+
jQuery("#theme_1_file option:selected").remove();
|
42 |
+
jQuery("#theme_1_file").trigger('change');
|
43 |
+
}
|
44 |
+
});
|
45 |
+
}
|
46 |
+
};
|
47 |
+
|
48 |
jQuery(document).ready(function($) {
|
49 |
orbisius_ctc_theme_editor_setup();
|
50 |
});
|
65 |
app_load('#orbisius_ctc_theme_editor_theme_1_form', 'generate_dropdown', '#theme_1_file', app_handle_theme_change);
|
66 |
}
|
67 |
|
68 |
+
///////////////////////////////////////////////////////////////////////////////////////////////////
|
69 |
+
// Delete File
|
70 |
+
///////////////////////////////////////////////////////////////////////////////////////////////////
|
71 |
+
$('#theme_1_delete_file_btn').on("click", function () {
|
72 |
+
var selected_file = $('#theme_1_file').val();
|
73 |
+
|
74 |
+
if (confirm('Delete: [' + selected_file + '] ? Are you sure?', '')) {
|
75 |
+
orbisius_child_theme_creator.delete_file(selected_file, '#orbisius_ctc_theme_editor_theme_1_form');
|
76 |
+
}
|
77 |
+
});
|
78 |
+
///////////////////////////////////////////////////////////////////////////////////////////////////
|
79 |
+
|
80 |
+
///////////////////////////////////////////////////////////////////////////////////////////////////
|
81 |
+
// New File
|
82 |
+
///////////////////////////////////////////////////////////////////////////////////////////////////
|
83 |
+
$('#theme_1_new_file_btn').on("click", function () {
|
84 |
+
$('#theme_1_new_file_container').toggle('slow');
|
85 |
+
$('#theme_1_new_file').focus();
|
86 |
+
});
|
87 |
+
|
88 |
+
// The user enters a file name. Let's check if it exists.
|
89 |
+
$('#theme_1_new_file').on("input", function (event) {
|
90 |
+
var new_file = $('#theme_1_new_file').val();
|
91 |
+
new_file = orbisius_child_theme_creator.sanitize_file_name(new_file);
|
92 |
+
|
93 |
+
var ok = 1; // let's by positive by default
|
94 |
+
|
95 |
+
// Let's check if that file exists by checking if there is an entry in the options
|
96 |
+
$("#theme_1_file option").each(function() { // idx, val
|
97 |
+
var cur_val = $(this).val();
|
98 |
+
|
99 |
+
if (cur_val == new_file) {
|
100 |
+
ok = 0;
|
101 |
+
return ;
|
102 |
+
}
|
103 |
+
});
|
104 |
+
|
105 |
+
if (ok) {
|
106 |
+
$('.status', $('#theme_1_new_file_container')).text('').removeClass('app-alert-error');
|
107 |
+
} else {
|
108 |
+
var err = 'File with that name already exists.';
|
109 |
+
$('.status', $('#theme_1_new_file_container')).text(err).addClass('app-alert-error');
|
110 |
+
}
|
111 |
+
});
|
112 |
+
|
113 |
+
/**
|
114 |
+
* New File: On OK this will hide the form but will add a new element
|
115 |
+
* to the theme files dropdown.
|
116 |
+
*/
|
117 |
+
$('#theme_1_new_file_btn_ok').on("click", function () {
|
118 |
+
var val = $('#theme_1_new_file').val();
|
119 |
+
val = orbisius_child_theme_creator.sanitize_file_name(val);
|
120 |
+
var text = val;
|
121 |
+
|
122 |
+
if (val == '') {
|
123 |
+
alert('Invalid or empty value for filename.');
|
124 |
+
$('#theme_1_new_file').focus();
|
125 |
+
return ;
|
126 |
+
}
|
127 |
+
|
128 |
+
var ok = 1; // let's by positive by default
|
129 |
+
|
130 |
+
// Let's check if that file exists by checking if there is an entry in the options
|
131 |
+
$("#theme_1_file option").each(function() { // idx, val
|
132 |
+
var cur_val = $(this).val();
|
133 |
+
|
134 |
+
if (cur_val == val) {
|
135 |
+
ok = 0;
|
136 |
+
return ;
|
137 |
+
}
|
138 |
+
});
|
139 |
+
|
140 |
+
if (!ok) {
|
141 |
+
alert('File with that name already exists.');
|
142 |
+
$('#theme_1_new_file').focus();
|
143 |
+
return ;
|
144 |
+
}
|
145 |
+
|
146 |
+
// unselects current element from the dropdown.
|
147 |
+
$("select theme_1_file").prop("selected", false);
|
148 |
+
var new_option = $('<option></option>').val(val).html(text).prop("selected", true);
|
149 |
+
|
150 |
+
$('#theme_1_file').append( new_option ); // select
|
151 |
+
$('#theme_1_new_file_container').hide('slow');
|
152 |
+
$('#theme_1_new_file').val(''); // text box for new file
|
153 |
+
$('#theme_1_file_contents').val('').focus(); // textarea
|
154 |
+
});
|
155 |
+
|
156 |
+
// This is when the cancel button is clicked so the user doesn't want a new file.
|
157 |
+
$('#theme_1_new_file_btn_cancel').on("click", function () {
|
158 |
+
$('#theme_1_new_file').val('');
|
159 |
+
$('#theme_1_new_file_container').hide('slow');
|
160 |
+
$('.status', $('#theme_1_new_file_container')).text('').removeClass('app-alert-error');
|
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);
|
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").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")}}}})}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").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()})
|
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.0.
|
7 |
Author: Svetoslav Marinov (Slavi)
|
8 |
Author URI: http://orbisius.com
|
9 |
*/
|
@@ -508,7 +508,8 @@ function orbisius_child_theme_creator_tools_action() {
|
|
508 |
}
|
509 |
|
510 |
$buff .= "<br class='clear' /><h2>Child Themes</h2>\n";
|
511 |
-
|
|
|
512 |
// list child themes
|
513 |
// we use the same CSS as in WP's appearances but put only the buttons we want.
|
514 |
foreach ($themes as $theme_basedir_name => $theme_obj) {
|
@@ -517,6 +518,8 @@ function orbisius_child_theme_creator_tools_action() {
|
|
517 |
if (empty($parent_theme)) {
|
518 |
continue; // no parents allowed here.
|
519 |
}
|
|
|
|
|
520 |
|
521 |
// get the web uri for the current theme and go 1 level up
|
522 |
$src = dirname(get_template_directory_uri()) . "/$theme_basedir_name/screenshot.png";
|
@@ -542,6 +545,10 @@ function orbisius_child_theme_creator_tools_action() {
|
|
542 |
$buff .= "</div> <!-- /available-theme -->\n";
|
543 |
}
|
544 |
|
|
|
|
|
|
|
|
|
545 |
$buff .= "</div> <!-- /availablethemes -->\n <br class='clear' />";
|
546 |
|
547 |
//var_dump($themes);
|
@@ -1049,6 +1056,10 @@ function orbisius_ctc_theme_editor() {
|
|
1049 |
exit();
|
1050 |
}
|
1051 |
|
|
|
|
|
|
|
|
|
1052 |
$msg = 'Pick any two themes and copy snippets from one to the other.';
|
1053 |
|
1054 |
$plugin_data = orbisius_child_theme_creator_get_plugin_data();
|
@@ -1128,14 +1139,26 @@ function orbisius_ctc_theme_editor() {
|
|
1128 |
<div>
|
1129 |
<button type='submit' class='button button-primary' id="theme_1_submit" name="theme_1_submit">Update</button>
|
1130 |
<span class="status"></span>
|
1131 |
-
|
1132 |
-
<!--<button class='button' id="theme_1_new_file" name="theme_1_new_file_btn">New File</button>
|
1133 |
-
<div class="theme_1_new_file_container app-hide">
|
1134 |
-
<input type="text" id="theme_1_new_file" name="theme_1_new_file" value="" />
|
1135 |
-
<div>e.g. test.js, extra.css etc</div>
|
1136 |
-
</div>-->
|
1137 |
</div>
|
1138 |
</form>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1139 |
</td>
|
1140 |
<td width="50%">
|
1141 |
<form id="orbisius_ctc_theme_editor_theme_2_form" class="orbisius_ctc_theme_editor_theme_2_form">
|
@@ -1184,6 +1207,11 @@ function orbisius_ctc_theme_editor_ajax() {
|
|
1184 |
|
1185 |
break;
|
1186 |
|
|
|
|
|
|
|
|
|
|
|
1187 |
default:
|
1188 |
break;
|
1189 |
}
|
@@ -1252,10 +1280,10 @@ function orbisius_ctc_theme_editor_generate_dropdown() {
|
|
1252 |
/**
|
1253 |
* Reads or writes contents to a file.
|
1254 |
* If the saving is not successfull it will return an empty buffer.
|
1255 |
-
* @param int $read - 1, write 2
|
1256 |
* @return string
|
1257 |
*/
|
1258 |
-
function orbisius_ctc_theme_editor_manage_file($
|
1259 |
$buff = $theme_base_dir = $theme_file = '';
|
1260 |
|
1261 |
$req = orbisius_ctc_theme_editor_get_request();
|
@@ -1276,17 +1304,21 @@ function orbisius_ctc_theme_editor_manage_file($read = 1) {
|
|
1276 |
|
1277 |
if (empty($theme_base_dir) || !is_dir($theme_dir)) {
|
1278 |
return 'Selected theme is invalid.';
|
1279 |
-
} elseif (!file_exists($theme_dir . $theme_file)) {
|
1280 |
return 'Selected file is invalid.';
|
1281 |
}
|
1282 |
|
1283 |
$theme_file = $theme_dir . $theme_file;
|
1284 |
|
1285 |
-
if ($
|
1286 |
$buff = file_get_contents($theme_file);
|
1287 |
-
} elseif ($
|
1288 |
$status = file_put_contents($theme_file, $theme_file_contents);
|
1289 |
$buff = !empty($status) ? $theme_file_contents : '';
|
|
|
|
|
|
|
|
|
1290 |
}
|
1291 |
|
1292 |
return $buff;
|
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.0.7
|
7 |
Author: Svetoslav Marinov (Slavi)
|
8 |
Author URI: http://orbisius.com
|
9 |
*/
|
508 |
}
|
509 |
|
510 |
$buff .= "<br class='clear' /><h2>Child Themes</h2>\n";
|
511 |
+
$child_themes_cnt = 0;
|
512 |
+
|
513 |
// list child themes
|
514 |
// we use the same CSS as in WP's appearances but put only the buttons we want.
|
515 |
foreach ($themes as $theme_basedir_name => $theme_obj) {
|
518 |
if (empty($parent_theme)) {
|
519 |
continue; // no parents allowed here.
|
520 |
}
|
521 |
+
|
522 |
+
$child_themes_cnt++;
|
523 |
|
524 |
// get the web uri for the current theme and go 1 level up
|
525 |
$src = dirname(get_template_directory_uri()) . "/$theme_basedir_name/screenshot.png";
|
545 |
$buff .= "</div> <!-- /available-theme -->\n";
|
546 |
}
|
547 |
|
548 |
+
if ( $child_themes_cnt == 0 ) {
|
549 |
+
$buff .= "<div>No child themes found.</div>\n";
|
550 |
+
}
|
551 |
+
|
552 |
$buff .= "</div> <!-- /availablethemes -->\n <br class='clear' />";
|
553 |
|
554 |
//var_dump($themes);
|
1056 |
exit();
|
1057 |
}
|
1058 |
|
1059 |
+
if (defined('DISALLOW_FILE_EDIT') && DISALLOW_FILE_EDIT) {
|
1060 |
+
wp_die('Theme editor is disabled due to DISALLOW_FILE_EDIT constant is set to true in wp-config.php', 'Orbisius Theme Editor disabled by config');
|
1061 |
+
}
|
1062 |
+
|
1063 |
$msg = 'Pick any two themes and copy snippets from one to the other.';
|
1064 |
|
1065 |
$plugin_data = orbisius_child_theme_creator_get_plugin_data();
|
1139 |
<div>
|
1140 |
<button type='submit' class='button button-primary' id="theme_1_submit" name="theme_1_submit">Update</button>
|
1141 |
<span class="status"></span>
|
|
|
|
|
|
|
|
|
|
|
|
|
1142 |
</div>
|
1143 |
</form>
|
1144 |
+
|
1145 |
+
<br/>
|
1146 |
+
<hr />
|
1147 |
+
<div>
|
1148 |
+
<button type="button" class='button' id="theme_1_new_file_btn" name="theme_1_new_file_btn">New File</button>
|
1149 |
+
|
1150 |
+
<div id='theme_1_new_file_container' class="theme_1_new_file_container app-hide">
|
1151 |
+
<h3>New File</h3>
|
1152 |
+
<input type="text" id="theme_1_new_file" name="theme_1_new_file" value="" />
|
1153 |
+
<span class="status"></span>
|
1154 |
+
<div>e.g. test.js, extra.css etc</div>
|
1155 |
+
|
1156 |
+
<button type='button' class='button button-primary' id="theme_1_new_file_btn_ok" name="theme_1_submit">OK</button>
|
1157 |
+
or <a href='javascript:void(0)' class='app-button-negative' id="theme_1_new_file_btn_cancel" name="theme_1_submit">Cancel</a>
|
1158 |
+
</div>
|
1159 |
+
|
1160 |
+
<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>
|
1161 |
+
</div>
|
1162 |
</td>
|
1163 |
<td width="50%">
|
1164 |
<form id="orbisius_ctc_theme_editor_theme_2_form" class="orbisius_ctc_theme_editor_theme_2_form">
|
1207 |
|
1208 |
break;
|
1209 |
|
1210 |
+
case 'delete_file':
|
1211 |
+
$buff = orbisius_ctc_theme_editor_manage_file(3);
|
1212 |
+
|
1213 |
+
break;
|
1214 |
+
|
1215 |
default:
|
1216 |
break;
|
1217 |
}
|
1280 |
/**
|
1281 |
* Reads or writes contents to a file.
|
1282 |
* If the saving is not successfull it will return an empty buffer.
|
1283 |
+
* @param int $cmd_id : read - 1, write - 2, delete - 3
|
1284 |
* @return string
|
1285 |
*/
|
1286 |
+
function orbisius_ctc_theme_editor_manage_file($cmd_id = 1) {
|
1287 |
$buff = $theme_base_dir = $theme_file = '';
|
1288 |
|
1289 |
$req = orbisius_ctc_theme_editor_get_request();
|
1304 |
|
1305 |
if (empty($theme_base_dir) || !is_dir($theme_dir)) {
|
1306 |
return 'Selected theme is invalid.';
|
1307 |
+
} elseif (!file_exists($theme_dir . $theme_file) && $cmd_id == 1) {
|
1308 |
return 'Selected file is invalid.';
|
1309 |
}
|
1310 |
|
1311 |
$theme_file = $theme_dir . $theme_file;
|
1312 |
|
1313 |
+
if ($cmd_id == 1) {
|
1314 |
$buff = file_get_contents($theme_file);
|
1315 |
+
} elseif ($cmd_id == 2) {
|
1316 |
$status = file_put_contents($theme_file, $theme_file_contents);
|
1317 |
$buff = !empty($status) ? $theme_file_contents : '';
|
1318 |
+
} elseif ($cmd_id == 3 && (!empty($req['theme_1_file']) || !empty($req['theme_2_file']))) {
|
1319 |
+
$status = unlink($theme_file);
|
1320 |
+
} else {
|
1321 |
+
|
1322 |
}
|
1323 |
|
1324 |
return $buff;
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: lordspace,orbisius
|
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=7APYDVPBCSY9A
|
4 |
Tags: 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.0
|
6 |
-
Tested up to: 3.7
|
7 |
-
Stable tag: 1.0.
|
8 |
License: GPLv2 or later
|
9 |
Network:true
|
10 |
|
@@ -28,7 +28,7 @@ We have launched a **FREE** service that allows you to setup a test/sandbox Word
|
|
28 |
Join today and test themes and plugins before you actually put them on your live site. For more info go to:
|
29 |
<a href="http://qsandbox.com/?utm_source=orbisius-child-theme-creator&utm_medium=readme&utm_campaign=product" target="_blank" title="Free Test/Sandbox WordPress Site">http://qsandbox.com</a>
|
30 |
|
31 |
-
= Features =
|
32 |
* Create a theme with one click of a button
|
33 |
* Never forget what files to copy and what to skip when creating child themes.
|
34 |
* Easy to use interface
|
@@ -39,11 +39,14 @@ Join today and test themes and plugins before you actually put them on your live
|
|
39 |
This plugin allows you to quickly edit theme files from Appearance > Orbisius Theme Editor (entry added by the same plugin)
|
40 |
It features two editors and you can pick snippets from one theme and paste into another.
|
41 |
|
42 |
-
= Features =
|
43 |
* Edit two theme files at the same time
|
44 |
* Ajax -> No page refresh
|
45 |
* Easy to use interface
|
46 |
* Supports WordPress Multisite
|
|
|
|
|
|
|
47 |
|
48 |
= Usage : To create a child theme go to =
|
49 |
Go to Admin > Appearance > Orbisius Child Theme Creator then click on the theme you like and the child theme will be created for you.
|
@@ -90,9 +93,10 @@ n/a
|
|
90 |
Just install the plugin and activate it. Then go to Admin > Appearance > Orbisius Child Theme Creator.
|
91 |
Then click on a theme and the plugin will create a child theme for you.
|
92 |
|
93 |
-
=
|
94 |
-
|
95 |
-
|
|
|
96 |
|
97 |
= The child theme is created but doesn't have some styles or doesn't show the admin panel of the parent theme =
|
98 |
OK. Please contact the theme author if his/her theme is child theme friendly.
|
@@ -106,11 +110,25 @@ AAAAA is of course the directory of your parent theme.
|
|
106 |
= I want to be able to copy functions.php =
|
107 |
Please use Orbisius Theme Editor (part of this plugin)
|
108 |
|
|
|
|
|
|
|
|
|
109 |
= What to do next? =
|
110 |
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.
|
111 |
|
112 |
== Changelog ==
|
113 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
= 1.0.6 =
|
115 |
* Tested with WP 3.7
|
116 |
* Loading current theme in the left editor if there is no theme selected yet.
|
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.0
|
6 |
+
Tested up to: 3.7.1
|
7 |
+
Stable tag: 1.0.7
|
8 |
License: GPLv2 or later
|
9 |
Network:true
|
10 |
|
28 |
Join today and test themes and plugins before you actually put them on your live site. For more info go to:
|
29 |
<a href="http://qsandbox.com/?utm_source=orbisius-child-theme-creator&utm_medium=readme&utm_campaign=product" target="_blank" title="Free Test/Sandbox WordPress Site">http://qsandbox.com</a>
|
30 |
|
31 |
+
= Child Theme Creator Features =
|
32 |
* Create a theme with one click of a button
|
33 |
* Never forget what files to copy and what to skip when creating child themes.
|
34 |
* Easy to use interface
|
39 |
This plugin allows you to quickly edit theme files from Appearance > Orbisius Theme Editor (entry added by the same plugin)
|
40 |
It features two editors and you can pick snippets from one theme and paste into another.
|
41 |
|
42 |
+
= Theme Editor Features =
|
43 |
* Edit two theme files at the same time
|
44 |
* Ajax -> No page refresh
|
45 |
* Easy to use interface
|
46 |
* Supports WordPress Multisite
|
47 |
+
* Create a new file (+ checks if the file exists)
|
48 |
+
* Delete file
|
49 |
+
* Respects the DISALLOW_FILE_EDIT constant, which if set to true will disable the Theme editor
|
50 |
|
51 |
= Usage : To create a child theme go to =
|
52 |
Go to Admin > Appearance > Orbisius Child Theme Creator then click on the theme you like and the child theme will be created for you.
|
93 |
Just install the plugin and activate it. Then go to Admin > Appearance > Orbisius Child Theme Creator.
|
94 |
Then click on a theme and the plugin will create a child theme for you.
|
95 |
|
96 |
+
= How to disable Orbisius Theme Editor Plugin? =
|
97 |
+
Just put this line right after the first <?php tag in the wp-config.php. This will also remove the WordPress' Theme/Plugin editors as well.
|
98 |
+
|
99 |
+
define('DISALLOW_FILE_EDIT', true);
|
100 |
|
101 |
= The child theme is created but doesn't have some styles or doesn't show the admin panel of the parent theme =
|
102 |
OK. Please contact the theme author if his/her theme is child theme friendly.
|
110 |
= I want to be able to copy functions.php =
|
111 |
Please use Orbisius Theme Editor (part of this plugin)
|
112 |
|
113 |
+
= Troubleshooting =
|
114 |
+
If your site becomes broken due to a child theme (mis)configuration. Please check another plugin of ours:
|
115 |
+
<a href="http://club.orbisius.com/products/wordpress-plugins/orbisius-theme-fixer/?utm_source=orbisius-child-theme-creator&utm_medium=readme_troubleshooting&utm_campaign=product" target="_blank" title="[new window]">Orbisius Theme Fixer</a>
|
116 |
+
|
117 |
= What to do next? =
|
118 |
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.
|
119 |
|
120 |
== Changelog ==
|
121 |
|
122 |
+
= 1.0.8 =
|
123 |
+
* Tested with WP 3.7.1
|
124 |
+
* Added New File and Delete operations for Theme Editor #1 (left)
|
125 |
+
* Respects the DISALLOW_FILE_EDIT constant, which if set to true will disable the Theme editor
|
126 |
+
|
127 |
+
= 1.0.7 =
|
128 |
+
* Added: Theme Editor
|
129 |
+
* - New File, checks for existing file are made on typing.
|
130 |
+
* - Delete File
|
131 |
+
|
132 |
= 1.0.6 =
|
133 |
* Tested with WP 3.7
|
134 |
* Loading current theme in the left editor if there is no theme selected yet.
|