Child Theme Configurator - Version 1.1.9

Version Description

  • Added check for writability before attempting to create child theme files to avoid fatal error on servers not running suEXEC. Fixed a bug in the ctc_update_cache function that was throwing a fatal JS error when new media queries were saved via the Raw CSS input. Configurator now adds functions.php file to child theme when it does not exist.
Download this release

Release Info

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

Code changes from version 1.1.8 to 1.1.9

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.1.8
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
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.1.9
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
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.1.8
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
@@ -43,7 +43,7 @@ class Child_Theme_Configurator_CSS {
43
 
44
  function __construct() {
45
  // scalars
46
- $this->version = '1.1.8';
47
  $this->querykey = 0;
48
  $this->selkey = 0;
49
  $this->qskey = 0;
@@ -458,6 +458,19 @@ class Child_Theme_Configurator_CSS {
458
  * TODO: allow user to modify selector sequence, !important flags and @media sort
459
  */
460
  function write_css($backup = false) {
 
 
 
 
 
 
 
 
 
 
 
 
 
461
  // write new stylesheet
462
  $output = '/*' . LF;
463
  $output .= 'Theme Name: ' . $this->child_name . LF;
@@ -503,7 +516,6 @@ class Child_Theme_Configurator_CSS {
503
  endif;
504
  endforeach;
505
  $sel_output .= $this->encode_shorthand($shorthand); // . ($important ? ' !important' : '');
506
- ;
507
  if ($has_value):
508
  $sel_output .= '}' . LF;
509
  endif;
@@ -512,19 +524,16 @@ class Child_Theme_Configurator_CSS {
512
  if ('base' != $query) $sel_output .= '}' . LF;
513
  if ($has_selector) $output .= $sel_output;
514
  endforeach;
515
- $themedir = get_theme_root() . '/' . $this->child;
516
-
517
- $stylesheet = $themedir . '/style.css';
518
- if (!is_dir($themedir)):
519
- mkdir($themedir, 0755);
520
- endif;
521
  // backup current stylesheet
522
  if ($backup && is_file($stylesheet)):
523
- $timestamp = date('YmdHis', current_time('timestamp'));
524
- file_put_contents($stylesheet . '-' . $timestamp . '.bak', file_get_contents($stylesheet));
 
525
  endif;
526
  // write new stylesheet
527
- file_put_contents($stylesheet, $output);
 
528
  }
529
 
530
  /*
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.1.9
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
43
 
44
  function __construct() {
45
  // scalars
46
+ $this->version = '1.1.9';
47
  $this->querykey = 0;
48
  $this->selkey = 0;
49
  $this->qskey = 0;
458
  * TODO: allow user to modify selector sequence, !important flags and @media sort
459
  */
460
  function write_css($backup = false) {
461
+ // verify write permissions
462
+ $themedir = get_theme_root();
463
+ if (! is_writable($themedir)) return false;
464
+ $childdir = $themedir . '/' . $this->child;
465
+
466
+ if (!is_dir($childdir)):
467
+ if (!mkdir($childdir, 0755)) return false;
468
+ endif;
469
+ // add functions.php file
470
+ if ($backup && !file_exists($childdir . '/functions.php')):
471
+ if (false === file_put_contents($childdir . '/functions.php',
472
+ "<?php\n// Exit if accessed directly\nif ( !defined('ABSPATH')) exit;\n\n/* Add custom functions below */")) return false;
473
+ endif;
474
  // write new stylesheet
475
  $output = '/*' . LF;
476
  $output .= 'Theme Name: ' . $this->child_name . LF;
516
  endif;
517
  endforeach;
518
  $sel_output .= $this->encode_shorthand($shorthand); // . ($important ? ' !important' : '');
 
519
  if ($has_value):
520
  $sel_output .= '}' . LF;
521
  endif;
524
  if ('base' != $query) $sel_output .= '}' . LF;
525
  if ($has_selector) $output .= $sel_output;
526
  endforeach;
527
+ $stylesheet = $childdir . '/style.css';
 
 
 
 
 
528
  // backup current stylesheet
529
  if ($backup && is_file($stylesheet)):
530
+ $timestamp = date('YmdHis', current_time('timestamp'));
531
+ $bakfile = preg_replace("/\.css$/", '', $stylesheet) . '-' . $timestamp . '.css';
532
+ if (false === file_put_contents($bakfile, file_get_contents($stylesheet))) return false;
533
  endif;
534
  // write new stylesheet
535
+ if (false === file_put_contents($stylesheet, $output)) return false;
536
+ return true;
537
  }
538
 
539
  /*
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.1.8
9
  Author: Lilaea Media
10
  Author URI: http://www.lilaeamedia.com/
11
  Text Domain: chld_thm_cfg
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.1.9
9
  Author: Lilaea Media
10
  Author URI: http://www.lilaeamedia.com/
11
  Text Domain: chld_thm_cfg
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.1.8
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
@@ -18,7 +18,7 @@ require_once('class-ctc-ui.php');
18
  require_once('class-ctc-css.php');
19
  class Child_Theme_Configurator {
20
 
21
- var $version = '1.1.8';
22
  var $css;
23
  var $optionsName;
24
  var $menuName;
@@ -231,7 +231,10 @@ class Child_Theme_Configurator {
231
  $this->css->set_property('child_version', $version);
232
  $this->css->parse_css_file('parnt');
233
  $this->css->parse_css_file('child');
234
- $this->css->write_css(true); // backup current stylesheet
 
 
 
235
  $this->css->reset_updates();
236
  if (update_option($this->optionsName, $this->css)):
237
  $this->update_redirect();
@@ -254,6 +257,7 @@ class Child_Theme_Configurator {
254
  return in_array($theme, array_keys(wp_get_themes()));
255
  }
256
 
 
257
  function sanitize_options($input) {
258
  return $input;
259
  }
@@ -264,5 +268,4 @@ class Child_Theme_Configurator {
264
  die();
265
  endif;
266
  }
267
-
268
  }
6
  Class: Child_Theme_Configurator
7
  Plugin URI: http://www.lilaeamedia.com/plugins/child-theme-configurator/
8
  Description: Main Controller Class
9
+ Version: 1.1.9
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
18
  require_once('class-ctc-css.php');
19
  class Child_Theme_Configurator {
20
 
21
+ var $version = '1.1.9';
22
  var $css;
23
  var $optionsName;
24
  var $menuName;
231
  $this->css->set_property('child_version', $version);
232
  $this->css->parse_css_file('parnt');
233
  $this->css->parse_css_file('child');
234
+ if (!$this->css->write_css(true)): // true backs up current stylesheet
235
+ $this->errors[] = __('Your theme directory is not writable. Please adjust permissions and try again.', 'chld_thm_cfg');
236
+ return false;
237
+ endif;
238
  $this->css->reset_updates();
239
  if (update_option($this->optionsName, $this->css)):
240
  $this->update_redirect();
257
  return in_array($theme, array_keys(wp_get_themes()));
258
  }
259
 
260
+ // this is a stub for future use
261
  function sanitize_options($input) {
262
  return $input;
263
  }
268
  die();
269
  endif;
270
  }
 
271
  }
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.1.8
6
  * Author: Lilaea Media
7
  * Author URI: http://www.lilaeamedia.com/
8
  * License: GPLv2
@@ -157,7 +157,10 @@ jQuery(document).ready(function($){
157
  if (ctc_is_empty(this.key)) {
158
  ctcAjax.sel_ndx = this.data;
159
  } else if ('qsid' == this.key) {
160
- ctcAjax.sel_ndx[this.data['query']][this.data['selector']] = this.data['qsid'];
 
 
 
161
  } else {
162
  ctcAjax.sel_ndx[this.key] = this.data;
163
  currQuery = this.key;
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.1.9
6
  * Author: Lilaea Media
7
  * Author URI: http://www.lilaeamedia.com/
8
  * License: GPLv2
157
  if (ctc_is_empty(this.key)) {
158
  ctcAjax.sel_ndx = this.data;
159
  } else if ('qsid' == this.key) {
160
+ if (ctc_is_empty(ctcAjax.sel_ndx[this.data.query])) {
161
+ ctcAjax.sel_ndx[this.data.query] = {}
162
+ }
163
+ ctcAjax.sel_ndx[this.data.query][this.data.selector] = this.data.qsid;
164
  } else {
165
  ctcAjax.sel_ndx[this.key] = this.data;
166
  currQuery = this.key;
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.1.8
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(g){var n="\n",k="base",a,m={},o=function(p){g(p).iris({change:function(){j(p)}})},j=function(v){var r=/^(ctc_(ovrd|\d+)_(parent|child)_([a-z\-]+)_(\d+))(_\w+)?$/,w=g(v).parents(".ctc-selector-row, .ctc-parent-row").first(),u=w.find(".ctc-swatch").first(),t={parent:{},child:{}},s={parent:{origin:"",start:"",end:""},child:{origin:"",start:"",end:""}},q={child:false,parent:false},p={};w.find(".ctc-parent-value, .ctc-child-value").each(function(){var E=g(this).attr("id"),x=E.toString().match(r),F=x[2],y=x[3],H=("undefined"==typeof x[4]?"":x[4]),D=x[5],C=("undefined"==typeof x[6]?"":x[6]),G=("parent"==y?g(this).text():g(this).val()),z="ctc_"+F+"_child_"+H+"_i_"+D,B,A;if("child"==y){p[E]=G;p[z]=(g("#"+z).is(":checked"))?1:0}if(""===G){g("#"+z).prop("checked",false);return}if(false===b(C)){switch(C){case"_border_width":t[y][H+"-width"]=G;break;case"_border_style":t[y][H+"-style"]=G;break;case"_border_color":t[y][H+"-color"]=G;break;case"_background_url":t[y]["background-image"]=d(y,G);break;case"_background_color":t[y]["background-color"]=v.value;break;case"_background_color1":s[y].start=G;q[y]=true;break;case"_background_color2":s[y].end=G;q[y]=true;break;case"_background_origin":s[y].origin=G;q[y]=true;break}}else{if(B=H.toString().match(/^border(\-(top|right|bottom|left))?$/)&&!G.match(/none/)){A=G.toString().split(/ +/);t[y][H+"-width"]="undefined"==typeof A[0]?"":A[0];t[y][H+"-style"]="undefined"==typeof A[1]?"":A[1];t[y][H+"-color"]="undefined"==typeof A[2]?"":A[2]}else{if("background-image"==H){if(G.toString().match(/url\(/)){t[y]["background-image"]=d(y,G)}else{A=G.toString().split(/ +/);if(A.length>2){s[y].origin="undefined"==typeof A[0]?"top":A[0];s[y].start="undefined"==typeof A[1]?"transparent":A[1];s[y].end="undefined"==typeof A[2]?"transparent":A[2];q[y]=true}else{t[y]["background-image"]=G}}}else{t[y][H]=G}}}});if("undefined"!=typeof u){g(u).removeAttr("style");if(q.parent){g(u).ctcgrad(s.parent.origin,[s.parent.start,s.parent.end])}g(u).css(t.parent);if(!(u.attr("id").toString().match(/parent/))){if(q.child){g(u).ctcgrad(s.child.origin,[s.child.start,s.child.end])}g(u).css(t.child)}}return p},c=function(r){var q,s,p;g(r).each(function(){switch(this.obj){case"imports":ctcAjax.imports=this.data;break;case"rule_val":ctcAjax.rule_val[this.key]=this.data;currRuleId=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(b(this.key)){ctcAjax.sel_ndx=this.data}else{if("qsid"==this.key){ctcAjax.sel_ndx[this.data.query][this.data.selector]=this.data.qsid}else{ctcAjax.sel_ndx[this.key]=this.data;q=this.key}}break;case"sel_val":ctcAjax.sel_val[this.key]=this.data;s=this.key;break}})},d=function(t,q){var s=q.toString().match(/url\([" ]*(.+?)[" ]*\)/),r=("undefined"==typeof s?null:s[1]),p=ctcAjax.theme_uri+"/"+("parent"==t?ctcAjax.parnt:ctcAjax.child)+"/",u;if(!r){return false}else{if(r.toString().match(/^(https?:|\/)/)){u=q}else{u="url("+p+r+")"}}return u},b=function(q){if("undefined"==typeof q||false===q||null===q||""===q){return true}if(true===q||"string"===typeof q||"number"===typeof q){return false}if("object"===typeof q){for(var p in q){if(q.hasOwnProperty(p)){return false}}return true}return false},i=function(){var p=[];if(1===loading.sel_ndx){return p}if(0===loading.sel_ndx){loading.sel_ndx=1;ctc_query_css("sel_ndx",null,ctc_setup_query_menu);return p}if(false===b(ctcAjax.sel_ndx)){g.each(ctcAjax.sel_ndx,function(q,r){var s={label:q,value:q};p.push(s)})}return p},f=function(q){var p=[];if(1===loading.sel_ndx){return p}if(0===loading.sel_ndx){loading.sel_ndx=1;ctc_query_css("sel_ndx",q,ctc_setup_selector_menu);return p}if(false===b(ctcAjax.sel_ndx[q])){g.each(ctcAjax.sel_ndx[q],function(r,s){var t={label:r,value:s};p.push(t)})}return p},l=function(){var p=[];if(1===loading.rule){return p}if(0===loading.rule){loading.rule=1;ctc_query_css("rule",null,ctc_setup_rule_menu);return p}if(false===b(ctcAjax.rule)){g.each(ctcAjax.rule,function(q,r){var s={label:r,value:q};p.push(s)})}return p.sort(function(r,q){if(r.label>q.label){return 1}if(r.label<q.label){return -1}return 0})},h=function(t,v,y){var r="",w=(b(ctcAjax.sel_val[t])||b(ctcAjax.sel_val[t].value)||b(ctcAjax.sel_val[t].value[v])?"":ctcAjax.sel_val[t].value[v]),q=ctc_decode_value(v,("undefined"==typeof w?"":w.parnt)),u=(false===b(w.i_parnt)&&w.i_parnt)?ctcAjax.important_label:"",s=ctc_decode_value(v,("undefined"==typeof w?"":w.child)),p=(false===b(w.i_child)&&w.i_child)?1:0,x="ctc_"+y+"_child_"+v+"_i_"+t;if(false===b(ctcAjax.sel_val[t])){r+='<div class="ctc-'+("ovrd"==y?"input":"selector")+'-row clearfix">'+n;r+='<div class="ctc-input-cell">'+("ovrd"==y?v:ctcAjax.sel_val[t].selector+(b(q.orig)?"<br/>"+ctcAjax.child_only_txt:""))+"</div>"+n;if("ovrd"==y){r+='<div class="ctc-parent-value ctc-input-cell" id="ctc_'+y+"_parent_"+v+"_"+t+'">'+(b(q.orig)?"[no value]":q.orig+u)+"</div>"+n}r+='<div class="ctc-input-cell">'+n;if(false===b(q.names)){g.each(q.names,function(z,A){A=(b(A)?"":A);r+='<div class="ctc-child-input-cell">'+n;var C="ctc_"+y+"_child_"+v+"_"+t+A,B;if(false===(B=s.values.shift())){B=""}r+=(b(A)?"":ctcAjax.field_labels[A]+":<br/>")+'<input type="text" id="'+C+'" name="'+C+'" class="ctc-child-value'+((A+v).toString().match(/color/)?" color-picker":"")+((A).toString().match(/url/)?" ctc-input-wide":"")+'" value="'+B+'" />'+n;r+="</div>"+n});r+='<label for="'+x+'"><input type="checkbox" id="'+x+'" name="'+x+'" value="1" '+(1===p?"checked":"")+" />"+ctcAjax.important_label+"</label>"+n}r+="</div>"+n;r+=("ovrd"==y?"":'<div class="ctc-swatch ctc-specific" id="ctc_child_'+v+"_"+t+'_swatch">'+ctcAjax.swatch_txt+"</div>"+n+'<div class="ctc-child-input-cell ctc-button-cell" id="ctc_save_'+v+"_"+t+'_cell">'+n+'<input type="button" class="button ctc-save-input" id="ctc_save_'+v+"_"+t+'" name="ctc_save_'+v+"_"+t+'" value="Save" /></div>'+n);r+="</div><!-- end input row -->"+n}return r},e=function(p){if(1===loading.sel_val){return false}if(0==loading.sel_val){loading.sel_val=1;ctc_query_css("sel_val",p,e);return false}var s,q,r;if(false===b(ctcAjax.sel_val[p])){if(false===b(ctcAjax.sel_val[p].seq)){s="ctc_ovrd_child_seq_"+p;r=parseInt(ctcAjax.sel_val[p].seq);q='<input type="text" id="'+s+'" name="'+s+'" class="ctc-child-value" value="'+r+'" />';g("#ctc_child_load_order_container").html(q)}if(false===b(ctcAjax.sel_val[p].value)){q="";g.each(ctcAjax.sel_val[p].value,function(u,t){q+=h(p,u,"ovrd")});g("#ctc_sel_ovrd_rule_inputs").html(q).find(".color-picker").each(function(){o(this)});j("#ctc_child_all_0_swatch")}}};ctc_render_rule_value_inputs=function(q){if(1===loading.rule_val){return false}if(0==loading.rule_val){loading.rule_val=1;ctc_query_css("rule_val",q,ctc_render_rule_value_inputs);return false}var r=ctcAjax.rule[q],p='<div class="ctc-input-row clearfix" id="ctc_rule_row_'+r+'">'+n;if(false===b(ctcAjax.rule_val[q])){g.each(ctcAjax.rule_val[q],function(t,u){var s=ctc_decode_value(r,u);p+='<div class="ctc-parent-row clearfix" id="ctc_rule_row_'+r+"_"+t+'">'+n;p+='<div class="ctc-input-cell ctc-parent-value" id="ctc_'+t+"_parent_"+r+"_"+t+'">'+s.orig+"</div>"+n;p+='<div class="ctc-input-cell">'+n;p+='<div class="ctc-swatch ctc-specific" id="ctc_'+t+"_parent_"+r+"_"+t+'_swatch">'+ctcAjax.swatch_txt+"</div></div>"+n;p+='<div class="ctc-input-cell"><a href="#" class="ctc-selector-handle" id="ctc_selector_'+r+"_"+t+'">'+ctcAjax.selector_txt+"</a></div>"+n;p+='<div id="ctc_selector_'+r+"_"+t+'_container" class="ctc-selector-container clearfix">'+n;p+='<a href="#" id="ctc_selector_'+r+"_"+t+'_close" class="ctc-selector-handle" style="float:right">'+ctcAjax.close_txt+'</a><div id="ctc_status_val_qry_'+t+'"></div>'+n;p+='<div id="ctc_selector_'+r+"_"+t+'_rows"></div>'+n;p+="</div></div>"+n});p+="</div>"+n}g("#ctc_rule_value_inputs").html(p).find(".ctc-swatch").each(function(){j(this)})},ctc_render_selector_value_inputs=function(s){if(1==loading.val_qry){return false}var u,q,t=g("#ctc_rule_menu_selected").text(),p,r="";if(0===loading.val_qry){loading.val_qry=1;u={rule:t};ctc_query_css("val_qry",s,ctc_render_selector_value_inputs,u);return false}if(false===b(ctcAjax.val_qry[s])){g.each(ctcAjax.val_qry[s],function(w,v){page_rule=w;g.each(v,function(y,x){r+='<h4 class="ctc-query-heading">'+y+"</h4>"+n;if(false===b(x)){g.each(x,function(z,A){ctcAjax.sel_val[z]=A;r+=h(z,w,s)})}})})}p="#ctc_selector_"+t+"_"+s+"_rows";g(p).html(r).find(".color-picker").each(function(){o(this)});g(p).find(".ctc-swatch").each(function(){j(this)})},ctc_query_css=function(r,q,u,s){var p={ctc_query_obj:r,ctc_query_key:q},t="#ctc_status_"+r+("val_qry"==r?"_"+q:"");if("object"===typeof s){g.each(s,function(v,w){p["ctc_query_"+v]=w})}g(".ctc-status-icon").remove();g(t).append('<span class="ctc-status-icon spinner"></span>');g(".spinner").show();p.action="ctc_query";p._wpnonce=g("#_wpnonce").val();g.post(ctcAjax.ajaxurl,p,function(v){loading[r]=2;g(".ctc-status-icon").removeClass("spinner");if(b(v)){g(".ctc-status-icon").addClass("failure")}else{g(".ctc-status-icon").addClass("success");c(v);if("function"===typeof u){u(q)}return false}},"json").fail(function(){loading[r]=0;g(".ctc-status-icon").removeClass("spinner");g(".ctc-status-icon").addClass("failure")});return false},ctc_save=function(t){var s={},u,r,p,q,v=g(t).attr("id");if(b(m[v])){m[v]=0}m[v]++;g(t).prop("disabled",true);g(".ctc-status-icon").remove();g(t).parent(".ctc-textarea-button-cell, .ctc-button-cell").append('<span class="ctc-status-icon spinner"></span>');g(".spinner").show();if((u=g("#ctc_new_selectors"))&&"ctc_save_new_selectors"==g(t).attr("id")){s.ctc_new_selectors=u.val();if(r=g("#ctc_sel_ovrd_query_selected")){s.ctc_sel_ovrd_query=r.text()}}else{if((p=g("#ctc_child_imports"))&&"ctc_save_imports"==g(t).attr("id")){s.ctc_child_imports=p.val()}else{s=j(t)}}s.action="ctc_update";s._wpnonce=g("#_wpnonce").val();g.post(ctcAjax.ajaxurl,s,function(w){g(t).prop("disabled",false);g(".ctc-status-icon").removeClass("spinner");if(b(w)){g(".ctc-status-icon").addClass("failure")}else{g(".ctc-status-icon").addClass("success");g("#ctc_new_selectors").val("");c(w);ctc_setup_menus()}return false},"json").fail(function(){g(t).prop("disabled",false);g(".ctc-status-icon").removeClass("spinner");g(".ctc-status-icon").addClass("failure")});return false},ctc_decode_value=function(r,p){p=("undefined"==typeof p?"":p);var q={orig:p};if(r.toString().match(/^border(\-(top|right|bottom|left))?$/)){var s=p.toString().split(/ +/);q.names=["_border_width","_border_style","_border_color"];q.values=[("undefined"==typeof s[0]?"":s[0]),("undefined"==typeof s[1]?"":s[1]),("undefined"==typeof s[2]?"":s[2])]}else{if(r.toString().match(/^background\-image/)){q.names=["_background_url","_background_origin","_background_color1","_background_color2"];q.values=["","","",""];if(false===(b(p))&&!(p.toString().match(/url/))){var s=p.toString().split(/:/);q.values[1]=("undefined"==typeof s[0]?"":s[0]);q.values[2]=("undefined"==typeof s[1]?"":s[1]);q.values[3]=("undefined"==typeof s[3]?"":s[3]);q.orig=[q.values[1],q.values[2],q.values[3]].join(" ")}else{q.values[0]=p}}else{q.names=[""];q.values=[p]}}return q},ctc_set_query=function(p){k=p;g("#ctc_sel_ovrd_query").val("");g("#ctc_sel_ovrd_query_selected").text(p);g("#ctc_sel_ovrd_selector").val("");g("#ctc_sel_ovrd_selector_selected").html("&nbsp;");g("#ctc_sel_ovrd_rule_inputs").html("");ctc_setup_selector_menu(p);j("#ctc_child_all_0_swatch");g("#ctc_new_selector_row").show()},ctc_set_selector=function(q,p){g("#ctc_sel_ovrd_selector").val("");g("#ctc_sel_ovrd_selector_selected").text(p);g("#ctc_sel_ovrd_qsid").val(q);a=q;if(1!=loading.sel_val){loading.sel_val=0}e(q);g("#ctc_sel_ovrd_new_rule, #ctc_sel_ovrd_rule_header,#ctc_sel_ovrd_rule_inputs_container,#ctc_sel_ovrd_rule_inputs").show()},ctc_set_rule=function(q,p){g("#ctc_rule_menu").val("");g("#ctc_rule_menu_selected").text(p);if(1!=loading.rule_val){loading.rule_val=0}ctc_render_rule_value_inputs(q);g("#ctc_rule_value_inputs,#ctc_input_row_rule_header").show()},ctc_setup_query_menu=function(){ctc_queries=i();g("#ctc_sel_ovrd_query").autocomplete({source:ctc_queries,minLength:0,selectFirst:true,autoFocus:true,select:function(q,p){ctc_set_query(p.item.value);return false},focus:function(p){p.preventDefault()}})},ctc_setup_selector_menu=function(p){ctc_selectors=f(p);g("#ctc_sel_ovrd_selector").autocomplete({source:ctc_selectors,selectFirst:true,autoFocus:true,select:function(r,q){ctc_set_selector(q.item.value,q.item.label);return false},focus:function(q){q.preventDefault()}})},ctc_setup_rule_menu=function(){ctc_rules=l();g("#ctc_rule_menu").autocomplete({source:ctc_rules,selectFirst:true,autoFocus:true,select:function(q,p){ctc_set_rule(p.item.value,p.item.label);return false},focus:function(p){p.preventDefault()}})},ctc_filtered_rules=function(s,q){var p=[],r=(b(ctcAjax.sel_val[a]))||(b(ctcAjax.sel_val[a].value));if(b(ctc_rules)){ctc_rules=l()}g.each(ctc_rules,function(t,w){var u=false,v=new RegExp(g.ui.autocomplete.escapeRegex(s.term),"i");if(v.test(w.label)){if(false===r){g.each(ctcAjax.sel_val[a].value,function(y,x){if(w.label==y){u=true;return false}});if(u){return}}p.push(w)}});q(p)},ctc_setup_new_rule_menu=function(){g("#ctc_new_rule_menu").autocomplete({source:ctc_filtered_rules,selectFirst:true,autoFocus:true,select:function(q,p){g("#ctc_sel_ovrd_rule_inputs").append(h(a,p.item.label,"ovrd")).find(".ctc-child-value").each(function(){if(g(this).hasClass("color-picker")){o(g(this))}g(this).focus()});g("#ctc_new_rule_menu").val("");if(b(ctcAjax.sel_val[a].value)){ctcAjax.sel_val[a]["value"]={}}ctcAjax.sel_val[a].value[p.item.label]={child:""};return false},focus:function(p){p.preventDefault()}})},ctc_setup_menus=function(){ctc_setup_query_menu();ctc_setup_selector_menu(k);ctc_setup_rule_menu();ctc_setup_new_rule_menu()},ctc_theme_exists=function(p,q){var r=false;g.each(ctcAjax.themes,function(s,t){g.each(t,function(u,v){if(u==p&&("parnt"==s||"new"==q)){r=true;return false}});if(r){return false}});return r},ctc_set_notice=function(p){var q="";if(false===b(p)){g.each(p,function(r,s){q+='<div class="'+r+'"><ul>'+n;g(s).each(function(t,u){q+="<li>"+u.toString()+"</li>"+n});q+="</ul></div>"})}g("#ctc_error_notice").html(q)},ctc_validate=function(){var s=/[^\w\-]/,q=g("#ctc_child_template").val().toString().replace(s).toLowerCase(),p=g("#ctc_theme_child").val().toString().replace(s).toLowerCase(),r=g("input[name=ctc_child_type]:checked").val(),t=[];if("new"==r){p=q}if(ctc_theme_exists(p,r)){t.push(ctcAjax.theme_exists_txt.toString().replace(/%s/,p))}if(""===p){t.push(ctcAjax.inval_theme_txt)}if(""===g("#ctc_child_name").val()){t.push(ctcAjax.inval_name_txt)}if(t.length){ctc_set_notice({error:t});return false}return true},ctc_set_theme_menu=function(q){var p=g("#ctc_theme_child").val();if(false===b(ctcAjax.themes.child[p])){g("#ctc_child_name").val(ctcAjax.themes.child[p].Name);g("#ctc_child_author").val(ctcAjax.themes.child[p].Author);g("#ctc_child_version").val(ctcAjax.themes.child[p].Version)}},fade_update_notice=function(){g(".updated, .error").slideUp("slow",function(){g(".updated").remove()})},loading={rule:2,sel_ndx:2,val_qry:0,rule_val:0,sel_val:0},ctc_selectors=[],ctc_queries=[],ctc_rules=[];g(".color-picker").each(function(){o(this)});g(".ctc-option-panel-container").on("focus",".color-picker",function(){ctc_set_notice("");g(this).iris("toggle");g(".iris-picker").css({position:"absolute","z-index":10})});g(".ctc-option-panel-container").on("focus","input",function(){ctc_set_notice("");g(".color-picker").not(this).iris("hide")});g(".ctc-option-panel-container").on("change",".ctc-child-value, input[type=checkbox]",function(){j(this)});g(".ctc-option-panel-container").on("click",".ctc-selector-handle",function(q){q.preventDefault();ctc_set_notice("");var r=g(this).attr("id").toString().replace("_close",""),p=r.toString().replace(/\D+/g,"");if(g("#"+r+"_container").is(":hidden")){if(1!=loading.val_qry){loading.val_qry=0}ctc_render_selector_value_inputs(p)}g("#"+r+"_container").fadeToggle("fast");g(".ctc-selector-container").not("#"+r+"_container").fadeOut("fast")});g(".nav-tab").on("click",function(q){q.preventDefault();ctc_set_notice("");var r="#"+g(this).attr("id"),p=r+"_panel";g(".nav-tab").removeClass("nav-tab-active");g(".ctc-option-panel").removeClass("ctc-option-panel-active");g(".ctc-selector-container").hide();g(r).addClass("nav-tab-active");g(".ctc-option-panel-container").scrollTop(0);g(p).addClass("ctc-option-panel-active")});g("#view_child_options,#view_parnt_options").on("click",function(s){ctc_set_notice("");var p=new Date().getTime(),r=g(this).attr("id").toString().match(/(child|parnt)/)[1],q=ctcAjax.theme_uri+"/"+ctcAjax[r]+"/style.css?"+p;g.get(q,function(t){g("#view_"+r+"_options_panel").text(t)}).fail(function(){g("#view_"+r+"_options_panel").text(ctcAjax.css_fail_txt)})});g("#ctc_load_form").on("submit",function(){return(ctc_validate()&&confirm(ctcAjax.load_txt))});g("#parent_child_options_panel").on("change","#ctc_theme_child",ctc_set_theme_menu);g(document).on("click",".ctc-save-input",function(p){ctc_save(this)});ctc_setup_menus();ctc_set_query(k);g("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.1.9
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(g){var n="\n",k="base",a,m={},o=function(p){g(p).iris({change:function(){j(p)}})},j=function(v){var r=/^(ctc_(ovrd|\d+)_(parent|child)_([a-z\-]+)_(\d+))(_\w+)?$/,w=g(v).parents(".ctc-selector-row, .ctc-parent-row").first(),u=w.find(".ctc-swatch").first(),t={parent:{},child:{}},s={parent:{origin:"",start:"",end:""},child:{origin:"",start:"",end:""}},q={child:false,parent:false},p={};w.find(".ctc-parent-value, .ctc-child-value").each(function(){var E=g(this).attr("id"),x=E.toString().match(r),F=x[2],y=x[3],H=("undefined"==typeof x[4]?"":x[4]),D=x[5],C=("undefined"==typeof x[6]?"":x[6]),G=("parent"==y?g(this).text():g(this).val()),z="ctc_"+F+"_child_"+H+"_i_"+D,B,A;if("child"==y){p[E]=G;p[z]=(g("#"+z).is(":checked"))?1:0}if(""===G){g("#"+z).prop("checked",false);return}if(false===b(C)){switch(C){case"_border_width":t[y][H+"-width"]=G;break;case"_border_style":t[y][H+"-style"]=G;break;case"_border_color":t[y][H+"-color"]=G;break;case"_background_url":t[y]["background-image"]=d(y,G);break;case"_background_color":t[y]["background-color"]=v.value;break;case"_background_color1":s[y].start=G;q[y]=true;break;case"_background_color2":s[y].end=G;q[y]=true;break;case"_background_origin":s[y].origin=G;q[y]=true;break}}else{if(B=H.toString().match(/^border(\-(top|right|bottom|left))?$/)&&!G.match(/none/)){A=G.toString().split(/ +/);t[y][H+"-width"]="undefined"==typeof A[0]?"":A[0];t[y][H+"-style"]="undefined"==typeof A[1]?"":A[1];t[y][H+"-color"]="undefined"==typeof A[2]?"":A[2]}else{if("background-image"==H){if(G.toString().match(/url\(/)){t[y]["background-image"]=d(y,G)}else{A=G.toString().split(/ +/);if(A.length>2){s[y].origin="undefined"==typeof A[0]?"top":A[0];s[y].start="undefined"==typeof A[1]?"transparent":A[1];s[y].end="undefined"==typeof A[2]?"transparent":A[2];q[y]=true}else{t[y]["background-image"]=G}}}else{t[y][H]=G}}}});if("undefined"!=typeof u){g(u).removeAttr("style");if(q.parent){g(u).ctcgrad(s.parent.origin,[s.parent.start,s.parent.end])}g(u).css(t.parent);if(!(u.attr("id").toString().match(/parent/))){if(q.child){g(u).ctcgrad(s.child.origin,[s.child.start,s.child.end])}g(u).css(t.child)}}return p},c=function(r){var q,s,p;g(r).each(function(){switch(this.obj){case"imports":ctcAjax.imports=this.data;break;case"rule_val":ctcAjax.rule_val[this.key]=this.data;currRuleId=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(b(this.key)){ctcAjax.sel_ndx=this.data}else{if("qsid"==this.key){if(b(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;q=this.key}}break;case"sel_val":ctcAjax.sel_val[this.key]=this.data;s=this.key;break}})},d=function(t,q){var s=q.toString().match(/url\([" ]*(.+?)[" ]*\)/),r=("undefined"==typeof s?null:s[1]),p=ctcAjax.theme_uri+"/"+("parent"==t?ctcAjax.parnt:ctcAjax.child)+"/",u;if(!r){return false}else{if(r.toString().match(/^(https?:|\/)/)){u=q}else{u="url("+p+r+")"}}return u},b=function(q){if("undefined"==typeof q||false===q||null===q||""===q){return true}if(true===q||"string"===typeof q||"number"===typeof q){return false}if("object"===typeof q){for(var p in q){if(q.hasOwnProperty(p)){return false}}return true}return false},i=function(){var p=[];if(1===loading.sel_ndx){return p}if(0===loading.sel_ndx){loading.sel_ndx=1;ctc_query_css("sel_ndx",null,ctc_setup_query_menu);return p}if(false===b(ctcAjax.sel_ndx)){g.each(ctcAjax.sel_ndx,function(q,r){var s={label:q,value:q};p.push(s)})}return p},f=function(q){var p=[];if(1===loading.sel_ndx){return p}if(0===loading.sel_ndx){loading.sel_ndx=1;ctc_query_css("sel_ndx",q,ctc_setup_selector_menu);return p}if(false===b(ctcAjax.sel_ndx[q])){g.each(ctcAjax.sel_ndx[q],function(r,s){var t={label:r,value:s};p.push(t)})}return p},l=function(){var p=[];if(1===loading.rule){return p}if(0===loading.rule){loading.rule=1;ctc_query_css("rule",null,ctc_setup_rule_menu);return p}if(false===b(ctcAjax.rule)){g.each(ctcAjax.rule,function(q,r){var s={label:r,value:q};p.push(s)})}return p.sort(function(r,q){if(r.label>q.label){return 1}if(r.label<q.label){return -1}return 0})},h=function(t,v,y){var r="",w=(b(ctcAjax.sel_val[t])||b(ctcAjax.sel_val[t].value)||b(ctcAjax.sel_val[t].value[v])?"":ctcAjax.sel_val[t].value[v]),q=ctc_decode_value(v,("undefined"==typeof w?"":w.parnt)),u=(false===b(w.i_parnt)&&w.i_parnt)?ctcAjax.important_label:"",s=ctc_decode_value(v,("undefined"==typeof w?"":w.child)),p=(false===b(w.i_child)&&w.i_child)?1:0,x="ctc_"+y+"_child_"+v+"_i_"+t;if(false===b(ctcAjax.sel_val[t])){r+='<div class="ctc-'+("ovrd"==y?"input":"selector")+'-row clearfix">'+n;r+='<div class="ctc-input-cell">'+("ovrd"==y?v:ctcAjax.sel_val[t].selector+(b(q.orig)?"<br/>"+ctcAjax.child_only_txt:""))+"</div>"+n;if("ovrd"==y){r+='<div class="ctc-parent-value ctc-input-cell" id="ctc_'+y+"_parent_"+v+"_"+t+'">'+(b(q.orig)?"[no value]":q.orig+u)+"</div>"+n}r+='<div class="ctc-input-cell">'+n;if(false===b(q.names)){g.each(q.names,function(z,A){A=(b(A)?"":A);r+='<div class="ctc-child-input-cell">'+n;var C="ctc_"+y+"_child_"+v+"_"+t+A,B;if(false===(B=s.values.shift())){B=""}r+=(b(A)?"":ctcAjax.field_labels[A]+":<br/>")+'<input type="text" id="'+C+'" name="'+C+'" class="ctc-child-value'+((A+v).toString().match(/color/)?" color-picker":"")+((A).toString().match(/url/)?" ctc-input-wide":"")+'" value="'+B+'" />'+n;r+="</div>"+n});r+='<label for="'+x+'"><input type="checkbox" id="'+x+'" name="'+x+'" value="1" '+(1===p?"checked":"")+" />"+ctcAjax.important_label+"</label>"+n}r+="</div>"+n;r+=("ovrd"==y?"":'<div class="ctc-swatch ctc-specific" id="ctc_child_'+v+"_"+t+'_swatch">'+ctcAjax.swatch_txt+"</div>"+n+'<div class="ctc-child-input-cell ctc-button-cell" id="ctc_save_'+v+"_"+t+'_cell">'+n+'<input type="button" class="button ctc-save-input" id="ctc_save_'+v+"_"+t+'" name="ctc_save_'+v+"_"+t+'" value="Save" /></div>'+n);r+="</div><!-- end input row -->"+n}return r},e=function(p){if(1===loading.sel_val){return false}if(0==loading.sel_val){loading.sel_val=1;ctc_query_css("sel_val",p,e);return false}var s,q,r;if(false===b(ctcAjax.sel_val[p])){if(false===b(ctcAjax.sel_val[p].seq)){s="ctc_ovrd_child_seq_"+p;r=parseInt(ctcAjax.sel_val[p].seq);q='<input type="text" id="'+s+'" name="'+s+'" class="ctc-child-value" value="'+r+'" />';g("#ctc_child_load_order_container").html(q)}if(false===b(ctcAjax.sel_val[p].value)){q="";g.each(ctcAjax.sel_val[p].value,function(u,t){q+=h(p,u,"ovrd")});g("#ctc_sel_ovrd_rule_inputs").html(q).find(".color-picker").each(function(){o(this)});j("#ctc_child_all_0_swatch")}}};ctc_render_rule_value_inputs=function(q){if(1===loading.rule_val){return false}if(0==loading.rule_val){loading.rule_val=1;ctc_query_css("rule_val",q,ctc_render_rule_value_inputs);return false}var r=ctcAjax.rule[q],p='<div class="ctc-input-row clearfix" id="ctc_rule_row_'+r+'">'+n;if(false===b(ctcAjax.rule_val[q])){g.each(ctcAjax.rule_val[q],function(t,u){var s=ctc_decode_value(r,u);p+='<div class="ctc-parent-row clearfix" id="ctc_rule_row_'+r+"_"+t+'">'+n;p+='<div class="ctc-input-cell ctc-parent-value" id="ctc_'+t+"_parent_"+r+"_"+t+'">'+s.orig+"</div>"+n;p+='<div class="ctc-input-cell">'+n;p+='<div class="ctc-swatch ctc-specific" id="ctc_'+t+"_parent_"+r+"_"+t+'_swatch">'+ctcAjax.swatch_txt+"</div></div>"+n;p+='<div class="ctc-input-cell"><a href="#" class="ctc-selector-handle" id="ctc_selector_'+r+"_"+t+'">'+ctcAjax.selector_txt+"</a></div>"+n;p+='<div id="ctc_selector_'+r+"_"+t+'_container" class="ctc-selector-container clearfix">'+n;p+='<a href="#" id="ctc_selector_'+r+"_"+t+'_close" class="ctc-selector-handle" style="float:right">'+ctcAjax.close_txt+'</a><div id="ctc_status_val_qry_'+t+'"></div>'+n;p+='<div id="ctc_selector_'+r+"_"+t+'_rows"></div>'+n;p+="</div></div>"+n});p+="</div>"+n}g("#ctc_rule_value_inputs").html(p).find(".ctc-swatch").each(function(){j(this)})},ctc_render_selector_value_inputs=function(s){if(1==loading.val_qry){return false}var u,q,t=g("#ctc_rule_menu_selected").text(),p,r="";if(0===loading.val_qry){loading.val_qry=1;u={rule:t};ctc_query_css("val_qry",s,ctc_render_selector_value_inputs,u);return false}if(false===b(ctcAjax.val_qry[s])){g.each(ctcAjax.val_qry[s],function(w,v){page_rule=w;g.each(v,function(y,x){r+='<h4 class="ctc-query-heading">'+y+"</h4>"+n;if(false===b(x)){g.each(x,function(z,A){ctcAjax.sel_val[z]=A;r+=h(z,w,s)})}})})}p="#ctc_selector_"+t+"_"+s+"_rows";g(p).html(r).find(".color-picker").each(function(){o(this)});g(p).find(".ctc-swatch").each(function(){j(this)})},ctc_query_css=function(r,q,u,s){var p={ctc_query_obj:r,ctc_query_key:q},t="#ctc_status_"+r+("val_qry"==r?"_"+q:"");if("object"===typeof s){g.each(s,function(v,w){p["ctc_query_"+v]=w})}g(".ctc-status-icon").remove();g(t).append('<span class="ctc-status-icon spinner"></span>');g(".spinner").show();p.action="ctc_query";p._wpnonce=g("#_wpnonce").val();g.post(ctcAjax.ajaxurl,p,function(v){loading[r]=2;g(".ctc-status-icon").removeClass("spinner");if(b(v)){g(".ctc-status-icon").addClass("failure")}else{g(".ctc-status-icon").addClass("success");c(v);if("function"===typeof u){u(q)}return false}},"json").fail(function(){loading[r]=0;g(".ctc-status-icon").removeClass("spinner");g(".ctc-status-icon").addClass("failure")});return false},ctc_save=function(t){var s={},u,r,p,q,v=g(t).attr("id");if(b(m[v])){m[v]=0}m[v]++;g(t).prop("disabled",true);g(".ctc-status-icon").remove();g(t).parent(".ctc-textarea-button-cell, .ctc-button-cell").append('<span class="ctc-status-icon spinner"></span>');g(".spinner").show();if((u=g("#ctc_new_selectors"))&&"ctc_save_new_selectors"==g(t).attr("id")){s.ctc_new_selectors=u.val();if(r=g("#ctc_sel_ovrd_query_selected")){s.ctc_sel_ovrd_query=r.text()}}else{if((p=g("#ctc_child_imports"))&&"ctc_save_imports"==g(t).attr("id")){s.ctc_child_imports=p.val()}else{s=j(t)}}s.action="ctc_update";s._wpnonce=g("#_wpnonce").val();g.post(ctcAjax.ajaxurl,s,function(w){g(t).prop("disabled",false);g(".ctc-status-icon").removeClass("spinner");if(b(w)){g(".ctc-status-icon").addClass("failure")}else{g(".ctc-status-icon").addClass("success");g("#ctc_new_selectors").val("");c(w);ctc_setup_menus()}return false},"json").fail(function(){g(t).prop("disabled",false);g(".ctc-status-icon").removeClass("spinner");g(".ctc-status-icon").addClass("failure")});return false},ctc_decode_value=function(r,p){p=("undefined"==typeof p?"":p);var q={orig:p};if(r.toString().match(/^border(\-(top|right|bottom|left))?$/)){var s=p.toString().split(/ +/);q.names=["_border_width","_border_style","_border_color"];q.values=[("undefined"==typeof s[0]?"":s[0]),("undefined"==typeof s[1]?"":s[1]),("undefined"==typeof s[2]?"":s[2])]}else{if(r.toString().match(/^background\-image/)){q.names=["_background_url","_background_origin","_background_color1","_background_color2"];q.values=["","","",""];if(false===(b(p))&&!(p.toString().match(/url/))){var s=p.toString().split(/:/);q.values[1]=("undefined"==typeof s[0]?"":s[0]);q.values[2]=("undefined"==typeof s[1]?"":s[1]);q.values[3]=("undefined"==typeof s[3]?"":s[3]);q.orig=[q.values[1],q.values[2],q.values[3]].join(" ")}else{q.values[0]=p}}else{q.names=[""];q.values=[p]}}return q},ctc_set_query=function(p){k=p;g("#ctc_sel_ovrd_query").val("");g("#ctc_sel_ovrd_query_selected").text(p);g("#ctc_sel_ovrd_selector").val("");g("#ctc_sel_ovrd_selector_selected").html("&nbsp;");g("#ctc_sel_ovrd_rule_inputs").html("");ctc_setup_selector_menu(p);j("#ctc_child_all_0_swatch");g("#ctc_new_selector_row").show()},ctc_set_selector=function(q,p){g("#ctc_sel_ovrd_selector").val("");g("#ctc_sel_ovrd_selector_selected").text(p);g("#ctc_sel_ovrd_qsid").val(q);a=q;if(1!=loading.sel_val){loading.sel_val=0}e(q);g("#ctc_sel_ovrd_new_rule, #ctc_sel_ovrd_rule_header,#ctc_sel_ovrd_rule_inputs_container,#ctc_sel_ovrd_rule_inputs").show()},ctc_set_rule=function(q,p){g("#ctc_rule_menu").val("");g("#ctc_rule_menu_selected").text(p);if(1!=loading.rule_val){loading.rule_val=0}ctc_render_rule_value_inputs(q);g("#ctc_rule_value_inputs,#ctc_input_row_rule_header").show()},ctc_setup_query_menu=function(){ctc_queries=i();g("#ctc_sel_ovrd_query").autocomplete({source:ctc_queries,minLength:0,selectFirst:true,autoFocus:true,select:function(q,p){ctc_set_query(p.item.value);return false},focus:function(p){p.preventDefault()}})},ctc_setup_selector_menu=function(p){ctc_selectors=f(p);g("#ctc_sel_ovrd_selector").autocomplete({source:ctc_selectors,selectFirst:true,autoFocus:true,select:function(r,q){ctc_set_selector(q.item.value,q.item.label);return false},focus:function(q){q.preventDefault()}})},ctc_setup_rule_menu=function(){ctc_rules=l();g("#ctc_rule_menu").autocomplete({source:ctc_rules,selectFirst:true,autoFocus:true,select:function(q,p){ctc_set_rule(p.item.value,p.item.label);return false},focus:function(p){p.preventDefault()}})},ctc_filtered_rules=function(s,q){var p=[],r=(b(ctcAjax.sel_val[a]))||(b(ctcAjax.sel_val[a].value));if(b(ctc_rules)){ctc_rules=l()}g.each(ctc_rules,function(t,w){var u=false,v=new RegExp(g.ui.autocomplete.escapeRegex(s.term),"i");if(v.test(w.label)){if(false===r){g.each(ctcAjax.sel_val[a].value,function(y,x){if(w.label==y){u=true;return false}});if(u){return}}p.push(w)}});q(p)},ctc_setup_new_rule_menu=function(){g("#ctc_new_rule_menu").autocomplete({source:ctc_filtered_rules,selectFirst:true,autoFocus:true,select:function(q,p){g("#ctc_sel_ovrd_rule_inputs").append(h(a,p.item.label,"ovrd")).find(".ctc-child-value").each(function(){if(g(this).hasClass("color-picker")){o(g(this))}g(this).focus()});g("#ctc_new_rule_menu").val("");if(b(ctcAjax.sel_val[a].value)){ctcAjax.sel_val[a]["value"]={}}ctcAjax.sel_val[a].value[p.item.label]={child:""};return false},focus:function(p){p.preventDefault()}})},ctc_setup_menus=function(){ctc_setup_query_menu();ctc_setup_selector_menu(k);ctc_setup_rule_menu();ctc_setup_new_rule_menu()},ctc_theme_exists=function(p,q){var r=false;g.each(ctcAjax.themes,function(s,t){g.each(t,function(u,v){if(u==p&&("parnt"==s||"new"==q)){r=true;return false}});if(r){return false}});return r},ctc_set_notice=function(p){var q="";if(false===b(p)){g.each(p,function(r,s){q+='<div class="'+r+'"><ul>'+n;g(s).each(function(t,u){q+="<li>"+u.toString()+"</li>"+n});q+="</ul></div>"})}g("#ctc_error_notice").html(q)},ctc_validate=function(){var s=/[^\w\-]/,q=g("#ctc_child_template").val().toString().replace(s).toLowerCase(),p=g("#ctc_theme_child").val().toString().replace(s).toLowerCase(),r=g("input[name=ctc_child_type]:checked").val(),t=[];if("new"==r){p=q}if(ctc_theme_exists(p,r)){t.push(ctcAjax.theme_exists_txt.toString().replace(/%s/,p))}if(""===p){t.push(ctcAjax.inval_theme_txt)}if(""===g("#ctc_child_name").val()){t.push(ctcAjax.inval_name_txt)}if(t.length){ctc_set_notice({error:t});return false}return true},ctc_set_theme_menu=function(q){var p=g("#ctc_theme_child").val();if(false===b(ctcAjax.themes.child[p])){g("#ctc_child_name").val(ctcAjax.themes.child[p].Name);g("#ctc_child_author").val(ctcAjax.themes.child[p].Author);g("#ctc_child_version").val(ctcAjax.themes.child[p].Version)}},fade_update_notice=function(){g(".updated, .error").slideUp("slow",function(){g(".updated").remove()})},loading={rule:2,sel_ndx:2,val_qry:0,rule_val:0,sel_val:0},ctc_selectors=[],ctc_queries=[],ctc_rules=[];g(".color-picker").each(function(){o(this)});g(".ctc-option-panel-container").on("focus",".color-picker",function(){ctc_set_notice("");g(this).iris("toggle");g(".iris-picker").css({position:"absolute","z-index":10})});g(".ctc-option-panel-container").on("focus","input",function(){ctc_set_notice("");g(".color-picker").not(this).iris("hide")});g(".ctc-option-panel-container").on("change",".ctc-child-value, input[type=checkbox]",function(){j(this)});g(".ctc-option-panel-container").on("click",".ctc-selector-handle",function(q){q.preventDefault();ctc_set_notice("");var r=g(this).attr("id").toString().replace("_close",""),p=r.toString().replace(/\D+/g,"");if(g("#"+r+"_container").is(":hidden")){if(1!=loading.val_qry){loading.val_qry=0}ctc_render_selector_value_inputs(p)}g("#"+r+"_container").fadeToggle("fast");g(".ctc-selector-container").not("#"+r+"_container").fadeOut("fast")});g(".nav-tab").on("click",function(q){q.preventDefault();ctc_set_notice("");var r="#"+g(this).attr("id"),p=r+"_panel";g(".nav-tab").removeClass("nav-tab-active");g(".ctc-option-panel").removeClass("ctc-option-panel-active");g(".ctc-selector-container").hide();g(r).addClass("nav-tab-active");g(".ctc-option-panel-container").scrollTop(0);g(p).addClass("ctc-option-panel-active")});g("#view_child_options,#view_parnt_options").on("click",function(s){ctc_set_notice("");var p=new Date().getTime(),r=g(this).attr("id").toString().match(/(child|parnt)/)[1],q=ctcAjax.theme_uri+"/"+ctcAjax[r]+"/style.css?"+p;g.get(q,function(t){g("#view_"+r+"_options_panel").text(t)}).fail(function(){g("#view_"+r+"_options_panel").text(ctcAjax.css_fail_txt)})});g("#ctc_load_form").on("submit",function(){return(ctc_validate()&&confirm(ctcAjax.load_txt))});g("#parent_child_options_panel").on("change","#ctc_theme_child",ctc_set_theme_menu);g(document).on("click",".ctc-save-input",function(p){ctc_save(this)});ctc_setup_menus();ctc_set_query(k);g("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.8
7
- Stable tag: 1.1.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -45,6 +45,10 @@ Why create Child Themes using the Child Theme Configurator?
45
 
46
  http://www.youtube.com/watch?v=xL2HkWQxgOA
47
 
 
 
 
 
48
  = Where is it in the Admin? =
49
 
50
  The Child Theme Configurator can be found under the "Tools" menu in the WordPress Admin. Click "Child Themes" to get started.
@@ -67,7 +71,7 @@ A child theme is not a "copy" of the parent theme. It is a special feature of Wo
67
 
68
  = Where are the .php files? =
69
 
70
- You can add your own functions.php file, and any other files and directories you need for your Child Theme. The Child Theme Configurator helps you identify and override selectors in the Parent stylesheet without touching the other files.
71
 
72
  = How do I change a specific color/font style/background? =
73
 
@@ -87,7 +91,7 @@ Delete the value from the input for the rule you wish to remove. The Child Theme
87
 
88
  = How do I set the !important flag? =
89
 
90
- We always recommend relying on good cascading design over global overrides. To that end, version 1.1.8 gives the ability to change the load order of child theme styles by entering a value in the "Order" field. And yes, you can now set rules as important by checking the "!" box next to each input. Please use judiciously.
91
 
92
  = How do I create cross-browser gradients? =
93
 
@@ -117,6 +121,9 @@ You can also create a secondary stylesheet that contains @font-face rules and im
117
 
118
  == Changelog ==
119
 
 
 
 
120
  = 1.1.8 =
121
  * Added reorder sequence and important flag functionality. Fixed bug where multiple inputs with same selector/rule combo were assigned the same id. Fixed bug in the shorthand encoding routine.
122
 
@@ -167,6 +174,9 @@ You can also create a secondary stylesheet that contains @font-face rules and im
167
 
168
  == Upgrade Notice ==
169
 
 
 
 
170
  = 1.1.5 =
171
  * Several bugs fixed/improvements made, see change log for details.
172
 
4
  Tags: child theme, custom theme, CSS, responsive design, CSS editor, theme generator
5
  Requires at least: 3.7
6
  Tested up to: 3.8
7
+ Stable tag: 1.1.9
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
45
 
46
  http://www.youtube.com/watch?v=xL2HkWQxgOA
47
 
48
+ = Why doesn't this work with my (insert theme vendor here) theme? =
49
+
50
+ Some themes (particularly commercial themes) do not adhere to the Theme Development guidelines set forth by WordPress.org, and do not automatically load child theme stylesheets or php files. This is unfortunate, because it effectively prohibits the webmaster from adding any customizations (other than those made through the admin theme options) that will survive past an upgrade. Contact the vendor directly to ask for this core functionality. It is our opinion that ALL themes (especially commercial ones) must pass the Theme Unit Tests outlined by WordPress.org.
51
+
52
  = Where is it in the Admin? =
53
 
54
  The Child Theme Configurator can be found under the "Tools" menu in the WordPress Admin. Click "Child Themes" to get started.
71
 
72
  = Where are the .php files? =
73
 
74
+ The configurator automatically adds a blank functions.php file to the child theme directory. You can add any additional files and directories you need for your Child Theme. The Child Theme Configurator helps you identify and override selectors in the Parent stylesheet without touching the other files.
75
 
76
  = How do I change a specific color/font style/background? =
77
 
91
 
92
  = How do I set the !important flag? =
93
 
94
+ We always recommend relying on good cascading design over global overrides. Start by verifying the style is not being controlled by a higher priority selector in the parent stylesheet and if so, creating a variation of that selector for the specific case. If all else fails, you can set rules as "important" by checking the "!" box next to the input. Because this will force the style to take priority, please use this option judiciously.
95
 
96
  = How do I create cross-browser gradients? =
97
 
121
 
122
  == Changelog ==
123
 
124
+ = 1.1.9 =
125
+ * Added check for writability before attempting to create child theme files to avoid fatal error on servers not running suEXEC. Fixed a bug in the ctc_update_cache function that was throwing a fatal JS error when new media queries were saved via the Raw CSS input. Configurator now adds functions.php file to child theme when it does not exist.
126
+
127
  = 1.1.8 =
128
  * Added reorder sequence and important flag functionality. Fixed bug where multiple inputs with same selector/rule combo were assigned the same id. Fixed bug in the shorthand encoding routine.
129
 
174
 
175
  == Upgrade Notice ==
176
 
177
+ = 1.1.9 =
178
+ * Several bugs fixed/improvements made, see change log for details.
179
+
180
  = 1.1.5 =
181
  * Several bugs fixed/improvements made, see change log for details.
182