Child Theme Creator by Orbisius - Version 1.3.4

Version Description

  • Uses the recommended approach for loading css (since v.1.3.4)
  • Fixes, updated FAQ
  • Removed a notice about depricated function: https://wordpress.org/support/topic/depricated-functions-3/
  • Removed some snippets that contained some 3rd party tracking info e.g. twitter's via or some user id to the addthis widget.
Download this release

Release Info

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

Code changes from version 1.3.3 to 1.3.4

nbproject/private/private.xml CHANGED
@@ -51,9 +51,8 @@
51
  <open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
52
  <group name="qsandbox"/>
53
  <group>
54
- <file>file:/C:/Copy/Dropbox/cloud/projects/default/htdocs/wordpress313/wp-content/plugins/orbisius-child-theme-creator/assets/main.js</file>
55
- <file>file:/C:/Copy/Dropbox/cloud/projects/default/htdocs/wordpress313/wp-content/plugins/orbisius-child-theme-creator/readme.txt</file>
56
  <file>file:/C:/Copy/Dropbox/cloud/projects/default/htdocs/wordpress313/wp-content/plugins/orbisius-child-theme-creator/orbisius-child-theme-creator.php</file>
 
57
  </group>
58
  </open-files>
59
  </project-private>
51
  <open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
52
  <group name="qsandbox"/>
53
  <group>
 
 
54
  <file>file:/C:/Copy/Dropbox/cloud/projects/default/htdocs/wordpress313/wp-content/plugins/orbisius-child-theme-creator/orbisius-child-theme-creator.php</file>
55
+ <file>file:/C:/Copy/Dropbox/cloud/projects/default/htdocs/wordpress313/wp-content/plugins/orbisius-child-theme-creator/readme.txt</file>
56
  </group>
57
  </open-files>
58
  </project-private>
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.3
7
  Author: Svetoslav Marinov (Slavi)
8
  Author URI: http://orbisius.com
9
  */
@@ -391,11 +391,11 @@ function orbisius_child_theme_creator_settings_page() {
391
  <script type="text/javascript">
392
  var addthis_config = {"data_track_clickback": true};
393
  var addthis_share = {
394
- templates: {twitter: 'Check out {{title}} #WordPress #plugin at {{lurl}} (via @orbisius)'}
395
  }
396
  </script>
397
  <!-- AddThis Button START part2 -->
398
- <script type="text/javascript" src="//s7.addthis.com/js/250/addthis_widget.js#pubid=lordspace"></script>
399
  <!-- AddThis Button END part2 -->
400
  </div> <!-- .postbox -->
401
 
@@ -748,17 +748,17 @@ function orbisius_child_theme_creator_tools_action() {
748
  if (empty($errors)) {
749
  try {
750
  $installer = new orbisius_child_theme_creator($parent_theme_base_dirname);
751
- $installer->custom_info($child_custom_info);
752
 
753
  $installer->check_permissions();
754
  $installer->copy_main_files();
755
  $installer->generate_style();
 
756
  $installer->copy_parent_themes_options();
757
 
758
  // Does the user want to copy the functions.php?
759
- if (!empty($_REQUEST['create_blank_functions_file'])) {
760
- $installer->create_blank('functions.php');
761
- } elseif (!empty($_REQUEST['copy_functions_php'])) {
762
  $installer->add_files('functions.php');
763
  }
764
 
@@ -921,9 +921,6 @@ function orbisius_child_theme_creator_tools_action() {
921
  . "Switch theme to the new theme after it is created</label></li>\n";
922
  }
923
 
924
- $buff .= "<li><label><input type='checkbox' id='create_blank_functions_file' name='create_blank_functions_file' value='1' /> "
925
- . "Create a blank functions.php file</label></li>\n";
926
-
927
  // This allows the users to specify title and description of the target child theme
928
  $customize_info_container_id = 'orbisius_ctc_cust_info_' . md5($src);
929
 
@@ -1324,15 +1321,15 @@ class orbisius_child_theme_creator {
1324
  public function __construct($parent_theme_basedir = '') {
1325
  $all_themes_root = get_theme_root();
1326
 
1327
- $this->parent_theme_basedir = $parent_theme_basedir;
1328
- $this->parent_theme_dir = $all_themes_root . '/' . $parent_theme_basedir . '/';
1329
 
1330
  $i = 0;
1331
 
1332
  // Let's create multiple folders in case the script is run multiple times.
1333
  do {
1334
  $i++;
1335
- $target_dir = $all_themes_root . '/' . $parent_theme_basedir . '-child-' . sprintf("%02d", $i) . '/';
1336
  } while (is_dir($target_dir));
1337
 
1338
  $this->target_dir_path = $target_dir;
@@ -1368,6 +1365,14 @@ class orbisius_child_theme_creator {
1368
  return $this->custom_info[$key];
1369
  }
1370
  }
 
 
 
 
 
 
 
 
1371
 
1372
  return $this->custom_info; // all custom info requested
1373
  }
@@ -1460,10 +1465,7 @@ class orbisius_child_theme_creator {
1460
  $app_link = $plugin_data['PluginURI'];
1461
  $app_title = $plugin_data['Name'];
1462
 
1463
- $parent_theme_data = version_compare($wp_version, '3.4', '>=')
1464
- ? wp_get_theme($this->parent_theme_basedir)
1465
- : (object) get_theme_data($this->target_dir_path . 'style.css');
1466
-
1467
  $theme_name = "$parent_theme_data->Name $this->target_name_suffix";
1468
  $theme_uri = $parent_theme_data->ThemeURI;
1469
  $theme_descr = "$this->target_name_suffix theme for the $parent_theme_data->Name theme";
@@ -1508,9 +1510,10 @@ class orbisius_child_theme_creator {
1508
  $buff .= "Version: $ver\n";
1509
  $buff .= "*/\n";
1510
 
1511
- $buff .= "\n/* Generated by $app_title ($app_link) on " . date('r') . " */ \n\n";
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
 
@@ -1650,9 +1653,16 @@ class orbisius_child_theme_creator {
1650
  *
1651
  * @param str $file
1652
  */
1653
- public function create_blank($file) {
1654
  if ($file == 'functions.php') {
 
 
 
 
 
 
1655
  $file_tpl = <<<BUFF_EOF
 
1656
  /*
1657
  * Generated By Orbisius Child Theme Creator - your favorite plugin for Child Theme creation :)
1658
  * https://wordpress.org/plugins/orbisius-child-theme-creator/
@@ -1666,9 +1676,31 @@ class orbisius_child_theme_creator {
1666
  * Also if the parent theme supports pluggable functions you can use function_exists( 'put_the_function_name_here' ) checks.
1667
  */
1668
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1669
  BUFF_EOF;
1670
 
1671
- $file_tpl = '<?php' . "\n" . $file_tpl . "\n\n"; // no need to close php
1672
 
1673
  $file = $this->target_dir_path . $file;
1674
  file_put_contents($file, $file_tpl, LOCK_EX);
@@ -1686,26 +1718,19 @@ class orbisius_child_theme_creator_util {
1686
  */
1687
  public static function output_orb_widget($obj = '', $return = 0) {
1688
  $buff = '';
 
1689
  ?>
1690
- <!-- Orbisius JS Widget -->
1691
- <?php
1692
- $naked_domain = !empty($_SERVER['DEV_ENV']) ? 'orbclub.com.clients.com' : 'club.orbisius.com';
1693
-
1694
- if (!empty($_SERVER['DEV_ENV']) && is_ssl()) {
1695
- $naked_domain = 'ssl.orbisius.com/club';
1696
- }
1697
-
1698
- // obj could be 'author'
1699
- $obj = empty($obj) ? str_replace('.php', '', basename(__FILE__)) : sanitize_title($obj);
1700
- $obj_id = 'orb_widget_' . sha1($obj);
1701
-
1702
- $params = '?' . http_build_query(array('p' => $obj, 't' => $obj_id, 'layout' => 'plugin', ));
1703
- $buff .= "<div id='$obj_id' class='$obj_id orbisius_ext_content'></div>\n";
1704
- $buff .= "<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://$naked_domain/wpu/widget/$params';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'orbsius-js-$obj_id');</script>";
1705
- ?>
1706
- <!-- /Orbisius JS Widget -->
1707
  <?php
1708
-
 
1709
  if ($return) {
1710
  return $buff;
1711
  } else {
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.4
7
  Author: Svetoslav Marinov (Slavi)
8
  Author URI: http://orbisius.com
9
  */
391
  <script type="text/javascript">
392
  var addthis_config = {"data_track_clickback": true};
393
  var addthis_share = {
394
+ templates: {twitter: 'Check out {{title}} #WordPress #plugin at {{lurl}}'}
395
  }
396
  </script>
397
  <!-- AddThis Button START part2 -->
398
+ <script type="text/javascript" src="//s7.addthis.com/js/250/addthis_widget.js"></script>
399
  <!-- AddThis Button END part2 -->
400
  </div> <!-- .postbox -->
401
 
748
  if (empty($errors)) {
749
  try {
750
  $installer = new orbisius_child_theme_creator($parent_theme_base_dirname);
751
+ $theme_setup_params = $installer->custom_info($child_custom_info);
752
 
753
  $installer->check_permissions();
754
  $installer->copy_main_files();
755
  $installer->generate_style();
756
+ $installer->create_file( 'functions.php', $theme_setup_params );
757
  $installer->copy_parent_themes_options();
758
 
759
  // Does the user want to copy the functions.php?
760
+ // This is dangerous and can crash the site.
761
+ if (!empty($_REQUEST['copy_functions_php'])) {
 
762
  $installer->add_files('functions.php');
763
  }
764
 
921
  . "Switch theme to the new theme after it is created</label></li>\n";
922
  }
923
 
 
 
 
924
  // This allows the users to specify title and description of the target child theme
925
  $customize_info_container_id = 'orbisius_ctc_cust_info_' . md5($src);
926
 
1321
  public function __construct($parent_theme_basedir = '') {
1322
  $all_themes_root = get_theme_root();
1323
 
1324
+ $this->parent_theme_basedir = orbisius_child_theme_creator_util::sanitize_data( $parent_theme_basedir );
1325
+ $this->parent_theme_dir = $all_themes_root . '/' . $this->parent_theme_basedir . '/';
1326
 
1327
  $i = 0;
1328
 
1329
  // Let's create multiple folders in case the script is run multiple times.
1330
  do {
1331
  $i++;
1332
+ $target_dir = $all_themes_root . '/' . $parent_theme_basedir . '-child-theme-' . sprintf("%02d", $i) . '/';
1333
  } while (is_dir($target_dir));
1334
 
1335
  $this->target_dir_path = $target_dir;
1365
  return $this->custom_info[$key];
1366
  }
1367
  }
1368
+
1369
+ if ( empty( $this->custom_info['parent_theme_basedir'] ) ) {
1370
+ $this->custom_info['parent_theme_basedir'] = $this->parent_theme_basedir;
1371
+ }
1372
+
1373
+ if ( empty( $this->custom_info['parent_theme_dir'] ) ) {
1374
+ $this->custom_info['parent_theme_dir'] = $this->parent_theme_dir;
1375
+ }
1376
 
1377
  return $this->custom_info; // all custom info requested
1378
  }
1465
  $app_link = $plugin_data['PluginURI'];
1466
  $app_title = $plugin_data['Name'];
1467
 
1468
+ $parent_theme_data = wp_get_theme($this->parent_theme_basedir);
 
 
 
1469
  $theme_name = "$parent_theme_data->Name $this->target_name_suffix";
1470
  $theme_uri = $parent_theme_data->ThemeURI;
1471
  $theme_descr = "$this->target_name_suffix theme for the $parent_theme_data->Name theme";
1510
  $buff .= "Version: $ver\n";
1511
  $buff .= "*/\n";
1512
 
1513
+ $buff .= "\n/* Generated by $app_title ($app_link) on " . date('r') . " */ \n";
1514
+ $buff .= "/* The plugin now uses the recommended approach for loading the css files.*/\n";
1515
+ $buff .= "\n";
1516
+ //$buff .= "@import url('../$this->parent_theme_basedir/style.css');\n";
1517
 
1518
  file_put_contents($this->target_dir_path . 'style.css', $buff, LOCK_EX);
1519
 
1653
  *
1654
  * @param str $file
1655
  */
1656
+ public function create_file($file, $params = array() ) {
1657
  if ($file == 'functions.php') {
1658
+ $parent_base_dir = $params['parent_theme_basedir'];
1659
+ $func_prefix = $params['parent_theme_basedir'];
1660
+ $func_prefix = strtolower( $func_prefix );
1661
+ $func_prefix = 'orbisius_ctc_' . preg_replace( '#[^\w]+#si', '_', $func_prefix );
1662
+ $func_prefix = trim( $func_prefix, '_' );
1663
+
1664
  $file_tpl = <<<BUFF_EOF
1665
+ <?php
1666
  /*
1667
  * Generated By Orbisius Child Theme Creator - your favorite plugin for Child Theme creation :)
1668
  * https://wordpress.org/plugins/orbisius-child-theme-creator/
1676
  * Also if the parent theme supports pluggable functions you can use function_exists( 'put_the_function_name_here' ) checks.
1677
  */
1678
 
1679
+ /**
1680
+ * Loads parent and child themes' style.css
1681
+ */
1682
+ function {$func_prefix}_child_theme_enqueue_styles() {
1683
+ \$parent_style = '{$func_prefix}_parent_style';
1684
+ \$parent_base_dir = '$parent_base_dir';
1685
+
1686
+ wp_enqueue_style( \$parent_style,
1687
+ get_template_directory_uri() . '/style.css',
1688
+ array(),
1689
+ wp_get_theme( \$parent_base_dir ) ? wp_get_theme( \$parent_base_dir )->get('Version') : ''
1690
+ );
1691
+
1692
+ wp_enqueue_style( \$parent_style . '_child_style',
1693
+ get_stylesheet_directory_uri() . '/style.css',
1694
+ array( \$parent_style ),
1695
+ wp_get_theme()->get('Version')
1696
+ );
1697
+ }
1698
+
1699
+ add_action( 'wp_enqueue_scripts', '{$func_prefix}_child_theme_enqueue_styles' );
1700
+
1701
  BUFF_EOF;
1702
 
1703
+ $file_tpl = ltrim( $file_tpl );
1704
 
1705
  $file = $this->target_dir_path . $file;
1706
  file_put_contents($file, $file_tpl, LOCK_EX);
1718
  */
1719
  public static function output_orb_widget($obj = '', $return = 0) {
1720
  $buff = '';
1721
+ ob_start();
1722
  ?>
1723
+ <!-- Orbisius -->
1724
+ <div class="postbox">
1725
+ <h3><span>Curious about our other products?</span></h3>
1726
+ <div class="inside">
1727
+ Visit <a href="http://orbisius.com/products/" target="_blank">http://orbisius.com/products/</a>
1728
+ </div> <!-- .inside -->
1729
+ </div> <!-- .postbox -->
1730
+ <!-- /Orbisius -->
 
 
 
 
 
 
 
 
 
1731
  <?php
1732
+ $buff = ob_get_clean();
1733
+
1734
  if ($return) {
1735
  return $buff;
1736
  } else {
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
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.6
7
- Stable tag: 1.3.3
8
  License: GPLv2 or later
9
 
10
  Create Child Themes quickly and easily from any theme that you have currently installed on your site/blog.
@@ -18,6 +18,7 @@ It also creates rtl.css if exists in the parent theme.
18
 
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
@@ -114,6 +115,10 @@ n/a
114
  Just install the plugin and activate it. Then go to Admin > Appearance > Orbisius Child Theme Creator.
115
  Then click on a theme and the plugin will create a child theme for you.
116
 
 
 
 
 
117
  = How to disable Orbisius Theme Editor Plugin? =
118
  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.
119
 
@@ -151,6 +156,12 @@ Todo
151
 
152
  == Changelog ==
153
 
 
 
 
 
 
 
154
  = 1.3.3 =
155
  * Tested with WP 4.6
156
  * TODO: when saving return JSON and show an error on invalid syntax.
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.6
7
+ Stable tag: 1.3.4
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.
18
 
19
  = Child Theme Creator Features =
20
  * Create a theme with a click of a button
21
+ * Uses the recommended approach for loading css (since v.1.3.4)
22
  * Never forget what files to copy and what to skip when creating child themes.
23
  * Copies parent theme's options (since v.1.3)
24
  * Easy to use interface
115
  Just install the plugin and activate it. Then go to Admin > Appearance > Orbisius Child Theme Creator.
116
  Then click on a theme and the plugin will create a child theme for you.
117
 
118
+ = After my child theme is created can I remove the plugin safely? =
119
+ Yes, you can, however, the plugin comes with a double editor which is pretty awesome.
120
+ It allows you to copy and paste from one theme to another without changing screens.
121
+
122
  = How to disable Orbisius Theme Editor Plugin? =
123
  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.
124
 
156
 
157
  == Changelog ==
158
 
159
+ = 1.3.4 =
160
+ * Uses the recommended approach for loading css (since v.1.3.4)
161
+ * Fixes, updated FAQ
162
+ * Removed a notice about depricated function: https://wordpress.org/support/topic/depricated-functions-3/
163
+ * Removed some snippets that contained some 3rd party tracking info e.g. twitter's via or some user id to the addthis widget.
164
+
165
  = 1.3.3 =
166
  * Tested with WP 4.6
167
  * TODO: when saving return JSON and show an error on invalid syntax.