Child Theme Configurator - Version 1.4.4

Version Description

  • Refactored the way CTC caches updates and returns them to the UI controller to reduce memory consumption.
  • Prevent out of memory fatals when generating new child theme.
  • Changed "Scan Parent for Additional Stylesheets" to individual checkbox options for each file with a toggle to show/hide in the Parent/Child tab.
  • Added automatic update of form when Parent Theme is changed.
  • Pre-populate Parent/Child form when parent slug is passed to CTC options.
Download this release

Release Info

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

Code changes from version 1.4.3 to 1.4.4

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.3
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.3');
20
  define('CHLD_THM_CFG_MAX_SELECTORS', '5000');
21
  define('CHLD_THM_CFG_MAX_RECURSE_LOOPS', '100');
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.4.4
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.4.4');
20
  define('CHLD_THM_CFG_MAX_SELECTORS', '5000');
21
  define('CHLD_THM_CFG_MAX_RECURSE_LOOPS', '100');
22
 
css/chld-thm-cfg.css CHANGED
@@ -1,6 +1,9 @@
1
 
2
- .nav-tab, .nav-tab:focus, .nav-tab:active {
3
  outline: none;
 
 
 
4
  }
5
 
6
  .nav-tab-active {
@@ -186,7 +189,21 @@
186
  .ctc-child-input-cell input[type="text"].ctc-input-wide {
187
  width: 200px;
188
  }
189
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
190
  .clearfix:after, .clearfix:before {
191
  content: ' ';
192
  display: table;
1
 
2
+ a.nav-tab, a.nav-tab:focus, a.nav-tab:active {
3
  outline: none;
4
+ -moz-box-shadow:none;
5
+ -webkit-box-shadow:none;
6
+ box-shadow:none;
7
  }
8
 
9
  .nav-tab-active {
189
  .ctc-child-input-cell input[type="text"].ctc-input-wide {
190
  width: 200px;
191
  }
192
+ #ctc_additional_css_label {
193
+ cursor:pointer;
194
+ }
195
+ #ctc_additional_css_label span {
196
+ white-space:nowrap;
197
+ }
198
+ #ctc_additional_css_label span:after {
199
+ content: "\f140";
200
+ font: 400 20px/1 dashicons;
201
+ color:#999;
202
+ vertical-align:bottom;
203
+ }
204
+ #ctc_additional_css_label.open span:after {
205
+ content: "\f142";
206
+ }
207
  .clearfix:after, .clearfix:before {
208
  content: ' ';
209
  display: table;
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.3
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
@@ -34,7 +34,7 @@ class Child_Theme_Configurator_CSS {
34
  var $valkey; // counter for dict_val
35
  // miscellaneous properties
36
  var $imports; // @import rules
37
- var $updates; // temporary update cache
38
  var $child; // child theme slug
39
  var $parnt; // parent theme slug
40
  var $configtype; // theme or plugin extension
@@ -42,16 +42,16 @@ class Child_Theme_Configurator_CSS {
42
  var $child_author; // stylesheet author
43
  var $child_version; // stylesheet version
44
 
45
- function __construct() {
46
  // scalars
47
- $this->version = '1.4.3';
48
  $this->querykey = 0;
49
  $this->selkey = 0;
50
  $this->qskey = 0;
51
  $this->rulekey = 0;
52
  $this->valkey = 0;
53
  $this->child = '';
54
- $this->parnt = '';
55
  $this->configtype = 'theme';
56
  $this->child_name = '';
57
  $this->child_author = 'Child Theme Configurator by Lilaea Media';
@@ -66,7 +66,6 @@ class Child_Theme_Configurator_CSS {
66
  $this->sel_ndx = array();
67
  $this->val_ndx = array();
68
  $this->imports = array('child' => array(), 'parnt' => array());
69
- $this->updates = array();
70
  }
71
 
72
  /*
@@ -75,8 +74,6 @@ class Child_Theme_Configurator_CSS {
75
  */
76
  function get_prop($objname, $params = null) {
77
  switch ($objname):
78
- case 'updates':
79
- return $this->obj_to_utf8($this->updates);
80
  case 'imports':
81
  return $this->obj_to_utf8(is_array($this->imports['child']) ? (current($this->imports['child']) == 1 ? array_keys($this->imports['child']) : array_keys(array_flip($this->imports['child']))) : array());
82
  case 'sel_ndx':
@@ -107,7 +104,8 @@ class Child_Theme_Configurator_CSS {
107
  return $this->child_version;
108
  case 'preview':
109
  $template = (empty($params['key']) || 'child' == $params['key']) ? 'child' : 'parnt';
110
- return $this->get_raw_css($template);
 
111
  endswitch;
112
  return false;
113
  }
@@ -123,14 +121,13 @@ class Child_Theme_Configurator_CSS {
123
  }
124
 
125
  function get_raw_css($template = 'child') {
126
- if ($styles = $this->read_stylesheet($template)):
127
- if (preg_match("/\}[\w\#\.]/", $styles)): // prettify compressed CSS
128
- $styles = preg_replace("/\*\/\s*/s", "*/\n", $styles); // end comment
129
- $styles = preg_replace("/\{\s*/s", " {\n ", $styles); // open brace
130
- $styles = preg_replace("/;\s*/s", ";\n ", $styles); // semicolon
131
- $styles = preg_replace("/\s*\}\s*/s", "\n}\n", $styles); // close brace
132
  endif;
133
- return $styles;
134
  endif;
135
  }
136
 
@@ -161,6 +158,7 @@ class Child_Theme_Configurator_CSS {
161
  * Update cache is returned to UI via AJAX to refresh page
162
  */
163
  function update_arrays($template, $query, $sel, $rule = null, $value = null, $important = 0, $seq = null) {
 
164
  // normalize selector styling
165
  $sel = implode(', ', preg_split('#\s*,\s*#s', trim($sel)));
166
  // add selector and query to index
@@ -174,15 +172,16 @@ class Child_Theme_Configurator_CSS {
174
  $this->dict_qs[$this->qskey]['q'] = $this->dict_query[$query];
175
  // tell the UI to update a single cached query/selector lookup by passing 'qsid' as the key
176
  // (normally the entire array is replaced):
177
- $this->updates[] = array(
178
- 'obj' => 'sel_ndx',
179
- 'key' => 'qsid',
180
- 'data' => array(
181
- 'query' => $query,
182
- 'selector' => $sel,
183
- 'qsid' => $this->qskey,
184
- ),
185
- );
 
186
  endif;
187
  if (!isset($this->dict_seq[$this->qskey]))
188
  $this->dict_seq[$this->qskey] = $this->qskey;
@@ -191,11 +190,13 @@ class Child_Theme_Configurator_CSS {
191
  if (!isset($this->dict_rule[$rule])):
192
  $this->dict_rule[$rule] = ++$this->rulekey;
193
  // tell the UI to update a single cached rule:
194
- $this->updates[] = array(
195
- 'obj' => 'rule',
196
- 'key' => $this->rulekey,
197
- 'data' => $rule,
198
- );
 
 
199
  endif;
200
  $qsid = $this->sel_ndx[$this->dict_query[$query]][$this->dict_sel[$sel]];
201
  $ruleid = $this->dict_rule[$rule];
@@ -206,63 +207,43 @@ class Child_Theme_Configurator_CSS {
206
  // set the important flag for this value
207
  $this->val_ndx[$qsid][$ruleid]['i_' . $template] = $important;
208
  // tell the UI to add a single cached query/selector data array:
209
- $updatearr = array(
210
- 'obj' => 'sel_val',
211
- 'key' => $qsid,
212
- 'data' => $this->denorm_sel_val($qsid),
213
- );
214
- $this->updates[] = $updatearr;
215
- if (isset($seq)): // this is a renamed selector
216
- $this->dict_seq[$qsid] = $seq;
217
- $this->updates[] = array(
218
- 'obj' => 'rewrite',
219
  'key' => $qsid,
220
- 'data' => $sel,
221
  );
 
 
 
 
 
 
 
 
 
 
 
222
  endif;
223
  endif;
224
  }
225
 
226
- /*
227
- * reset_updates
228
- * clears temporary update cache
229
- */
230
- function reset_updates() {
231
- $this->updates = array();
232
- }
233
-
234
- function read_stylesheet($template = 'child') {
235
  $source = $this->get_prop($template);
236
  $configtype = $this->get_prop('configtype');
237
  if (empty($source) || !is_scalar($source)) return false;
238
- $stylesheets = array();
239
  $themedir = get_theme_root() . '/' . $source;
240
- if ('parnt' == $template && (empty($configtype) || 'theme' == $configtype) && isset($_POST['ctc_scan_subdirs'])):
241
- $stylesheets = $this->recurse_directory($themedir);
242
- else:
243
- $stylesheets[] = apply_filters('chld_thm_cfg_' . $template, $themedir . '/style.css', $this);
244
- endif;
245
 
246
- // read stylesheets
247
- $styles = '';
248
- foreach ($stylesheets as $stylesheet):
249
- if ($stylesheet_verified = $this->is_file_ok($stylesheet, 'read')):
250
- $import_url = preg_replace('%^' . preg_quote($themedir) . '/%', '', $stylesheet_verified);
251
- $styles .= @file_get_contents($stylesheet_verified) . "\n";
252
- /*if ($styles && isset($_POST['ctc_scan_subdirs'])
253
- && 'parnt' == $template
254
- && (empty($configtype) || 'theme' == $configtype)
255
- && 'style.css' != $import_url):
256
- $this->imports['child']["@import url('../" . $source . '/' . $import_url . "')"] = 1;
257
- // convert relative urls to absolute
258
- $this->convert_parent_rel_url_to_abs_url($import_url, $styles);
259
- endif;*/
260
- endif;
261
- endforeach;
262
- return $styles;
263
  }
264
 
265
- function recurse_directory($rootdir, $ext = 'css') {
266
  if (!$this->is_file_ok($rootdir, 'search')) return array(); // make sure we are only recursing theme and plugin files
267
  $files = array();
268
  $dirs = array($rootdir);
@@ -290,7 +271,7 @@ class Child_Theme_Configurator_CSS {
290
  return $files;
291
  }
292
 
293
- function convert_parent_rel_url_to_abs_url($url, &$styles) {
294
  $source = $this->get_prop('parnt');
295
  $spliton = '%[/\\\\]%';
296
  $dirname = dirname($url);
@@ -303,7 +284,7 @@ class Child_Theme_Configurator_CSS {
303
  $dds .= '\.\.\/';
304
  $regex = '%url\([\'" ]*' . $dds . '(.+?)[\'" ]*\)%';
305
  $fullurl = $themeuri . '/' . $source . '/' . $upone . ('' == $upone ? '' : '/' );
306
- $styles = preg_replace($regex, "url(" . $fullurl . "$1)", $styles);
307
  endwhile;
308
  }
309
  /*
@@ -311,15 +292,17 @@ class Child_Theme_Configurator_CSS {
311
  * Parse user form input into separate properties and pass to update_arrays
312
  */
313
  function parse_post_data() {
 
314
  if (isset($_POST['ctc_new_selectors'])):
315
-
316
- $this->parse_css('child', LF . $this->parse_css_input($_POST['ctc_new_selectors']),
317
  (isset($_POST['ctc_sel_ovrd_query'])?trim($_POST['ctc_sel_ovrd_query']):null), false);
318
  elseif (isset($_POST['ctc_child_imports'])):
319
  $this->imports['child'] = array();
320
- $this->parse_css('child', $this->parse_css_input($_POST['ctc_child_imports']));
 
321
  else:
322
- $newselector = isset($_POST['ctc_rewrite_selector']) ? sanitize_text_field($this->parse_css_input(($_POST['ctc_rewrite_selector']))) : NULL;
323
  // set the custom sequence value
324
  foreach (preg_grep('#^ctc_ovrd_child_seq_#', array_keys($_POST)) as $post_key):
325
  if (preg_match('#^ctc_ovrd_child_seq_(\d+)$#', $post_key, $matches)):
@@ -335,7 +318,7 @@ class Child_Theme_Configurator_CSS {
335
  if (null == $rule || !isset($this->dict_rule[$rule])) continue;
336
  $ruleid = $this->dict_rule[$rule];
337
  $qsid = $matches[3];
338
- $value = sanitize_text_field($this->parse_css_input(($_POST[$post_key])));
339
  $important = $this->is_important($value);
340
  if (!empty($_POST['ctc_' . $valid . '_child_' . $rule . '_i_' . $qsid])) $important = 1;
341
 
@@ -417,48 +400,53 @@ class Child_Theme_Configurator_CSS {
417
  * parse_css_file
418
  * reads stylesheet to get WordPress meta data and passes rest to parse_css
419
  */
420
- function parse_css_file($template) {
421
- $styles = $this->read_stylesheet($template);
 
 
422
  // get theme name
423
  $regex = '#Theme Name:\s*(.+?)\n#i';
424
- preg_match($regex, $styles, $matches);
425
  $child_name = $this->get_prop('child_name');
426
  if (!empty($matches[1]) && 'child' == $template && empty($child_name)) $this->set_prop('child_name', $matches[1]);
427
- $this->parse_css($template, $styles);
428
  }
429
 
430
  /*
431
  * parse_css
432
  * accepts raw CSS as text and parses into separate properties
433
  */
434
- function parse_css($template, $styles, $basequery = null, $parse_imports = true) {
435
  if (false === strpos($basequery, '@')):
436
  $basequery = 'base';
437
  endif;
438
  $ruleset = array();
439
  // ignore commented code
440
- $styles = preg_replace('#\/\*.*?\*\/#s', '', $styles);
441
  // space brace to ensure correct matching
442
- $styles = preg_replace('#(\{\s*)#', "$1\n", $styles);
443
  // get all imports
444
  if ($parse_imports):
 
445
  $regex = '#(\@import.+?);#';
446
- preg_match_all($regex, $styles, $matches);
447
  foreach (preg_grep('#style\.css#', $matches[1], PREG_GREP_INVERT) as $import)
448
  $this->imports[$template][$import] = 1;
449
- $this->updates[] = array(
450
- 'obj' => 'imports',
451
- 'data' => array_keys($this->imports[$template]),
452
- );
 
 
453
  endif;
454
  // break into @ segments
455
  $regex = '#(\@media[^\{]+?)\{([^\@]*)\}#s'; // *?\})\s
456
- preg_match_all($regex, $styles, $matches);
457
  foreach ($matches[1] as $segment):
458
  $ruleset[trim($segment)] = array_shift($matches[2]);
459
  endforeach;
460
  // stripping rulesets leaves base styles
461
- $ruleset[$basequery] = preg_replace($regex, '', $styles);
462
  foreach ($ruleset as $query => $segment):
463
  // make sure there is semicolon before closing brace
464
  $segment = preg_replace('#(\})#', ";$1", $segment);
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.4
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
34
  var $valkey; // counter for dict_val
35
  // miscellaneous properties
36
  var $imports; // @import rules
37
+ var $styles; // temporary update cache
38
  var $child; // child theme slug
39
  var $parnt; // parent theme slug
40
  var $configtype; // theme or plugin extension
42
  var $child_author; // stylesheet author
43
  var $child_version; // stylesheet version
44
 
45
+ function __construct($parent = '') {
46
  // scalars
47
+ $this->version = '1.4.4';
48
  $this->querykey = 0;
49
  $this->selkey = 0;
50
  $this->qskey = 0;
51
  $this->rulekey = 0;
52
  $this->valkey = 0;
53
  $this->child = '';
54
+ $this->parnt = $parent;
55
  $this->configtype = 'theme';
56
  $this->child_name = '';
57
  $this->child_author = 'Child Theme Configurator by Lilaea Media';
66
  $this->sel_ndx = array();
67
  $this->val_ndx = array();
68
  $this->imports = array('child' => array(), 'parnt' => array());
 
69
  }
70
 
71
  /*
74
  */
75
  function get_prop($objname, $params = null) {
76
  switch ($objname):
 
 
77
  case 'imports':
78
  return $this->obj_to_utf8(is_array($this->imports['child']) ? (current($this->imports['child']) == 1 ? array_keys($this->imports['child']) : array_keys(array_flip($this->imports['child']))) : array());
79
  case 'sel_ndx':
104
  return $this->child_version;
105
  case 'preview':
106
  $template = (empty($params['key']) || 'child' == $params['key']) ? 'child' : 'parnt';
107
+ $this->get_raw_css($template);
108
+ return $this->styles;
109
  endswitch;
110
  return false;
111
  }
121
  }
122
 
123
  function get_raw_css($template = 'child') {
124
+ if ($this->read_stylesheet($template, 'style.css')):
125
+ if (preg_match("/\}[\w\#\.]/", $this->styles)): // prettify compressed CSS
126
+ $this->styles = preg_replace("/\*\/\s*/s", "*/\n", $this->styles); // end comment
127
+ $this->styles = preg_replace("/\{\s*/s", " {\n ", $this->styles); // open brace
128
+ $this->styles = preg_replace("/;\s*/s", ";\n ", $this->styles); // semicolon
129
+ $this->styles = preg_replace("/\s*\}\s*/s", "\n}\n", $this->styles); // close brace
130
  endif;
 
131
  endif;
132
  }
133
 
158
  * Update cache is returned to UI via AJAX to refresh page
159
  */
160
  function update_arrays($template, $query, $sel, $rule = null, $value = null, $important = 0, $seq = null) {
161
+ global $chld_thm_cfg;
162
  // normalize selector styling
163
  $sel = implode(', ', preg_split('#\s*,\s*#s', trim($sel)));
164
  // add selector and query to index
172
  $this->dict_qs[$this->qskey]['q'] = $this->dict_query[$query];
173
  // tell the UI to update a single cached query/selector lookup by passing 'qsid' as the key
174
  // (normally the entire array is replaced):
175
+ if ($chld_thm_cfg->cache_updates)
176
+ $chld_thm_cfg->updates[] = array(
177
+ 'obj' => 'sel_ndx',
178
+ 'key' => 'qsid',
179
+ 'data' => array(
180
+ 'query' => $query,
181
+ 'selector' => $sel,
182
+ 'qsid' => $this->qskey,
183
+ ),
184
+ );
185
  endif;
186
  if (!isset($this->dict_seq[$this->qskey]))
187
  $this->dict_seq[$this->qskey] = $this->qskey;
190
  if (!isset($this->dict_rule[$rule])):
191
  $this->dict_rule[$rule] = ++$this->rulekey;
192
  // tell the UI to update a single cached rule:
193
+ if ($chld_thm_cfg->cache_updates):
194
+ $chld_thm_cfg->updates[] = array(
195
+ 'obj' => 'rule',
196
+ 'key' => $this->rulekey,
197
+ 'data' => $rule,
198
+ );
199
+ endif;
200
  endif;
201
  $qsid = $this->sel_ndx[$this->dict_query[$query]][$this->dict_sel[$sel]];
202
  $ruleid = $this->dict_rule[$rule];
207
  // set the important flag for this value
208
  $this->val_ndx[$qsid][$ruleid]['i_' . $template] = $important;
209
  // tell the UI to add a single cached query/selector data array:
210
+ if ($chld_thm_cfg->cache_updates):
211
+ $updatearr = array(
212
+ 'obj' => 'sel_val',
 
 
 
 
 
 
 
213
  'key' => $qsid,
214
+ 'data' => $this->denorm_sel_val($qsid),
215
  );
216
+ $chld_thm_cfg->updates[] = $updatearr;
217
+ endif;
218
+ if (isset($seq)): // this is a renamed selector
219
+ $this->dict_seq[$qsid] = $seq;
220
+ if ($chld_thm_cfg->cache_updates):
221
+ $chld_thm_cfg->updates[] = array(
222
+ 'obj' => 'rewrite',
223
+ 'key' => $qsid,
224
+ 'data' => $sel,
225
+ );
226
+ endif;
227
  endif;
228
  endif;
229
  }
230
 
231
+ function read_stylesheet($template = 'child', $file = 'style.css') {
 
 
 
 
 
 
 
 
232
  $source = $this->get_prop($template);
233
  $configtype = $this->get_prop('configtype');
234
  if (empty($source) || !is_scalar($source)) return false;
 
235
  $themedir = get_theme_root() . '/' . $source;
236
+ $stylesheet = apply_filters('chld_thm_cfg_' . $template, $themedir . '/' . $file , $this);
 
 
 
 
237
 
238
+ // read stylesheet
239
+ $this->styles = '';
240
+ if ($stylesheet_verified = $this->is_file_ok($stylesheet, 'read')):
241
+ $import_url = preg_replace('%^' . preg_quote($themedir) . '/%', '', $stylesheet_verified);
242
+ $this->styles .= @file_get_contents($stylesheet_verified) . "\n";
243
+ endif;
 
 
 
 
 
 
 
 
 
 
 
244
  }
245
 
246
+ function recurse_directory($rootdir, $ext = 'css', $relative = false) {
247
  if (!$this->is_file_ok($rootdir, 'search')) return array(); // make sure we are only recursing theme and plugin files
248
  $files = array();
249
  $dirs = array($rootdir);
271
  return $files;
272
  }
273
 
274
+ function convert_parent_rel_url_to_abs_url($url) {
275
  $source = $this->get_prop('parnt');
276
  $spliton = '%[/\\\\]%';
277
  $dirname = dirname($url);
284
  $dds .= '\.\.\/';
285
  $regex = '%url\([\'" ]*' . $dds . '(.+?)[\'" ]*\)%';
286
  $fullurl = $themeuri . '/' . $source . '/' . $upone . ('' == $upone ? '' : '/' );
287
+ $this->styles = preg_replace($regex, "url(" . $fullurl . "$1)", $this->styles);
288
  endwhile;
289
  }
290
  /*
292
  * Parse user form input into separate properties and pass to update_arrays
293
  */
294
  function parse_post_data() {
295
+ $this->cache_updates = true;
296
  if (isset($_POST['ctc_new_selectors'])):
297
+ $this->styles = $this->parse_css_input(LF . $_POST['ctc_new_selectors']);
298
+ $this->parse_css('child',
299
  (isset($_POST['ctc_sel_ovrd_query'])?trim($_POST['ctc_sel_ovrd_query']):null), false);
300
  elseif (isset($_POST['ctc_child_imports'])):
301
  $this->imports['child'] = array();
302
+ $this->styles = $this->parse_css_input($_POST['ctc_child_imports']);
303
+ $this->parse_css('child');
304
  else:
305
+ $newselector = isset($_POST['ctc_rewrite_selector']) ? sanitize_text_field($this->parse_css_input($_POST['ctc_rewrite_selector'])) : NULL;
306
  // set the custom sequence value
307
  foreach (preg_grep('#^ctc_ovrd_child_seq_#', array_keys($_POST)) as $post_key):
308
  if (preg_match('#^ctc_ovrd_child_seq_(\d+)$#', $post_key, $matches)):
318
  if (null == $rule || !isset($this->dict_rule[$rule])) continue;
319
  $ruleid = $this->dict_rule[$rule];
320
  $qsid = $matches[3];
321
+ $value = sanitize_text_field($this->parse_css_input($_POST[$post_key]));
322
  $important = $this->is_important($value);
323
  if (!empty($_POST['ctc_' . $valid . '_child_' . $rule . '_i_' . $qsid])) $important = 1;
324
 
400
  * parse_css_file
401
  * reads stylesheet to get WordPress meta data and passes rest to parse_css
402
  */
403
+ function parse_css_file($template, $file = 'style.css') {
404
+ global $chld_thm_cfg;
405
+ $chld_thm_cfg->cache_updates = false;
406
+ $this->read_stylesheet($template, $file);
407
  // get theme name
408
  $regex = '#Theme Name:\s*(.+?)\n#i';
409
+ preg_match($regex, $this->styles, $matches);
410
  $child_name = $this->get_prop('child_name');
411
  if (!empty($matches[1]) && 'child' == $template && empty($child_name)) $this->set_prop('child_name', $matches[1]);
412
+ $this->parse_css($template);
413
  }
414
 
415
  /*
416
  * parse_css
417
  * accepts raw CSS as text and parses into separate properties
418
  */
419
+ function parse_css($template, $basequery = null, $parse_imports = true) {
420
  if (false === strpos($basequery, '@')):
421
  $basequery = 'base';
422
  endif;
423
  $ruleset = array();
424
  // ignore commented code
425
+ $this->styles = preg_replace('#\/\*.*?\*\/#s', '', $this->styles);
426
  // space brace to ensure correct matching
427
+ $this->styles = preg_replace('#(\{\s*)#', "$1\n", $this->styles);
428
  // get all imports
429
  if ($parse_imports):
430
+ global $chld_thm_cfg;
431
  $regex = '#(\@import.+?);#';
432
+ preg_match_all($regex, $this->styles, $matches);
433
  foreach (preg_grep('#style\.css#', $matches[1], PREG_GREP_INVERT) as $import)
434
  $this->imports[$template][$import] = 1;
435
+ if ($chld_thm_cfg->cache_updates):
436
+ $chld_thm_cfg->updates[] = array(
437
+ 'obj' => 'imports',
438
+ 'data' => array_keys($this->imports[$template]),
439
+ );
440
+ endif;
441
  endif;
442
  // break into @ segments
443
  $regex = '#(\@media[^\{]+?)\{([^\@]*)\}#s'; // *?\})\s
444
+ preg_match_all($regex, $this->styles, $matches);
445
  foreach ($matches[1] as $segment):
446
  $ruleset[trim($segment)] = array_shift($matches[2]);
447
  endforeach;
448
  // stripping rulesets leaves base styles
449
+ $ruleset[$basequery] = preg_replace($regex, '', $this->styles);
450
  foreach ($ruleset as $query => $segment):
451
  // make sure there is semicolon before closing brace
452
  $segment = preg_replace('#(\})#', ";$1", $segment);
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.3
9
  Author: Lilaea Media
10
  Author URI: http://www.lilaeamedia.com/
11
  Text Domain: chld_thm_cfg
@@ -27,7 +27,7 @@ class Child_Theme_Configurator_UI {
27
  global $chld_thm_cfg;
28
  $css = $chld_thm_cfg->css;
29
  $themes = $chld_thm_cfg->themes;
30
- $parent = $css->get_prop('parnt');
31
  $child = $css->get_prop('child');
32
  $configtype = $css->get_prop('configtype');
33
  $hidechild = (count($themes['child']) ? '' : 'style="display:none"');
@@ -157,15 +157,29 @@ class Child_Theme_Configurator_UI {
157
  value="1" />
158
  </div>
159
  </div>
 
 
 
160
  <div class="ctc-input-row clearfix" id="input_row_child_template">
161
- <div class="ctc-input-cell"> <strong>
162
- <?php _e('Scan Parent Theme<br/>for Additional Stylesheets', 'chld_thm_cfg'); ?>
163
- </strong> </div>
164
- <div class="ctc-input-cell">
165
- <input class="ctc_checkbox" id="ctc_scan_subdirs" name="ctc_scan_subdirs" type="checkbox"
166
- value="1" />
 
 
 
 
 
 
 
 
 
 
167
  </div>
168
  </div>
 
169
  <div class="ctc-input-row clearfix" id="input_row_child_template">
170
  <div class="ctc-input-cell"> <strong>&nbsp;</strong> </div>
171
  <div class="ctc-input-cell">
@@ -440,8 +454,7 @@ class Child_Theme_Configurator_UI {
440
  <p><strong>
441
  <?php _e('CAUTION: If your child theme is active, the child theme version of the file will be used instead of the parent immediately after it is copied.', 'chld_thm_cfg');?>
442
  </strong></p>
443
- <p class="howto">
444
- <?php echo sprintf(__('The %s file is generated separately and cannot be copied here.', 'chld_thm_cfg'),
445
  $editorlink . '<code>functions.php</code>' . $editorlinkend
446
  );
447
  else:
@@ -575,8 +588,9 @@ class Child_Theme_Configurator_UI {
575
  <li>Enter a Name for the child theme.</li>
576
  <li>Enter an author for the child theme.</li>
577
  <li>Enter the child theme version number.</li>
578
- <li>If your theme uses multiple stylesheets, check "Scan Parent Theme for additional stylesheets.</li>
579
- <li>Click "Generate Child Theme." If you are loading an existing child theme, The Child Theme Configurator will create a backup of your existing stylesheet in the theme directory.</li></ol>
 
580
  ', 'chld_thm_cfg'
581
  ),
582
  ) );
@@ -676,8 +690,6 @@ class Child_Theme_Configurator_UI {
676
  <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>
677
  <h5>Why doesn\'t the Parent Theme have any styles when I "View Parent CSS"?</h5>
678
  <p>Your Parent theme is probably using a non-standard location for the stylesheets. Check "Scan Parent Theme for additional stylesheets" on the Parent/Child tab and load the Child Theme again.</p>
679
- <h5>Why is everything backwards?</h5>
680
- <p>More than likely you selected "Scan Parent Theme for additional stylesheets" and your theme uses a "right-to-left" (rtl) stylesheet. Go to the @imports tab and remove the rtl stylesheet from the list of imported stylesheets.</p>
681
  <h5 id="menus-broken">Why are my menus displaying incorrectly when I activate the new child theme?</h5>
682
  <p>The child theme creates a new instance in the WordPress options data and the menus have to be assigned. Go to Appearance &gt; Menus and assign locations to each of the menus for the new Child Theme.</p>
683
  <h5 "preview-not-loading">Why do the preview tabs return "Stylesheet could not be displayed"?</h5>
@@ -695,10 +707,11 @@ class Child_Theme_Configurator_UI {
695
  <h5 id="gradients">How do I create cross-browser gradients?</h5>
696
  <p>The Child Theme Configurator automatically generates the vendor prefixes and filters to display gradients across most browsers. It uses a normalized syntax and only supports two colors without intermediate stops. The inputs consist of origin (e.g., top, left, 135deg, etc.), start color and end color. The browser-specific syntax is generated automatically when you save these values. <strong>Note:</strong> For Internet Explorer, a filter rule approximates the gradient but can only be horizontal (origin top) or vertical (origin left). The legacy webkit-gradient syntax is not supported.</p>
697
  <h5 id="responsive">How do I make my Theme responsive?</h5>
698
- <p>This topic is beyond the scope of this document. The short answer is to use a responsive Parent Theme. Some common characteristics of responsive design are:
699
  <ul><li>Avoiding fixed width and height values. Using max- and min-height values and percentages are ways to make your designs respond to the viewer\'s browser size.</li>
700
  <li>Combining floats and clears with inline and relative positions allow the elements to adjust gracefully to their container\'s width.</li>
701
  <li>Showing and hiding content with Javascript.</li></ul>
 
702
  <h5 id="web_fonts">How do I add Web Fonts?</h5>
703
  <p>The easiest method is to paste the @import code provided by Google, Font Squirrel or any other Web Font site into the @import tab. The fonts will then be available to use as a value of the <strong>font-family</strong> rule. Be sure you understand the license for any embedded fonts.</p>
704
  <p>You can also create a secondary stylesheet that contains @font-face rules and import it using the @import tab. <strong>Note:</strong> Currently the Child Theme Configurator does not generate previews of imported web fonts, but will in a later release.</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.4.4
9
  Author: Lilaea Media
10
  Author URI: http://www.lilaeamedia.com/
11
  Text Domain: chld_thm_cfg
27
  global $chld_thm_cfg;
28
  $css = $chld_thm_cfg->css;
29
  $themes = $chld_thm_cfg->themes;
30
+ $parent = isset($_GET['ctc_parent']) ? sanitize_text_field($_GET['ctc_parent']) : $css->get_prop('parnt');
31
  $child = $css->get_prop('child');
32
  $configtype = $css->get_prop('configtype');
33
  $hidechild = (count($themes['child']) ? '' : 'style="display:none"');
157
  value="1" />
158
  </div>
159
  </div>
160
+ <?php if (empty($configtype) || 'theme' == $configtype):
161
+ $stylesheets = $chld_thm_cfg->get_additional_css($parent);
162
+ if (count($stylesheets)):?>
163
  <div class="ctc-input-row clearfix" id="input_row_child_template">
164
+ <div class="ctc-input-cell" id="ctc_additional_css_label"> <strong> <span><?php _e('Parse additional stylesheets:', 'chld_thm_cfg'); ?></span> </strong>
165
+ <p><?php _e('(click to toggle)', 'chld_thm_cfg'); ?></p>
166
+ </div>
167
+ <div class="ctc-input-cell-wide" id="ctc_additional_css_files" style="display:none">
168
+ <p style="margin-top:0">
169
+ <?php _e('Select only the stylesheets you wish to customize to reduce overhead.', 'chld_thm_cfg'); ?>
170
+ </p>
171
+ <?php
172
+ foreach ($stylesheets as $stylesheet): ?>
173
+ <div class="ctc-input-cell">
174
+ <label>
175
+ <input class="ctc_checkbox" name="ctc_additional_css[]" type="checkbox"
176
+ value="<?php echo $stylesheet; ?>" />
177
+ <?php echo $stylesheet; ?></label>
178
+ </div>
179
+ <?php endforeach; ?>
180
  </div>
181
  </div>
182
+ <?php endif; endif; ?>
183
  <div class="ctc-input-row clearfix" id="input_row_child_template">
184
  <div class="ctc-input-cell"> <strong>&nbsp;</strong> </div>
185
  <div class="ctc-input-cell">
454
  <p><strong>
455
  <?php _e('CAUTION: If your child theme is active, the child theme version of the file will be used instead of the parent immediately after it is copied.', 'chld_thm_cfg');?>
456
  </strong></p>
457
+ <p class="howto"> <?php echo sprintf(__('The %s file is generated separately and cannot be copied here.', 'chld_thm_cfg'),
 
458
  $editorlink . '<code>functions.php</code>' . $editorlinkend
459
  );
460
  else:
588
  <li>Enter a Name for the child theme.</li>
589
  <li>Enter an author for the child theme.</li>
590
  <li>Enter the child theme version number.</li>
591
+ <li>If you check "Backup Stylesheet", The Child Theme Configurator will create a backup in the theme directory.</li>
592
+ <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>
593
+ <li>Click "Generate Child Theme."</li></ol>
594
  ', 'chld_thm_cfg'
595
  ),
596
  ) );
690
  <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>
691
  <h5>Why doesn\'t the Parent Theme have any styles when I "View Parent CSS"?</h5>
692
  <p>Your Parent theme is probably using a non-standard location for the stylesheets. Check "Scan Parent Theme for additional stylesheets" on the Parent/Child tab and load the Child Theme again.</p>
 
 
693
  <h5 id="menus-broken">Why are my menus displaying incorrectly when I activate the new child theme?</h5>
694
  <p>The child theme creates a new instance in the WordPress options data and the menus have to be assigned. Go to Appearance &gt; Menus and assign locations to each of the menus for the new Child Theme.</p>
695
  <h5 "preview-not-loading">Why do the preview tabs return "Stylesheet could not be displayed"?</h5>
707
  <h5 id="gradients">How do I create cross-browser gradients?</h5>
708
  <p>The Child Theme Configurator automatically generates the vendor prefixes and filters to display gradients across most browsers. It uses a normalized syntax and only supports two colors without intermediate stops. The inputs consist of origin (e.g., top, left, 135deg, etc.), start color and end color. The browser-specific syntax is generated automatically when you save these values. <strong>Note:</strong> For Internet Explorer, a filter rule approximates the gradient but can only be horizontal (origin top) or vertical (origin left). The legacy webkit-gradient syntax is not supported.</p>
709
  <h5 id="responsive">How do I make my Theme responsive?</h5>
710
+ <p>The short answer is to use a responsive Parent Theme. Some common characteristics of responsive design are:</p>
711
  <ul><li>Avoiding fixed width and height values. Using max- and min-height values and percentages are ways to make your designs respond to the viewer\'s browser size.</li>
712
  <li>Combining floats and clears with inline and relative positions allow the elements to adjust gracefully to their container\'s width.</li>
713
  <li>Showing and hiding content with Javascript.</li></ul>
714
+ <iframe width="480" height="270" src="//www.youtube.com/embed/iBiiAgsK4G4?rel=0&modestbranding=1" frameborder="0" allowfullscreen></iframe>
715
  <h5 id="web_fonts">How do I add Web Fonts?</h5>
716
  <p>The easiest method is to paste the @import code provided by Google, Font Squirrel or any other Web Font site into the @import tab. The fonts will then be available to use as a value of the <strong>font-family</strong> rule. Be sure you understand the license for any embedded fonts.</p>
717
  <p>You can also create a secondary stylesheet that contains @font-face rules and import it using the @import tab. <strong>Note:</strong> Currently the Child Theme Configurator does not generate previews of imported web fonts, but will in a later release.</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.3
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
@@ -32,6 +32,8 @@ class Child_Theme_Configurator {
32
  var $is_ajax;
33
  var $updated;
34
  var $image_formats;
 
 
35
 
36
  function __construct($file) {
37
  $this->dir = dirname( $file );
@@ -45,7 +47,7 @@ class Child_Theme_Configurator {
45
  $this->pluginPath = $this->dir . '/';
46
  $this->pluginURL = plugin_dir_url($file);
47
  $this->image_formats = array('jpg','jpeg','gif','png','JPG','JPEG','GIF','PNG');
48
-
49
  // setup plugin hooks
50
  add_action('admin_menu', array(&$this, 'admin_menu'));
51
  add_action('admin_enqueue_scripts', array(&$this, 'enqueue_scripts'));
@@ -154,9 +156,7 @@ class Child_Theme_Configurator {
154
  $this->load_config();
155
  $this->css->parse_post_data();
156
  $this->css->write_css();
157
- $result = $this->css->get_prop('updates');
158
- // clear updates so they aren't saved in options object
159
- $this->css->reset_updates();
160
  update_option($this->optionsName, $this->css);
161
  // send all updates back to browser to update cache
162
  die(json_encode($result));
@@ -195,9 +195,10 @@ class Child_Theme_Configurator {
195
  || ! $this->check_theme_exists($this->css->get_prop('parnt'))
196
  // upgrade to v.1.1.1
197
  || !($version = $this->css->get_prop('version'))
198
- )
199
-
200
- $this->css = new Child_Theme_Configurator_CSS();
 
201
  }
202
 
203
  function write_config() {
@@ -208,7 +209,6 @@ class Child_Theme_Configurator {
208
  && !isset($_POST['ctc_theme_image_submit'])
209
  && !isset($_POST['ctc_theme_screenshot_submit'])) return false;
210
  $this->errors = array();
211
- //die(print_r($_POST, true));
212
  if (current_user_can('install_themes')): // && $this->validate_post()):
213
  if (isset($_POST['ctc_load_styles'])):
214
  foreach (array(
@@ -258,11 +258,15 @@ class Child_Theme_Configurator {
258
  do_action('chld_thm_cfg_addl_files', $this); // hook for add'l plugin files and subdirectories
259
  $this->css->parse_css_file('parnt');
260
  $this->css->parse_css_file('child');
 
 
 
 
 
261
  if (false === $this->css->write_css(isset($_POST['ctc_backup']))):
262
  $this->errors[] = __('Your stylesheet is not writable. Please adjust permissions and try again.', 'chld_thm_cfg');
263
  return false;
264
  endif;
265
- $this->css->reset_updates();
266
  update_option($this->optionsName, $this->css);
267
  do_action('chld_thm_cfg_addl_options', $this); // hook for add'l plugin options
268
  $msg = 1; //isset($_POST['ctc_scan_subdirs']) ? '9&tab=import_options' : 1;
@@ -397,6 +401,17 @@ class Child_Theme_Configurator {
397
 
398
  }
399
 
 
 
 
 
 
 
 
 
 
 
 
400
  function handle_file_upload($field, $childdir = NULL){
401
  /* adapted from http://www.php.net/manual/en/features.file-upload.php#114004 */
402
  try {
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.4
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
32
  var $is_ajax;
33
  var $updated;
34
  var $image_formats;
35
+ var $updates = array();
36
+ var $cache_updates;
37
 
38
  function __construct($file) {
39
  $this->dir = dirname( $file );
47
  $this->pluginPath = $this->dir . '/';
48
  $this->pluginURL = plugin_dir_url($file);
49
  $this->image_formats = array('jpg','jpeg','gif','png','JPG','JPEG','GIF','PNG');
50
+ $this->cache_updates = true;
51
  // setup plugin hooks
52
  add_action('admin_menu', array(&$this, 'admin_menu'));
53
  add_action('admin_enqueue_scripts', array(&$this, 'enqueue_scripts'));
156
  $this->load_config();
157
  $this->css->parse_post_data();
158
  $this->css->write_css();
159
+ $result = $this->css->obj_to_utf8($this->updates);
 
 
160
  update_option($this->optionsName, $this->css);
161
  // send all updates back to browser to update cache
162
  die(json_encode($result));
195
  || ! $this->check_theme_exists($this->css->get_prop('parnt'))
196
  // upgrade to v.1.1.1
197
  || !($version = $this->css->get_prop('version'))
198
+ ):
199
+ $parent = get_template();
200
+ $this->css = new Child_Theme_Configurator_CSS($parent);
201
+ endif;
202
  }
203
 
204
  function write_config() {
209
  && !isset($_POST['ctc_theme_image_submit'])
210
  && !isset($_POST['ctc_theme_screenshot_submit'])) return false;
211
  $this->errors = array();
 
212
  if (current_user_can('install_themes')): // && $this->validate_post()):
213
  if (isset($_POST['ctc_load_styles'])):
214
  foreach (array(
258
  do_action('chld_thm_cfg_addl_files', $this); // hook for add'l plugin files and subdirectories
259
  $this->css->parse_css_file('parnt');
260
  $this->css->parse_css_file('child');
261
+ if (isset($_POST['ctc_additional_css']) && is_array($_POST['ctc_additional_css'])):
262
+ foreach ($_POST['ctc_additional_css'] as $file):
263
+ $this->css->parse_css_file('parnt', $file);
264
+ endforeach;
265
+ endif;
266
  if (false === $this->css->write_css(isset($_POST['ctc_backup']))):
267
  $this->errors[] = __('Your stylesheet is not writable. Please adjust permissions and try again.', 'chld_thm_cfg');
268
  return false;
269
  endif;
 
270
  update_option($this->optionsName, $this->css);
271
  do_action('chld_thm_cfg_addl_options', $this); // hook for add'l plugin options
272
  $msg = 1; //isset($_POST['ctc_scan_subdirs']) ? '9&tab=import_options' : 1;
401
 
402
  }
403
 
404
+ function get_additional_css($parnt) {
405
+ $themedir = get_theme_root() . '/' . $parnt;
406
+ $files = array();
407
+ foreach ($this->css->recurse_directory($themedir) as $file):
408
+ $file = preg_replace('%^' . preg_quote($themedir) . '\/%', '', $file);
409
+ if ('style.css' != $file) $files[] = $file;
410
+ endforeach;
411
+ return $files;
412
+ }
413
+
414
+
415
  function handle_file_upload($field, $childdir = NULL){
416
  /* adapted from http://www.php.net/manual/en/features.file-upload.php#114004 */
417
  try {
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.3
6
  * Author: Lilaea Media
7
  * Author URI: http://www.lilaeamedia.com/
8
  * License: GPLv2
@@ -581,7 +581,7 @@ jQuery(document).ready(function($){
581
  postdata,
582
  //on success function
583
  function(response){
584
- // console.log(response);
585
  // release button
586
  $(obj).prop('disabled', false);
587
  // hide spinner
@@ -942,7 +942,15 @@ jQuery(document).ready(function($){
942
  e.preventDefault();
943
  ctc_selector_input_toggle(this);
944
  });//ctc_rewrite_toggle
945
-
 
 
 
 
 
 
 
 
946
  // initialize menus
947
  ctc_setup_menus();
948
  ctc_set_query(currentQuery);
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.4
6
  * Author: Lilaea Media
7
  * Author URI: http://www.lilaeamedia.com/
8
  * License: GPLv2
581
  postdata,
582
  //on success function
583
  function(response){
584
+ //console.log(response);
585
  // release button
586
  $(obj).prop('disabled', false);
587
  // hide spinner
942
  e.preventDefault();
943
  ctc_selector_input_toggle(this);
944
  });//ctc_rewrite_toggle
945
+ $(document).on('change', '#ctc_theme_parnt', function(e) {
946
+ $(this).parents('.ctc-input-row').first().append('<span class="ctc-status-icon spinner"></span>');
947
+ $('.spinner').show();
948
+ document.location='?page=chld_thm_cfg_menu&ctc_parent=' + $(this).val();
949
+ });
950
+ $(document).on('click', '#ctc_additional_css_label', function(e){
951
+ $(this).toggleClass('open');
952
+ $('#ctc_additional_css_files').slideToggle('fast');
953
+ });
954
  // initialize menus
955
  ctc_setup_menus();
956
  ctc_set_query(currentQuery);
js/chld-thm-cfg.min.js CHANGED
@@ -2,10 +2,10 @@
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.3
6
  * Author: Lilaea Media
7
  * Author URI: http://www.lilaeamedia.com/
8
  * License: GPLv2
9
  * Copyright (C) 2013 Lilaea Media
10
  */
11
- ;jQuery(document).ready(function(c){var l="\n",s="base",h,b={},p,q,k=function(t){c(t).iris({change:function(){f(t)}})},e=function(v){var t=parseInt(v),u=String.fromCharCode(t);return u},m=function(u){var t=u.charCodeAt(0);return t},f=function(z){var v=/^(ctc_(ovrd|\d+)_(parent|child)_([0-9a-z\-]+)_(\d+))(_\w+)?$/,A=c(z).parents(".ctc-selector-row, .ctc-parent-row").first(),y=A.find(".ctc-swatch").first(),x={parent:{},child:{}},w={parent:{origin:"",start:"",end:""},child:{origin:"",start:"",end:""}},u={child:false,parent:false},t={};A.find(".ctc-parent-value, .ctc-child-value").each(function(){var I=c(this).attr("id"),B=I.toString().match(v),J=B[2],C=B[3],L=("undefined"==typeof B[4]?"":B[4]),H=B[5],G=("undefined"==typeof B[6]?"":B[6]),K=("parent"==C?c(this).text():c(this).val()),D="ctc_"+J+"_child_"+L+"_i_"+H,F,E;if("child"==C){t[I]=K;t[D]=(c("#"+D).is(":checked"))?1:0}if(""!=K){if(false===r(G)){switch(G){case"_border_width":x[C][L+"-width"]=K;break;case"_border_style":x[C][L+"-style"]=K;break;case"_border_color":x[C][L+"-color"]=K;break;case"_background_url":x[C]["background-image"]=i(C,K);break;case"_background_color":x[C]["background-color"]=z.value;break;case"_background_color1":w[C].start=K;u[C]=true;break;case"_background_color2":w[C].end=K;u[C]=true;break;case"_background_origin":w[C].origin=K;u[C]=true;break}}else{if(F=L.toString().match(/^border(\-(top|right|bottom|left))?$/)&&!K.match(/none/)){E=K.toString().split(/ +/);x[C][L+"-width"]="undefined"==typeof E[0]?"":E[0];x[C][L+"-style"]="undefined"==typeof E[1]?"":E[1];x[C][L+"-color"]="undefined"==typeof E[2]?"":E[2]}else{if("background-image"==L){if(K.toString().match(/url\(/)){x[C]["background-image"]=i(C,K)}else{E=K.toString().split(/ +/);if(E.length>2){w[C].origin="undefined"==typeof E[0]?"top":E[0];w[C].start="undefined"==typeof E[1]?"transparent":E[1];w[C].end="undefined"==typeof E[2]?"transparent":E[2];u[C]=true}else{x[C]["background-image"]=K}}}else{x[C][L]=K}}}}});if("undefined"!=typeof y&&false===r(y.attr("id"))){c(y).removeAttr("style");if(u.parent){c(y).ctcgrad(w.parent.origin,[w.parent.start,w.parent.end])}c(y).css(x.parent);if(!(y.attr("id").toString().match(/parent/))){if(u.child){c(y).ctcgrad(w.child.origin,[w.child.start,w.child.end])}c(y).css(x.child)}}return t},n=function(u){var t,v,w;c(u).each(function(){switch(this.obj){case"imports":ctcAjax.imports=this.data;break;case"rule_val":ctcAjax.rule_val[this.key]=this.data;w=this.key;break;case"val_qry":ctcAjax.val_qry[this.key]=this.data;break;case"rule":ctcAjax.rule=this.data;break;case"sel_ndx":if(r(this.key)){ctcAjax.sel_ndx=this.data}else{if("qsid"==this.key){if(r(ctcAjax.sel_ndx[this.data.query])){ctcAjax.sel_ndx[this.data.query]={}}ctcAjax.sel_ndx[this.data.query][this.data.selector]=this.data.qsid}else{ctcAjax.sel_ndx[this.key]=this.data;t=this.key}}break;case"sel_val":ctcAjax.sel_val[this.key]=this.data;v=this.key;break;case"rewrite":p=this.key;q=this.data;break}})},i=function(x,u){var w=u.toString().match(/url\(['" ]*(.+?)['" ]*\)/),v=r(w)?null:w[1],t=ctcAjax.theme_uri+"/"+("parent"==x?ctcAjax.parnt:ctcAjax.child)+"/",y;if(!v){return false}else{if(v.toString().match(/^(https?:|\/)/)){y=u}else{y="url("+t+v+")"}}return y},r=function(u){if("undefined"==typeof u||false===u||null===u||""===u){return true}if(true===u||"string"===typeof u||"number"===typeof u){return false}if("object"===typeof u){for(var t in u){if(u.hasOwnProperty(t)){return false}}return true}return false},a=function(){var t=[];if(1===loading.sel_ndx){return t}if(0===loading.sel_ndx){loading.sel_ndx=1;ctc_query_css("sel_ndx",null,ctc_setup_query_menu);return t}if(false===r(ctcAjax.sel_ndx)){c.each(ctcAjax.sel_ndx,function(u,v){var w={label:u,value:u};t.push(w)})}return t},o=function(u){var t=[];if(1===loading.sel_ndx){return t}if(0===loading.sel_ndx){loading.sel_ndx=1;ctc_query_css("sel_ndx",u,ctc_setup_selector_menu);return t}if(false===r(ctcAjax.sel_ndx[u])){c.each(ctcAjax.sel_ndx[u],function(v,w){var x={label:v,value:w};t.push(x)})}return t},d=function(){var t=[];if(1===loading.rule){return t}if(0===loading.rule){loading.rule=1;ctc_query_css("rule",null,ctc_setup_rule_menu);return t}if(false===r(ctcAjax.rule)){c.each(ctcAjax.rule,function(u,v){var w={label:v.replace(/\d+/g,e),value:u};t.push(w)})}return t.sort(function(v,u){if(v.label>u.label){return 1}if(v.label<u.label){return -1}return 0})},j=function(x,z,C){var v="",A=(r(ctcAjax.sel_val[x])||r(ctcAjax.sel_val[x].value)||r(ctcAjax.sel_val[x].value[z])?"":ctcAjax.sel_val[x].value[z]),u=ctc_decode_value(z,("undefined"==typeof A?"":A.parnt)),y=(false===r(A.i_parnt)&&A.i_parnt)?ctcAjax.important_label:"",w=ctc_decode_value(z,("undefined"==typeof A?"":A.child)),t=(false===r(A.i_child)&&A.i_child)?1:0,B="ctc_"+C+"_child_"+z+"_i_"+x;if(false===r(ctcAjax.sel_val[x])){v+='<div class="ctc-'+("ovrd"==C?"input":"selector")+'-row clearfix">'+l;v+='<div class="ctc-input-cell">'+("ovrd"==C?z.replace(/\d+/g,e):ctcAjax.sel_val[x].selector+'<br/><a href="#" class="ctc-selector-edit" id="ctc_selector_edit_'+x+'" >'+ctcAjax.edit_txt+"</a> "+(r(u.orig)?ctcAjax.child_only_txt:""))+"</div>"+l;if("ovrd"==C){v+='<div class="ctc-parent-value ctc-input-cell" id="ctc_'+C+"_parent_"+z+"_"+x+'">'+(r(u.orig)?"[no value]":u.orig+y)+"</div>"+l}v+='<div class="ctc-input-cell">'+l;if(false===r(u.names)){c.each(u.names,function(D,E){E=(r(E)?"":E);v+='<div class="ctc-child-input-cell">'+l;var G="ctc_"+C+"_child_"+z+"_"+x+E,F;if(false===(F=w.values.shift())){F=""}v+=(r(E)?"":ctcAjax.field_labels[E]+":<br/>")+'<input type="text" id="'+G+'" name="'+G+'" class="ctc-child-value'+((E+z).toString().match(/color/)?" color-picker":"")+((E).toString().match(/url/)?" ctc-input-wide":"")+'" value="'+F+'" />'+l;v+="</div>"+l});v+='<label for="'+B+'"><input type="checkbox" id="'+B+'" name="'+B+'" value="1" '+(1===t?"checked":"")+" />"+ctcAjax.important_label+"</label>"+l}v+="</div>"+l;v+=("ovrd"==C?"":'<div class="ctc-swatch ctc-specific" id="ctc_child_'+z+"_"+x+'_swatch">'+ctcAjax.swatch_txt+"</div>"+l+'<div class="ctc-child-input-cell ctc-button-cell" id="ctc_save_'+z+"_"+x+'_cell">'+l+'<input type="button" class="button ctc-save-input" id="ctc_save_'+z+"_"+x+'" name="ctc_save_'+z+"_"+x+'" value="Save" /></div>'+l);v+="</div><!-- end input row -->"+l}return v},g=function(t){if(1===loading.sel_val){return false}if(0==loading.sel_val){loading.sel_val=1;ctc_query_css("sel_val",t,g);return false}var w,u,v;if(r(ctcAjax.sel_val[t])){c("#ctc_sel_ovrd_rule_inputs").html("")}else{if(r(ctcAjax.sel_val[t].seq)){c("#ctc_child_load_order_container").html("")}else{w="ctc_ovrd_child_seq_"+t;v=parseInt(ctcAjax.sel_val[t].seq);u='<input type="text" id="'+w+'" name="'+w+'" class="ctc-child-value" value="'+v+'" />';c("#ctc_child_load_order_container").html(u)}if(r(ctcAjax.sel_val[t].value)){c("#ctc_sel_ovrd_rule_inputs").html("")}else{u="";c.each(ctcAjax.sel_val[t].value,function(y,x){u+=j(t,y,"ovrd")});c("#ctc_sel_ovrd_rule_inputs").html(u).find(".color-picker").each(function(){k(this)});f("#ctc_child_all_0_swatch")}}};ctc_render_css_preview=function(t){if(1===loading.preview){return false}if(0==loading.preview){loading.preview=1;var t;if(!(t=c(this).attr("id").toString().match(/(child|parnt)/)[1])){t="child"}ctc_set_notice("");ctc_query_css("preview",t,ctc_render_css_preview);return false}if(2==loading.preview){c("#view_"+t+"_options_panel").text(ctcAjax.previewResponse);loading.preview=0}},ctc_render_rule_value_inputs=function(u){if(1===loading.rule_val){return false}if(0==loading.rule_val){loading.rule_val=1;ctc_query_css("rule_val",u,ctc_render_rule_value_inputs);return false}var v=ctcAjax.rule[u],t='<div class="ctc-input-row clearfix" id="ctc_rule_row_'+v+'">'+l;if(false===r(ctcAjax.rule_val[u])){c.each(ctcAjax.rule_val[u],function(x,y){var w=ctc_decode_value(v,y);t+='<div class="ctc-parent-row clearfix" id="ctc_rule_row_'+v+"_"+x+'">'+l;t+='<div class="ctc-input-cell ctc-parent-value" id="ctc_'+x+"_parent_"+v+"_"+x+'">'+w.orig+"</div>"+l;t+='<div class="ctc-input-cell">'+l;t+='<div class="ctc-swatch ctc-specific" id="ctc_'+x+"_parent_"+v+"_"+x+'_swatch">'+ctcAjax.swatch_txt+"</div></div>"+l;t+='<div class="ctc-input-cell"><a href="#" class="ctc-selector-handle" id="ctc_selector_'+v+"_"+x+'">'+ctcAjax.selector_txt+"</a></div>"+l;t+='<div id="ctc_selector_'+v+"_"+x+'_container" class="ctc-selector-container clearfix">'+l;t+='<a href="#" id="ctc_selector_'+v+"_"+x+'_close" class="ctc-selector-handle" style="float:right">'+ctcAjax.close_txt+'</a><div id="ctc_status_val_qry_'+x+'"></div>'+l;t+='<div id="ctc_selector_'+v+"_"+x+'_rows"></div>'+l;t+="</div></div>"+l});t+="</div>"+l}c("#ctc_rule_value_inputs").html(t).find(".ctc-swatch").each(function(){f(this)})},ctc_render_selector_value_inputs=function(w){if(1==loading.val_qry){return false}var y,u,x=c("#ctc_rule_menu_selected").text().replace(/[^\w\-]/g,m),t,v="";if(0===loading.val_qry){loading.val_qry=1;y={rule:x};ctc_query_css("val_qry",w,ctc_render_selector_value_inputs,y);return false}if(false===r(ctcAjax.val_qry[w])){c.each(ctcAjax.val_qry[w],function(A,z){page_rule=A;c.each(z,function(C,B){v+='<h4 class="ctc-query-heading">'+C+"</h4>"+l;if(false===r(B)){c.each(B,function(D,E){ctcAjax.sel_val[D]=E;v+=j(D,A,w)})}})})}t="#ctc_selector_"+x+"_"+w+"_rows";c(t).html(v).find(".color-picker").each(function(){k(this)});c(t).find(".ctc-swatch").each(function(){f(this)})},ctc_query_css=function(v,u,y,w){var t={ctc_query_obj:v,ctc_query_key:u},x="#ctc_status_"+v+("val_qry"==v?"_"+u:"");if("object"===typeof w){c.each(w,function(z,A){t["ctc_query_"+z]=A})}c(".ctc-status-icon").remove();c(x).append('<span class="ctc-status-icon spinner"></span>');c(".spinner").show();t.action="ctc_query";t._wpnonce=c("#_wpnonce").val();c.post(ctcAjax.ajaxurl,t,function(z){loading[v]=2;c(".ctc-status-icon").removeClass("spinner");if(r(z)){c(".ctc-status-icon").addClass("failure");if("preview"==v){ctcAjax.previewResponse=ctcAjax.css_fail_txt;y(u)}}else{c(".ctc-status-icon").addClass("success");if("preview"==v){ctcAjax.previewResponse=z.shift().data}else{n(z)}if("function"===typeof y){y(u)}return false}},"json").fail(function(){c(".ctc-status-icon").removeClass("spinner");c(".ctc-status-icon").addClass("failure");if("preview"==v){ctcAjax.previewResponse=ctcAjax.css_fail_txt;loading[v]=2;y(u)}else{loading[v]=0}});return false},ctc_save=function(y){var w={},z,v,t,u,A=c(y).attr("id"),x;if(r(b[A])){b[A]=0}b[A]++;c(y).prop("disabled",true);c(".ctc-status-icon").remove();c(y).parent(".ctc-textarea-button-cell, .ctc-button-cell").append('<span class="ctc-status-icon spinner"></span>');c(".spinner").show();if((z=c("#ctc_new_selectors"))&&"ctc_save_new_selectors"==c(y).attr("id")){w.ctc_new_selectors=z.val();if(v=c("#ctc_sel_ovrd_query_selected")){w.ctc_sel_ovrd_query=v.text()}}else{if((t=c("#ctc_child_imports"))&&"ctc_save_imports"==c(y).attr("id")){w.ctc_child_imports=t.val()}else{w=f(y)}}c("#ctc_sel_ovrd_selector_selected").find("#ctc_rewrite_selector").each(function(){x=c("#ctc_rewrite_selector").val(),origsel=c("#ctc_rewrite_selector_orig").val();if(r(x)||!x.toString().match(/\w/)){x=origsel}else{w.ctc_rewrite_selector=x}c(".ctc-rewrite-toggle").text(ctcAjax.rename_txt);c("#ctc_sel_ovrd_selector_selected").html(x)});w.action="ctc_update";w._wpnonce=c("#_wpnonce").val();c.post(ctcAjax.ajaxurl,w,function(B){c(y).prop("disabled",false);c(".ctc-status-icon").removeClass("spinner");if(r(B)){c(".ctc-status-icon").addClass("failure")}else{c(".ctc-status-icon").addClass("success");c("#ctc_new_selectors").val("");n(B);ctc_setup_menus();if(false===r(p)){ctc_set_selector(p,q);p=q=null}}return false},"json").fail(function(){c(y).prop("disabled",false);c(".ctc-status-icon").removeClass("spinner");c(".ctc-status-icon").addClass("failure")});return false},ctc_decode_value=function(v,t){t=("undefined"==typeof t?"":t);var u={orig:t};if(v.toString().match(/^border(\-(top|right|bottom|left))?$/)){var w=t.toString().split(/ +/);u.names=["_border_width","_border_style","_border_color"];u.values=[("undefined"==typeof w[0]?"":w[0]),("undefined"==typeof w[1]?"":w[1]),("undefined"==typeof w[2]?"":w[2])]}else{if(v.toString().match(/^background\-image/)){u.names=["_background_url","_background_origin","_background_color1","_background_color2"];u.values=["","","",""];if(false===(r(t))&&!(t.toString().match(/url/))){var w=t.toString().split(/:/);u.values[1]=("undefined"==typeof w[0]?"":w[0]);u.values[2]=("undefined"==typeof w[1]?"":w[1]);u.values[3]=("undefined"==typeof w[3]?"":w[3]);u.orig=[u.values[1],u.values[2],u.values[3]].join(" ")}else{u.values[0]=t}}else{u.names=[""];u.values=[t]}}return u},ctc_set_query=function(t){s=t;c("#ctc_sel_ovrd_query").val("");c("#ctc_sel_ovrd_query_selected").text(t);c("#ctc_sel_ovrd_selector").val("");c("#ctc_sel_ovrd_selector_selected").html("&nbsp;");c("#ctc_sel_ovrd_rule_inputs").html("");ctc_setup_selector_menu(t);f("#ctc_child_all_0_swatch");c("#ctc_new_selector_row").show()},ctc_set_selector=function(u,t){c("#ctc_sel_ovrd_selector").val("");c("#ctc_sel_ovrd_selector_selected").text(t);c("#ctc_sel_ovrd_qsid").val(u);h=u;if(1!=loading.sel_val){loading.sel_val=0}g(u);c(".ctc-rewrite-toggle").text(ctcAjax.rename_txt);c("#ctc_sel_ovrd_new_rule, #ctc_sel_ovrd_rule_header,#ctc_sel_ovrd_rule_inputs_container,#ctc_sel_ovrd_rule_inputs,.ctc-rewrite-toggle").show()},ctc_set_rule=function(u,t){c("#ctc_rule_menu").val("");c("#ctc_rule_menu_selected").text(t);if(1!=loading.rule_val){loading.rule_val=0}ctc_render_rule_value_inputs(u);c(".ctc-rewrite-toggle").text(ctcAjax.rename_txt);c("#ctc_rule_value_inputs,#ctc_input_row_rule_header").show()},ctc_setup_query_menu=function(){ctc_queries=a();c("#ctc_sel_ovrd_query").autocomplete({source:ctc_queries,minLength:0,selectFirst:true,autoFocus:true,select:function(u,t){ctc_set_query(t.item.value);return false},focus:function(t){t.preventDefault()}})},ctc_setup_selector_menu=function(t){ctc_selectors=o(t);c("#ctc_sel_ovrd_selector").autocomplete({source:ctc_selectors,selectFirst:true,autoFocus:true,select:function(v,u){ctc_set_selector(u.item.value,u.item.label);return false},focus:function(u){u.preventDefault()}})},ctc_setup_rule_menu=function(){ctc_rules=d();c("#ctc_rule_menu").autocomplete({source:ctc_rules,selectFirst:true,autoFocus:true,select:function(u,t){ctc_set_rule(t.item.value,t.item.label);return false},focus:function(t){t.preventDefault()}})},ctc_filtered_rules=function(w,u){var t=[],v=(r(ctcAjax.sel_val[h]))||(r(ctcAjax.sel_val[h].value));if(r(ctc_rules)){ctc_rules=d()}c.each(ctc_rules,function(x,A){var y=false,z=new RegExp(c.ui.autocomplete.escapeRegex(w.term),"i");if(z.test(A.label)){if(false===v){c.each(ctcAjax.sel_val[h].value,function(C,B){if(A.label==C.replace(/\d+/g,e)){y=true;return false}});if(y){return}}t.push(A)}});u(t)},ctc_setup_new_rule_menu=function(){c("#ctc_new_rule_menu").autocomplete({source:ctc_filtered_rules,selectFirst:true,autoFocus:true,select:function(u,t){u.preventDefault();var v=c(j(h,t.item.label.replace(/[^\w\-]/g,m),"ovrd"));c("#ctc_sel_ovrd_rule_inputs").append(v);c("#ctc_new_rule_menu").val("");if(r(ctcAjax.sel_val[h].value)){ctcAjax.sel_val[h]["value"]={}}ctcAjax.sel_val[h].value[t.item.label]={child:""};v.find('input[type="text"]').each(function(w,x){if(c(x).hasClass("color-picker")){k(x)}c(x).focus()});return false},focus:function(t){t.preventDefault()}})},ctc_setup_menus=function(){ctc_setup_query_menu();ctc_setup_selector_menu(s);ctc_setup_rule_menu();ctc_setup_new_rule_menu()},ctc_theme_exists=function(t,u){var v=false;c.each(ctcAjax.themes,function(w,x){c.each(x,function(y,z){if(y==t&&("parnt"==w||"new"==u)){v=true;return false}});if(v){return false}});return v},ctc_set_notice=function(t){var u="";if(false===r(t)){c.each(t,function(v,w){u+='<div class="'+v+'"><ul>'+l;c(w).each(function(x,y){u+="<li>"+y.toString()+"</li>"+l});u+="</ul></div>"})}c("#ctc_error_notice").html(u)},ctc_validate=function(){var w=/[^\w\-]/,u=c("#ctc_child_template").val().toString().replace(w).toLowerCase(),t=c("#ctc_theme_child").val().toString().replace(w).toLowerCase(),v=c("input[name=ctc_child_type]:checked").val(),x=[];if("new"==v){t=u}if(ctc_theme_exists(t,v)){x.push(ctcAjax.theme_exists_txt.toString().replace(/%s/,t))}if(""===t){x.push(ctcAjax.inval_theme_txt)}if(""===c("#ctc_child_name").val()){x.push(ctcAjax.inval_name_txt)}if(x.length){ctc_set_notice({error:x});return false}return true},ctc_set_theme_menu=function(u){var t=c("#ctc_theme_child").val();if(false===r(ctcAjax.themes.child[t])){c("#ctc_child_name").val(ctcAjax.themes.child[t].Name);c("#ctc_child_author").val(ctcAjax.themes.child[t].Author);c("#ctc_child_version").val(ctcAjax.themes.child[t].Version)}},fade_update_notice=function(){c(".updated, .error").slideUp("slow",function(){c(".updated").remove()})},ctc_focus_panel=function(u){var t=u+"_panel";c(".nav-tab").removeClass("nav-tab-active");c(".ctc-option-panel").removeClass("ctc-option-panel-active");c(".ctc-selector-container").hide();c(u).addClass("nav-tab-active");c(".ctc-option-panel-container").scrollTop(0);c(t).addClass("ctc-option-panel-active")},ctc_selector_edit=function(w){var t=c(w).attr("id").match(/_(\d+)$/)[1],v=ctcAjax.sel_val[t].query,u=ctcAjax.sel_val[t].selector,x="#query_selector_options";ctc_set_query(v);ctc_set_selector(t,u);ctc_focus_panel(x)},ctc_selector_input_toggle=function(u){var t;if(c("#ctc_rewrite_selector").length){t=c("#ctc_rewrite_selector_orig").val();c("#ctc_sel_ovrd_selector_selected").text(t);c(u).text(ctcAjax.rename_txt)}else{t=c("#ctc_sel_ovrd_selector_selected").text();c("#ctc_sel_ovrd_selector_selected").html('<input id="ctc_rewrite_selector" name="ctc_rewrite_selector" type="text" value="'+t+'" autocomplete="off" /><input id="ctc_rewrite_selector_orig" name="ctc_rewrite_selector_orig" type="hidden" value="'+t+'"/>');c(u).text(ctcAjax.cancel_txt)}};loading={rule:2,sel_ndx:2,val_qry:0,rule_val:0,sel_val:0,preview:0},ctc_selectors=[],ctc_queries=[],ctc_rules=[];c(".color-picker").each(function(){k(this)});c(".ctc-option-panel-container").on("focus",".color-picker",function(){ctc_set_notice("");c(this).iris("toggle");c(".iris-picker").css({position:"absolute","z-index":10})});c(".ctc-option-panel-container").on("focus","input",function(){ctc_set_notice("");c(".color-picker").not(this).iris("hide")});c(".ctc-option-panel-container").on("change",".ctc-child-value, input[type=checkbox]",function(){f(this)});c(".ctc-option-panel-container").on("click",".ctc-selector-handle",function(u){u.preventDefault();ctc_set_notice("");var v=c(this).attr("id").toString().replace("_close",""),t=v.toString().match(/_(\d+)$/)[1];if(c("#"+v+"_container").is(":hidden")){if(1!=loading.val_qry){loading.val_qry=0}ctc_render_selector_value_inputs(t)}c("#"+v+"_container").fadeToggle("fast");c(".ctc-selector-container").not("#"+v+"_container").fadeOut("fast")});c(".nav-tab").on("click",function(t){t.preventDefault();ctc_set_notice("");c(".ctc-status-icon").remove();var u="#"+c(this).attr("id");ctc_focus_panel(u)});c("#view_child_options,#view_parnt_options").on("click",ctc_render_css_preview);c("#ctc_load_form").on("submit",function(){return(ctc_validate()&&confirm(ctcAjax.load_txt))});c("#parent_child_options_panel").on("change","#ctc_theme_child",ctc_set_theme_menu);c(document).on("click",".ctc-save-input",function(t){ctc_save(this)});c(document).on("click",".ctc-selector-edit",function(t){ctc_selector_edit(this)});c(document).on("click",".ctc-rewrite-toggle",function(t){t.preventDefault();ctc_selector_input_toggle(this)});ctc_setup_menus();ctc_set_query(s);c("input[type=submit],input[type=button]").prop("disabled",false);setTimeout(fade_update_notice,6000)});
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.4
6
  * Author: Lilaea Media
7
  * Author URI: http://www.lilaeamedia.com/
8
  * License: GPLv2
9
  * Copyright (C) 2013 Lilaea Media
10
  */
11
+ ;jQuery(document).ready(function(c){var l="\n",s="base",h,b={},p,q,k=function(t){c(t).iris({change:function(){f(t)}})},e=function(v){var t=parseInt(v),u=String.fromCharCode(t);return u},m=function(u){var t=u.charCodeAt(0);return t},f=function(z){var v=/^(ctc_(ovrd|\d+)_(parent|child)_([0-9a-z\-]+)_(\d+))(_\w+)?$/,A=c(z).parents(".ctc-selector-row, .ctc-parent-row").first(),y=A.find(".ctc-swatch").first(),x={parent:{},child:{}},w={parent:{origin:"",start:"",end:""},child:{origin:"",start:"",end:""}},u={child:false,parent:false},t={};A.find(".ctc-parent-value, .ctc-child-value").each(function(){var I=c(this).attr("id"),B=I.toString().match(v),J=B[2],C=B[3],L=("undefined"==typeof B[4]?"":B[4]),H=B[5],G=("undefined"==typeof B[6]?"":B[6]),K=("parent"==C?c(this).text():c(this).val()),D="ctc_"+J+"_child_"+L+"_i_"+H,F,E;if("child"==C){t[I]=K;t[D]=(c("#"+D).is(":checked"))?1:0}if(""!=K){if(false===r(G)){switch(G){case"_border_width":x[C][L+"-width"]=K;break;case"_border_style":x[C][L+"-style"]=K;break;case"_border_color":x[C][L+"-color"]=K;break;case"_background_url":x[C]["background-image"]=i(C,K);break;case"_background_color":x[C]["background-color"]=z.value;break;case"_background_color1":w[C].start=K;u[C]=true;break;case"_background_color2":w[C].end=K;u[C]=true;break;case"_background_origin":w[C].origin=K;u[C]=true;break}}else{if(F=L.toString().match(/^border(\-(top|right|bottom|left))?$/)&&!K.match(/none/)){E=K.toString().split(/ +/);x[C][L+"-width"]="undefined"==typeof E[0]?"":E[0];x[C][L+"-style"]="undefined"==typeof E[1]?"":E[1];x[C][L+"-color"]="undefined"==typeof E[2]?"":E[2]}else{if("background-image"==L){if(K.toString().match(/url\(/)){x[C]["background-image"]=i(C,K)}else{E=K.toString().split(/ +/);if(E.length>2){w[C].origin="undefined"==typeof E[0]?"top":E[0];w[C].start="undefined"==typeof E[1]?"transparent":E[1];w[C].end="undefined"==typeof E[2]?"transparent":E[2];u[C]=true}else{x[C]["background-image"]=K}}}else{x[C][L]=K}}}}});if("undefined"!=typeof y&&false===r(y.attr("id"))){c(y).removeAttr("style");if(u.parent){c(y).ctcgrad(w.parent.origin,[w.parent.start,w.parent.end])}c(y).css(x.parent);if(!(y.attr("id").toString().match(/parent/))){if(u.child){c(y).ctcgrad(w.child.origin,[w.child.start,w.child.end])}c(y).css(x.child)}}return t},n=function(u){var t,v,w;c(u).each(function(){switch(this.obj){case"imports":ctcAjax.imports=this.data;break;case"rule_val":ctcAjax.rule_val[this.key]=this.data;w=this.key;break;case"val_qry":ctcAjax.val_qry[this.key]=this.data;break;case"rule":ctcAjax.rule=this.data;break;case"sel_ndx":if(r(this.key)){ctcAjax.sel_ndx=this.data}else{if("qsid"==this.key){if(r(ctcAjax.sel_ndx[this.data.query])){ctcAjax.sel_ndx[this.data.query]={}}ctcAjax.sel_ndx[this.data.query][this.data.selector]=this.data.qsid}else{ctcAjax.sel_ndx[this.key]=this.data;t=this.key}}break;case"sel_val":ctcAjax.sel_val[this.key]=this.data;v=this.key;break;case"rewrite":p=this.key;q=this.data;break}})},i=function(x,u){var w=u.toString().match(/url\(['" ]*(.+?)['" ]*\)/),v=r(w)?null:w[1],t=ctcAjax.theme_uri+"/"+("parent"==x?ctcAjax.parnt:ctcAjax.child)+"/",y;if(!v){return false}else{if(v.toString().match(/^(https?:|\/)/)){y=u}else{y="url("+t+v+")"}}return y},r=function(u){if("undefined"==typeof u||false===u||null===u||""===u){return true}if(true===u||"string"===typeof u||"number"===typeof u){return false}if("object"===typeof u){for(var t in u){if(u.hasOwnProperty(t)){return false}}return true}return false},a=function(){var t=[];if(1===loading.sel_ndx){return t}if(0===loading.sel_ndx){loading.sel_ndx=1;ctc_query_css("sel_ndx",null,ctc_setup_query_menu);return t}if(false===r(ctcAjax.sel_ndx)){c.each(ctcAjax.sel_ndx,function(u,v){var w={label:u,value:u};t.push(w)})}return t},o=function(u){var t=[];if(1===loading.sel_ndx){return t}if(0===loading.sel_ndx){loading.sel_ndx=1;ctc_query_css("sel_ndx",u,ctc_setup_selector_menu);return t}if(false===r(ctcAjax.sel_ndx[u])){c.each(ctcAjax.sel_ndx[u],function(v,w){var x={label:v,value:w};t.push(x)})}return t},d=function(){var t=[];if(1===loading.rule){return t}if(0===loading.rule){loading.rule=1;ctc_query_css("rule",null,ctc_setup_rule_menu);return t}if(false===r(ctcAjax.rule)){c.each(ctcAjax.rule,function(u,v){var w={label:v.replace(/\d+/g,e),value:u};t.push(w)})}return t.sort(function(v,u){if(v.label>u.label){return 1}if(v.label<u.label){return -1}return 0})},j=function(x,z,C){var v="",A=(r(ctcAjax.sel_val[x])||r(ctcAjax.sel_val[x].value)||r(ctcAjax.sel_val[x].value[z])?"":ctcAjax.sel_val[x].value[z]),u=ctc_decode_value(z,("undefined"==typeof A?"":A.parnt)),y=(false===r(A.i_parnt)&&A.i_parnt)?ctcAjax.important_label:"",w=ctc_decode_value(z,("undefined"==typeof A?"":A.child)),t=(false===r(A.i_child)&&A.i_child)?1:0,B="ctc_"+C+"_child_"+z+"_i_"+x;if(false===r(ctcAjax.sel_val[x])){v+='<div class="ctc-'+("ovrd"==C?"input":"selector")+'-row clearfix">'+l;v+='<div class="ctc-input-cell">'+("ovrd"==C?z.replace(/\d+/g,e):ctcAjax.sel_val[x].selector+'<br/><a href="#" class="ctc-selector-edit" id="ctc_selector_edit_'+x+'" >'+ctcAjax.edit_txt+"</a> "+(r(u.orig)?ctcAjax.child_only_txt:""))+"</div>"+l;if("ovrd"==C){v+='<div class="ctc-parent-value ctc-input-cell" id="ctc_'+C+"_parent_"+z+"_"+x+'">'+(r(u.orig)?"[no value]":u.orig+y)+"</div>"+l}v+='<div class="ctc-input-cell">'+l;if(false===r(u.names)){c.each(u.names,function(D,E){E=(r(E)?"":E);v+='<div class="ctc-child-input-cell">'+l;var G="ctc_"+C+"_child_"+z+"_"+x+E,F;if(false===(F=w.values.shift())){F=""}v+=(r(E)?"":ctcAjax.field_labels[E]+":<br/>")+'<input type="text" id="'+G+'" name="'+G+'" class="ctc-child-value'+((E+z).toString().match(/color/)?" color-picker":"")+((E).toString().match(/url/)?" ctc-input-wide":"")+'" value="'+F+'" />'+l;v+="</div>"+l});v+='<label for="'+B+'"><input type="checkbox" id="'+B+'" name="'+B+'" value="1" '+(1===t?"checked":"")+" />"+ctcAjax.important_label+"</label>"+l}v+="</div>"+l;v+=("ovrd"==C?"":'<div class="ctc-swatch ctc-specific" id="ctc_child_'+z+"_"+x+'_swatch">'+ctcAjax.swatch_txt+"</div>"+l+'<div class="ctc-child-input-cell ctc-button-cell" id="ctc_save_'+z+"_"+x+'_cell">'+l+'<input type="button" class="button ctc-save-input" id="ctc_save_'+z+"_"+x+'" name="ctc_save_'+z+"_"+x+'" value="Save" /></div>'+l);v+="</div><!-- end input row -->"+l}return v},g=function(t){if(1===loading.sel_val){return false}if(0==loading.sel_val){loading.sel_val=1;ctc_query_css("sel_val",t,g);return false}var w,u,v;if(r(ctcAjax.sel_val[t])){c("#ctc_sel_ovrd_rule_inputs").html("")}else{if(r(ctcAjax.sel_val[t].seq)){c("#ctc_child_load_order_container").html("")}else{w="ctc_ovrd_child_seq_"+t;v=parseInt(ctcAjax.sel_val[t].seq);u='<input type="text" id="'+w+'" name="'+w+'" class="ctc-child-value" value="'+v+'" />';c("#ctc_child_load_order_container").html(u)}if(r(ctcAjax.sel_val[t].value)){c("#ctc_sel_ovrd_rule_inputs").html("")}else{u="";c.each(ctcAjax.sel_val[t].value,function(y,x){u+=j(t,y,"ovrd")});c("#ctc_sel_ovrd_rule_inputs").html(u).find(".color-picker").each(function(){k(this)});f("#ctc_child_all_0_swatch")}}};ctc_render_css_preview=function(t){if(1===loading.preview){return false}if(0==loading.preview){loading.preview=1;var t;if(!(t=c(this).attr("id").toString().match(/(child|parnt)/)[1])){t="child"}ctc_set_notice("");ctc_query_css("preview",t,ctc_render_css_preview);return false}if(2==loading.preview){c("#view_"+t+"_options_panel").text(ctcAjax.previewResponse);loading.preview=0}},ctc_render_rule_value_inputs=function(u){if(1===loading.rule_val){return false}if(0==loading.rule_val){loading.rule_val=1;ctc_query_css("rule_val",u,ctc_render_rule_value_inputs);return false}var v=ctcAjax.rule[u],t='<div class="ctc-input-row clearfix" id="ctc_rule_row_'+v+'">'+l;if(false===r(ctcAjax.rule_val[u])){c.each(ctcAjax.rule_val[u],function(x,y){var w=ctc_decode_value(v,y);t+='<div class="ctc-parent-row clearfix" id="ctc_rule_row_'+v+"_"+x+'">'+l;t+='<div class="ctc-input-cell ctc-parent-value" id="ctc_'+x+"_parent_"+v+"_"+x+'">'+w.orig+"</div>"+l;t+='<div class="ctc-input-cell">'+l;t+='<div class="ctc-swatch ctc-specific" id="ctc_'+x+"_parent_"+v+"_"+x+'_swatch">'+ctcAjax.swatch_txt+"</div></div>"+l;t+='<div class="ctc-input-cell"><a href="#" class="ctc-selector-handle" id="ctc_selector_'+v+"_"+x+'">'+ctcAjax.selector_txt+"</a></div>"+l;t+='<div id="ctc_selector_'+v+"_"+x+'_container" class="ctc-selector-container clearfix">'+l;t+='<a href="#" id="ctc_selector_'+v+"_"+x+'_close" class="ctc-selector-handle" style="float:right">'+ctcAjax.close_txt+'</a><div id="ctc_status_val_qry_'+x+'"></div>'+l;t+='<div id="ctc_selector_'+v+"_"+x+'_rows"></div>'+l;t+="</div></div>"+l});t+="</div>"+l}c("#ctc_rule_value_inputs").html(t).find(".ctc-swatch").each(function(){f(this)})},ctc_render_selector_value_inputs=function(w){if(1==loading.val_qry){return false}var y,u,x=c("#ctc_rule_menu_selected").text().replace(/[^\w\-]/g,m),t,v="";if(0===loading.val_qry){loading.val_qry=1;y={rule:x};ctc_query_css("val_qry",w,ctc_render_selector_value_inputs,y);return false}if(false===r(ctcAjax.val_qry[w])){c.each(ctcAjax.val_qry[w],function(A,z){page_rule=A;c.each(z,function(C,B){v+='<h4 class="ctc-query-heading">'+C+"</h4>"+l;if(false===r(B)){c.each(B,function(D,E){ctcAjax.sel_val[D]=E;v+=j(D,A,w)})}})})}t="#ctc_selector_"+x+"_"+w+"_rows";c(t).html(v).find(".color-picker").each(function(){k(this)});c(t).find(".ctc-swatch").each(function(){f(this)})},ctc_query_css=function(v,u,y,w){var t={ctc_query_obj:v,ctc_query_key:u},x="#ctc_status_"+v+("val_qry"==v?"_"+u:"");if("object"===typeof w){c.each(w,function(z,A){t["ctc_query_"+z]=A})}c(".ctc-status-icon").remove();c(x).append('<span class="ctc-status-icon spinner"></span>');c(".spinner").show();t.action="ctc_query";t._wpnonce=c("#_wpnonce").val();c.post(ctcAjax.ajaxurl,t,function(z){loading[v]=2;c(".ctc-status-icon").removeClass("spinner");if(r(z)){c(".ctc-status-icon").addClass("failure");if("preview"==v){ctcAjax.previewResponse=ctcAjax.css_fail_txt;y(u)}}else{c(".ctc-status-icon").addClass("success");if("preview"==v){ctcAjax.previewResponse=z.shift().data}else{n(z)}if("function"===typeof y){y(u)}return false}},"json").fail(function(){c(".ctc-status-icon").removeClass("spinner");c(".ctc-status-icon").addClass("failure");if("preview"==v){ctcAjax.previewResponse=ctcAjax.css_fail_txt;loading[v]=2;y(u)}else{loading[v]=0}});return false},ctc_save=function(y){var w={},z,v,t,u,A=c(y).attr("id"),x;if(r(b[A])){b[A]=0}b[A]++;c(y).prop("disabled",true);c(".ctc-status-icon").remove();c(y).parent(".ctc-textarea-button-cell, .ctc-button-cell").append('<span class="ctc-status-icon spinner"></span>');c(".spinner").show();if((z=c("#ctc_new_selectors"))&&"ctc_save_new_selectors"==c(y).attr("id")){w.ctc_new_selectors=z.val();if(v=c("#ctc_sel_ovrd_query_selected")){w.ctc_sel_ovrd_query=v.text()}}else{if((t=c("#ctc_child_imports"))&&"ctc_save_imports"==c(y).attr("id")){w.ctc_child_imports=t.val()}else{w=f(y)}}c("#ctc_sel_ovrd_selector_selected").find("#ctc_rewrite_selector").each(function(){x=c("#ctc_rewrite_selector").val(),origsel=c("#ctc_rewrite_selector_orig").val();if(r(x)||!x.toString().match(/\w/)){x=origsel}else{w.ctc_rewrite_selector=x}c(".ctc-rewrite-toggle").text(ctcAjax.rename_txt);c("#ctc_sel_ovrd_selector_selected").html(x)});w.action="ctc_update";w._wpnonce=c("#_wpnonce").val();c.post(ctcAjax.ajaxurl,w,function(B){c(y).prop("disabled",false);c(".ctc-status-icon").removeClass("spinner");if(r(B)){c(".ctc-status-icon").addClass("failure")}else{c(".ctc-status-icon").addClass("success");c("#ctc_new_selectors").val("");n(B);ctc_setup_menus();if(false===r(p)){ctc_set_selector(p,q);p=q=null}}return false},"json").fail(function(){c(y).prop("disabled",false);c(".ctc-status-icon").removeClass("spinner");c(".ctc-status-icon").addClass("failure")});return false},ctc_decode_value=function(v,t){t=("undefined"==typeof t?"":t);var u={orig:t};if(v.toString().match(/^border(\-(top|right|bottom|left))?$/)){var w=t.toString().split(/ +/);u.names=["_border_width","_border_style","_border_color"];u.values=[("undefined"==typeof w[0]?"":w[0]),("undefined"==typeof w[1]?"":w[1]),("undefined"==typeof w[2]?"":w[2])]}else{if(v.toString().match(/^background\-image/)){u.names=["_background_url","_background_origin","_background_color1","_background_color2"];u.values=["","","",""];if(false===(r(t))&&!(t.toString().match(/url/))){var w=t.toString().split(/:/);u.values[1]=("undefined"==typeof w[0]?"":w[0]);u.values[2]=("undefined"==typeof w[1]?"":w[1]);u.values[3]=("undefined"==typeof w[3]?"":w[3]);u.orig=[u.values[1],u.values[2],u.values[3]].join(" ")}else{u.values[0]=t}}else{u.names=[""];u.values=[t]}}return u},ctc_set_query=function(t){s=t;c("#ctc_sel_ovrd_query").val("");c("#ctc_sel_ovrd_query_selected").text(t);c("#ctc_sel_ovrd_selector").val("");c("#ctc_sel_ovrd_selector_selected").html("&nbsp;");c("#ctc_sel_ovrd_rule_inputs").html("");ctc_setup_selector_menu(t);f("#ctc_child_all_0_swatch");c("#ctc_new_selector_row").show()},ctc_set_selector=function(u,t){c("#ctc_sel_ovrd_selector").val("");c("#ctc_sel_ovrd_selector_selected").text(t);c("#ctc_sel_ovrd_qsid").val(u);h=u;if(1!=loading.sel_val){loading.sel_val=0}g(u);c(".ctc-rewrite-toggle").text(ctcAjax.rename_txt);c("#ctc_sel_ovrd_new_rule, #ctc_sel_ovrd_rule_header,#ctc_sel_ovrd_rule_inputs_container,#ctc_sel_ovrd_rule_inputs,.ctc-rewrite-toggle").show()},ctc_set_rule=function(u,t){c("#ctc_rule_menu").val("");c("#ctc_rule_menu_selected").text(t);if(1!=loading.rule_val){loading.rule_val=0}ctc_render_rule_value_inputs(u);c(".ctc-rewrite-toggle").text(ctcAjax.rename_txt);c("#ctc_rule_value_inputs,#ctc_input_row_rule_header").show()},ctc_setup_query_menu=function(){ctc_queries=a();c("#ctc_sel_ovrd_query").autocomplete({source:ctc_queries,minLength:0,selectFirst:true,autoFocus:true,select:function(u,t){ctc_set_query(t.item.value);return false},focus:function(t){t.preventDefault()}})},ctc_setup_selector_menu=function(t){ctc_selectors=o(t);c("#ctc_sel_ovrd_selector").autocomplete({source:ctc_selectors,selectFirst:true,autoFocus:true,select:function(v,u){ctc_set_selector(u.item.value,u.item.label);return false},focus:function(u){u.preventDefault()}})},ctc_setup_rule_menu=function(){ctc_rules=d();c("#ctc_rule_menu").autocomplete({source:ctc_rules,selectFirst:true,autoFocus:true,select:function(u,t){ctc_set_rule(t.item.value,t.item.label);return false},focus:function(t){t.preventDefault()}})},ctc_filtered_rules=function(w,u){var t=[],v=(r(ctcAjax.sel_val[h]))||(r(ctcAjax.sel_val[h].value));if(r(ctc_rules)){ctc_rules=d()}c.each(ctc_rules,function(x,A){var y=false,z=new RegExp(c.ui.autocomplete.escapeRegex(w.term),"i");if(z.test(A.label)){if(false===v){c.each(ctcAjax.sel_val[h].value,function(C,B){if(A.label==C.replace(/\d+/g,e)){y=true;return false}});if(y){return}}t.push(A)}});u(t)},ctc_setup_new_rule_menu=function(){c("#ctc_new_rule_menu").autocomplete({source:ctc_filtered_rules,selectFirst:true,autoFocus:true,select:function(u,t){u.preventDefault();var v=c(j(h,t.item.label.replace(/[^\w\-]/g,m),"ovrd"));c("#ctc_sel_ovrd_rule_inputs").append(v);c("#ctc_new_rule_menu").val("");if(r(ctcAjax.sel_val[h].value)){ctcAjax.sel_val[h]["value"]={}}ctcAjax.sel_val[h].value[t.item.label]={child:""};v.find('input[type="text"]').each(function(w,x){if(c(x).hasClass("color-picker")){k(x)}c(x).focus()});return false},focus:function(t){t.preventDefault()}})},ctc_setup_menus=function(){ctc_setup_query_menu();ctc_setup_selector_menu(s);ctc_setup_rule_menu();ctc_setup_new_rule_menu()},ctc_theme_exists=function(t,u){var v=false;c.each(ctcAjax.themes,function(w,x){c.each(x,function(y,z){if(y==t&&("parnt"==w||"new"==u)){v=true;return false}});if(v){return false}});return v},ctc_set_notice=function(t){var u="";if(false===r(t)){c.each(t,function(v,w){u+='<div class="'+v+'"><ul>'+l;c(w).each(function(x,y){u+="<li>"+y.toString()+"</li>"+l});u+="</ul></div>"})}c("#ctc_error_notice").html(u)},ctc_validate=function(){var w=/[^\w\-]/,u=c("#ctc_child_template").val().toString().replace(w).toLowerCase(),t=c("#ctc_theme_child").val().toString().replace(w).toLowerCase(),v=c("input[name=ctc_child_type]:checked").val(),x=[];if("new"==v){t=u}if(ctc_theme_exists(t,v)){x.push(ctcAjax.theme_exists_txt.toString().replace(/%s/,t))}if(""===t){x.push(ctcAjax.inval_theme_txt)}if(""===c("#ctc_child_name").val()){x.push(ctcAjax.inval_name_txt)}if(x.length){ctc_set_notice({error:x});return false}return true},ctc_set_theme_menu=function(u){var t=c("#ctc_theme_child").val();if(false===r(ctcAjax.themes.child[t])){c("#ctc_child_name").val(ctcAjax.themes.child[t].Name);c("#ctc_child_author").val(ctcAjax.themes.child[t].Author);c("#ctc_child_version").val(ctcAjax.themes.child[t].Version)}},fade_update_notice=function(){c(".updated, .error").slideUp("slow",function(){c(".updated").remove()})},ctc_focus_panel=function(u){var t=u+"_panel";c(".nav-tab").removeClass("nav-tab-active");c(".ctc-option-panel").removeClass("ctc-option-panel-active");c(".ctc-selector-container").hide();c(u).addClass("nav-tab-active");c(".ctc-option-panel-container").scrollTop(0);c(t).addClass("ctc-option-panel-active")},ctc_selector_edit=function(w){var t=c(w).attr("id").match(/_(\d+)$/)[1],v=ctcAjax.sel_val[t].query,u=ctcAjax.sel_val[t].selector,x="#query_selector_options";ctc_set_query(v);ctc_set_selector(t,u);ctc_focus_panel(x)},ctc_selector_input_toggle=function(u){var t;if(c("#ctc_rewrite_selector").length){t=c("#ctc_rewrite_selector_orig").val();c("#ctc_sel_ovrd_selector_selected").text(t);c(u).text(ctcAjax.rename_txt)}else{t=c("#ctc_sel_ovrd_selector_selected").text();c("#ctc_sel_ovrd_selector_selected").html('<input id="ctc_rewrite_selector" name="ctc_rewrite_selector" type="text" value="'+t+'" autocomplete="off" /><input id="ctc_rewrite_selector_orig" name="ctc_rewrite_selector_orig" type="hidden" value="'+t+'"/>');c(u).text(ctcAjax.cancel_txt)}};loading={rule:2,sel_ndx:2,val_qry:0,rule_val:0,sel_val:0,preview:0},ctc_selectors=[],ctc_queries=[],ctc_rules=[];c(".color-picker").each(function(){k(this)});c(".ctc-option-panel-container").on("focus",".color-picker",function(){ctc_set_notice("");c(this).iris("toggle");c(".iris-picker").css({position:"absolute","z-index":10})});c(".ctc-option-panel-container").on("focus","input",function(){ctc_set_notice("");c(".color-picker").not(this).iris("hide")});c(".ctc-option-panel-container").on("change",".ctc-child-value, input[type=checkbox]",function(){f(this)});c(".ctc-option-panel-container").on("click",".ctc-selector-handle",function(u){u.preventDefault();ctc_set_notice("");var v=c(this).attr("id").toString().replace("_close",""),t=v.toString().match(/_(\d+)$/)[1];if(c("#"+v+"_container").is(":hidden")){if(1!=loading.val_qry){loading.val_qry=0}ctc_render_selector_value_inputs(t)}c("#"+v+"_container").fadeToggle("fast");c(".ctc-selector-container").not("#"+v+"_container").fadeOut("fast")});c(".nav-tab").on("click",function(t){t.preventDefault();ctc_set_notice("");c(".ctc-status-icon").remove();var u="#"+c(this).attr("id");ctc_focus_panel(u)});c("#view_child_options,#view_parnt_options").on("click",ctc_render_css_preview);c("#ctc_load_form").on("submit",function(){return(ctc_validate()&&confirm(ctcAjax.load_txt))});c("#parent_child_options_panel").on("change","#ctc_theme_child",ctc_set_theme_menu);c(document).on("click",".ctc-save-input",function(t){ctc_save(this)});c(document).on("click",".ctc-selector-edit",function(t){ctc_selector_edit(this)});c(document).on("click",".ctc-rewrite-toggle",function(t){t.preventDefault();ctc_selector_input_toggle(this)});c(document).on("change","#ctc_theme_parnt",function(t){c(this).parents(".ctc-input-row").first().append('<span class="ctc-status-icon spinner"></span>');c(".spinner").show();document.location="?page=chld_thm_cfg_menu&ctc_parent="+c(this).val()});c(document).on("click","#ctc_additional_css_label",function(t){c(this).toggleClass("open");c("#ctc_additional_css_files").slideToggle("fast")});ctc_setup_menus();ctc_set_query(s);c("input[type=submit],input[type=button]").prop("disabled",false);setTimeout(fade_update_notice,6000)});
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: 3.9.1
7
- Stable tag: 1.4.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -14,14 +14,6 @@ Create a Child Theme from any installed Theme. Each CSS selector, rule and value
14
 
15
  Created by Lilaea Media, the team that brought you IntelliWidget, the Child Theme Configurator provides a new approach to WordPress stylesheets. The Child Theme Configurator lets you identify and override only the Parent Theme style attributes you want to change. It gives you unlimited control over your WordPress look and feel while leaving your Parent Theme untouched.
16
 
17
- = New Files Tab! =
18
-
19
- Now you can copy parent theme template files into your child themes and edit them using the Theme Editor. We've also added an image uploader to add custom theme images for your stylesheets along with a screenshot uploader.
20
-
21
- = Now it works with plugins! =
22
-
23
- 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. Learn more at http://www.lilaeamedia.com/plugins/child-theme-plugin-styles
24
-
25
  = Take Control of Your Child Themes =
26
 
27
  https://www.youtube.com/watch?v=xL2HkWQxgOA
@@ -48,11 +40,36 @@ When you are ready, just activate the Child Theme and your WordPress site takes
48
  * Upload custom screenshot for your child theme
49
  * Save hours of development time
50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  == Installation ==
52
 
53
- 1. Download the Child Theme Configurator plugin archive and unzip it.
54
- 2. Upload the child-theme-configurator directory to your WordPress plugins directory (e.g., /path/to/wordpress/wp-content/plugins/)
55
- 3. Activate the plugin through the 'Plugins' menu in WordPress
 
 
 
 
 
 
 
 
 
56
 
57
  == Frequently Asked Questions ==
58
 
@@ -136,12 +153,16 @@ The Child Theme Configurator uses a standardized syntax for gradients and only s
136
 
137
  = How do I make my Theme responsive? =
138
 
139
- This topic is beyond the scope of this document. The short answer is to use a responsive Parent Theme. Some common characteristics of responsive design are:
140
 
141
  * Avoiding fixed width and height values. Using max- and min-height values and percentages are ways to make your designs respond to the viewer's browser size.
142
  * Combining floats and clears with inline and relative positions allow the elements to adjust gracefully to their container's width.
143
  * Showing and hiding content with Javascript.
144
 
 
 
 
 
145
  = How do I add Web Fonts? =
146
 
147
  The easiest method is to paste the @import code provided by Google, Font Squirrel or any other Web Font site into the @import tab. The fonts will then be available to use as a value of the font-family rule. Be sure you understand the license for any embedded fonts.
@@ -158,6 +179,13 @@ You can also create a secondary stylesheet that contains @font-face rules and im
158
 
159
  == Changelog ==
160
 
 
 
 
 
 
 
 
161
  = 1.4.3 =
162
  * updated parser to match selectors containing parentheses and empty media rulesets
163
 
@@ -258,8 +286,9 @@ You can also create a secondary stylesheet that contains @font-face rules and im
258
 
259
  == Upgrade Notice ==
260
 
261
- = 1.4.3 =
262
- * This release fixes a bug in the parser that was ignoring selectors containing parentheses.
 
263
 
264
  == Create Your Child Theme ==
265
 
@@ -272,12 +301,10 @@ The first step is to create a child theme and import your parent theme styles in
272
  3. Enter a Name for the child theme.
273
  4. Enter an author for the child theme.
274
  5. Enter the child theme version number.
275
- 6. Check "Backup Stylesheet" if you want to backup original version of child stylesheet.
276
- 7. Check "Scan Parent Theme for Additional Stylesheets" if your theme uses multiple stylesheets or if the the stylesheets are in a non-standard location. For example, the "Responsive" theme puts the stylesheets in a subdirectory named "core."
277
  8. Click "Generate Child Theme Files."
278
 
279
- If you are loading an existing child theme and checked "Backup Stylesheet," the Child Theme Configurator will create a backup of your existing stylesheet in the theme directory.
280
-
281
  == Override Parent Styles ==
282
 
283
  There are two ways to identify and override parent styles. The Child Theme Configurator lets you search styles by selector and by rule. If you wish to change a specific selector (e.g., h1), use the "Query/Selector" tab. If you have a specific value you wish to change site-wide (e.g., the color of the type), use the "Rule/Value" tab.
4
  Tags: child theme, custom theme, CSS, responsive design, CSS editor, theme generator
5
  Requires at least: 3.7
6
  Tested up to: 3.9.1
7
+ Stable tag: 1.4.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
14
 
15
  Created by Lilaea Media, the team that brought you IntelliWidget, the Child Theme Configurator provides a new approach to WordPress stylesheets. The Child Theme Configurator lets you identify and override only the Parent Theme style attributes you want to change. It gives you unlimited control over your WordPress look and feel while leaving your Parent Theme untouched.
16
 
 
 
 
 
 
 
 
 
17
  = Take Control of Your Child Themes =
18
 
19
  https://www.youtube.com/watch?v=xL2HkWQxgOA
40
  * Upload custom screenshot for your child theme
41
  * Save hours of development time
42
 
43
+ = Now it works with plugins! =
44
+
45
+ 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.
46
+
47
+ https://www.youtube.com/watch?v=mJ3i6gsuL1E
48
+
49
+ Learn more at http://www.lilaeamedia.com/plugins/child-theme-plugin-styles
50
+
51
+ = IntelliWidget Responsive Menu =
52
+
53
+ Break free from your theme's built-in responsive menu options and take control over the mobile user experience with our premium menu plugin.
54
+
55
+ https://www.youtube.com/watch?v=JDbxvaEt7VE
56
+
57
+ Learn more at http://www.lilaeamedia.com/plugins/intelliwidget-responsive-menu
58
+
59
  == Installation ==
60
 
61
+ 1. To install from the Plugins repository:
62
+ * In the WordPress Admin, go to "Plugins > Add New."
63
+ * Type "child theme" in the "Search" box and click "Search Plugins."
64
+ * Locate "Child Theme Configurator" in the list and click "Install Now."
65
+
66
+ 2. To install manually:
67
+ * Download the IntelliWidget plugin from http://wordpress.org/plugins/child-theme-configurator
68
+ * In the WordPress Admin, go to "Plugins > Add New."
69
+ * Click the "Upload" link at the top of the page.
70
+ * Browse for the zip file, select and click "Install."
71
+
72
+ 3. In the WordPress Admin, go to "Plugins > Installed Plugins." Locate "Child Theme Configurator" in the list and click "Activate."
73
 
74
  == Frequently Asked Questions ==
75
 
153
 
154
  = How do I make my Theme responsive? =
155
 
156
+ The short answer is to use a responsive Parent Theme. Some common characteristics of responsive design are:
157
 
158
  * Avoiding fixed width and height values. Using max- and min-height values and percentages are ways to make your designs respond to the viewer's browser size.
159
  * Combining floats and clears with inline and relative positions allow the elements to adjust gracefully to their container's width.
160
  * Showing and hiding content with Javascript.
161
 
162
+ For more information view "Make a Theme Responsive":
163
+
164
+ https://www.youtube.com/watch?v=iBiiAgsK4G4
165
+
166
  = How do I add Web Fonts? =
167
 
168
  The easiest method is to paste the @import code provided by Google, Font Squirrel or any other Web Font site into the @import tab. The fonts will then be available to use as a value of the font-family rule. Be sure you understand the license for any embedded fonts.
179
 
180
  == Changelog ==
181
 
182
+ = 1.4.4 =
183
+ * Refactored the way CTC caches updates and returns them to the UI controller to reduce memory consumption.
184
+ * Prevent out of memory fatals when generating new child theme.
185
+ * Changed "Scan Parent for Additional Stylesheets" to individual checkbox options for each file with a toggle to show/hide in the Parent/Child tab.
186
+ * Added automatic update of form when Parent Theme is changed.
187
+ * Pre-populate Parent/Child form when parent slug is passed to CTC options.
188
+
189
  = 1.4.3 =
190
  * updated parser to match selectors containing parentheses and empty media rulesets
191
 
286
 
287
  == Upgrade Notice ==
288
 
289
+ = 1.4.4 =
290
+ * This release fixes out of memory errors when generating child themes for parent themes with numerous additional stylesheets.
291
+ * Added ability to select individual parent stylesheets for parsing.
292
 
293
  == Create Your Child Theme ==
294
 
301
  3. Enter a Name for the child theme.
302
  4. Enter an author for the child theme.
303
  5. Enter the child theme version number.
304
+ 6. If you check "Backup Stylesheet", The Child Theme Configurator will create a backup in the theme directory.
305
+ 7. If your theme uses additional stylesheets they will appear as checkbox options. Select only the stylesheets you wish to customize to reduce overhead.
306
  8. Click "Generate Child Theme Files."
307
 
 
 
308
  == Override Parent Styles ==
309
 
310
  There are two ways to identify and override parent styles. The Child Theme Configurator lets you search styles by selector and by rule. If you wish to change a specific selector (e.g., h1), use the "Query/Selector" tab. If you have a specific value you wish to change site-wide (e.g., the color of the type), use the "Rule/Value" tab.