Child Theme Configurator - Version 1.4.6

Version Description

  • Feature: export child theme as zip archive
  • Added transform to list of vendor rules
  • Bug fixed: parser not loading multiple instances of same @media rulesets
  • Refactored uploader to use wp core functions for compatibility and security
  • Increased CHLD_THM_CFG_MAX_RECURSE_LOOPS to 1000 to accommodate complex parent frameworks
Download this release

Release Info

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

Code changes from version 1.4.5.2 to 1.4.6

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.5.2
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
@@ -16,9 +16,9 @@ if ( !defined('ABSPATH')) exit;
16
  */
17
 
18
  defined('LF') or define('LF', "\n");
19
- define('CHLD_THM_CFG_VERSION', '1.4.5.2');
20
- define('CHLD_THM_CFG_MAX_SELECTORS', '5000');
21
- define('CHLD_THM_CFG_MAX_RECURSE_LOOPS', '100');
22
 
23
  if (is_admin()):
24
  include_once( 'includes/class-ctc.php' );
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.6
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.6');
20
+ define('CHLD_THM_CFG_MAX_SELECTORS', '50000');
21
+ define('CHLD_THM_CFG_MAX_RECURSE_LOOPS', '1000');
22
 
23
  if (is_admin()):
24
  include_once( 'includes/class-ctc.php' );
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.5.2
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
@@ -41,10 +41,11 @@ class Child_Theme_Configurator_CSS {
41
  var $child_name; // child theme name
42
  var $child_author; // stylesheet author
43
  var $child_version; // stylesheet version
 
44
 
45
  function __construct($parent = '') {
46
  // scalars
47
- $this->version = '1.4.5.2';
48
  $this->querykey = 0;
49
  $this->selkey = 0;
50
  $this->qskey = 0;
@@ -56,6 +57,14 @@ class Child_Theme_Configurator_CSS {
56
  $this->child_name = '';
57
  $this->child_author = 'Child Theme Configurator by Lilaea Media';
58
  $this->child_version = '1.0';
 
 
 
 
 
 
 
 
59
  // multi-dim arrays
60
  $this->dict_qs = array();
61
  $this->dict_sel = array();
@@ -250,7 +259,7 @@ class Child_Theme_Configurator_CSS {
250
  $loops = 0;
251
  if ('img' == $ext):
252
  global $chld_thm_cfg;
253
- $ext = '(' . implode('|', $chld_thm_cfg->image_formats) . ')';
254
  endif;
255
  while(count($dirs) && $loops < CHLD_THM_CFG_MAX_RECURSE_LOOPS):
256
  $loops++;
@@ -261,7 +270,7 @@ class Child_Theme_Configurator_CSS {
261
  $filepath = $dir . '/' . $file;
262
  if (is_dir($filepath)):
263
  array_unshift($dirs, $filepath);
264
- elseif (is_file($filepath) && preg_match("/\.".$ext."$/", $filepath)):
265
  $files[] = $filepath;
266
  endif;
267
  endwhile;
@@ -451,10 +460,10 @@ class Child_Theme_Configurator_CSS {
451
  endif;
452
  endif;
453
  // break into @ segments
454
- $regex = '#(\@media[^\{]+?)\{([^\@]*)\}#s'; // *?\})\s
455
  preg_match_all($regex, $this->styles, $matches);
456
  foreach ($matches[1] as $segment):
457
- $ruleset[trim($segment)] = array_shift($matches[2]);
458
  endforeach;
459
  // stripping rulesets leaves base styles
460
  $ruleset[$basequery] = preg_replace($regex, '', $this->styles);
@@ -506,7 +515,7 @@ class Child_Theme_Configurator_CSS {
506
  $value = $this->encode_gradient($value);
507
  endif;
508
  // normalize common vendor prefixes
509
- $rule = preg_replace('#(\-(o|ms|moz|webkit)\-)?(box\-sizing|font\-smoothing|border\-radius|box\-shadow|transition)#', "$3", $rule);
510
  $this->update_arrays($template, $query, $sel, $rule, $value, $important);
511
  endforeach;
512
  endforeach;
@@ -596,7 +605,7 @@ class Child_Theme_Configurator_CSS {
596
  if (preg_match("/^(margin|padding)\-(top|right|bottom|left)$/", $rule, $matches)):
597
  $shorthand[$matches[1]][$matches[2]] = $value . $importantstr;
598
  return '';
599
- elseif (preg_match("/^(box\-sizing|font\-smoothing|border\-radius|box\-shadow|transition)$/", $rule)):
600
  foreach(array('moz', 'webkit', 'o') as $prefix):
601
  $rules .= ' -' . $prefix . '-' . $rule . ': ' . $value . $importantstr . ';' . LF;
602
  endforeach;
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.6
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
41
  var $child_name; // child theme name
42
  var $child_author; // stylesheet author
43
  var $child_version; // stylesheet version
44
+ var $vendorrule;
45
 
46
  function __construct($parent = '') {
47
  // scalars
48
+ $this->version = '1.4.6';
49
  $this->querykey = 0;
50
  $this->selkey = 0;
51
  $this->qskey = 0;
57
  $this->child_name = '';
58
  $this->child_author = 'Child Theme Configurator by Lilaea Media';
59
  $this->child_version = '1.0';
60
+ $this->vendorrule = array(
61
+ "box-sizing",
62
+ "font-smoothing",
63
+ "border-radius",
64
+ "box-shadow",
65
+ "transition",
66
+ "transform"
67
+ );
68
  // multi-dim arrays
69
  $this->dict_qs = array();
70
  $this->dict_sel = array();
259
  $loops = 0;
260
  if ('img' == $ext):
261
  global $chld_thm_cfg;
262
+ $ext = '(' . implode('|', array_keys($chld_thm_cfg->imgmimes)) . ')';
263
  endif;
264
  while(count($dirs) && $loops < CHLD_THM_CFG_MAX_RECURSE_LOOPS):
265
  $loops++;
270
  $filepath = $dir . '/' . $file;
271
  if (is_dir($filepath)):
272
  array_unshift($dirs, $filepath);
273
+ elseif (is_file($filepath) && preg_match("/\.".$ext."$/i", $filepath)):
274
  $files[] = $filepath;
275
  endif;
276
  endwhile;
460
  endif;
461
  endif;
462
  // break into @ segments
463
+ $regex = '#(\@media[^\{]+?)\{(((?!\@media).)*?\})\s*?\}#s';
464
  preg_match_all($regex, $this->styles, $matches);
465
  foreach ($matches[1] as $segment):
466
+ $ruleset[trim($segment)] = array_shift($matches[2]) . (isset($ruleset[trim($segment)])?$ruleset[trim($segment)]:'');
467
  endforeach;
468
  // stripping rulesets leaves base styles
469
  $ruleset[$basequery] = preg_replace($regex, '', $this->styles);
515
  $value = $this->encode_gradient($value);
516
  endif;
517
  // normalize common vendor prefixes
518
+ $rule = preg_replace('#(\-(o|ms|moz|webkit)\-)?(' . implode('|', $this->vendorrule) . ')#', "$3", $rule);
519
  $this->update_arrays($template, $query, $sel, $rule, $value, $important);
520
  endforeach;
521
  endforeach;
605
  if (preg_match("/^(margin|padding)\-(top|right|bottom|left)$/", $rule, $matches)):
606
  $shorthand[$matches[1]][$matches[2]] = $value . $importantstr;
607
  return '';
608
+ elseif (preg_match('/^(' . implode('|', $this->vendorrule) . ')$/', $rule)):
609
  foreach(array('moz', 'webkit', 'o') as $prefix):
610
  $rules .= ' -' . $prefix . '-' . $rule . ': ' . $value . $importantstr . ';' . LF;
611
  endforeach;
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.5.2
9
  Author: Lilaea Media
10
  Author URI: http://www.lilaeamedia.com/
11
  Text Domain: chld_thm_cfg
@@ -384,6 +384,20 @@ class Child_Theme_Configurator_UI {
384
  </div>
385
  </form>
386
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
387
  </div>
388
  <?php endif; ?>
389
  <?php do_action('chld_thm_cfg_panels', $chld_thm_cfg, $active_tab, $hidechild); ?>
@@ -528,12 +542,12 @@ class Child_Theme_Configurator_UI {
528
 
529
  function get_theme_screenshot() {
530
  global $chld_thm_cfg;
531
- foreach ($chld_thm_cfg->image_formats as $ext):
532
  if ($screenshot = $chld_thm_cfg->css->is_file_ok($chld_thm_cfg->css->get_child_target('screenshot.' . $ext))):
533
  $screenshot = preg_replace('%^' . preg_quote(get_theme_root()) . '%', get_theme_root_uri(), $screenshot);
534
  return $screenshot . '?' . time();
535
  endif;
536
- endforeach;
537
  return false;
538
  }
539
 
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.6
9
  Author: Lilaea Media
10
  Author URI: http://www.lilaeamedia.com/
11
  Text Domain: chld_thm_cfg
384
  </div>
385
  </form>
386
  </div>
387
+ <div class="ctc-input-row clearfix" id="input_row_screenshot">
388
+ <form id="ctc_export_form" method="post" action="?page=<?php echo $chld_thm_cfg->menuName; ?>&amp;tab=file_options">
389
+ <?php wp_nonce_field( 'ctc_update' ); ?>
390
+ <div class="ctc-input-cell"> <strong>
391
+ <?php _e('Export Child Theme as Zip Archive', 'chld_thm_cfg'); ?>
392
+ </strong>
393
+ </div>
394
+ <div class="ctc-input-cell-wide">
395
+ <input class="ctc_submit button button-primary" id="ctc_export_child_zip"
396
+ name="ctc_export_child_zip" type="submit"
397
+ value="<?php _e('Export', 'chld_thm_cfg'); ?>" />
398
+ </div>
399
+ </form>
400
+ </div>
401
  </div>
402
  <?php endif; ?>
403
  <?php do_action('chld_thm_cfg_panels', $chld_thm_cfg, $active_tab, $hidechild); ?>
542
 
543
  function get_theme_screenshot() {
544
  global $chld_thm_cfg;
545
+ foreach (array_keys($chld_thm_cfg->imgmimes) as $extreg): foreach (explode('|', $extreg) as $ext):
546
  if ($screenshot = $chld_thm_cfg->css->is_file_ok($chld_thm_cfg->css->get_child_target('screenshot.' . $ext))):
547
  $screenshot = preg_replace('%^' . preg_quote(get_theme_root()) . '%', get_theme_root_uri(), $screenshot);
548
  return $screenshot . '?' . time();
549
  endif;
550
+ endforeach; endforeach;
551
  return false;
552
  }
553
 
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.5.2
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
@@ -31,9 +31,10 @@ class Child_Theme_Configurator {
31
  var $hook;
32
  var $is_ajax;
33
  var $updated;
34
- var $image_formats;
35
  var $updates = array();
36
  var $cache_updates;
 
 
37
 
38
  function __construct($file) {
39
  $this->dir = dirname( $file );
@@ -46,7 +47,11 @@ class Child_Theme_Configurator {
46
  $this->shortName = __('Child Themes', 'chld_thm_cfg');
47
  $this->pluginPath = $this->dir . '/';
48
  $this->pluginURL = plugin_dir_url($file);
49
- $this->image_formats = array('jpg','jpeg','gif','png','JPG','JPEG','GIF','PNG');
 
 
 
 
50
  $this->cache_updates = true;
51
  // setup plugin hooks
52
  add_action('admin_menu', array(&$this, 'admin_menu'));
@@ -207,9 +212,10 @@ class Child_Theme_Configurator {
207
  && !isset($_POST['ctc_child_templates_submit'])
208
  && !isset($_POST['ctc_image_submit'])
209
  && !isset($_POST['ctc_theme_image_submit'])
210
- && !isset($_POST['ctc_theme_screenshot_submit'])) return false;
 
211
  $this->errors = array();
212
- if (current_user_can('install_themes')): // && $this->validate_post()):
213
  if (isset($_POST['ctc_load_styles'])):
214
  foreach (array(
215
  'ctc_theme_parnt',
@@ -258,7 +264,7 @@ class Child_Theme_Configurator {
258
  $this->css->set_prop('child', $child);
259
  $this->css->set_prop('child_name', $name);
260
  $this->css->set_prop('child_author', $author);
261
- $this->css->set_prop('child_version', $version);
262
  $this->css->set_prop('configtype', $configtype);
263
  do_action('chld_thm_cfg_addl_files', $this); // hook for add'l plugin files and subdirectories
264
  $this->css->parse_css_file('parnt');
@@ -293,25 +299,28 @@ class Child_Theme_Configurator {
293
  endforeach;
294
  $msg = '8&tab=file_options';
295
  elseif (isset($_POST['ctc_theme_image_submit']) && isset($_FILES['ctc_theme_image'])):
296
- $this->handle_file_upload('ctc_theme_image', 'images');
297
  $msg = '8&tab=file_options';
298
  elseif (isset($_POST['ctc_theme_screenshot_submit']) && isset($_FILES['ctc_theme_screenshot'])):
299
  // remove old screenshot
300
- foreach($this->image_formats as $ext):
301
  $this->delete_child_file('screenshot', $ext);
302
- endforeach;
303
- $this->handle_file_upload('ctc_theme_screenshot');
304
  $msg = '8&tab=file_options';
 
 
 
305
  else:
306
  $msg = '8&tab=file_options';
307
  endif;
308
- if (empty($this->errors)):
309
- $this->update_redirect($msg);
310
- endif;
311
  else:
312
  $this->errors[] = __('You do not have permission to configure child themes.', 'chld_thm_cfg');
313
  endif;
314
-
 
 
 
315
  //$this->errors[] = sprintf(__('Child Theme %s was unchanged.', 'chld_thm_cfg'), $name, $this->optionsName);
316
  }
317
 
@@ -373,9 +382,9 @@ class Child_Theme_Configurator {
373
  function copy_parent_file($file, $ext = 'php') {
374
  $parent_file = NULL;
375
  if ('screenshot' == $file):
376
- foreach ($this->image_formats as $ext):
377
  if ($parent_file = $this->css->is_file_ok($this->css->get_parent_source('screenshot.' . $ext))) break;
378
- endforeach;
379
  else:
380
  $parent_file = $this->css->is_file_ok($this->css->get_parent_source($file . '.' . $ext));
381
  endif;
@@ -417,66 +426,67 @@ class Child_Theme_Configurator {
417
  }
418
 
419
 
420
- function handle_file_upload($field, $childdir = NULL){
421
- /* adapted from http://www.php.net/manual/en/features.file-upload.php#114004 */
422
- try {
423
- // Undefined | Multiple Files | $_FILES Corruption Attack
424
- // If this request falls under any of them, treat it invalid.
425
- if ( !isset($_FILES[$field]['error']) || is_array($_FILES[$field]['error']) ):
426
- throw new RuntimeException(__('Invalid parameters.', 'chld_thm_cfg'));
427
- endif;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
428
 
429
- // Check $_FILES['upfile']['error'] value.
430
- switch ($_FILES[$field]['error']):
431
- case UPLOAD_ERR_OK:
432
- break;
433
- case UPLOAD_ERR_NO_FILE:
434
- throw new RuntimeException(__('Please select a file to upload.', 'chld_thm_cfg'));
435
- case UPLOAD_ERR_INI_SIZE:
436
- case UPLOAD_ERR_FORM_SIZE:
437
- throw new RuntimeException(__('File is too large.', 'chld_thm_cfg'));
438
- default:
439
- throw new RuntimeException(__('There was a problem uploading the file.', 'chld_thm_cfg'));
440
- endswitch;
441
 
442
- if ($_FILES[$field]['size'] > 1024 * 1024):
443
- throw new RuntimeException(__('Theme images cannot be over 1MB.', 'chld_thm_cfg'));
444
- endif;
445
-
446
- if (false === ($ext = array_search(
447
- exif_imagetype($_FILES[$field]['tmp_name']),
448
- array(
449
- 'jpg' => IMAGETYPE_JPEG,
450
- 'png' => IMAGETYPE_PNG,
451
- 'gif' => IMAGETYPE_GIF,
452
- ),
453
- true
454
- ))):
455
- throw new RuntimeException(__('Theme images must be JPG, PNG or GIF.', 'chld_thm_cfg'));
456
- endif;
457
- // strip extension
458
- $filename = preg_replace('%\.[^\.]+$%', '', $_FILES[$field]['name']);
459
- // strip non alphas and replace with dash
460
- $filename = preg_replace('%[^\w]+%', '-', $filename);
461
- // Ensure target is in child theme
462
- $target = $this->css->get_child_target(isset($childdir) ? $childdir . '/' . $filename . '.' . $ext : 'screenshot.' . $ext);
463
- $targetdir = dirname($target);
464
- if (! is_dir($targetdir)):
465
- if (! @mkdir($targetdir, 0755, true)):
466
- throw new RuntimeException(__('Unable to create directory.', 'chld_thm_cfg'));
467
- endif;
468
- elseif (! is_writable($targetdir)):
469
- throw new RuntimeException(__('Child theme directory is not writable.', 'chld_thm_cfg'));
470
- endif;
471
- if (!$target || !move_uploaded_file(
472
- $_FILES[$field]['tmp_name'],
473
- $target
474
- )):
475
- throw new RuntimeException(__('There was a problem uploading the file.', 'chld_thm_cfg'));
476
- endif;
477
-
478
- } catch (RuntimeException $e) {
479
- $this->errors[] = $e->getMessage();
480
- }
481
  }
482
  }
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.6
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
31
  var $hook;
32
  var $is_ajax;
33
  var $updated;
 
34
  var $updates = array();
35
  var $cache_updates;
36
+ var $uploadsubdir;
37
+ var $imgmimes = array();
38
 
39
  function __construct($file) {
40
  $this->dir = dirname( $file );
47
  $this->shortName = __('Child Themes', 'chld_thm_cfg');
48
  $this->pluginPath = $this->dir . '/';
49
  $this->pluginURL = plugin_dir_url($file);
50
+ $this->imgmimes = array(
51
+ 'jpg|jpeg|jpe' => 'image/jpeg',
52
+ 'gif' => 'image/gif',
53
+ 'png' => 'image/png',
54
+ );
55
  $this->cache_updates = true;
56
  // setup plugin hooks
57
  add_action('admin_menu', array(&$this, 'admin_menu'));
212
  && !isset($_POST['ctc_child_templates_submit'])
213
  && !isset($_POST['ctc_image_submit'])
214
  && !isset($_POST['ctc_theme_image_submit'])
215
+ && !isset($_POST['ctc_theme_screenshot_submit'])
216
+ && !isset($_POST['ctc_export_child_zip'])) return false;
217
  $this->errors = array();
218
+ if ($this->validate_post()): //current_user_can('install_themes')): // && $this->validate_post()):
219
  if (isset($_POST['ctc_load_styles'])):
220
  foreach (array(
221
  'ctc_theme_parnt',
264
  $this->css->set_prop('child', $child);
265
  $this->css->set_prop('child_name', $name);
266
  $this->css->set_prop('child_author', $author);
267
+ $this->css->set_prop('child_version', strlen($version) ? $version : '1.0');
268
  $this->css->set_prop('configtype', $configtype);
269
  do_action('chld_thm_cfg_addl_files', $this); // hook for add'l plugin files and subdirectories
270
  $this->css->parse_css_file('parnt');
299
  endforeach;
300
  $msg = '8&tab=file_options';
301
  elseif (isset($_POST['ctc_theme_image_submit']) && isset($_FILES['ctc_theme_image'])):
302
+ $this->handle_file_upload('ctc_theme_image', 'images', $this->imgmimes);
303
  $msg = '8&tab=file_options';
304
  elseif (isset($_POST['ctc_theme_screenshot_submit']) && isset($_FILES['ctc_theme_screenshot'])):
305
  // remove old screenshot
306
+ foreach(array_keys($this->imgmimes) as $extreg): foreach (explode('|', $extreg) as $ext):
307
  $this->delete_child_file('screenshot', $ext);
308
+ endforeach; endforeach;
309
+ $this->handle_file_upload('ctc_theme_screenshot', NULL, $this->imgmimes);
310
  $msg = '8&tab=file_options';
311
+ elseif (isset($_POST['ctc_export_child_zip'])):
312
+ $this->export_zip();
313
+ $this->errors[] = __('Zip file creation failed.', 'chld_thm_cfg');
314
  else:
315
  $msg = '8&tab=file_options';
316
  endif;
 
 
 
317
  else:
318
  $this->errors[] = __('You do not have permission to configure child themes.', 'chld_thm_cfg');
319
  endif;
320
+ if (empty($this->errors)):
321
+ $this->update_redirect($msg);
322
+ endif;
323
+ return false;
324
  //$this->errors[] = sprintf(__('Child Theme %s was unchanged.', 'chld_thm_cfg'), $name, $this->optionsName);
325
  }
326
 
382
  function copy_parent_file($file, $ext = 'php') {
383
  $parent_file = NULL;
384
  if ('screenshot' == $file):
385
+ foreach (array_keys($this->imgmimes) as $extreg): foreach(explode('|', $extreg) as $ext):
386
  if ($parent_file = $this->css->is_file_ok($this->css->get_parent_source('screenshot.' . $ext))) break;
387
+ endforeach; endforeach;
388
  else:
389
  $parent_file = $this->css->is_file_ok($this->css->get_parent_source($file . '.' . $ext));
390
  endif;
426
  }
427
 
428
 
429
+ function handle_file_upload($field, $childdir = NULL, $mimes = NULL){
430
+
431
+ $this->uploadsubdir = $childdir ? '/' . $childdir : NULL;
432
+ $uploadedfile = $_FILES[$field];
433
+ $upload_overrides = array(
434
+ 'test_form' => false,
435
+ 'unique_filename_callback' => ($childdir ? NULL : array($this, 'set_filename')),
436
+ 'mimes' => (is_array($mimes) ? $mimes : NULL)
437
+ );
438
+ add_filter('upload_dir', array($this, 'upload_dir'));
439
+ if ( ! function_exists( 'wp_handle_upload' ) ) require_once( ABSPATH . 'wp-admin/includes/file.php' );
440
+ $movefile = wp_handle_upload( $uploadedfile, $upload_overrides );
441
+ if (isset($movefile['error'])) $this->errors[] = $movefile['error'];
442
+ remove_filter('upload_dir', array($this, 'upload_dir'));
443
+
444
+ }
445
+
446
+ function export_zip() {
447
+ if (($child = $this->css->get_prop('child'))
448
+ && ($dir = $this->css->is_file_ok(dirname($this->css->get_child_target()), 'search'))
449
+ && ($version = preg_replace("%[^\w\.\-]%", '', $this->css->get_prop('version')))):
450
+ if (!file_exists($this->pluginPath . 'tmp')) mkdir($this->pluginPath . 'tmp', 0755);
451
+ $file = $this->pluginPath . 'tmp/' . $child . '-' . $version . '.zip';
452
+ mbstring_binary_safe_encoding();
453
 
454
+ require_once(ABSPATH . 'wp-admin/includes/class-pclzip.php');
 
 
 
 
 
 
 
 
 
 
 
455
 
456
+ $archive = new PclZip($file);
457
+ if ($archive->create($dir, PCLZIP_OPT_REMOVE_PATH, dirname($dir)) == 0) return false;
458
+ reset_mbstring_encoding();
459
+ header( 'Content-Description: File Transfer' );
460
+ header( 'Content-Type: application/octet-stream' );
461
+ header( 'Content-Length: ' . filesize($file) );
462
+ header( 'Content-Disposition: attachment; filename=' . basename($file) );
463
+ header( 'Expires: 0');
464
+ header( 'Cache-Control: must-revalidate');
465
+ header( 'Pragma: public');
466
+ readfile($file);
467
+ unlink($file);
468
+ die();
469
+ endif;
470
+ }
471
+
472
+ function upload_dir($uploads) {
473
+ $filename = basename($uploads['path']);
474
+ $basedir = get_theme_root() . '/' . $this->css->get_prop('child');
475
+ $baseurl = get_theme_root_uri() . '/' . $this->css->get_prop('child');
476
+ $dir = $basedir . $this->uploadsubdir;
477
+ $url = $baseurl . $this->uploadsubdir;
478
+ $uploads = array(
479
+ 'path' => $dir,
480
+ 'url' => $url,
481
+ 'subdir' => $this->uploadsubdir,
482
+ 'basedir' => $basedir,
483
+ 'baseurl' => $baseurl,
484
+ 'error' => false,
485
+ );
486
+ return $uploads;
487
+ }
488
+
489
+ function set_filename($dir, $basename, $ext) {
490
+ return 'screenshot' . $ext;
 
 
 
 
491
  }
492
  }
js/chld-thm-cfg.js CHANGED
@@ -2,11 +2,11 @@
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.2
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($){
12
 
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.6
6
  * Author: Lilaea Media
7
  * Author URI: http://www.lilaeamedia.com/
8
  * License: GPLv2
9
+ * Copyright (C) 2014 Lilaea Media
10
  */
11
  jQuery(document).ready(function($){
12
 
js/chld-thm-cfg.min.js CHANGED
@@ -1,11 +1,5 @@
1
  /*!
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.2
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 t(v)?v:v.toString().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)});
1
  /*!
2
+ * Script: chld-thm-cfg.min.js
3
+ * Copyright (C) 2014 Lilaea Media
 
 
 
 
 
 
4
  */
5
  ;jQuery(document).ready(function(c){var l="\n",u="base",h,b={},r,s,p=new RegExp('"',"g"),n=function(v){return t(v)?v:v.toString().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)});
js/ctcgrad.js CHANGED
@@ -1,7 +1,7 @@
1
  /*!
2
  * CTC Gradient Functions
3
  * Adapted from Iris
4
- * Copyright (c) 2012–2013 Automattic.
5
  * Licensed under the GPLv2 license.
6
  */
7
  (function( $, undef ){
1
  /*!
2
  * CTC Gradient Functions
3
  * Adapted from Iris
4
+ * Copyright (c) 2012–2014 Automattic.
5
  * Licensed under the GPLv2 license.
6
  */
7
  (function( $, undef ){
js/ctcgrad.min.js CHANGED
@@ -1,7 +1,7 @@
1
  /*!
2
  * CTC Gradient Functions
3
  * Adapted from Iris
4
- * Copyright (c) 2012–2013 Automattic.
5
  * Licensed under the GPLv2 license.
6
  */
7
  (function(i,f){var d,q,b,a,o,e,l,c,h;l=navigator.userAgent.toLowerCase();c=navigator.appName==="Microsoft Internet Explorer";h=c?parseFloat(l.match(/msie ([0-9]{1,}[\.0-9]{0,})/)[1]):0;q=(c&&h<10);a=["-moz-","-webkit-","-o-","-ms-"];p();if(q&&h<=7){i.fn.ctcgrad=i.noop;i.support.ctcgrad=false;return}i.support.ctcgrad=true;function p(){var r,s;if(q){b="filter"}else{r=i('<div id="ctcgrad-gradtest" />');s="linear-gradient(top,#fff,#000)";i.each(a,function(t,u){r.css("backgroundImage",u+s);if(r.css("backgroundImage").match("gradient")){b=t;return false}});if(b===false){r.css("background","-webkit-gradient(linear,0% 0%,0% 100%,from(#fff),to(#000))");if(r.css("backgroundImage").match("gradient")){b="webkit"}}r.remove()}}function n(r,s){r=(r.match(/(\d+deg|top|left|bottom|right)( (top|left|bottom|right))?/)?r:"top");s=i.isArray(s)?s:Array.prototype.slice.call(arguments,1);if(b==="webkit"){return m(r,s)}else{return a[b]+"linear-gradient("+r+", "+s.join(", ")+")"}}function g(x,A){var w,C,u,r,v,B,z,y,t,s;x=(x==="left")?"left":"top";A=i.isArray(A)?A:Array.prototype.slice.call(arguments,1);w=(x==="top")?0:1;C=i(this);u=A.length-1;r="filter";v=(w===1)?"left":"top";B=(w===1)?"right":"bottom";z=(w===1)?"height":"width";if(C.css("position")==="static"){C.css({position:"relative"})}A=j(A);i.each(A,function(D,F){var E,G;if(D===u){return false}E=A[D+1];if(F.stop===E.stop){return}G=100-parseFloat(E.stop)+"%";F.octoHex=new Color(F.color).toIEOctoHex();E.octoHex=new Color(E.color).toIEOctoHex();s="progid:DXImageTransform.Microsoft.Gradient(GradientType="+w+", StartColorStr='"+F.octoHex+"', EndColorStr='"+E.octoHex+"')"});return s}function m(r,s){var t=[];r=(r==="top")?"0% 0%,0% 100%,":"0% 100%,100% 100%,";s=j(s);i.each(s,function(u,v){t.push("color-stop("+(parseFloat(v.stop)/100)+", "+v.color+")")});return"-webkit-gradient(linear,"+r+t.join(",")+")"}function j(t){var s=[],u=[],r=[],v=t.length-1;i.each(t,function(y,A){var w=A,z=false,x=A.match(/1?[0-9]{1,2}%$/);if(x){w=A.replace(/\s?1?[0-9]{1,2}%$/,"");z=x.shift()}s.push(w);u.push(z)});if(u[0]===false){u[0]="0%"}if(u[v]===false){u[v]="100%"}u=k(u);i.each(u,function(w){r[w]={color:s[w],stop:u[w]}});return r}function k(z){var u=0,y=z.length-1,t=0,w=false,r,x,s,v;if(z.length<=2||i.inArray(false,z)<0){return z}while(t<z.length-1){if(!w&&z[t]===false){u=t-1;w=true}else{if(w&&z[t]!==false){y=t;t=z.length}}t++}x=y-u;v=parseInt(z[u].replace("%"),10);r=(parseFloat(z[y].replace("%"))-v)/x;t=u+1;s=1;while(t<y){z[t]=(v+(s*r))+"%";s++;t++}return k(z)}i.fn.ctcgrad=function(r){var s=arguments;if(q){i(this).css("filter",g.apply(this,s))}else{i(this).css("backgroundImage",n.apply(this,s))}}}(jQuery));
1
  /*!
2
  * CTC Gradient Functions
3
  * Adapted from Iris
4
+ * Copyright (c) 2012–2014 Automattic.
5
  * Licensed under the GPLv2 license.
6
  */
7
  (function(i,f){var d,q,b,a,o,e,l,c,h;l=navigator.userAgent.toLowerCase();c=navigator.appName==="Microsoft Internet Explorer";h=c?parseFloat(l.match(/msie ([0-9]{1,}[\.0-9]{0,})/)[1]):0;q=(c&&h<10);a=["-moz-","-webkit-","-o-","-ms-"];p();if(q&&h<=7){i.fn.ctcgrad=i.noop;i.support.ctcgrad=false;return}i.support.ctcgrad=true;function p(){var r,s;if(q){b="filter"}else{r=i('<div id="ctcgrad-gradtest" />');s="linear-gradient(top,#fff,#000)";i.each(a,function(t,u){r.css("backgroundImage",u+s);if(r.css("backgroundImage").match("gradient")){b=t;return false}});if(b===false){r.css("background","-webkit-gradient(linear,0% 0%,0% 100%,from(#fff),to(#000))");if(r.css("backgroundImage").match("gradient")){b="webkit"}}r.remove()}}function n(r,s){r=(r.match(/(\d+deg|top|left|bottom|right)( (top|left|bottom|right))?/)?r:"top");s=i.isArray(s)?s:Array.prototype.slice.call(arguments,1);if(b==="webkit"){return m(r,s)}else{return a[b]+"linear-gradient("+r+", "+s.join(", ")+")"}}function g(x,A){var w,C,u,r,v,B,z,y,t,s;x=(x==="left")?"left":"top";A=i.isArray(A)?A:Array.prototype.slice.call(arguments,1);w=(x==="top")?0:1;C=i(this);u=A.length-1;r="filter";v=(w===1)?"left":"top";B=(w===1)?"right":"bottom";z=(w===1)?"height":"width";if(C.css("position")==="static"){C.css({position:"relative"})}A=j(A);i.each(A,function(D,F){var E,G;if(D===u){return false}E=A[D+1];if(F.stop===E.stop){return}G=100-parseFloat(E.stop)+"%";F.octoHex=new Color(F.color).toIEOctoHex();E.octoHex=new Color(E.color).toIEOctoHex();s="progid:DXImageTransform.Microsoft.Gradient(GradientType="+w+", StartColorStr='"+F.octoHex+"', EndColorStr='"+E.octoHex+"')"});return s}function m(r,s){var t=[];r=(r==="top")?"0% 0%,0% 100%,":"0% 100%,100% 100%,";s=j(s);i.each(s,function(u,v){t.push("color-stop("+(parseFloat(v.stop)/100)+", "+v.color+")")});return"-webkit-gradient(linear,"+r+t.join(",")+")"}function j(t){var s=[],u=[],r=[],v=t.length-1;i.each(t,function(y,A){var w=A,z=false,x=A.match(/1?[0-9]{1,2}%$/);if(x){w=A.replace(/\s?1?[0-9]{1,2}%$/,"");z=x.shift()}s.push(w);u.push(z)});if(u[0]===false){u[0]="0%"}if(u[v]===false){u[v]="100%"}u=k(u);i.each(u,function(w){r[w]={color:s[w],stop:u[w]}});return r}function k(z){var u=0,y=z.length-1,t=0,w=false,r,x,s,v;if(z.length<=2||i.inArray(false,z)<0){return z}while(t<z.length-1){if(!w&&z[t]===false){u=t-1;w=true}else{if(w&&z[t]!==false){y=t;t=z.length}}t++}x=y-u;v=parseInt(z[u].replace("%"),10);r=(parseFloat(z[y].replace("%"))-v)/x;t=u+1;s=1;while(t<y){z[t]=(v+(s*r))+"%";s++;t++}return k(z)}i.fn.ctcgrad=function(r){var s=arguments;if(q){i(this).css("filter",g.apply(this,s))}else{i(this).css("backgroundImage",n.apply(this,s))}}}(jQuery));
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: lilaeamedia
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8QE5YJ8WE96AJ
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.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -179,6 +179,13 @@ You can also create a secondary stylesheet that contains @font-face rules and im
179
 
180
  == Changelog ==
181
 
 
 
 
 
 
 
 
182
  = 1.4.5.2 =
183
  * Fix: javascript bug
184
 
@@ -297,9 +304,12 @@ You can also create a secondary stylesheet that contains @font-face rules and im
297
 
298
  == Upgrade Notice ==
299
 
300
- = 1.4.5.2 =
301
- * Fixed JavaScript bug introduced in 1.4.5
302
- * Fixed regression bug introduced in 1.4.5 that broke raw css input
 
 
 
303
 
304
  == Create Your Child Theme ==
305
 
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8QE5YJ8WE96AJ
4
  Tags: child theme, custom theme, CSS, responsive design, CSS editor, theme generator
5
  Requires at least: 3.7
6
+ Tested up to: 4.0
7
+ Stable tag: 1.4.6
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.6 =
183
+ * Feature: export child theme as zip archive
184
+ * Added transform to list of vendor rules
185
+ * Bug fixed: parser not loading multiple instances of same @media rulesets
186
+ * Refactored uploader to use wp core functions for compatibility and security
187
+ * Increased CHLD_THM_CFG_MAX_RECURSE_LOOPS to 1000 to accommodate complex parent frameworks
188
+
189
  = 1.4.5.2 =
190
  * Fix: javascript bug
191
 
304
 
305
  == Upgrade Notice ==
306
 
307
+ = 1.4.6 =
308
+ * Feature: export child theme as zip archive
309
+ * Added transform to list of vendor rules
310
+ * Bug fixed: parser not loading multiple instances of same @media rulesets
311
+ * Refactored uploader to use wp core functions for compatibility and security
312
+ * Increased CHLD_THM_CFG_MAX_RECURSE_LOOPS to 1000 to accommodate complex parent frameworks
313
 
314
  == Create Your Child Theme ==
315