Child Theme Creator by Orbisius - Version 1.3.2

Version Description

  • Added locking when saving files.
  • Syntax check is performed only for php files. Saving other files should be quicker now.
  • Perform a syntax check before saving to avoid crashing good people's WordPress. Changes are saved in a file with the same name but there's suffix added to it error
  • Listing error files as well as sass, scss (if any)
  • Tested with WP 4.5
Download this release

Release Info

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

Code changes from version 1.3.1 to 1.3.2

nbproject/private/private.xml CHANGED
@@ -52,7 +52,6 @@
52
  <group name="qsandbox"/>
53
  <group>
54
  <file>file:/C:/Copy/Dropbox/cloud/projects/default/htdocs/wordpress313/wp-content/plugins/orbisius-child-theme-creator/orbisius-child-theme-creator.php</file>
55
- <file>file:/C:/Copy/Dropbox/cloud/projects/default/htdocs/wordpress313/wp-content/plugins/orbisius-child-theme-creator/readme.txt</file>
56
  </group>
57
  </open-files>
58
  </project-private>
52
  <group name="qsandbox"/>
53
  <group>
54
  <file>file:/C:/Copy/Dropbox/cloud/projects/default/htdocs/wordpress313/wp-content/plugins/orbisius-child-theme-creator/orbisius-child-theme-creator.php</file>
 
55
  </group>
56
  </open-files>
57
  </project-private>
orbisius-child-theme-creator.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Orbisius Child Theme Creator
4
  Plugin URI: http://club.orbisius.com/products/wordpress-plugins/orbisius-child-theme-creator/
5
  Description: This plugin allows you to quickly create child themes from any theme that you have currently installed on your site/blog.
6
- Version: 1.3.1
7
  Author: Svetoslav Marinov (Slavi)
8
  Author URI: http://orbisius.com
9
  */
@@ -1512,7 +1512,7 @@ class orbisius_child_theme_creator {
1512
 
1513
  $buff .= "@import url('../$this->parent_theme_basedir/style.css');\n";
1514
 
1515
- file_put_contents($this->target_dir_path . 'style.css', $buff);
1516
 
1517
  // RTL langs; make rtl.css to point to the parent file as well
1518
  if (file_exists($this->parent_theme_dir . 'rtl.css')) {
@@ -1526,7 +1526,7 @@ class orbisius_child_theme_creator {
1526
 
1527
  $rtl_buff .= "@import url('../$this->parent_theme_basedir/rtl.css');\n";
1528
 
1529
- file_put_contents($this->target_dir_path . 'rtl.css', $rtl_buff);
1530
  }
1531
 
1532
  $themes_url = admin_url('themes.php');
@@ -2444,10 +2444,17 @@ function orbisius_ctc_theme_editor_zip_theme($theme_base_dir, $to) {
2444
  */
2445
  function orbisius_ctc_theme_editor_check_syntax($theme_file_contents) {
2446
  $status_rec = array(
2447
- 'status' => 0,
2448
  'msg' => '',
 
2449
  );
2450
 
 
 
 
 
 
 
 
2451
  $temp = tmpfile();
2452
  fwrite($temp, $theme_file_contents);
2453
 
@@ -2479,6 +2486,7 @@ function orbisius_ctc_theme_editor_check_syntax($theme_file_contents) {
2479
  } else {
2480
  $status_rec['msg'] = 'Syntax check failed. Error: ' . $error;
2481
  }
 
2482
  } else {
2483
  $status_rec['msg'] = 'Syntax check: n/a. functiona: exec() and shell_exec() are not available.';
2484
  }
@@ -2533,7 +2541,7 @@ function orbisius_ctc_theme_editor_generate_dropdown() {
2533
  $all_files = orbisius_child_theme_creator_util::load_files($theme_dir);
2534
 
2535
  foreach ($all_files as $file) {
2536
- if (preg_match('#\.(php|css|js|txt)$#si', $file)) {
2537
  $files[] = $file;
2538
  }
2539
  }
@@ -2576,21 +2584,29 @@ function orbisius_ctc_theme_editor_manage_file( $cmd_id = 1 ) {
2576
  return 'Missing data!';
2577
  }
2578
 
2579
- //$theme_dir = $theme_root . "$theme_base_dir/";
2580
  if (empty($theme_base_dir) || !is_dir($theme_dir)) {
2581
  return 'Selected theme is invalid.';
2582
  } elseif (!file_exists($theme_file) && $cmd_id == 1) {
2583
- //} elseif (!file_exists($theme_dir . $theme_file) && $cmd_id == 1) {
2584
  return 'Selected file is invalid.';
2585
  }
2586
 
2587
- //$theme_file = $theme_dir . $theme_file; //
2588
-
2589
  if ($cmd_id == 1) {
2590
  $buff = file_get_contents($theme_file);
2591
  } elseif ($cmd_id == 2) {
2592
- $status = file_put_contents($theme_file, $theme_file_contents);
2593
- $buff = !empty($status) ? $theme_file_contents : '';
 
 
 
 
 
 
 
 
 
 
 
 
2594
  } elseif ($cmd_id == 3 && (!empty($req['theme_1_file']) || !empty($req['theme_2_file']))) {
2595
  $status = unlink($theme_file);
2596
  }
3
  Plugin Name: Orbisius Child Theme Creator
4
  Plugin URI: http://club.orbisius.com/products/wordpress-plugins/orbisius-child-theme-creator/
5
  Description: This plugin allows you to quickly create child themes from any theme that you have currently installed on your site/blog.
6
+ Version: 1.3.2
7
  Author: Svetoslav Marinov (Slavi)
8
  Author URI: http://orbisius.com
9
  */
1512
 
1513
  $buff .= "@import url('../$this->parent_theme_basedir/style.css');\n";
1514
 
1515
+ file_put_contents($this->target_dir_path . 'style.css', $buff, LOCK_EX);
1516
 
1517
  // RTL langs; make rtl.css to point to the parent file as well
1518
  if (file_exists($this->parent_theme_dir . 'rtl.css')) {
1526
 
1527
  $rtl_buff .= "@import url('../$this->parent_theme_basedir/rtl.css');\n";
1528
 
1529
+ file_put_contents($this->target_dir_path . 'rtl.css', $rtl_buff, LOCK_EX);
1530
  }
1531
 
1532
  $themes_url = admin_url('themes.php');
2444
  */
2445
  function orbisius_ctc_theme_editor_check_syntax($theme_file_contents) {
2446
  $status_rec = array(
 
2447
  'msg' => '',
2448
+ 'status' => 0,
2449
  );
2450
 
2451
+ // Not a php thing so don't bother.
2452
+ if (stripos($theme_file_contents, '<?') === false) {
2453
+ $status_rec['msg'] = 'Syntax OK.';
2454
+ $status_rec['status'] = 1;
2455
+ return $status_rec;
2456
+ }
2457
+
2458
  $temp = tmpfile();
2459
  fwrite($temp, $theme_file_contents);
2460
 
2486
  } else {
2487
  $status_rec['msg'] = 'Syntax check failed. Error: ' . $error;
2488
  }
2489
+ $status_rec['syntax_check_ran'] = 1;
2490
  } else {
2491
  $status_rec['msg'] = 'Syntax check: n/a. functiona: exec() and shell_exec() are not available.';
2492
  }
2541
  $all_files = orbisius_child_theme_creator_util::load_files($theme_dir);
2542
 
2543
  foreach ($all_files as $file) {
2544
+ if (preg_match('#\.(php|js|txt|css|sass|scss)(?:_error_.*)?$#si', $file)) {
2545
  $files[] = $file;
2546
  }
2547
  }
2584
  return 'Missing data!';
2585
  }
2586
 
 
2587
  if (empty($theme_base_dir) || !is_dir($theme_dir)) {
2588
  return 'Selected theme is invalid.';
2589
  } elseif (!file_exists($theme_file) && $cmd_id == 1) {
 
2590
  return 'Selected file is invalid.';
2591
  }
2592
 
 
 
2593
  if ($cmd_id == 1) {
2594
  $buff = file_get_contents($theme_file);
2595
  } elseif ($cmd_id == 2) {
2596
+ $suff = '';
2597
+
2598
+ // This should prevent people from crashing their WP by missing something.
2599
+ // The changes will be saved in another file.
2600
+ $syntax_check_rec = orbisius_ctc_theme_editor_check_syntax($theme_file_contents);
2601
+
2602
+ if (!empty($syntax_check_rec['syntax_check_ran']) && empty($syntax_check_rec['status'])) {
2603
+ $suff = microtime(true);
2604
+ $suff = preg_replace('#[^\w-]#si', '_', $suff);
2605
+ $suff = '_error_' . date('Y-m-d') . '_' . $suff;
2606
+ }
2607
+
2608
+ $status = file_put_contents($theme_file . $suff, $theme_file_contents, LOCK_EX);
2609
+ $buff = $theme_file_contents;
2610
  } elseif ($cmd_id == 3 && (!empty($req['theme_1_file']) || !empty($req['theme_2_file']))) {
2611
  $status = unlink($theme_file);
2612
  }
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: lordspace,orbisius
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=7APYDVPBCSY9A
4
  Tags: theme,child theme,childtheme,childthemes,parent theme,child themes,CSS,styling,resposive design,design,custom themeing, shared hosting,theme editor theme,themes,wp,wordpress,orbisius,theme creator,custom theme,theme generator,css,css editor
5
  Requires at least: 3.4
6
- Tested up to: 4.4
7
- Stable tag: 1.3.1
8
  License: GPLv2 or later
9
 
10
  Create Child Themes quickly and easily from any theme that you have currently installed on your site/blog.
@@ -19,6 +19,7 @@ It also creates rtl.css if exists in the parent theme.
19
  = Child Theme Creator Features =
20
  * Create a theme with a click of a button
21
  * Never forget what files to copy and what to skip when creating child themes.
 
22
  * Easy to use interface
23
  * When moving through the themes the currently looked one will have a nice background & border
24
  * Create *unlimited* child themes from a parent theme. The plugin will add Child 01, Child 02 etc.
@@ -150,6 +151,13 @@ Todo
150
 
151
  == Changelog ==
152
 
 
 
 
 
 
 
 
153
  = 1.3.1 =
154
  * For some reason WordPress.org didn't register the 1.3.0 release or the stable tag didn't get set to 1.3.0 on time.
155
 
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=7APYDVPBCSY9A
4
  Tags: theme,child theme,childtheme,childthemes,parent theme,child themes,CSS,styling,resposive design,design,custom themeing, shared hosting,theme editor theme,themes,wp,wordpress,orbisius,theme creator,custom theme,theme generator,css,css editor
5
  Requires at least: 3.4
6
+ Tested up to: 4.5
7
+ Stable tag: 1.3.2
8
  License: GPLv2 or later
9
 
10
  Create Child Themes quickly and easily from any theme that you have currently installed on your site/blog.
19
  = Child Theme Creator Features =
20
  * Create a theme with a click of a button
21
  * Never forget what files to copy and what to skip when creating child themes.
22
+ * Copies parent theme's options (since v.1.3)
23
  * Easy to use interface
24
  * When moving through the themes the currently looked one will have a nice background & border
25
  * Create *unlimited* child themes from a parent theme. The plugin will add Child 01, Child 02 etc.
151
 
152
  == Changelog ==
153
 
154
+ = 1.3.2 =
155
+ * Added locking when saving files.
156
+ * Syntax check is performed only for php files. Saving other files should be quicker now.
157
+ * Perform a syntax check before saving to avoid crashing good people's WordPress. Changes are saved in a file with the same name but there's suffix added to it _error_
158
+ * Listing _error_ files as well as sass, scss (if any)
159
+ * Tested with WP 4.5
160
+
161
  = 1.3.1 =
162
  * For some reason WordPress.org didn't register the 1.3.0 release or the stable tag didn't get set to 1.3.0 on time.
163