Child Theme Configurator - Version 1.5.0

Version Description

  • We have completely refactored CTC to use the WP_Filesystem API.
  • If your web host is configured to use suExec (meaning it runs under the user of the web account being accessed), the changes will be completely transparent.
  • Other configurations will now require user credentials to add, remove or update Child Theme files.
  • To make things easier we added the ability for you to make the files writable while editing and then make them read-only when you are done.
  • You can also set your credentials in wp-config.php: http://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants
  • Contact us at http://www.lilaeamedia.com/about/contact if you have any questions.
Download this release

Release Info

Developer lilaeamedia
Plugin Icon 128x128 Child Theme Configurator
Version 1.5.0
Comparing to
See all releases

Code changes from version 1.4.8.1 to 1.5.0

child-theme-configurator.php CHANGED
@@ -6,7 +6,7 @@ if ( !defined('ABSPATH')) exit;
6
  Plugin Name: Child Theme Configurator
7
  Plugin URI: http://www.lilaeamedia.com/plugins/child-theme-configurator/
8
  Description: Create a Child Theme from any installed Theme. Each CSS selector, rule and value can then be searched, previewed and modified.
9
- Version: 1.4.8.1
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
@@ -16,7 +16,7 @@ if ( !defined('ABSPATH')) exit;
16
  */
17
 
18
  defined('LF') or define('LF', "\n");
19
- define('CHLD_THM_CFG_VERSION', '1.4.8.1');
20
  define('CHLD_THM_CFG_MAX_SELECTORS', '50000');
21
  define('CHLD_THM_CFG_MAX_RECURSE_LOOPS', '1000');
22
 
6
  Plugin Name: Child Theme Configurator
7
  Plugin URI: http://www.lilaeamedia.com/plugins/child-theme-configurator/
8
  Description: Create a Child Theme from any installed Theme. Each CSS selector, rule and value can then be searched, previewed and modified.
9
+ Version: 1.5.0
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
16
  */
17
 
18
  defined('LF') or define('LF', "\n");
19
+ define('CHLD_THM_CFG_VERSION', '1.5.0');
20
  define('CHLD_THM_CFG_MAX_SELECTORS', '50000');
21
  define('CHLD_THM_CFG_MAX_RECURSE_LOOPS', '1000');
22
 
css/chld-thm-cfg.css CHANGED
@@ -220,4 +220,7 @@ a.nav-tab, a.nav-tab:focus, a.nav-tab:active {
220
  }
221
  .smaller {
222
  font-size: .85em;
 
 
 
223
  }
220
  }
221
  .smaller {
222
  font-size: .85em;
223
+ }
224
+ .writable {
225
+ color: red;
226
  }
includes/class-ctc-css.php CHANGED
@@ -6,7 +6,7 @@ if ( !defined('ABSPATH')) exit;
6
  Class: Child_Theme_Configurator_CSS
7
  Plugin URI: http://www.lilaeamedia.com/plugins/child-theme-configurator/
8
  Description: Handles all CSS output, parsing, normalization
9
- Version: 1.4.8.1
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
@@ -45,7 +45,7 @@ class Child_Theme_Configurator_CSS {
45
 
46
  function __construct($parent = '') {
47
  // scalars
48
- $this->version = '1.4.8.1';
49
  $this->querykey = 0;
50
  $this->selkey = 0;
51
  $this->qskey = 0;
@@ -116,7 +116,7 @@ class Child_Theme_Configurator_CSS {
116
  $this->get_raw_css($template);
117
  return $this->styles;
118
  endswitch;
119
- return false;
120
  }
121
 
122
  /*
@@ -126,7 +126,7 @@ class Child_Theme_Configurator_CSS {
126
  function set_prop($prop, $value) {
127
  if (is_scalar($this->{$prop}))
128
  $this->{$prop} = $value;
129
- else return false;
130
  }
131
 
132
  function get_raw_css($template = 'child') {
@@ -154,10 +154,10 @@ class Child_Theme_Configurator_CSS {
154
  }
155
 
156
  function get_child_target($file = 'style.css') {
157
- return get_theme_root() . '/' . $this->get_prop('child') . '/' . $file;
158
  }
159
  function get_parent_source($file = 'style.css') {
160
- return get_theme_root() . '/' . $this->get_prop('parnt') . '/' . $file;
161
  }
162
 
163
  /*
@@ -240,7 +240,7 @@ class Child_Theme_Configurator_CSS {
240
  function read_stylesheet($template = 'child', $file = 'style.css') {
241
  $source = $this->get_prop($template);
242
  $configtype = $this->get_prop('configtype');
243
- if (empty($source) || !is_scalar($source)) return false;
244
  $themedir = get_theme_root() . '/' . $source;
245
  $stylesheet = apply_filters('chld_thm_cfg_' . $template, $themedir . '/' . $file , $this);
246
 
@@ -252,7 +252,7 @@ class Child_Theme_Configurator_CSS {
252
  endif;
253
  }
254
 
255
- function recurse_directory($rootdir, $ext = 'css', $relative = false) {
256
  if (!$this->is_file_ok($rootdir, 'search')) return array(); // make sure we are only recursing theme and plugin files
257
  $files = array();
258
  $dirs = array($rootdir);
@@ -265,12 +265,15 @@ class Child_Theme_Configurator_CSS {
265
  $loops++;
266
  $dir = array_shift($dirs);
267
  if ($handle = opendir($dir)):
268
- while (false !== ($file = readdir($handle))):
269
  if (preg_match("/^\./", $file)) continue;
270
- $filepath = $dir . '/' . $file;
271
  if (is_dir($filepath)):
272
  array_unshift($dirs, $filepath);
273
- elseif (is_file($filepath) && preg_match("/\.".$ext."$/i", $filepath)):
 
 
 
274
  $files[] = $filepath;
275
  endif;
276
  endwhile;
@@ -301,11 +304,11 @@ class Child_Theme_Configurator_CSS {
301
  * Parse user form input into separate properties and pass to update_arrays
302
  */
303
  function parse_post_data() {
304
- $this->cache_updates = true;
305
  if (isset($_POST['ctc_new_selectors'])):
306
  $this->styles = $this->parse_css_input(LF . $_POST['ctc_new_selectors']);
307
  $this->parse_css('child',
308
- (isset($_POST['ctc_sel_ovrd_query'])?trim($_POST['ctc_sel_ovrd_query']):null), false);
309
  elseif (isset($_POST['ctc_child_imports'])):
310
  $this->imports['child'] = array();
311
  $this->styles = $this->parse_css_input($_POST['ctc_child_imports']);
@@ -421,7 +424,7 @@ class Child_Theme_Configurator_CSS {
421
  */
422
  function parse_css_file($template, $file = 'style.css') {
423
  global $chld_thm_cfg;
424
- $chld_thm_cfg->cache_updates = false;
425
  $this->read_stylesheet($template, $file);
426
  // get theme name
427
  $regex = '#Theme Name:\s*(.+?)\n#i';
@@ -435,9 +438,8 @@ class Child_Theme_Configurator_CSS {
435
  * parse_css
436
  * accepts raw CSS as text and parses into separate properties
437
  */
438
- function parse_css($template, $basequery = null, $parse_imports = true) {
439
- //echo $this->styles;
440
- if (false === strpos($basequery, '@')):
441
  $basequery = 'base';
442
  endif;
443
  $ruleset = array();
@@ -450,7 +452,7 @@ class Child_Theme_Configurator_CSS {
450
  global $chld_thm_cfg;
451
  $regex = '#(\@import.+?);#';
452
  preg_match_all($regex, $this->styles, $matches);
453
- foreach (preg_grep('#style\.css#', $matches[1], PREG_GREP_INVERT) as $import)
454
  $this->imports[$template][$import] = 1;
455
  if ($chld_thm_cfg->cache_updates):
456
  $chld_thm_cfg->updates[] = array(
@@ -482,7 +484,7 @@ class Child_Theme_Configurator_CSS {
482
  $this->update_arrays($template, $query, $sel);
483
  foreach (explode(';', $stuff) as $ruleval):
484
  if ($this->qskey > CHLD_THM_CFG_MAX_SELECTORS) break;
485
- if (false === strpos($ruleval, ':')) continue;
486
  list($rule, $value) = explode(':', $ruleval, 2);
487
  $rule = trim($rule);
488
  $rule = preg_replace_callback("/[^\w\-]/", array($this, 'to_ascii'), $rule);
@@ -511,12 +513,12 @@ class Child_Theme_Configurator_CSS {
511
  // normalize zero values
512
  $value = preg_replace('#([: ])0(px|r?em)#', "$1\0", $value);
513
  // normalize gradients
514
- if (false !== strpos($value, 'gradient')):
515
- if (false !== strpos($rule, 'filter')):
516
  $rule = 'background-image';
517
  continue; // treat as background-image, we'll add filter rule later
518
  endif;
519
- if (false !== strpos($value, 'webkit-gradient')) continue; // bail on legacy webkit, we'll add it later
520
  $value = $this->encode_gradient($value);
521
  endif;
522
  // normalize common vendor prefixes
@@ -535,7 +537,7 @@ class Child_Theme_Configurator_CSS {
535
  * @media query blocks are sorted using internal heuristics (see sort_queries)
536
  * New selectors are appended to the end of each media query block.
537
  */
538
- function write_css($backup = false) {
539
  // write new stylesheet
540
  $output = apply_filters('chld_thm_cfg_css_header', $this->get_css_header(), $this);
541
  $imports = $this->get_prop('imports');
@@ -584,17 +586,24 @@ class Child_Theme_Configurator_CSS {
584
  endforeach;
585
  $stylesheet = apply_filters('chld_thm_cfg_target', $this->get_child_target(), $this);
586
  if ($stylesheet_verified = $this->is_file_ok($stylesheet, 'write')):
587
- // backup current stylesheet
588
- if ($backup && is_file($stylesheet_verified)):
589
- $timestamp = date('YmdHis', current_time('timestamp'));
590
- $bakfile = preg_replace("/\.css$/", '', $stylesheet_verified) . '-' . $timestamp . '.css';
591
- if (false === file_put_contents($bakfile, file_get_contents($stylesheet_verified))) return false;
592
- endif;
593
- // write new stylesheet
594
- if (false === file_put_contents($stylesheet_verified, $output)) return false;
595
- return true;
 
 
 
 
 
 
 
596
  endif;
597
- return false;
598
  }
599
 
600
  /*
@@ -605,7 +614,7 @@ class Child_Theme_Configurator_CSS {
605
  */
606
  function add_vendor_rules($rule, $value, &$shorthand, $important = 0) {
607
  $rules = '';
608
- if ('filter' == $rule && (false !== strpos($value, 'progid:DXImageTransform.Microsoft.Gradient'))) return;
609
  $importantstr = $important ? ' !important' : '';
610
  if (preg_match("/^(margin|padding)\-(top|right|bottom|left)$/", $rule, $matches)):
611
  $shorthand[$matches[1]][$matches[2]] = $value . $importantstr;
@@ -662,7 +671,7 @@ class Child_Theme_Configurator_CSS {
662
  * normalized rule/value pairs for each property
663
  */
664
  function normalize_background($value, &$rules, &$values){
665
- if (false !== strpos($value, 'gradient')):
666
  // only supporting linear syntax
667
  if (preg_match('#(linear\-|Microsoft\.)#', $value)):
668
  $values[] = $value;
@@ -688,7 +697,7 @@ class Child_Theme_Configurator_CSS {
688
  $position = array();
689
  foreach(preg_split('/ +/', trim($parts[1])) as $part):
690
  if ('' === $part) continue; // empty($part) ||
691
- if (false === strpos($part, 'repeat')):
692
  $position[] = $part;
693
  else:
694
  $rules[] = 'background-repeat';
@@ -880,7 +889,7 @@ class Child_Theme_Configurator_CSS {
880
  'stop2' => empty($parts[4]) ? '' : $parts[4],
881
  );
882
  endif;
883
- return false;
884
  }
885
 
886
  /*
@@ -1028,6 +1037,7 @@ class Child_Theme_Configurator_CSS {
1028
  /*
1029
  * obj_to_utf8
1030
  * sets object data to UTF8
 
1031
  * and stringifies NULLs
1032
  */
1033
  function obj_to_utf8($data) {
@@ -1057,15 +1067,15 @@ class Child_Theme_Configurator_CSS {
1057
  function is_file_ok($stylesheet, $permission = 'read') {
1058
  // remove any ../ manipulations
1059
  $stylesheet = preg_replace("%\.\./%", '/', $stylesheet);
1060
- if ('read' == $permission && !is_file($stylesheet)) return false;
1061
- if ('search' == $permission && !is_dir($stylesheet)) return false;
1062
  // sanity check for php files
1063
- //if (!preg_match('%' . preg_quote($ext) . '$%', $stylesheet)) return false;
1064
  // check if in themes dir;
1065
  if (preg_match('%^' . preg_quote(get_theme_root()) . '%', $stylesheet)) return $stylesheet;
1066
  // check if in plugins dir
1067
  if (preg_match('%^' . preg_quote(WP_PLUGIN_DIR) . '%', $stylesheet)) return $stylesheet;
1068
- return false;
1069
  }
1070
  function normalize_color($value) {
1071
  return preg_replace("/#([0-9A-F])\\1([0-9A-F])\\2([0-9A-F])\\3/i",strtolower("#$1$2$3"), $value);
6
  Class: Child_Theme_Configurator_CSS
7
  Plugin URI: http://www.lilaeamedia.com/plugins/child-theme-configurator/
8
  Description: Handles all CSS output, parsing, normalization
9
+ Version: 1.5.0
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
45
 
46
  function __construct($parent = '') {
47
  // scalars
48
+ $this->version = '1.5.0';
49
  $this->querykey = 0;
50
  $this->selkey = 0;
51
  $this->qskey = 0;
116
  $this->get_raw_css($template);
117
  return $this->styles;
118
  endswitch;
119
+ return FALSE;
120
  }
121
 
122
  /*
126
  function set_prop($prop, $value) {
127
  if (is_scalar($this->{$prop}))
128
  $this->{$prop} = $value;
129
+ else return FALSE;
130
  }
131
 
132
  function get_raw_css($template = 'child') {
154
  }
155
 
156
  function get_child_target($file = 'style.css') {
157
+ return trailingslashit(get_theme_root()) . trailingslashit($this->get_prop('child')) . $file;
158
  }
159
  function get_parent_source($file = 'style.css') {
160
+ return trailingslashit(get_theme_root()) . trailingslashit($this->get_prop('parnt')) . $file;
161
  }
162
 
163
  /*
240
  function read_stylesheet($template = 'child', $file = 'style.css') {
241
  $source = $this->get_prop($template);
242
  $configtype = $this->get_prop('configtype');
243
+ if (empty($source) || !is_scalar($source)) return FALSE;
244
  $themedir = get_theme_root() . '/' . $source;
245
  $stylesheet = apply_filters('chld_thm_cfg_' . $template, $themedir . '/' . $file , $this);
246
 
252
  endif;
253
  }
254
 
255
+ function recurse_directory($rootdir, $ext = 'css', $all = FALSE) {
256
  if (!$this->is_file_ok($rootdir, 'search')) return array(); // make sure we are only recursing theme and plugin files
257
  $files = array();
258
  $dirs = array($rootdir);
265
  $loops++;
266
  $dir = array_shift($dirs);
267
  if ($handle = opendir($dir)):
268
+ while (FALSE !== ($file = readdir($handle))):
269
  if (preg_match("/^\./", $file)) continue;
270
+ $filepath = trailingslashit($dir) . $file;
271
  if (is_dir($filepath)):
272
  array_unshift($dirs, $filepath);
273
+ if ($all):
274
+ $files[] = $filepath;
275
+ endif;
276
+ elseif (is_file($filepath) && ($all || preg_match("/\.".$ext."$/i", $filepath))):
277
  $files[] = $filepath;
278
  endif;
279
  endwhile;
304
  * Parse user form input into separate properties and pass to update_arrays
305
  */
306
  function parse_post_data() {
307
+ $this->cache_updates = TRUE;
308
  if (isset($_POST['ctc_new_selectors'])):
309
  $this->styles = $this->parse_css_input(LF . $_POST['ctc_new_selectors']);
310
  $this->parse_css('child',
311
+ (isset($_POST['ctc_sel_ovrd_query'])?trim($_POST['ctc_sel_ovrd_query']):null), FALSE);
312
  elseif (isset($_POST['ctc_child_imports'])):
313
  $this->imports['child'] = array();
314
  $this->styles = $this->parse_css_input($_POST['ctc_child_imports']);
424
  */
425
  function parse_css_file($template, $file = 'style.css') {
426
  global $chld_thm_cfg;
427
+ $chld_thm_cfg->cache_updates = FALSE;
428
  $this->read_stylesheet($template, $file);
429
  // get theme name
430
  $regex = '#Theme Name:\s*(.+?)\n#i';
438
  * parse_css
439
  * accepts raw CSS as text and parses into separate properties
440
  */
441
+ function parse_css($template, $basequery = null, $parse_imports = TRUE) {
442
+ if (FALSE === strpos($basequery, '@')):
 
443
  $basequery = 'base';
444
  endif;
445
  $ruleset = array();
452
  global $chld_thm_cfg;
453
  $regex = '#(\@import.+?);#';
454
  preg_match_all($regex, $this->styles, $matches);
455
+ foreach (preg_grep('#' . $this->get_prop('parnt') . '\/style\.css#', $matches[1], PREG_GREP_INVERT) as $import)
456
  $this->imports[$template][$import] = 1;
457
  if ($chld_thm_cfg->cache_updates):
458
  $chld_thm_cfg->updates[] = array(
484
  $this->update_arrays($template, $query, $sel);
485
  foreach (explode(';', $stuff) as $ruleval):
486
  if ($this->qskey > CHLD_THM_CFG_MAX_SELECTORS) break;
487
+ if (FALSE === strpos($ruleval, ':')) continue;
488
  list($rule, $value) = explode(':', $ruleval, 2);
489
  $rule = trim($rule);
490
  $rule = preg_replace_callback("/[^\w\-]/", array($this, 'to_ascii'), $rule);
513
  // normalize zero values
514
  $value = preg_replace('#([: ])0(px|r?em)#', "$1\0", $value);
515
  // normalize gradients
516
+ if (FALSE !== strpos($value, 'gradient')):
517
+ if (FALSE !== strpos($rule, 'filter')):
518
  $rule = 'background-image';
519
  continue; // treat as background-image, we'll add filter rule later
520
  endif;
521
+ if (FALSE !== strpos($value, 'webkit-gradient')) continue; // bail on legacy webkit, we'll add it later
522
  $value = $this->encode_gradient($value);
523
  endif;
524
  // normalize common vendor prefixes
537
  * @media query blocks are sorted using internal heuristics (see sort_queries)
538
  * New selectors are appended to the end of each media query block.
539
  */
540
+ function write_css($backup = FALSE) {
541
  // write new stylesheet
542
  $output = apply_filters('chld_thm_cfg_css_header', $this->get_css_header(), $this);
543
  $imports = $this->get_prop('imports');
586
  endforeach;
587
  $stylesheet = apply_filters('chld_thm_cfg_target', $this->get_child_target(), $this);
588
  if ($stylesheet_verified = $this->is_file_ok($stylesheet, 'write')):
589
+ global $chld_thm_cfg, $wp_filesystem; // this was initialized earlier;
590
+ // backup current stylesheet
591
+ if ($backup && is_file($stylesheet_verified)):
592
+ $timestamp = date('YmdHis', current_time('timestamp'));
593
+ $bakfile = preg_replace("/\.css$/", '', $stylesheet_verified) . '-' . $timestamp . '.css';
594
+ // don't write new stylesheet if backup fails
595
+ if (!$wp_filesystem->copy($chld_thm_cfg->fspath($stylesheet_verified), $chld_thm_cfg->fspath($bakfile))) return FALSE;
596
+ endif;
597
+ // write new stylesheet:
598
+ // try direct write first, then wp_filesystem write
599
+ // stylesheet must already exist and be writable by web server
600
+ if (FALSE !== @file_put_contents($stylesheet_verified, $output)): //is_writable($stylesheet_verified) &&
601
+ return TRUE;
602
+ elseif (FALSE !== $wp_filesystem->put_contents($chld_thm_cfg->fspath($stylesheet_verified), $output)):
603
+ return TRUE;
604
+ endif;
605
  endif;
606
+ return FALSE;
607
  }
608
 
609
  /*
614
  */
615
  function add_vendor_rules($rule, $value, &$shorthand, $important = 0) {
616
  $rules = '';
617
+ if ('filter' == $rule && (FALSE !== strpos($value, 'progid:DXImageTransform.Microsoft.Gradient'))) return;
618
  $importantstr = $important ? ' !important' : '';
619
  if (preg_match("/^(margin|padding)\-(top|right|bottom|left)$/", $rule, $matches)):
620
  $shorthand[$matches[1]][$matches[2]] = $value . $importantstr;
671
  * normalized rule/value pairs for each property
672
  */
673
  function normalize_background($value, &$rules, &$values){
674
+ if (FALSE !== strpos($value, 'gradient')):
675
  // only supporting linear syntax
676
  if (preg_match('#(linear\-|Microsoft\.)#', $value)):
677
  $values[] = $value;
697
  $position = array();
698
  foreach(preg_split('/ +/', trim($parts[1])) as $part):
699
  if ('' === $part) continue; // empty($part) ||
700
+ if (FALSE === strpos($part, 'repeat')):
701
  $position[] = $part;
702
  else:
703
  $rules[] = 'background-repeat';
889
  'stop2' => empty($parts[4]) ? '' : $parts[4],
890
  );
891
  endif;
892
+ return FALSE;
893
  }
894
 
895
  /*
1037
  /*
1038
  * obj_to_utf8
1039
  * sets object data to UTF8
1040
+ * flattens to array
1041
  * and stringifies NULLs
1042
  */
1043
  function obj_to_utf8($data) {
1067
  function is_file_ok($stylesheet, $permission = 'read') {
1068
  // remove any ../ manipulations
1069
  $stylesheet = preg_replace("%\.\./%", '/', $stylesheet);
1070
+ if ('read' == $permission && !is_file($stylesheet)) return FALSE;
1071
+ if ('search' == $permission && !is_dir($stylesheet)) return FALSE;
1072
  // sanity check for php files
1073
+ //if (!preg_match('%' . preg_quote($ext) . '$%', $stylesheet)) return FALSE;
1074
  // check if in themes dir;
1075
  if (preg_match('%^' . preg_quote(get_theme_root()) . '%', $stylesheet)) return $stylesheet;
1076
  // check if in plugins dir
1077
  if (preg_match('%^' . preg_quote(WP_PLUGIN_DIR) . '%', $stylesheet)) return $stylesheet;
1078
+ return FALSE;
1079
  }
1080
  function normalize_color($value) {
1081
  return preg_replace("/#([0-9A-F])\\1([0-9A-F])\\2([0-9A-F])\\3/i",strtolower("#$1$2$3"), $value);
includes/class-ctc-ui.php CHANGED
@@ -5,7 +5,7 @@ if ( !defined('ABSPATH')) exit;
5
  Class: Child_Theme_Configurator_UI
6
  Plugin URI: http://www.lilaeamedia.com/plugins/child-theme-configurator/
7
  Description: Handles the plugin User Interface
8
- Version: 1.4.8.1
9
  Author: Lilaea Media
10
  Author URI: http://www.lilaeamedia.com/
11
  Text Domain: chld_thm_cfg
@@ -20,7 +20,7 @@ class Child_Theme_Configurator_UI {
20
 
21
  function __construct() {
22
  $this->swatch_text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
23
- $this->extLink = '<a href="http://www.lilaeamedia.com/total-wordpress-customization-pagecells-responsive-theme-framework/" target="_blank" title="' . __('Total WordPress Customization with PageCells Responsive Theme Framework', 'chld_thm_cfg') . '" style="float:right">' . __('Need a theme that gives you total control?', 'chld_thm_cfg') . '</a>';
24
  }
25
 
26
  function render_options() {
@@ -33,12 +33,16 @@ class Child_Theme_Configurator_UI {
33
  $hidechild = (count($themes['child']) ? '' : 'style="display:none"');
34
  $imports = $css->get_prop('imports');
35
  $id = 0;
 
36
  add_thickbox(); ?>
37
 
38
  <div class="wrap">
39
  <div id="icon-tools" class="icon32"></div>
40
  <?php echo $this->extLink; ?>
41
  <h2><?php echo $chld_thm_cfg->pluginName; ?> v.<?php echo CHLD_THM_CFG_VERSION;?></h2>
 
 
 
42
  <div id="ctc_error_notice">
43
  <?php $this->settings_errors(); ?>
44
  </div>
@@ -65,7 +69,7 @@ class Child_Theme_Configurator_UI {
65
  <?php _e('Parent CSS', 'chld_thm_cfg'); ?>
66
  </a>
67
  <?php
68
- if ('' == $hidechild && (empty($configtype) || 'theme' == $configtype)):
69
  ?>
70
  <a id="file_options" href="?page=<?php echo $chld_thm_cfg->menuName; ?>&amp;tab=file_options"
71
  class="nav-tab<?php echo 'file_options' == $active_tab ? ' nav-tab-active' : ''; ?>" <?php echo $hidechild; ?>>
@@ -73,6 +77,7 @@ class Child_Theme_Configurator_UI {
73
  </a>
74
  <?php
75
  endif;
 
76
  do_action('chld_thm_cfg_tabs', $chld_thm_cfg, $active_tab, $hidechild);?>
77
  <i id="ctc_status_preview"></i></h2>
78
  <div class="ctc-option-panel-container">
@@ -334,7 +339,7 @@ class Child_Theme_Configurator_UI {
334
  class="ctc-option-panel<?php echo 'view_child_options' == $active_tab ? ' ctc-option-panel-active' : ''; ?>" <?php echo $hidechild; ?>> </div>
335
  <div id="view_parnt_options_panel"
336
  class="ctc-option-panel<?php echo 'view_parnt_options' == $active_tab ? ' ctc-option-panel-active' : ''; ?>" <?php echo $hidechild; ?>> </div>
337
- <?php if ('' == $hidechild && (empty($configtype) || 'theme' == $configtype)): ?>
338
  <div id="file_options_panel"
339
  class="ctc-option-panel<?php echo 'file_options' == $active_tab ? ' ctc-option-panel-active' : ''; ?>" <?php echo $hidechild; ?>>
340
  <?php $this->render_file_form('parnt'); ?>
@@ -398,11 +403,30 @@ class Child_Theme_Configurator_UI {
398
  </div>
399
  </form>
400
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
401
  </div>
402
  <?php endif; ?>
403
  <?php do_action('chld_thm_cfg_panels', $chld_thm_cfg, $active_tab, $hidechild); ?>
404
- </div>
405
- </div>
 
406
  <style type="text/css">
407
  .ctc-status-icon.success {
408
  display: block;
@@ -427,17 +451,17 @@ class Child_Theme_Configurator_UI {
427
  }
428
 
429
  function render_file_form($template = 'parnt') {
430
- global $chld_thm_cfg;
431
  if ($theme = $chld_thm_cfg->css->get_prop($template)):
432
  $themeroot = get_theme_root() . '/' . $theme;
433
- $files = $chld_thm_cfg->css->recurse_directory($themeroot, 'php');
434
  $counter = 0;
435
  sort($files);
436
  ob_start();
437
  foreach ($files as $file):
438
- $templatefile = preg_replace('%(^' . preg_quote($themeroot) . '\/|\.php$)%', '', $file);
439
- if (preg_match('%^(inc|core|lang|css|js)%',$templatefile) || 'functions' == basename($templatefile)) continue; ?>
440
- <label class="ctc-input-cell smaller">
441
  <input class="ctc_checkbox" id="ctc_file_<?php echo $template . '_' . ++$counter; ?>"
442
  name="ctc_file_<?php echo $template; ?>[]" type="checkbox"
443
  value="<?php echo $templatefile; ?>" />
@@ -474,16 +498,25 @@ class Child_Theme_Configurator_UI {
474
  else:
475
  echo $editorlink . $linktext . $editorlinkend; ?></p>
476
  <p class="howto">
477
- <?php _e('Remove child theme templates by selecting them here.', 'chld_thm_cfg');
 
 
 
 
478
  endif; ?>
479
  </p>
480
  </div>
481
  <div class="ctc-input-cell-wide"> <?php echo $inputs; ?> </div>
482
  <div class="ctc-input-cell"> <strong>&nbsp;</strong> </div>
483
  <div class="ctc-input-cell-wide" style="margin-top:10px;margin-bottom:10px">
 
 
 
 
 
484
  <input class="ctc_submit button button-primary" id="ctc_<?php echo $template; ?>_templates_submit"
485
  name="ctc_<?php echo $template; ?>_templates_submit" type="submit"
486
- value="<?php echo ('parnt' == $template ? __('Copy Selected to Child Theme', 'chld_thm_cfg') : __('Remove Selected from Child Theme', 'chld_thm_cfg')); ?>" />
487
  </div>
488
  </form>
489
  </div>
@@ -495,14 +528,15 @@ class Child_Theme_Configurator_UI {
495
  function render_image_form() {
496
  global $chld_thm_cfg;
497
  if ($theme = $chld_thm_cfg->css->get_prop('child')):
498
- $themeroot = get_theme_root() . '/' . $theme . '/images';
499
- $themeuri = get_theme_root_uri() . '/' . $theme . '/images/';
500
- $files = $chld_thm_cfg->css->recurse_directory($themeroot, 'img');
 
501
  $counter = 0;
502
  sort($files);
503
  ob_start();
504
  foreach ($files as $file):
505
- $templatefile = preg_replace('%^' . preg_quote($themeroot) . '/%', '', $file); ?>
506
  <div class="ctc-input-cell" style="height:100px">
507
  <label class="smaller">
508
  <input class="ctc_checkbox" id="ctc_img_<?php echo ++$counter; ?>"
@@ -544,11 +578,11 @@ class Child_Theme_Configurator_UI {
544
  global $chld_thm_cfg;
545
  foreach (array_keys($chld_thm_cfg->imgmimes) as $extreg): foreach (explode('|', $extreg) as $ext):
546
  if ($screenshot = $chld_thm_cfg->css->is_file_ok($chld_thm_cfg->css->get_child_target('screenshot.' . $ext))):
547
- $screenshot = preg_replace('%^' . preg_quote(get_theme_root()) . '%', get_theme_root_uri(), $screenshot);
548
  return $screenshot . '?' . time();
549
  endif;
550
  endforeach; endforeach;
551
- return false;
552
  }
553
 
554
  function settings_errors() {
@@ -564,9 +598,11 @@ class Child_Theme_Configurator_UI {
564
  if ( 8 == $_GET['updated']):
565
  echo '<p>' . __('Child Theme files modified successfully.', 'chld_thm_cfg') . '</p>' . LF;
566
  else:
567
- echo '<p>' . apply_filters('chld_thm_cfg_update_msg', sprintf(__('Child Theme <strong>%s</strong> has been generated successfully.', 'chld_thm_cfg'),
 
568
  $chld_thm_cfg->css->get_prop('child_name')), $chld_thm_cfg) . LF
569
- . '</p>';
 
570
  endif;
571
  if ( 9 == $_GET['updated']) echo '<p>' . __('Please verify the imports below and remove any imports that are not needed by the front end, such as admin or configuration stylesheets.', 'chld_thm_cfg') . '</p>' . LF;
572
  echo '</div>' . LF;
@@ -603,7 +639,7 @@ class Child_Theme_Configurator_UI {
603
  <li>Enter an author for the child theme.</li>
604
  <li>Enter the child theme version number.</li>
605
  <li>If you check "Backup Stylesheet", The Child Theme Configurator will create a backup in the theme directory.</li>
606
- <li>If your theme uses additional stylesheets they will appear as checkbox options. Select only the stylesheets you wish to customize to reduce overhead.</li>
607
  <li>Click "Generate Child Theme."</li></ol>
608
  ', 'chld_thm_cfg'
609
  ),
@@ -649,10 +685,9 @@ class Child_Theme_Configurator_UI {
649
 
650
  $screen->add_help_tab( array(
651
  'id' => 'ctc_imports',
652
- 'title' => __( '@imports', 'chld_thm_cfg' ),
653
  'content' => __( '
654
  <p>You can add additional stylesheets and web fonts by typing @import rules into the textarea on the @import tab. <strong>Important: The Child Theme Configurator adds the @import rule that loads the Parent Theme\'s stylesheet automatically. Do not need to add it here.</strong></p>
655
- <p><strong>Important:</strong> If you chose "Scan Parent Theme for additional stylesheets," the Child Theme Configurator automically places @import rules for the additional stylesheets here. Be sure to delete any imports that are not needed by the front end, such as admin or configuration stylesheets.</p>
656
  <p>Below is an example that loads a local custom stylesheet (you would have to add the "fonts" directory and stylesheet) as well as the web font "Open Sans" from Google Web Fonts:</p>
657
  <blockquote><pre><code>
658
  @import url(fonts/stylesheet.css);
@@ -682,11 +717,25 @@ class Child_Theme_Configurator_UI {
682
  $screen->add_help_tab( array(
683
  'id' => 'ctc_preview',
684
  'title' => __( 'Preview and Activate', 'chld_thm_cfg' ),
685
- 'content' => __( '
686
- <p>Click the Child or Parent CSS tab to reference the stylesheet code. To preview the stylesheet as a WordPress theme follow these steps:</p>
687
  <ol><li>Navigate to Appearance > Themes in the WordPress Admin. You will now see the new Child Theme as one of the installed Themes.</li>
688
  <li>Click "Live Preview" below the new Child Theme to see it in action.</li>
689
  <li>When you are ready to take the Child Theme live, click "Activate."</li></ol>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
690
  ', 'chld_thm_cfg'
691
  ),
692
  ) );
@@ -698,7 +747,8 @@ class Child_Theme_Configurator_UI {
698
  <h5>Does it work with Plugins?</h5>
699
  <p>We offer a premium extension to let you easily modify styles for any WordPress Plugin installed on your website. The Child Theme Configurator Plugin Extension scans your plugins and allows you to create custom stylesheets in your Child Theme. <a href="http://www.lilaeamedia.com/plugins/child-theme-plugin-styles" title="Child Theme Configurator Extension">Learn more</a></p>
700
  <h5 id="doesnt_work">Why doesn’t this work with my (insert theme vendor here) theme?</h5>
701
- <p>Some themes (particularly commercial themes) do not adhere to the Theme Development guidelines set forth by WordPress.org, and do not automatically load child theme stylesheets or php files. This is unfortunate, because it effectively prohibits the webmaster from adding any customizations (other than those made through the admin theme options) that will survive past an upgrade.</p>
 
702
  <p>Contact the vendor directly to ask for this core functionality. It is our opinion that ALL themes (especially commercial ones) must pass the Theme Unit Tests outlined by WordPress.org.</p>
703
  <h5>Can I edit the Child Theme stylesheet manually offline or by using the Editor or do I have to use the Configurator?</h5>
704
  <p>You can make any manual changes you wish to the stylesheet. Just make sure you import the revised stylesheet using the Parent/Child panel or the Configurator will overwrite your changes the next time you use it. Just follow the steps as usual but select the "Use Existing Child Theme" radio button as the "Child Theme" option. The Configurator will automatically update its internal data from the new stylesheet.</p>
5
  Class: Child_Theme_Configurator_UI
6
  Plugin URI: http://www.lilaeamedia.com/plugins/child-theme-configurator/
7
  Description: Handles the plugin User Interface
8
+ Version: 1.5.0
9
  Author: Lilaea Media
10
  Author URI: http://www.lilaeamedia.com/
11
  Text Domain: chld_thm_cfg
20
 
21
  function __construct() {
22
  $this->swatch_text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
23
+ $this->extLink = '<a href="http://www.lilaeamedia.com/total-wordpress-customization-pagecells-responsive-theme-framework/" target="_blank" title="' . __('Total WordPress Customization with PageCells Responsive Theme Framework', 'chld_thm_cfg') . '" style="float:right"><img src="http://www.lilaeamedia.com/images/logos/pagecells-310.png" height="40" width="310" alt="PageCells Responsive Framework" /></a>';
24
  }
25
 
26
  function render_options() {
33
  $hidechild = (count($themes['child']) ? '' : 'style="display:none"');
34
  $imports = $css->get_prop('imports');
35
  $id = 0;
36
+ $chld_thm_cfg->fs_method = get_filesystem_method();
37
  add_thickbox(); ?>
38
 
39
  <div class="wrap">
40
  <div id="icon-tools" class="icon32"></div>
41
  <?php echo $this->extLink; ?>
42
  <h2><?php echo $chld_thm_cfg->pluginName; ?> v.<?php echo CHLD_THM_CFG_VERSION;?></h2>
43
+ <?php if ('POST' == $_SERVER['REQUEST_METHOD'] && !$chld_thm_cfg->fs):
44
+ echo $chld_thm_cfg->fs_prompt;
45
+ else: ?>
46
  <div id="ctc_error_notice">
47
  <?php $this->settings_errors(); ?>
48
  </div>
69
  <?php _e('Parent CSS', 'chld_thm_cfg'); ?>
70
  </a>
71
  <?php
72
+ if ('' == $hidechild): // && (empty($configtype) || 'theme' == $configtype)):
73
  ?>
74
  <a id="file_options" href="?page=<?php echo $chld_thm_cfg->menuName; ?>&amp;tab=file_options"
75
  class="nav-tab<?php echo 'file_options' == $active_tab ? ' nav-tab-active' : ''; ?>" <?php echo $hidechild; ?>>
77
  </a>
78
  <?php
79
  endif;
80
+
81
  do_action('chld_thm_cfg_tabs', $chld_thm_cfg, $active_tab, $hidechild);?>
82
  <i id="ctc_status_preview"></i></h2>
83
  <div class="ctc-option-panel-container">
339
  class="ctc-option-panel<?php echo 'view_child_options' == $active_tab ? ' ctc-option-panel-active' : ''; ?>" <?php echo $hidechild; ?>> </div>
340
  <div id="view_parnt_options_panel"
341
  class="ctc-option-panel<?php echo 'view_parnt_options' == $active_tab ? ' ctc-option-panel-active' : ''; ?>" <?php echo $hidechild; ?>> </div>
342
+ <?php if ('' == $hidechild): // && (empty($configtype) || 'theme' == $configtype)): ?>
343
  <div id="file_options_panel"
344
  class="ctc-option-panel<?php echo 'file_options' == $active_tab ? ' ctc-option-panel-active' : ''; ?>" <?php echo $hidechild; ?>>
345
  <?php $this->render_file_form('parnt'); ?>
403
  </div>
404
  </form>
405
  </div>
406
+ <?php if ('direct' != $chld_thm_cfg->fs_method): ?>
407
+ <div class="ctc-input-row clearfix" id="input_row_permissions">
408
+ <form id="ctc_permission_form" method="post" action="?page=<?php echo $chld_thm_cfg->menuName; ?>&amp;tab=file_options">
409
+ <?php wp_nonce_field( 'ctc_update' ); ?>
410
+ <div class="ctc-input-cell"> <strong>
411
+ <?php _e('Secure Child Theme', 'chld_thm_cfg'); ?>
412
+ </strong>
413
+ <p class="howto">
414
+ <?php _e('Attempt to reset child theme permissions to user ownership and read-only access.', 'chld_thm_cfg'); ?>
415
+ </p>
416
+ </div>
417
+ <div class="ctc-input-cell-wide">
418
+ <input class="ctc_submit button button-primary" id="ctc_reset_permission"
419
+ name="ctc_reset_permission" type="submit"
420
+ value="<?php _e('Make read-only', 'chld_thm_cfg'); ?>" />
421
+ </div>
422
+ </form>
423
+ </div><?php endif; ?>
424
  </div>
425
  <?php endif; ?>
426
  <?php do_action('chld_thm_cfg_panels', $chld_thm_cfg, $active_tab, $hidechild); ?>
427
+ </div><?php
428
+ endif;
429
+ ?></div>
430
  <style type="text/css">
431
  .ctc-status-icon.success {
432
  display: block;
451
  }
452
 
453
  function render_file_form($template = 'parnt') {
454
+ global $chld_thm_cfg, $wp_filesystem;
455
  if ($theme = $chld_thm_cfg->css->get_prop($template)):
456
  $themeroot = get_theme_root() . '/' . $theme;
457
+ $files = $chld_thm_cfg->css->recurse_directory(trailingslashit(get_theme_root()) . $theme, 'php');
458
  $counter = 0;
459
  sort($files);
460
  ob_start();
461
  foreach ($files as $file):
462
+ $templatefile = preg_replace('%\.php$%', '', $chld_thm_cfg->theme_basename($theme, $file));
463
+ if ('parnt' == $template && (preg_match('%^(inc|core|lang|css|js)%',$templatefile) || 'functions' == basename($templatefile))) continue; ?>
464
+ <label class="ctc-input-cell smaller<?php echo 'child' == $template && !$chld_thm_cfg->fs && is_writable($file) ? ' writable' : ''; ?>">
465
  <input class="ctc_checkbox" id="ctc_file_<?php echo $template . '_' . ++$counter; ?>"
466
  name="ctc_file_<?php echo $template; ?>[]" type="checkbox"
467
  value="<?php echo $templatefile; ?>" />
498
  else:
499
  echo $editorlink . $linktext . $editorlinkend; ?></p>
500
  <p class="howto">
501
+ <?php if ($chld_thm_cfg->fs):
502
+ _e('Delete child theme templates by selecting them here.', 'chld_thm_cfg');
503
+ else:
504
+ _e('Delete child theme templates or make them writable by selecting them here. Writable files are displayed in <span style="color:red">red</span>.', 'chld_thm_cfg');
505
+ endif;
506
  endif; ?>
507
  </p>
508
  </div>
509
  <div class="ctc-input-cell-wide"> <?php echo $inputs; ?> </div>
510
  <div class="ctc-input-cell"> <strong>&nbsp;</strong> </div>
511
  <div class="ctc-input-cell-wide" style="margin-top:10px;margin-bottom:10px">
512
+ <?php if ('child' == $template && !$chld_thm_cfg->fs): ?>
513
+ <input class="ctc_submit button button-primary" id="ctc_templates_writable_submit"
514
+ name="ctc_templates_writable_submit" type="submit"
515
+ value="<?php _e('Make Selected Writable', 'chld_thm_cfg'); ?>" />&nbsp; &nbsp;
516
+ <?php endif; ?>
517
  <input class="ctc_submit button button-primary" id="ctc_<?php echo $template; ?>_templates_submit"
518
  name="ctc_<?php echo $template; ?>_templates_submit" type="submit"
519
+ value="<?php echo ('parnt' == $template ? __('Copy Selected to Child Theme', 'chld_thm_cfg') : __('Delete Selected', 'chld_thm_cfg')); ?>" />
520
  </div>
521
  </form>
522
  </div>
528
  function render_image_form() {
529
  global $chld_thm_cfg;
530
  if ($theme = $chld_thm_cfg->css->get_prop('child')):
531
+ $imgdir = trailingslashit($theme) . 'images';
532
+ $themeuri = trailingslashit(get_theme_root_uri()) . trailingslashit($imgdir);
533
+ $files = $chld_thm_cfg->css->recurse_directory(trailingslashit(get_theme_root()) . $imgdir, 'img');
534
+
535
  $counter = 0;
536
  sort($files);
537
  ob_start();
538
  foreach ($files as $file):
539
+ $templatefile = $chld_thm_cfg->theme_basename($imgdir, $file); ?>
540
  <div class="ctc-input-cell" style="height:100px">
541
  <label class="smaller">
542
  <input class="ctc_checkbox" id="ctc_img_<?php echo ++$counter; ?>"
578
  global $chld_thm_cfg;
579
  foreach (array_keys($chld_thm_cfg->imgmimes) as $extreg): foreach (explode('|', $extreg) as $ext):
580
  if ($screenshot = $chld_thm_cfg->css->is_file_ok($chld_thm_cfg->css->get_child_target('screenshot.' . $ext))):
581
+ $screenshot = trailingslashit(get_theme_root_uri()) . $chld_thm_cfg->theme_basename('', $screenshot);
582
  return $screenshot . '?' . time();
583
  endif;
584
  endforeach; endforeach;
585
+ return FALSE;
586
  }
587
 
588
  function settings_errors() {
598
  if ( 8 == $_GET['updated']):
599
  echo '<p>' . __('Child Theme files modified successfully.', 'chld_thm_cfg') . '</p>' . LF;
600
  else:
601
+ echo '<p>' . apply_filters('chld_thm_cfg_update_msg', sprintf(__('Child Theme <strong>%s</strong> has been generated successfully.
602
+ ', 'chld_thm_cfg'),
603
  $chld_thm_cfg->css->get_prop('child_name')), $chld_thm_cfg) . LF
604
+ //. (1 == $_GET['updated'] && 'direct' != $chld_thm_cfg->fs_method ? '<br/>' . __( 'To enable Child Theme Configurator for editing, the stylesheet has been made writable. You can change this back when you are finished editing for security by clicking "Make read-only" under the "Files" tab.', 'chld_thm_cfg') : '')
605
+ . '<strong>IMPORTANT: <a href="http://www.lilaeamedia.com/plugins/child-theme-configurator/#preview_activate">Test your child theme</a> before activating.</strong></p>';
606
  endif;
607
  if ( 9 == $_GET['updated']) echo '<p>' . __('Please verify the imports below and remove any imports that are not needed by the front end, such as admin or configuration stylesheets.', 'chld_thm_cfg') . '</p>' . LF;
608
  echo '</div>' . LF;
639
  <li>Enter an author for the child theme.</li>
640
  <li>Enter the child theme version number.</li>
641
  <li>If you check "Backup Stylesheet", The Child Theme Configurator will create a backup in the theme directory.</li>
642
+ <li>If your theme uses additional stylesheets they will appear as checkbox options when you open the toggle arrow. Select only the stylesheets you wish to customize to reduce overhead. Remember to select them again if you reload your configuration.</li>
643
  <li>Click "Generate Child Theme."</li></ol>
644
  ', 'chld_thm_cfg'
645
  ),
685
 
686
  $screen->add_help_tab( array(
687
  'id' => 'ctc_imports',
688
+ 'title' => __( '@imports and Web Fonts', 'chld_thm_cfg' ),
689
  'content' => __( '
690
  <p>You can add additional stylesheets and web fonts by typing @import rules into the textarea on the @import tab. <strong>Important: The Child Theme Configurator adds the @import rule that loads the Parent Theme\'s stylesheet automatically. Do not need to add it here.</strong></p>
 
691
  <p>Below is an example that loads a local custom stylesheet (you would have to add the "fonts" directory and stylesheet) as well as the web font "Open Sans" from Google Web Fonts:</p>
692
  <blockquote><pre><code>
693
  @import url(fonts/stylesheet.css);
717
  $screen->add_help_tab( array(
718
  'id' => 'ctc_preview',
719
  'title' => __( 'Preview and Activate', 'chld_thm_cfg' ),
720
+ 'content' => __( '<p><strong>IMPORTANT: <a target="_blank" href="http://www.lilaeamedia.com/plugins/child-theme-configurator/#preview_activate" title="Test your child theme before activating!">Test your child theme before activating!</a></strong> Some themes (particularly commercial themes) do not adhere to the Theme Development guidelines set forth by WordPress.org, and do not correctly load parent template files or automatically load child theme stylesheets or php files. <strong>In the worst cases they will break your website when you activate the child theme.</strong></p>
 
721
  <ol><li>Navigate to Appearance > Themes in the WordPress Admin. You will now see the new Child Theme as one of the installed Themes.</li>
722
  <li>Click "Live Preview" below the new Child Theme to see it in action.</li>
723
  <li>When you are ready to take the Child Theme live, click "Activate."</li></ol>
724
+ <p>You can also click the Child or Parent CSS tab to reference the stylesheet code.</p>
725
+ ', 'chld_thm_cfg'
726
+ ),
727
+ ) );
728
+
729
+ $screen->add_help_tab( array(
730
+ 'id' => 'ctc_permissions',
731
+ 'title' => __( 'File Permissions', 'chld_thm_cfg' ),
732
+ 'content' => __( '
733
+ <p>WordPress was designed to work on a number of server configurations. Child Theme Configurator uses the WordPress Filesystem API to allow changes to sites that require user permission to edit files.</p><p>However, because most of the functionality occurs via AJAX (background) requests, the child theme stylesheet must be writable by the web server.</p><p>The plugin will automatically detect your configuration and provide a number of options to resolve this requirement. Use the links provided to find out more about the options available, including:</p>
734
+ <ol><li>Temporarily making the stylesheet writable through the plugin.</li>
735
+ <li>Adding your FTP/SSH credentials to the WordPress config file.</li>
736
+ <li>Setting the stylesheet write permissions on the server manually</li>
737
+ <li>Configuring your web server to allow write access in certain situations.</li>
738
+ </ol>
739
  ', 'chld_thm_cfg'
740
  ),
741
  ) );
747
  <h5>Does it work with Plugins?</h5>
748
  <p>We offer a premium extension to let you easily modify styles for any WordPress Plugin installed on your website. The Child Theme Configurator Plugin Extension scans your plugins and allows you to create custom stylesheets in your Child Theme. <a href="http://www.lilaeamedia.com/plugins/child-theme-plugin-styles" title="Child Theme Configurator Extension">Learn more</a></p>
749
  <h5 id="doesnt_work">Why doesn’t this work with my (insert theme vendor here) theme?</h5>
750
+ <p>Some themes (particularly commercial themes) do not adhere to the Theme Development guidelines set forth by WordPress.org, and do not correctly load parent template files or automatically load child theme stylesheets or php files.</p>
751
+ <p>This is unfortunate, because in the best case they effectively prohibit the webmaster from adding any customizations (other than those made through the admin theme options) that will survive past an upgrade. <strong>In the worst case they will break your website when you activate the child theme.</strong></p>
752
  <p>Contact the vendor directly to ask for this core functionality. It is our opinion that ALL themes (especially commercial ones) must pass the Theme Unit Tests outlined by WordPress.org.</p>
753
  <h5>Can I edit the Child Theme stylesheet manually offline or by using the Editor or do I have to use the Configurator?</h5>
754
  <p>You can make any manual changes you wish to the stylesheet. Just make sure you import the revised stylesheet using the Parent/Child panel or the Configurator will overwrite your changes the next time you use it. Just follow the steps as usual but select the "Use Existing Child Theme" radio button as the "Child Theme" option. The Configurator will automatically update its internal data from the new stylesheet.</p>
includes/class-ctc.php CHANGED
@@ -6,7 +6,7 @@ if ( !defined('ABSPATH')) exit;
6
  Class: Child_Theme_Configurator
7
  Plugin URI: http://www.lilaeamedia.com/plugins/child-theme-configurator/
8
  Description: Main Controller Class
9
- Version: 1.4.8.1
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
@@ -31,17 +31,21 @@ class Child_Theme_Configurator {
31
  var $hook;
32
  var $is_ajax;
33
  var $updated;
34
- var $updates = array();
35
  var $cache_updates;
36
  var $uploadsubdir;
37
- var $imgmimes = array();
 
 
 
 
 
38
 
39
  function __construct($file) {
40
  $this->dir = dirname( $file );
41
  $this->optionsName = 'chld_thm_cfg_options';
42
  $this->menuName = 'chld_thm_cfg_menu';
43
  $lang_dir = $this->dir . '/lang';
44
- load_plugin_textdomain('chld_thm_cfg', false, $lang_dir, $lang_dir);
45
 
46
  $this->pluginName = __('Child Theme Configurator', 'chld_thm_cfg');
47
  $this->shortName = __('Child Themes', 'chld_thm_cfg');
@@ -52,14 +56,18 @@ class Child_Theme_Configurator {
52
  'gif' => 'image/gif',
53
  'png' => 'image/png',
54
  );
55
- $this->cache_updates = true;
 
 
 
 
 
 
56
  // setup plugin hooks
57
  add_action('admin_menu', array(&$this, 'admin_menu'));
58
  add_action('admin_enqueue_scripts', array(&$this, 'enqueue_scripts'));
59
  add_action('wp_ajax_ctc_update', array(&$this, 'ajax_save_postdata' ));
60
  add_action('wp_ajax_ctc_query', array(&$this, 'ajax_query_css' ));
61
- add_action('chld_thm_cfg_addl_files', array(&$this, 'add_functions_file'), 10, 2);
62
- add_action('chld_thm_cfg_addl_files', array(&$this, 'copy_screenshot'), 10, 2);
63
  //add_action('update_option_' . $this->optionsName, array(&$this, 'update_redirect'), 10);
64
  }
65
 
@@ -77,7 +85,7 @@ class Child_Theme_Configurator {
77
  // wp_enqueue_script('thickbox');
78
  wp_enqueue_script('ctc-thm-cfg-ctcgrad', $this->pluginURL . 'js/ctcgrad.min.js', array('iris'), '1.0');
79
  wp_enqueue_script('chld-thm-cfg-admin', $this->pluginURL . 'js/chld-thm-cfg.min.js',
80
- array('jquery-ui-autocomplete'), '1.0', true);
81
  wp_localize_script( 'chld-thm-cfg-admin', 'ctcAjax',
82
  apply_filters('chld_thm_cfg_localize_script', array(
83
  'ajaxurl' => admin_url( 'admin-ajax.php' ),
@@ -152,12 +160,13 @@ class Child_Theme_Configurator {
152
  function validate_post($action = 'ctc_update', $noncefield = '_wpnonce') {
153
  return ('POST' == $_SERVER['REQUEST_METHOD']
154
  && current_user_can('edit_theme_options')
155
- && ($this->is_ajax ? check_ajax_referer( $action, $noncefield, false ) : check_admin_referer($action, $noncefield, false )));
156
  }
157
 
158
  function ajax_save_postdata() {
159
- $this->is_ajax = true;
160
  if ($this->validate_post()):
 
161
  $this->load_config();
162
  $this->css->parse_post_data();
163
  $this->css->write_css();
@@ -171,7 +180,7 @@ class Child_Theme_Configurator {
171
  }
172
 
173
  function ajax_query_css() {
174
- $this->is_ajax = true;
175
  if ($this->validate_post()):
176
  $this->load_config();
177
  $regex = "/^ctc_query_/";
@@ -198,12 +207,23 @@ class Child_Theme_Configurator {
198
  || !is_object($this->css)
199
  || ! $this->check_theme_exists($this->css->get_prop('child'))
200
  || ! $this->check_theme_exists($this->css->get_prop('parnt'))
201
- // upgrade to v.1.1.1
202
  || !($version = $this->css->get_prop('version'))
203
  ):
204
  $parent = get_template();
205
  $this->css = new Child_Theme_Configurator_CSS($parent);
206
  endif;
 
 
 
 
 
 
 
 
 
 
 
 
207
  }
208
 
209
  function write_config() {
@@ -213,115 +233,151 @@ class Child_Theme_Configurator {
213
  && !isset($_POST['ctc_image_submit'])
214
  && !isset($_POST['ctc_theme_image_submit'])
215
  && !isset($_POST['ctc_theme_screenshot_submit'])
216
- && !isset($_POST['ctc_export_child_zip'])) return false;
 
 
 
217
  $this->errors = array();
218
- if ($this->validate_post()): //current_user_can('install_themes')): // && $this->validate_post()):
219
- if (isset($_POST['ctc_load_styles'])):
220
- foreach (array(
221
- 'ctc_theme_parnt',
222
- 'ctc_child_type',
223
- 'ctc_theme_child',
224
- 'ctc_child_name',
225
- 'ctc_configtype',
226
- 'ctc_child_template',
227
- 'ctc_child_author',
228
- 'ctc_child_version') as $postfield):
229
- $varparts = explode('_', $postfield);
230
- $varname = end($varparts);
231
- ${$varname} = empty($_POST[$postfield])?'':sanitize_text_field($_POST[$postfield]);
232
- endforeach;
233
- if ($parnt):
234
- if (! $this->check_theme_exists($parnt)):
235
- $this->errors[] = sprintf(__('%s does not exist. Please select a valid Parent Theme', 'chld_thm_cfg'), $parnt);
236
- endif;
237
- else:
238
- $this->errors[] = __('Please select a valid Parent Theme', 'chld_thm_cfg');
239
- endif;
240
- if ('new' == $type):
241
- if (empty($template) && empty($name)):
242
- $this->errors[] = __('Please enter a valid Child Theme template name', 'chld_thm_cfg');
243
- else:
244
- $configtype = 'theme'; // no custom stylesheets until style.css exists!
245
- $child = strtolower(preg_replace("%[^\w\-]%", '', empty($template) ? $name : $template));
246
- if ($this->check_theme_exists($child)):
247
- $this->errors[] = sprintf(__('<strong>%s</strong> exists. Please enter a different Child Theme template name', 'chld_thm_cfg'), $child);
248
- endif;
249
- endif;
250
- endif;
251
- if (empty($name)):
252
- $name = ucfirst($child);
253
- endif;
254
- if (empty($child)):
255
- $this->errors[] = __('Please enter a valid Child Theme name', 'chld_thm_cfg');
256
  endif;
 
 
257
 
258
- if (false === $this->verify_child_theme($child)):
259
- $this->errors[] = __('Your theme directories are not writable. Please adjust permissions and try again.', 'chld_thm_cfg');
260
- endif;
261
- if (empty($this->errors)):
262
- $this->css = new Child_Theme_Configurator_CSS();
263
- $this->css->set_prop('parnt', $parnt);
264
- $this->css->set_prop('child', $child);
265
- $this->css->set_prop('child_name', $name);
266
- $this->css->set_prop('child_author', $author);
267
- $this->css->set_prop('child_version', strlen($version) ? $version : '1.0');
268
- $this->css->set_prop('configtype', $configtype);
269
- do_action('chld_thm_cfg_addl_files', $this); // hook for add'l plugin files and subdirectories
270
- $this->css->parse_css_file('parnt');
271
- $this->css->parse_css_file('child');
272
- if (isset($_POST['ctc_additional_css']) && is_array($_POST['ctc_additional_css'])):
273
- foreach ($_POST['ctc_additional_css'] as $file):
274
- $this->css->parse_css_file('parnt', $file);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
275
  endforeach;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
276
  endif;
277
- if (false === $this->css->write_css(isset($_POST['ctc_backup']))):
278
- $this->errors[] = __('Your stylesheet is not writable. Please adjust permissions and try again.', 'chld_thm_cfg');
279
- return false;
280
- endif;
281
- update_option($this->optionsName, $this->css);
282
- do_action('chld_thm_cfg_addl_options', $this); // hook for add'l plugin options
283
- $msg = 1; //isset($_POST['ctc_scan_subdirs']) ? '9&tab=import_options' : 1;
284
  endif;
285
- elseif (isset($_POST['ctc_parnt_templates_submit']) && isset($_POST['ctc_file_parnt'])):
286
- foreach ($_POST['ctc_file_parnt'] as $file):
287
- $this->copy_parent_file(sanitize_text_field($file));
288
- endforeach;
289
- $msg = '8&tab=file_options';
290
- elseif (isset($_POST['ctc_child_templates_submit']) && isset($_POST['ctc_file_child'])):
291
- foreach ($_POST['ctc_file_child'] as $file):
292
- $this->delete_child_file(sanitize_text_field($file));
293
- endforeach;
294
- $msg = '8&tab=file_options';
295
- elseif (isset($_POST['ctc_image_submit']) && isset($_POST['ctc_img'])):
296
- foreach ($_POST['ctc_img'] as $file):
297
-
298
- $this->delete_child_file('images/' . sanitize_text_field($file), 'img');
299
- endforeach;
300
- $msg = '8&tab=file_options';
301
- elseif (isset($_POST['ctc_theme_image_submit']) && isset($_FILES['ctc_theme_image'])):
302
- $this->handle_file_upload('ctc_theme_image', 'images', $this->imgmimes);
303
- $msg = '8&tab=file_options';
304
- elseif (isset($_POST['ctc_theme_screenshot_submit']) && isset($_FILES['ctc_theme_screenshot'])):
305
- // remove old screenshot
306
- foreach(array_keys($this->imgmimes) as $extreg): foreach (explode('|', $extreg) as $ext):
307
- $this->delete_child_file('screenshot', $ext);
308
- endforeach; endforeach;
309
- $this->handle_file_upload('ctc_theme_screenshot', NULL, $this->imgmimes);
310
- $msg = '8&tab=file_options';
311
- elseif (isset($_POST['ctc_export_child_zip'])):
312
- $this->export_zip();
313
- $this->errors[] = __('Zip file creation failed.', 'chld_thm_cfg');
314
- else:
315
- $msg = '8&tab=file_options';
316
  endif;
317
- else:
318
- $this->errors[] = __('You do not have permission to configure child themes.', 'chld_thm_cfg');
319
- endif;
320
- if (empty($this->errors)):
321
- $this->update_redirect($msg);
322
  endif;
323
- return false;
324
- //$this->errors[] = sprintf(__('Child Theme %s was unchanged.', 'chld_thm_cfg'), $name, $this->optionsName);
325
  }
326
 
327
  function render_menu($template = 'child', $selected = null) {
@@ -351,26 +407,41 @@ class Child_Theme_Configurator {
351
  endif;
352
  }
353
 
354
- function verify_child_theme($child) {
355
- $themedir = get_theme_root();
356
- if (! is_writable($themedir)) return false;
357
- $childdir = $themedir . '/' . $child;
358
-
359
- if (! is_dir($childdir)):
360
- if (! mkdir($childdir, 0755)):
361
- return false;
 
 
 
 
 
 
 
 
362
  endif;
363
- elseif (! is_writable($childdir)):
364
- return false;
365
- endif;
366
  }
367
 
368
- function add_functions_file($obj){
 
 
369
  // add functions.php file
370
- $file = $obj->css->is_file_ok($obj->css->get_child_target('functions.php'), 'write');
371
- if ($file && !file_exists($file)):
372
- if (false === file_put_contents($file,
373
- "<?php\n// Exit if accessed directly\nif ( !defined('ABSPATH')) exit;\n\n/* Add custom functions below */")) return false;
 
 
 
 
 
 
374
  endif;
375
  }
376
 
@@ -380,81 +451,214 @@ class Child_Theme_Configurator {
380
  }
381
 
382
  function copy_parent_file($file, $ext = 'php') {
 
 
383
  $parent_file = NULL;
384
  if ('screenshot' == $file):
385
- foreach (array_keys($this->imgmimes) as $extreg): foreach(explode('|', $extreg) as $ext):
386
- if ($parent_file = $this->css->is_file_ok($this->css->get_parent_source('screenshot.' . $ext))) break;
387
- endforeach; endforeach;
388
- else:
389
- $parent_file = $this->css->is_file_ok($this->css->get_parent_source($file . '.' . $ext));
390
- endif;
391
- $child_file = $this->css->get_child_target($file . '.' . $ext);
392
-
393
- if ($parent_file && $child_file && !file_exists($child_file)):
394
- $childdir = dirname($child_file);
395
- if (! is_dir($childdir)):
396
- if (! @mkdir($childdir, 0755, true)):
397
- return false;
398
  endif;
399
- elseif (! is_writable($childdir)):
400
- return false;
401
- endif;
402
- if (false === file_put_contents($child_file,
403
- @file_get_contents($parent_file))) return false;
404
  endif;
 
 
 
 
 
 
 
 
 
 
405
  }
406
 
407
  function delete_child_file($file, $ext = 'php') {
 
 
408
  // verify file is in child theme and exists before removing.
409
  $file = ('img' == $ext ? $file : $file . '.' . $ext);
410
- $child_file = $this->css->get_child_target($file);
411
- if ($this->css->is_file_ok($child_file, 'write') && file_exists($child_file)):
412
- if (false === @unlink($child_file)) return false;
413
  endif;
414
-
415
-
416
  }
417
 
418
  function get_additional_css($parnt) {
419
- $themedir = get_theme_root() . '/' . $parnt;
420
  $files = array();
421
- foreach ($this->css->recurse_directory($themedir) as $file):
422
- $file = preg_replace('%^' . preg_quote($themedir) . '\/%', '', $file);
423
  if ('style.css' != $file) $files[] = $file;
424
  endforeach;
425
  return $files;
426
  }
427
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
428
 
429
  function handle_file_upload($field, $childdir = NULL, $mimes = NULL){
430
-
431
- $this->uploadsubdir = $childdir ? '/' . $childdir : NULL;
432
  $uploadedfile = $_FILES[$field];
433
  $upload_overrides = array(
434
- 'test_form' => false,
435
- 'unique_filename_callback' => ($childdir ? NULL : array($this, 'set_filename')),
436
  'mimes' => (is_array($mimes) ? $mimes : NULL)
437
  );
438
- add_filter('upload_dir', array($this, 'upload_dir'));
439
  if ( ! function_exists( 'wp_handle_upload' ) ) require_once( ABSPATH . 'wp-admin/includes/file.php' );
440
  $movefile = wp_handle_upload( $uploadedfile, $upload_overrides );
441
- if (isset($movefile['error'])) $this->errors[] = $movefile['error'];
442
- remove_filter('upload_dir', array($this, 'upload_dir'));
443
-
 
 
444
  }
445
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
446
  function export_zip() {
447
  if (($child = $this->css->get_prop('child'))
448
  && ($dir = $this->css->is_file_ok(dirname($this->css->get_child_target()), 'search'))
449
  && ($version = preg_replace("%[^\w\.\-]%", '', $this->css->get_prop('version')))):
450
- if (!file_exists($this->pluginPath . 'tmp')) mkdir($this->pluginPath . 'tmp', 0755);
451
- $file = $this->pluginPath . 'tmp/' . $child . '-' . $version . '.zip';
 
452
  mbstring_binary_safe_encoding();
453
 
454
  require_once(ABSPATH . 'wp-admin/includes/class-pclzip.php');
455
 
456
  $archive = new PclZip($file);
457
- if ($archive->create($dir, PCLZIP_OPT_REMOVE_PATH, dirname($dir)) == 0) return false;
458
  reset_mbstring_encoding();
459
  header( 'Content-Description: File Transfer' );
460
  header( 'Content-Type: application/octet-stream' );
@@ -468,25 +672,108 @@ class Child_Theme_Configurator {
468
  die();
469
  endif;
470
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
471
 
472
- function upload_dir($uploads) {
473
- $filename = basename($uploads['path']);
474
- $basedir = get_theme_root() . '/' . $this->css->get_prop('child');
475
- $baseurl = get_theme_root_uri() . '/' . $this->css->get_prop('child');
476
- $dir = $basedir . $this->uploadsubdir;
477
- $url = $baseurl . $this->uploadsubdir;
478
- $uploads = array(
479
- 'path' => $dir,
480
- 'url' => $url,
481
- 'subdir' => $this->uploadsubdir,
482
- 'basedir' => $basedir,
483
- 'baseurl' => $baseurl,
484
- 'error' => false,
485
- );
486
- return $uploads;
487
  }
488
 
489
- function set_filename($dir, $basename, $ext) {
490
- return 'screenshot' . $ext;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
491
  }
492
  }
6
  Class: Child_Theme_Configurator
7
  Plugin URI: http://www.lilaeamedia.com/plugins/child-theme-configurator/
8
  Description: Main Controller Class
9
+ Version: 1.5.0
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
31
  var $hook;
32
  var $is_ajax;
33
  var $updated;
 
34
  var $cache_updates;
35
  var $uploadsubdir;
36
+ var $fs;
37
+ var $fs_prompt;
38
+ var $fs_method;
39
+ var $postarrays;
40
+ var $imgmimes;
41
+ var $updates;
42
 
43
  function __construct($file) {
44
  $this->dir = dirname( $file );
45
  $this->optionsName = 'chld_thm_cfg_options';
46
  $this->menuName = 'chld_thm_cfg_menu';
47
  $lang_dir = $this->dir . '/lang';
48
+ load_plugin_textdomain('chld_thm_cfg', FALSE, $lang_dir, $lang_dir);
49
 
50
  $this->pluginName = __('Child Theme Configurator', 'chld_thm_cfg');
51
  $this->shortName = __('Child Themes', 'chld_thm_cfg');
56
  'gif' => 'image/gif',
57
  'png' => 'image/png',
58
  );
59
+ $this->postarrays = array(
60
+ 'ctc_img',
61
+ 'ctc_file_parnt',
62
+ 'ctc_file_child',
63
+ );
64
+ $this->updates = array();
65
+ $this->cache_updates = TRUE;
66
  // setup plugin hooks
67
  add_action('admin_menu', array(&$this, 'admin_menu'));
68
  add_action('admin_enqueue_scripts', array(&$this, 'enqueue_scripts'));
69
  add_action('wp_ajax_ctc_update', array(&$this, 'ajax_save_postdata' ));
70
  add_action('wp_ajax_ctc_query', array(&$this, 'ajax_query_css' ));
 
 
71
  //add_action('update_option_' . $this->optionsName, array(&$this, 'update_redirect'), 10);
72
  }
73
 
85
  // wp_enqueue_script('thickbox');
86
  wp_enqueue_script('ctc-thm-cfg-ctcgrad', $this->pluginURL . 'js/ctcgrad.min.js', array('iris'), '1.0');
87
  wp_enqueue_script('chld-thm-cfg-admin', $this->pluginURL . 'js/chld-thm-cfg.min.js',
88
+ array('jquery-ui-autocomplete'), '1.0', TRUE);
89
  wp_localize_script( 'chld-thm-cfg-admin', 'ctcAjax',
90
  apply_filters('chld_thm_cfg_localize_script', array(
91
  'ajaxurl' => admin_url( 'admin-ajax.php' ),
160
  function validate_post($action = 'ctc_update', $noncefield = '_wpnonce') {
161
  return ('POST' == $_SERVER['REQUEST_METHOD']
162
  && current_user_can('edit_theme_options')
163
+ && ($this->is_ajax ? check_ajax_referer( $action, $noncefield, FALSE ) : check_admin_referer($action, $noncefield, FALSE )));
164
  }
165
 
166
  function ajax_save_postdata() {
167
+ $this->is_ajax = TRUE;
168
  if ($this->validate_post()):
169
+ $this->verify_creds();
170
  $this->load_config();
171
  $this->css->parse_post_data();
172
  $this->css->write_css();
180
  }
181
 
182
  function ajax_query_css() {
183
+ $this->is_ajax = TRUE;
184
  if ($this->validate_post()):
185
  $this->load_config();
186
  $regex = "/^ctc_query_/";
207
  || !is_object($this->css)
208
  || ! $this->check_theme_exists($this->css->get_prop('child'))
209
  || ! $this->check_theme_exists($this->css->get_prop('parnt'))
 
210
  || !($version = $this->css->get_prop('version'))
211
  ):
212
  $parent = get_template();
213
  $this->css = new Child_Theme_Configurator_CSS($parent);
214
  endif;
215
+ if ('POST' != $_SERVER['REQUEST_METHOD']):
216
+ if ($this->css->get_prop('child')):
217
+ $this->verify_creds();
218
+ $stylesheet = $this->css->get_child_target('style.css');
219
+ if (!is_writable($stylesheet) && !$this->fs):
220
+ add_action('admin_notices', array($this, 'writable_notice'));
221
+ endif;
222
+ endif;
223
+ if (fileowner($this->css->get_child_target('')) != fileowner(ABSPATH)):
224
+ add_action('admin_notices', array($this, 'owner_notice'));
225
+ endif;
226
+ endif;
227
  }
228
 
229
  function write_config() {
233
  && !isset($_POST['ctc_image_submit'])
234
  && !isset($_POST['ctc_theme_image_submit'])
235
  && !isset($_POST['ctc_theme_screenshot_submit'])
236
+ && !isset($_POST['ctc_export_child_zip'])
237
+ && !isset($_POST['ctc_reset_permission'])
238
+ && !isset($_POST['ctc_templates_writable_submit'])
239
+ && !isset($_POST['ctc_set_writable'])) return FALSE;
240
  $this->errors = array();
241
+ if ($this->validate_post()):
242
+ if (isset($_POST['ctc_export_child_zip'])):
243
+ $this->export_zip();
244
+ $this->errors[] = __('Zip file creation failed.', 'chld_thm_cfg');
245
+ else:
246
+ if (isset($_POST['ctc_theme_image_submit']) && isset($_FILES['ctc_theme_image'])):
247
+ $this->handle_file_upload('ctc_theme_image', $this->imgmimes);
248
+ elseif (isset($_POST['ctc_theme_screenshot_submit']) && isset($_FILES['ctc_theme_screenshot'])):
249
+ $this->handle_file_upload('ctc_theme_screenshot', $this->imgmimes);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
250
  endif;
251
+ $args = preg_grep("/nonce/", array_keys($_POST), PREG_GREP_INVERT);
252
+ $this->verify_creds($args);
253
 
254
+ if ($this->fs):
255
+ if (isset($_POST['ctc_load_styles'])):
256
+ foreach (array(
257
+ 'ctc_theme_parnt',
258
+ 'ctc_child_type',
259
+ 'ctc_theme_child',
260
+ 'ctc_child_name',
261
+ 'ctc_configtype',
262
+ 'ctc_child_template',
263
+ 'ctc_child_author',
264
+ 'ctc_child_version') as $postfield):
265
+ $varparts = explode('_', $postfield);
266
+ $varname = end($varparts);
267
+ ${$varname} = empty($_POST[$postfield])?'':sanitize_text_field($_POST[$postfield]);
268
+ endforeach;
269
+ if ($parnt):
270
+ if (! $this->check_theme_exists($parnt)):
271
+ $this->errors[] = sprintf(__('%s does not exist. Please select a valid Parent Theme', 'chld_thm_cfg'), $parnt);
272
+ endif;
273
+ else:
274
+ $this->errors[] = __('Please select a valid Parent Theme', 'chld_thm_cfg');
275
+ endif;
276
+ if ('new' == $type):
277
+ if (empty($template) && empty($name)):
278
+ $this->errors[] = __('Please enter a valid Child Theme template name', 'chld_thm_cfg');
279
+ else:
280
+ $configtype = 'theme'; // no custom stylesheets until style.css exists!
281
+ add_action('chld_thm_cfg_addl_files', array(&$this, 'add_base_files'), 10, 2);
282
+ add_action('chld_thm_cfg_addl_files', array(&$this, 'copy_screenshot'), 10, 2);
283
+ $child = strtolower(preg_replace("%[^\w\-]%", '', empty($template) ? $name : $template));
284
+ if ($this->check_theme_exists($child)):
285
+ $this->errors[] = sprintf(__('<strong>%s</strong> exists. Please enter a different Child Theme template name', 'chld_thm_cfg'), $child);
286
+ endif;
287
+ endif;
288
+ elseif (empty($configtype) || 'theme' == $configtype):
289
+ add_action('chld_thm_cfg_addl_files', array(&$this, 'add_base_files'), 10, 2);
290
+ add_action('chld_thm_cfg_addl_files', array(&$this, 'copy_screenshot'), 10, 2);
291
+ elseif(has_action('chld_thm_cfg_addl_files')):
292
+ remove_all_actions('chld_thm_cfg_addl_files');
293
+ // back compat for plugins extension
294
+ add_action('chld_thm_cfg_addl_files', array(&$this, 'write_addl_files'), 10, 2);
295
+ endif;
296
+ if (empty($name)):
297
+ $name = ucfirst($child);
298
+ endif;
299
+ if (empty($child)):
300
+ $this->errors[] = __('Please enter a valid Child Theme name', 'chld_thm_cfg');
301
+ endif;
302
+ if (FALSE === $this->verify_child_dir($child)):
303
+ $this->errors[] = __('Your theme directories are not writable.', 'chld_thm_cfg');
304
+ add_action('admin_notices', array($this, 'writable_notice'));
305
+ endif;
306
+ if (empty($this->errors)):
307
+ $this->css = new Child_Theme_Configurator_CSS();
308
+ $this->css->set_prop('parnt', $parnt);
309
+ $this->css->set_prop('child', $child);
310
+ $this->css->set_prop('child_name', $name);
311
+ $this->css->set_prop('child_author', $author);
312
+ $this->css->set_prop('child_version', strlen($version) ? $version : '1.0');
313
+ $this->css->set_prop('configtype', $configtype);
314
+ do_action('chld_thm_cfg_addl_files', $this); // hook for add'l plugin files and subdirectories
315
+ $this->css->parse_css_file('parnt');
316
+ $this->css->parse_css_file('child');
317
+ if (isset($_POST['ctc_additional_css']) && is_array($_POST['ctc_additional_css'])):
318
+ foreach ($_POST['ctc_additional_css'] as $file):
319
+ $this->css->parse_css_file('parnt', $file);
320
+ endforeach;
321
+ endif;
322
+ if (FALSE === $this->css->write_css(isset($_POST['ctc_backup']))):
323
+ $this->errors[] = __('Your stylesheet is not writable.', 'chld_thm_cfg');
324
+ add_action('admin_notices', array($this, 'writable_notice'));
325
+ return FALSE;
326
+ endif;
327
+ update_option($this->optionsName, $this->css);
328
+ do_action('chld_thm_cfg_addl_options', $this); // hook for add'l plugin options
329
+ $msg = 1; //isset($_POST['ctc_scan_subdirs']) ? '9&tab=import_options' : 1;
330
+ endif;
331
+ elseif (isset($_POST['ctc_parnt_templates_submit']) && isset($_POST['ctc_file_parnt'])):
332
+ foreach ($_POST['ctc_file_parnt'] as $file):
333
+ $this->copy_parent_file(sanitize_text_field($file));
334
+ endforeach;
335
+ $msg = '8&tab=file_options';
336
+ elseif (isset($_POST['ctc_child_templates_submit']) && isset($_POST['ctc_file_child'])):
337
+ foreach ($_POST['ctc_file_child'] as $file):
338
+ $this->delete_child_file(sanitize_text_field($file));
339
+ endforeach;
340
+ $msg = '8&tab=file_options';
341
+ elseif (isset($_POST['ctc_image_submit']) && isset($_POST['ctc_img'])):
342
+ foreach ($_POST['ctc_img'] as $file):
343
+ $this->delete_child_file('images/' . sanitize_text_field($file), 'img');
344
  endforeach;
345
+ $msg = '8&tab=file_options';
346
+ elseif (isset($_POST['ctc_templates_writable_submit']) && isset($_POST['ctc_file_child'])):
347
+ foreach ($_POST['ctc_file_child'] as $file):
348
+ $this->set_writable(sanitize_text_field($file));
349
+ endforeach;
350
+ $msg = '8&tab=file_options';
351
+ elseif (isset($_POST['ctc_set_writable'])):
352
+ $this->set_writable();
353
+ $msg = '8&tab=file_options';
354
+ elseif (isset($_POST['ctc_reset_permission'])):
355
+ $this->unset_writable();
356
+ $msg = '8&tab=file_options';
357
+ elseif (isset($_POST['ctc_theme_image_submit']) && isset($_POST['movefile'])):
358
+ $this->move_file_upload('images');
359
+ $msg = '8&tab=file_options';
360
+ elseif (isset($_POST['ctc_theme_screenshot_submit']) && isset($_POST['movefile'])):
361
+ // remove old screenshot
362
+ foreach(array_keys($this->imgmimes) as $extreg):
363
+ foreach (explode('|', $extreg) as $ext):
364
+ $this->delete_child_file('screenshot', $ext);
365
+ endforeach;
366
+ endforeach;
367
+ $this->move_file_upload('');
368
+ $msg = '8&tab=file_options';
369
+ else:
370
+ $msg = '8&tab=file_options';
371
  endif;
 
 
 
 
 
 
 
372
  endif;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
373
  endif;
374
+ if (empty($this->errors) && empty($this->fs_prompt)):
375
+ $this->update_redirect($msg);
376
+ endif;
377
+ return FALSE;
 
378
  endif;
379
+ $this->errors[] = __('You do not have permission to configure child themes.', 'chld_thm_cfg');
380
+ return FALSE;
381
  }
382
 
383
  function render_menu($template = 'child', $selected = null) {
407
  endif;
408
  }
409
 
410
+ function verify_child_dir($path) {
411
+ if (!$this->fs) return FALSE; // return if no filesystem access
412
+ global $wp_filesystem;
413
+ $themedir = $wp_filesystem->find_folder(get_theme_root());
414
+ if (! $wp_filesystem->is_writable($themedir)) return FALSE;
415
+ $childparts = explode('/', wp_normalize_path($path));
416
+ while (count($childparts)):
417
+ $subdir = array_shift($childparts);
418
+ if (empty($subdir)) continue;
419
+ $themedir = trailingslashit($themedir) . $subdir;
420
+ if (! $wp_filesystem->is_dir($themedir)):
421
+ if (! $wp_filesystem->mkdir($themedir, FS_CHMOD_DIR)):
422
+ return FALSE;
423
+ endif;
424
+ elseif (! $wp_filesystem->is_writable($themedir)):
425
+ return FALSE;
426
  endif;
427
+ endwhile;
428
+ return TRUE;
 
429
  }
430
 
431
+ function add_base_files($obj){
432
+ if (!$this->fs) return FALSE; // return if no filesystem access
433
+ global $wp_filesystem;
434
  // add functions.php file
435
+ $contents = "<?php\n// Exit if accessed directly\nif ( !defined('ABSPATH')) exit;\n\n/* Add custom functions below */";
436
+ if (FALSE === $this->write_child_file('functions.php', $contents) || FALSE === $this->write_child_file('style.css', $this->css->get_css_header())) return FALSE;
437
+ }
438
+
439
+ function write_child_file($file, $contents) {
440
+ if (!$this->fs) return FALSE; // return if no filesystem access
441
+ global $wp_filesystem;
442
+ $file = $this->fspath($this->css->is_file_ok($this->css->get_child_target($file), 'write'));
443
+ if ($file && !$wp_filesystem->exists($file)):
444
+ if (FALSE === $wp_filesystem->put_contents($file, $contents)) return FALSE;
445
  endif;
446
  }
447
 
451
  }
452
 
453
  function copy_parent_file($file, $ext = 'php') {
454
+ if (!$this->fs) return FALSE; // return if no filesystem access
455
+ global $wp_filesystem;
456
  $parent_file = NULL;
457
  if ('screenshot' == $file):
458
+ foreach (array_keys($this->imgmimes) as $extreg):
459
+ foreach(explode('|', $extreg) as $ext):
460
+ if ($parent_file = $this->css->is_file_ok($this->css->get_parent_source('screenshot.' . $ext))) break;
461
+ endforeach;
462
+ if ($parent_file):
463
+ $parent_file = $this->fspath($parent_file);
464
+ break;
 
 
 
 
 
 
465
  endif;
466
+ endforeach;
467
+ else:
468
+ $parent_file = $this->fspath($this->css->is_file_ok($this->css->get_parent_source($file . '.' . $ext)));
 
 
469
  endif;
470
+ // get child theme + file + ext (passing empty string and full child path to theme_basename )
471
+ $child_file = $this->css->get_child_target($file . '.' . $ext);
472
+ // return true if file already exists
473
+ if ($wp_filesystem->exists($this->fspath($child_file))) return TRUE;
474
+ $child_dir = dirname($this->theme_basename('', $child_file));
475
+ if ($parent_file // sanity check
476
+ && $child_file // sanity check
477
+ && $this->verify_child_dir($child_dir) //create child subdir if necessary
478
+ && $wp_filesystem->copy($parent_file, $this->fspath($child_file), FS_CHMOD_FILE)) return TRUE;
479
+ $this->errors[] = __('Could not copy file.', 'chld_thm_cfg');
480
  }
481
 
482
  function delete_child_file($file, $ext = 'php') {
483
+ if (!$this->fs) return FALSE; // return if no filesystem access
484
+ global $wp_filesystem;
485
  // verify file is in child theme and exists before removing.
486
  $file = ('img' == $ext ? $file : $file . '.' . $ext);
487
+ $child_file = $this->fspath($this->css->is_file_ok($this->css->get_child_target($file), 'write'));
488
+ if ($wp_filesystem->exists($child_file)):
489
+ if (!$wp_filesystem->delete($child_file)) return FALSE;
490
  endif;
 
 
491
  }
492
 
493
  function get_additional_css($parnt) {
 
494
  $files = array();
495
+ foreach ($this->css->recurse_directory(trailingslashit(get_theme_root()) . $parnt) as $file):
496
+ $file = $this->theme_basename($parnt, $file);
497
  if ('style.css' != $file) $files[] = $file;
498
  endforeach;
499
  return $files;
500
  }
501
 
502
+ function theme_basename($theme, $file) {
503
+ // if no theme passed, returns theme + file
504
+ $themedir = trailingslashit(get_theme_root()) . ('' == $theme ? '' : trailingslashit($theme));
505
+ return preg_replace('%^' . preg_quote($themedir) . '%', '', $file);
506
+ }
507
+
508
+ function uploads_basename($file) {
509
+ $file = wp_normalize_path($file);
510
+ $uplarr = wp_upload_dir();
511
+ $upldir = trailingslashit($uplarr['basedir']);
512
+ return preg_replace('%^' . preg_quote($upldir) . '%', '', $file);
513
+ }
514
+
515
+ function uploads_fullpath($file) {
516
+ $file = wp_normalize_path($file);
517
+ $uplarr = wp_upload_dir();
518
+ $upldir = trailingslashit($uplarr['basedir']);
519
+ return $upldir . $file;
520
+ }
521
+
522
+ function serialize_postarrays() {
523
+ foreach ($this->postarrays as $field)
524
+ if (isset($_POST[$field]) && is_array($_POST[$field]))
525
+ $_POST[$field] = implode("%%", $_POST[$field]);
526
+ }
527
+
528
+ function unserialize_postarrays() {
529
+ foreach ($this->postarrays as $field)
530
+ if (isset($_POST[$field]) && !is_array($_POST[$field]))
531
+ $_POST[$field] = explode("%%", $_POST[$field]);
532
+ }
533
+
534
+ function set_writable($file = NULL) {
535
+
536
+ $file = isset($file) ? $this->css->get_child_target($file . '.php') : apply_filters('chld_thm_cfg_target', $this->css->get_child_target(), $this->css);
537
+ if ($this->fs): // filesystem access
538
+ global $wp_filesystem;
539
+ if ($file && $wp_filesystem->chmod($this->fspath($file), 0666)) return;
540
+ endif;
541
+ $this->errors[] = __('Could not set write permissions.', 'chld_thm_cfg');
542
+ add_action('admin_notices', array($this, 'writable_notice'));
543
+ return FALSE;
544
+ }
545
+
546
+ function unset_writable() {
547
+ if (!$this->fs) return FALSE; // return if no filesystem access
548
+ global $wp_filesystem;
549
+ $dir = untrailingslashit($this->css->get_child_target(''));
550
+ $child = $this->theme_basename('', $dir);
551
+ $newchild = untrailingslashit($child) . '-new';
552
+ $themedir = trailingslashit(get_theme_root());
553
+ $fsthemedir = $this->fspath($themedir);
554
+ // is child theme owned by user?
555
+ if (fileowner($dir) == fileowner(ABSPATH)):
556
+ $copy = FALSE;
557
+ $wp_filesystem->chmod($dir);
558
+ // recursive chmod (as user)
559
+ // WP_Filesystem RECURSIVE CHMOD IS FLAWED! IT SETS ALL CHILDREN TO PERM OF OUTERMOST DIR
560
+ //if ($wp_filesystem->chmod($this->fspath($dir), FALSE, TRUE)):
561
+ //endif;
562
+ else:
563
+ $copy = TRUE;
564
+ endif;
565
+ // n -> copy entire folder (as user)
566
+ $files = $this->css->recurse_directory($dir, NULL, TRUE);
567
+ $errors = array();
568
+ foreach ($files as $file):
569
+ $childfile = $this->theme_basename($child, wp_normalize_path($file));
570
+ $newfile = trailingslashit($newchild) . $childfile;
571
+ $childpath = $fsthemedir . trailingslashit($child) . $childfile;
572
+ $newpath = $fsthemedir . $newfile;
573
+ if ($copy):
574
+ if ($this->verify_child_dir(is_dir($file)?$newfile:dirname($newfile))):
575
+ if (is_file($file) && !$wp_filesystem->copy($childpath, $newpath)):
576
+ $errors[] = 'could not copy ' . $newpath;
577
+ endif;
578
+ else:
579
+ $errors[] = 'invalid dir: ' . $newfile;
580
+ endif;
581
+ else:
582
+ $wp_filesystem->chmod($this->fspath($file));
583
+ endif;
584
+ endforeach;
585
+ if ($copy):
586
+ // verify copy (as webserver)
587
+ $newfiles = $this->css->recurse_directory(trailingslashit($themedir) . $newchild, NULL, TRUE);
588
+ $deleteddirs = $deletedfiles = 0;
589
+ if (count($newfiles) == count($files)):
590
+ // rename old (as webserver)
591
+ if (!$wp_filesystem->exists(trailingslashit($fsthemedir) . $child . '-old'))
592
+ $wp_filesystem->move(trailingslashit($fsthemedir) . $child, trailingslashit($fsthemedir) . $child . '-old');
593
+ // rename new (as user)
594
+ if (!$wp_filesystem->exists(trailingslashit($fsthemedir) . $child))
595
+ $wp_filesystem->move(trailingslashit($fsthemedir) . $newchild, trailingslashit($fsthemedir) . $child);
596
+ // remove old files (as webserver)
597
+ $oldfiles = $this->css->recurse_directory(trailingslashit($themedir) . $child . '-old', NULL, TRUE);
598
+ array_unshift($oldfiles, trailingslashit($themedir) . $child . '-old');
599
+ foreach (array_reverse($oldfiles) as $file):
600
+ if ($wp_filesystem->delete($this->fspath($file)) || (is_dir($file) && @rmdir($file)) || (is_file($file) && @unlink($file))):
601
+ $deletedfiles++;
602
+ endif;
603
+ endforeach;
604
+ if ($deletedfiles != count($oldfiles)):
605
+ $errors[] = 'deleted: ' . $deletedfiles . ' != ' . count($oldfiles) . ' files';
606
+ endif;
607
+ else:
608
+ $errors[] = 'newfiles != files';
609
+ endif;
610
+ endif;
611
+ if (count($errors)):
612
+ $this->errors[] = __('There were errors while resetting permissions.', 'chld_thm_cfg') ;
613
+ add_action('admin_notices', array($this, 'writable_notice'));
614
+ endif;
615
+ }
616
 
617
  function handle_file_upload($field, $childdir = NULL, $mimes = NULL){
 
 
618
  $uploadedfile = $_FILES[$field];
619
  $upload_overrides = array(
620
+ 'test_form' => FALSE,
 
621
  'mimes' => (is_array($mimes) ? $mimes : NULL)
622
  );
 
623
  if ( ! function_exists( 'wp_handle_upload' ) ) require_once( ABSPATH . 'wp-admin/includes/file.php' );
624
  $movefile = wp_handle_upload( $uploadedfile, $upload_overrides );
625
+ if (isset($movefile['error'])):
626
+ $this->errors[] = $movefile['error'];
627
+ return FALSE;
628
+ endif;
629
+ $_POST['movefile'] = $this->uploads_basename($movefile['file']);
630
  }
631
 
632
+ function move_file_upload($subdir = 'images') {
633
+ if (!$this->fs) return FALSE; // return if no filesystem access
634
+ global $wp_filesystem;
635
+ $source_file = sanitize_text_field($_POST['movefile']);
636
+ $target_file = ('' == $subdir ? preg_replace("%^.+(\.\w+)$%", "screenshot$1", basename($source_file)) : trailingslashit($subdir) . basename($source_file));
637
+ if (FALSE !== $this->verify_child_dir(trailingslashit($this->css->get_prop('child')) . $subdir)):
638
+ $source_path = $this->fspath($this->uploads_fullpath($source_file));
639
+ if ($target_path = $this->css->is_file_ok($this->css->get_child_target($target_file), 'write')):
640
+ $target_path = $this->fspath($target_path);
641
+ if ($wp_filesystem->exists($source_path)):
642
+ if ($wp_filesystem->move($source_path, $target_path)) return TRUE;
643
+ endif;
644
+ endif;
645
+ endif;
646
+
647
+ $this->errors[] = __('Could not upload file.', 'chld_thm_cfg');
648
+ }
649
  function export_zip() {
650
  if (($child = $this->css->get_prop('child'))
651
  && ($dir = $this->css->is_file_ok(dirname($this->css->get_child_target()), 'search'))
652
  && ($version = preg_replace("%[^\w\.\-]%", '', $this->css->get_prop('version')))):
653
+ // use php system upload dir to store temp files so that we can use pclzip
654
+ $tmpdir = ini_get('upload_tmp_dir') ? ini_get('upload_tmp_dir') : sys_get_temp_dir();
655
+ $file = trailingslashit($tmpdir) . $child . '-' . $version . '.zip';
656
  mbstring_binary_safe_encoding();
657
 
658
  require_once(ABSPATH . 'wp-admin/includes/class-pclzip.php');
659
 
660
  $archive = new PclZip($file);
661
+ if ($archive->create($dir, PCLZIP_OPT_REMOVE_PATH, dirname($dir)) == 0) return FALSE;
662
  reset_mbstring_encoding();
663
  header( 'Content-Description: File Transfer' );
664
  header( 'Content-Type: application/octet-stream' );
672
  die();
673
  endif;
674
  }
675
+
676
+ /*
677
+ *
678
+ */
679
+ function verify_creds($args = array()) {
680
+ $this->fs_prompt = $this->fs = FALSE;
681
+ //fs prompt does not support arrays as post data - serialize arrays
682
+ $this->serialize_postarrays();
683
+ // generate callback url
684
+ $url = wp_nonce_url('tools.php?page=' . $this->menuName, 'ctc_update', '_wpnonce');
685
+ // buffer output so we can process prior to http header
686
+ ob_start();
687
+ if ($creds = request_filesystem_credentials($url, '', FALSE, FALSE, $args)):
688
+ // check filesystem permission if direct or ftp creds exist
689
+ if ( WP_Filesystem($creds) )
690
+ // login ok
691
+ $this->fs = TRUE;
692
+ else
693
+ // incorrect credentials, get form with error flag
694
+ $creds = request_filesystem_credentials($url, '', TRUE, FALSE, $args);
695
+ else:
696
+ // no credentials, initialize unpriveledged filesystem object
697
+ WP_Filesystem();
698
+ endif;
699
+ // if form was generated, store it
700
+ $this->fs_prompt = ob_get_contents();
701
+ // now we can read/write if fs is TRUE otherwise fs_prompt will contain form
702
+ ob_end_clean();
703
+ //fs prompt does not support arrays as post data - unserialize arrays
704
+ $this->unserialize_postarrays();
705
+ }
706
 
707
+ /*
708
+ * convert 'direct' filepath into wp_filesystem filepath
709
+ */
710
+ function fspath($file){
711
+ if (! $this->fs) return FALSE; // return if no filesystem access
712
+ global $wp_filesystem;
713
+ if (is_dir($file)):
714
+ $dir = $file;
715
+ $base = '';
716
+ else:
717
+ $dir = dirname($file);
718
+ $base = basename($file);
719
+ endif;
720
+ $fsdir = $wp_filesystem->find_folder($dir);
721
+ return trailingslashit($fsdir) . $base;
722
  }
723
 
724
+ function writable_notice() {
725
+ ?> <div class="update-nag">
726
+ <p><?php _e( 'Child Theme Configurator is unable to write to the stylesheet. This can be resolved using one of the following options:<ol>', 'chld_thm_cfg');
727
+ if (isset($_SERVER['SERVER_SOFTWARE']) && preg_match('%unix%i',$_SERVER['SERVER_SOFTWARE'])):
728
+ _e('<li>Temporarily make the stylesheet writable by clicking the button below. You should change this back when you are finished editing for security by clicking "Make read-only" under the "Files" tab.</li>', 'chld_thm_cfg');
729
+ ?><form action="" method="post"><?php wp_nonce_field( 'ctc_update' ); ?>
730
+ <input name="ctc_set_writable" class="button" type="submit" value="<?php _e('Temporarily make stylesheet writable', 'chld_thm_cfg'); ?>"/></form><?php endif;
731
+ _e('<li><a target="_blank" href="http://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants" title="Editin wp-config.php">Add your FTP/SSH credentials to the WordPress config file</a>.</li>', 'chld_thm_cfg');
732
+ if (isset($_SERVER['SERVER_SOFTWARE']) && preg_match('%iis%i',$_SERVER['SERVER_SOFTWARE']))
733
+ _e('<li><a target="_blank" href="http://technet.microsoft.com/en-us/library/cc771170" title="Setting Application Pool Identity">Assign WordPress to an application pool that has write permissions</a> (Windows IIS systems).</li>', 'chld_thm_cfg');
734
+ _e('<li><a target="_blank" href="http://codex.wordpress.org/Changing_File_Permissions" title="Changing File Permissions">Set the stylesheet write permissions on the server manually</a> (not recommended).</li>', 'chld_thm_cfg');
735
+ if (isset($_SERVER['SERVER_SOFTWARE']) && preg_match('%unix%i',$_SERVER['SERVER_SOFTWARE']))
736
+ _e('<li>Run PHP under Apache with suEXEC (contact your web host).</li>', 'chld_thm_cfg') ?>
737
+ </ol></p>
738
+ </div>
739
+ <?php
740
+ }
741
+ function owner_notice() {
742
+ ?>
743
+ <div class="update-nag">
744
+ <p><?php _e( 'This Child Theme is not owned by your website account. It may have been created by a prior version of this plugin or by another program. Moving forward, it must be owned by your website account to make changes. Child Theme Configurator will attempt to correct this when you click the button below.', 'chld_thm_cfg') ?></p>
745
+ <form action="" method="post"><?php wp_nonce_field( 'ctc_update' ); ?>
746
+ <input name="ctc_reset_permission" class="button" type="submit" value="<?php _e('Correct Child Theme Permissions', 'chld_thm_cfg'); ?>"/></form> </div>
747
+ <?php
748
+ }
749
+
750
+ // back compatibility function for plugins extension
751
+ function write_addl_files($chld_thm_cfg) {
752
+ global $chld_thm_cfg_plugins;
753
+ if (!is_object($chld_thm_cfg_plugins) || !$chld_thm_cfg->fs) return FALSE;
754
+ $configtype = $chld_thm_cfg->css->get_prop('configtype');
755
+ if ('theme' == $configtype || !($def = $chld_thm_cfg_plugins->defs->get_def($configtype))) return FALSE;
756
+ $child = trailingslashit($chld_thm_cfg->css->get_prop('child'));
757
+ if (isset($def['addl']) && is_array($def['addl']) && count($def['addl'])):
758
+ foreach ($def['addl'] as $path => $type):
759
+
760
+ // sanitize the crap out of the target data -- it will be used to create paths
761
+ $path = wp_normalize_path(preg_replace("%[^\w\\//\-]%", '', sanitize_text_field($child . $path)));
762
+ if (('dir' == $type && FALSE === $chld_thm_cfg->verify_child_dir($path))
763
+ || ('dir' != $type && FALSE === $chld_thm_cfg->write_child_file($path, ''))):
764
+ $chld_thm_cfg->errors[] =
765
+ __('Your theme directories are not writable.', 'chld_thm_cfg_plugins');
766
+ endif;
767
+ endforeach;
768
+ endif;
769
+ // write main def file
770
+ if (isset($def['target'])):
771
+ $path = wp_normalize_path(preg_replace("%[^\w\\//\-\.]%", '', sanitize_text_field($def['target']))); //$child .
772
+ if (FALSE === $chld_thm_cfg->write_child_file($path, '')):
773
+ $chld_thm_cfg->errors[] =
774
+ __('Your stylesheet is not writable.', 'chld_thm_cfg_plugins');
775
+ return FALSE;
776
+ endif;
777
+ endif;
778
  }
779
  }
js/chld-thm-cfg.js CHANGED
@@ -2,7 +2,7 @@
2
  * Script: chld-thm-cfg.js
3
  * Plugin URI: http://www.lilaeamedia.com/plugins/child-theme-configurator/
4
  * Description: Handles jQuery, AJAX and other UI
5
- * Version: 1.4.8.1
6
  * Author: Lilaea Media
7
  * Author URI: http://www.lilaeamedia.com/
8
  * License: GPLv2
2
  * Script: chld-thm-cfg.js
3
  * Plugin URI: http://www.lilaeamedia.com/plugins/child-theme-configurator/
4
  * Description: Handles jQuery, AJAX and other UI
5
+ * Version: 1.5.0
6
  * Author: Lilaea Media
7
  * Author URI: http://www.lilaeamedia.com/
8
  * License: GPLv2
lang/chld_thm_cfg.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the same license as the Child Theme Configurator package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Child Theme Configurator 1.4.0\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/child-theme-configurator\n"
7
- "POT-Creation-Date: 2014-04-25 22:05:14+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -13,246 +13,287 @@ msgstr ""
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
15
  #: includes/class-ctc-ui.php:23
16
- msgid "Easily customize your plugins with the CTC Plugin Extension"
17
  msgstr ""
18
 
19
- #: includes/class-ctc-ui.php:23
20
- msgid "Use this to customize your plugins"
21
- msgstr ""
22
-
23
- #: includes/class-ctc-ui.php:50
24
  msgid "Parent/Child"
25
  msgstr ""
26
 
27
- #: includes/class-ctc-ui.php:53 includes/class-ctc-ui.php:579
28
  msgid "Query/Selector"
29
  msgstr ""
30
 
31
- #: includes/class-ctc-ui.php:56 includes/class-ctc-ui.php:593
32
  msgid "Rule/Value"
33
  msgstr ""
34
 
35
- #: includes/class-ctc-ui.php:59
36
  msgid "@import"
37
  msgstr ""
38
 
39
- #: includes/class-ctc-ui.php:62
40
  msgid "Child CSS"
41
  msgstr ""
42
 
43
- #: includes/class-ctc-ui.php:65
44
  msgid "Parent CSS"
45
  msgstr ""
46
 
47
- #: includes/class-ctc-ui.php:72 includes/class-ctc-ui.php:632
48
  msgid "Files"
49
  msgstr ""
50
 
51
- #: includes/class-ctc-ui.php:84
52
  msgid "Parent Theme"
53
  msgstr ""
54
 
55
- #: includes/class-ctc-ui.php:94
56
  msgid "Child Theme"
57
  msgstr ""
58
 
59
- #: includes/class-ctc-ui.php:101
60
  msgid "Create New Child Theme"
61
  msgstr ""
62
 
63
- #: includes/class-ctc-ui.php:110
64
  msgid "Use Existing Child Theme"
65
  msgstr ""
66
 
67
- #: includes/class-ctc-ui.php:115
68
  msgid "Theme Slug"
69
  msgstr ""
70
 
71
- #: includes/class-ctc-ui.php:125
72
  msgid "Child Theme Name"
73
  msgstr ""
74
 
75
- #: includes/class-ctc-ui.php:129
76
  msgid "Theme Name"
77
  msgstr ""
78
 
79
- #: includes/class-ctc-ui.php:135 includes/class-ctc-ui.php:139
80
  msgid "Author"
81
  msgstr ""
82
 
83
- #: includes/class-ctc-ui.php:144 includes/class-ctc-ui.php:148
84
  msgid "Version"
85
  msgstr ""
86
 
87
- #: includes/class-ctc-ui.php:153
88
  msgid "Backup Stylesheet"
89
  msgstr ""
90
 
91
- #: includes/class-ctc-ui.php:162
92
- msgid "Scan Parent Theme<br/>for Additional Stylesheets"
 
 
 
 
93
  msgstr ""
94
 
95
- #: includes/class-ctc-ui.php:173
 
 
 
 
96
  msgid "Generate Child Theme Files"
97
  msgstr ""
98
 
99
- #: includes/class-ctc-ui.php:184 includes/class-ctc-ui.php:253
100
  msgid "Rule"
101
  msgstr ""
102
 
103
- #: includes/class-ctc-ui.php:197
104
  msgid "Value"
105
  msgstr ""
106
 
107
- #: includes/class-ctc-ui.php:200 includes/class-ctc-ui.php:238
108
- #: includes/class-ctc.php:102
109
  msgid "Sample"
110
  msgstr ""
111
 
112
- #: includes/class-ctc-ui.php:203 includes/class-ctc.php:104
113
  msgid "Selectors"
114
  msgstr ""
115
 
116
- #: includes/class-ctc-ui.php:214
117
  msgid "Query"
118
  msgstr ""
119
 
120
- #: includes/class-ctc-ui.php:225
121
  msgid "Selector"
122
  msgstr ""
123
 
124
- #: includes/class-ctc-ui.php:246 includes/class-ctc-ui.php:286
125
- #: includes/class-ctc-ui.php:305
126
  msgid "Save"
127
  msgstr ""
128
 
129
- #: includes/class-ctc-ui.php:256
130
  msgid "Parent Value"
131
  msgstr ""
132
 
133
- #: includes/class-ctc-ui.php:259
134
  msgid "Child Value"
135
  msgstr ""
136
 
137
- #: includes/class-ctc-ui.php:265
138
  msgid "New Rule"
139
  msgstr ""
140
 
141
- #: includes/class-ctc-ui.php:275
142
  msgid "Order"
143
  msgstr ""
144
 
145
- #: includes/class-ctc-ui.php:282
146
  msgid "Raw CSS"
147
  msgstr ""
148
 
149
- #: includes/class-ctc-ui.php:301
150
  msgid "@import Statements"
151
  msgstr ""
152
 
153
- #: includes/class-ctc-ui.php:333
154
  msgid "Upload New Child Theme Image"
155
  msgstr ""
156
 
157
- #: includes/class-ctc-ui.php:336
158
  msgid ""
159
  "Theme images reside under the <code>images</code> directory in your child "
160
- "theme and are meant for stylesheet use only. Use the media gallery for "
161
  "content images."
162
  msgstr ""
163
 
164
- #: includes/class-ctc-ui.php:343 includes/class-ctc-ui.php:369
165
  msgid "Upload"
166
  msgstr ""
167
 
168
- #: includes/class-ctc-ui.php:350
169
  msgid "Child Theme Screenshot"
170
  msgstr ""
171
 
172
- #: includes/class-ctc-ui.php:359
173
  msgid "Upload New Screenshot"
174
  msgstr ""
175
 
176
- #: includes/class-ctc-ui.php:362
177
  msgid ""
178
- "The theme screenshot should be a 4:3 ratio (eg., 880px x 660px) JPG, PNG or "
179
  "GIF. It will be renamed <code>screenshot</code>."
180
  msgstr ""
181
 
182
- #: includes/class-ctc-ui.php:430
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
  msgid "Copy PHP template files from the parent theme by selecting them here."
184
  msgstr ""
185
 
186
- #: includes/class-ctc-ui.php:433
187
  msgid ""
188
  "CAUTION: If your child theme is active, the child theme version of the file "
189
  "will be used instead of the parent immediately after it is copied."
190
  msgstr ""
191
 
192
- #: includes/class-ctc-ui.php:436
193
- msgid ""
194
- "The <code>functions.php</code> file is generated separately and cannot be "
195
- "copied here."
196
  msgstr ""
197
 
198
- #: includes/class-ctc-ui.php:438
199
- msgid "Click here to edit template files using the Theme Editor"
200
  msgstr ""
201
 
202
- #: includes/class-ctc-ui.php:443
203
- msgid "Remove child theme templates by selecting them here."
 
 
 
 
 
 
204
  msgstr ""
205
 
206
- #: includes/class-ctc-ui.php:452
207
  msgid "Copy Selected to Child Theme"
208
  msgstr ""
209
 
210
- #: includes/class-ctc-ui.php:452
211
- msgid "Remove Selected from Child Theme"
212
  msgstr ""
213
 
214
- #: includes/class-ctc-ui.php:489
215
  msgid "Child Theme Images"
216
  msgstr ""
217
 
218
- #: includes/class-ctc-ui.php:492
219
  msgid "Remove child theme images by selecting them here."
220
  msgstr ""
221
 
222
- #: includes/class-ctc-ui.php:500
223
  msgid "Remove Selected"
224
  msgstr ""
225
 
226
- #: includes/class-ctc-ui.php:531
227
  msgid "Child Theme files modified successfully."
228
  msgstr ""
229
 
230
- #: includes/class-ctc-ui.php:533
231
- msgid "Child Theme <strong>%s</strong> has been generated successfully."
 
 
232
  msgstr ""
233
 
234
- #: includes/class-ctc-ui.php:537
235
  msgid ""
236
  "Please verify the imports below and remove any imports that are not needed "
237
  "by the front end, such as admin or configuration stylesheets."
238
  msgstr ""
239
 
240
- #: includes/class-ctc-ui.php:554
241
  msgid "Tutorial Video"
242
  msgstr ""
243
 
244
- #: includes/class-ctc-ui.php:555
245
  msgid ""
246
  "<iframe width=\"480\" height=\"270\" src=\"//www.youtube.com/embed/"
247
  "xL2HkWQxgOA?rel=0&modestbranding=1\" frameborder=\"0\" allowfullscreen></"
248
  "iframe>"
249
  msgstr ""
250
 
251
- #: includes/class-ctc-ui.php:561
252
  msgid "Start Here"
253
  msgstr ""
254
 
255
- #: includes/class-ctc-ui.php:562
256
  msgid ""
257
  "\n"
258
  "<p>The first step is to create a child theme and import your parent theme "
@@ -267,15 +308,17 @@ msgid ""
267
  "<li>Enter a Name for the child theme.</li>\n"
268
  "<li>Enter an author for the child theme.</li>\n"
269
  "<li>Enter the child theme version number.</li>\n"
270
- "<li>If your theme uses multiple stylesheets, check \"Scan Parent Theme for "
271
- "additional stylesheets.</li>\n"
272
- "<li>Click \"Generate Child Theme.\" If you are loading an existing child "
273
- "theme, The Child Theme Configurator will create a backup of your existing "
274
- "stylesheet in the theme directory.</li></ol>\n"
 
 
275
  "\t\t\t\t "
276
  msgstr ""
277
 
278
- #: includes/class-ctc-ui.php:580
279
  msgid ""
280
  "\n"
281
  "<p>There are two ways to identify and override parent styles. The Child "
@@ -308,7 +351,7 @@ msgid ""
308
  "\t\t\t\t "
309
  msgstr ""
310
 
311
- #: includes/class-ctc-ui.php:594
312
  msgid ""
313
  "\n"
314
  "<p>There are two ways to identify and override parent styles. The Child "
@@ -335,11 +378,11 @@ msgid ""
335
  "\t\t\t\t "
336
  msgstr ""
337
 
338
- #: includes/class-ctc-ui.php:606
339
  msgid "Add New Styles"
340
  msgstr ""
341
 
342
- #: includes/class-ctc-ui.php:607
343
  msgid ""
344
  "\n"
345
  "<p>If you wish to add additional rules to a given selector, first load the "
@@ -359,22 +402,17 @@ msgid ""
359
  "\t\t\t\t "
360
  msgstr ""
361
 
362
- #: includes/class-ctc-ui.php:617
363
- msgid "@imports"
364
  msgstr ""
365
 
366
- #: includes/class-ctc-ui.php:618
367
  msgid ""
368
  "\n"
369
  "<p>You can add additional stylesheets and web fonts by typing @import rules "
370
  "into the textarea on the @import tab. <strong>Important: The Child Theme "
371
  "Configurator adds the @import rule that loads the Parent Theme's stylesheet "
372
  "automatically. Do not need to add it here.</strong></p>\n"
373
- "<p><strong>Important:</strong> If you chose \"Scan Parent Theme for "
374
- "additional stylesheets,\" the Child Theme Configurator automically places "
375
- "@import rules for the additional stylesheets here. Be sure to delete any "
376
- "imports that are not needed by the front end, such as admin or configuration "
377
- "stylesheets.</p>\n"
378
  "<p>Below is an example that loads a local custom stylesheet (you would have "
379
  "to add the \"fonts\" directory and stylesheet) as well as the web font "
380
  "\"Open Sans\" from Google Web Fonts:</p>\n"
@@ -386,7 +424,7 @@ msgid ""
386
  "\t\t\t\t "
387
  msgstr ""
388
 
389
- #: includes/class-ctc-ui.php:633
390
  msgid ""
391
  "\n"
392
  "<h5>Parent Templates</h5><p>Copy PHP template files from the parent theme by "
@@ -412,29 +450,60 @@ msgid ""
412
  "\t\t\t\t "
413
  msgstr ""
414
 
415
- #: includes/class-ctc-ui.php:649
416
  msgid "Preview and Activate"
417
  msgstr ""
418
 
419
- #: includes/class-ctc-ui.php:650
420
  msgid ""
421
- "\n"
422
- "<p>Click the Child or Parent CSS tab to reference the stylesheet code. To "
423
- "preview the stylesheet as a WordPress theme follow these steps:</p>\n"
 
 
 
 
 
424
  "<ol><li>Navigate to Appearance > Themes in the WordPress Admin. You will now "
425
  "see the new Child Theme as one of the installed Themes.</li>\n"
426
  "<li>Click \"Live Preview\" below the new Child Theme to see it in action.</"
427
  "li>\n"
428
  "<li>When you are ready to take the Child Theme live, click \"Activate.\"</"
429
  "li></ol>\n"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
430
  "\t\t\t\t "
431
  msgstr ""
432
 
433
- #: includes/class-ctc-ui.php:661
434
  msgid "FAQs"
435
  msgstr ""
436
 
437
- #: includes/class-ctc-ui.php:662
438
  msgid ""
439
  "\n"
440
  "<h5>Does it work with Plugins?</h5>\n"
@@ -447,11 +516,14 @@ msgid ""
447
  "<h5 id=\"doesnt_work\">Why doesn’t this work with my (insert theme vendor "
448
  "here) theme?</h5>\n"
449
  "<p>Some themes (particularly commercial themes) do not adhere to the Theme "
450
- "Development guidelines set forth by WordPress.org, and do not automatically "
451
- "load child theme stylesheets or php files. This is unfortunate, because it "
452
- "effectively prohibits the webmaster from adding any customizations (other "
453
- "than those made through the admin theme options) that will survive past an "
454
- "upgrade.</p>\n"
 
 
 
455
  "<p>Contact the vendor directly to ask for this core functionality. It is our "
456
  "opinion that ALL themes (especially commercial ones) must pass the Theme "
457
  "Unit Tests outlined by WordPress.org.</p>\n"
@@ -465,14 +537,10 @@ msgid ""
465
  "update its internal data from the new stylesheet.</p>\n"
466
  "<h5>Why doesn't the Parent Theme have any styles when I \"View Parent CSS\"?"
467
  "</h5>\n"
468
- "<p>Your Parent theme is probably using a non-standard location for the "
469
- "stylesheets. Check \"Scan Parent Theme for additional stylesheets\" on the "
470
- "Parent/Child tab and load the Child Theme again.</p>\n"
471
- "<h5>Why is everything backwards?</h5>\n"
472
- "<p>More than likely you selected \"Scan Parent Theme for additional "
473
- "stylesheets\" and your theme uses a \"right-to-left\" (rtl) stylesheet. Go "
474
- "to the @imports tab and remove the rtl stylesheet from the list of imported "
475
- "stylesheets.</p>\n"
476
  "<h5 id=\"menus-broken\">Why are my menus displaying incorrectly when I "
477
  "activate the new child theme?</h5>\n"
478
  "<p>The child theme creates a new instance in the WordPress options data and "
@@ -516,15 +584,17 @@ msgid ""
516
  "vertical (origin left). The legacy webkit-gradient syntax is not supported.</"
517
  "p>\n"
518
  "<h5 id=\"responsive\">How do I make my Theme responsive?</h5>\n"
519
- "<p>This topic is beyond the scope of this document. The short answer is to "
520
- "use a responsive Parent Theme. Some common characteristics of responsive "
521
- "design are:\n"
522
  "<ul><li>Avoiding fixed width and height values. Using max- and min-height "
523
  "values and percentages are ways to make your designs respond to the viewer's "
524
  "browser size.</li>\n"
525
  "<li>Combining floats and clears with inline and relative positions allow the "
526
  "elements to adjust gracefully to their container's width.</li>\n"
527
  "<li>Showing and hiding content with Javascript.</li></ul>\n"
 
 
 
528
  "<h5 id=\"web_fonts\">How do I add Web Fonts?</h5>\n"
529
  "<p>The easiest method is to paste the @import code provided by Google, Font "
530
  "Squirrel or any other Web Font site into the @import tab. The fonts will "
@@ -542,11 +612,11 @@ msgid ""
542
  " "
543
  msgstr ""
544
 
545
- #: includes/class-ctc-ui.php:706
546
  msgid "Glossary"
547
  msgstr ""
548
 
549
- #: includes/class-ctc-ui.php:707
550
  msgid ""
551
  "\n"
552
  "<h3 id=\"terms\">Glossary</h3>\n"
@@ -586,143 +656,217 @@ msgid ""
586
  "\t\t\t\t "
587
  msgstr ""
588
 
589
- #: includes/class-ctc-ui.php:730
590
  msgid "Contact us"
591
  msgstr ""
592
 
593
- #: includes/class-ctc-ui.php:731
594
  msgid "Plugin Website"
595
  msgstr ""
596
 
597
- #: includes/class-ctc-ui.php:732
598
  msgid "Donate"
599
  msgstr ""
600
 
601
- #: includes/class-ctc-ui.php:733
602
  msgid "Give Us 5 Stars"
603
  msgstr ""
604
 
605
- #: includes/class-ctc-ui.php:734
606
  msgid "WordPress Codex"
607
  msgstr ""
608
 
609
- #: includes/class-ctc-ui.php:735
610
  msgid "WordPress Answers"
611
  msgstr ""
612
 
613
- #. #-#-#-#-# ctc.pot.txt (Child Theme Configurator 1.4.0) #-#-#-#-#
614
  #. Plugin Name of the plugin/theme
615
- #: includes/class-ctc.php:43
616
  msgid "Child Theme Configurator"
617
  msgstr ""
618
 
619
- #: includes/class-ctc.php:44
620
  msgid "Child Themes"
621
  msgstr ""
622
 
623
- #: includes/class-ctc.php:92
624
  msgid "URL/None"
625
  msgstr ""
626
 
627
- #: includes/class-ctc.php:93
628
  msgid "Origin"
629
  msgstr ""
630
 
631
- #: includes/class-ctc.php:94
632
  msgid "Color 1"
633
  msgstr ""
634
 
635
- #: includes/class-ctc.php:95
636
  msgid "Color 2"
637
  msgstr ""
638
 
639
- #: includes/class-ctc.php:96
640
  msgid "Width"
641
  msgstr ""
642
 
643
- #: includes/class-ctc.php:97
644
  msgid "Style"
645
  msgstr ""
646
 
647
- #: includes/class-ctc.php:98
648
  msgid "Color"
649
  msgstr ""
650
 
651
- #: includes/class-ctc.php:100
652
  msgid "Are you sure? This will replace your current settings."
653
  msgstr ""
654
 
655
- #: includes/class-ctc.php:103
656
  msgid "<span style=\"font-size:10px\">!</span>"
657
  msgstr ""
658
 
659
- #: includes/class-ctc.php:105
660
  msgid "Close"
661
  msgstr ""
662
 
663
- #: includes/class-ctc.php:106
664
  msgid "Edit"
665
  msgstr ""
666
 
667
- #: includes/class-ctc.php:107
668
  msgid "Cancel"
669
  msgstr ""
670
 
671
- #: includes/class-ctc.php:108
672
  msgid "Rename"
673
  msgstr ""
674
 
675
- #: includes/class-ctc.php:109
676
  msgid "The stylesheet cannot be displayed."
677
  msgstr ""
678
 
679
- #: includes/class-ctc.php:110
680
  msgid "(Child Only)"
681
  msgstr ""
682
 
683
- #: includes/class-ctc.php:111
684
  msgid "Please enter a valid Child Theme"
685
  msgstr ""
686
 
687
- #: includes/class-ctc.php:112 includes/class-ctc.php:245
688
  msgid "Please enter a valid Child Theme name"
689
  msgstr ""
690
 
691
- #: includes/class-ctc.php:113
692
  msgid "<strong>%s</strong> exists. Please enter a different Child Theme"
693
  msgstr ""
694
 
695
- #: includes/class-ctc.php:229
 
 
 
 
696
  msgid "%s does not exist. Please select a valid Parent Theme"
697
  msgstr ""
698
 
699
- #: includes/class-ctc.php:232
700
  msgid "Please select a valid Parent Theme"
701
  msgstr ""
702
 
703
- #: includes/class-ctc.php:238
 
 
 
 
704
  msgid ""
705
  "<strong>%s</strong> exists. Please enter a different Child Theme template "
706
  "name"
707
  msgstr ""
708
 
709
- #: includes/class-ctc.php:242
710
- msgid "Please enter a valid Child Theme template name"
 
 
 
 
 
 
 
 
711
  msgstr ""
712
 
713
- #: includes/class-ctc.php:248
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
714
  msgid ""
715
- "Your theme directories are not writable. Please adjust permissions and try "
716
- "again."
717
  msgstr ""
718
 
719
- #: includes/class-ctc.php:262
720
  msgid ""
721
- "Your stylesheet is not writable. Please adjust permissions and try again."
 
 
722
  msgstr ""
723
 
724
- #: includes/class-ctc.php:299
725
- msgid "You do not have permission to configure child themes."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
726
  msgstr ""
727
 
728
  #. Plugin URI of the plugin/theme
2
  # This file is distributed under the same license as the Child Theme Configurator package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Child Theme Configurator 1.5.0\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/child-theme-configurator\n"
7
+ "POT-Creation-Date: 2014-09-27 19:30:32+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
15
  #: includes/class-ctc-ui.php:23
16
+ msgid "Total WordPress Customization with PageCells Responsive Theme Framework"
17
  msgstr ""
18
 
19
+ #: includes/class-ctc-ui.php:54
 
 
 
 
20
  msgid "Parent/Child"
21
  msgstr ""
22
 
23
+ #: includes/class-ctc-ui.php:57 includes/class-ctc-ui.php:650
24
  msgid "Query/Selector"
25
  msgstr ""
26
 
27
+ #: includes/class-ctc-ui.php:60 includes/class-ctc-ui.php:664
28
  msgid "Rule/Value"
29
  msgstr ""
30
 
31
+ #: includes/class-ctc-ui.php:63
32
  msgid "@import"
33
  msgstr ""
34
 
35
+ #: includes/class-ctc-ui.php:66
36
  msgid "Child CSS"
37
  msgstr ""
38
 
39
+ #: includes/class-ctc-ui.php:69
40
  msgid "Parent CSS"
41
  msgstr ""
42
 
43
+ #: includes/class-ctc-ui.php:76 includes/class-ctc-ui.php:702
44
  msgid "Files"
45
  msgstr ""
46
 
47
+ #: includes/class-ctc-ui.php:89
48
  msgid "Parent Theme"
49
  msgstr ""
50
 
51
+ #: includes/class-ctc-ui.php:99
52
  msgid "Child Theme"
53
  msgstr ""
54
 
55
+ #: includes/class-ctc-ui.php:106
56
  msgid "Create New Child Theme"
57
  msgstr ""
58
 
59
+ #: includes/class-ctc-ui.php:115
60
  msgid "Use Existing Child Theme"
61
  msgstr ""
62
 
63
+ #: includes/class-ctc-ui.php:120
64
  msgid "Theme Slug"
65
  msgstr ""
66
 
67
+ #: includes/class-ctc-ui.php:130
68
  msgid "Child Theme Name"
69
  msgstr ""
70
 
71
+ #: includes/class-ctc-ui.php:134
72
  msgid "Theme Name"
73
  msgstr ""
74
 
75
+ #: includes/class-ctc-ui.php:140 includes/class-ctc-ui.php:144
76
  msgid "Author"
77
  msgstr ""
78
 
79
+ #: includes/class-ctc-ui.php:149 includes/class-ctc-ui.php:153
80
  msgid "Version"
81
  msgstr ""
82
 
83
+ #: includes/class-ctc-ui.php:158
84
  msgid "Backup Stylesheet"
85
  msgstr ""
86
 
87
+ #: includes/class-ctc-ui.php:169
88
+ msgid "Parse additional stylesheets:"
89
+ msgstr ""
90
+
91
+ #: includes/class-ctc-ui.php:170
92
+ msgid "(click to toggle)"
93
  msgstr ""
94
 
95
+ #: includes/class-ctc-ui.php:174
96
+ msgid "Select only the stylesheets you wish to customize to reduce overhead."
97
+ msgstr ""
98
+
99
+ #: includes/class-ctc-ui.php:192
100
  msgid "Generate Child Theme Files"
101
  msgstr ""
102
 
103
+ #: includes/class-ctc-ui.php:203 includes/class-ctc-ui.php:272
104
  msgid "Rule"
105
  msgstr ""
106
 
107
+ #: includes/class-ctc-ui.php:216
108
  msgid "Value"
109
  msgstr ""
110
 
111
+ #: includes/class-ctc-ui.php:219 includes/class-ctc-ui.php:257
112
+ #: includes/class-ctc.php:117
113
  msgid "Sample"
114
  msgstr ""
115
 
116
+ #: includes/class-ctc-ui.php:222 includes/class-ctc.php:119
117
  msgid "Selectors"
118
  msgstr ""
119
 
120
+ #: includes/class-ctc-ui.php:233
121
  msgid "Query"
122
  msgstr ""
123
 
124
+ #: includes/class-ctc-ui.php:244
125
  msgid "Selector"
126
  msgstr ""
127
 
128
+ #: includes/class-ctc-ui.php:265 includes/class-ctc-ui.php:305
129
+ #: includes/class-ctc-ui.php:324
130
  msgid "Save"
131
  msgstr ""
132
 
133
+ #: includes/class-ctc-ui.php:275
134
  msgid "Parent Value"
135
  msgstr ""
136
 
137
+ #: includes/class-ctc-ui.php:278
138
  msgid "Child Value"
139
  msgstr ""
140
 
141
+ #: includes/class-ctc-ui.php:284
142
  msgid "New Rule"
143
  msgstr ""
144
 
145
+ #: includes/class-ctc-ui.php:294
146
  msgid "Order"
147
  msgstr ""
148
 
149
+ #: includes/class-ctc-ui.php:301
150
  msgid "Raw CSS"
151
  msgstr ""
152
 
153
+ #: includes/class-ctc-ui.php:320
154
  msgid "@import Statements"
155
  msgstr ""
156
 
157
+ #: includes/class-ctc-ui.php:352
158
  msgid "Upload New Child Theme Image"
159
  msgstr ""
160
 
161
+ #: includes/class-ctc-ui.php:355
162
  msgid ""
163
  "Theme images reside under the <code>images</code> directory in your child "
164
+ "theme and are meant for stylesheet use only. Use the Media Library for "
165
  "content images."
166
  msgstr ""
167
 
168
+ #: includes/class-ctc-ui.php:362 includes/class-ctc-ui.php:388
169
  msgid "Upload"
170
  msgstr ""
171
 
172
+ #: includes/class-ctc-ui.php:369
173
  msgid "Child Theme Screenshot"
174
  msgstr ""
175
 
176
+ #: includes/class-ctc-ui.php:378
177
  msgid "Upload New Screenshot"
178
  msgstr ""
179
 
180
+ #: includes/class-ctc-ui.php:381
181
  msgid ""
182
+ "The theme screenshot should be a 4:3 ratio (e.g., 880px x 660px) JPG, PNG or "
183
  "GIF. It will be renamed <code>screenshot</code>."
184
  msgstr ""
185
 
186
+ #: includes/class-ctc-ui.php:396
187
+ msgid "Export Child Theme as Zip Archive"
188
+ msgstr ""
189
+
190
+ #: includes/class-ctc-ui.php:402
191
+ msgid "Export"
192
+ msgstr ""
193
+
194
+ #: includes/class-ctc-ui.php:411
195
+ msgid "Secure Child Theme"
196
+ msgstr ""
197
+
198
+ #: includes/class-ctc-ui.php:414
199
+ msgid ""
200
+ "Attempt to reset child theme permissions to user ownership and read-only "
201
+ "access."
202
+ msgstr ""
203
+
204
+ #: includes/class-ctc-ui.php:420
205
+ msgid "Make read-only"
206
+ msgstr ""
207
+
208
+ #: includes/class-ctc-ui.php:471
209
+ msgid "Click here to edit template files using the Theme Editor"
210
+ msgstr ""
211
+
212
+ #: includes/class-ctc-ui.php:475
213
+ msgid ""
214
+ "The Theme editor has been disabled. Template files must be edited offline."
215
+ msgstr ""
216
+
217
+ #: includes/class-ctc-ui.php:490
218
  msgid "Copy PHP template files from the parent theme by selecting them here."
219
  msgstr ""
220
 
221
+ #: includes/class-ctc-ui.php:493
222
  msgid ""
223
  "CAUTION: If your child theme is active, the child theme version of the file "
224
  "will be used instead of the parent immediately after it is copied."
225
  msgstr ""
226
 
227
+ #: includes/class-ctc-ui.php:495
228
+ msgid "The %s file is generated separately and cannot be copied here."
 
 
229
  msgstr ""
230
 
231
+ #: includes/class-ctc-ui.php:502
232
+ msgid "Delete child theme templates by selecting them here."
233
  msgstr ""
234
 
235
+ #: includes/class-ctc-ui.php:504
236
+ msgid ""
237
+ "Delete child theme templates or make them writable by selecting them here. "
238
+ "Writable files are displayed in <span style=\"color:red\">red</span>."
239
+ msgstr ""
240
+
241
+ #: includes/class-ctc-ui.php:515
242
+ msgid "Make Selected Writable"
243
  msgstr ""
244
 
245
+ #: includes/class-ctc-ui.php:519
246
  msgid "Copy Selected to Child Theme"
247
  msgstr ""
248
 
249
+ #: includes/class-ctc-ui.php:519
250
+ msgid "Delete Selected"
251
  msgstr ""
252
 
253
+ #: includes/class-ctc-ui.php:557
254
  msgid "Child Theme Images"
255
  msgstr ""
256
 
257
+ #: includes/class-ctc-ui.php:560
258
  msgid "Remove child theme images by selecting them here."
259
  msgstr ""
260
 
261
+ #: includes/class-ctc-ui.php:568
262
  msgid "Remove Selected"
263
  msgstr ""
264
 
265
+ #: includes/class-ctc-ui.php:599
266
  msgid "Child Theme files modified successfully."
267
  msgstr ""
268
 
269
+ #: includes/class-ctc-ui.php:601
270
+ msgid ""
271
+ "Child Theme <strong>%s</strong> has been generated successfully.\n"
272
+ " "
273
  msgstr ""
274
 
275
+ #: includes/class-ctc-ui.php:607
276
  msgid ""
277
  "Please verify the imports below and remove any imports that are not needed "
278
  "by the front end, such as admin or configuration stylesheets."
279
  msgstr ""
280
 
281
+ #: includes/class-ctc-ui.php:624
282
  msgid "Tutorial Video"
283
  msgstr ""
284
 
285
+ #: includes/class-ctc-ui.php:625
286
  msgid ""
287
  "<iframe width=\"480\" height=\"270\" src=\"//www.youtube.com/embed/"
288
  "xL2HkWQxgOA?rel=0&modestbranding=1\" frameborder=\"0\" allowfullscreen></"
289
  "iframe>"
290
  msgstr ""
291
 
292
+ #: includes/class-ctc-ui.php:631
293
  msgid "Start Here"
294
  msgstr ""
295
 
296
+ #: includes/class-ctc-ui.php:632
297
  msgid ""
298
  "\n"
299
  "<p>The first step is to create a child theme and import your parent theme "
308
  "<li>Enter a Name for the child theme.</li>\n"
309
  "<li>Enter an author for the child theme.</li>\n"
310
  "<li>Enter the child theme version number.</li>\n"
311
+ "<li>If you check \"Backup Stylesheet\", The Child Theme Configurator will "
312
+ "create a backup in the theme directory.</li>\n"
313
+ "<li>If your theme uses additional stylesheets they will appear as checkbox "
314
+ "options when you open the toggle arrow. Select only the stylesheets you wish "
315
+ "to customize to reduce overhead. Remember to select them again if you reload "
316
+ "your configuration.</li>\n"
317
+ "<li>Click \"Generate Child Theme.\"</li></ol>\n"
318
  "\t\t\t\t "
319
  msgstr ""
320
 
321
+ #: includes/class-ctc-ui.php:651
322
  msgid ""
323
  "\n"
324
  "<p>There are two ways to identify and override parent styles. The Child "
351
  "\t\t\t\t "
352
  msgstr ""
353
 
354
+ #: includes/class-ctc-ui.php:665
355
  msgid ""
356
  "\n"
357
  "<p>There are two ways to identify and override parent styles. The Child "
378
  "\t\t\t\t "
379
  msgstr ""
380
 
381
+ #: includes/class-ctc-ui.php:677
382
  msgid "Add New Styles"
383
  msgstr ""
384
 
385
+ #: includes/class-ctc-ui.php:678
386
  msgid ""
387
  "\n"
388
  "<p>If you wish to add additional rules to a given selector, first load the "
402
  "\t\t\t\t "
403
  msgstr ""
404
 
405
+ #: includes/class-ctc-ui.php:688
406
+ msgid "@imports and Web Fonts"
407
  msgstr ""
408
 
409
+ #: includes/class-ctc-ui.php:689
410
  msgid ""
411
  "\n"
412
  "<p>You can add additional stylesheets and web fonts by typing @import rules "
413
  "into the textarea on the @import tab. <strong>Important: The Child Theme "
414
  "Configurator adds the @import rule that loads the Parent Theme's stylesheet "
415
  "automatically. Do not need to add it here.</strong></p>\n"
 
 
 
 
 
416
  "<p>Below is an example that loads a local custom stylesheet (you would have "
417
  "to add the \"fonts\" directory and stylesheet) as well as the web font "
418
  "\"Open Sans\" from Google Web Fonts:</p>\n"
424
  "\t\t\t\t "
425
  msgstr ""
426
 
427
+ #: includes/class-ctc-ui.php:703
428
  msgid ""
429
  "\n"
430
  "<h5>Parent Templates</h5><p>Copy PHP template files from the parent theme by "
450
  "\t\t\t\t "
451
  msgstr ""
452
 
453
+ #: includes/class-ctc-ui.php:719
454
  msgid "Preview and Activate"
455
  msgstr ""
456
 
457
+ #: includes/class-ctc-ui.php:720
458
  msgid ""
459
+ "<p><strong>IMPORTANT: <a target=\"_blank\" href=\"http://www.lilaeamedia.com/"
460
+ "plugins/child-theme-configurator/#preview_activate\" title=\"Test your child "
461
+ "theme before activating!\">Test your child theme before activating!</a></"
462
+ "strong> Some themes (particularly commercial themes) do not adhere to the "
463
+ "Theme Development guidelines set forth by WordPress.org, and do not "
464
+ "correctly load parent template files or automatically load child theme "
465
+ "stylesheets or php files. <strong>In the worst cases they will break your "
466
+ "website when you activate the child theme.</strong></p>\n"
467
  "<ol><li>Navigate to Appearance > Themes in the WordPress Admin. You will now "
468
  "see the new Child Theme as one of the installed Themes.</li>\n"
469
  "<li>Click \"Live Preview\" below the new Child Theme to see it in action.</"
470
  "li>\n"
471
  "<li>When you are ready to take the Child Theme live, click \"Activate.\"</"
472
  "li></ol>\n"
473
+ "<p>You can also click the Child or Parent CSS tab to reference the "
474
+ "stylesheet code.</p>\n"
475
+ "\t\t\t\t "
476
+ msgstr ""
477
+
478
+ #: includes/class-ctc-ui.php:731
479
+ msgid "File Permissions"
480
+ msgstr ""
481
+
482
+ #: includes/class-ctc-ui.php:732
483
+ msgid ""
484
+ "\n"
485
+ "<p>WordPress was designed to work on a number of server configurations. "
486
+ "Child Theme Configurator uses the WordPress Filesystem API to allow changes "
487
+ "to sites that require user permission to edit files.</p><p>However, because "
488
+ "most of the functionality occurs via AJAX (background) requests, the child "
489
+ "theme stylesheet must be writable by the web server.</p><p>The plugin will "
490
+ "automatically detect your configuration and provide a number of options to "
491
+ "resolve this requirement. Use the links provided to find out more about the "
492
+ "options available, including:</p>\n"
493
+ "<ol><li>Temporarily making the stylesheet writable through the plugin.</li>\n"
494
+ "<li>Adding your FTP/SSH credentials to the WordPress config file.</li>\n"
495
+ "<li>Setting the stylesheet write permissions on the server manually</li>\n"
496
+ "<li>Configuring your web server to allow write access in certain situations."
497
+ "</li>\n"
498
+ "</ol>\n"
499
  "\t\t\t\t "
500
  msgstr ""
501
 
502
+ #: includes/class-ctc-ui.php:745
503
  msgid "FAQs"
504
  msgstr ""
505
 
506
+ #: includes/class-ctc-ui.php:746
507
  msgid ""
508
  "\n"
509
  "<h5>Does it work with Plugins?</h5>\n"
516
  "<h5 id=\"doesnt_work\">Why doesn’t this work with my (insert theme vendor "
517
  "here) theme?</h5>\n"
518
  "<p>Some themes (particularly commercial themes) do not adhere to the Theme "
519
+ "Development guidelines set forth by WordPress.org, and do not correctly load "
520
+ "parent template files or automatically load child theme stylesheets or php "
521
+ "files.</p>\n"
522
+ "<p>This is unfortunate, because in the best case they effectively prohibit "
523
+ "the webmaster from adding any customizations (other than those made through "
524
+ "the admin theme options) that will survive past an upgrade. <strong>In the "
525
+ "worst case they will break your website when you activate the child theme.</"
526
+ "strong></p>\n"
527
  "<p>Contact the vendor directly to ask for this core functionality. It is our "
528
  "opinion that ALL themes (especially commercial ones) must pass the Theme "
529
  "Unit Tests outlined by WordPress.org.</p>\n"
537
  "update its internal data from the new stylesheet.</p>\n"
538
  "<h5>Why doesn't the Parent Theme have any styles when I \"View Parent CSS\"?"
539
  "</h5>\n"
540
+ "<p>Your Parent theme is probably using a separate location for the "
541
+ "stylesheets. Select individual stylesheets from the \"Parse Additional "
542
+ "Stylesheets\" section of the Parent/Child tab and click \"Generate Child "
543
+ "Theme Files\" again.</p>\n"
 
 
 
 
544
  "<h5 id=\"menus-broken\">Why are my menus displaying incorrectly when I "
545
  "activate the new child theme?</h5>\n"
546
  "<p>The child theme creates a new instance in the WordPress options data and "
584
  "vertical (origin left). The legacy webkit-gradient syntax is not supported.</"
585
  "p>\n"
586
  "<h5 id=\"responsive\">How do I make my Theme responsive?</h5>\n"
587
+ "<p>The short answer is to use a responsive Parent Theme. Some common "
588
+ "characteristics of responsive design are:</p>\n"
 
589
  "<ul><li>Avoiding fixed width and height values. Using max- and min-height "
590
  "values and percentages are ways to make your designs respond to the viewer's "
591
  "browser size.</li>\n"
592
  "<li>Combining floats and clears with inline and relative positions allow the "
593
  "elements to adjust gracefully to their container's width.</li>\n"
594
  "<li>Showing and hiding content with Javascript.</li></ul>\n"
595
+ "<iframe width=\"480\" height=\"270\" src=\"//www.youtube.com/embed/"
596
+ "iBiiAgsK4G4?rel=0&modestbranding=1\" frameborder=\"0\" allowfullscreen></"
597
+ "iframe> \n"
598
  "<h5 id=\"web_fonts\">How do I add Web Fonts?</h5>\n"
599
  "<p>The easiest method is to paste the @import code provided by Google, Font "
600
  "Squirrel or any other Web Font site into the @import tab. The fonts will "
612
  " "
613
  msgstr ""
614
 
615
+ #: includes/class-ctc-ui.php:790
616
  msgid "Glossary"
617
  msgstr ""
618
 
619
+ #: includes/class-ctc-ui.php:791
620
  msgid ""
621
  "\n"
622
  "<h3 id=\"terms\">Glossary</h3>\n"
656
  "\t\t\t\t "
657
  msgstr ""
658
 
659
+ #: includes/class-ctc-ui.php:814
660
  msgid "Contact us"
661
  msgstr ""
662
 
663
+ #: includes/class-ctc-ui.php:815
664
  msgid "Plugin Website"
665
  msgstr ""
666
 
667
+ #: includes/class-ctc-ui.php:816
668
  msgid "Donate"
669
  msgstr ""
670
 
671
+ #: includes/class-ctc-ui.php:817
672
  msgid "Give Us 5 Stars"
673
  msgstr ""
674
 
675
+ #: includes/class-ctc-ui.php:818
676
  msgid "WordPress Codex"
677
  msgstr ""
678
 
679
+ #: includes/class-ctc-ui.php:819
680
  msgid "WordPress Answers"
681
  msgstr ""
682
 
683
+ #. #-#-#-#-# chld_thm_cfg.pot (Child Theme Configurator 1.5.0) #-#-#-#-#
684
  #. Plugin Name of the plugin/theme
685
+ #: includes/class-ctc.php:50
686
  msgid "Child Theme Configurator"
687
  msgstr ""
688
 
689
+ #: includes/class-ctc.php:51
690
  msgid "Child Themes"
691
  msgstr ""
692
 
693
+ #: includes/class-ctc.php:107
694
  msgid "URL/None"
695
  msgstr ""
696
 
697
+ #: includes/class-ctc.php:108
698
  msgid "Origin"
699
  msgstr ""
700
 
701
+ #: includes/class-ctc.php:109
702
  msgid "Color 1"
703
  msgstr ""
704
 
705
+ #: includes/class-ctc.php:110
706
  msgid "Color 2"
707
  msgstr ""
708
 
709
+ #: includes/class-ctc.php:111
710
  msgid "Width"
711
  msgstr ""
712
 
713
+ #: includes/class-ctc.php:112
714
  msgid "Style"
715
  msgstr ""
716
 
717
+ #: includes/class-ctc.php:113
718
  msgid "Color"
719
  msgstr ""
720
 
721
+ #: includes/class-ctc.php:115
722
  msgid "Are you sure? This will replace your current settings."
723
  msgstr ""
724
 
725
+ #: includes/class-ctc.php:118
726
  msgid "<span style=\"font-size:10px\">!</span>"
727
  msgstr ""
728
 
729
+ #: includes/class-ctc.php:120
730
  msgid "Close"
731
  msgstr ""
732
 
733
+ #: includes/class-ctc.php:121
734
  msgid "Edit"
735
  msgstr ""
736
 
737
+ #: includes/class-ctc.php:122
738
  msgid "Cancel"
739
  msgstr ""
740
 
741
+ #: includes/class-ctc.php:123
742
  msgid "Rename"
743
  msgstr ""
744
 
745
+ #: includes/class-ctc.php:124
746
  msgid "The stylesheet cannot be displayed."
747
  msgstr ""
748
 
749
+ #: includes/class-ctc.php:125
750
  msgid "(Child Only)"
751
  msgstr ""
752
 
753
+ #: includes/class-ctc.php:126
754
  msgid "Please enter a valid Child Theme"
755
  msgstr ""
756
 
757
+ #: includes/class-ctc.php:127 includes/class-ctc.php:301
758
  msgid "Please enter a valid Child Theme name"
759
  msgstr ""
760
 
761
+ #: includes/class-ctc.php:128
762
  msgid "<strong>%s</strong> exists. Please enter a different Child Theme"
763
  msgstr ""
764
 
765
+ #: includes/class-ctc.php:244
766
+ msgid "Zip file creation failed."
767
+ msgstr ""
768
+
769
+ #: includes/class-ctc.php:272
770
  msgid "%s does not exist. Please select a valid Parent Theme"
771
  msgstr ""
772
 
773
+ #: includes/class-ctc.php:275
774
  msgid "Please select a valid Parent Theme"
775
  msgstr ""
776
 
777
+ #: includes/class-ctc.php:279
778
+ msgid "Please enter a valid Child Theme template name"
779
+ msgstr ""
780
+
781
+ #: includes/class-ctc.php:286
782
  msgid ""
783
  "<strong>%s</strong> exists. Please enter a different Child Theme template "
784
  "name"
785
  msgstr ""
786
 
787
+ #: includes/class-ctc.php:305 includes/class-ctc.php:784
788
+ msgid "Your theme directories are not writable."
789
+ msgstr ""
790
+
791
+ #: includes/class-ctc.php:328 includes/class-ctc.php:793
792
+ msgid "Your stylesheet is not writable."
793
+ msgstr ""
794
+
795
+ #: includes/class-ctc.php:384
796
+ msgid "You do not have permission to configure child themes."
797
  msgstr ""
798
 
799
+ #: includes/class-ctc.php:487
800
+ msgid "Could not copy file."
801
+ msgstr ""
802
+
803
+ #: includes/class-ctc.php:549
804
+ msgid "Could not set write permissions."
805
+ msgstr ""
806
+
807
+ #: includes/class-ctc.php:628
808
+ msgid "There were errors while resetting permissions."
809
+ msgstr ""
810
+
811
+ #: includes/class-ctc.php:666
812
+ msgid "Could not upload file."
813
+ msgstr ""
814
+
815
+ #: includes/class-ctc.php:745
816
  msgid ""
817
+ "Child Theme Configurator is unable to write to the stylesheet. This can be "
818
+ "resolved using one of the following options:<ol>"
819
  msgstr ""
820
 
821
+ #: includes/class-ctc.php:747
822
  msgid ""
823
+ "<li>Temporarily make the stylesheet writable by clicking the button below. "
824
+ "You should change this back when you are finished editing for security by "
825
+ "clicking \"Make read-only\" under the \"Files\" tab.</li>"
826
  msgstr ""
827
 
828
+ #: includes/class-ctc.php:749
829
+ msgid "Temporarily make stylesheet writable"
830
+ msgstr ""
831
+
832
+ #: includes/class-ctc.php:750
833
+ msgid ""
834
+ "<li><a target=\"_blank\" href=\"http://codex.wordpress.org/Editing_wp-"
835
+ "config.php#WordPress_Upgrade_Constants\" title=\"Editin wp-config.php\">Add "
836
+ "your FTP/SSH credentials to the WordPress config file</a>.</li>"
837
+ msgstr ""
838
+
839
+ #: includes/class-ctc.php:752
840
+ msgid ""
841
+ "<li><a target=\"_blank\" href=\"http://technet.microsoft.com/en-us/library/"
842
+ "cc771170\" title=\"Setting Application Pool Identity\">Assign WordPress to "
843
+ "an application pool that has write permissions</a> (Windows IIS systems).</"
844
+ "li>"
845
+ msgstr ""
846
+
847
+ #: includes/class-ctc.php:753
848
+ msgid ""
849
+ "<li><a target=\"_blank\" href=\"http://codex.wordpress.org/"
850
+ "Changing_File_Permissions\" title=\"Changing File Permissions\">Set the "
851
+ "stylesheet write permissions on the server manually</a> (not recommended).</"
852
+ "li>"
853
+ msgstr ""
854
+
855
+ #: includes/class-ctc.php:755
856
+ msgid "<li>Run PHP under Apache with suEXEC (contact your web host).</li>"
857
+ msgstr ""
858
+
859
+ #: includes/class-ctc.php:763
860
+ msgid ""
861
+ "This Child Theme is not owned by your website account. It may have been "
862
+ "created by a prior version of this plugin or by another program. Moving "
863
+ "forward, it must be owned by your website account to make changes. Child "
864
+ "Theme Configurator will attempt to correct this when you click the button "
865
+ "below."
866
+ msgstr ""
867
+
868
+ #: includes/class-ctc.php:765
869
+ msgid "Correct Child Theme Permissions"
870
  msgstr ""
871
 
872
  #. Plugin URI of the plugin/theme
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: child theme, custom theme, CSS, responsive design, CSS editor, theme generator
5
  Requires at least: 3.7
6
  Tested up to: 4.0
7
- Stable tag: 1.4.8.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -79,6 +79,8 @@ Learn more at http://www.lilaeamedia.com/plugins/intelliwidget-responsive-menu
79
 
80
  3. In the WordPress Admin, go to "Plugins > Installed Plugins." Locate "Child Theme Configurator" in the list and click "Activate."
81
 
 
 
82
  == Frequently Asked Questions ==
83
 
84
  = Does it work with plugins? =
@@ -93,9 +95,11 @@ https://www.youtube.com/watch?v=DSfx2RbZobo
93
 
94
  = Why doesn't this work with my (insert theme vendor here) theme? =
95
 
96
- Some themes (particularly commercial themes) do not adhere to the Theme Development guidelines set forth by WordPress.org, and do not automatically load child theme stylesheets or php files. This is unfortunate, because it effectively prohibits the webmaster from adding any customizations (other than those made through the admin theme options) that will survive past an upgrade.
 
 
97
 
98
- Contact the vendor directly to ask for this core functionality. It is our opinion that ALL themes (especially commercial ones) must pass the Theme Unit Tests outlined by WordPress.org.
99
 
100
  = Why doesn't the Parent Theme have any styles when I "View Parent CSS"? =
101
 
@@ -187,6 +191,14 @@ You can also create a secondary stylesheet that contains @font-face rules and im
187
 
188
  == Changelog ==
189
 
 
 
 
 
 
 
 
 
190
  = 1.4.8 =
191
  * Removed backtrace in main CSS parser regex due to high memory usage.
192
 
@@ -318,7 +330,7 @@ You can also create a secondary stylesheet that contains @font-face rules and im
318
 
319
  == Upgrade Notice ==
320
 
321
- Removed backtrace in main CSS parser regex due to high memory usage. This should fix the 500 Server errors from large parent stylesheets
322
 
323
  == Create Your Child Theme ==
324
 
@@ -334,6 +346,7 @@ The first step is to create a child theme and import your parent theme styles in
334
  6. If you check "Backup Stylesheet", The Child Theme Configurator will create a backup in the theme directory.
335
  7. If your theme uses additional stylesheets they will appear as checkbox options. Select only the stylesheets you wish to customize to reduce overhead.
336
  8. Click "Generate Child Theme Files."
 
337
 
338
  == Override Parent Styles ==
339
 
@@ -394,14 +407,21 @@ You can upload a custom screenshot for the child theme here. The theme screensho
394
 
395
  == Preview and Activate ==
396
 
397
- Click the Preview CSS tab to see your new masterpiece as CSS code. To preview the stylesheet as a WordPress theme follow these steps:
 
 
 
 
398
 
399
  1. Navigate to Appearance > Themes in the WordPress Admin. You will now see the new Child Theme as one of the installed Themes.
400
  2. Click "Live Preview" below the new Child Theme to see it in action.
401
  3. When you are ready to take the Child Theme live, click "Activate."
402
 
 
 
403
  == Caveats ==
404
 
 
405
  * No web font preview. Look for live preview of imported fonts in a later release.
406
  * No webkit-gradient. The Child Theme Configurator plugin does not support the legacy webkit gradient. If there is a demand, we will add it in a future release, but most Chrome and Safari users should have upgraded by now.
407
  * Only two-color gradients. The Child Theme Configurator plugin is powerful, but we have simplified the gradient interface. You can use any gradient you want as long as it has two colors and no intermediate stops.
@@ -412,4 +432,4 @@ Click the Preview CSS tab to see your new masterpiece as CSS code. To preview th
412
 
413
  Go to http://www.lilaeamedia.com/plugins/child-theme-configurator
414
 
415
- Copyright: (C) 2014 Lilaea Media
4
  Tags: child theme, custom theme, CSS, responsive design, CSS editor, theme generator
5
  Requires at least: 3.7
6
  Tested up to: 4.0
7
+ Stable tag: 1.5.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
79
 
80
  3. In the WordPress Admin, go to "Plugins > Installed Plugins." Locate "Child Theme Configurator" in the list and click "Activate."
81
 
82
+ 4. ALWAYS TEST YOUR CHILD THEME BEFORE ACTIVATING (See "Preview and Activate").
83
+
84
  == Frequently Asked Questions ==
85
 
86
  = Does it work with plugins? =
95
 
96
  = Why doesn't this work with my (insert theme vendor here) theme? =
97
 
98
+ Some themes (particularly commercial themes) do not adhere to the Theme Development guidelines set forth by WordPress.org, and do not correctly load parent template files or automatically load child theme stylesheets or php files.
99
+
100
+ This is unfortunate, because in the best case they effectively prohibit the webmaster from adding any customizations (other than those made through the admin theme options) that will survive past an upgrade. **In the worst case they will break your website when you activate the child theme.**
101
 
102
+ Contact the vendor directly to ask for this core functionality. It is our opinion that ALL themes (especially commercial ones) must pass the Theme Unit Tests outlined by WordPress.org and ALWAYS TEST YOUR CHILD THEME BEFORE ACTIVATING (See "Preview and Activate").
103
 
104
  = Why doesn't the Parent Theme have any styles when I "View Parent CSS"? =
105
 
191
 
192
  == Changelog ==
193
 
194
+ = 1.5.0 =
195
+ * We have completely refactored CTC to use the WP_Filesystem API.
196
+ * If your web host is configured to use suExec (meaning it runs under the user of the web account being accessed), the changes will be completely transparent.
197
+ * Other configurations will now require user credentials to add, remove or update Child Theme files.
198
+ * To make things easier we added the ability for you to make the files writable while editing and then make them read-only when you are done.
199
+ * You can also set your credentials in wp-config.php: http://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants
200
+ * Contact us at http://www.lilaeamedia.com/about/contact if you have any questions.
201
+
202
  = 1.4.8 =
203
  * Removed backtrace in main CSS parser regex due to high memory usage.
204
 
330
 
331
  == Upgrade Notice ==
332
 
333
+ CTC now uses the WP_Filesystem API (see changelog). The changes will be transparent to most users. Contact us at http://www.lilaeamedia.com/about/contact if you have any questions.
334
 
335
  == Create Your Child Theme ==
336
 
346
  6. If you check "Backup Stylesheet", The Child Theme Configurator will create a backup in the theme directory.
347
  7. If your theme uses additional stylesheets they will appear as checkbox options. Select only the stylesheets you wish to customize to reduce overhead.
348
  8. Click "Generate Child Theme Files."
349
+ 9. ALWAYS TEST YOUR CHILD THEME BEFORE ACTIVATING!
350
 
351
  == Override Parent Styles ==
352
 
407
 
408
  == Preview and Activate ==
409
 
410
+ **IMPORTANT: Test your child theme before activating!**
411
+
412
+ Some themes (particularly commercial themes) do not adhere to the Theme Development guidelines set forth by WordPress.org, and do not correctly load parent template files or automatically load child theme stylesheets or php files.
413
+
414
+ **In the worst cases they will break your website when you activate the child theme.**
415
 
416
  1. Navigate to Appearance > Themes in the WordPress Admin. You will now see the new Child Theme as one of the installed Themes.
417
  2. Click "Live Preview" below the new Child Theme to see it in action.
418
  3. When you are ready to take the Child Theme live, click "Activate."
419
 
420
+ You can also click the Preview CSS tab to see your new masterpiece as CSS code.
421
+
422
  == Caveats ==
423
 
424
+ * ALWAYS TEST YOUR CHILD THEME BEFORE ACTIVATING (See "Preview and Activate," above).
425
  * No web font preview. Look for live preview of imported fonts in a later release.
426
  * No webkit-gradient. The Child Theme Configurator plugin does not support the legacy webkit gradient. If there is a demand, we will add it in a future release, but most Chrome and Safari users should have upgraded by now.
427
  * Only two-color gradients. The Child Theme Configurator plugin is powerful, but we have simplified the gradient interface. You can use any gradient you want as long as it has two colors and no intermediate stops.
432
 
433
  Go to http://www.lilaeamedia.com/plugins/child-theme-configurator
434
 
435
+ Copyright: (C) 2014 Lilaea Media