Child Theme Configurator - Version 1.4.5

Version Description

  • Fix: escape quotes in text inputs. This has bugged me for a while now.
  • Fix: Escape backslash for octal content values. Thanks Laurent for reporting this.
  • Fix: Normalize colors to lowercase and short form when possible to prevent duplicate entries in the data
Download this release

Release Info

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

Code changes from version 1.4.4 to 1.4.5

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.4
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.4');
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.5
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.5');
20
  define('CHLD_THM_CFG_MAX_SELECTORS', '5000');
21
  define('CHLD_THM_CFG_MAX_RECURSE_LOOPS', '100');
22
 
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.4
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
@@ -44,7 +44,7 @@ class Child_Theme_Configurator_CSS {
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;
@@ -318,7 +318,7 @@ class Child_Theme_Configurator_CSS {
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
 
@@ -393,9 +393,19 @@ class Child_Theme_Configurator_CSS {
393
  * TODO: this is a stub for future use
394
  */
395
  function parse_css_input($styles) {
396
- return stripslashes($styles);
 
 
 
 
397
  }
398
 
 
 
 
 
 
 
399
  /*
400
  * parse_css_file
401
  * reads stylesheet to get WordPress meta data and passes rest to parse_css
@@ -461,11 +471,13 @@ class Child_Theme_Configurator_CSS {
461
  list($rule, $value) = explode(':', $ruleval, 2);
462
  $rule = trim($rule);
463
  $rule = preg_replace_callback("/[^\w\-]/", array($this, 'to_ascii'), $rule);
464
- $value = stripslashes(trim($value));
465
 
466
  $rules = $values = array();
467
  // save important flag
468
  $important = $this->is_important($value);
 
 
469
  // normalize font
470
  if ('font' == $rule):
471
  $this->normalize_font($value, $rules, $values);
@@ -543,7 +555,7 @@ class Child_Theme_Configurator_CSS {
543
  endif;
544
  $important_parnt = empty($valid['i_parnt']) ? 0 : 1;
545
  $important = isset($valid['i_child']) ? $valid['i_child'] : $important_parnt;
546
- $sel_output .= $this->add_vendor_rules($rulearr[$ruleid], stripslashes($valarr[$valid['child']]), $shorthand, $important);
547
  endif;
548
  endforeach;
549
  $sel_output .= $this->encode_shorthand($shorthand); // . ($important ? ' !important' : '');
@@ -1040,5 +1052,8 @@ class Child_Theme_Configurator_CSS {
1040
  if (preg_match('%^' . preg_quote(WP_PLUGIN_DIR) . '%', $stylesheet)) return $stylesheet;
1041
  return false;
1042
  }
 
 
 
1043
  }
1044
  ?>
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.5
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
44
 
45
  function __construct($parent = '') {
46
  // scalars
47
+ $this->version = '1.4.5';
48
  $this->querykey = 0;
49
  $this->selkey = 0;
50
  $this->qskey = 0;
318
  if (null == $rule || !isset($this->dict_rule[$rule])) continue;
319
  $ruleid = $this->dict_rule[$rule];
320
  $qsid = $matches[3];
321
+ $value = $this->normalize_color($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
 
393
  * TODO: this is a stub for future use
394
  */
395
  function parse_css_input($styles) {
396
+ return $this->sanitize($styles);
397
+ }
398
+
399
+ function sanitize($styles) {
400
+ return $this->repl_octal(sanitize_text_field(stripslashes($this->esc_octal($styles))));
401
  }
402
 
403
+ function esc_octal($styles){
404
+ return preg_replace("#(['\"])\\\\([0-9a-f]{4})(['\"])#i", "$1##bs##$2$3", $styles);
405
+ }
406
+ function repl_octal($styles) {
407
+ return str_replace("##bs##", "\\", $styles);
408
+ }
409
  /*
410
  * parse_css_file
411
  * reads stylesheet to get WordPress meta data and passes rest to parse_css
471
  list($rule, $value) = explode(':', $ruleval, 2);
472
  $rule = trim($rule);
473
  $rule = preg_replace_callback("/[^\w\-]/", array($this, 'to_ascii'), $rule);
474
+ $value = $this->sanitize($value);
475
 
476
  $rules = $values = array();
477
  // save important flag
478
  $important = $this->is_important($value);
479
+ // normalize color
480
+ $value = $this->normalize_color($value);
481
  // normalize font
482
  if ('font' == $rule):
483
  $this->normalize_font($value, $rules, $values);
555
  endif;
556
  $important_parnt = empty($valid['i_parnt']) ? 0 : 1;
557
  $important = isset($valid['i_child']) ? $valid['i_child'] : $important_parnt;
558
+ $sel_output .= $this->add_vendor_rules($rulearr[$ruleid], $this->sanitize($valarr[$valid['child']]), $shorthand, $important);
559
  endif;
560
  endforeach;
561
  $sel_output .= $this->encode_shorthand($shorthand); // . ($important ? ' !important' : '');
1052
  if (preg_match('%^' . preg_quote(WP_PLUGIN_DIR) . '%', $stylesheet)) return $stylesheet;
1053
  return false;
1054
  }
1055
+ function normalize_color($value) {
1056
+ return preg_replace("/#([0-9A-F])\\1([0-9A-F])\\2([0-9A-F])\\3/i",strtolower("#$1$2$3"), $value);
1057
+ }
1058
  }
1059
  ?>
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.4
9
  Author: Lilaea Media
10
  Author URI: http://www.lilaeamedia.com/
11
  Text Domain: chld_thm_cfg
@@ -689,7 +689,7 @@ class Child_Theme_Configurator_UI {
689
  <h5>Can I edit the Child Theme stylesheet manually offline or by using the Editor or do I have to use the Configurator?</h5>
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>
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.5
9
  Author: Lilaea Media
10
  Author URI: http://www.lilaeamedia.com/
11
  Text Domain: chld_thm_cfg
689
  <h5>Can I edit the Child Theme stylesheet manually offline or by using the Editor or do I have to use the Configurator?</h5>
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 separate location for the stylesheets. Select individual stylesheets from the "Parse Additional Stylesheets" section of the Parent/Child tab and click "Generate Child Theme Files" 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>
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.4
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
@@ -232,18 +232,23 @@ class Child_Theme_Configurator {
232
  $this->errors[] = __('Please select a valid Parent Theme', 'chld_thm_cfg');
233
  endif;
234
  if ('new' == $type):
235
- $configtype = 'theme'; // no custom stylesheets until style.css exists!
236
- $child = strtolower(preg_replace("%[^\w\-]%", '', $template));
237
- if ($this->check_theme_exists($child)):
238
- $this->errors[] = sprintf(__('<strong>%s</strong> exists. Please enter a different Child Theme template name', 'chld_thm_cfg'), $child);
 
 
 
 
239
  endif;
240
  endif;
241
- if (empty($child)):
242
- $this->errors[] = __('Please enter a valid Child Theme template name', 'chld_thm_cfg');
243
- endif;
244
  if (empty($name)):
 
 
 
245
  $this->errors[] = __('Please enter a valid Child Theme name', 'chld_thm_cfg');
246
  endif;
 
247
  if (false === $this->verify_child_theme($child)):
248
  $this->errors[] = __('Your theme directories are not writable. Please adjust permissions and try again.', 'chld_thm_cfg');
249
  endif;
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.5
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
232
  $this->errors[] = __('Please select a valid Parent Theme', 'chld_thm_cfg');
233
  endif;
234
  if ('new' == $type):
235
+ if (empty($template) && empty($name)):
236
+ $this->errors[] = __('Please enter a valid Child Theme template name', 'chld_thm_cfg');
237
+ else:
238
+ $configtype = 'theme'; // no custom stylesheets until style.css exists!
239
+ $child = strtolower(preg_replace("%[^\w\-]%", '', empty($template) ? $name : $template));
240
+ if ($this->check_theme_exists($child)):
241
+ $this->errors[] = sprintf(__('<strong>%s</strong> exists. Please enter a different Child Theme template name', 'chld_thm_cfg'), $child);
242
+ endif;
243
  endif;
244
  endif;
 
 
 
245
  if (empty($name)):
246
+ $name = ucfirst($child);
247
+ endif;
248
+ if (empty($child)):
249
  $this->errors[] = __('Please enter a valid Child Theme name', 'chld_thm_cfg');
250
  endif;
251
+
252
  if (false === $this->verify_child_theme($child)):
253
  $this->errors[] = __('Your theme directories are not writable. Please adjust permissions and try again.', 'chld_thm_cfg');
254
  endif;
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.4
6
  * Author: Lilaea Media
7
  * Author URI: http://www.lilaeamedia.com/
8
  * License: GPLv2
@@ -16,7 +16,11 @@ jQuery(document).ready(function($){
16
  saveEvents = {},
17
  rewrite_id,
18
  rewrite_sel,
 
19
  // initialize functions
 
 
 
20
  ctc_setup_iris = function(obj) {
21
  $(obj).iris({
22
  change: function() {
@@ -328,7 +332,7 @@ jQuery(document).ready(function($){
328
  + '<input type="text" id="' + id + '" name="' + id + '" class="ctc-child-value'
329
  + ((newname + rule).toString().match(/color/) ? ' color-picker' : '')
330
  + ((newname).toString().match(/url/) ? ' ctc-input-wide' : '')
331
- + '" value="' + newval + '" />' + lf;
332
  html += '</div>' + lf;
333
  });
334
  html += '<label for="' + impid + '"><input type="checkbox" id="' + impid + '" name="' + impid + '" value="1" '
@@ -869,8 +873,8 @@ jQuery(document).ready(function($){
869
  } else {
870
  origval = $('#ctc_sel_ovrd_selector_selected').text();
871
  $('#ctc_sel_ovrd_selector_selected').html('<input id="ctc_rewrite_selector" name="ctc_rewrite_selector" type="text" value="'
872
- + origval + '" autocomplete="off" /><input id="ctc_rewrite_selector_orig" name="ctc_rewrite_selector_orig" type="hidden" value="'
873
- + origval + '"/>');
874
  $(obj).text(ctcAjax.cancel_txt);
875
  }
876
  }
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.5
6
  * Author: Lilaea Media
7
  * Author URI: http://www.lilaeamedia.com/
8
  * License: GPLv2
16
  saveEvents = {},
17
  rewrite_id,
18
  rewrite_sel,
19
+ quot_regex = new RegExp('"', 'g'),
20
  // initialize functions
21
+ esc_quot = function(str){
22
+ return str.replace(quot_regex, '&quot;');
23
+ },
24
  ctc_setup_iris = function(obj) {
25
  $(obj).iris({
26
  change: function() {
332
  + '<input type="text" id="' + id + '" name="' + id + '" class="ctc-child-value'
333
  + ((newname + rule).toString().match(/color/) ? ' color-picker' : '')
334
  + ((newname).toString().match(/url/) ? ' ctc-input-wide' : '')
335
+ + '" value="' + esc_quot(newval) + '" />' + lf;
336
  html += '</div>' + lf;
337
  });
338
  html += '<label for="' + impid + '"><input type="checkbox" id="' + impid + '" name="' + impid + '" value="1" '
873
  } else {
874
  origval = $('#ctc_sel_ovrd_selector_selected').text();
875
  $('#ctc_sel_ovrd_selector_selected').html('<input id="ctc_rewrite_selector" name="ctc_rewrite_selector" type="text" value="'
876
+ + esc_quot(origval) + '" autocomplete="off" /><input id="ctc_rewrite_selector_orig" name="ctc_rewrite_selector_orig" type="hidden" value="'
877
+ + esc_quot(origval) + '"/>');
878
  $(obj).text(ctcAjax.cancel_txt);
879
  }
880
  }
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.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)});
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.5
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",u="base",h,b={},r,s,p=new RegExp('"',"g"),n=function(v){return v.replace(p,"&quot;")},k=function(v){c(v).iris({change:function(){f(v)}})},e=function(x){var v=parseInt(x),w=String.fromCharCode(v);return w},m=function(w){var v=w.charCodeAt(0);return v},f=function(B){var x=/^(ctc_(ovrd|\d+)_(parent|child)_([0-9a-z\-]+)_(\d+))(_\w+)?$/,C=c(B).parents(".ctc-selector-row, .ctc-parent-row").first(),A=C.find(".ctc-swatch").first(),z={parent:{},child:{}},y={parent:{origin:"",start:"",end:""},child:{origin:"",start:"",end:""}},w={child:false,parent:false},v={};C.find(".ctc-parent-value, .ctc-child-value").each(function(){var K=c(this).attr("id"),D=K.toString().match(x),L=D[2],E=D[3],N=("undefined"==typeof D[4]?"":D[4]),J=D[5],I=("undefined"==typeof D[6]?"":D[6]),M=("parent"==E?c(this).text():c(this).val()),F="ctc_"+L+"_child_"+N+"_i_"+J,H,G;if("child"==E){v[K]=M;v[F]=(c("#"+F).is(":checked"))?1:0}if(""!=M){if(false===t(I)){switch(I){case"_border_width":z[E][N+"-width"]=M;break;case"_border_style":z[E][N+"-style"]=M;break;case"_border_color":z[E][N+"-color"]=M;break;case"_background_url":z[E]["background-image"]=i(E,M);break;case"_background_color":z[E]["background-color"]=B.value;break;case"_background_color1":y[E].start=M;w[E]=true;break;case"_background_color2":y[E].end=M;w[E]=true;break;case"_background_origin":y[E].origin=M;w[E]=true;break}}else{if(H=N.toString().match(/^border(\-(top|right|bottom|left))?$/)&&!M.match(/none/)){G=M.toString().split(/ +/);z[E][N+"-width"]="undefined"==typeof G[0]?"":G[0];z[E][N+"-style"]="undefined"==typeof G[1]?"":G[1];z[E][N+"-color"]="undefined"==typeof G[2]?"":G[2]}else{if("background-image"==N){if(M.toString().match(/url\(/)){z[E]["background-image"]=i(E,M)}else{G=M.toString().split(/ +/);if(G.length>2){y[E].origin="undefined"==typeof G[0]?"top":G[0];y[E].start="undefined"==typeof G[1]?"transparent":G[1];y[E].end="undefined"==typeof G[2]?"transparent":G[2];w[E]=true}else{z[E]["background-image"]=M}}}else{z[E][N]=M}}}}});if("undefined"!=typeof A&&false===t(A.attr("id"))){c(A).removeAttr("style");if(w.parent){c(A).ctcgrad(y.parent.origin,[y.parent.start,y.parent.end])}c(A).css(z.parent);if(!(A.attr("id").toString().match(/parent/))){if(w.child){c(A).ctcgrad(y.child.origin,[y.child.start,y.child.end])}c(A).css(z.child)}}return v},o=function(w){var v,x,y;c(w).each(function(){switch(this.obj){case"imports":ctcAjax.imports=this.data;break;case"rule_val":ctcAjax.rule_val[this.key]=this.data;y=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(t(this.key)){ctcAjax.sel_ndx=this.data}else{if("qsid"==this.key){if(t(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;v=this.key}}break;case"sel_val":ctcAjax.sel_val[this.key]=this.data;x=this.key;break;case"rewrite":r=this.key;s=this.data;break}})},i=function(z,w){var y=w.toString().match(/url\(['" ]*(.+?)['" ]*\)/),x=t(y)?null:y[1],v=ctcAjax.theme_uri+"/"+("parent"==z?ctcAjax.parnt:ctcAjax.child)+"/",A;if(!x){return false}else{if(x.toString().match(/^(https?:|\/)/)){A=w}else{A="url("+v+x+")"}}return A},t=function(w){if("undefined"==typeof w||false===w||null===w||""===w){return true}if(true===w||"string"===typeof w||"number"===typeof w){return false}if("object"===typeof w){for(var v in w){if(w.hasOwnProperty(v)){return false}}return true}return false},a=function(){var v=[];if(1===loading.sel_ndx){return v}if(0===loading.sel_ndx){loading.sel_ndx=1;ctc_query_css("sel_ndx",null,ctc_setup_query_menu);return v}if(false===t(ctcAjax.sel_ndx)){c.each(ctcAjax.sel_ndx,function(w,x){var y={label:w,value:w};v.push(y)})}return v},q=function(w){var v=[];if(1===loading.sel_ndx){return v}if(0===loading.sel_ndx){loading.sel_ndx=1;ctc_query_css("sel_ndx",w,ctc_setup_selector_menu);return v}if(false===t(ctcAjax.sel_ndx[w])){c.each(ctcAjax.sel_ndx[w],function(x,y){var z={label:x,value:y};v.push(z)})}return v},d=function(){var v=[];if(1===loading.rule){return v}if(0===loading.rule){loading.rule=1;ctc_query_css("rule",null,ctc_setup_rule_menu);return v}if(false===t(ctcAjax.rule)){c.each(ctcAjax.rule,function(w,x){var y={label:x.replace(/\d+/g,e),value:w};v.push(y)})}return v.sort(function(x,w){if(x.label>w.label){return 1}if(x.label<w.label){return -1}return 0})},j=function(z,B,E){var x="",C=(t(ctcAjax.sel_val[z])||t(ctcAjax.sel_val[z].value)||t(ctcAjax.sel_val[z].value[B])?"":ctcAjax.sel_val[z].value[B]),w=ctc_decode_value(B,("undefined"==typeof C?"":C.parnt)),A=(false===t(C.i_parnt)&&C.i_parnt)?ctcAjax.important_label:"",y=ctc_decode_value(B,("undefined"==typeof C?"":C.child)),v=(false===t(C.i_child)&&C.i_child)?1:0,D="ctc_"+E+"_child_"+B+"_i_"+z;if(false===t(ctcAjax.sel_val[z])){x+='<div class="ctc-'+("ovrd"==E?"input":"selector")+'-row clearfix">'+l;x+='<div class="ctc-input-cell">'+("ovrd"==E?B.replace(/\d+/g,e):ctcAjax.sel_val[z].selector+'<br/><a href="#" class="ctc-selector-edit" id="ctc_selector_edit_'+z+'" >'+ctcAjax.edit_txt+"</a> "+(t(w.orig)?ctcAjax.child_only_txt:""))+"</div>"+l;if("ovrd"==E){x+='<div class="ctc-parent-value ctc-input-cell" id="ctc_'+E+"_parent_"+B+"_"+z+'">'+(t(w.orig)?"[no value]":w.orig+A)+"</div>"+l}x+='<div class="ctc-input-cell">'+l;if(false===t(w.names)){c.each(w.names,function(F,G){G=(t(G)?"":G);x+='<div class="ctc-child-input-cell">'+l;var I="ctc_"+E+"_child_"+B+"_"+z+G,H;if(false===(H=y.values.shift())){H=""}x+=(t(G)?"":ctcAjax.field_labels[G]+":<br/>")+'<input type="text" id="'+I+'" name="'+I+'" class="ctc-child-value'+((G+B).toString().match(/color/)?" color-picker":"")+((G).toString().match(/url/)?" ctc-input-wide":"")+'" value="'+n(H)+'" />'+l;x+="</div>"+l});x+='<label for="'+D+'"><input type="checkbox" id="'+D+'" name="'+D+'" value="1" '+(1===v?"checked":"")+" />"+ctcAjax.important_label+"</label>"+l}x+="</div>"+l;x+=("ovrd"==E?"":'<div class="ctc-swatch ctc-specific" id="ctc_child_'+B+"_"+z+'_swatch">'+ctcAjax.swatch_txt+"</div>"+l+'<div class="ctc-child-input-cell ctc-button-cell" id="ctc_save_'+B+"_"+z+'_cell">'+l+'<input type="button" class="button ctc-save-input" id="ctc_save_'+B+"_"+z+'" name="ctc_save_'+B+"_"+z+'" value="Save" /></div>'+l);x+="</div><!-- end input row -->"+l}return x},g=function(v){if(1===loading.sel_val){return false}if(0==loading.sel_val){loading.sel_val=1;ctc_query_css("sel_val",v,g);return false}var y,w,x;if(t(ctcAjax.sel_val[v])){c("#ctc_sel_ovrd_rule_inputs").html("")}else{if(t(ctcAjax.sel_val[v].seq)){c("#ctc_child_load_order_container").html("")}else{y="ctc_ovrd_child_seq_"+v;x=parseInt(ctcAjax.sel_val[v].seq);w='<input type="text" id="'+y+'" name="'+y+'" class="ctc-child-value" value="'+x+'" />';c("#ctc_child_load_order_container").html(w)}if(t(ctcAjax.sel_val[v].value)){c("#ctc_sel_ovrd_rule_inputs").html("")}else{w="";c.each(ctcAjax.sel_val[v].value,function(A,z){w+=j(v,A,"ovrd")});c("#ctc_sel_ovrd_rule_inputs").html(w).find(".color-picker").each(function(){k(this)});f("#ctc_child_all_0_swatch")}}};ctc_render_css_preview=function(v){if(1===loading.preview){return false}if(0==loading.preview){loading.preview=1;var v;if(!(v=c(this).attr("id").toString().match(/(child|parnt)/)[1])){v="child"}ctc_set_notice("");ctc_query_css("preview",v,ctc_render_css_preview);return false}if(2==loading.preview){c("#view_"+v+"_options_panel").text(ctcAjax.previewResponse);loading.preview=0}},ctc_render_rule_value_inputs=function(w){if(1===loading.rule_val){return false}if(0==loading.rule_val){loading.rule_val=1;ctc_query_css("rule_val",w,ctc_render_rule_value_inputs);return false}var x=ctcAjax.rule[w],v='<div class="ctc-input-row clearfix" id="ctc_rule_row_'+x+'">'+l;if(false===t(ctcAjax.rule_val[w])){c.each(ctcAjax.rule_val[w],function(z,A){var y=ctc_decode_value(x,A);v+='<div class="ctc-parent-row clearfix" id="ctc_rule_row_'+x+"_"+z+'">'+l;v+='<div class="ctc-input-cell ctc-parent-value" id="ctc_'+z+"_parent_"+x+"_"+z+'">'+y.orig+"</div>"+l;v+='<div class="ctc-input-cell">'+l;v+='<div class="ctc-swatch ctc-specific" id="ctc_'+z+"_parent_"+x+"_"+z+'_swatch">'+ctcAjax.swatch_txt+"</div></div>"+l;v+='<div class="ctc-input-cell"><a href="#" class="ctc-selector-handle" id="ctc_selector_'+x+"_"+z+'">'+ctcAjax.selector_txt+"</a></div>"+l;v+='<div id="ctc_selector_'+x+"_"+z+'_container" class="ctc-selector-container clearfix">'+l;v+='<a href="#" id="ctc_selector_'+x+"_"+z+'_close" class="ctc-selector-handle" style="float:right">'+ctcAjax.close_txt+'</a><div id="ctc_status_val_qry_'+z+'"></div>'+l;v+='<div id="ctc_selector_'+x+"_"+z+'_rows"></div>'+l;v+="</div></div>"+l});v+="</div>"+l}c("#ctc_rule_value_inputs").html(v).find(".ctc-swatch").each(function(){f(this)})},ctc_render_selector_value_inputs=function(y){if(1==loading.val_qry){return false}var A,w,z=c("#ctc_rule_menu_selected").text().replace(/[^\w\-]/g,m),v,x="";if(0===loading.val_qry){loading.val_qry=1;A={rule:z};ctc_query_css("val_qry",y,ctc_render_selector_value_inputs,A);return false}if(false===t(ctcAjax.val_qry[y])){c.each(ctcAjax.val_qry[y],function(C,B){page_rule=C;c.each(B,function(E,D){x+='<h4 class="ctc-query-heading">'+E+"</h4>"+l;if(false===t(D)){c.each(D,function(F,G){ctcAjax.sel_val[F]=G;x+=j(F,C,y)})}})})}v="#ctc_selector_"+z+"_"+y+"_rows";c(v).html(x).find(".color-picker").each(function(){k(this)});c(v).find(".ctc-swatch").each(function(){f(this)})},ctc_query_css=function(x,w,A,y){var v={ctc_query_obj:x,ctc_query_key:w},z="#ctc_status_"+x+("val_qry"==x?"_"+w:"");if("object"===typeof y){c.each(y,function(B,C){v["ctc_query_"+B]=C})}c(".ctc-status-icon").remove();c(z).append('<span class="ctc-status-icon spinner"></span>');c(".spinner").show();v.action="ctc_query";v._wpnonce=c("#_wpnonce").val();c.post(ctcAjax.ajaxurl,v,function(B){loading[x]=2;c(".ctc-status-icon").removeClass("spinner");if(t(B)){c(".ctc-status-icon").addClass("failure");if("preview"==x){ctcAjax.previewResponse=ctcAjax.css_fail_txt;A(w)}}else{c(".ctc-status-icon").addClass("success");if("preview"==x){ctcAjax.previewResponse=B.shift().data}else{o(B)}if("function"===typeof A){A(w)}return false}},"json").fail(function(){c(".ctc-status-icon").removeClass("spinner");c(".ctc-status-icon").addClass("failure");if("preview"==x){ctcAjax.previewResponse=ctcAjax.css_fail_txt;loading[x]=2;A(w)}else{loading[x]=0}});return false},ctc_save=function(A){var y={},B,x,v,w,C=c(A).attr("id"),z;if(t(b[C])){b[C]=0}b[C]++;c(A).prop("disabled",true);c(".ctc-status-icon").remove();c(A).parent(".ctc-textarea-button-cell, .ctc-button-cell").append('<span class="ctc-status-icon spinner"></span>');c(".spinner").show();if((B=c("#ctc_new_selectors"))&&"ctc_save_new_selectors"==c(A).attr("id")){y.ctc_new_selectors=B.val();if(x=c("#ctc_sel_ovrd_query_selected")){y.ctc_sel_ovrd_query=x.text()}}else{if((v=c("#ctc_child_imports"))&&"ctc_save_imports"==c(A).attr("id")){y.ctc_child_imports=v.val()}else{y=f(A)}}c("#ctc_sel_ovrd_selector_selected").find("#ctc_rewrite_selector").each(function(){z=c("#ctc_rewrite_selector").val(),origsel=c("#ctc_rewrite_selector_orig").val();if(t(z)||!z.toString().match(/\w/)){z=origsel}else{y.ctc_rewrite_selector=z}c(".ctc-rewrite-toggle").text(ctcAjax.rename_txt);c("#ctc_sel_ovrd_selector_selected").html(z)});y.action="ctc_update";y._wpnonce=c("#_wpnonce").val();c.post(ctcAjax.ajaxurl,y,function(D){c(A).prop("disabled",false);c(".ctc-status-icon").removeClass("spinner");if(t(D)){c(".ctc-status-icon").addClass("failure")}else{c(".ctc-status-icon").addClass("success");c("#ctc_new_selectors").val("");o(D);ctc_setup_menus();if(false===t(r)){ctc_set_selector(r,s);r=s=null}}return false},"json").fail(function(){c(A).prop("disabled",false);c(".ctc-status-icon").removeClass("spinner");c(".ctc-status-icon").addClass("failure")});return false},ctc_decode_value=function(x,v){v=("undefined"==typeof v?"":v);var w={orig:v};if(x.toString().match(/^border(\-(top|right|bottom|left))?$/)){var y=v.toString().split(/ +/);w.names=["_border_width","_border_style","_border_color"];w.values=[("undefined"==typeof y[0]?"":y[0]),("undefined"==typeof y[1]?"":y[1]),("undefined"==typeof y[2]?"":y[2])]}else{if(x.toString().match(/^background\-image/)){w.names=["_background_url","_background_origin","_background_color1","_background_color2"];w.values=["","","",""];if(false===(t(v))&&!(v.toString().match(/url/))){var y=v.toString().split(/:/);w.values[1]=("undefined"==typeof y[0]?"":y[0]);w.values[2]=("undefined"==typeof y[1]?"":y[1]);w.values[3]=("undefined"==typeof y[3]?"":y[3]);w.orig=[w.values[1],w.values[2],w.values[3]].join(" ")}else{w.values[0]=v}}else{w.names=[""];w.values=[v]}}return w},ctc_set_query=function(v){u=v;c("#ctc_sel_ovrd_query").val("");c("#ctc_sel_ovrd_query_selected").text(v);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(v);f("#ctc_child_all_0_swatch");c("#ctc_new_selector_row").show()},ctc_set_selector=function(w,v){c("#ctc_sel_ovrd_selector").val("");c("#ctc_sel_ovrd_selector_selected").text(v);c("#ctc_sel_ovrd_qsid").val(w);h=w;if(1!=loading.sel_val){loading.sel_val=0}g(w);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(w,v){c("#ctc_rule_menu").val("");c("#ctc_rule_menu_selected").text(v);if(1!=loading.rule_val){loading.rule_val=0}ctc_render_rule_value_inputs(w);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(w,v){ctc_set_query(v.item.value);return false},focus:function(v){v.preventDefault()}})},ctc_setup_selector_menu=function(v){ctc_selectors=q(v);c("#ctc_sel_ovrd_selector").autocomplete({source:ctc_selectors,selectFirst:true,autoFocus:true,select:function(x,w){ctc_set_selector(w.item.value,w.item.label);return false},focus:function(w){w.preventDefault()}})},ctc_setup_rule_menu=function(){ctc_rules=d();c("#ctc_rule_menu").autocomplete({source:ctc_rules,selectFirst:true,autoFocus:true,select:function(w,v){ctc_set_rule(v.item.value,v.item.label);return false},focus:function(v){v.preventDefault()}})},ctc_filtered_rules=function(y,w){var v=[],x=(t(ctcAjax.sel_val[h]))||(t(ctcAjax.sel_val[h].value));if(t(ctc_rules)){ctc_rules=d()}c.each(ctc_rules,function(z,C){var A=false,B=new RegExp(c.ui.autocomplete.escapeRegex(y.term),"i");if(B.test(C.label)){if(false===x){c.each(ctcAjax.sel_val[h].value,function(E,D){if(C.label==E.replace(/\d+/g,e)){A=true;return false}});if(A){return}}v.push(C)}});w(v)},ctc_setup_new_rule_menu=function(){c("#ctc_new_rule_menu").autocomplete({source:ctc_filtered_rules,selectFirst:true,autoFocus:true,select:function(w,v){w.preventDefault();var x=c(j(h,v.item.label.replace(/[^\w\-]/g,m),"ovrd"));c("#ctc_sel_ovrd_rule_inputs").append(x);c("#ctc_new_rule_menu").val("");if(t(ctcAjax.sel_val[h].value)){ctcAjax.sel_val[h]["value"]={}}ctcAjax.sel_val[h].value[v.item.label]={child:""};x.find('input[type="text"]').each(function(y,z){if(c(z).hasClass("color-picker")){k(z)}c(z).focus()});return false},focus:function(v){v.preventDefault()}})},ctc_setup_menus=function(){ctc_setup_query_menu();ctc_setup_selector_menu(u);ctc_setup_rule_menu();ctc_setup_new_rule_menu()},ctc_theme_exists=function(v,w){var x=false;c.each(ctcAjax.themes,function(y,z){c.each(z,function(A,B){if(A==v&&("parnt"==y||"new"==w)){x=true;return false}});if(x){return false}});return x},ctc_set_notice=function(v){var w="";if(false===t(v)){c.each(v,function(x,y){w+='<div class="'+x+'"><ul>'+l;c(y).each(function(z,A){w+="<li>"+A.toString()+"</li>"+l});w+="</ul></div>"})}c("#ctc_error_notice").html(w)},ctc_validate=function(){var y=/[^\w\-]/,w=c("#ctc_child_template").val().toString().replace(y).toLowerCase(),v=c("#ctc_theme_child").val().toString().replace(y).toLowerCase(),x=c("input[name=ctc_child_type]:checked").val(),z=[];if("new"==x){v=w}if(ctc_theme_exists(v,x)){z.push(ctcAjax.theme_exists_txt.toString().replace(/%s/,v))}if(""===v){z.push(ctcAjax.inval_theme_txt)}if(""===c("#ctc_child_name").val()){z.push(ctcAjax.inval_name_txt)}if(z.length){ctc_set_notice({error:z});return false}return true},ctc_set_theme_menu=function(w){var v=c("#ctc_theme_child").val();if(false===t(ctcAjax.themes.child[v])){c("#ctc_child_name").val(ctcAjax.themes.child[v].Name);c("#ctc_child_author").val(ctcAjax.themes.child[v].Author);c("#ctc_child_version").val(ctcAjax.themes.child[v].Version)}},fade_update_notice=function(){c(".updated, .error").slideUp("slow",function(){c(".updated").remove()})},ctc_focus_panel=function(w){var v=w+"_panel";c(".nav-tab").removeClass("nav-tab-active");c(".ctc-option-panel").removeClass("ctc-option-panel-active");c(".ctc-selector-container").hide();c(w).addClass("nav-tab-active");c(".ctc-option-panel-container").scrollTop(0);c(v).addClass("ctc-option-panel-active")},ctc_selector_edit=function(y){var v=c(y).attr("id").match(/_(\d+)$/)[1],x=ctcAjax.sel_val[v].query,w=ctcAjax.sel_val[v].selector,z="#query_selector_options";ctc_set_query(x);ctc_set_selector(v,w);ctc_focus_panel(z)},ctc_selector_input_toggle=function(w){var v;if(c("#ctc_rewrite_selector").length){v=c("#ctc_rewrite_selector_orig").val();c("#ctc_sel_ovrd_selector_selected").text(v);c(w).text(ctcAjax.rename_txt)}else{v=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="'+n(v)+'" autocomplete="off" /><input id="ctc_rewrite_selector_orig" name="ctc_rewrite_selector_orig" type="hidden" value="'+n(v)+'"/>');c(w).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(w){w.preventDefault();ctc_set_notice("");var x=c(this).attr("id").toString().replace("_close",""),v=x.toString().match(/_(\d+)$/)[1];if(c("#"+x+"_container").is(":hidden")){if(1!=loading.val_qry){loading.val_qry=0}ctc_render_selector_value_inputs(v)}c("#"+x+"_container").fadeToggle("fast");c(".ctc-selector-container").not("#"+x+"_container").fadeOut("fast")});c(".nav-tab").on("click",function(v){v.preventDefault();ctc_set_notice("");c(".ctc-status-icon").remove();var w="#"+c(this).attr("id");ctc_focus_panel(w)});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(v){ctc_save(this)});c(document).on("click",".ctc-selector-edit",function(v){ctc_selector_edit(this)});c(document).on("click",".ctc-rewrite-toggle",function(v){v.preventDefault();ctc_selector_input_toggle(this)});c(document).on("change","#ctc_theme_parnt",function(v){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(v){c(this).toggleClass("open");c("#ctc_additional_css_files").slideToggle("fast")});ctc_setup_menus();ctc_set_query(u);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.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -179,6 +179,11 @@ You can also create a secondary stylesheet that contains @font-face rules and im
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.
@@ -286,9 +291,8 @@ You can also create a secondary stylesheet that contains @font-face rules and im
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
 
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.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
179
 
180
  == Changelog ==
181
 
182
+ = 1.4.5 =
183
+ * Fix: escape quotes in text inputs. This has bugged me for a while now.
184
+ * Fix: Escape backslash for octal content values. Thanks Laurent for reporting this.
185
+ * Fix: Normalize colors to lowercase and short form when possible to prevent duplicate entries in the data
186
+
187
  = 1.4.4 =
188
  * Refactored the way CTC caches updates and returns them to the UI controller to reduce memory consumption.
189
  * Prevent out of memory fatals when generating new child theme.
291
 
292
  == Upgrade Notice ==
293
 
294
+ = 1.4.5 =
295
+ * Fixed a number of issues with text inputs. See changelog for details.
 
296
 
297
  == Create Your Child Theme ==
298