Child Theme Creator by Orbisius - Version 1.4.4

Version Description

  • Made the plugin more compatible with php v5.2. Why those hosting companies don't upgrade?
  • The child theme's folder is based on its name (if supplied)
Download this release

Release Info

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

Code changes from version 1.4.3 to 1.4.4

addons/clipboard/init.php CHANGED
@@ -1,9 +1,28 @@
1
  <?php
2
 
3
- $c = new orb_ctc_addon_clipboard();
4
  add_action('orbisius_child_theme_creator_admin_enqueue_scripts', array( $c, 'admin_enqueue_scripts' ) );
5
 
6
  class orb_ctc_addon_clipboard {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  function admin_enqueue_scripts() {
8
  wp_register_script( 'orb_ctc_addon_clipboard',
9
  apply_filters('orbisius_child_theme_creator_filter_asset_src', "addons/clipboard/share/clipboard-js/dist/clipboard.min.js"),
1
  <?php
2
 
3
+ $c = orb_ctc_addon_clipboard::get_instance();
4
  add_action('orbisius_child_theme_creator_admin_enqueue_scripts', array( $c, 'admin_enqueue_scripts' ) );
5
 
6
  class orb_ctc_addon_clipboard {
7
+ /**
8
+ * Singleton pattern i.e. we have only one instance of this obj
9
+ *
10
+ * @staticvar type $instance
11
+ * @return \cls
12
+ */
13
+ public static function get_instance() {
14
+ static $instance = null;
15
+
16
+ // This will make the calling class to be instantiated.
17
+ // no need each sub class to define this method.
18
+ if (is_null($instance)) {
19
+ // We do a late static binding. i.e. the instance is the subclass of this one.
20
+ $instance = new self(); // leave only this line and not the hack.
21
+ }
22
+
23
+ return $instance;
24
+ }
25
+
26
  function admin_enqueue_scripts() {
27
  wp_register_script( 'orb_ctc_addon_clipboard',
28
  apply_filters('orbisius_child_theme_creator_filter_asset_src', "addons/clipboard/share/clipboard-js/dist/clipboard.min.js"),
addons/cloud_lib/init.php CHANGED
@@ -1,4 +1,4 @@
1
  <?php
2
 
3
- require_once( __DIR__ . '/lib/snippet_lib.php' );
4
- require_once( __DIR__ . '/modules/cloud.php' );
1
  <?php
2
 
3
+ require_once( dirname(__FILE__) . '/lib/snippet_lib.php' );
4
+ require_once( dirname(__FILE__) . '/modules/cloud.php' );
lib/000_singleton.php DELETED
@@ -1,25 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Allows sub classes to have a convenient get_instance method.
5
- */
6
- class orbisius_child_theme_creator_singleton {
7
-
8
- /**
9
- * Singleton pattern i.e. we have only one instance of this obj
10
- *
11
- * @staticvar type $instance
12
- * @return \cls
13
- */
14
- public static function get_instance() {
15
- static $instance = null;
16
-
17
- // This will make the calling class to be instantiated.
18
- // no need each sub class to define this method.
19
- if (is_null($instance)) {
20
- $instance = new static();
21
- }
22
-
23
- return $instance;
24
- }
25
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/user.php CHANGED
@@ -1,10 +1,29 @@
1
  <?php
2
 
3
- class orbisius_child_theme_creator_user extends orbisius_child_theme_creator_singleton {
4
  private $api_meta_key = '_orb_ctc_cloud_api_key';
5
  private $meta_cloud_plan = '_orb_ctc_cloud_plan';
6
  private $meta_cloud_email = '_orb_ctc_cloud_email';
7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  /**
9
  *
10
  * @param str/opt $key
1
  <?php
2
 
3
+ class orbisius_child_theme_creator_user {
4
  private $api_meta_key = '_orb_ctc_cloud_api_key';
5
  private $meta_cloud_plan = '_orb_ctc_cloud_plan';
6
  private $meta_cloud_email = '_orb_ctc_cloud_email';
7
 
8
+ /**
9
+ * Singleton pattern i.e. we have only one instance of this obj
10
+ *
11
+ * @staticvar type $instance
12
+ * @return \cls
13
+ */
14
+ public static function get_instance() {
15
+ static $instance = null;
16
+
17
+ // This will make the calling class to be instantiated.
18
+ // no need each sub class to define this method.
19
+ if (is_null($instance)) {
20
+ // We do a late static binding. i.e. the instance is the subclass of this one.
21
+ $instance = new self(); // leave only this line and not the hack.
22
+ }
23
+
24
+ return $instance;
25
+ }
26
+
27
  /**
28
  *
29
  * @param str/opt $key
nbproject/private/private.xml CHANGED
@@ -140,10 +140,9 @@
140
  </group>
141
  <group>
142
  <file>file:/C:/Copy/Dropbox/cloud/projects/default/htdocs/wordpress313/wp-content/plugins/orbisius-child-theme-creator/readme.txt</file>
143
- <file>file:/C:/Copy/Dropbox/cloud/projects/default/htdocs/wordpress313/wp-content/plugins/orbisius-child-theme-creator/addons/cloud_lib/lib/snippet_lib.php</file>
144
- <file>file:/C:/Copy/Dropbox/cloud/projects/default/htdocs/wordpress313/wp-content/plugins/orbisius-child-theme-creator/addons/cloud_lib/modules/cloud.php</file>
145
  <file>file:/C:/Copy/Dropbox/cloud/projects/default/htdocs/wordpress313/wp-content/plugins/orbisius-child-theme-creator/addons/init.php</file>
146
- <file>file:/C:/Copy/Dropbox/cloud/projects/default/htdocs/wordpress313/wp-content/plugins/orbisius-child-theme-creator/orbisius-child-theme-creator.php</file>
147
  </group>
148
  </open-files>
149
  </project-private>
140
  </group>
141
  <group>
142
  <file>file:/C:/Copy/Dropbox/cloud/projects/default/htdocs/wordpress313/wp-content/plugins/orbisius-child-theme-creator/readme.txt</file>
143
+ <file>file:/C:/Copy/Dropbox/cloud/projects/default/htdocs/wordpress313/wp-content/plugins/orbisius-child-theme-creator/addons/clipboard/init.php</file>
 
144
  <file>file:/C:/Copy/Dropbox/cloud/projects/default/htdocs/wordpress313/wp-content/plugins/orbisius-child-theme-creator/addons/init.php</file>
145
+ <file>file:/C:/Copy/Dropbox/cloud/projects/default/htdocs/wordpress313/wp-content/plugins/orbisius-child-theme-creator/addons/cloud_lib/lib/snippet_lib.php</file>
146
  </group>
147
  </open-files>
148
  </project-private>
orbisius-child-theme-creator.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Orbisius Child Theme Creator
4
  Plugin URI: http://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.4.3
7
  Author: Svetoslav Marinov (Slavi)
8
  Author URI: http://orbisius.com
9
  */
@@ -25,7 +25,7 @@
25
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26
  */
27
 
28
- define( 'ORBISIUS_CHILD_THEME_CREATOR_BASE_DIR', __DIR__ );
29
  define( 'ORBISIUS_CHILD_THEME_CREATOR_MAIN_PLUGIN_FILE', __FILE__ );
30
 
31
  // Set up plugin
@@ -46,7 +46,6 @@ add_action( 'wp_ajax_nopriv_orbisius_ctc_theme_editor_ajax', 'orbisius_ctc_theme
46
 
47
  register_activation_hook( __FILE__, 'orbisius_child_theme_creator_on_activate' );
48
 
49
- require_once( ORBISIUS_CHILD_THEME_CREATOR_BASE_DIR . '/lib/000_singleton.php' );
50
  require_once( ORBISIUS_CHILD_THEME_CREATOR_BASE_DIR . '/lib/result.php' );
51
  require_once( ORBISIUS_CHILD_THEME_CREATOR_BASE_DIR . '/lib/user.php' );
52
 
@@ -845,7 +844,12 @@ function orbisius_child_theme_creator_tools_action() {
845
 
846
  if (empty($errors)) {
847
  try {
848
- $installer = new orbisius_child_theme_creator($parent_theme_base_dirname);
 
 
 
 
 
849
  $theme_setup_params = $installer->custom_info($child_custom_info);
850
 
851
  $installer->check_permissions();
@@ -1440,7 +1444,6 @@ function orbisius_child_theme_creator_add_plugin_credits() {
1440
  /**
1441
  */
1442
  class orbisius_child_theme_creator {
1443
-
1444
  public $result = null;
1445
  public $target_dir_path; // /var/www/vhosts/domain.com/www/wp-content/themes/Parent-Theme-child-01/
1446
 
@@ -1451,25 +1454,33 @@ class orbisius_child_theme_creator {
1451
  * @param str $parent_theme_basedir
1452
  */
1453
 
1454
- public function __construct($parent_theme_basedir = '') {
1455
  $all_themes_root = get_theme_root();
 
1456
 
1457
- $this->parent_theme_basedir = orbisius_child_theme_creator_util::sanitize_data( $parent_theme_basedir );
1458
  $this->parent_theme_dir = $all_themes_root . '/' . $this->parent_theme_basedir . '/';
1459
 
1460
- $i = 0;
 
 
 
 
1461
 
1462
  // Let's create multiple folders in case the script is run multiple times.
 
 
1463
  do {
 
 
1464
  $i++;
1465
- $target_dir = $all_themes_root . '/' . $parent_theme_basedir . '-child-theme-' . sprintf("%02d", $i) . '/';
1466
  } while (is_dir($target_dir));
1467
 
1468
  $this->target_dir_path = $target_dir;
1469
  $this->target_base_dirname = basename($target_dir);
1470
 
1471
  // this is appended to the new theme's name
1472
- $this->target_name_suffix = 'Child ' . sprintf("%02d", $i);
1473
  }
1474
 
1475
  /**
@@ -1791,9 +1802,9 @@ class orbisius_child_theme_creator {
1791
  public function create_file($file, $params = array() ) {
1792
  if ($file == 'functions.php') {
1793
  $parent_base_dir = $params['parent_theme_basedir'];
1794
- $func_prefix = $params['parent_theme_basedir'];
1795
- $func_prefix = strtolower( $func_prefix );
1796
- $func_prefix = 'orbisius_ctc_' . preg_replace( '#[^\w]+#si', '_', $func_prefix );
1797
  $func_prefix = trim( $func_prefix, '_' );
1798
 
1799
  $file_tpl = <<<BUFF_EOF
3
  Plugin Name: Orbisius Child Theme Creator
4
  Plugin URI: http://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.4.4
7
  Author: Svetoslav Marinov (Slavi)
8
  Author URI: http://orbisius.com
9
  */
25
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26
  */
27
 
28
+ define( 'ORBISIUS_CHILD_THEME_CREATOR_BASE_DIR', dirname(__FILE__) );
29
  define( 'ORBISIUS_CHILD_THEME_CREATOR_MAIN_PLUGIN_FILE', __FILE__ );
30
 
31
  // Set up plugin
46
 
47
  register_activation_hook( __FILE__, 'orbisius_child_theme_creator_on_activate' );
48
 
 
49
  require_once( ORBISIUS_CHILD_THEME_CREATOR_BASE_DIR . '/lib/result.php' );
50
  require_once( ORBISIUS_CHILD_THEME_CREATOR_BASE_DIR . '/lib/user.php' );
51
 
844
 
845
  if (empty($errors)) {
846
  try {
847
+ $init_data = [
848
+ 'parent_theme_base_dirname' => $parent_theme_base_dirname,
849
+ 'child_theme_name' => empty($child_custom_info['name']) ? '' : $child_custom_info['name'],
850
+ ];
851
+ $installer = new orbisius_child_theme_creator();
852
+ $installer->init($init_data);
853
  $theme_setup_params = $installer->custom_info($child_custom_info);
854
 
855
  $installer->check_permissions();
1444
  /**
1445
  */
1446
  class orbisius_child_theme_creator {
 
1447
  public $result = null;
1448
  public $target_dir_path; // /var/www/vhosts/domain.com/www/wp-content/themes/Parent-Theme-child-01/
1449
 
1454
  * @param str $parent_theme_basedir
1455
  */
1456
 
1457
+ public function init($init_data = array()) {
1458
  $all_themes_root = get_theme_root();
1459
+ $parent_theme_basedir = orbisius_child_theme_creator_util::sanitize_data( $init_data['parent_theme_base_dirname'] );
1460
 
1461
+ $this->parent_theme_basedir = $parent_theme_basedir;
1462
  $this->parent_theme_dir = $all_themes_root . '/' . $this->parent_theme_basedir . '/';
1463
 
1464
+ if (empty($init_data['child_theme_name'])) {
1465
+ $child_theme_dir = $parent_theme_basedir . '-child-theme';
1466
+ } else { // own dir based on the name the user has entered
1467
+ $child_theme_dir = sanitize_title($init_data['child_theme_name']);
1468
+ }
1469
 
1470
  // Let's create multiple folders in case the script is run multiple times.
1471
+ $i = 0;
1472
+
1473
  do {
1474
+ $suff = empty($i) ? '' : '_' . sprintf('%02d', $i);
1475
+ $target_dir = $all_themes_root . '/' . $child_theme_dir . $suff . '/';
1476
  $i++;
 
1477
  } while (is_dir($target_dir));
1478
 
1479
  $this->target_dir_path = $target_dir;
1480
  $this->target_base_dirname = basename($target_dir);
1481
 
1482
  // this is appended to the new theme's name
1483
+ $this->target_name_suffix = "Child theme of $parent_theme_basedir";
1484
  }
1485
 
1486
  /**
1802
  public function create_file($file, $params = array() ) {
1803
  if ($file == 'functions.php') {
1804
  $parent_base_dir = $params['parent_theme_basedir'];
1805
+ // this should be unique dir so use it for function
1806
+ $func_prefix = strtolower( $this->target_base_dirname );
1807
+ $func_prefix = 'orbisius_ct_' . preg_replace( '#[^\w]+#si', '_', $func_prefix );
1808
  $func_prefix = trim( $func_prefix, '_' );
1809
 
1810
  $file_tpl = <<<BUFF_EOF
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.8
7
- Stable tag: 1.4.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.
@@ -166,6 +166,10 @@ Todo
166
 
167
  == Changelog ==
168
 
 
 
 
 
169
  = 1.4.3 =
170
  * Removed some of the info about other plugins
171
  * Using old way of defining arrays e.g. array() and not [] because some hosts still run old php :(
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.8
7
+ Stable tag: 1.4.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.
166
 
167
  == Changelog ==
168
 
169
+ = 1.4.4 =
170
+ * Made the plugin more compatible with php v5.2. Why those hosting companies don't upgrade?
171
+ * The child theme's folder is based on its name (if supplied)
172
+
173
  = 1.4.3 =
174
  * Removed some of the info about other plugins
175
  * Using old way of defining arrays e.g. array() and not [] because some hosts still run old php :(