Child Theme Creator by Orbisius - Version 1.0.6

Version Description

  • Tested with WP 3.7
  • Loading current theme in the left editor if there is no theme selected yet.
  • Reduced the font size of the links in the top right corner of Child Theme Creator and Theme Editor
  • Separated Parent themes from Child ones
  • Hid the advanced section. Was confusing and scaring people. If you really want to copy functions pass &orb_show_copy_functions parameter to the Child Plugin page.
Download this release

Release Info

Developer lordspace
Plugin Icon wp plugin Child Theme Creator by Orbisius
Version 1.0.6
Comparing to
See all releases

Code changes from version 1.0.5 to 1.0.6

assets/main.js CHANGED
@@ -71,7 +71,7 @@ function app_handle_theme_change(form_id, action, target_container, result) {
71
  }
72
 
73
  /**
74
- * Sends ajax call to WP. Different requests append sub_cmd because WP is used key: 'action'.
75
  * Depending on the target element a different method for setting the value is used.
76
  *
77
  * @param {type} form_id
@@ -81,38 +81,53 @@ function app_handle_theme_change(form_id, action, target_container, result) {
81
  * @returns {undefined}
82
  */
83
  function app_load(form_id, action, target_container, callback) {
84
- var result = 'Loading...';
 
85
  var undo_readonly = 0;
 
86
 
87
- if (action.indexOf('save') >= 0) { // save action
88
  if (jQuery(target_container).is("input,textarea")) {
89
  jQuery(target_container).attr('readonly', 'readonly');
90
  jQuery(target_container).addClass('saving_action');
91
  }
92
 
93
- jQuery('.status', jQuery(target_container).parent()).html(result);
94
  } else {
95
  if (jQuery(target_container).is("input,textarea")) {
96
- jQuery(target_container).val(result);
97
  jQuery(target_container).addClass('saving_action');
98
  } else if (jQuery(target_container).is("select")) { // for loading. we want to override options of the select
99
- jQuery(target_container + ' option').text(result);
100
  } else {
101
- jQuery(target_container).html(result);
102
  }
103
  }
104
 
105
  jQuery.ajax({
106
  type : "post",
107
  //dataType : "json",
108
- url : ajaxurl, // contains all the necessary params
109
  data : jQuery(form_id).serialize() + '&action=orbisius_ctc_theme_editor_ajax&sub_cmd=' + escape(action),
110
 
111
  success : function (result) {
112
- if (jQuery(target_container).is("input,textarea")) {
113
- jQuery(target_container).val(result);
114
- } else {
115
- jQuery(target_container).html(result);
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  }
117
 
118
  if (typeof callback != 'undefined') {
@@ -123,16 +138,9 @@ function app_load(form_id, action, target_container, callback) {
123
  complete : function (result) { // this is always called
124
  jQuery(target_container).removeClass('saving_action');
125
 
126
- if (action.indexOf('save') >= 0) { // save action
127
  if (jQuery(target_container).is("input,textarea")) {
128
  jQuery(target_container).removeAttr('readonly');
129
-
130
- // http://stackoverflow.com/questions/2432749/jquery-delay-not-delaying
131
- jQuery('.status', jQuery(target_container).parent()).html('Saved.');
132
-
133
- setTimeout(function () {
134
- jQuery('.status', jQuery(target_container).parent()).empty();
135
- }, 2000);
136
  }
137
  }
138
  }
71
  }
72
 
73
  /**
74
+ * Sends ajax call to WP. Different requests append sub_cmd because WP is using key: 'action'.
75
  * Depending on the target element a different method for setting the value is used.
76
  *
77
  * @param {type} form_id
81
  * @returns {undefined}
82
  */
83
  function app_load(form_id, action, target_container, callback) {
84
+ var loading_text = '<span class="app-alert-notice">Loading...</span>';
85
+ var loading_text_just_text = 'Loading...'; // used in textarea, select etc.
86
  var undo_readonly = 0;
87
+ var is_save_action = action.indexOf('save') >= 0;
88
 
89
+ if (is_save_action) { // save action
90
  if (jQuery(target_container).is("input,textarea")) {
91
  jQuery(target_container).attr('readonly', 'readonly');
92
  jQuery(target_container).addClass('saving_action');
93
  }
94
 
95
+ jQuery('.status', jQuery(target_container).parent()).html(loading_text);
96
  } else {
97
  if (jQuery(target_container).is("input,textarea")) {
98
+ jQuery(target_container).val(loading_text_just_text);
99
  jQuery(target_container).addClass('saving_action');
100
  } else if (jQuery(target_container).is("select")) { // for loading. we want to override options of the select
101
+ jQuery(target_container + ' option').text(loading_text_just_text);
102
  } else {
103
+ jQuery(target_container).html(loading_text);
104
  }
105
  }
106
 
107
  jQuery.ajax({
108
  type : "post",
109
  //dataType : "json",
110
+ url : ajaxurl, // WP defines it and it contains all the necessary params
111
  data : jQuery(form_id).serialize() + '&action=orbisius_ctc_theme_editor_ajax&sub_cmd=' + escape(action),
112
 
113
  success : function (result) {
114
+ // http://stackoverflow.com/questions/2432749/jquery-delay-not-delaying
115
+ if (result != '') {
116
+ if (jQuery(target_container).is("input,textarea")) {
117
+ jQuery(target_container).val(result);
118
+ } else {
119
+ jQuery(target_container).html(result);
120
+ }
121
+
122
+ if (is_save_action) { // save action
123
+ jQuery('.status', jQuery(target_container).parent()).html('Saved.').addClass('app-alert-success');
124
+
125
+ setTimeout(function () {
126
+ jQuery('.status', jQuery(target_container).parent()).empty().removeClass('app-alert-success app-alert-error');
127
+ }, 2000);
128
+ }
129
+ } else if (is_save_action) { // save action
130
+ jQuery('.status', jQuery(target_container).parent()).html('Oops. Cannot save.').addClass('app-alert-error');
131
  }
132
 
133
  if (typeof callback != 'undefined') {
138
  complete : function (result) { // this is always called
139
  jQuery(target_container).removeClass('saving_action');
140
 
141
+ if (is_save_action) { // save action
142
  if (jQuery(target_container).is("input,textarea")) {
143
  jQuery(target_container).removeAttr('readonly');
 
 
 
 
 
 
 
144
  }
145
  }
146
  }
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="Loading...";var s=0;if(t.indexOf("save")>=0){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(i);jQuery(n).addClass("saving_action")}else if(jQuery(n).is("select")){jQuery(n+" option").text(i)}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(jQuery(n).is("input,textarea")){jQuery(n).val(i)}else{jQuery(n).html(i)}if(typeof r!="undefined"){r(e,t,n,i)}},complete:function(e){jQuery(n).removeClass("saving_action");if(t.indexOf("save")>=0){if(jQuery(n).is("input,textarea")){jQuery(n).removeAttr("readonly");jQuery(".status",jQuery(n).parent()).html("Saved.");setTimeout(function(){jQuery(".status",jQuery(n).parent()).empty()},2e3)}}}})}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").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()})
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.5
7
  Author: Svetoslav Marinov (Slavi)
8
  Author URI: http://orbisius.com
9
  */
@@ -138,7 +138,7 @@ function orbisius_child_theme_creator_settings_page() {
138
  <br/>Join today and test themes and plugins before you actually put them on your live site. For more info go to:
139
  <a href="http://qsandbox.com/?utm_source=orbisius-child-theme-creator&utm_medium=settings_screen&utm_campaign=product"
140
  target="_blank" title="[new window]">http://qsandbox.com</a>
141
- </p></div>
142
 
143
  <div class="updated0"><p>
144
  This plugin doesn't currently have any configuration options. To use it go to <strong>Appearance &rarr; Orbisius Child Theme Creator</strong>
@@ -375,11 +375,6 @@ function orbisius_child_theme_creator_tools_action() {
375
  }
376
  }
377
 
378
- if ( 0&&$multi_site ) {
379
- $msg .= orbisius_child_theme_creator_util::msg("You are running WordPress in MultiSite configuration.
380
- Please report any glitches that you may find.", 2);
381
- }
382
-
383
  if (!empty($errors)) {
384
  $msg .= orbisius_child_theme_creator_util::msg($errors);
385
  }
@@ -389,30 +384,33 @@ function orbisius_child_theme_creator_tools_action() {
389
  }
390
  ?>
391
  <div class="wrap orbisius_child_theme_creator_container">
392
- <h2>Orbisius Child Theme Creator
393
-
394
- <div class="" style="float: right;padding: 3px; _border: 1px solid #D54E21;">
395
- Links:
396
  <a href="http://qsandbox.com/?utm_source=orbisius-child-theme-creator&utm_medium=action_screen&utm_campaign=product"
397
  target="_blank" title="Opens in new tab/window. qSandbox is a FREE service that allows you to setup a test/sandbox WordPress site in 2 seconds. No technical knowledge is required.
398
  Test themes and plugins before you actually put them on your site">Free Test Site</a> <small>(2 sec setup)</small>
399
 
400
- | <a href="http://orbisius.com/page/free-quote/?utm_source=child-theme-creator&utm_medium=plugin-linksutm_campaign=plugin-update"
401
  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>
402
 
403
- | <a href="#help" title="[new window]">Help</a>
404
- </div>
405
- </h2>
406
 
407
- <?php echo $msg; ?>
408
- <div class="updated">
409
- <p>
410
- Choose a parent theme from the list below and click on the <strong>Create Child Theme</strong> button.
411
- </p>
412
  </div>
 
 
413
 
414
  <?php
415
  $buff = '';
 
 
 
 
 
 
 
416
  $buff .= "<div id='availablethemes' class='theme_container'>\n";
417
  $nonce = wp_create_nonce(basename(__FILE__) . '-action');
418
 
@@ -421,6 +419,12 @@ function orbisius_child_theme_creator_tools_action() {
421
 
422
  // we use the same CSS as in WP's appearances but put only the buttons we want.
423
  foreach ($themes as $theme_basedir_name => $theme_obj) {
 
 
 
 
 
 
424
  // get the web uri for the current theme and go 1 level up
425
  $src = dirname(get_template_directory_uri()) . "/$theme_basedir_name/screenshot.png";
426
  $functions_file = dirname(get_template_directory()) . "/$theme_basedir_name/functions.php";
@@ -440,6 +444,7 @@ function orbisius_child_theme_creator_tools_action() {
440
 
441
  $author_name = $theme_obj->get('Author');
442
  $author_name = strip_tags($author_name);
 
443
  $author_name = empty($author_name) ? 'n/a' : $author_name;
444
 
445
  $author_uri = $theme_obj->get('AuthorURI');
@@ -460,49 +465,41 @@ function orbisius_child_theme_creator_tools_action() {
460
  $buff .= "<div class='action-links'>\n";
461
  $buff .= "<ul>\n";
462
 
463
- $parent_theme = $theme_obj->get('Template');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
464
 
465
- if (empty($parent_theme)) { // Normal themes / no child ones
466
- if (file_exists($functions_file)) {
467
- $adv_container_id = md5($src);
468
-
469
- $buff .= "
470
- <li>
471
- <a href='javascript:void(0)' onclick='jQuery(\"#orbisius_ctc_act_adv_$adv_container_id\").slideToggle(\"slow\");'>+ Advanced</a> (show/hide)
472
- <div id='orbisius_ctc_act_adv_$adv_container_id' class='app-hide'>";
473
-
474
- $buff .= "<div>
475
- <label>
476
- <input type='checkbox' id='orbisius_child_theme_creator_copy_functions_php' name='copy_functions_php' value='1' /> Copy functons.php
477
- (<span class='app-serious-notice'><strong>Danger</strong>: if the theme doesn't support
478
- <a href='http://wp.tutsplus.com/tutorials/creative-coding/understanding-wordpress-pluggable-functions-and-their-usage/'
479
- target='_blank'>pluggable functions</a> this <strong>will crash your site</strong>. Make a backup is highly recommended.</span>)
480
- </label>
481
- </div>";
482
-
483
- $buff .= "
484
- </div> <!-- /orbisius_ctc_act_adv_$adv_container_id -->
485
  </li>\n";
486
- }
487
-
488
- // Let's allow the user to make that theme network wide usable
489
- if ($multi_site) {
490
- $buff .= "<li>
491
- <div>
492
- <label>
493
- <input type='checkbox' id='orbisius_child_theme_creator_make_network_wide_available'
494
- name='orbisius_child_theme_creator_make_network_wide_available' value='1' /> Make the new theme network wide available
495
- </label>
496
- </div></li>\n";
497
- } else {
498
- $buff .= "<li><label><input type='checkbox' id='orbisius_child_theme_creator_switch' name='switch' value='1' /> "
499
- . "Switch theme to the new theme after it is created</label></li>\n";
500
- }
501
-
502
- $buff .= "<li> <button type='submit' class='button button-primary'>Create Child Theme</button> </li>\n";
503
  } else {
504
- $buff .= "<li>[child theme]</li>\n";
 
505
  }
 
 
506
 
507
  $buff .= "</ul>\n";
508
  $buff .= "</div> <!-- /action-links -->\n";
@@ -510,7 +507,43 @@ function orbisius_child_theme_creator_tools_action() {
510
  $buff .= "</div> <!-- /available-theme -->\n";
511
  }
512
 
513
- $buff .= "</div> <!-- /availablethemes -->\n";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
514
  //var_dump($themes);
515
  echo $buff;
516
  ?>
@@ -519,7 +552,7 @@ function orbisius_child_theme_creator_tools_action() {
519
  <h2>Support &amp; Premium Plugins</h2>
520
  <div class="updated">
521
  <p>
522
- The support is handled on our Club Orbisius site: <a href="http://club.orbisius.com/" target="_blank" title="[new window]">http://club.orbisius.com/</a>.
523
  Please do NOT use the WordPress forums or other places to seek support.
524
  </p>
525
  </div>
@@ -532,9 +565,9 @@ function orbisius_child_theme_creator_tools_action() {
532
  $app_descr = urlencode($plugin_data['Description']);
533
  ?>
534
 
535
- <h2>Like this plugin? Share it with your friends</h2>
536
- <p>
537
- <!-- AddThis Button BEGIN -->
538
  <div class="addthis_toolbox addthis_default_style addthis_32x32_style">
539
  <a class="addthis_button_facebook" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
540
  <a class="addthis_button_twitter" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
@@ -553,10 +586,10 @@ function orbisius_child_theme_creator_tools_action() {
553
  <!-- The JS code is in the footer -->
554
 
555
  <script type="text/javascript">
556
- var addthis_config = {"data_track_clickback": true};
557
  var addthis_share = {
558
  templates: {twitter: 'Check out {{title}} #wordpress #plugin at {{lurl}} (via @orbisius)'}
559
- }
560
  </script>
561
  <!-- AddThis Button START part2 -->
562
  <script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js"></script>
@@ -585,7 +618,7 @@ function orbisius_child_theme_creator_tools_action() {
585
 
586
  <br/>Video Link: <a href="http://www.youtube.com/watch?v=BZUVq6ZTv-o&feature=youtu.be" target="_blank">http://www.youtube.com/watch?v=BZUVq6ZTv-o&feature=youtu.be</a>
587
  </p>
588
- </div>
589
  <?php
590
  }
591
 
@@ -1022,7 +1055,19 @@ function orbisius_ctc_theme_editor() {
1022
 
1023
  ?>
1024
  <div class="wrap orbisius_child_theme_creator_container orbisius_ctc_theme_editor_container">
1025
- <h2>Orbisius Theme Editor <small>(Part of <a href='<?php echo $plugin_data['url'];?>' target="_blank">Orbisius Child Theme Creator</a>)</small></h2>
 
 
 
 
 
 
 
 
 
 
 
 
1026
 
1027
  <div class="updated"><p><?php echo $msg; ?></p></div>
1028
 
@@ -1030,16 +1075,16 @@ function orbisius_ctc_theme_editor() {
1030
  $buff = $theme_1_file = $theme_2_file = '';
1031
  $req = orbisius_ctc_theme_editor_get_request();
1032
 
 
 
1033
  $html_dropdown_themes = array('' => '== SELECT THEME ==');
1034
 
1035
- $theme_1 = empty($req['theme_1']) ? '' : $req['theme_1'];
1036
  $theme_2 = empty($req['theme_2']) ? '' : $req['theme_2'];
1037
 
1038
  $theme_load_args = array();
1039
  $themes = wp_get_themes( $theme_load_args );
1040
 
1041
- $current_theme = wp_get_theme();
1042
-
1043
  // we use the same CSS as in WP's appearances but put only the buttons we want.
1044
  foreach ($themes as $theme_basedir_name => $theme_obj) {
1045
  $theme_name = $theme_obj->Name;
@@ -1083,6 +1128,12 @@ function orbisius_ctc_theme_editor() {
1083
  <div>
1084
  <button type='submit' class='button button-primary' id="theme_1_submit" name="theme_1_submit">Update</button>
1085
  <span class="status"></span>
 
 
 
 
 
 
1086
  </div>
1087
  </form>
1088
  </td>
@@ -1199,8 +1250,9 @@ function orbisius_ctc_theme_editor_generate_dropdown() {
1199
  }
1200
 
1201
  /**
1202
- * Reads or writes contents to a file
1203
- * @param type $read
 
1204
  * @return string
1205
  */
1206
  function orbisius_ctc_theme_editor_manage_file($read = 1) {
@@ -1233,8 +1285,8 @@ function orbisius_ctc_theme_editor_manage_file($read = 1) {
1233
  if ($read == 1) {
1234
  $buff = file_get_contents($theme_file);
1235
  } elseif ($read == 2) {
1236
- file_put_contents($theme_file, $theme_file_contents);
1237
- $buff = $theme_file_contents;
1238
  }
1239
 
1240
  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.6
7
  Author: Svetoslav Marinov (Slavi)
8
  Author URI: http://orbisius.com
9
  */
138
  <br/>Join today and test themes and plugins before you actually put them on your live site. For more info go to:
139
  <a href="http://qsandbox.com/?utm_source=orbisius-child-theme-creator&utm_medium=settings_screen&utm_campaign=product"
140
  target="_blank" title="[new window]">http://qsandbox.com</a>
141
+ </p></div>
142
 
143
  <div class="updated0"><p>
144
  This plugin doesn't currently have any configuration options. To use it go to <strong>Appearance &rarr; Orbisius Child Theme Creator</strong>
375
  }
376
  }
377
 
 
 
 
 
 
378
  if (!empty($errors)) {
379
  $msg .= orbisius_child_theme_creator_util::msg($errors);
380
  }
384
  }
385
  ?>
386
  <div class="wrap orbisius_child_theme_creator_container">
387
+ <h2 style="display:inline;">Orbisius Child Theme Creator</h2>
388
+ <div style="float: right;padding: 3px;" class="updated">
 
 
389
  <a href="http://qsandbox.com/?utm_source=orbisius-child-theme-creator&utm_medium=action_screen&utm_campaign=product"
390
  target="_blank" title="Opens in new tab/window. qSandbox is a FREE service that allows you to setup a test/sandbox WordPress site in 2 seconds. No technical knowledge is required.
391
  Test themes and plugins before you actually put them on your site">Free Test Site</a> <small>(2 sec setup)</small>
392
 
393
+ | <a href="http://orbisius.com/page/free-quote/?utm_source=child-theme-creator&utm_medium=plugin-links&utm_campaign=plugin-update"
394
  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>
395
 
396
+ | <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>
 
 
397
 
398
+ | <a href="http://club.orbisius.com/products/wordpress-plugins/orbisius-child-theme-creator/?utm_source=orbisius-child-theme-editor&utm_medium=action_screen&utm_campaign=product" target="_blank" title="[new window]">Product Page</a>
399
+
400
+ | <a href="#help" title="">Help</a>
 
 
401
  </div>
402
+
403
+ <?php echo $msg; ?>
404
 
405
  <?php
406
  $buff = '';
407
+ $buff .= "<h2>Available Themes</h2>\n";
408
+
409
+ // call to action.
410
+ $buff .= "<div class='updated'><p>\n";
411
+ $buff .= "Decide which parent theme you want to use from the list below and then click on the <strong>Create Child Theme</strong> button.";
412
+ $buff .= "</p></div>\n";
413
+
414
  $buff .= "<div id='availablethemes' class='theme_container'>\n";
415
  $nonce = wp_create_nonce(basename(__FILE__) . '-action');
416
 
419
 
420
  // we use the same CSS as in WP's appearances but put only the buttons we want.
421
  foreach ($themes as $theme_basedir_name => $theme_obj) {
422
+ $parent_theme = $theme_obj->get('Template');
423
+
424
+ if (!empty($parent_theme)) {
425
+ continue; // no kids allowed here.
426
+ }
427
+
428
  // get the web uri for the current theme and go 1 level up
429
  $src = dirname(get_template_directory_uri()) . "/$theme_basedir_name/screenshot.png";
430
  $functions_file = dirname(get_template_directory()) . "/$theme_basedir_name/functions.php";
444
 
445
  $author_name = $theme_obj->get('Author');
446
  $author_name = strip_tags($author_name);
447
+ $author_name = trim($author_name);
448
  $author_name = empty($author_name) ? 'n/a' : $author_name;
449
 
450
  $author_uri = $theme_obj->get('AuthorURI');
465
  $buff .= "<div class='action-links'>\n";
466
  $buff .= "<ul>\n";
467
 
468
+ if (isset($_REQUEST['orb_show_copy_functions']) && file_exists($functions_file)) {
469
+ $adv_container_id = md5($src);
470
+
471
+ $buff .= "
472
+ <li>
473
+ <a href='javascript:void(0)' onclick='jQuery(\"#orbisius_ctc_act_adv_$adv_container_id\").slideToggle(\"slow\");'>+ Advanced</a> (show/hide)
474
+ <div id='orbisius_ctc_act_adv_$adv_container_id' class='app-hide'>";
475
+
476
+ $buff .= "<label>
477
+ <input type='checkbox' id='orbisius_child_theme_creator_copy_functions_php' name='copy_functions_php' value='1' /> Copy functons.php
478
+ (<span class='app-serious-notice'><strong>Danger</strong>: if the theme doesn't support
479
+ <a href='http://wp.tutsplus.com/tutorials/creative-coding/understanding-wordpress-pluggable-functions-and-their-usage/'
480
+ target='_blank'>pluggable functions</a> this <strong>will crash your site</strong>. Make a backup is highly recommended. In most cases you won't need to copy functions.php</span>)
481
+ </label>
482
+ ";
483
+
484
+ $buff .= "
485
+ </div> <!-- /orbisius_ctc_act_adv_$adv_container_id -->
486
+ </li>\n";
487
+ }
488
 
489
+ // Let's allow the user to make that theme network wide usable
490
+ if ($multi_site) {
491
+ $buff .= "<li>
492
+ <label>
493
+ <input type='checkbox' id='orbisius_child_theme_creator_make_network_wide_available'
494
+ name='orbisius_child_theme_creator_make_network_wide_available' value='1' /> Make the new theme network wide available
495
+ </label>
 
 
 
 
 
 
 
 
 
 
 
 
 
496
  </li>\n";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
497
  } else {
498
+ $buff .= "<li><label><input type='checkbox' id='orbisius_child_theme_creator_switch' name='switch' value='1' /> "
499
+ . "Switch theme to the new theme after it is created</label></li>\n";
500
  }
501
+
502
+ $buff .= "<li> <button type='submit' class='button button-primary'>Create Child Theme</button> </li>\n";
503
 
504
  $buff .= "</ul>\n";
505
  $buff .= "</div> <!-- /action-links -->\n";
507
  $buff .= "</div> <!-- /available-theme -->\n";
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) {
515
+ $parent_theme = $theme_obj->get('Template');
516
+
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";
523
+
524
+ $author_name = $theme_obj->get('Author');
525
+ $author_name = strip_tags($author_name);
526
+ $author_name = empty($author_name) ? 'n/a' : $author_name;
527
+
528
+ $author_uri = $theme_obj->get('AuthorURI');
529
+ $author_line = empty($author_uri)
530
+ ? $author_name
531
+ : "<a title='Visit author homepage' href='$author_uri' target='_blank'>$author_name</a>";
532
+
533
+ $author_line .= " | Ver.$theme_obj->Version\n";
534
+
535
+ $edit_theme_link = orbisius_child_theme_creator_util::get_theme_editor_link( array('theme_1' => $theme_basedir_name) );
536
+ $author_line .= " | <a href='$edit_theme_link' title='Edit with Orbisius Theme Editor'>Edit</a>\n";
537
+
538
+ $buff .= "<div class='available-theme'>\n";
539
+ $buff .= "<img class='screenshot' src='$src' alt='' />\n";
540
+ $buff .= "<h3>$theme_obj->Name</h3>\n";
541
+ $buff .= "<div class='theme-author'>By $author_line</div>\n";
542
+ $buff .= "</div> <!-- /available-theme -->\n";
543
+ }
544
+
545
+ $buff .= "</div> <!-- /availablethemes -->\n <br class='clear' />";
546
+
547
  //var_dump($themes);
548
  echo $buff;
549
  ?>
552
  <h2>Support &amp; Premium Plugins</h2>
553
  <div class="updated">
554
  <p>
555
+ The support is handled on our Club Orbisius site: <a href="http://club.orbisius.com/forums/forum/community-support-forum/wordpress-plugins/orbisius-child-theme-creator/" target="_blank" title="[new window]">http://club.orbisius.com/</a>.
556
  Please do NOT use the WordPress forums or other places to seek support.
557
  </p>
558
  </div>
565
  $app_descr = urlencode($plugin_data['Description']);
566
  ?>
567
 
568
+ <h2>Like this plugin? Share it with your friends</h2>
569
+ <p>
570
+ <!-- AddThis Button BEGIN -->
571
  <div class="addthis_toolbox addthis_default_style addthis_32x32_style">
572
  <a class="addthis_button_facebook" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
573
  <a class="addthis_button_twitter" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
586
  <!-- The JS code is in the footer -->
587
 
588
  <script type="text/javascript">
589
+ var addthis_config = { "data_track_clickback": true };
590
  var addthis_share = {
591
  templates: {twitter: 'Check out {{title}} #wordpress #plugin at {{lurl}} (via @orbisius)'}
592
+ };
593
  </script>
594
  <!-- AddThis Button START part2 -->
595
  <script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js"></script>
618
 
619
  <br/>Video Link: <a href="http://www.youtube.com/watch?v=BZUVq6ZTv-o&feature=youtu.be" target="_blank">http://www.youtube.com/watch?v=BZUVq6ZTv-o&feature=youtu.be</a>
620
  </p>
621
+ </div> <!-- /wrap -->
622
  <?php
623
  }
624
 
1055
 
1056
  ?>
1057
  <div class="wrap orbisius_child_theme_creator_container orbisius_ctc_theme_editor_container">
1058
+ <h2 style="display:inline;">Orbisius Theme Editor <small>(Part of <a href='<?php echo $plugin_data['url'];?>' target="_blank">Orbisius Child Theme Creator</a>)</small></h2>
1059
+ <div style="float: right;padding: 3px;" class="updated">
1060
+ <a href="http://qsandbox.com/?utm_source=orbisius-child-theme-editor&utm_medium=action_screen&utm_campaign=product"
1061
+ target="_blank" title="Opens in new tab/window. qSandbox is a FREE service that allows you to setup a test/sandbox WordPress site in 2 seconds. No technical knowledge is required.
1062
+ Test themes and plugins before you actually put them on your site">Free Test Site</a> <small>(2 sec setup)</small>
1063
+
1064
+ | <a href="http://orbisius.com/page/free-quote/?utm_source=child-theme-editor&utm_medium=plugin-links&utm_campaign=plugin-update"
1065
+ 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>
1066
+
1067
+ | <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>
1068
+
1069
+ | <a href="http://club.orbisius.com/products/wordpress-plugins/orbisius-child-theme-creator/?utm_source=orbisius-child-theme-editor&utm_medium=action_screen&utm_campaign=product" target="_blank" title="[new window]">Product Page</a>
1070
+ </div>
1071
 
1072
  <div class="updated"><p><?php echo $msg; ?></p></div>
1073
 
1075
  $buff = $theme_1_file = $theme_2_file = '';
1076
  $req = orbisius_ctc_theme_editor_get_request();
1077
 
1078
+ $current_theme = wp_get_theme();
1079
+
1080
  $html_dropdown_themes = array('' => '== SELECT THEME ==');
1081
 
1082
+ $theme_1 = empty($req['theme_1']) ? $current_theme->get_stylesheet() : $req['theme_1'];
1083
  $theme_2 = empty($req['theme_2']) ? '' : $req['theme_2'];
1084
 
1085
  $theme_load_args = array();
1086
  $themes = wp_get_themes( $theme_load_args );
1087
 
 
 
1088
  // we use the same CSS as in WP's appearances but put only the buttons we want.
1089
  foreach ($themes as $theme_basedir_name => $theme_obj) {
1090
  $theme_name = $theme_obj->Name;
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>
1250
  }
1251
 
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($read = 1) {
1285
  if ($read == 1) {
1286
  $buff = file_get_contents($theme_file);
1287
  } elseif ($read == 2) {
1288
+ $status = file_put_contents($theme_file, $theme_file_contents);
1289
+ $buff = !empty($status) ? $theme_file_contents : '';
1290
  }
1291
 
1292
  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.6.1
7
- Stable tag: 1.0.5
8
  License: GPLv2 or later
9
  Network:true
10
 
@@ -103,11 +103,21 @@ Also which files does the theme need in order to work well.
103
  Ok. You'll need to use FTP client and go to in the wordpress folder and then wp-content/themes/AAAAA-child-01/ and delete functions.php
104
  AAAAA is of course the directory of your parent theme.
105
 
 
 
 
106
  = What to do next? =
107
  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.
108
 
109
  == Changelog ==
110
 
 
 
 
 
 
 
 
111
  = 1.0.5 =
112
  * Tested under WordPress Multisite environment
113
  * Added menus in WordPress Multisite environment
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.6
8
  License: GPLv2 or later
9
  Network:true
10
 
103
  Ok. You'll need to use FTP client and go to in the wordpress folder and then wp-content/themes/AAAAA-child-01/ and delete functions.php
104
  AAAAA is of course the directory of your parent theme.
105
 
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.
117
+ * Reduced the font size of the links in the top right corner of Child Theme Creator and Theme Editor
118
+ * Separated Parent themes from Child ones
119
+ * Hid the advanced section. Was confusing and scaring people. If you really want to copy functions pass &orb_show_copy_functions parameter to the Child Plugin page.
120
+
121
  = 1.0.5 =
122
  * Tested under WordPress Multisite environment
123
  * Added menus in WordPress Multisite environment
screenshot-2.png CHANGED
Binary file