Child Theme Configurator - Version 2.4.2

Version Description

  • Added call to customizer.php to initialize theme mods prior to analyzing child theme
  • Deferred copy_theme_mods until after child theme analysis. This allows hooks in Preview to initialize custom theme mods
  • Added mpriority (max priority) to CSS object to accommodate multiple irregular stylesheet hooks
  • Restored original (pre 2.4.1) version filter hook style_loader_src to child theme stylesheets to prevent caching
  • Strip closing php tag from functions.php to prevent premature response header
Download this release

Release Info

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

Code changes from version 2.4.1 to 2.4.2

child-theme-configurator.php CHANGED
@@ -6,7 +6,7 @@ if ( !defined( 'ABSPATH' ) ) exit;
6
  Plugin Name: Child Theme Configurator
7
  Plugin URI: http://www.childthemeconfigurator.com
8
  Description: When using the Customizer is not enough - Create child themes and customize styles, templates, functions and more.
9
- Version: 2.4.1
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com
12
  Text Domain: child-theme-configurator
@@ -42,19 +42,13 @@ if ( isset( $_GET['preview_ctc'] ) ):
42
  endif;
43
 
44
  // append timestamp to linked stylesheets to force cache refresh
45
- add_action( 'init', 'chld_thm_cfg_link_timestamp' );
46
 
47
- function chld_thm_cfg_link_timestamp(){
48
- // only filter for admin users when child theme is active
49
- if ( is_child_theme() && current_user_can( 'edit_theme_options' ) )
50
- add_filter( 'style_loader_src', 'chld_thm_cfg_version', 10, 2 );
51
- }
52
 
53
  function chld_thm_cfg_version( $src, $handle ) {
54
  // only filter links for current theme
55
- if ( strstr( $src, get_stylesheet() ) ):
56
- $src = preg_replace( "/ver=(.*?)(\&|$)/", 'ver=' . wp_get_theme()->Version . "$2", $src );
57
- endif;
58
  return $src;
59
  }
60
 
6
  Plugin Name: Child Theme Configurator
7
  Plugin URI: http://www.childthemeconfigurator.com
8
  Description: When using the Customizer is not enough - Create child themes and customize styles, templates, functions and more.
9
+ Version: 2.4.2
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com
12
  Text Domain: child-theme-configurator
42
  endif;
43
 
44
  // append timestamp to linked stylesheets to force cache refresh
 
45
 
46
+ add_filter( 'style_loader_src', 'chld_thm_cfg_version', 10, 2 );
 
 
 
 
47
 
48
  function chld_thm_cfg_version( $src, $handle ) {
49
  // only filter links for current theme
50
+ if ( is_child_theme() && strstr( $src, get_stylesheet() ) && ( $ver = wp_get_theme()->Version ) )
51
+ $src = preg_replace( "/ver=(.*?)(\&|$)/", 'ver=' . $ver . "$2", $src );
 
52
  return $src;
53
  }
54
 
includes/classes/Admin.php CHANGED
@@ -36,6 +36,8 @@ class ChildThemeConfiguratorAdmin {
36
  var $debug;
37
  var $is_debug;
38
  var $is_new;
 
 
39
  // memory checks
40
  var $max_sel;
41
  var $sel_limit;
@@ -194,6 +196,16 @@ class ChildThemeConfiguratorAdmin {
194
  endif;
195
  do_action( 'chld_thm_cfg_load' );
196
  if ( $this->is_get ):
 
 
 
 
 
 
 
 
 
 
197
  if ( $this->get( 'child' ) ):
198
  // get filesystem credentials if available
199
  $this->verify_creds();
@@ -244,7 +256,8 @@ class ChildThemeConfiguratorAdmin {
244
  $this->debug( 'ajax save ', __FUNCTION__, __CLASS__ );
245
  // security check
246
  if ( $this->validate_post( $action ) ):
247
- if ( 'ctc_plugin' == $action ) do_action( 'chld_thm_cfg_pluginmode' );
 
248
  $this->verify_creds(); // initialize filesystem access
249
  add_action( 'chld_thm_cfg_cache_updates', array( $this, 'cache_debug' ) );
250
  // get configuration data from options API
@@ -253,15 +266,40 @@ class ChildThemeConfiguratorAdmin {
253
  // toggle debug
254
  $this->toggle_debug();
255
  else:
256
- $this->css->parse_post_data(); // parse any passed values
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
257
  // if child theme config has been set up, save new data
258
  // return recent edits and selected stylesheets as cache updates
259
  if ( $this->get( 'child' ) ):
260
  // hook for add'l plugin files and subdirectories
261
  do_action( 'chld_thm_cfg_addl_files' );
262
-
263
-
264
- $this->css->write_css();
 
265
  /*
266
  $this->updates[] = array(
267
  'obj' => 'addl_css',
@@ -270,13 +308,19 @@ class ChildThemeConfiguratorAdmin {
270
  );
271
  */
272
  endif;
273
-
274
  // update config data in options API
275
  $this->save_config();
276
  endif;
277
  // add any additional updates to pass back to browser
278
  do_action( 'chld_thm_cfg_cache_updates' );
279
  endif;
 
 
 
 
 
 
280
  // send all updates back to browser to update cache
281
  die( json_encode( $this->css->obj_to_utf8( $this->updates ) ) );
282
  endif;
@@ -390,7 +434,6 @@ class ChildThemeConfiguratorAdmin {
390
  endif;
391
  // now we need to check filesystem access
392
  $args = preg_grep( "/nonce/", array_keys( $_POST ), PREG_GREP_INVERT );
393
- $msg = FALSE;
394
  $this->verify_creds( $args );
395
  if ( $this->fs ):
396
  // we have filesystem access so proceed with specific actions
@@ -403,7 +446,7 @@ class ChildThemeConfiguratorAdmin {
403
  break;
404
  case 'load_styles':
405
  // main child theme setup function
406
- $msg = $this->setup_child_theme();
407
  break;
408
 
409
  case 'parnt_templates_submit':
@@ -413,7 +456,7 @@ class ChildThemeConfiguratorAdmin {
413
  list( $path, $ext ) = $this->get_pathinfo( sanitize_text_field( $file ) );
414
  $this->copy_parent_file( $path, $ext );
415
  endforeach;
416
- $msg = '8&tab=file_options';
417
  endif;
418
  break;
419
 
@@ -430,7 +473,7 @@ class ChildThemeConfiguratorAdmin {
430
  $this->delete_child_file( $path, $ext );
431
  endif;
432
  endforeach;
433
- $msg = '8&tab=file_options';
434
  endif;
435
  break;
436
 
@@ -439,7 +482,7 @@ class ChildThemeConfiguratorAdmin {
439
  if ( isset( $_POST[ 'ctc_img' ] ) ):
440
  foreach ( $_POST[ 'ctc_img' ] as $file )
441
  $this->delete_child_file( 'images/' . sanitize_text_field( $file ), 'img' );
442
- $msg = '8&tab=file_options';
443
  endif;
444
  break;
445
 
@@ -450,7 +493,7 @@ class ChildThemeConfiguratorAdmin {
450
  list( $path, $ext ) = $this->get_pathinfo( sanitize_text_field( $file ) );
451
  $this->set_writable( $path, $ext );
452
  endforeach;
453
- $msg = '8&tab=file_options';
454
  endif;
455
  break;
456
 
@@ -458,20 +501,20 @@ class ChildThemeConfiguratorAdmin {
458
  // make child theme style.css and functions.php writable ( systems not running suExec )
459
  $this->set_writable(); // no argument defaults to style.css
460
  $this->set_writable( 'functions' );
461
- $msg = '8&tab=file_options';
462
  break;
463
 
464
  case 'reset_permission':
465
  // make child theme read-only ( systems not running suExec )
466
  $this->unset_writable();
467
- $msg = '8&tab=file_options';
468
  break;
469
 
470
  case 'theme_image_submit':
471
  // move uploaded child theme images (now we have filesystem access)
472
  if ( isset( $_POST[ 'movefile' ] ) ):
473
  $this->move_file_upload( 'images' );
474
- $msg = '8&tab=file_options';
475
  endif;
476
  break;
477
 
@@ -484,7 +527,7 @@ class ChildThemeConfiguratorAdmin {
484
  $this->delete_child_file( 'screenshot', $ext );
485
  endforeach;
486
  $this->move_file_upload( '' );
487
- $msg = '8&tab=file_options';
488
  endif;
489
  break;
490
  default:
@@ -501,7 +544,7 @@ class ChildThemeConfiguratorAdmin {
501
  $this->processdone = TRUE;
502
  //die( '<pre><code><small>' . print_r( $_POST, TRUE ) . '</small></code></pre>' );
503
  // no errors so we redirect with confirmation message
504
- $this->update_redirect( $msg );
505
  endif;
506
  endif; // end request method condition
507
  // if we are here, then this is either a get request or we need filesystem access
@@ -511,7 +554,7 @@ class ChildThemeConfiguratorAdmin {
511
  * Handle the creation or update of a child theme
512
  */
513
  function setup_child_theme() {
514
- $msg = 1;
515
  $this->is_new = TRUE;
516
  // sanitize and extract config fields into local vars
517
  foreach ( $this->configfields as $configfield ):
@@ -555,11 +598,12 @@ class ChildThemeConfiguratorAdmin {
555
  // clone existing child theme
556
  $this->clone_child_theme( $child, $template_sanitized );
557
  if ( !empty( $this->errors ) ) return FALSE;
558
- // if no errors, copy menus, widgets and customizer options
559
- $this->copy_theme_mods( $child, $template_sanitized );
560
- $msg = 3;
 
561
  else:
562
- $msg = 2;
563
  endif;
564
  $child = $template_sanitized;
565
  endif;
@@ -578,7 +622,7 @@ class ChildThemeConfiguratorAdmin {
578
  $this->debug( 'resetting child theme', __FUNCTION__, __CLASS__ );
579
  $this->reset_child_theme();
580
  $this->enqueue_parent_css();
581
- $msg = 4;
582
  else:
583
 
584
  // if any errors, bail before we create css object
@@ -712,9 +756,11 @@ class ChildThemeConfiguratorAdmin {
712
 
713
  // plugin hook to parse additional or non-standard files
714
  do_action( 'chld_thm_cfg_parse_stylesheets' );
715
- // copy menus, widgets and other customizer options from parent to child if selected
716
  if ( isset( $_POST[ 'ctc_parent_mods' ] ) && 'duplicate' != $type )
717
- $this->copy_theme_mods( $parnt, $child );
 
 
 
718
  // run code generation function in read-only mode to add existing external stylesheet links to config data
719
  $this->enqueue_parent_css( TRUE );
720
  // hook for add'l plugin files and subdirectories. Must run after stylesheets are parsed to apply latest options
@@ -747,7 +793,6 @@ class ChildThemeConfiguratorAdmin {
747
  do_action( 'chld_thm_cfg_addl_options' );
748
  //$this->dump_configs();
749
  // return message id 1, which says new child theme created successfully;
750
- return $msg;
751
  }
752
 
753
  /*
@@ -764,14 +809,14 @@ class ChildThemeConfiguratorAdmin {
764
  return preg_replace( "/[^\w\-]/", '', $slug );
765
  }
766
 
767
- function update_redirect( $msg = 1 ) {
768
  $this->log_debug();
769
  if ( empty( $this->is_ajax ) ):
770
  $ctcpage = apply_filters( 'chld_thm_cfg_admin_page', CHLD_THM_CFG_MENU );
771
  $screen = get_current_screen()->id;
772
  wp_safe_redirect(
773
  ( strstr( $screen, '-network' ) ? network_admin_url( 'themes.php' ) : admin_url( 'tools.php' ) )
774
- . '?page=' . $ctcpage . ( $msg ? '&updated=' . $msg : ( $this->errors ? '&error=' . implode( ',', $this->errors ) : '' ) ) );
775
  die();
776
  endif;
777
  }
@@ -880,6 +925,7 @@ if ( !defined( 'ABSPATH' ) ) exit;
880
  $cssnotheme = $this->get( 'cssnotheme' );
881
  $ignoreparnt = $this->get( 'ignoreparnt' );
882
  $priority = $this->get( 'qpriority' );
 
883
  $reorder = $this->get( 'reorder' );
884
  $this->debug( 'forcedep: ' . print_r( $this->get( 'forcedep' ), TRUE ) . ' deps: ' . print_r( $deps, TRUE ) . ' enq: ' . $enq . ' handling: ' . $handling
885
  . ' hasstyles: ' . $hasstyles . ' parntloaded: ' . $parntloaded . ' childloaded: ' . $childloaded . ' reorder: ' . $reorder
@@ -939,10 +985,12 @@ add_action( 'wp_head', 'chld_thm_cfg_add_parent_dep', 2 );
939
 
940
  // deregister and re-register swaps
941
  foreach ( $this->get( 'swappath' ) as $sphandle => $sppath ):
942
- $enqueues[] = " if ( !file_exists( trailingslashit( get_stylesheet_directory() ) . '" . $sppath . "' ) ):";
943
- $enqueues[] = " wp_deregister_style( '" . $sphandle . "' );";
944
- $enqueues[] = " wp_register_style( '" . $sphandle . "', trailingslashit( get_template_directory_uri() ) . '" . $sppath . "' );";
945
- $enqueues[] = " endif;";
 
 
946
  endforeach;
947
 
948
  //die( print_r( $enqueues, TRUE ) );
@@ -971,7 +1019,7 @@ if ( !function_exists( 'child_theme_configurator_css' ) ):
971
  $code .= "
972
  }
973
  endif;
974
- add_action( 'wp_enqueue_scripts', 'child_theme_configurator_css', " . ( $priority + 10 ) . " );" . LF;
975
  endif;
976
  if ( $ignoreparnt )
977
  $code .= "
@@ -1010,7 +1058,7 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
1010
  if ( $this->is_ajax && is_readable( $filename ) && is_writable( $filename ) ):
1011
  // ok to proceed
1012
  $this->debug( 'Ajax update, bypassing wp filesystem.', __FUNCTION__, __CLASS__ );
1013
- $markerdata = explode( "\n", @file_get_contents( $filename ) );
1014
  elseif ( !$this->fs ):
1015
  $this->debug( 'No filesystem access.', __FUNCTION__, __CLASS__ );
1016
  return FALSE; // return if no filesystem access
@@ -1027,8 +1075,12 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
1027
  endif;
1028
  endif;
1029
  // get_contents_array returns extra linefeeds so just split it ourself
1030
- $markerdata = explode( "\n", $wp_filesystem->get_contents( $this->fspath( $filename ) ) );
1031
  endif;
 
 
 
 
1032
  $newfile = '';
1033
  $externals = array();
1034
  $phpopen = 0;
@@ -1101,9 +1153,9 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
1101
  // verify there is no PHP close tag at end of file
1102
  if ( ! $phpopen ):
1103
  $this->debug( 'PHP not open', __FUNCTION__, __CLASS__ );
1104
- //$this->errors[] = 12 //__( 'A closing PHP tag was detected in Child theme functions file so "Parent Stylesheet Handling" option was not configured. Closing PHP at the end of the file is discouraged as it can cause premature HTTP headers. Please edit <code>functions.php</code> to remove the final <code>?&gt;</code> tag and click "Generate/Rebuild Child Theme Files" again.', 'child-theme-configurator' );
1105
- //return FALSE;
1106
- $newfile .= '<?php' . LF;
1107
  endif;
1108
  $newfile .= "\n// BEGIN {$marker}\n";
1109
  foreach ( $insertion as $insertline )
@@ -1821,6 +1873,7 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
1821
  // so we need cases for active parent, active child or neither
1822
  function copy_theme_mods( $from, $to ) {
1823
  if ( strlen( $from ) && strlen( $to ) ):
 
1824
 
1825
  // get parent theme settings
1826
  $mods = $this->get_theme_mods( $from );
@@ -1858,14 +1911,15 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
1858
  function get_theme_mods( $theme ){
1859
  // get active theme
1860
  $active_theme = get_stylesheet();
 
1861
  // create temp array from parent settings
1862
  $mods = get_option( 'theme_mods_' . $theme );
1863
  if ( $active_theme == $theme ):
1864
- $this->debug( 'from is active, using active widgets', __FUNCTION__, __CLASS__ );
1865
  // if parent theme is active, get widgets from active sidebars_widgets array
1866
  $mods[ 'sidebars_widgets' ][ 'data' ] = retrieve_widgets();
1867
  else:
1868
- $this->debug( 'from not active, using theme mods widgets', __FUNCTION__, __CLASS__ );
1869
  // otherwise get widgets from parent theme mods
1870
  $mods[ 'sidebars_widgets' ][ 'data' ] = empty( $mods[ 'sidebars_widgets' ][ 'data' ] ) ?
1871
  array( 'wp_inactive_widgets' => array() ) : $mods[ 'sidebars_widgets' ][ 'data' ];
@@ -1875,15 +1929,16 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
1875
 
1876
  function set_theme_mods( $theme, $mods ){
1877
  $active_theme = get_stylesheet();
 
1878
  $widgets = $mods[ 'sidebars_widgets' ][ 'data' ];
1879
  if ( $active_theme == $theme ):
1880
- $this->debug( 'to active, setting active widgets', __FUNCTION__, __CLASS__ );
1881
  // copy widgets to active sidebars_widgets array
1882
  wp_set_sidebars_widgets( $mods[ 'sidebars_widgets' ][ 'data' ] );
1883
  // if child theme is active, remove widgets from temp array
1884
  unset( $mods[ 'sidebars_widgets' ] );
1885
  else:
1886
- $this->debug( 'child not active, saving widgets in theme mods', __FUNCTION__, __CLASS__ );
1887
  // otherwise copy widgets to temp array with time stamp
1888
  // array value is already set
1889
  //$mods[ 'sidebars_widgets' ][ 'data' ] = $widgets;
@@ -2154,13 +2209,6 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
2154
  endif;
2155
  endforeach;
2156
 
2157
- //echo ( print_r( $this->css->swappath, TRUE ) );
2158
-
2159
- /*
2160
- die( '<pre><code>Baseline: ' . $baseline . PHP_EOL . print_r( $analysis, TRUE ) . PHP_EOL
2161
- . 'Swap Paths: ' . print_r( $this->css->swappath, TRUE ) . '</code></pre>' );
2162
- */
2163
-
2164
  // store stylesheet dependencies
2165
  if ( isset( $analysis->{ $baseline } ) ):
2166
  if ( isset( $analysis->{ $baseline }->deps ) ):
@@ -2172,9 +2220,7 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
2172
  $this->css->parnt_deps[] = $deparray[ 0 ];
2173
  endif;
2174
  if ( !preg_match( "/^style.*?\.css$/", $deparray[ 1 ] ) ):
2175
- // bootstrap wastes memory among other resources
2176
- //if ( !preg_match( "/bootstrap/i", $deparray[ 0 ] ) && !preg_match( "/bootstrap/i", $deparray[ 1 ] ) )
2177
- $this->css->addl_css[] = sanitize_text_field( $deparray[ 1 ] );
2178
  endif;
2179
  endforeach;
2180
  foreach ( $analysis->{ $baseline }->deps[ 1 ] as $deparray ):
@@ -2186,8 +2232,7 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
2186
  endif;
2187
  if ( 'separate' == $this->get( 'handling' ) || !empty( $analysis->{ $baseline }->signals->ctc_child_loaded ) ):
2188
  if ( !preg_match( "/^style.*?\.css$/", $deparray[ 1 ] ) ):
2189
- //if ( !preg_match( "/bootstrap/", $deparray[ 0 ] ) && !preg_match( "/bootstrap/", $deparray[ 1 ] ) )
2190
- $this->css->addl_css[] = sanitize_text_field( $deparray[ 1 ] );
2191
  endif;
2192
  endif;
2193
  endforeach;
@@ -2235,6 +2280,9 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
2235
  // roll back CTC Pro Genesis handling option
2236
  if ( isset( $analysis->child->signals->ctc_gen_loaded ) )
2237
  $this->genesis = TRUE;
 
 
 
2238
  }
2239
 
2240
  /**
@@ -2244,16 +2292,25 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
2244
  * This allows the stylesheets to be enqueued in the correct order.
2245
  */
2246
  function set_enqueue_priority( $analysis, $baseline ){
 
2247
  foreach ( $analysis->{ $baseline }->irreg as $irreg ):
2248
  $handles = explode( ',', $irreg );
2249
  $priority = array_shift( $handles );
2250
- $handle = $analysis->{ $baseline }->signals->{ 'thm_' . $baseline . '_loaded' };
2251
- if ( in_array( $handle, $handles ) ):
 
2252
  $this->debug( '(baseline: ' . $baseline . ') match: ' . $handle . ' setting priority: ' . $priority, __FUNCTION__, __CLASS__ );
2253
  $this->css->set_prop( 'qpriority', $priority );
2254
- break;
 
2255
  endif;
 
 
 
2256
  endforeach;
 
 
 
2257
  }
2258
 
2259
  }
36
  var $debug;
37
  var $is_debug;
38
  var $is_new;
39
+ var $copy_mods; // copy theme options from and to
40
+ var $msg; // passed via 'updated' query var
41
  // memory checks
42
  var $max_sel;
43
  var $sel_limit;
196
  endif;
197
  do_action( 'chld_thm_cfg_load' );
198
  if ( $this->is_get ):
199
+ /**
200
+ * using 'updated' get var to indicate theme mods should be copied and the to/from themes
201
+ * otherwise set msg id
202
+ */
203
+ if ( isset( $_GET[ 'updated' ] ) ):
204
+ $msgparts = explode( ',', $_GET[ 'updated' ] );
205
+ $this->msg = array_shift( $msgparts );
206
+ if ( count( $msgparts ) )
207
+ $this->copy_mods = $msgparts;
208
+ endif;
209
  if ( $this->get( 'child' ) ):
210
  // get filesystem credentials if available
211
  $this->verify_creds();
256
  $this->debug( 'ajax save ', __FUNCTION__, __CLASS__ );
257
  // security check
258
  if ( $this->validate_post( $action ) ):
259
+ if ( 'ctc_plugin' == $action )
260
+ do_action( 'chld_thm_cfg_pluginmode' );
261
  $this->verify_creds(); // initialize filesystem access
262
  add_action( 'chld_thm_cfg_cache_updates', array( $this, 'cache_debug' ) );
263
  // get configuration data from options API
266
  // toggle debug
267
  $this->toggle_debug();
268
  else:
269
+ if( isset( $_POST[ 'ctc_copy_mods' ] ) ):
270
+ // copy menus, widgets and other customizer options from parent to child if selected
271
+ if ( isset( $_POST[ 'ctc_copy_from' ] ) && isset( $_POST[ 'ctc_copy_to' ] ) ):
272
+ $this->debug( 'Copy Theme Mods on resubmit', __FUNCTION__, __CLASS__ );
273
+ $from = sanitize_text_field( $_POST[ 'ctc_copy_from' ] );
274
+ $to = sanitize_text_field( $_POST[ 'ctc_copy_to' ] );
275
+ $this->copy_theme_mods( $from, $to );
276
+ else:
277
+ $this->debug( 'Copy Theme Mods passed but missing to and from values', __FUNCTION__, __CLASS__ );
278
+ endif;
279
+ endif;
280
+
281
+ if ( isset( $_POST[ 'ctc_analysis' ] ) ): // process ANALYZER SIGNAL inputs
282
+
283
+ if ( $this->cache_updates ):
284
+ $this->updates[] = array(
285
+ 'obj' => 'analysis',
286
+ 'data' => array(),
287
+ );
288
+ endif;
289
+
290
+ $this->evaluate_signals();
291
+ else: // process EDITOR inputs
292
+ $this->css->parse_post_data(); // parse any passed values
293
+ endif;
294
  // if child theme config has been set up, save new data
295
  // return recent edits and selected stylesheets as cache updates
296
  if ( $this->get( 'child' ) ):
297
  // hook for add'l plugin files and subdirectories
298
  do_action( 'chld_thm_cfg_addl_files' );
299
+
300
+
301
+ if ( !$this->css->write_css() )
302
+ die( 0 );
303
  /*
304
  $this->updates[] = array(
305
  'obj' => 'addl_css',
308
  );
309
  */
310
  endif;
311
+
312
  // update config data in options API
313
  $this->save_config();
314
  endif;
315
  // add any additional updates to pass back to browser
316
  do_action( 'chld_thm_cfg_cache_updates' );
317
  endif;
318
+ if ( count( $this->errors ) )
319
+ $this->updates[] = array(
320
+ 'obj' => 'errors',
321
+ 'key' => '',
322
+ 'data' => $this->errors,
323
+ );
324
  // send all updates back to browser to update cache
325
  die( json_encode( $this->css->obj_to_utf8( $this->updates ) ) );
326
  endif;
434
  endif;
435
  // now we need to check filesystem access
436
  $args = preg_grep( "/nonce/", array_keys( $_POST ), PREG_GREP_INVERT );
 
437
  $this->verify_creds( $args );
438
  if ( $this->fs ):
439
  // we have filesystem access so proceed with specific actions
446
  break;
447
  case 'load_styles':
448
  // main child theme setup function
449
+ $this->setup_child_theme();
450
  break;
451
 
452
  case 'parnt_templates_submit':
456
  list( $path, $ext ) = $this->get_pathinfo( sanitize_text_field( $file ) );
457
  $this->copy_parent_file( $path, $ext );
458
  endforeach;
459
+ $this->msg = '8&tab=file_options';
460
  endif;
461
  break;
462
 
473
  $this->delete_child_file( $path, $ext );
474
  endif;
475
  endforeach;
476
+ $this->msg = '8&tab=file_options';
477
  endif;
478
  break;
479
 
482
  if ( isset( $_POST[ 'ctc_img' ] ) ):
483
  foreach ( $_POST[ 'ctc_img' ] as $file )
484
  $this->delete_child_file( 'images/' . sanitize_text_field( $file ), 'img' );
485
+ $this->msg = '8&tab=file_options';
486
  endif;
487
  break;
488
 
493
  list( $path, $ext ) = $this->get_pathinfo( sanitize_text_field( $file ) );
494
  $this->set_writable( $path, $ext );
495
  endforeach;
496
+ $this->msg = '8&tab=file_options';
497
  endif;
498
  break;
499
 
501
  // make child theme style.css and functions.php writable ( systems not running suExec )
502
  $this->set_writable(); // no argument defaults to style.css
503
  $this->set_writable( 'functions' );
504
+ $this->msg = '8&tab=file_options';
505
  break;
506
 
507
  case 'reset_permission':
508
  // make child theme read-only ( systems not running suExec )
509
  $this->unset_writable();
510
+ $this->msg = '8&tab=file_options';
511
  break;
512
 
513
  case 'theme_image_submit':
514
  // move uploaded child theme images (now we have filesystem access)
515
  if ( isset( $_POST[ 'movefile' ] ) ):
516
  $this->move_file_upload( 'images' );
517
+ $this->msg = '8&tab=file_options';
518
  endif;
519
  break;
520
 
527
  $this->delete_child_file( 'screenshot', $ext );
528
  endforeach;
529
  $this->move_file_upload( '' );
530
+ $this->msg = '8&tab=file_options';
531
  endif;
532
  break;
533
  default:
544
  $this->processdone = TRUE;
545
  //die( '<pre><code><small>' . print_r( $_POST, TRUE ) . '</small></code></pre>' );
546
  // no errors so we redirect with confirmation message
547
+ $this->update_redirect();
548
  endif;
549
  endif; // end request method condition
550
  // if we are here, then this is either a get request or we need filesystem access
554
  * Handle the creation or update of a child theme
555
  */
556
  function setup_child_theme() {
557
+ $this->msg = 1;
558
  $this->is_new = TRUE;
559
  // sanitize and extract config fields into local vars
560
  foreach ( $this->configfields as $configfield ):
598
  // clone existing child theme
599
  $this->clone_child_theme( $child, $template_sanitized );
600
  if ( !empty( $this->errors ) ) return FALSE;
601
+ /**
602
+ * using 'updated' get var to indicate theme mods should be copied and the to/from themes
603
+ */
604
+ $this->msg = '3,' . $child . ',' . $template_sanitized;
605
  else:
606
+ $this->msg = 2;
607
  endif;
608
  $child = $template_sanitized;
609
  endif;
622
  $this->debug( 'resetting child theme', __FUNCTION__, __CLASS__ );
623
  $this->reset_child_theme();
624
  $this->enqueue_parent_css();
625
+ $this->msg = 4;
626
  else:
627
 
628
  // if any errors, bail before we create css object
756
 
757
  // plugin hook to parse additional or non-standard files
758
  do_action( 'chld_thm_cfg_parse_stylesheets' );
 
759
  if ( isset( $_POST[ 'ctc_parent_mods' ] ) && 'duplicate' != $type )
760
+ /**
761
+ * using 'updated' get var to indicate theme mods should be copied and the to/from themes
762
+ */
763
+ $this->msg .= ',' . $parnt . ',' . $child;
764
  // run code generation function in read-only mode to add existing external stylesheet links to config data
765
  $this->enqueue_parent_css( TRUE );
766
  // hook for add'l plugin files and subdirectories. Must run after stylesheets are parsed to apply latest options
793
  do_action( 'chld_thm_cfg_addl_options' );
794
  //$this->dump_configs();
795
  // return message id 1, which says new child theme created successfully;
 
796
  }
797
 
798
  /*
809
  return preg_replace( "/[^\w\-]/", '', $slug );
810
  }
811
 
812
+ function update_redirect() {
813
  $this->log_debug();
814
  if ( empty( $this->is_ajax ) ):
815
  $ctcpage = apply_filters( 'chld_thm_cfg_admin_page', CHLD_THM_CFG_MENU );
816
  $screen = get_current_screen()->id;
817
  wp_safe_redirect(
818
  ( strstr( $screen, '-network' ) ? network_admin_url( 'themes.php' ) : admin_url( 'tools.php' ) )
819
+ . '?page=' . $ctcpage . ( $this->errors ? '&error=' . implode( ',', $this->errors ) : ( $this->msg ? '&updated=' . $this->msg : '' ) ) );
820
  die();
821
  endif;
822
  }
925
  $cssnotheme = $this->get( 'cssnotheme' );
926
  $ignoreparnt = $this->get( 'ignoreparnt' );
927
  $priority = $this->get( 'qpriority' );
928
+ $maxpriority = $this->get( 'mpriority' );
929
  $reorder = $this->get( 'reorder' );
930
  $this->debug( 'forcedep: ' . print_r( $this->get( 'forcedep' ), TRUE ) . ' deps: ' . print_r( $deps, TRUE ) . ' enq: ' . $enq . ' handling: ' . $handling
931
  . ' hasstyles: ' . $hasstyles . ' parntloaded: ' . $parntloaded . ' childloaded: ' . $childloaded . ' reorder: ' . $reorder
985
 
986
  // deregister and re-register swaps
987
  foreach ( $this->get( 'swappath' ) as $sphandle => $sppath ):
988
+ if ( file_exists( trailingslashit( get_template_directory() ) . $sppath ) ):
989
+ $enqueues[] = " if ( !file_exists( trailingslashit( get_stylesheet_directory() ) . '" . $sppath . "' ) ):";
990
+ $enqueues[] = " wp_deregister_style( '" . $sphandle . "' );";
991
+ $enqueues[] = " wp_register_style( '" . $sphandle . "', trailingslashit( get_template_directory_uri() ) . '" . $sppath . "' );";
992
+ $enqueues[] = " endif;";
993
+ endif;
994
  endforeach;
995
 
996
  //die( print_r( $enqueues, TRUE ) );
1019
  $code .= "
1020
  }
1021
  endif;
1022
+ add_action( 'wp_enqueue_scripts', 'child_theme_configurator_css', " . $maxpriority . " );" . LF;
1023
  endif;
1024
  if ( $ignoreparnt )
1025
  $code .= "
1058
  if ( $this->is_ajax && is_readable( $filename ) && is_writable( $filename ) ):
1059
  // ok to proceed
1060
  $this->debug( 'Ajax update, bypassing wp filesystem.', __FUNCTION__, __CLASS__ );
1061
+ $markerdata = @file_get_contents( $filename );
1062
  elseif ( !$this->fs ):
1063
  $this->debug( 'No filesystem access.', __FUNCTION__, __CLASS__ );
1064
  return FALSE; // return if no filesystem access
1075
  endif;
1076
  endif;
1077
  // get_contents_array returns extra linefeeds so just split it ourself
1078
+ $markerdata = $wp_filesystem->get_contents( $this->fspath( $filename ) );
1079
  endif;
1080
+ // remove closing php tag
1081
+ $markerdata = preg_replace( "/\?>\s*\$/s", '', $markerdata );
1082
+ // divide into lines
1083
+ $markerdata = explode( "\n", $markerdata );
1084
  $newfile = '';
1085
  $externals = array();
1086
  $phpopen = 0;
1153
  // verify there is no PHP close tag at end of file
1154
  if ( ! $phpopen ):
1155
  $this->debug( 'PHP not open', __FUNCTION__, __CLASS__ );
1156
+ $this->errors[] = 12; //__( 'A closing PHP tag was detected in Child theme functions file so "Parent Stylesheet Handling" option was not configured. Closing PHP at the end of the file is discouraged as it can cause premature HTTP headers. Please edit <code>functions.php</code> to remove the final <code>?&gt;</code> tag and click "Generate/Rebuild Child Theme Files" again.', 'child-theme-configurator' );
1157
+ return FALSE;
1158
+ //$newfile .= '<?php' . LF;
1159
  endif;
1160
  $newfile .= "\n// BEGIN {$marker}\n";
1161
  foreach ( $insertion as $insertline )
1873
  // so we need cases for active parent, active child or neither
1874
  function copy_theme_mods( $from, $to ) {
1875
  if ( strlen( $from ) && strlen( $to ) ):
1876
+ $this->debug( 'copying theme fomds from ' . $from . ' to ' . $to, __FUNCTION__, __CLASS__ );
1877
 
1878
  // get parent theme settings
1879
  $mods = $this->get_theme_mods( $from );
1911
  function get_theme_mods( $theme ){
1912
  // get active theme
1913
  $active_theme = get_stylesheet();
1914
+ $this->debug( 'active theme is ' . $active_theme, __FUNCTION__, __CLASS__ );
1915
  // create temp array from parent settings
1916
  $mods = get_option( 'theme_mods_' . $theme );
1917
  if ( $active_theme == $theme ):
1918
+ $this->debug( $theme . ' is active, using active widgets', __FUNCTION__, __CLASS__ );
1919
  // if parent theme is active, get widgets from active sidebars_widgets array
1920
  $mods[ 'sidebars_widgets' ][ 'data' ] = retrieve_widgets();
1921
  else:
1922
+ $this->debug( $theme . ' not active, using theme mods widgets', __FUNCTION__, __CLASS__ );
1923
  // otherwise get widgets from parent theme mods
1924
  $mods[ 'sidebars_widgets' ][ 'data' ] = empty( $mods[ 'sidebars_widgets' ][ 'data' ] ) ?
1925
  array( 'wp_inactive_widgets' => array() ) : $mods[ 'sidebars_widgets' ][ 'data' ];
1929
 
1930
  function set_theme_mods( $theme, $mods ){
1931
  $active_theme = get_stylesheet();
1932
+ $this->debug( 'active theme is ' . $active_theme, __FUNCTION__, __CLASS__ );
1933
  $widgets = $mods[ 'sidebars_widgets' ][ 'data' ];
1934
  if ( $active_theme == $theme ):
1935
+ $this->debug( $theme . ' active, setting active widgets', __FUNCTION__, __CLASS__ );
1936
  // copy widgets to active sidebars_widgets array
1937
  wp_set_sidebars_widgets( $mods[ 'sidebars_widgets' ][ 'data' ] );
1938
  // if child theme is active, remove widgets from temp array
1939
  unset( $mods[ 'sidebars_widgets' ] );
1940
  else:
1941
+ $this->debug( $theme . ' not active, saving widgets in theme mods', __FUNCTION__, __CLASS__ );
1942
  // otherwise copy widgets to temp array with time stamp
1943
  // array value is already set
1944
  //$mods[ 'sidebars_widgets' ][ 'data' ] = $widgets;
2209
  endif;
2210
  endforeach;
2211
 
 
 
 
 
 
 
 
2212
  // store stylesheet dependencies
2213
  if ( isset( $analysis->{ $baseline } ) ):
2214
  if ( isset( $analysis->{ $baseline }->deps ) ):
2220
  $this->css->parnt_deps[] = $deparray[ 0 ];
2221
  endif;
2222
  if ( !preg_match( "/^style.*?\.css$/", $deparray[ 1 ] ) ):
2223
+ $this->css->addl_css[] = sanitize_text_field( $deparray[ 1 ] );
 
 
2224
  endif;
2225
  endforeach;
2226
  foreach ( $analysis->{ $baseline }->deps[ 1 ] as $deparray ):
2232
  endif;
2233
  if ( 'separate' == $this->get( 'handling' ) || !empty( $analysis->{ $baseline }->signals->ctc_child_loaded ) ):
2234
  if ( !preg_match( "/^style.*?\.css$/", $deparray[ 1 ] ) ):
2235
+ $this->css->addl_css[] = sanitize_text_field( $deparray[ 1 ] );
 
2236
  endif;
2237
  endif;
2238
  endforeach;
2280
  // roll back CTC Pro Genesis handling option
2281
  if ( isset( $analysis->child->signals->ctc_gen_loaded ) )
2282
  $this->genesis = TRUE;
2283
+
2284
+ add_action( 'chld_thm_cfg_addl_files', array( $this, 'enqueue_parent_css' ), 15, 2 );
2285
+
2286
  }
2287
 
2288
  /**
2292
  * This allows the stylesheets to be enqueued in the correct order.
2293
  */
2294
  function set_enqueue_priority( $analysis, $baseline ){
2295
+ $maxpriority = 10;
2296
  foreach ( $analysis->{ $baseline }->irreg as $irreg ):
2297
  $handles = explode( ',', $irreg );
2298
  $priority = array_shift( $handles );
2299
+ if ( isset( $analysis->{ $baseline }->signals->{ 'thm_' . $baseline . '_loaded' } )
2300
+ && ( $handle = $analysis->{ $baseline }->signals->{ 'thm_' . $baseline . '_loaded' } )
2301
+ && in_array( $handle, $handles ) ): // override priority if this is theme stylesheet
2302
  $this->debug( '(baseline: ' . $baseline . ') match: ' . $handle . ' setting priority: ' . $priority, __FUNCTION__, __CLASS__ );
2303
  $this->css->set_prop( 'qpriority', $priority );
2304
+ elseif ( preg_match( '/chld_thm_cfg/', $irreg ) ): // skip if this is ctc handle
2305
+ continue;
2306
  endif;
2307
+ // update max priority if this is higher
2308
+ if ( $priority >= $maxpriority )
2309
+ $maxpriority = $priority;
2310
  endforeach;
2311
+ // set max priority property
2312
+ $this->css->set_prop( 'mpriority', $maxpriority );
2313
+
2314
  }
2315
 
2316
  }
includes/classes/CSS.php CHANGED
@@ -43,6 +43,7 @@ class ChildThemeConfiguratorCSS {
43
  var $enqueue; // whether or not to load parent theme
44
  var $ignoreparnt; // no not parse or enqueue parent
45
  var $qpriority;
 
46
  var $hasstyles;
47
  var $parntloaded;
48
  var $childloaded;
@@ -108,6 +109,7 @@ class ChildThemeConfiguratorCSS {
108
  'childloaded',
109
  'ignoreparnt',
110
  'qpriority',
 
111
  'enqueue',
112
  'handling',
113
  'templates',
@@ -169,7 +171,8 @@ class ChildThemeConfiguratorCSS {
169
  $this->parnt = '';
170
  $this->ignoreparnt = 0;
171
  $this->qpriority = 10;
172
- $this->version = '2.4.1';
 
173
 
174
  // do not set enqueue, not being set is used to flag old versions
175
 
@@ -352,6 +355,8 @@ class ChildThemeConfiguratorCSS {
352
  return empty( $this->ignoreparnt ) ? 0 : 1;
353
  case 'qpriority':
354
  return empty( $this->qpriority ) ? 10 : $this->qpriority;
 
 
355
  case 'parntloaded':
356
  return empty( $this->parntloaded ) ? FALSE : $this->parntloaded;
357
  case 'childloaded':
@@ -798,17 +803,6 @@ class ChildThemeConfiguratorCSS {
798
  $this->imports[ 'child' ] = array();
799
  $this->styles = $this->parse_css_input( $_POST[ 'ctc_child_imports' ] );
800
  $this->parse_css( 'child' );
801
- // process ANALYZER SIGNAL inputs
802
- elseif ( isset( $_POST[ 'ctc_analysis' ] ) ):
803
-
804
- if ( $this->ctc()->cache_updates ):
805
- $this->ctc()->updates[] = array(
806
- 'obj' => 'analysis',
807
- 'data' => array(),
808
- );
809
- endif;
810
-
811
- $this->ctc()->evaluate_signals( $this->get_prop( 'ignoreparnt' ) );
812
  // process CONFIGURE inputs
813
  elseif ( isset( $_POST[ 'ctc_configtype' ] ) ):
814
  ob_start();
@@ -972,7 +966,7 @@ class ChildThemeConfiguratorCSS {
972
  endif;
973
 
974
  // update enqueue function if imports have not been converted or new imports passed
975
- if ( isset( $_POST[ 'ctc_analysis' ] ) || isset( $_POST[ 'ctc_child_imports' ] ) || !$this->get_prop( 'converted' ) )
976
  add_action( 'chld_thm_cfg_addl_files', array( $this->ctc(), 'enqueue_parent_css' ), 15, 2 );
977
  }
978
 
@@ -1360,17 +1354,26 @@ class ChildThemeConfiguratorCSS {
1360
  // write new stylesheet:
1361
  // try direct write first, then wp_filesystem write
1362
  // stylesheet must already exist and be writable by web server
1363
- if ( $this->ctc()->is_ajax && is_writable( $stylesheet_verified ) ):
1364
- if ( FALSE === @file_put_contents( $stylesheet_verified, $output ) ):
1365
- $this->ctc()->debug( 'Ajax write failed.', __FUNCTION__, __CLASS__ );
 
 
 
 
 
 
1366
  return FALSE;
1367
  endif;
1368
  elseif ( FALSE === $wp_filesystem->put_contents( $this->ctc()->fspath( $stylesheet_verified ), $output, $mode ) ):
1369
  $this->ctc()->debug( 'Filesystem write failed.', __FUNCTION__, __CLASS__ );
1370
  return FALSE;
1371
  endif;
 
1372
  return TRUE;
1373
- endif;
 
 
1374
  return FALSE;
1375
  }
1376
 
43
  var $enqueue; // whether or not to load parent theme
44
  var $ignoreparnt; // no not parse or enqueue parent
45
  var $qpriority;
46
+ var $mpriority;
47
  var $hasstyles;
48
  var $parntloaded;
49
  var $childloaded;
109
  'childloaded',
110
  'ignoreparnt',
111
  'qpriority',
112
+ 'mpriority',
113
  'enqueue',
114
  'handling',
115
  'templates',
171
  $this->parnt = '';
172
  $this->ignoreparnt = 0;
173
  $this->qpriority = 10;
174
+ $this->mpriority = 10;
175
+ $this->version = '2.4.2';
176
 
177
  // do not set enqueue, not being set is used to flag old versions
178
 
355
  return empty( $this->ignoreparnt ) ? 0 : 1;
356
  case 'qpriority':
357
  return empty( $this->qpriority ) ? 10 : $this->qpriority;
358
+ case 'mpriority':
359
+ return empty( $this->mpriority ) ? 10 : $this->mpriority;
360
  case 'parntloaded':
361
  return empty( $this->parntloaded ) ? FALSE : $this->parntloaded;
362
  case 'childloaded':
803
  $this->imports[ 'child' ] = array();
804
  $this->styles = $this->parse_css_input( $_POST[ 'ctc_child_imports' ] );
805
  $this->parse_css( 'child' );
 
 
 
 
 
 
 
 
 
 
 
806
  // process CONFIGURE inputs
807
  elseif ( isset( $_POST[ 'ctc_configtype' ] ) ):
808
  ob_start();
966
  endif;
967
 
968
  // update enqueue function if imports have not been converted or new imports passed
969
+ if ( isset( $_POST[ 'ctc_child_imports' ] ) || !$this->get_prop( 'converted' ) )
970
  add_action( 'chld_thm_cfg_addl_files', array( $this->ctc(), 'enqueue_parent_css' ), 15, 2 );
971
  }
972
 
1354
  // write new stylesheet:
1355
  // try direct write first, then wp_filesystem write
1356
  // stylesheet must already exist and be writable by web server
1357
+ if ( $this->ctc()->is_ajax ):
1358
+ if ( is_writable( $stylesheet_verified ) ):
1359
+ $this->ctc()->debug( 'Attempting Ajax write...', __FUNCTION__, __CLASS__ );
1360
+ if ( FALSE === @file_put_contents( $stylesheet_verified, $output ) ):
1361
+ $this->ctc()->debug( 'Ajax write failed.', __FUNCTION__, __CLASS__ );
1362
+ return FALSE;
1363
+ endif;
1364
+ else:
1365
+ $this->ctc()->debug( 'File not writable.', __FUNCTION__, __CLASS__ );
1366
  return FALSE;
1367
  endif;
1368
  elseif ( FALSE === $wp_filesystem->put_contents( $this->ctc()->fspath( $stylesheet_verified ), $output, $mode ) ):
1369
  $this->ctc()->debug( 'Filesystem write failed.', __FUNCTION__, __CLASS__ );
1370
  return FALSE;
1371
  endif;
1372
+ $this->ctc()->debug( 'No write failure reported.', __FUNCTION__, __CLASS__ );
1373
  return TRUE;
1374
+ endif;
1375
+ $this->ctc()->debug( 'File NOT ok.', __FUNCTION__, __CLASS__ );
1376
+
1377
  return FALSE;
1378
  }
1379
 
includes/classes/Core.php CHANGED
@@ -14,7 +14,7 @@ if ( !defined( 'ABSPATH' ) ) exit;
14
  define( 'LILAEAMEDIA_URL', "http://www.lilaeamedia.com" );
15
  defined( 'CHLD_THM_CFG_DOCS_URL' ) or
16
  define( 'CHLD_THM_CFG_DOCS_URL', "http://www.childthemeconfigurator.com" );
17
- define( 'CHLD_THM_CFG_VERSION', '2.4.1' );
18
  define( 'CHLD_THM_CFG_PREV_VERSION', '1.7.9.1' );
19
  define( 'CHLD_THM_CFG_MIN_WP_VERSION', '3.7' );
20
  define( 'CHLD_THM_CFG_PRO_MIN_VERSION', '2.2.0' );
14
  define( 'LILAEAMEDIA_URL', "http://www.lilaeamedia.com" );
15
  defined( 'CHLD_THM_CFG_DOCS_URL' ) or
16
  define( 'CHLD_THM_CFG_DOCS_URL', "http://www.childthemeconfigurator.com" );
17
+ define( 'CHLD_THM_CFG_VERSION', '2.4.2' );
18
  define( 'CHLD_THM_CFG_PREV_VERSION', '1.7.9.1' );
19
  define( 'CHLD_THM_CFG_MIN_WP_VERSION', '3.7' );
20
  define( 'CHLD_THM_CFG_PRO_MIN_VERSION', '2.2.0' );
includes/classes/UI.php CHANGED
@@ -269,6 +269,7 @@ class ChildThemeConfiguratorUI {
269
  'ssl' => is_ssl(),
270
  'homeurl' => home_url( '/' ) . '?ModPagespeed=off&' . ( defined( 'WP_ROCKET_VERSION' ) ? '' : 'ao_noptimize=1&' ) . 'preview_ctc=1', // WP Rocket serves cached page when ao_nooptimize is present v2.3.0
271
  'ajaxurl' => admin_url( 'admin-ajax.php' ),
 
272
  'theme_uri' => get_theme_root_uri(),
273
  'theme_dir' => basename( get_theme_root_uri() ),
274
  'page' => CHLD_THM_CFG_MENU,
@@ -284,6 +285,7 @@ class ChildThemeConfiguratorUI {
284
  'swappath' => $this->css()->get_prop( 'swappath' ),
285
  'imports' => $this->css()->get_prop( 'imports' ),
286
  'converted' => $this->css()->get_prop( 'converted' ),
 
287
  'is_debug' => $this->ctc()->is_debug,
288
  '_background_url_txt' => __( 'URL/None', 'child-theme-configurator' ),
289
  '_background_origin_txt' => __( 'Origin', 'child-theme-configurator' ),
269
  'ssl' => is_ssl(),
270
  'homeurl' => home_url( '/' ) . '?ModPagespeed=off&' . ( defined( 'WP_ROCKET_VERSION' ) ? '' : 'ao_noptimize=1&' ) . 'preview_ctc=1', // WP Rocket serves cached page when ao_nooptimize is present v2.3.0
271
  'ajaxurl' => admin_url( 'admin-ajax.php' ),
272
+ 'customizerurl' => admin_url( 'customize.php' ),
273
  'theme_uri' => get_theme_root_uri(),
274
  'theme_dir' => basename( get_theme_root_uri() ),
275
  'page' => CHLD_THM_CFG_MENU,
285
  'swappath' => $this->css()->get_prop( 'swappath' ),
286
  'imports' => $this->css()->get_prop( 'imports' ),
287
  'converted' => $this->css()->get_prop( 'converted' ),
288
+ 'copy_mods' => $this->ctc()->copy_mods,
289
  'is_debug' => $this->ctc()->is_debug,
290
  '_background_url_txt' => __( 'URL/None', 'child-theme-configurator' ),
291
  '_background_origin_txt' => __( 'Origin', 'child-theme-configurator' ),
includes/forms/settings-errors.php CHANGED
@@ -36,12 +36,12 @@ if ( isset( $_GET[ 'error' ] ) || count( $this->ctc()->errors ) ):
36
  if ( $writable_error ):
37
  $this->render_notices( 'writable' );
38
  endif;
39
- elseif ( isset( $_GET[ 'updated' ] ) ):
40
  $child_theme = wp_get_theme( $this->ctc()->get( 'child' ) );
41
  ?>
42
  <div class="updated notice is-dismissible">
43
  <?php
44
- switch ( $_GET[ 'updated' ] ):
45
  case '4':
46
  ?>
47
  <p>
36
  if ( $writable_error ):
37
  $this->render_notices( 'writable' );
38
  endif;
39
+ elseif ( $msg = $this->ctc()->msg ):
40
  $child_theme = wp_get_theme( $this->ctc()->get( 'child' ) );
41
  ?>
42
  <div class="updated notice is-dismissible">
43
  <?php
44
+ switch ( $msg ):
45
  case '4':
46
  ?>
47
  <p>
js/chldthmcfg.js CHANGED
@@ -2,7 +2,7 @@
2
  * Script: chldthmcfg.js
3
  * Plugin URI: http://www.childthemeconfigurator.com/
4
  * Description: Handles jQuery, AJAX and other UI
5
- * Version: 2.4.1
6
  * Author: Lilaea Media
7
  * Author URI: http://www.lilaeamedia.com/
8
  * License: GPLv2
@@ -1161,7 +1161,6 @@
1161
  // console.log( 'ajax_post: ' + obj );
1162
  // console.log( data );
1163
  // console.log( window.ctcAjax.ajaxurl );
1164
- // console.log( window.ctcAjax.ajaxurl );
1165
  // get ajax url from localized object
1166
  $.ajax( {
1167
  url: window.ctcAjax.ajaxurl,
@@ -2034,7 +2033,7 @@
2034
  // test for rtl because it may occur past test.css boundary and flag false positive
2035
  } else if ( stylesheetpath.match( /rtl.*?\.css$/ ) ) {
2036
  self.analysis[ themetype ].signals.thm_rtl = 1;
2037
- } else if ( 'ctc-test.css' === stylesheetpath ) { // flag test stylesheet link
2038
  // console.log( 'end of queue reached' );
2039
  testloaded = 1; // flag that test queue has been detected ( end of wp_head )
2040
  } else {
@@ -2177,11 +2176,19 @@
2177
  }
2178
  }
2179
  if ( 'child' === themetype ) {
 
 
 
 
 
 
 
 
2180
  // test for reorder flag
2181
  if ( self.analysis.child.signals.ctc_parnt_reorder ) {
2182
  // console.log( 'reorder flag detected, resubmitting.' );
2183
  // console.log( 'resubmitting 1' );
2184
- resubmit = 1;
2185
  }
2186
  // test for presence of a child theme stylesheet
2187
  if ( !self.analysis.child.signals.ctc_child_loaded &&
@@ -2193,7 +2200,7 @@
2193
  msg: $.chldthmcfg.getxt( 'anlz14' )
2194
  } );
2195
  // console.log( 'resubmitting 2' );
2196
- resubmit = 1;
2197
  }
2198
  // test for deprecated Genesis methods
2199
  if ( self.analysis[ themetype ].signals.ctc_gen_loaded ) {
@@ -2216,7 +2223,7 @@
2216
  msg: $.chldthmcfg.getxt( 'anlz16' )
2217
  } );
2218
  // console.log( 'resubmitting 3' );
2219
- resubmit = 1;
2220
  }
2221
  // test for redundant stylesheet link (old CTC version)
2222
  if ( self.analysis.child.signals.thm_unregistered &&
@@ -2257,7 +2264,7 @@
2257
  self.analysis.parnt.swaps.push( el2 );
2258
  window.ctcAjax.swappath[ el2[ 0 ] ] = el2[ 1 ];
2259
  // console.log( 'resubmitting 7' );
2260
- resubmit = 1;
2261
  }
2262
  } );
2263
  } );
@@ -2294,7 +2301,7 @@
2294
  if ( !$( '#ctc_enqueue_none' ).is( ':checked' ) ) {
2295
  $( '#ctc_enqueue_none' ).prop( 'checked', true );
2296
  // console.log( 'resubmitting 4' );
2297
- resubmit = 1;
2298
  resubmitdata.ctc_enqueue = 'none';
2299
  }
2300
  } else {
@@ -2332,7 +2339,7 @@
2332
  //}
2333
  $( '#ctc_enqueue_none' ).prop( 'checked', true );
2334
  // console.log( 'resubmitting 5' );
2335
- resubmit = 1;
2336
  resubmitdata.ctc_enqueue = 'none';
2337
  }
2338
  // test if no parent styles, no need to enqueue and resubmit
@@ -2346,7 +2353,7 @@
2346
  //}
2347
  $( '#ctc_enqueue_none' ).prop( 'checked', true );
2348
  // console.log( 'resubmitting 6' );
2349
- resubmit = 1;
2350
  resubmitdata.ctc_enqueue = 'none';
2351
  }
2352
  }
@@ -2361,9 +2368,11 @@
2361
  hidden = encodeURIComponent( JSON.stringify( self.analysis ) );
2362
 
2363
  $( 'input[name="ctc_analysis"]' ).val( hidden );
2364
- resubmitdata.ctc_analysis = hidden;
2365
 
2366
  if ( self.is_success() && resubmit && !self.resubmitting ){
 
 
 
2367
  self.resubmitting = 1;
2368
  self.resubmit( resubmitdata );
2369
  return;
@@ -2443,16 +2452,19 @@
2443
  data.action = 'ctc_update';
2444
  data._wpnonce = $( '#_wpnonce' ).val();
2445
  // console.log( '=====>>> RESUBMIT CALLED! <<<=====' );
2446
- // console.log( data );
2447
  // console.log( self.analysis );
2448
  $.ajax( {
2449
  url: window.ctcAjax.ajaxurl,
2450
  data: data,
2451
- //dataType: 'json',
2452
  type: 'POST'
2453
- } ).done( function() { // response ) {
2454
  // console.log( 'resubmit done:' );
2455
- // console.log( response );
 
 
 
2456
  self.hide_loading();
2457
  self.do_analysis();
2458
  } ).fail( function() { // xhr, status, err ) {
@@ -2460,7 +2472,7 @@
2460
  self.hide_loading();
2461
  // console.log( status + ' ' + err );
2462
  // FIXME: handle failure
2463
- } );
2464
  },
2465
  do_analysis: function() {
2466
  var self = this;
@@ -2490,7 +2502,16 @@
2490
  self.show_loading( false );
2491
  self.analyze_theme( 'parnt' );
2492
  if ( $.chldthmcfg.existing ) {
2493
- self.analyze_theme( 'child' );
 
 
 
 
 
 
 
 
 
2494
  }
2495
  //$( '#ctc_enqueue_enqueue' ).prop( 'checked', true );
2496
  //$( '#ctc_handling_primary' ).prop( 'checked', true );
2
  * Script: chldthmcfg.js
3
  * Plugin URI: http://www.childthemeconfigurator.com/
4
  * Description: Handles jQuery, AJAX and other UI
5
+ * Version: 2.4.2
6
  * Author: Lilaea Media
7
  * Author URI: http://www.lilaeamedia.com/
8
  * License: GPLv2
1161
  // console.log( 'ajax_post: ' + obj );
1162
  // console.log( data );
1163
  // console.log( window.ctcAjax.ajaxurl );
 
1164
  // get ajax url from localized object
1165
  $.ajax( {
1166
  url: window.ctcAjax.ajaxurl,
2033
  // test for rtl because it may occur past test.css boundary and flag false positive
2034
  } else if ( stylesheetpath.match( /rtl.*?\.css$/ ) ) {
2035
  self.analysis[ themetype ].signals.thm_rtl = 1;
2036
+ } else if ( stylesheetpath.match( /ctc\-test.*?\.css$/ ) ) { // flag test stylesheet link
2037
  // console.log( 'end of queue reached' );
2038
  testloaded = 1; // flag that test queue has been detected ( end of wp_head )
2039
  } else {
2176
  }
2177
  }
2178
  if ( 'child' === themetype ) {
2179
+ // test if theme mods should be copied
2180
+ if ( window.ctcAjax.copy_mods && window.ctcAjax.copy_mods.length > 1 ){
2181
+ //console.log( 'copy theme mods', window.ctcAjax.copy_mods );
2182
+ resubmit = 1;
2183
+ resubmitdata.ctc_copy_mods = 1;
2184
+ resubmitdata.ctc_copy_from = window.ctcAjax.copy_mods[ 0 ];
2185
+ resubmitdata.ctc_copy_to = window.ctcAjax.copy_mods[ 1 ];
2186
+ }
2187
  // test for reorder flag
2188
  if ( self.analysis.child.signals.ctc_parnt_reorder ) {
2189
  // console.log( 'reorder flag detected, resubmitting.' );
2190
  // console.log( 'resubmitting 1' );
2191
+ resubmit = 2;
2192
  }
2193
  // test for presence of a child theme stylesheet
2194
  if ( !self.analysis.child.signals.ctc_child_loaded &&
2200
  msg: $.chldthmcfg.getxt( 'anlz14' )
2201
  } );
2202
  // console.log( 'resubmitting 2' );
2203
+ resubmit = 2;
2204
  }
2205
  // test for deprecated Genesis methods
2206
  if ( self.analysis[ themetype ].signals.ctc_gen_loaded ) {
2223
  msg: $.chldthmcfg.getxt( 'anlz16' )
2224
  } );
2225
  // console.log( 'resubmitting 3' );
2226
+ resubmit = 2;
2227
  }
2228
  // test for redundant stylesheet link (old CTC version)
2229
  if ( self.analysis.child.signals.thm_unregistered &&
2264
  self.analysis.parnt.swaps.push( el2 );
2265
  window.ctcAjax.swappath[ el2[ 0 ] ] = el2[ 1 ];
2266
  // console.log( 'resubmitting 7' );
2267
+ resubmit = 2;
2268
  }
2269
  } );
2270
  } );
2301
  if ( !$( '#ctc_enqueue_none' ).is( ':checked' ) ) {
2302
  $( '#ctc_enqueue_none' ).prop( 'checked', true );
2303
  // console.log( 'resubmitting 4' );
2304
+ resubmit = 2;
2305
  resubmitdata.ctc_enqueue = 'none';
2306
  }
2307
  } else {
2339
  //}
2340
  $( '#ctc_enqueue_none' ).prop( 'checked', true );
2341
  // console.log( 'resubmitting 5' );
2342
+ resubmit = 2;
2343
  resubmitdata.ctc_enqueue = 'none';
2344
  }
2345
  // test if no parent styles, no need to enqueue and resubmit
2353
  //}
2354
  $( '#ctc_enqueue_none' ).prop( 'checked', true );
2355
  // console.log( 'resubmitting 6' );
2356
+ resubmit = 2;
2357
  resubmitdata.ctc_enqueue = 'none';
2358
  }
2359
  }
2368
  hidden = encodeURIComponent( JSON.stringify( self.analysis ) );
2369
 
2370
  $( 'input[name="ctc_analysis"]' ).val( hidden );
 
2371
 
2372
  if ( self.is_success() && resubmit && !self.resubmitting ){
2373
+ if ( resubmit === 2 ){
2374
+ resubmitdata.ctc_analysis = hidden;
2375
+ }
2376
  self.resubmitting = 1;
2377
  self.resubmit( resubmitdata );
2378
  return;
2452
  data.action = 'ctc_update';
2453
  data._wpnonce = $( '#_wpnonce' ).val();
2454
  // console.log( '=====>>> RESUBMIT CALLED! <<<=====' );
2455
+ //console.log( data );
2456
  // console.log( self.analysis );
2457
  $.ajax( {
2458
  url: window.ctcAjax.ajaxurl,
2459
  data: data,
2460
+ dataType: 'json',
2461
  type: 'POST'
2462
+ } ).done( function( res ) { // response ) {
2463
  // console.log( 'resubmit done:' );
2464
+ //console.log( res )
2465
+ if ( res.length > 1 ) {
2466
+ $( '#ctc_debug_box' ).val( $( '#ctc_debug_box' ).val() + res[ 1 ].data );
2467
+ }
2468
  self.hide_loading();
2469
  self.do_analysis();
2470
  } ).fail( function() { // xhr, status, err ) {
2472
  self.hide_loading();
2473
  // console.log( status + ' ' + err );
2474
  // FIXME: handle failure
2475
+ } );//.always( self.update.debug );
2476
  },
2477
  do_analysis: function() {
2478
  var self = this;
2502
  self.show_loading( false );
2503
  self.analyze_theme( 'parnt' );
2504
  if ( $.chldthmcfg.existing ) {
2505
+ // run customizer to initialize new theme
2506
+ if ( self.resubmitting ){
2507
+ self.analyze_theme( 'child' );
2508
+ } else {
2509
+ // console.log( 'calling ' + window.ctcAjax.customizerurl + '?theme=' + $.chldthmcfg.currchild + ' ...' );
2510
+ $.get( window.ctcAjax.customizerurl + '?theme=' + $.chldthmcfg.currchild, function(){ //data ){
2511
+ self.analyze_theme( 'child' );
2512
+ //console.log( data );
2513
+ } );//.done().fail();
2514
+ }
2515
  }
2516
  //$( '#ctc_enqueue_enqueue' ).prop( 'checked', true );
2517
  //$( '#ctc_handling_primary' ).prop( 'checked', true );
js/chldthmcfg.min.js CHANGED
@@ -1,2 +1,2 @@
1
  !function(e){"use strict";e.chldthmcfg={escquo:function(e){var t=this;return t.is_empty(e)?e:e.toString().replace(/"/g,"&quot;")},getxt:function(e,t){var c=window.ctcAjax[e+"_txt"];return c?(t&&(c=c.replace(/%s/,t)),c):""},getname:function(t){var c=this,n="child"===t?e.chldthmcfg.currchild:e.chldthmcfg.currparnt;return c.is_empty(window.ctcAjax.themes[t][n])?"":window.ctcAjax.themes[t][n].Name},frascii:function(e){var t=parseInt(e),c=String.fromCharCode(t);return c},toascii:function(e){var t=e.charCodeAt(0);return t},is_empty:function(e,t){if("undefined"==typeof e||!1===e||null===e||""===e)return!0;if("undefined"!=typeof t&&"0"===e||0===e)return!0;if(!0===e||"string"==typeof e||"number"==typeof e)return!1;if("object"==typeof e){for(var c in e)if(e.hasOwnProperty(c))return!1;return!0}return!1},theme_exists:function(t,c){var n=!1;return e.each(window.ctcAjax.themes,function(a,s){return e.each(s,function(e,s){return s=null,e.toLowerCase()!==t.toLowerCase()||"parnt"!==a&&"new"!==c?void 0:(n=!0,!1)}),n?!1:void 0}),n},validate:function(){var t=this,c=/[^\w\-]/g,n=e("#ctc_child_template").length?e("#ctc_child_template").val().toString().replace(c):"",a=e("#ctc_theme_child").length&&!t.is_empty(e("#ctc_theme_child").val())?e("#ctc_theme_child").val().toString().replace(c):n,s=e("input[name=ctc_child_type]:checked").val(),i=[];return"new"===s&&(a=n),t.theme_exists(a,s)&&i.push(t.getxt("theme_exists").toString().replace(/%s/,a)),t.is_empty(a)&&i.push(t.getxt("inval_theme")),i.length?(t.set_notice({error:i}),!1):"reset"===s?!!confirm(t.getxt("load")):!0},autogen_slugs:function(){if(e("#ctc_theme_parnt").length){for(var t=this,c=e("#ctc_theme_parnt").val(),n=e("#ctc_theme_child").length?e("#ctc_theme_child").val():"",a=""!==n&&e("#ctc_child_type_duplicate").is(":checked")?n:c+"-child",s=a,i=""!==n&&e("#ctc_child_type_duplicate").is(":checked")?e.chldthmcfg.getname("child"):e.chldthmcfg.getname("parnt")+" Child",l="",r="",o="00";t.theme_exists(s,"new");)l=t.is_empty(l)?2:l+1,r=o.substring(0,o.length-l.toString().length)+l.toString(),s=a+r;t.testslug=s,t.testname=i+(r.length?" "+r:"")}},focus_panel:function(t){var c=t+"_panel";e(".nav-tab").removeClass("nav-tab-active"),e(".ctc-option-panel").removeClass("ctc-option-panel-active"),e(t).addClass("nav-tab-active"),e(".ctc-option-panel-container").scrollTop(0),e(c).addClass("ctc-option-panel-active")},maybe_show_rewrite:function(){var t,c,n=this;e(".ctc-rewrite-toggle").each(function(a,s){t=e(s).hasClass("rewrite-query")?"query":"selector",c=e("#ctc_sel_ovrd_"+t+"_selected").text(),c.match(/^[\s\u00A0]*$/)?e(s).hide():(e(s).text(n.getxt("rename")),e(s).show())})},selector_input_toggle:function(t){var c,n=this,a=e(t).hasClass("rewrite-query")?"query":"selector",s="ctc_rewrite_"+a,i="ctc_sel_ovrd_"+a+"_selected";e("#"+s).length?(c=e("#"+s+"_orig").val(),e("#"+i).empty().text(c),e(t).text(n.getxt("rename"))):(c=e("#"+i).text(),e("#"+i).html('<textarea id="'+s+'" name="'+s+'" autocomplete="off"></textarea><input id="'+s+'_orig" name="'+s+'_orig" type="hidden" value="'+n.escquo(c)+'"/>'),e("#"+s).val(c),e(t).text(n.getxt("cancel")))},coalesce_inputs:function(t){var c=this,n=e(t).attr("id"),a=/^(ctc_(ovrd|\d+)_(parent|child)_([0-9a-z\-]+)_(\d+?)(_(\d+))?)(_\w+)?$/,s=e(t).parents(".ctc-selector-row, .ctc-parent-row").first(),i=s.find(".ctc-swatch").first(),l={parent:{},child:{}},r={parent:{origin:"",start:"",end:""},child:{origin:"",start:"",end:""}},o={child:!1,parent:!1},_={};return s.find(".ctc-parent-value, .ctc-child-value").each(function(){var t,s,i=e(this).attr("id"),d=i.toString().match(a),u=d[2],h=d[3],p="undefined"==typeof d[4]?"":d[4],m=d[7],g=d[5],f="undefined"==typeof d[7]?"":d[8],y="parent"===h?e(this).text().replace(/!$/,""):"seq"!==p&&"ctc_delete_query_selector"===n?"":e(this).val(),v="seq"===p?!1:"ctc_"+u+"_child_"+p+"_i_"+g+"_"+m;if("child"===h&&(c.is_empty(e(this).data("color"))||(y=c.color_text(e(this).data("color")),e(this).data("color",null)),_[i]=y,v&&(_[v]=e("#"+v).is(":checked")?1:0)),""!==y)if(c.is_empty(f))if(t=p.toString().match(/^border(\-(top|right|bottom|left))?$/)&&!y.match(/none/)){var w=new RegExp(c.border_regx+c.color_regx,"i");s=y.toString().match(w),c.is_empty(s)||(s.shift(),l[h][p+"-width"]=s.shift()||"",s.shift(),l[h][p+"-style"]=s.shift()||"",l[h][p+"-color"]=s.shift()||"")}else if("background-image"!==p||y.match(/none/))"seq"!==p&&(l[h][p]=y);else if(y.toString().match(/url\(/))l[h]["background-image"]=c.image_url(h,y);else{var x=new RegExp(c.grad_regx+c.color_regx+c.color_regx,"i");s=y.toString().match(x),!c.is_empty(s)&&s.length>2?(s.shift(),r[h].origin=s.shift()||"top",r[h].start=s.shift()||"transparent",r[h].end=s.shift()||"transparent",o[h]=!0):l[h]["background-image"]=y}else switch(f){case"_border_width":l[h][p+"-width"]="none"===y?0:y;break;case"_border_style":l[h][p+"-style"]=y;break;case"_border_color":l[h][p+"-color"]=y;break;case"_background_url":l[h]["background-image"]=c.image_url(h,y);break;case"_background_color":l[h]["background-color"]=y;break;case"_background_color1":r[h].start=y,o[h]=!0;break;case"_background_color2":r[h].end=y,o[h]=!0;break;case"_background_origin":r[h].origin=y,o[h]=!0}}),"undefined"==typeof i||c.is_empty(i.attr("id"))||(i.removeAttr("style"),o.parent&&i.ctcgrad(r.parent.origin,[r.parent.start,r.parent.end]),i.css(l.parent),i.attr("id").toString().match(/parent/)||(o.child&&i.ctcgrad(r.child.origin,[r.child.start,r.child.end]),i.css(l.child)),i.css({"z-index":-1})),_},decode_value:function(e,t){t="undefined"==typeof t?"":t;var c,n=this,a={orig:t,names:[""],values:[t]};if(e.toString().match(/^border(\-(top|right|bottom|left))?$/)){var s,i=new RegExp(n.border_regx+"("+n.color_regx+")?","i");c=t.toString().match(i),n.is_empty(c)&&(c=[]),a.names=["_border_width","_border_style","_border_color"],s=c.shift(),a.values[0]=c.shift()||"",c.shift(),a.values[1]=c.shift()||"",c.shift(),a.values[2]=c.shift()||""}else if(e.toString().match(/^background\-image/))if(a.names=["_background_url","_background_origin","_background_color1","_background_color2"],a.values=["","","",""],n.is_empty(t)||t.toString().match(/(url|none)/))a.values[0]=t;else{var l,r;c=t.toString().split(/:/),a.values[1]=c.shift()||"",a.values[2]=c.shift()||"",l=c.shift()||"",a.values[3]=c.shift()||"",r=c.shift()||"",a.orig=[a.values[1],a.values[2],a.values[3]].join(" ")}return a},image_url:function(e,t){var c,n=this,a=t.toString().match(/url\(['" ]*(.+?)['" ]*\)/),s=n.is_empty(a)?null:a[1],i=window.ctcAjax.theme_uri+"/"+("parent"===e?window.ctcAjax.parnt:window.ctcAjax.child)+"/";return s?c=s.toString().match(/^(data:|https?:|\/)/)?t:"url("+i+s+")":!1},setup_menus:function(){var e=this;e.setup_query_menu(),e.setup_selector_menu(),e.setup_rule_menu(),e.setup_new_rule_menu(),e.load_queries(),e.load_rules(),e.set_query(e.currquery)},load_queries:function(){var e=this;e.query_css("queries",null)},load_selectors:function(){var e=this;e.query_css("selectors",e.currquery)},load_rules:function(){var e=this;e.query_css("rules",null)},load_selector_values:function(){var e=this;e.query_css("qsid",e.currqsid)},get_queries:function(t,c){var n=[],a=new RegExp(e.ui.autocomplete.escapeRegex(t.term),"i");e.chldthmcfg.is_empty(this.element.data("menu"))?n.push({label:window.ctcAjax.nosels_txt,value:null}):e.each(this.element.data("menu"),function(e,t){a.test(t)&&n.push({label:t,value:t})}),c(n)},get_selectors:function(t,c){var n=[],a=new RegExp(e.ui.autocomplete.escapeRegex(t.term),"i");e.chldthmcfg.is_empty(this.element.data("menu"))?n.push({label:window.ctcAjax.nosels_txt,value:null}):e.each(this.element.data("menu"),function(e,t){a.test(e)&&n.push({label:e,value:t})}),c(n)},get_rules:function(t,c){var n=[],a=new RegExp(e.ui.autocomplete.escapeRegex(t.term),"i");e.chldthmcfg.is_empty(this.element.data("menu"))?n.push({label:window.ctcAjax.nosels_txt,value:null}):e.each(this.element.data("menu"),function(e,t){a.test(e)&&n.push({label:e,value:t})}),c(n)},get_filtered_rules:function(t,c){var n=[],a=new RegExp(e.ui.autocomplete.escapeRegex(t.term),"i");e.each(e("#ctc_rule_menu").data("menu"),function(e,t){a.test(e)&&n.push({label:e,value:t})}),c(n)},merge_ruleval_arrays:function(t,c,n){var a=this,s={},i=n?c.child.pop():null;return e.each(["parnt","child"],function(t,l){a.is_empty(c[l])||e.each(c[l],function(e,t){n?parseInt(t[2])>=parseInt(i[2])&&(i[2]=parseInt(t[2])+1):(a.is_empty(s[t[2]])&&(s[t[2]]={}),s[t[2]][l]=t)})}),n&&(s[i[2]]={parnt:[],child:i}),s},input_row:function(t,c,n,a,s){var i=this,l="";if(!i.is_empty(a)&&!i.is_empty(a.value)&&!i.is_empty(a.value[c])){var r=a.value[c],o=i.merge_ruleval_arrays(c,r,s);e.each(o,function(s,r){var o=i.decode_value(c,i.is_empty(r.parnt)?"":r.parnt[0]),_=i.is_empty(r.parnt)||i.is_empty(r.parnt[1],1)?0:1,d=i.decode_value(c,i.is_empty(r.child)?"":r.child[0]),u=i.is_empty(r.child)||i.is_empty(r.child[1],1)?0:1;if(l+='<div class="ctc-'+("ovrd"===n?"input":"selector")+'-row clearfix"><div class="ctc-input-cell">',l+="ovrd"===n?c.replace(/\d+/g,i.frascii):a.selector+'<br/><a href="#" class="ctc-selector-edit" id="ctc_selector_edit_'+t+'" >'+i.getxt("edit")+"</a> "+(i.is_empty(o.orig)?i.getxt("child_only"):""),l+='</div><div class="ctc-parent-value ctc-input-cell"'+("ovrd"!==n?' style="display:none"':"")+' id="ctc_'+n+"_parent_"+c+"_"+t+"_"+s+'">'+(i.is_empty(o.orig)?"[no value]":o.orig+(_?i.getxt("important"):""))+'</div><div class="ctc-input-cell">',!i.is_empty(o.names)){e.each(o.names,function(e,a){a=i.is_empty(a)?"":a,l+='<div class="ctc-child-input-cell ctc-clear">';var r,o="ctc_"+n+"_child_"+c+"_"+t+"_"+s+a;!1===(r=d.values.shift())&&(r=""),l+=(i.is_empty(a)?"":i.getxt(a)+":<br/>")+'<input type="text" id="'+o+'" name="'+o+'" class="ctc-child-value'+((a+c).toString().match(/color/)?" color-picker":"")+(a.toString().match(/url/)?" ctc-input-wide":"")+'" value="'+i.escquo(r)+'" /></div>'});var h="ctc_"+n+"_child_"+c+"_i_"+t+"_"+s;l+='<label for="'+h+'"><input type="checkbox" id="'+h+'" name="'+h+'" value="1" '+(u?"checked":"")+" />"+i.getxt("important")+"</label>"}l+="</div>","ovrd"!==n&&(l+='<div class="ctc-swatch ctc-specific" id="ctc_child_'+c+"_"+t+"_"+s+'_swatch">'+i.getxt("swatch")+'</div><div class="ctc-child-input-cell ctc-button-cell" id="ctc_save_'+c+"_"+t+"_"+s+'_cell"><input type="button" class="button ctc-save-input" id="ctc_save_'+c+"_"+t+"_"+s+'" name="ctc_save_'+c+"_"+t+"_"+s+'" value="Save" /></div>'),l+="</div><!-- end input row -->\n"})}return l},scrolltop:function(){e("html, body, .ctc-option-panel-container").animate({scrollTop:0})},css_preview:function(e){var t=this;(e=e.match(/(child|parnt)/)[1])||(e="child"),t.query_css("preview",e)},setup_iris:function(e){var t=this;t.setup_spectrum(e)},setup_spectrum:function(t){var c=this,n=!c.is_empty(window.ctcAjax.palette);try{e(t).spectrum({showInput:!0,allowEmpty:!0,showAlpha:!0,showInitial:!0,preferredFormat:"hex",clickoutFiresChange:!0,move:function(n){e(t).data("color",n),c.coalesce_inputs(t)},showPalette:!!n,showSelectionPalette:!!n,palette:[],maxSelectionSize:36,localStorageKey:"ctc-palette."+window.ctcAjax.child,hideAfterPaletteSelect:!0}).on("change",function(){c.coalesce_inputs(this)}).on("keyup",function(){var t=this,n=c.addhash(e(this).val());e(t).val(n),clearTimeout(e(this).data("spectrumTimer")),e(this).data("spectrumTimer",setTimeout(function(){c.coalesce_inputs(t),e(t).spectrum("set",n)},500))})}catch(a){c.jquery_exception(a,"Spectrum Color Picker")}},addhash:function(e){return e.replace(/^#?([a-f0-9]{3,6}.*)/,"#$1")},color_text:function(e){var t=this;return t.is_empty(e)?"":e.getAlpha()<1?e.toRgbString():e.toHexString()},setup_query_menu:function(){var t=this;try{e("#ctc_sel_ovrd_query").autocomplete({source:t.get_queries,minLength:0,selectFirst:!0,autoFocus:!0,select:function(c,n){return e("#ctc_rewrite_query").length?(e("#ctc_rewrite_query").val(n.item.value),e("#ctc_sel_ovrd_query").val("")):(t.set_query(n.item.value),t.reset_qsid()),!1},focus:function(e){e.preventDefault()}}).data("menu",{})}catch(c){t.jquery_exception(c,"Query Menu")}},setup_selector_menu:function(){var t=this;try{e("#ctc_sel_ovrd_selector").autocomplete({source:t.get_selectors,selectFirst:!0,autoFocus:!0,select:function(c,n){return e("#ctc_rewrite_selector").length?(e("#ctc_rewrite_selector").val(n.item.label),e("#ctc_sel_ovrd_selector").val("")):t.set_selector(n.item.value,n.item.label),!1},focus:function(e){e.preventDefault()}}).data("menu",{})}catch(c){t.jquery_exception(c,"Selector Menu")}},setup_rule_menu:function(){var t=this;try{e("#ctc_rule_menu").autocomplete({source:t.get_rules,selectFirst:!0,autoFocus:!0,select:function(e,c){return t.set_rule(c.item.value,c.item.label),!1},focus:function(e){e.preventDefault()}}).data("menu",{})}catch(c){t.jquery_exception(c,"Property Menu")}},setup_new_rule_menu:function(){var t=this;try{e("#ctc_new_rule_menu").autocomplete({source:t.get_filtered_rules,selectFirst:!0,autoFocus:!0,select:function(c,n){c.preventDefault();var a,s,i=n.item.label.replace(/[^\w\-]/g,t.toascii);return t.is_empty(t.currdata.value)&&(t.currdata.value={}),t.is_empty(t.currdata.value[n.item.label])&&(t.currdata.value[n.item.label]={}),t.is_empty(t.currdata.value[n.item.label].child)&&(t.currdata.value[n.item.label].child=[]),t.currdata.value[n.item.label].child.push(["",0,1,1]),a=e(t.input_row(t.currqsid,i,"ovrd",t.currdata,!0)),e("#ctc_sel_ovrd_rule_inputs").append(a),e("#ctc_new_rule_menu").val(""),a.find('input[type="text"]').each(function(c,n){s||(s=n),e(n).hasClass("color-picker")&&t.setup_spectrum(n)}),s&&e(s).focus(),!1},focus:function(e){e.preventDefault()}}).data("menu",{})}catch(c){t.jquery_exception(c,"New Property Menu")}},set_theme_params:function(t,c){e("#ctc_child_author").val(window.ctcAjax.themes[t][c].Author),e("#ctc_child_version").val(window.ctcAjax.themes[t][c].Version),e("#ctc_child_authoruri").val(window.ctcAjax.themes[t][c].AuthorURI),e("#ctc_child_themeuri").val(window.ctcAjax.themes[t][c].ThemeURI),e("#ctc_child_descr").val(window.ctcAjax.themes[t][c].Descr),e("#ctc_child_tags").val(window.ctcAjax.themes[t][c].Tags)},update_form:function(){var t,c=this;e("#input_row_stylesheet_handling_container,#input_row_parent_handling_container,#ctc_additional_css_files_container,#input_row_new_theme_slug,#input_row_duplicate_theme_slug,#ctc_copy_theme_mods,#ctc_child_header_parameters,#ctc_configure_submit,#input_row_theme_slug").slideUp("fast"),e("#ctc_configure_submit .ctc-step").text("9"),e("#ctc_theme_child").length&&!e("#ctc_child_type_new").is(":checked")?(t=e("#ctc_theme_child").val(),c.existing=1,c.currparnt=window.ctcAjax.themes.child[t].Template,c.autogen_slugs(),e("#ctc_theme_parnt").val(c.currparnt),e("#ctc_theme_parnt-button .ui-selectmenu-text").text(c.getname("parnt")),c.set_theme_params("child",t),e("#ctc_child_type_duplicate").is(":checked")?(e("#ctc_child_template").val(c.testslug),e("#ctc_child_name").val(c.testname),e(".ctc-analyze-theme, .ctc-analyze-howto").show(),e("#ctc_load_styles").val("Duplicate Child Theme")):e("#ctc_child_type_reset").is(":checked")?(e("#ctc_configure_submit .ctc-step").text("3"),e("#ctc_configure_submit").slideDown("fast"),e("#theme_slug_container").text(t),e(".ctc-analyze-theme, .ctc-analyze-howto").hide(),e("#ctc_enqueue_none").prop("checked",!0),e("#ctc_load_styles").val("Reset Child Theme to Previous State")):(e("#ctc_child_template").val(""),e("#theme_slug_container").text(t),e(".ctc-analyze-theme, .ctc-analyze-howto").show(),e("#ctc_child_name").val(c.getname("child")),e("#ctc_load_styles").val("Configure Child Theme")),e("#input_row_existing_theme_option").slideDown("fast"),e("#input_row_new_theme_option").slideUp("fast")):(c.existing=0,c.autogen_slugs(),e("#ctc_theme_parnt").val(c.currparnt),e("#ctc_theme_parnt-button .ui-selectmenu-text").text(e.chldthmcfg.getname("parnt")),c.set_theme_params("parnt",c.currparnt),e("#input_row_existing_theme_option,#input_row_duplicate_theme_container,#input_row_theme_slug").slideUp("fast"),e("#input_row_new_theme_option").slideDown("fast"),e("#ctc_child_name").val(c.testname),e("#ctc_child_template").val(c.testslug),e(".ctc-analyze-theme, .ctc-analyze-howto").show(),e("#ctc_load_styles").val("Create New Child Theme"))},set_notice:function(t){var c,n=this,a="";n.is_empty(t)||e.each(t,function(t,c){a+='<div class="'+t+' notice is-dismissible dashicons-before"><ul>\n',e(c).each(function(e,t){a+="<li>"+t.toString()+"</li>\n"}),a+="</ul></div>"}),c=e(a),e("#ctc_error_notice").html(c),n.bind_dismiss(c),e("html, body").animate({scrollTop:0},"slow")},set_parent_menu:function(e){var t=this;t.currparnt=e.value,t.update_form()},set_child_menu:function(e){var t=this;t.currchild=e.value,t.update_form()},set_query:function(t){var c=this;return c.is_empty(t)?!1:(c.currquery=t,e("#ctc_sel_ovrd_query").val(""),e("#ctc_sel_ovrd_query_selected").text(t),e("#ctc_sel_ovrd_selector").val(""),e("#ctc_sel_ovrd_selector_selected").html("&nbsp;"),c.load_selectors(),void c.scrolltop())},reset_qsid:function(){self.currqsid=null,e("#ctc_sel_ovrd_rule_inputs").empty(),e("#ctc_sel_ovrd_new_rule,#input_row_load_order,#ctc_sel_ovrd_rule_inputs_container").hide().find(".ctc-child-value").remove(),e(".ctc-rewrite-toggle").hide()},set_selector:function(t,c){var n=this;return c=null,n.is_empty(t)?!1:(e("#ctc_sel_ovrd_selector").val(""),n.currqsid=t,n.reload=!1,n.load_selector_values(),void n.scrolltop())},set_rule:function(t,c){var n=this;return n.is_empty(t)?!1:(e("#ctc_rule_menu").val(""),e("#ctc_rule_menu_selected").text(c),e(".ctc-rewrite-toggle").text(n.getxt("rename")),e("#ctc_rule_value_inputs, #ctc_input_row_rule_header").show(),n.query_css("rule_val",t),void n.scrolltop())},set_qsid:function(t){var c=this;c.currqsid=e(t).attr("id").match(/_(\d+)$/)[1],c.focus_panel("#query_selector_options"),c.reload=!0,c.load_selector_values()},query_css:function(t,c,n){var a=this,s={ctc_query_obj:t,ctc_query_key:c},i="#ctc_status_"+t+("val_qry"===t?"_"+c:"");"object"==typeof n&&e.each(n,function(e,t){s["ctc_query_"+e]=t}),e(".query-icon,.ctc-status-icon").remove(),e(i+" .ctc-status-icon").remove(),e(i).append('<span class="ctc-status-icon spinner is-active query-icon"></span>'),s.action=a.is_empty(e("#ctc_action").val())||"plugin"!==e("#ctc_action").val()?"ctc_query":"ctc_plgqry",s._wpnonce=e("#_wpnonce").val(),a.ajax_post(t,s)},save:function(t){var c,n,a,s,i,l=this,r={},o=e(t).attr("id");e(t).prop("disabled",!0),e(".ctc-query-icon,.ctc-status-icon").remove(),e(t).parent(".ctc-textarea-button-cell, .ctc-button-cell").append('<span class="ctc-status-icon spinner save-icon"></span>'),o.match(/ctc_configtype/)?(e(t).parents(".ctc-input-row").first().append('<span class="ctc-status-icon spinner save-icon"></span>'),r.ctc_configtype=e(t).val()):(c=e("#ctc_new_selectors"))&&"ctc_save_new_selectors"===e(t).attr("id")?(r.ctc_new_selectors=c.val(),(n=e("#ctc_sel_ovrd_query_selected"))&&(r.ctc_sel_ovrd_query=n.text()),l.reload=!0):(a=e("#ctc_child_imports"))&&"ctc_save_imports"===o?r.ctc_child_imports=a.val():"ctc_is_debug"===o?r.ctc_is_debug=e("#ctc_is_debug").is(":checked")?1:0:r=l.coalesce_inputs(t),e(".save-icon").addClass("is-active"),e.each(["query","selector"],function(t,c){e("#ctc_rewrite_"+c).length&&(s=e("#ctc_rewrite_"+c).val(),i=e("#ctc_rewrite_"+c+"_orig").val(),l.is_empty(s)||!s.toString().match(/\w/)?s=i:(r["ctc_rewrite_"+c]=s,l.reload=!0),e("#ctc_sel_ovrd_"+c+"_selected").html(s)),e(".ctc-rewrite-toggle").text(l.getxt("rename"))}),r.action=l.is_empty(e("#ctc_action").val())||"plugin"!==e("#ctc_action").val()?"ctc_update":"ctc_plugin",r._wpnonce=e("#_wpnonce").val(),l.ajax_post("qsid",r)},ajax_post:function(t,c,n){var a=this;e.ajax({url:window.ctcAjax.ajaxurl,data:c,dataType:a.is_empty(n)?"json":n,type:"POST"}).done(function(e){a.handle_success(t,e)}).fail(function(){a.handle_failure(t)}).always(function(){a.jqueryerr.length&&a.jquery_notice()})},handle_failure:function(t){var c=this;e(".query-icon, .save-icon").removeClass("spinner").addClass("failure"),e("input[type=submit], input[type=button], input[type=checkbox],.ctc-delete-input").prop("disabled",!1),e(".ajax-pending").removeClass("ajax-pending"),"preview"===t&&e("#view_parnt_options_panel,#view_child_options_panel").text(c.getxt("css_fail"))},handle_success:function(t,c){var n=this;e(".query-icon, .save-icon").removeClass("spinner"),e(".ajax-pending").removeClass("ajax-pending"),n.is_empty(c)?n.handle_failure(t):(e("#ctc_new_selectors").val(""),e(".query-icon, .save-icon").addClass("success"),e("input[type=submit], input[type=button], input[type=checkbox],.ctc-delete-input").prop("disabled",!1),e(c).each(function(){"function"==typeof n.update[this.obj]&&n.update[this.obj].call(n,this)}))},jquery_exception:function(e,t){var c=this,n=c.is_empty(e.lineNumber)?"":" line: "+e.lineNumber,a=c.is_empty(e.fileName)?"":" "+e.fileName.split(/\?/)[0];c.jqueryerr.push("<code><small>"+t+": "+e.message+a+n+"</small></code>")},jquery_notice:function(t){t=null;var c=this,n=[],a=[];c.jqueryerr.length&&(e("input[type=submit], input[type=button]").prop("disabled",!0),e("script").each(function(){var t=e(this).prop("src");c.is_empty(t)||!t.match(/jquery(\.min|\.js|\-?ui)/i)||t.match(/load\-scripts.php/)||n.push("<code><small>"+t.split(/\?/)[0]+"</small></code>")}),a.push("<strong>"+c.getxt("js")+"</strong> "+c.getxt("contact")),a.push(c.jqueryerr.join("<br/>")),n.length&&a.push(c.getxt("jquery")+"<br/>"+n.join("<br/>")),a.push(c.getxt("plugin"))),c.set_notice({error:a})},update:{qsid:function(t){var c,n,a,s,i=this;i.currqsid=t.key,i.currdata=t.data,e("#ctc_sel_ovrd_qsid").val(i.currqsid),i.is_empty(i.currdata.seq)?e("#ctc_child_load_order_container").empty():(c="ctc_ovrd_child_seq_"+i.currqsid,a=parseInt(i.currdata.seq),n='<input type="text" id="'+c+'" name="'+c+'" class="ctc-child-value" value="'+a+'" />',e("#ctc_child_load_order_container").html(n)),i.is_empty(i.currdata.value)?(s=!0,e("#ctc_sel_ovrd_rule_inputs").empty(),i.load_selectors()):(s=!1,n="",e.each(i.currdata.value,function(e,t){t=null,n+=i.input_row(i.currqsid,e,"ovrd",i.currdata)}),e("#ctc_sel_ovrd_rule_inputs").html(n).find(".color-picker").each(function(){i.setup_spectrum(this)}),i.coalesce_inputs("#ctc_child_all_0_swatch")),i.reload&&(i.load_queries(),i.load_selectors(),i.set_query(i.currdata.query),i.load_rules()),e("#ctc_sel_ovrd_selector_selected").text(i.currdata.selector),i.maybe_show_rewrite(),s?i.reset_qsid():e("#ctc_sel_ovrd_rule_header,#ctc_sel_ovrd_new_rule,#ctc_sel_ovrd_rule_inputs_container,#ctc_sel_ovrd_rule_inputs,#input_row_load_order").fadeIn()},rule_val:function(t){var c=this,n=e("#ctc_rule_menu_selected").text(),a='<div class="ctc-input-row clearfix" id="ctc_rule_row_'+n+'">\n';c.is_empty(t.data)||(e.each(t.data,function(e,t){var s=c.decode_value(n,t);a+='<div class="ctc-parent-row clearfix" id="ctc_rule_row_'+n+"_"+e+'">\n<div class="ctc-input-cell ctc-parent-value" id="ctc_'+e+"_parent_"+n+"_"+e+'">'+s.orig+'</div>\n<div class="ctc-input-cell">\n<div class="ctc-swatch ctc-specific" id="ctc_'+e+"_parent_"+n+"_"+e+'_swatch">'+c.getxt("swatch")+'</div></div>\n<div class="ctc-input-cell"><a href="#" class="ctc-selector-handle" id="ctc_selector_'+n+"_"+e+'">'+c.getxt("selector")+'</a></div>\n<div id="ctc_selector_'+n+"_"+e+'_container" class="ctc-selector-container">\n<a href="#" id="ctc_selector_'+n+"_"+e+'_close" class="ctc-selector-handle ctc-exit" title="'+c.getxt("close")+'"></a><div id="ctc_selector_'+n+"_"+e+'_inner_container" class="ctc-selector-inner-container clearfix">\n<div id="ctc_status_val_qry_'+e+'"></div>\n<div id="ctc_selector_'+n+"_"+e+'_rows"></div>\n</div></div></div>\n'}),a+="</div>\n"),e("#ctc_rule_value_inputs").html(a).find(".ctc-swatch").each(function(){c.coalesce_inputs(this)})},val_qry:function(t){var c,n,a=this,s="";a.is_empty(t.data)||e.each(t.data,function(n,i){c=n,e.each(i,function(c,i){s+='<h4 class="ctc-query-heading">'+c+"</h4>\n",a.is_empty(i)||e.each(i,function(e,c){s+=a.input_row(e,n,t.key,c)})})}),n="#ctc_selector_"+c+"_"+t.key+"_rows",e(n).html(s).find(".color-picker").each(function(){a.setup_spectrum(this)}),e(n).find(".ctc-swatch").each(function(){a.coalesce_inputs(this)})},queries:function(t){e("#ctc_sel_ovrd_query").data("menu",t.data)},selectors:function(t){e("#ctc_sel_ovrd_selector").data("menu",t.data)},rules:function(t){e("#ctc_rule_menu").data("menu",t.data)},debug:function(t){e("#ctc_debug_box").val(e("#ctc_debug_box").val()+t.data)},preview:function(t){e("#view_"+t.key+"_options_panel").text(t.data)},dismiss:function(){}},bind_dismiss:function(t){var c=this,n=e(t),a=e('<button type="button" class="notice-dismiss"><span class="screen-reader-text"></span></button>'),s=window.commonL10n.dismiss||"";a.find(".screen-reader-text").text(s),n.append(a),a.on("click.wp-dismiss-notice",function(e){e.preventDefault(),c.dismiss_notice(t)})},dismiss_notice:function(t){e(t).fadeTo(100,0,function(){e(this).slideUp(100,function(){e(this).remove()})})},reset_handling:function(){e("#parnt_analysis_notice .notice, #child_analysis_notice .notice").slideUp(),e("#ctc_enqueue_enqueue").prop("checked",!0),e("#ctc_handling_primary").prop("checked",!0),e("#ctc_ignoreparnt").prop("checked",!1),e("#ctc_repairheader").prop("checked",!1)},init:function(){var t=this;if(!e("#ctc_theme_parnt").is("input")){try{e.widget("ctc.themeMenu",e.ui.selectmenu,{_renderItem:function(t,c){var n=e("<li>"),a=c.value.replace(/[^\w\-]/g,"");return e("#ctc_theme_option_"+a).detach().appendTo(n),n.appendTo(t)}})}catch(c){t.jquery_exception(c,"Theme Menu")}try{e("#ctc_theme_parnt").themeMenu({select:function(e,c){t.reset_handling(),t.set_parent_menu(c.item)}})}catch(c){"function"==typeof themeMenu?e("#ctc_theme_parnt").themeMenu("destroy"):e("#ctc_theme_parnt-button").remove(),t.jquery_exception(c,"Parent Theme Menu")}if(t.is_empty(window.ctcAjax.themes.child))e("#ctc_child_name").length&&(e("#ctc_child_name").val(t.testname),e("#ctc_child_template").val(t.testslug));else try{e("#ctc_theme_child").themeMenu({select:function(e,c){t.reset_handling(),t.set_child_menu(c.item)}})}catch(c){"function"==typeof themeMenu?e("#ctc_theme_child").themeMenu("destroy"):e("#ctc_theme_child-button").remove(),t.jquery_exception(c,"Child Theme Menu")}}t.currparnt=e("#ctc_theme_parnt").val(),t.currchild=e("#ctc_theme_child").length?e("#ctc_theme_child").val():"",e("#ctc_main").on("click",".ctc-section-toggle",function(t){t.preventDefault(),e(this).parents(".ctc-input-row, .notice-warning, .updated, .error").first().find(".ctc-section-toggle").each(function(){e(this).toggleClass("open")});var c=e(this).attr("id").replace(/\d$/,"")+"_content";return e("#"+c).stop().slideToggle("fast"),!1}),e("#ctc_main").on("click",".ctc-upgrade-notice .notice-dismiss",function(){var c={action:"ctc_dismiss",_wpnonce:e("#_wpnonce").val()};t.ajax_post("dismiss",c)}),t.is_empty(t.jqueryerr)&&(e("#ctc_main").on("click",".ctc-selector-handle",function(c){if(c.preventDefault(),e(this).hasClass("ajax-pending"))return!1;e(this).addClass("ajax-pending");var n,a,s=e(this).attr("id").toString().replace("_close",""),i=s.toString().match(/_([^_]+)_(\d+)$/);e("#"+s+"_container").is(":hidden")&&(t.is_empty(i[1])||t.is_empty(i[2])||(n=i[1],a=i[2],t.query_css("val_qry",a,{rule:n}))),e("#"+s+"_container").fadeToggle("fast"),e(".ctc-selector-container").not("#"+s+"_container").fadeOut("fast")}),e("#ctc_main").on("click",".ctc-save-input[type=button], .ctc-delete-input",function(c){return c.preventDefault(),e(this).hasClass("ajax-pending")?!1:(e(this).addClass("ajax-pending"),t.save(this),!1)}),e("#ctc_main").on("keydown",".ctc-selector-container .ctc-child-value[type=text]",function(c){if(13===c.which){var n=e(this).parents(".ctc-selector-row").find(".ctc-save-input[type=button]").first();if(n.length)return c.preventDefault(),n.hasClass("ajax-pending")?!1:(n.addClass("ajax-pending"),t.save(n),!1)}}),e("#ctc_main").on("click",".ctc-selector-edit",function(c){return c.preventDefault(),e(this).hasClass("ajax-pending")?!1:(e(this).addClass("ajax-pending"),void t.set_qsid(this))}),e("#ctc_main").on("click",".ctc-rewrite-toggle",function(e){e.preventDefault(),t.selector_input_toggle(this)}),e("#ctc_main").on("click","#ctc_copy_selector",function(){var c=e("#ctc_sel_ovrd_selector_selected").text().trim();t.is_empty(c)||e("#ctc_new_selectors").val(e("#ctc_new_selectors").val()+"\n"+c+" {\n\n}")}),e("#ctc_main").on("click",".ctc-backup-theme",function(c){c.preventDefault(),t.existing?e("#ctc_export_theme").val(t.currchild):e("#ctc_export_theme").val(t.currparnt),e("#ctc_export_theme_form").submit()}),e("#ctc_configtype").on("change",function(){var c=e(this).val();if(t.is_empty(c)||"theme"===c){e(".ctc-theme-only, .ctc-themeonly-container").removeClass("ctc-disabled"),e(".ctc-theme-only, .ctc-themeonly-container input").prop("disabled",!1);try{e("#ctc_theme_parnt, #ctc_theme_child").themeMenu("enable")}catch(n){t.jquery_exception(n,"Theme Menu")}}else{e(".ctc-theme-only, .ctc-themeonly-container").addClass("ctc-disabled"),e(".ctc-theme-only, .ctc-themeonly-container input").prop("disabled",!0);try{e("#ctc_theme_parnt, #ctc_theme_child").themeMenu("disable")}catch(n){t.jquery_exception(n,"Theme Menu")}}}),e(".nav-tab").on("click",function(c){if(c.preventDefault(),e(c.target).hasClass("ctc-disabled"))return!1;e(".ctc-query-icon,.ctc-status-icon").remove();var n="#"+e(this).attr("id");t.focus_panel(n)}),e("#view_child_options, #view_parnt_options").on("click",function(c){return e(c.target).hasClass("ajax-pending")||e(c.target).hasClass("ctc-disabled")?!1:(e(c.target).addClass("ajax-pending"),void t.css_preview(e(this).attr("id")))}),e("#ctc_load_form").on("submit",function(){return t.validate()}),e("#ctc_query_selector_form").on("submit",function(c){c.preventDefault();var n=e("#ctc_save_query_selector");return n.hasClass("ajax-pending")?!1:(n.addClass("ajax-pending"),t.save(n),!1)}),e("#ctc_rule_value_form").on("submit",function(e){return e.preventDefault(),!1}),e("#ctc_child_type_new,#ctc_child_type_existing,#ctc_child_type_duplicate,#ctc_child_type_reset").on("focus click",function(){t.reset_handling(),t.update_form()}),e("#ctc_is_debug").on("change",function(){e(this).is(":checked")?e("#ctc_debug_box").length||e("#ctc_debug_container").html('<textarea id="ctc_debug_box"></textarea>'):e("#ctc_debug_box").remove(),t.save(this)}),e(".ctc-live-preview").on("click",function(t){return t.stopImmediatePropagation(),t.preventDefault(),document.location=e(this).prop("href"),!1}),t.setup_menus(),e("input[type=submit], input[type=button]").prop("disabled",!1),t.scrolltop(),t.update_form()),t.jqueryerr.length&&t.jquery_notice()},testslug:"",testname:"",reload:!1,currquery:"base",currqsid:null,currdata:{},currparnt:"",currchild:"",existing:!1,jqueryerr:[],color_regx:"\\s+(\\#[a-f0-9]{3,6}|rgba?\\([\\d., ]+?\\)|hsla?\\([\\d%., ]+?\\)|[a-z]+)",border_regx:"(\\w+)(\\s+(\\w+))?",grad_regx:"(\\w+)"},e.chldthmanalyze={escrgx:function(e){return e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1")},trmcss:function(e){return"undefined"==typeof e?"":e.replace(/\-css$/,"")},show_loading:function(t,c){var n=e.chldthmcfg.existing?"child":"parnt",a=c?c:e.chldthmcfg.getname(n),s='<strong class="ctc_analyze_loading"><span class="spinner is-active"></span>'+e.chldthmcfg.getxt(t?"anlz1":"anlz2")+" "+a+"...</strong>";self.noticediv="",e("#"+n+"_analysis_notice").html(s)},hide_loading:function(){e(".ctc_analyze_loading").fadeTo(200,0,function(){e(this).slideUp(200,function(){e(this).remove()})})},setssl:function(e){return e.replace(/^https?/,window.ctcAjax.ssl?"https":"http")},analyze_theme:function(t){var c=this,n=Math.floor(e.now()/1e3),a="child"===t?e.chldthmcfg.currchild:e.chldthmcfg.currparnt,s="&template="+encodeURIComponent(e.chldthmcfg.currparnt)+"&stylesheet="+encodeURIComponent(a)+"&now="+n,i=c.setssl(window.ctcAjax.homeurl),l=i+s;c.analysis[t].url=l,e.get(l,function(n){c.parse_page(t,n),e(document).trigger("analysisdone")}).fail(function(n,s,i){c.analysis[t].signals.xhrgeterr=i,e.ajax({url:window.ctcAjax.ajaxurl,data:{action:"ctc_analyze",stylesheet:a,template:e.chldthmcfg.currparnt,
2
- _wpnonce:e("#_wpnonce").val()},dataType:"json",type:"POST"}).done(function(n){n.signals.httperr?(c.analysis[t].signals.failure=1,c.analysis[t].signals.httperr=n.signals.httperr):c.parse_page(t,n.body),e(document).trigger("analysisdone")}).fail(function(n,a,s){c.analysis[t].signals.failure=1,c.analysis[t].signals.xhrajaxerr=s,e(document).trigger("analysisdone")})})},parse_page:function(t,c){var n,a,s,i=this,l=window.ctcAjax.theme_dir,r="child"===t?e.chldthmcfg.currchild:e.chldthmcfg.currparnt,o=i.escrgx(e.chldthmcfg.currparnt)+("child"===t?"|"+i.escrgx(r):""),_=new RegExp("<link( rel=[\"']stylesheet[\"'] id=['\"]([^'\"]+?)['\"])?[^>]+?"+i.escrgx(l)+"/("+o+")/([^\"']+\\.css)(\\?[^\"']+)?[\"'][^>]+>","gi"),d=/<br \/>\n[^\n]+?(fatal|strict|notice|warning|error)[\s\S]+?<br \/>/gi,u=0,h=0;if("child"===t){c.match(/^[\s\S]*?<head>([\s\S]*?)<\/head>/)}for((a=c.match(/BEGIN WP QUEUE\n([\s\S]*?)\nEND WP QUEUE/))?i.analysis[t].queue=a[1].split(/\n/):(i.analysis[t].queue=[],i.analysis[t].signals.thm_noqueue=1),(a=c.match(/BEGIN CTC IRREGULAR\n([\s\S]*?)\nEND CTC IRREGULAR/))?i.analysis[t].irreg=a[1].split(/\n/):i.analysis[t].irreg=[],c.match(/CHLD_THM_CFG_IGNORE_PARENT/)&&(i.analysis[t].signals.thm_ignoreparnt=1),c.match(/IS_CTC_THEME/)&&(i.analysis[t].signals.thm_is_ctc=1),c.match(/NO_CTC_STYLES/)&&(i.analysis[t].signals.thm_no_styles=1),c.match(/HAS_CTC_IMPORT/)&&(i.analysis[t].signals.thm_has_import=1),c.match(/HAS_WP_CACHE/)&&(i.analysis[t].signals.thm_has_cache=1),c.match(/HAS_WP_ROCKET/)&&(i.analysis[t].signals.thm_has_wprocket=1),c.match(/HAS_AUTOPTIMIZE/)&&(i.analysis[t].signals.thm_has_autoptimize=1),c=c.replace(/<!\-\-[\s\S]*?\-\->/g,"");n=d.exec(c);){var p=n[0].replace(/<.*?>/g,"");i.phperr[t].push(p),i.analysis[t].signals.err_php=1,p.match(/Fatal error/i)&&(i.analysis[t].signals.err_fatal=1)}for(;s=_.exec(c);){var m=i.trmcss(s[2]),g=s[3],f=s[4],y=e.chldthmcfg.currparnt===g?"parnt":"child",v=0;if(""===m||-1===i.analysis[t].queue.indexOf(m))v=1;else if(0===m.indexOf("chld_thm_cfg")){f.match(/^ctc\-style.*?\.css$/)?(u=1,i.analysis[t].signals.ctc_sep_loaded=1):f.match(/^ctc\-genesis([\-\.]min)?\.css$/)?(u=1,i.analysis[t].signals.ctc_gen_loaded=1):m.match(/^chld_thm_cfg_ext/)?f.match(/rtl.*?\.css$/)?i.analysis[t].signals.thm_rtl=1:(i.analysis[t].signals.ctc_ext_loaded=1,i.analysis[t].deps[u].push([m,f,y])):"chld_thm_cfg_child"===m?(i.analysis[t].signals.ctc_child_loaded=1,i.analysis[t].deps[u].push([m,f,y])):"chld_thm_cfg_parent"===m&&(i.analysis[t].signals.ctc_parnt_loaded=1,i.analysis[t].deps[u].push([m,f,y]),u&&(i.analysis[t].signals.ctc_parnt_reorder=1));continue}if(f.match(/^style.*?\.css$/))u=1,"parnt"===y?v?i.analysis[t].signals.thm_parnt_loaded="thm_unregistered":(i.analysis[t].signals.thm_parnt_loaded=m,"child"===t&&i.analysis[t].signals.thm_child_loaded&&(i.analysis[t].signals.ctc_parnt_reorder=1)):i.analysis[t].signals.thm_child_loaded=v?"thm_unregistered":m,v?h?(i.analysis[t].signals.thm_past_wphead=1,i.analysis[t].deps[u].push(["thm_past_wphead",f,y])):(i.analysis[t].signals.thm_unregistered=1,i.analysis[t].deps[u].push(["thm_unregistered",f,y])):i.analysis[t].deps[u].push([m,f,y]);else if(f.match(/rtl.*?\.css$/))i.analysis[t].signals.thm_rtl=1;else if("ctc-test.css"===f)h=1;else{var w=null;v&&(w="dep_unregistered"),h&&(w=u?"css_past_wphead":"dep_past_wphead"),w?(i.analysis[t].signals[w]=1,m=w):i.dependencies[m]=f,i.analysis[t].deps[u].push([m,f,y])}}u||(i.analysis[t].signals.thm_notheme=1)},css_notice:function(){var t,c,n=this,a=e.chldthmcfg.existing?"child":"parnt",s=e.chldthmcfg.getname(a),i="",l={notices:[]},r={style:"notice-warning",headline:e.chldthmcfg.getxt("anlz3",s),errlist:"",msg:e.chldthmcfg.getxt("anlz7")},o=0,_={},d="",u={};if(n.analysis[a].signals.failure||n.analysis[a].signals.thm_noqueue&&!n.phperr[a].length)d=e.chldthmcfg.getxt("anlz33").replace(/%1/,'<a href="'+n.analysis[a].url+'" target="_new">').replace(/%2/,"</a>"),l.notices.push({headline:e.chldthmcfg.getxt("anlz4",s),msg:e.chldthmcfg.getxt("anlz5")+d,style:"notice-warning"});else if(n.phperr[a].length&&(e.each(n.phperr[a],function(e,t){t.match(/Fatal error/i)&&(u.fatal=1),t.match(/Constant \w+ already defined in .+?wp-config.php/i)&&(u.config=1),r.errlist+=t+"\n"}),u.fatal&&(r.style="error",r.headline=e.chldthmcfg.getxt("anlz8",s)),u.config&&(r.msg=e.chldthmcfg.getxt("anlzconfig",s)+r.msg),r.msg='<div style="background-color:#ffeebb;padding:6px"><div class="ctc-section-toggle" id="ctc_analysis_errs">'+e.chldthmcfg.getxt("anlz6")+'</div><div id="ctc_analysis_errs_content"><textarea>'+r.errlist+"</textarea></div></div>"+r.msg,l.notices.push(r)),n.analysis[a].signals.thm_has_wprocket&&n.analysis[a].signals.thm_has_autoptimize)l.notices.push({headline:e.chldthmcfg.getxt("anlzcache1"),style:"notice-warning",msg:e.chldthmcfg.getxt("anlzcache2")});else if(!n.analysis[a].signals.thm_noqueue){if((n.analysis[a].signals.thm_past_wphead||n.analysis[a].signals.dep_past_wphead)&&(l.notices.push({headline:e.chldthmcfg.getxt("anlz9"),style:"notice-warning",msg:e.chldthmcfg.getxt("anlz10")}),e("#ctc_repairheader").prop("checked",!0),e("#ctc_repairheader_container").show()),n.analysis[a].signals.thm_unregistered&&(n.analysis[a].signals.ctc_child_loaded||n.analysis[a].signals.ctc_sep_loaded||(l.notices.push({headline:e.chldthmcfg.getxt("anlz11"),style:"notice-warning",msg:e.chldthmcfg.getxt("anlz12")}),e("#ctc_repairheader_container").show(),e("#ctc_repairheader").prop("checked",!0))),"child"===a&&(n.analysis.child.signals.ctc_parnt_reorder&&(o=1),n.analysis.child.signals.ctc_child_loaded||n.analysis.child.signals.ctc_sep_loaded||n.analysis.child.signals.thm_child_loaded||(l.notices.push({headline:e.chldthmcfg.getxt("anlz13"),style:"notice-warning",msg:e.chldthmcfg.getxt("anlz14")}),o=1),n.analysis[a].signals.ctc_gen_loaded&&l.notices.push({headline:e.chldthmcfg.getxt("anlz31"),msg:e.chldthmcfg.getxt("anlz32"),style:"notice-warning"}),n.analysis.parnt.signals.thm_no_styles||n.analysis.child.signals.ctc_gen_loaded||n.analysis.child.signals.thm_parnt_loaded||n.analysis.child.signals.ctc_parnt_loaded||n.analysis.child.signals.thm_ignoreparnt||n.analysis.child.signals.thm_has_import||(l.notices.push({headline:e.chldthmcfg.getxt("anlz15"),style:"notice-warning",msg:e.chldthmcfg.getxt("anlz16")}),o=1),n.analysis.child.signals.thm_unregistered&&n.analysis.child.signals.thm_child_loaded&&"thm_unregistered"===n.analysis.child.signals.thm_child_loaded&&n.analysis.child.signals.ctc_child_loaded&&n.analysis.child.signals.ctc_parnt_loaded&&(l.notices.push({headline:e.chldthmcfg.getxt("anlz28"),style:"notice-warning",msg:e.chldthmcfg.getxt("anlz29")}),e("#ctc_repairheader_container").show(),e("#ctc_repairheader").prop("checked",!0)),n.analysis.child.signals.thm_is_ctc||e("#ctc_child_type_duplicate").is(":checked")||l.notices.push({headline:e.chldthmcfg.getxt("anlz19"),msg:e.chldthmcfg.getxt("anlz20"),style:"notice-warning"})),"object"!=typeof window.ctcAjax.swappath&&(window.ctcAjax.swappath={}),e.each(n.analysis.parnt.deps[0],function(t,c){e.each(n.analysis.child.deps[0],function(e,t){t[0]===c[0]&&t[2]!==c[2]&&(n.analysis.parnt.swaps.push(t),window.ctcAjax.swappath[t[0]]=t[1],o=1)})}),(n.analysis[a].signals.ctc_sep_loaded||n.analysis[a].signals.ctc_gen_loaded)&&e("#ctc_handling_separate").prop("checked",!0),l.notices.length||l.notices.push({headline:""+("child"===a?e.chldthmcfg.getxt("anlz17"):e.chldthmcfg.getxt("anlz18")),style:"updated",msg:""}),"child"===a&&n.analysis.child.signals.thm_has_import&&(l.notices.push({headline:e.chldthmcfg.getxt("anlz21"),msg:e.chldthmcfg.getxt("anlz22"),style:"notice-warning"}),e("#ctc_enqueue_import").prop("checked",!0)),n.analysis[a].signals.thm_ignoreparnt||n.analysis[a].signals.ctc_gen_loaded?(e("#ctc_ignoreparnt").prop("checked",!0),e("#ctc_enqueue_none").is(":checked")||(e("#ctc_enqueue_none").prop("checked",!0),o=1,_.ctc_enqueue="none")):e("#ctc_ignoreparnt").prop("checked",!1),!n.analysis[a].signals.ctc_sep_loaded&&!n.analysis[a].signals.ctc_gen_loaded&&!n.analysis[a].signals.ctc_child_loaded&&!n.analysis[a].signals.thm_unregistered&&!n.analysis[a].signals.thm_past_wphead&&n.analysis[a].deps[1].length){var h="";e.each(n.analysis[a].deps[1],function(e,t){t[1].match(/^style.*?\.css$/)||(h+='<li class="code">'+t[1]+"</li>\n")}),""!==h&&(h="<ul class='howto' style='padding-left:1em'>\n"+h+"</ul>\n",l.notices.push({headline:e.chldthmcfg.getxt("anlz23"),msg:h+e.chldthmcfg.getxt("anlz24"),style:"updated"}))}"child"===a&&n.analysis[a].signals.thm_parnt_loaded&&(l.notices.push({headline:e.chldthmcfg.getxt("anlz25"),msg:e.chldthmcfg.getxt("anlz26"),style:"updated"}),e("#ctc_enqueue_none").prop("checked",!0),o=1,_.ctc_enqueue="none"),n.analysis.parnt.signals.thm_no_styles&&(l.notices.push({headline:e.chldthmcfg.getxt("anlz27"),msg:e.chldthmcfg.getxt("anlz26"),style:"updated"}),e("#ctc_enqueue_none").prop("checked",!0),o=1,_.ctc_enqueue="none")}return i=encodeURIComponent(JSON.stringify(n.analysis)),e('input[name="ctc_analysis"]').val(i),_.ctc_analysis=i,n.is_success()&&o&&!n.resubmitting?(n.resubmitting=1,void n.resubmit(_)):(n.resubmitting=0,n.hide_loading(),e.each(l.notices,function(t,c){var n=e('<div class="'+c.style+' notice is-dismissible dashicons-before" ><h4>'+c.headline+"</h4>"+c.msg+"</div>");e.chldthmcfg.bind_dismiss(n),n.hide().appendTo("#"+a+"_analysis_notice").slideDown()}),t='<div style="background-color:#ddd;padding:6px"><div class="ctc-section-toggle" id="ctc_analysis_obj">'+e.chldthmcfg.getxt("anlz30")+'</div><div id="ctc_analysis_obj_content" style="display:none"><textarea style="font-family:monospace;font-size:10px">'+JSON.stringify(n.analysis,null,2)+"</textarea></div></div>",e(t).appendTo("#"+a+"_analysis_notice"),c="",e.each(n.dependencies,function(e,t){t&&(c+='<label class="code"><input class="ctc_checkbox ctc-themeonly" id="ctc_forcedep_'+e+'" name="ctc_forcedep[]" type="checkbox" value="'+e+'" autocomplete="off" '+(-1!==window.ctcAjax.forcedep.indexOf(e)?"checked":"")+" />"+e+"</label><br/>\n")}),c.length?(e("#ctc_dependencies").html(c),e("#ctc_dependencies_container").show()):(e("#ctc_dependencies").empty(),e("#ctc_dependencies_container").hide()),e("#ctc_child_type_reset").is(":checked")||(e("#input_row_stylesheet_handling_container,#input_row_parent_handling_container,#ctc_child_header_parameters,#ctc_configure_submit").slideDown("fast"),e("#ctc_child_type_duplicate").is(":checked")?(e("#ctc_configure_submit .ctc-step").text("8"),e("#ctc_copy_theme_mods").find("input").prop("checked",!1)):(e("#ctc_configure_submit .ctc-step").text("9"),e("#ctc_copy_theme_mods").slideDown("fast")),e("#ctc_child_type_duplicate").is(":checked")||e("#ctc_child_type_new").is(":checked")?(e("#input_row_theme_slug").hide(),e("#input_row_new_theme_slug").slideDown("fast")):(e("#input_row_new_theme_slug").hide(),e("#input_row_theme_slug").slideDown("fast"))),void 0)},resubmit:function(t){var c=this;c.hide_loading(),c.show_loading(!0),t.action="ctc_update",t._wpnonce=e("#_wpnonce").val(),e.ajax({url:window.ctcAjax.ajaxurl,data:t,type:"POST"}).done(function(){c.hide_loading(),c.do_analysis()}).fail(function(){c.hide_loading()})},do_analysis:function(){var t=this;t.analysis={parnt:{deps:[[],[]],signals:{failure:0},queue:[],irreg:[],swaps:[]},child:{deps:[[],[]],signals:{failure:0},queue:[],irreg:[],swaps:[]}},t.phperr={parnt:[],child:[]},t.dependencies={},t.done=0,t.show_loading(!1),t.analyze_theme("parnt"),e.chldthmcfg.existing&&t.analyze_theme("child")},init:function(){var t=this;e(document).on("analysisdone",function(){t.done++,t.done>e.chldthmcfg.existing&&(t.done=0,t.css_notice())}),e("#ctc_main").on("click",".ctc-analyze-theme",function(){t.is_success()&&e.chldthmcfg.dismiss_notice(e(".ctc-success-response").parent(".notice")),t.do_analysis()}),t.is_success()&&!window.ctcAjax.pluginmode&&t.do_analysis()},analysis:{},done:0,resubmitting:0,dependencies:{},is_success:function(){return e(".ctc-success-response").length}},e("#request-filesystem-credentials-form").length||(e.chldthmcfg.init(),e.chldthmanalyze.init())}(jQuery);
1
  !function(e){"use strict";e.chldthmcfg={escquo:function(e){var t=this;return t.is_empty(e)?e:e.toString().replace(/"/g,"&quot;")},getxt:function(e,t){var c=window.ctcAjax[e+"_txt"];return c?(t&&(c=c.replace(/%s/,t)),c):""},getname:function(t){var c=this,n="child"===t?e.chldthmcfg.currchild:e.chldthmcfg.currparnt;return c.is_empty(window.ctcAjax.themes[t][n])?"":window.ctcAjax.themes[t][n].Name},frascii:function(e){var t=parseInt(e),c=String.fromCharCode(t);return c},toascii:function(e){var t=e.charCodeAt(0);return t},is_empty:function(e,t){if("undefined"==typeof e||!1===e||null===e||""===e)return!0;if("undefined"!=typeof t&&"0"===e||0===e)return!0;if(!0===e||"string"==typeof e||"number"==typeof e)return!1;if("object"==typeof e){for(var c in e)if(e.hasOwnProperty(c))return!1;return!0}return!1},theme_exists:function(t,c){var n=!1;return e.each(window.ctcAjax.themes,function(a,s){return e.each(s,function(e,s){return s=null,e.toLowerCase()!==t.toLowerCase()||"parnt"!==a&&"new"!==c?void 0:(n=!0,!1)}),n?!1:void 0}),n},validate:function(){var t=this,c=/[^\w\-]/g,n=e("#ctc_child_template").length?e("#ctc_child_template").val().toString().replace(c):"",a=e("#ctc_theme_child").length&&!t.is_empty(e("#ctc_theme_child").val())?e("#ctc_theme_child").val().toString().replace(c):n,s=e("input[name=ctc_child_type]:checked").val(),i=[];return"new"===s&&(a=n),t.theme_exists(a,s)&&i.push(t.getxt("theme_exists").toString().replace(/%s/,a)),t.is_empty(a)&&i.push(t.getxt("inval_theme")),i.length?(t.set_notice({error:i}),!1):"reset"===s?!!confirm(t.getxt("load")):!0},autogen_slugs:function(){if(e("#ctc_theme_parnt").length){for(var t=this,c=e("#ctc_theme_parnt").val(),n=e("#ctc_theme_child").length?e("#ctc_theme_child").val():"",a=""!==n&&e("#ctc_child_type_duplicate").is(":checked")?n:c+"-child",s=a,i=""!==n&&e("#ctc_child_type_duplicate").is(":checked")?e.chldthmcfg.getname("child"):e.chldthmcfg.getname("parnt")+" Child",l="",r="",o="00";t.theme_exists(s,"new");)l=t.is_empty(l)?2:l+1,r=o.substring(0,o.length-l.toString().length)+l.toString(),s=a+r;t.testslug=s,t.testname=i+(r.length?" "+r:"")}},focus_panel:function(t){var c=t+"_panel";e(".nav-tab").removeClass("nav-tab-active"),e(".ctc-option-panel").removeClass("ctc-option-panel-active"),e(t).addClass("nav-tab-active"),e(".ctc-option-panel-container").scrollTop(0),e(c).addClass("ctc-option-panel-active")},maybe_show_rewrite:function(){var t,c,n=this;e(".ctc-rewrite-toggle").each(function(a,s){t=e(s).hasClass("rewrite-query")?"query":"selector",c=e("#ctc_sel_ovrd_"+t+"_selected").text(),c.match(/^[\s\u00A0]*$/)?e(s).hide():(e(s).text(n.getxt("rename")),e(s).show())})},selector_input_toggle:function(t){var c,n=this,a=e(t).hasClass("rewrite-query")?"query":"selector",s="ctc_rewrite_"+a,i="ctc_sel_ovrd_"+a+"_selected";e("#"+s).length?(c=e("#"+s+"_orig").val(),e("#"+i).empty().text(c),e(t).text(n.getxt("rename"))):(c=e("#"+i).text(),e("#"+i).html('<textarea id="'+s+'" name="'+s+'" autocomplete="off"></textarea><input id="'+s+'_orig" name="'+s+'_orig" type="hidden" value="'+n.escquo(c)+'"/>'),e("#"+s).val(c),e(t).text(n.getxt("cancel")))},coalesce_inputs:function(t){var c=this,n=e(t).attr("id"),a=/^(ctc_(ovrd|\d+)_(parent|child)_([0-9a-z\-]+)_(\d+?)(_(\d+))?)(_\w+)?$/,s=e(t).parents(".ctc-selector-row, .ctc-parent-row").first(),i=s.find(".ctc-swatch").first(),l={parent:{},child:{}},r={parent:{origin:"",start:"",end:""},child:{origin:"",start:"",end:""}},o={child:!1,parent:!1},_={};return s.find(".ctc-parent-value, .ctc-child-value").each(function(){var t,s,i=e(this).attr("id"),d=i.toString().match(a),u=d[2],h=d[3],p="undefined"==typeof d[4]?"":d[4],m=d[7],g=d[5],f="undefined"==typeof d[7]?"":d[8],y="parent"===h?e(this).text().replace(/!$/,""):"seq"!==p&&"ctc_delete_query_selector"===n?"":e(this).val(),v="seq"===p?!1:"ctc_"+u+"_child_"+p+"_i_"+g+"_"+m;if("child"===h&&(c.is_empty(e(this).data("color"))||(y=c.color_text(e(this).data("color")),e(this).data("color",null)),_[i]=y,v&&(_[v]=e("#"+v).is(":checked")?1:0)),""!==y)if(c.is_empty(f))if(t=p.toString().match(/^border(\-(top|right|bottom|left))?$/)&&!y.match(/none/)){var w=new RegExp(c.border_regx+c.color_regx,"i");s=y.toString().match(w),c.is_empty(s)||(s.shift(),l[h][p+"-width"]=s.shift()||"",s.shift(),l[h][p+"-style"]=s.shift()||"",l[h][p+"-color"]=s.shift()||"")}else if("background-image"!==p||y.match(/none/))"seq"!==p&&(l[h][p]=y);else if(y.toString().match(/url\(/))l[h]["background-image"]=c.image_url(h,y);else{var x=new RegExp(c.grad_regx+c.color_regx+c.color_regx,"i");s=y.toString().match(x),!c.is_empty(s)&&s.length>2?(s.shift(),r[h].origin=s.shift()||"top",r[h].start=s.shift()||"transparent",r[h].end=s.shift()||"transparent",o[h]=!0):l[h]["background-image"]=y}else switch(f){case"_border_width":l[h][p+"-width"]="none"===y?0:y;break;case"_border_style":l[h][p+"-style"]=y;break;case"_border_color":l[h][p+"-color"]=y;break;case"_background_url":l[h]["background-image"]=c.image_url(h,y);break;case"_background_color":l[h]["background-color"]=y;break;case"_background_color1":r[h].start=y,o[h]=!0;break;case"_background_color2":r[h].end=y,o[h]=!0;break;case"_background_origin":r[h].origin=y,o[h]=!0}}),"undefined"==typeof i||c.is_empty(i.attr("id"))||(i.removeAttr("style"),o.parent&&i.ctcgrad(r.parent.origin,[r.parent.start,r.parent.end]),i.css(l.parent),i.attr("id").toString().match(/parent/)||(o.child&&i.ctcgrad(r.child.origin,[r.child.start,r.child.end]),i.css(l.child)),i.css({"z-index":-1})),_},decode_value:function(e,t){t="undefined"==typeof t?"":t;var c,n=this,a={orig:t,names:[""],values:[t]};if(e.toString().match(/^border(\-(top|right|bottom|left))?$/)){var s,i=new RegExp(n.border_regx+"("+n.color_regx+")?","i");c=t.toString().match(i),n.is_empty(c)&&(c=[]),a.names=["_border_width","_border_style","_border_color"],s=c.shift(),a.values[0]=c.shift()||"",c.shift(),a.values[1]=c.shift()||"",c.shift(),a.values[2]=c.shift()||""}else if(e.toString().match(/^background\-image/))if(a.names=["_background_url","_background_origin","_background_color1","_background_color2"],a.values=["","","",""],n.is_empty(t)||t.toString().match(/(url|none)/))a.values[0]=t;else{var l,r;c=t.toString().split(/:/),a.values[1]=c.shift()||"",a.values[2]=c.shift()||"",l=c.shift()||"",a.values[3]=c.shift()||"",r=c.shift()||"",a.orig=[a.values[1],a.values[2],a.values[3]].join(" ")}return a},image_url:function(e,t){var c,n=this,a=t.toString().match(/url\(['" ]*(.+?)['" ]*\)/),s=n.is_empty(a)?null:a[1],i=window.ctcAjax.theme_uri+"/"+("parent"===e?window.ctcAjax.parnt:window.ctcAjax.child)+"/";return s?c=s.toString().match(/^(data:|https?:|\/)/)?t:"url("+i+s+")":!1},setup_menus:function(){var e=this;e.setup_query_menu(),e.setup_selector_menu(),e.setup_rule_menu(),e.setup_new_rule_menu(),e.load_queries(),e.load_rules(),e.set_query(e.currquery)},load_queries:function(){var e=this;e.query_css("queries",null)},load_selectors:function(){var e=this;e.query_css("selectors",e.currquery)},load_rules:function(){var e=this;e.query_css("rules",null)},load_selector_values:function(){var e=this;e.query_css("qsid",e.currqsid)},get_queries:function(t,c){var n=[],a=new RegExp(e.ui.autocomplete.escapeRegex(t.term),"i");e.chldthmcfg.is_empty(this.element.data("menu"))?n.push({label:window.ctcAjax.nosels_txt,value:null}):e.each(this.element.data("menu"),function(e,t){a.test(t)&&n.push({label:t,value:t})}),c(n)},get_selectors:function(t,c){var n=[],a=new RegExp(e.ui.autocomplete.escapeRegex(t.term),"i");e.chldthmcfg.is_empty(this.element.data("menu"))?n.push({label:window.ctcAjax.nosels_txt,value:null}):e.each(this.element.data("menu"),function(e,t){a.test(e)&&n.push({label:e,value:t})}),c(n)},get_rules:function(t,c){var n=[],a=new RegExp(e.ui.autocomplete.escapeRegex(t.term),"i");e.chldthmcfg.is_empty(this.element.data("menu"))?n.push({label:window.ctcAjax.nosels_txt,value:null}):e.each(this.element.data("menu"),function(e,t){a.test(e)&&n.push({label:e,value:t})}),c(n)},get_filtered_rules:function(t,c){var n=[],a=new RegExp(e.ui.autocomplete.escapeRegex(t.term),"i");e.each(e("#ctc_rule_menu").data("menu"),function(e,t){a.test(e)&&n.push({label:e,value:t})}),c(n)},merge_ruleval_arrays:function(t,c,n){var a=this,s={},i=n?c.child.pop():null;return e.each(["parnt","child"],function(t,l){a.is_empty(c[l])||e.each(c[l],function(e,t){n?parseInt(t[2])>=parseInt(i[2])&&(i[2]=parseInt(t[2])+1):(a.is_empty(s[t[2]])&&(s[t[2]]={}),s[t[2]][l]=t)})}),n&&(s[i[2]]={parnt:[],child:i}),s},input_row:function(t,c,n,a,s){var i=this,l="";if(!i.is_empty(a)&&!i.is_empty(a.value)&&!i.is_empty(a.value[c])){var r=a.value[c],o=i.merge_ruleval_arrays(c,r,s);e.each(o,function(s,r){var o=i.decode_value(c,i.is_empty(r.parnt)?"":r.parnt[0]),_=i.is_empty(r.parnt)||i.is_empty(r.parnt[1],1)?0:1,d=i.decode_value(c,i.is_empty(r.child)?"":r.child[0]),u=i.is_empty(r.child)||i.is_empty(r.child[1],1)?0:1;if(l+='<div class="ctc-'+("ovrd"===n?"input":"selector")+'-row clearfix"><div class="ctc-input-cell">',l+="ovrd"===n?c.replace(/\d+/g,i.frascii):a.selector+'<br/><a href="#" class="ctc-selector-edit" id="ctc_selector_edit_'+t+'" >'+i.getxt("edit")+"</a> "+(i.is_empty(o.orig)?i.getxt("child_only"):""),l+='</div><div class="ctc-parent-value ctc-input-cell"'+("ovrd"!==n?' style="display:none"':"")+' id="ctc_'+n+"_parent_"+c+"_"+t+"_"+s+'">'+(i.is_empty(o.orig)?"[no value]":o.orig+(_?i.getxt("important"):""))+'</div><div class="ctc-input-cell">',!i.is_empty(o.names)){e.each(o.names,function(e,a){a=i.is_empty(a)?"":a,l+='<div class="ctc-child-input-cell ctc-clear">';var r,o="ctc_"+n+"_child_"+c+"_"+t+"_"+s+a;!1===(r=d.values.shift())&&(r=""),l+=(i.is_empty(a)?"":i.getxt(a)+":<br/>")+'<input type="text" id="'+o+'" name="'+o+'" class="ctc-child-value'+((a+c).toString().match(/color/)?" color-picker":"")+(a.toString().match(/url/)?" ctc-input-wide":"")+'" value="'+i.escquo(r)+'" /></div>'});var h="ctc_"+n+"_child_"+c+"_i_"+t+"_"+s;l+='<label for="'+h+'"><input type="checkbox" id="'+h+'" name="'+h+'" value="1" '+(u?"checked":"")+" />"+i.getxt("important")+"</label>"}l+="</div>","ovrd"!==n&&(l+='<div class="ctc-swatch ctc-specific" id="ctc_child_'+c+"_"+t+"_"+s+'_swatch">'+i.getxt("swatch")+'</div><div class="ctc-child-input-cell ctc-button-cell" id="ctc_save_'+c+"_"+t+"_"+s+'_cell"><input type="button" class="button ctc-save-input" id="ctc_save_'+c+"_"+t+"_"+s+'" name="ctc_save_'+c+"_"+t+"_"+s+'" value="Save" /></div>'),l+="</div><!-- end input row -->\n"})}return l},scrolltop:function(){e("html, body, .ctc-option-panel-container").animate({scrollTop:0})},css_preview:function(e){var t=this;(e=e.match(/(child|parnt)/)[1])||(e="child"),t.query_css("preview",e)},setup_iris:function(e){var t=this;t.setup_spectrum(e)},setup_spectrum:function(t){var c=this,n=!c.is_empty(window.ctcAjax.palette);try{e(t).spectrum({showInput:!0,allowEmpty:!0,showAlpha:!0,showInitial:!0,preferredFormat:"hex",clickoutFiresChange:!0,move:function(n){e(t).data("color",n),c.coalesce_inputs(t)},showPalette:!!n,showSelectionPalette:!!n,palette:[],maxSelectionSize:36,localStorageKey:"ctc-palette."+window.ctcAjax.child,hideAfterPaletteSelect:!0}).on("change",function(){c.coalesce_inputs(this)}).on("keyup",function(){var t=this,n=c.addhash(e(this).val());e(t).val(n),clearTimeout(e(this).data("spectrumTimer")),e(this).data("spectrumTimer",setTimeout(function(){c.coalesce_inputs(t),e(t).spectrum("set",n)},500))})}catch(a){c.jquery_exception(a,"Spectrum Color Picker")}},addhash:function(e){return e.replace(/^#?([a-f0-9]{3,6}.*)/,"#$1")},color_text:function(e){var t=this;return t.is_empty(e)?"":e.getAlpha()<1?e.toRgbString():e.toHexString()},setup_query_menu:function(){var t=this;try{e("#ctc_sel_ovrd_query").autocomplete({source:t.get_queries,minLength:0,selectFirst:!0,autoFocus:!0,select:function(c,n){return e("#ctc_rewrite_query").length?(e("#ctc_rewrite_query").val(n.item.value),e("#ctc_sel_ovrd_query").val("")):(t.set_query(n.item.value),t.reset_qsid()),!1},focus:function(e){e.preventDefault()}}).data("menu",{})}catch(c){t.jquery_exception(c,"Query Menu")}},setup_selector_menu:function(){var t=this;try{e("#ctc_sel_ovrd_selector").autocomplete({source:t.get_selectors,selectFirst:!0,autoFocus:!0,select:function(c,n){return e("#ctc_rewrite_selector").length?(e("#ctc_rewrite_selector").val(n.item.label),e("#ctc_sel_ovrd_selector").val("")):t.set_selector(n.item.value,n.item.label),!1},focus:function(e){e.preventDefault()}}).data("menu",{})}catch(c){t.jquery_exception(c,"Selector Menu")}},setup_rule_menu:function(){var t=this;try{e("#ctc_rule_menu").autocomplete({source:t.get_rules,selectFirst:!0,autoFocus:!0,select:function(e,c){return t.set_rule(c.item.value,c.item.label),!1},focus:function(e){e.preventDefault()}}).data("menu",{})}catch(c){t.jquery_exception(c,"Property Menu")}},setup_new_rule_menu:function(){var t=this;try{e("#ctc_new_rule_menu").autocomplete({source:t.get_filtered_rules,selectFirst:!0,autoFocus:!0,select:function(c,n){c.preventDefault();var a,s,i=n.item.label.replace(/[^\w\-]/g,t.toascii);return t.is_empty(t.currdata.value)&&(t.currdata.value={}),t.is_empty(t.currdata.value[n.item.label])&&(t.currdata.value[n.item.label]={}),t.is_empty(t.currdata.value[n.item.label].child)&&(t.currdata.value[n.item.label].child=[]),t.currdata.value[n.item.label].child.push(["",0,1,1]),a=e(t.input_row(t.currqsid,i,"ovrd",t.currdata,!0)),e("#ctc_sel_ovrd_rule_inputs").append(a),e("#ctc_new_rule_menu").val(""),a.find('input[type="text"]').each(function(c,n){s||(s=n),e(n).hasClass("color-picker")&&t.setup_spectrum(n)}),s&&e(s).focus(),!1},focus:function(e){e.preventDefault()}}).data("menu",{})}catch(c){t.jquery_exception(c,"New Property Menu")}},set_theme_params:function(t,c){e("#ctc_child_author").val(window.ctcAjax.themes[t][c].Author),e("#ctc_child_version").val(window.ctcAjax.themes[t][c].Version),e("#ctc_child_authoruri").val(window.ctcAjax.themes[t][c].AuthorURI),e("#ctc_child_themeuri").val(window.ctcAjax.themes[t][c].ThemeURI),e("#ctc_child_descr").val(window.ctcAjax.themes[t][c].Descr),e("#ctc_child_tags").val(window.ctcAjax.themes[t][c].Tags)},update_form:function(){var t,c=this;e("#input_row_stylesheet_handling_container,#input_row_parent_handling_container,#ctc_additional_css_files_container,#input_row_new_theme_slug,#input_row_duplicate_theme_slug,#ctc_copy_theme_mods,#ctc_child_header_parameters,#ctc_configure_submit,#input_row_theme_slug").slideUp("fast"),e("#ctc_configure_submit .ctc-step").text("9"),e("#ctc_theme_child").length&&!e("#ctc_child_type_new").is(":checked")?(t=e("#ctc_theme_child").val(),c.existing=1,c.currparnt=window.ctcAjax.themes.child[t].Template,c.autogen_slugs(),e("#ctc_theme_parnt").val(c.currparnt),e("#ctc_theme_parnt-button .ui-selectmenu-text").text(c.getname("parnt")),c.set_theme_params("child",t),e("#ctc_child_type_duplicate").is(":checked")?(e("#ctc_child_template").val(c.testslug),e("#ctc_child_name").val(c.testname),e(".ctc-analyze-theme, .ctc-analyze-howto").show(),e("#ctc_load_styles").val("Duplicate Child Theme")):e("#ctc_child_type_reset").is(":checked")?(e("#ctc_configure_submit .ctc-step").text("3"),e("#ctc_configure_submit").slideDown("fast"),e("#theme_slug_container").text(t),e(".ctc-analyze-theme, .ctc-analyze-howto").hide(),e("#ctc_enqueue_none").prop("checked",!0),e("#ctc_load_styles").val("Reset Child Theme to Previous State")):(e("#ctc_child_template").val(""),e("#theme_slug_container").text(t),e(".ctc-analyze-theme, .ctc-analyze-howto").show(),e("#ctc_child_name").val(c.getname("child")),e("#ctc_load_styles").val("Configure Child Theme")),e("#input_row_existing_theme_option").slideDown("fast"),e("#input_row_new_theme_option").slideUp("fast")):(c.existing=0,c.autogen_slugs(),e("#ctc_theme_parnt").val(c.currparnt),e("#ctc_theme_parnt-button .ui-selectmenu-text").text(e.chldthmcfg.getname("parnt")),c.set_theme_params("parnt",c.currparnt),e("#input_row_existing_theme_option,#input_row_duplicate_theme_container,#input_row_theme_slug").slideUp("fast"),e("#input_row_new_theme_option").slideDown("fast"),e("#ctc_child_name").val(c.testname),e("#ctc_child_template").val(c.testslug),e(".ctc-analyze-theme, .ctc-analyze-howto").show(),e("#ctc_load_styles").val("Create New Child Theme"))},set_notice:function(t){var c,n=this,a="";n.is_empty(t)||e.each(t,function(t,c){a+='<div class="'+t+' notice is-dismissible dashicons-before"><ul>\n',e(c).each(function(e,t){a+="<li>"+t.toString()+"</li>\n"}),a+="</ul></div>"}),c=e(a),e("#ctc_error_notice").html(c),n.bind_dismiss(c),e("html, body").animate({scrollTop:0},"slow")},set_parent_menu:function(e){var t=this;t.currparnt=e.value,t.update_form()},set_child_menu:function(e){var t=this;t.currchild=e.value,t.update_form()},set_query:function(t){var c=this;return c.is_empty(t)?!1:(c.currquery=t,e("#ctc_sel_ovrd_query").val(""),e("#ctc_sel_ovrd_query_selected").text(t),e("#ctc_sel_ovrd_selector").val(""),e("#ctc_sel_ovrd_selector_selected").html("&nbsp;"),c.load_selectors(),void c.scrolltop())},reset_qsid:function(){self.currqsid=null,e("#ctc_sel_ovrd_rule_inputs").empty(),e("#ctc_sel_ovrd_new_rule,#input_row_load_order,#ctc_sel_ovrd_rule_inputs_container").hide().find(".ctc-child-value").remove(),e(".ctc-rewrite-toggle").hide()},set_selector:function(t,c){var n=this;return c=null,n.is_empty(t)?!1:(e("#ctc_sel_ovrd_selector").val(""),n.currqsid=t,n.reload=!1,n.load_selector_values(),void n.scrolltop())},set_rule:function(t,c){var n=this;return n.is_empty(t)?!1:(e("#ctc_rule_menu").val(""),e("#ctc_rule_menu_selected").text(c),e(".ctc-rewrite-toggle").text(n.getxt("rename")),e("#ctc_rule_value_inputs, #ctc_input_row_rule_header").show(),n.query_css("rule_val",t),void n.scrolltop())},set_qsid:function(t){var c=this;c.currqsid=e(t).attr("id").match(/_(\d+)$/)[1],c.focus_panel("#query_selector_options"),c.reload=!0,c.load_selector_values()},query_css:function(t,c,n){var a=this,s={ctc_query_obj:t,ctc_query_key:c},i="#ctc_status_"+t+("val_qry"===t?"_"+c:"");"object"==typeof n&&e.each(n,function(e,t){s["ctc_query_"+e]=t}),e(".query-icon,.ctc-status-icon").remove(),e(i+" .ctc-status-icon").remove(),e(i).append('<span class="ctc-status-icon spinner is-active query-icon"></span>'),s.action=a.is_empty(e("#ctc_action").val())||"plugin"!==e("#ctc_action").val()?"ctc_query":"ctc_plgqry",s._wpnonce=e("#_wpnonce").val(),a.ajax_post(t,s)},save:function(t){var c,n,a,s,i,l=this,r={},o=e(t).attr("id");e(t).prop("disabled",!0),e(".ctc-query-icon,.ctc-status-icon").remove(),e(t).parent(".ctc-textarea-button-cell, .ctc-button-cell").append('<span class="ctc-status-icon spinner save-icon"></span>'),o.match(/ctc_configtype/)?(e(t).parents(".ctc-input-row").first().append('<span class="ctc-status-icon spinner save-icon"></span>'),r.ctc_configtype=e(t).val()):(c=e("#ctc_new_selectors"))&&"ctc_save_new_selectors"===e(t).attr("id")?(r.ctc_new_selectors=c.val(),(n=e("#ctc_sel_ovrd_query_selected"))&&(r.ctc_sel_ovrd_query=n.text()),l.reload=!0):(a=e("#ctc_child_imports"))&&"ctc_save_imports"===o?r.ctc_child_imports=a.val():"ctc_is_debug"===o?r.ctc_is_debug=e("#ctc_is_debug").is(":checked")?1:0:r=l.coalesce_inputs(t),e(".save-icon").addClass("is-active"),e.each(["query","selector"],function(t,c){e("#ctc_rewrite_"+c).length&&(s=e("#ctc_rewrite_"+c).val(),i=e("#ctc_rewrite_"+c+"_orig").val(),l.is_empty(s)||!s.toString().match(/\w/)?s=i:(r["ctc_rewrite_"+c]=s,l.reload=!0),e("#ctc_sel_ovrd_"+c+"_selected").html(s)),e(".ctc-rewrite-toggle").text(l.getxt("rename"))}),r.action=l.is_empty(e("#ctc_action").val())||"plugin"!==e("#ctc_action").val()?"ctc_update":"ctc_plugin",r._wpnonce=e("#_wpnonce").val(),l.ajax_post("qsid",r)},ajax_post:function(t,c,n){var a=this;e.ajax({url:window.ctcAjax.ajaxurl,data:c,dataType:a.is_empty(n)?"json":n,type:"POST"}).done(function(e){a.handle_success(t,e)}).fail(function(){a.handle_failure(t)}).always(function(){a.jqueryerr.length&&a.jquery_notice()})},handle_failure:function(t){var c=this;e(".query-icon, .save-icon").removeClass("spinner").addClass("failure"),e("input[type=submit], input[type=button], input[type=checkbox],.ctc-delete-input").prop("disabled",!1),e(".ajax-pending").removeClass("ajax-pending"),"preview"===t&&e("#view_parnt_options_panel,#view_child_options_panel").text(c.getxt("css_fail"))},handle_success:function(t,c){var n=this;e(".query-icon, .save-icon").removeClass("spinner"),e(".ajax-pending").removeClass("ajax-pending"),n.is_empty(c)?n.handle_failure(t):(e("#ctc_new_selectors").val(""),e(".query-icon, .save-icon").addClass("success"),e("input[type=submit], input[type=button], input[type=checkbox],.ctc-delete-input").prop("disabled",!1),e(c).each(function(){"function"==typeof n.update[this.obj]&&n.update[this.obj].call(n,this)}))},jquery_exception:function(e,t){var c=this,n=c.is_empty(e.lineNumber)?"":" line: "+e.lineNumber,a=c.is_empty(e.fileName)?"":" "+e.fileName.split(/\?/)[0];c.jqueryerr.push("<code><small>"+t+": "+e.message+a+n+"</small></code>")},jquery_notice:function(t){t=null;var c=this,n=[],a=[];c.jqueryerr.length&&(e("input[type=submit], input[type=button]").prop("disabled",!0),e("script").each(function(){var t=e(this).prop("src");c.is_empty(t)||!t.match(/jquery(\.min|\.js|\-?ui)/i)||t.match(/load\-scripts.php/)||n.push("<code><small>"+t.split(/\?/)[0]+"</small></code>")}),a.push("<strong>"+c.getxt("js")+"</strong> "+c.getxt("contact")),a.push(c.jqueryerr.join("<br/>")),n.length&&a.push(c.getxt("jquery")+"<br/>"+n.join("<br/>")),a.push(c.getxt("plugin"))),c.set_notice({error:a})},update:{qsid:function(t){var c,n,a,s,i=this;i.currqsid=t.key,i.currdata=t.data,e("#ctc_sel_ovrd_qsid").val(i.currqsid),i.is_empty(i.currdata.seq)?e("#ctc_child_load_order_container").empty():(c="ctc_ovrd_child_seq_"+i.currqsid,a=parseInt(i.currdata.seq),n='<input type="text" id="'+c+'" name="'+c+'" class="ctc-child-value" value="'+a+'" />',e("#ctc_child_load_order_container").html(n)),i.is_empty(i.currdata.value)?(s=!0,e("#ctc_sel_ovrd_rule_inputs").empty(),i.load_selectors()):(s=!1,n="",e.each(i.currdata.value,function(e,t){t=null,n+=i.input_row(i.currqsid,e,"ovrd",i.currdata)}),e("#ctc_sel_ovrd_rule_inputs").html(n).find(".color-picker").each(function(){i.setup_spectrum(this)}),i.coalesce_inputs("#ctc_child_all_0_swatch")),i.reload&&(i.load_queries(),i.load_selectors(),i.set_query(i.currdata.query),i.load_rules()),e("#ctc_sel_ovrd_selector_selected").text(i.currdata.selector),i.maybe_show_rewrite(),s?i.reset_qsid():e("#ctc_sel_ovrd_rule_header,#ctc_sel_ovrd_new_rule,#ctc_sel_ovrd_rule_inputs_container,#ctc_sel_ovrd_rule_inputs,#input_row_load_order").fadeIn()},rule_val:function(t){var c=this,n=e("#ctc_rule_menu_selected").text(),a='<div class="ctc-input-row clearfix" id="ctc_rule_row_'+n+'">\n';c.is_empty(t.data)||(e.each(t.data,function(e,t){var s=c.decode_value(n,t);a+='<div class="ctc-parent-row clearfix" id="ctc_rule_row_'+n+"_"+e+'">\n<div class="ctc-input-cell ctc-parent-value" id="ctc_'+e+"_parent_"+n+"_"+e+'">'+s.orig+'</div>\n<div class="ctc-input-cell">\n<div class="ctc-swatch ctc-specific" id="ctc_'+e+"_parent_"+n+"_"+e+'_swatch">'+c.getxt("swatch")+'</div></div>\n<div class="ctc-input-cell"><a href="#" class="ctc-selector-handle" id="ctc_selector_'+n+"_"+e+'">'+c.getxt("selector")+'</a></div>\n<div id="ctc_selector_'+n+"_"+e+'_container" class="ctc-selector-container">\n<a href="#" id="ctc_selector_'+n+"_"+e+'_close" class="ctc-selector-handle ctc-exit" title="'+c.getxt("close")+'"></a><div id="ctc_selector_'+n+"_"+e+'_inner_container" class="ctc-selector-inner-container clearfix">\n<div id="ctc_status_val_qry_'+e+'"></div>\n<div id="ctc_selector_'+n+"_"+e+'_rows"></div>\n</div></div></div>\n'}),a+="</div>\n"),e("#ctc_rule_value_inputs").html(a).find(".ctc-swatch").each(function(){c.coalesce_inputs(this)})},val_qry:function(t){var c,n,a=this,s="";a.is_empty(t.data)||e.each(t.data,function(n,i){c=n,e.each(i,function(c,i){s+='<h4 class="ctc-query-heading">'+c+"</h4>\n",a.is_empty(i)||e.each(i,function(e,c){s+=a.input_row(e,n,t.key,c)})})}),n="#ctc_selector_"+c+"_"+t.key+"_rows",e(n).html(s).find(".color-picker").each(function(){a.setup_spectrum(this)}),e(n).find(".ctc-swatch").each(function(){a.coalesce_inputs(this)})},queries:function(t){e("#ctc_sel_ovrd_query").data("menu",t.data)},selectors:function(t){e("#ctc_sel_ovrd_selector").data("menu",t.data)},rules:function(t){e("#ctc_rule_menu").data("menu",t.data)},debug:function(t){e("#ctc_debug_box").val(e("#ctc_debug_box").val()+t.data)},preview:function(t){e("#view_"+t.key+"_options_panel").text(t.data)},dismiss:function(){}},bind_dismiss:function(t){var c=this,n=e(t),a=e('<button type="button" class="notice-dismiss"><span class="screen-reader-text"></span></button>'),s=window.commonL10n.dismiss||"";a.find(".screen-reader-text").text(s),n.append(a),a.on("click.wp-dismiss-notice",function(e){e.preventDefault(),c.dismiss_notice(t)})},dismiss_notice:function(t){e(t).fadeTo(100,0,function(){e(this).slideUp(100,function(){e(this).remove()})})},reset_handling:function(){e("#parnt_analysis_notice .notice, #child_analysis_notice .notice").slideUp(),e("#ctc_enqueue_enqueue").prop("checked",!0),e("#ctc_handling_primary").prop("checked",!0),e("#ctc_ignoreparnt").prop("checked",!1),e("#ctc_repairheader").prop("checked",!1)},init:function(){var t=this;if(!e("#ctc_theme_parnt").is("input")){try{e.widget("ctc.themeMenu",e.ui.selectmenu,{_renderItem:function(t,c){var n=e("<li>"),a=c.value.replace(/[^\w\-]/g,"");return e("#ctc_theme_option_"+a).detach().appendTo(n),n.appendTo(t)}})}catch(c){t.jquery_exception(c,"Theme Menu")}try{e("#ctc_theme_parnt").themeMenu({select:function(e,c){t.reset_handling(),t.set_parent_menu(c.item)}})}catch(c){"function"==typeof themeMenu?e("#ctc_theme_parnt").themeMenu("destroy"):e("#ctc_theme_parnt-button").remove(),t.jquery_exception(c,"Parent Theme Menu")}if(t.is_empty(window.ctcAjax.themes.child))e("#ctc_child_name").length&&(e("#ctc_child_name").val(t.testname),e("#ctc_child_template").val(t.testslug));else try{e("#ctc_theme_child").themeMenu({select:function(e,c){t.reset_handling(),t.set_child_menu(c.item)}})}catch(c){"function"==typeof themeMenu?e("#ctc_theme_child").themeMenu("destroy"):e("#ctc_theme_child-button").remove(),t.jquery_exception(c,"Child Theme Menu")}}t.currparnt=e("#ctc_theme_parnt").val(),t.currchild=e("#ctc_theme_child").length?e("#ctc_theme_child").val():"",e("#ctc_main").on("click",".ctc-section-toggle",function(t){t.preventDefault(),e(this).parents(".ctc-input-row, .notice-warning, .updated, .error").first().find(".ctc-section-toggle").each(function(){e(this).toggleClass("open")});var c=e(this).attr("id").replace(/\d$/,"")+"_content";return e("#"+c).stop().slideToggle("fast"),!1}),e("#ctc_main").on("click",".ctc-upgrade-notice .notice-dismiss",function(){var c={action:"ctc_dismiss",_wpnonce:e("#_wpnonce").val()};t.ajax_post("dismiss",c)}),t.is_empty(t.jqueryerr)&&(e("#ctc_main").on("click",".ctc-selector-handle",function(c){if(c.preventDefault(),e(this).hasClass("ajax-pending"))return!1;e(this).addClass("ajax-pending");var n,a,s=e(this).attr("id").toString().replace("_close",""),i=s.toString().match(/_([^_]+)_(\d+)$/);e("#"+s+"_container").is(":hidden")&&(t.is_empty(i[1])||t.is_empty(i[2])||(n=i[1],a=i[2],t.query_css("val_qry",a,{rule:n}))),e("#"+s+"_container").fadeToggle("fast"),e(".ctc-selector-container").not("#"+s+"_container").fadeOut("fast")}),e("#ctc_main").on("click",".ctc-save-input[type=button], .ctc-delete-input",function(c){return c.preventDefault(),e(this).hasClass("ajax-pending")?!1:(e(this).addClass("ajax-pending"),t.save(this),!1)}),e("#ctc_main").on("keydown",".ctc-selector-container .ctc-child-value[type=text]",function(c){if(13===c.which){var n=e(this).parents(".ctc-selector-row").find(".ctc-save-input[type=button]").first();if(n.length)return c.preventDefault(),n.hasClass("ajax-pending")?!1:(n.addClass("ajax-pending"),t.save(n),!1)}}),e("#ctc_main").on("click",".ctc-selector-edit",function(c){return c.preventDefault(),e(this).hasClass("ajax-pending")?!1:(e(this).addClass("ajax-pending"),void t.set_qsid(this))}),e("#ctc_main").on("click",".ctc-rewrite-toggle",function(e){e.preventDefault(),t.selector_input_toggle(this)}),e("#ctc_main").on("click","#ctc_copy_selector",function(){var c=e("#ctc_sel_ovrd_selector_selected").text().trim();t.is_empty(c)||e("#ctc_new_selectors").val(e("#ctc_new_selectors").val()+"\n"+c+" {\n\n}")}),e("#ctc_main").on("click",".ctc-backup-theme",function(c){c.preventDefault(),t.existing?e("#ctc_export_theme").val(t.currchild):e("#ctc_export_theme").val(t.currparnt),e("#ctc_export_theme_form").submit()}),e("#ctc_configtype").on("change",function(){var c=e(this).val();if(t.is_empty(c)||"theme"===c){e(".ctc-theme-only, .ctc-themeonly-container").removeClass("ctc-disabled"),e(".ctc-theme-only, .ctc-themeonly-container input").prop("disabled",!1);try{e("#ctc_theme_parnt, #ctc_theme_child").themeMenu("enable")}catch(n){t.jquery_exception(n,"Theme Menu")}}else{e(".ctc-theme-only, .ctc-themeonly-container").addClass("ctc-disabled"),e(".ctc-theme-only, .ctc-themeonly-container input").prop("disabled",!0);try{e("#ctc_theme_parnt, #ctc_theme_child").themeMenu("disable")}catch(n){t.jquery_exception(n,"Theme Menu")}}}),e(".nav-tab").on("click",function(c){if(c.preventDefault(),e(c.target).hasClass("ctc-disabled"))return!1;e(".ctc-query-icon,.ctc-status-icon").remove();var n="#"+e(this).attr("id");t.focus_panel(n)}),e("#view_child_options, #view_parnt_options").on("click",function(c){return e(c.target).hasClass("ajax-pending")||e(c.target).hasClass("ctc-disabled")?!1:(e(c.target).addClass("ajax-pending"),void t.css_preview(e(this).attr("id")))}),e("#ctc_load_form").on("submit",function(){return t.validate()}),e("#ctc_query_selector_form").on("submit",function(c){c.preventDefault();var n=e("#ctc_save_query_selector");return n.hasClass("ajax-pending")?!1:(n.addClass("ajax-pending"),t.save(n),!1)}),e("#ctc_rule_value_form").on("submit",function(e){return e.preventDefault(),!1}),e("#ctc_child_type_new,#ctc_child_type_existing,#ctc_child_type_duplicate,#ctc_child_type_reset").on("focus click",function(){t.reset_handling(),t.update_form()}),e("#ctc_is_debug").on("change",function(){e(this).is(":checked")?e("#ctc_debug_box").length||e("#ctc_debug_container").html('<textarea id="ctc_debug_box"></textarea>'):e("#ctc_debug_box").remove(),t.save(this)}),e(".ctc-live-preview").on("click",function(t){return t.stopImmediatePropagation(),t.preventDefault(),document.location=e(this).prop("href"),!1}),t.setup_menus(),e("input[type=submit], input[type=button]").prop("disabled",!1),t.scrolltop(),t.update_form()),t.jqueryerr.length&&t.jquery_notice()},testslug:"",testname:"",reload:!1,currquery:"base",currqsid:null,currdata:{},currparnt:"",currchild:"",existing:!1,jqueryerr:[],color_regx:"\\s+(\\#[a-f0-9]{3,6}|rgba?\\([\\d., ]+?\\)|hsla?\\([\\d%., ]+?\\)|[a-z]+)",border_regx:"(\\w+)(\\s+(\\w+))?",grad_regx:"(\\w+)"},e.chldthmanalyze={escrgx:function(e){return e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1")},trmcss:function(e){return"undefined"==typeof e?"":e.replace(/\-css$/,"")},show_loading:function(t,c){var n=e.chldthmcfg.existing?"child":"parnt",a=c?c:e.chldthmcfg.getname(n),s='<strong class="ctc_analyze_loading"><span class="spinner is-active"></span>'+e.chldthmcfg.getxt(t?"anlz1":"anlz2")+" "+a+"...</strong>";self.noticediv="",e("#"+n+"_analysis_notice").html(s)},hide_loading:function(){e(".ctc_analyze_loading").fadeTo(200,0,function(){e(this).slideUp(200,function(){e(this).remove()})})},setssl:function(e){return e.replace(/^https?/,window.ctcAjax.ssl?"https":"http")},analyze_theme:function(t){var c=this,n=Math.floor(e.now()/1e3),a="child"===t?e.chldthmcfg.currchild:e.chldthmcfg.currparnt,s="&template="+encodeURIComponent(e.chldthmcfg.currparnt)+"&stylesheet="+encodeURIComponent(a)+"&now="+n,i=c.setssl(window.ctcAjax.homeurl),l=i+s;c.analysis[t].url=l,e.get(l,function(n){c.parse_page(t,n),e(document).trigger("analysisdone")}).fail(function(n,s,i){c.analysis[t].signals.xhrgeterr=i,e.ajax({url:window.ctcAjax.ajaxurl,data:{action:"ctc_analyze",stylesheet:a,template:e.chldthmcfg.currparnt,
2
+ _wpnonce:e("#_wpnonce").val()},dataType:"json",type:"POST"}).done(function(n){n.signals.httperr?(c.analysis[t].signals.failure=1,c.analysis[t].signals.httperr=n.signals.httperr):c.parse_page(t,n.body),e(document).trigger("analysisdone")}).fail(function(n,a,s){c.analysis[t].signals.failure=1,c.analysis[t].signals.xhrajaxerr=s,e(document).trigger("analysisdone")})})},parse_page:function(t,c){var n,a,s,i=this,l=window.ctcAjax.theme_dir,r="child"===t?e.chldthmcfg.currchild:e.chldthmcfg.currparnt,o=i.escrgx(e.chldthmcfg.currparnt)+("child"===t?"|"+i.escrgx(r):""),_=new RegExp("<link( rel=[\"']stylesheet[\"'] id=['\"]([^'\"]+?)['\"])?[^>]+?"+i.escrgx(l)+"/("+o+")/([^\"']+\\.css)(\\?[^\"']+)?[\"'][^>]+>","gi"),d=/<br \/>\n[^\n]+?(fatal|strict|notice|warning|error)[\s\S]+?<br \/>/gi,u=0,h=0;if("child"===t){c.match(/^[\s\S]*?<head>([\s\S]*?)<\/head>/)}for((a=c.match(/BEGIN WP QUEUE\n([\s\S]*?)\nEND WP QUEUE/))?i.analysis[t].queue=a[1].split(/\n/):(i.analysis[t].queue=[],i.analysis[t].signals.thm_noqueue=1),(a=c.match(/BEGIN CTC IRREGULAR\n([\s\S]*?)\nEND CTC IRREGULAR/))?i.analysis[t].irreg=a[1].split(/\n/):i.analysis[t].irreg=[],c.match(/CHLD_THM_CFG_IGNORE_PARENT/)&&(i.analysis[t].signals.thm_ignoreparnt=1),c.match(/IS_CTC_THEME/)&&(i.analysis[t].signals.thm_is_ctc=1),c.match(/NO_CTC_STYLES/)&&(i.analysis[t].signals.thm_no_styles=1),c.match(/HAS_CTC_IMPORT/)&&(i.analysis[t].signals.thm_has_import=1),c.match(/HAS_WP_CACHE/)&&(i.analysis[t].signals.thm_has_cache=1),c.match(/HAS_WP_ROCKET/)&&(i.analysis[t].signals.thm_has_wprocket=1),c.match(/HAS_AUTOPTIMIZE/)&&(i.analysis[t].signals.thm_has_autoptimize=1),c=c.replace(/<!\-\-[\s\S]*?\-\->/g,"");n=d.exec(c);){var p=n[0].replace(/<.*?>/g,"");i.phperr[t].push(p),i.analysis[t].signals.err_php=1,p.match(/Fatal error/i)&&(i.analysis[t].signals.err_fatal=1)}for(;s=_.exec(c);){var m=i.trmcss(s[2]),g=s[3],f=s[4],y=e.chldthmcfg.currparnt===g?"parnt":"child",v=0;if(""===m||-1===i.analysis[t].queue.indexOf(m))v=1;else if(0===m.indexOf("chld_thm_cfg")){f.match(/^ctc\-style.*?\.css$/)?(u=1,i.analysis[t].signals.ctc_sep_loaded=1):f.match(/^ctc\-genesis([\-\.]min)?\.css$/)?(u=1,i.analysis[t].signals.ctc_gen_loaded=1):m.match(/^chld_thm_cfg_ext/)?f.match(/rtl.*?\.css$/)?i.analysis[t].signals.thm_rtl=1:(i.analysis[t].signals.ctc_ext_loaded=1,i.analysis[t].deps[u].push([m,f,y])):"chld_thm_cfg_child"===m?(i.analysis[t].signals.ctc_child_loaded=1,i.analysis[t].deps[u].push([m,f,y])):"chld_thm_cfg_parent"===m&&(i.analysis[t].signals.ctc_parnt_loaded=1,i.analysis[t].deps[u].push([m,f,y]),u&&(i.analysis[t].signals.ctc_parnt_reorder=1));continue}if(f.match(/^style.*?\.css$/))u=1,"parnt"===y?v?i.analysis[t].signals.thm_parnt_loaded="thm_unregistered":(i.analysis[t].signals.thm_parnt_loaded=m,"child"===t&&i.analysis[t].signals.thm_child_loaded&&(i.analysis[t].signals.ctc_parnt_reorder=1)):i.analysis[t].signals.thm_child_loaded=v?"thm_unregistered":m,v?h?(i.analysis[t].signals.thm_past_wphead=1,i.analysis[t].deps[u].push(["thm_past_wphead",f,y])):(i.analysis[t].signals.thm_unregistered=1,i.analysis[t].deps[u].push(["thm_unregistered",f,y])):i.analysis[t].deps[u].push([m,f,y]);else if(f.match(/rtl.*?\.css$/))i.analysis[t].signals.thm_rtl=1;else if(f.match(/ctc\-test.*?\.css$/))h=1;else{var w=null;v&&(w="dep_unregistered"),h&&(w=u?"css_past_wphead":"dep_past_wphead"),w?(i.analysis[t].signals[w]=1,m=w):i.dependencies[m]=f,i.analysis[t].deps[u].push([m,f,y])}}u||(i.analysis[t].signals.thm_notheme=1)},css_notice:function(){var t,c,n=this,a=e.chldthmcfg.existing?"child":"parnt",s=e.chldthmcfg.getname(a),i="",l={notices:[]},r={style:"notice-warning",headline:e.chldthmcfg.getxt("anlz3",s),errlist:"",msg:e.chldthmcfg.getxt("anlz7")},o=0,_={},d="",u={};if(n.analysis[a].signals.failure||n.analysis[a].signals.thm_noqueue&&!n.phperr[a].length)d=e.chldthmcfg.getxt("anlz33").replace(/%1/,'<a href="'+n.analysis[a].url+'" target="_new">').replace(/%2/,"</a>"),l.notices.push({headline:e.chldthmcfg.getxt("anlz4",s),msg:e.chldthmcfg.getxt("anlz5")+d,style:"notice-warning"});else if(n.phperr[a].length&&(e.each(n.phperr[a],function(e,t){t.match(/Fatal error/i)&&(u.fatal=1),t.match(/Constant \w+ already defined in .+?wp-config.php/i)&&(u.config=1),r.errlist+=t+"\n"}),u.fatal&&(r.style="error",r.headline=e.chldthmcfg.getxt("anlz8",s)),u.config&&(r.msg=e.chldthmcfg.getxt("anlzconfig",s)+r.msg),r.msg='<div style="background-color:#ffeebb;padding:6px"><div class="ctc-section-toggle" id="ctc_analysis_errs">'+e.chldthmcfg.getxt("anlz6")+'</div><div id="ctc_analysis_errs_content"><textarea>'+r.errlist+"</textarea></div></div>"+r.msg,l.notices.push(r)),n.analysis[a].signals.thm_has_wprocket&&n.analysis[a].signals.thm_has_autoptimize)l.notices.push({headline:e.chldthmcfg.getxt("anlzcache1"),style:"notice-warning",msg:e.chldthmcfg.getxt("anlzcache2")});else if(!n.analysis[a].signals.thm_noqueue){if((n.analysis[a].signals.thm_past_wphead||n.analysis[a].signals.dep_past_wphead)&&(l.notices.push({headline:e.chldthmcfg.getxt("anlz9"),style:"notice-warning",msg:e.chldthmcfg.getxt("anlz10")}),e("#ctc_repairheader").prop("checked",!0),e("#ctc_repairheader_container").show()),n.analysis[a].signals.thm_unregistered&&(n.analysis[a].signals.ctc_child_loaded||n.analysis[a].signals.ctc_sep_loaded||(l.notices.push({headline:e.chldthmcfg.getxt("anlz11"),style:"notice-warning",msg:e.chldthmcfg.getxt("anlz12")}),e("#ctc_repairheader_container").show(),e("#ctc_repairheader").prop("checked",!0))),"child"===a&&(window.ctcAjax.copy_mods&&window.ctcAjax.copy_mods.length>1&&(o=1,_.ctc_copy_mods=1,_.ctc_copy_from=window.ctcAjax.copy_mods[0],_.ctc_copy_to=window.ctcAjax.copy_mods[1]),n.analysis.child.signals.ctc_parnt_reorder&&(o=2),n.analysis.child.signals.ctc_child_loaded||n.analysis.child.signals.ctc_sep_loaded||n.analysis.child.signals.thm_child_loaded||(l.notices.push({headline:e.chldthmcfg.getxt("anlz13"),style:"notice-warning",msg:e.chldthmcfg.getxt("anlz14")}),o=2),n.analysis[a].signals.ctc_gen_loaded&&l.notices.push({headline:e.chldthmcfg.getxt("anlz31"),msg:e.chldthmcfg.getxt("anlz32"),style:"notice-warning"}),n.analysis.parnt.signals.thm_no_styles||n.analysis.child.signals.ctc_gen_loaded||n.analysis.child.signals.thm_parnt_loaded||n.analysis.child.signals.ctc_parnt_loaded||n.analysis.child.signals.thm_ignoreparnt||n.analysis.child.signals.thm_has_import||(l.notices.push({headline:e.chldthmcfg.getxt("anlz15"),style:"notice-warning",msg:e.chldthmcfg.getxt("anlz16")}),o=2),n.analysis.child.signals.thm_unregistered&&n.analysis.child.signals.thm_child_loaded&&"thm_unregistered"===n.analysis.child.signals.thm_child_loaded&&n.analysis.child.signals.ctc_child_loaded&&n.analysis.child.signals.ctc_parnt_loaded&&(l.notices.push({headline:e.chldthmcfg.getxt("anlz28"),style:"notice-warning",msg:e.chldthmcfg.getxt("anlz29")}),e("#ctc_repairheader_container").show(),e("#ctc_repairheader").prop("checked",!0)),n.analysis.child.signals.thm_is_ctc||e("#ctc_child_type_duplicate").is(":checked")||l.notices.push({headline:e.chldthmcfg.getxt("anlz19"),msg:e.chldthmcfg.getxt("anlz20"),style:"notice-warning"})),"object"!=typeof window.ctcAjax.swappath&&(window.ctcAjax.swappath={}),e.each(n.analysis.parnt.deps[0],function(t,c){e.each(n.analysis.child.deps[0],function(e,t){t[0]===c[0]&&t[2]!==c[2]&&(n.analysis.parnt.swaps.push(t),window.ctcAjax.swappath[t[0]]=t[1],o=2)})}),(n.analysis[a].signals.ctc_sep_loaded||n.analysis[a].signals.ctc_gen_loaded)&&e("#ctc_handling_separate").prop("checked",!0),l.notices.length||l.notices.push({headline:""+("child"===a?e.chldthmcfg.getxt("anlz17"):e.chldthmcfg.getxt("anlz18")),style:"updated",msg:""}),"child"===a&&n.analysis.child.signals.thm_has_import&&(l.notices.push({headline:e.chldthmcfg.getxt("anlz21"),msg:e.chldthmcfg.getxt("anlz22"),style:"notice-warning"}),e("#ctc_enqueue_import").prop("checked",!0)),n.analysis[a].signals.thm_ignoreparnt||n.analysis[a].signals.ctc_gen_loaded?(e("#ctc_ignoreparnt").prop("checked",!0),e("#ctc_enqueue_none").is(":checked")||(e("#ctc_enqueue_none").prop("checked",!0),o=2,_.ctc_enqueue="none")):e("#ctc_ignoreparnt").prop("checked",!1),!n.analysis[a].signals.ctc_sep_loaded&&!n.analysis[a].signals.ctc_gen_loaded&&!n.analysis[a].signals.ctc_child_loaded&&!n.analysis[a].signals.thm_unregistered&&!n.analysis[a].signals.thm_past_wphead&&n.analysis[a].deps[1].length){var h="";e.each(n.analysis[a].deps[1],function(e,t){t[1].match(/^style.*?\.css$/)||(h+='<li class="code">'+t[1]+"</li>\n")}),""!==h&&(h="<ul class='howto' style='padding-left:1em'>\n"+h+"</ul>\n",l.notices.push({headline:e.chldthmcfg.getxt("anlz23"),msg:h+e.chldthmcfg.getxt("anlz24"),style:"updated"}))}"child"===a&&n.analysis[a].signals.thm_parnt_loaded&&(l.notices.push({headline:e.chldthmcfg.getxt("anlz25"),msg:e.chldthmcfg.getxt("anlz26"),style:"updated"}),e("#ctc_enqueue_none").prop("checked",!0),o=2,_.ctc_enqueue="none"),n.analysis.parnt.signals.thm_no_styles&&(l.notices.push({headline:e.chldthmcfg.getxt("anlz27"),msg:e.chldthmcfg.getxt("anlz26"),style:"updated"}),e("#ctc_enqueue_none").prop("checked",!0),o=2,_.ctc_enqueue="none")}return i=encodeURIComponent(JSON.stringify(n.analysis)),e('input[name="ctc_analysis"]').val(i),n.is_success()&&o&&!n.resubmitting?(2===o&&(_.ctc_analysis=i),n.resubmitting=1,void n.resubmit(_)):(n.resubmitting=0,n.hide_loading(),e.each(l.notices,function(t,c){var n=e('<div class="'+c.style+' notice is-dismissible dashicons-before" ><h4>'+c.headline+"</h4>"+c.msg+"</div>");e.chldthmcfg.bind_dismiss(n),n.hide().appendTo("#"+a+"_analysis_notice").slideDown()}),t='<div style="background-color:#ddd;padding:6px"><div class="ctc-section-toggle" id="ctc_analysis_obj">'+e.chldthmcfg.getxt("anlz30")+'</div><div id="ctc_analysis_obj_content" style="display:none"><textarea style="font-family:monospace;font-size:10px">'+JSON.stringify(n.analysis,null,2)+"</textarea></div></div>",e(t).appendTo("#"+a+"_analysis_notice"),c="",e.each(n.dependencies,function(e,t){t&&(c+='<label class="code"><input class="ctc_checkbox ctc-themeonly" id="ctc_forcedep_'+e+'" name="ctc_forcedep[]" type="checkbox" value="'+e+'" autocomplete="off" '+(-1!==window.ctcAjax.forcedep.indexOf(e)?"checked":"")+" />"+e+"</label><br/>\n")}),c.length?(e("#ctc_dependencies").html(c),e("#ctc_dependencies_container").show()):(e("#ctc_dependencies").empty(),e("#ctc_dependencies_container").hide()),e("#ctc_child_type_reset").is(":checked")||(e("#input_row_stylesheet_handling_container,#input_row_parent_handling_container,#ctc_child_header_parameters,#ctc_configure_submit").slideDown("fast"),e("#ctc_child_type_duplicate").is(":checked")?(e("#ctc_configure_submit .ctc-step").text("8"),e("#ctc_copy_theme_mods").find("input").prop("checked",!1)):(e("#ctc_configure_submit .ctc-step").text("9"),e("#ctc_copy_theme_mods").slideDown("fast")),e("#ctc_child_type_duplicate").is(":checked")||e("#ctc_child_type_new").is(":checked")?(e("#input_row_theme_slug").hide(),e("#input_row_new_theme_slug").slideDown("fast")):(e("#input_row_new_theme_slug").hide(),e("#input_row_theme_slug").slideDown("fast"))),void 0)},resubmit:function(t){var c=this;c.hide_loading(),c.show_loading(!0),t.action="ctc_update",t._wpnonce=e("#_wpnonce").val(),e.ajax({url:window.ctcAjax.ajaxurl,data:t,dataType:"json",type:"POST"}).done(function(t){t.length>1&&e("#ctc_debug_box").val(e("#ctc_debug_box").val()+t[1].data),c.hide_loading(),c.do_analysis()}).fail(function(){c.hide_loading()})},do_analysis:function(){var t=this;t.analysis={parnt:{deps:[[],[]],signals:{failure:0},queue:[],irreg:[],swaps:[]},child:{deps:[[],[]],signals:{failure:0},queue:[],irreg:[],swaps:[]}},t.phperr={parnt:[],child:[]},t.dependencies={},t.done=0,t.show_loading(!1),t.analyze_theme("parnt"),e.chldthmcfg.existing&&(t.resubmitting?t.analyze_theme("child"):e.get(window.ctcAjax.customizerurl+"?theme="+e.chldthmcfg.currchild,function(){t.analyze_theme("child")}))},init:function(){var t=this;e(document).on("analysisdone",function(){t.done++,t.done>e.chldthmcfg.existing&&(t.done=0,t.css_notice())}),e("#ctc_main").on("click",".ctc-analyze-theme",function(){t.is_success()&&e.chldthmcfg.dismiss_notice(e(".ctc-success-response").parent(".notice")),t.do_analysis()}),t.is_success()&&!window.ctcAjax.pluginmode&&t.do_analysis()},analysis:{},done:0,resubmitting:0,dependencies:{},is_success:function(){return e(".ctc-success-response").length}},e("#request-filesystem-credentials-form").length||(e.chldthmcfg.init(),e.chldthmanalyze.init())}(jQuery);
lang/child-theme-configurator.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the same license as the Child Theme Configurator package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Child Theme Configurator 2.4.1\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/child-theme-configurator\n"
7
- "POT-Creation-Date: 2019-01-20 01:05:21+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -12,7 +12,7 @@ msgstr ""
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
15
- #. #-#-#-#-# child-theme-configurator.pot (Child Theme Configurator 2.4.1) #-#-#-#-#
16
  #. Plugin Name of the plugin/theme
17
  #: includes/classes/Core.php:97 includes/classes/Core.php:108
18
  #: includes/forms/main.php:35
@@ -41,124 +41,124 @@ msgstr ""
41
  msgid "Click here to edit template files using the Theme Editor"
42
  msgstr ""
43
 
44
- #: includes/classes/UI.php:288
45
  msgid "URL/None"
46
  msgstr ""
47
 
48
- #: includes/classes/UI.php:289
49
  msgid "Origin"
50
  msgstr ""
51
 
52
- #: includes/classes/UI.php:290
53
  msgid "Color 1"
54
  msgstr ""
55
 
56
- #: includes/classes/UI.php:291
57
  msgid "Color 2"
58
  msgstr ""
59
 
60
- #: includes/classes/UI.php:292
61
  msgid "Width/None"
62
  msgstr ""
63
 
64
- #: includes/classes/UI.php:293
65
  msgid "Style"
66
  msgstr ""
67
 
68
- #: includes/classes/UI.php:294
69
  msgid "Color"
70
  msgstr ""
71
 
72
- #: includes/classes/UI.php:296
73
  msgid ""
74
  "Are you sure you wish to RESET? This will destroy any work you have done in "
75
  "the Configurator."
76
  msgstr ""
77
 
78
- #: includes/classes/UI.php:297
79
  msgid "<span style=\"font-size:10px\">!</span>"
80
  msgstr ""
81
 
82
- #: includes/classes/UI.php:298 includes/forms/rule-value.php:33
83
  msgid "Selectors"
84
  msgstr ""
85
 
86
- #: includes/classes/UI.php:299
87
  msgid "Close"
88
  msgstr ""
89
 
90
- #: includes/classes/UI.php:300
91
  msgid "Edit Selector"
92
  msgstr ""
93
 
94
- #: includes/classes/UI.php:301
95
  msgid "Cancel"
96
  msgstr ""
97
 
98
- #: includes/classes/UI.php:302
99
  msgid "Rename"
100
  msgstr ""
101
 
102
- #: includes/classes/UI.php:303
103
  msgid "The stylesheet cannot be displayed."
104
  msgstr ""
105
 
106
- #: includes/classes/UI.php:304
107
  msgid "(Child Only)"
108
  msgstr ""
109
 
110
- #: includes/classes/UI.php:305
111
  msgid "Please enter a valid Child Theme."
112
  msgstr ""
113
 
114
- #: includes/classes/UI.php:306
115
  msgid "Please enter a valid Child Theme name."
116
  msgstr ""
117
 
118
- #: includes/classes/UI.php:307
119
  msgid "<strong>%s</strong> exists. Please enter a different Child Theme"
120
  msgstr ""
121
 
122
- #: includes/classes/UI.php:308
123
  msgid "The page could not be loaded correctly."
124
  msgstr ""
125
 
126
- #: includes/classes/UI.php:309
127
  msgid ""
128
  "Conflicting or out-of-date jQuery libraries were loaded by another plugin:"
129
  msgstr ""
130
 
131
- #: includes/classes/UI.php:310
132
  msgid "Deactivating or replacing plugins may resolve this issue."
133
  msgstr ""
134
 
135
- #: includes/classes/UI.php:311
136
  msgid "%sWhy am I seeing this?%s"
137
  msgstr ""
138
 
139
- #: includes/classes/UI.php:314
140
  msgid "No Styles Available. Check Parent/Child settings."
141
  msgstr ""
142
 
143
- #: includes/classes/UI.php:315
144
  msgid "Updating"
145
  msgstr ""
146
 
147
- #: includes/classes/UI.php:316
148
  msgid "Checking"
149
  msgstr ""
150
 
151
- #: includes/classes/UI.php:317
152
  msgid "The theme \"%s\" generated unexpected PHP debug output."
153
  msgstr ""
154
 
155
- #: includes/classes/UI.php:318
156
  msgid ""
157
  "The theme \"%s\" could not be analyzed because the preview did not render "
158
  "correctly."
159
  msgstr ""
160
 
161
- #: includes/classes/UI.php:319
162
  msgid ""
163
  "<p>First, verify you can <a href=\"%s\">preview your home page with the "
164
  "Customizer</a> and try analyzing again.</p><p>If that does not work, try "
@@ -166,11 +166,11 @@ msgid ""
166
  "<strong>force redirects between HTTP and HTTPS</strong>.</p>"
167
  msgstr ""
168
 
169
- #: includes/classes/UI.php:320
170
  msgid "Click to show/hide PHP debug output"
171
  msgstr ""
172
 
173
- #: includes/classes/UI.php:322
174
  msgid ""
175
  "<p><strong>PLEASE NOTE:</strong></p><p><em>The analyzer reveals errors that "
176
  "may otherwise go undetected. Unless this is a fatal error, WordPress may "
@@ -183,28 +183,28 @@ msgid ""
183
  "faqs/\" target=\"_blank\">CTC documentation</a>.</em></p>"
184
  msgstr ""
185
 
186
- #: includes/classes/UI.php:323
187
  msgid "Do Not Activate \"%s\"! A PHP FATAL ERROR has been detected."
188
  msgstr ""
189
 
190
- #: includes/classes/UI.php:324
191
  msgid "This theme loads stylesheets after the wp_styles queue."
192
  msgstr ""
193
 
194
- #: includes/classes/UI.php:325
195
  msgid ""
196
  "<p>This makes it difficult for plugins to override these styles. You can try "
197
  "to resolve this using the \"Repair header template\" option (Step 6, "
198
  "\"Additional handling options\", below).</p>"
199
  msgstr ""
200
 
201
- #: includes/classes/UI.php:326
202
  msgid ""
203
  "This theme loads the parent theme's <code>style.css</code> file outside the "
204
  "wp_styles queue."
205
  msgstr ""
206
 
207
- #: includes/classes/UI.php:327
208
  msgid ""
209
  "<p>This is common with older themes but requires the use of <code>@import</"
210
  "code>, which is no longer recommended. You can try to resolve this using the "
@@ -212,41 +212,41 @@ msgid ""
212
  "\", below).</p>"
213
  msgstr ""
214
 
215
- #: includes/classes/UI.php:328
216
  msgid "This child theme does not load a Configurator stylesheet."
217
  msgstr ""
218
 
219
- #: includes/classes/UI.php:329
220
  msgid ""
221
  "<p>If you want to customize styles using this plugin, please click "
222
  "\"Configure Child Theme\" again to add this to the settings.</p>"
223
  msgstr ""
224
 
225
- #: includes/classes/UI.php:330
226
  msgid ""
227
  "This child theme uses the parent stylesheet but does not load the parent "
228
  "theme's <code>style.css</code> file."
229
  msgstr ""
230
 
231
- #: includes/classes/UI.php:331
232
  msgid ""
233
  "<p>Please select a stylesheet handling method or check \"Ignore parent theme "
234
  "stylesheets\" (see step 6, below).</p>"
235
  msgstr ""
236
 
237
- #: includes/classes/UI.php:332
238
  msgid "This child theme appears to be functioning correctly."
239
  msgstr ""
240
 
241
- #: includes/classes/UI.php:333
242
  msgid "This theme appears OK to use as a Child theme."
243
  msgstr ""
244
 
245
- #: includes/classes/UI.php:334
246
  msgid "This Child Theme has not been configured for this plugin."
247
  msgstr ""
248
 
249
- #: includes/classes/UI.php:335
250
  msgid ""
251
  "<p>The Configurator makes significant modifications to the child theme, "
252
  "including stylesheet changes and additional php functions. Please consider "
@@ -254,105 +254,105 @@ msgid ""
254
  "original as a backup.</p>"
255
  msgstr ""
256
 
257
- #: includes/classes/UI.php:336
258
  msgid ""
259
  "This child theme uses <code>@import</code> to load the parent theme's "
260
  "<code>style.css</code> file."
261
  msgstr ""
262
 
263
- #: includes/classes/UI.php:337
264
  msgid ""
265
  "<p>Please consider selecting \"Use the WordPress style queue\" for the "
266
  "parent stylesheet handling option (see step 6, below).</p>"
267
  msgstr ""
268
 
269
- #: includes/classes/UI.php:338
270
  msgid ""
271
  "This theme loads additional stylesheets after the <code>style.css</code> "
272
  "file:"
273
  msgstr ""
274
 
275
- #: includes/classes/UI.php:339
276
  msgid ""
277
  "<p>Consider saving new custom styles to a \"Separate stylesheet\" (see step "
278
  "5, below) so that you can customize these styles.</p>"
279
  msgstr ""
280
 
281
- #: includes/classes/UI.php:340
282
  msgid ""
283
  "The parent theme's <code>style.css</code> file is being loaded automatically."
284
  msgstr ""
285
 
286
- #: includes/classes/UI.php:341
287
  msgid ""
288
  "<p>The Configurator selected \"Do not add any parent stylesheet handling\" "
289
  "for the \"Parent stylesheet handling\" option (see step 6, below).</p>"
290
  msgstr ""
291
 
292
- #: includes/classes/UI.php:342
293
  msgid ""
294
  "This theme does not require the parent theme's <code>style.css</code> file "
295
  "for its appearance."
296
  msgstr ""
297
 
298
- #: includes/classes/UI.php:343
299
  msgid ""
300
  "This Child Theme was configured to accomodate a hard-coded stylesheet link."
301
  msgstr ""
302
 
303
- #: includes/classes/UI.php:344
304
  msgid ""
305
  "<p>This workaround was used in earlier versions of CTC and can be eliminated "
306
  "by using the \"Repair header template\" option (see step 6, \"Additional "
307
  "handling options\", below).</p>"
308
  msgstr ""
309
 
310
- #: includes/classes/UI.php:345
311
  msgid ""
312
  "Click to show/hide raw analysis data. Please include contents below with any "
313
  "support requests."
314
  msgstr ""
315
 
316
- #: includes/classes/UI.php:346
317
  msgid ""
318
  "This child theme was configured using the CTC Pro \"Genesis stylesheet "
319
  "handling\" method."
320
  msgstr ""
321
 
322
- #: includes/classes/UI.php:347
323
  msgid ""
324
  "<p>This method has been replaced by the \"Separate stylesheet\" and \"Ignore "
325
  "Parent Theme\" options ( selected below ) for broader framework "
326
  "compatability.</p>"
327
  msgstr ""
328
 
329
- #: includes/classes/UI.php:348
330
  msgid "<p>%1Click Here%2 to view the theme as viewed by the Analyzer.</p>"
331
  msgstr ""
332
 
333
- #: includes/classes/UI.php:349
334
  msgid ""
335
  "This theme uses a RTL (right-to-left) stylesheet that is not being loaded in "
336
  "the child theme."
337
  msgstr ""
338
 
339
- #: includes/classes/UI.php:350
340
  msgid ""
341
  "Use the Web Fonts tab to add a link to the parent RTL stylesheet. See the "
342
  "documentation for more information.</p>"
343
  msgstr ""
344
 
345
- #: includes/classes/UI.php:351
346
  msgid "Both WP Rocket and Autoptimize plugins are enabled."
347
  msgstr ""
348
 
349
- #: includes/classes/UI.php:352
350
  msgid ""
351
  "The combination of these two plugins interferes with the Analysis results. "
352
  "Please temporarily deactivate one of them and Analyze again."
353
  msgstr ""
354
 
355
- #: includes/classes/UI.php:353
356
  msgid ""
357
  "<p><strong>The WordPress configuration file has been modified incorrectly.</"
358
  "strong> Please see <a href=\"http://www.childthemeconfigurator.com/child-"
2
  # This file is distributed under the same license as the Child Theme Configurator package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Child Theme Configurator 2.4.2\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/child-theme-configurator\n"
7
+ "POT-Creation-Date: 2019-02-17 01:46:27+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
15
+ #. #-#-#-#-# child-theme-configurator.pot (Child Theme Configurator 2.4.2) #-#-#-#-#
16
  #. Plugin Name of the plugin/theme
17
  #: includes/classes/Core.php:97 includes/classes/Core.php:108
18
  #: includes/forms/main.php:35
41
  msgid "Click here to edit template files using the Theme Editor"
42
  msgstr ""
43
 
44
+ #: includes/classes/UI.php:290
45
  msgid "URL/None"
46
  msgstr ""
47
 
48
+ #: includes/classes/UI.php:291
49
  msgid "Origin"
50
  msgstr ""
51
 
52
+ #: includes/classes/UI.php:292
53
  msgid "Color 1"
54
  msgstr ""
55
 
56
+ #: includes/classes/UI.php:293
57
  msgid "Color 2"
58
  msgstr ""
59
 
60
+ #: includes/classes/UI.php:294
61
  msgid "Width/None"
62
  msgstr ""
63
 
64
+ #: includes/classes/UI.php:295
65
  msgid "Style"
66
  msgstr ""
67
 
68
+ #: includes/classes/UI.php:296
69
  msgid "Color"
70
  msgstr ""
71
 
72
+ #: includes/classes/UI.php:298
73
  msgid ""
74
  "Are you sure you wish to RESET? This will destroy any work you have done in "
75
  "the Configurator."
76
  msgstr ""
77
 
78
+ #: includes/classes/UI.php:299
79
  msgid "<span style=\"font-size:10px\">!</span>"
80
  msgstr ""
81
 
82
+ #: includes/classes/UI.php:300 includes/forms/rule-value.php:33
83
  msgid "Selectors"
84
  msgstr ""
85
 
86
+ #: includes/classes/UI.php:301
87
  msgid "Close"
88
  msgstr ""
89
 
90
+ #: includes/classes/UI.php:302
91
  msgid "Edit Selector"
92
  msgstr ""
93
 
94
+ #: includes/classes/UI.php:303
95
  msgid "Cancel"
96
  msgstr ""
97
 
98
+ #: includes/classes/UI.php:304
99
  msgid "Rename"
100
  msgstr ""
101
 
102
+ #: includes/classes/UI.php:305
103
  msgid "The stylesheet cannot be displayed."
104
  msgstr ""
105
 
106
+ #: includes/classes/UI.php:306
107
  msgid "(Child Only)"
108
  msgstr ""
109
 
110
+ #: includes/classes/UI.php:307
111
  msgid "Please enter a valid Child Theme."
112
  msgstr ""
113
 
114
+ #: includes/classes/UI.php:308
115
  msgid "Please enter a valid Child Theme name."
116
  msgstr ""
117
 
118
+ #: includes/classes/UI.php:309
119
  msgid "<strong>%s</strong> exists. Please enter a different Child Theme"
120
  msgstr ""
121
 
122
+ #: includes/classes/UI.php:310
123
  msgid "The page could not be loaded correctly."
124
  msgstr ""
125
 
126
+ #: includes/classes/UI.php:311
127
  msgid ""
128
  "Conflicting or out-of-date jQuery libraries were loaded by another plugin:"
129
  msgstr ""
130
 
131
+ #: includes/classes/UI.php:312
132
  msgid "Deactivating or replacing plugins may resolve this issue."
133
  msgstr ""
134
 
135
+ #: includes/classes/UI.php:313
136
  msgid "%sWhy am I seeing this?%s"
137
  msgstr ""
138
 
139
+ #: includes/classes/UI.php:316
140
  msgid "No Styles Available. Check Parent/Child settings."
141
  msgstr ""
142
 
143
+ #: includes/classes/UI.php:317
144
  msgid "Updating"
145
  msgstr ""
146
 
147
+ #: includes/classes/UI.php:318
148
  msgid "Checking"
149
  msgstr ""
150
 
151
+ #: includes/classes/UI.php:319
152
  msgid "The theme \"%s\" generated unexpected PHP debug output."
153
  msgstr ""
154
 
155
+ #: includes/classes/UI.php:320
156
  msgid ""
157
  "The theme \"%s\" could not be analyzed because the preview did not render "
158
  "correctly."
159
  msgstr ""
160
 
161
+ #: includes/classes/UI.php:321
162
  msgid ""
163
  "<p>First, verify you can <a href=\"%s\">preview your home page with the "
164
  "Customizer</a> and try analyzing again.</p><p>If that does not work, try "
166
  "<strong>force redirects between HTTP and HTTPS</strong>.</p>"
167
  msgstr ""
168
 
169
+ #: includes/classes/UI.php:322
170
  msgid "Click to show/hide PHP debug output"
171
  msgstr ""
172
 
173
+ #: includes/classes/UI.php:324
174
  msgid ""
175
  "<p><strong>PLEASE NOTE:</strong></p><p><em>The analyzer reveals errors that "
176
  "may otherwise go undetected. Unless this is a fatal error, WordPress may "
183
  "faqs/\" target=\"_blank\">CTC documentation</a>.</em></p>"
184
  msgstr ""
185
 
186
+ #: includes/classes/UI.php:325
187
  msgid "Do Not Activate \"%s\"! A PHP FATAL ERROR has been detected."
188
  msgstr ""
189
 
190
+ #: includes/classes/UI.php:326
191
  msgid "This theme loads stylesheets after the wp_styles queue."
192
  msgstr ""
193
 
194
+ #: includes/classes/UI.php:327
195
  msgid ""
196
  "<p>This makes it difficult for plugins to override these styles. You can try "
197
  "to resolve this using the \"Repair header template\" option (Step 6, "
198
  "\"Additional handling options\", below).</p>"
199
  msgstr ""
200
 
201
+ #: includes/classes/UI.php:328
202
  msgid ""
203
  "This theme loads the parent theme's <code>style.css</code> file outside the "
204
  "wp_styles queue."
205
  msgstr ""
206
 
207
+ #: includes/classes/UI.php:329
208
  msgid ""
209
  "<p>This is common with older themes but requires the use of <code>@import</"
210
  "code>, which is no longer recommended. You can try to resolve this using the "
212
  "\", below).</p>"
213
  msgstr ""
214
 
215
+ #: includes/classes/UI.php:330
216
  msgid "This child theme does not load a Configurator stylesheet."
217
  msgstr ""
218
 
219
+ #: includes/classes/UI.php:331
220
  msgid ""
221
  "<p>If you want to customize styles using this plugin, please click "
222
  "\"Configure Child Theme\" again to add this to the settings.</p>"
223
  msgstr ""
224
 
225
+ #: includes/classes/UI.php:332
226
  msgid ""
227
  "This child theme uses the parent stylesheet but does not load the parent "
228
  "theme's <code>style.css</code> file."
229
  msgstr ""
230
 
231
+ #: includes/classes/UI.php:333
232
  msgid ""
233
  "<p>Please select a stylesheet handling method or check \"Ignore parent theme "
234
  "stylesheets\" (see step 6, below).</p>"
235
  msgstr ""
236
 
237
+ #: includes/classes/UI.php:334
238
  msgid "This child theme appears to be functioning correctly."
239
  msgstr ""
240
 
241
+ #: includes/classes/UI.php:335
242
  msgid "This theme appears OK to use as a Child theme."
243
  msgstr ""
244
 
245
+ #: includes/classes/UI.php:336
246
  msgid "This Child Theme has not been configured for this plugin."
247
  msgstr ""
248
 
249
+ #: includes/classes/UI.php:337
250
  msgid ""
251
  "<p>The Configurator makes significant modifications to the child theme, "
252
  "including stylesheet changes and additional php functions. Please consider "
254
  "original as a backup.</p>"
255
  msgstr ""
256
 
257
+ #: includes/classes/UI.php:338
258
  msgid ""
259
  "This child theme uses <code>@import</code> to load the parent theme's "
260
  "<code>style.css</code> file."
261
  msgstr ""
262
 
263
+ #: includes/classes/UI.php:339
264
  msgid ""
265
  "<p>Please consider selecting \"Use the WordPress style queue\" for the "
266
  "parent stylesheet handling option (see step 6, below).</p>"
267
  msgstr ""
268
 
269
+ #: includes/classes/UI.php:340
270
  msgid ""
271
  "This theme loads additional stylesheets after the <code>style.css</code> "
272
  "file:"
273
  msgstr ""
274
 
275
+ #: includes/classes/UI.php:341
276
  msgid ""
277
  "<p>Consider saving new custom styles to a \"Separate stylesheet\" (see step "
278
  "5, below) so that you can customize these styles.</p>"
279
  msgstr ""
280
 
281
+ #: includes/classes/UI.php:342
282
  msgid ""
283
  "The parent theme's <code>style.css</code> file is being loaded automatically."
284
  msgstr ""
285
 
286
+ #: includes/classes/UI.php:343
287
  msgid ""
288
  "<p>The Configurator selected \"Do not add any parent stylesheet handling\" "
289
  "for the \"Parent stylesheet handling\" option (see step 6, below).</p>"
290
  msgstr ""
291
 
292
+ #: includes/classes/UI.php:344
293
  msgid ""
294
  "This theme does not require the parent theme's <code>style.css</code> file "
295
  "for its appearance."
296
  msgstr ""
297
 
298
+ #: includes/classes/UI.php:345
299
  msgid ""
300
  "This Child Theme was configured to accomodate a hard-coded stylesheet link."
301
  msgstr ""
302
 
303
+ #: includes/classes/UI.php:346
304
  msgid ""
305
  "<p>This workaround was used in earlier versions of CTC and can be eliminated "
306
  "by using the \"Repair header template\" option (see step 6, \"Additional "
307
  "handling options\", below).</p>"
308
  msgstr ""
309
 
310
+ #: includes/classes/UI.php:347
311
  msgid ""
312
  "Click to show/hide raw analysis data. Please include contents below with any "
313
  "support requests."
314
  msgstr ""
315
 
316
+ #: includes/classes/UI.php:348
317
  msgid ""
318
  "This child theme was configured using the CTC Pro \"Genesis stylesheet "
319
  "handling\" method."
320
  msgstr ""
321
 
322
+ #: includes/classes/UI.php:349
323
  msgid ""
324
  "<p>This method has been replaced by the \"Separate stylesheet\" and \"Ignore "
325
  "Parent Theme\" options ( selected below ) for broader framework "
326
  "compatability.</p>"
327
  msgstr ""
328
 
329
+ #: includes/classes/UI.php:350
330
  msgid "<p>%1Click Here%2 to view the theme as viewed by the Analyzer.</p>"
331
  msgstr ""
332
 
333
+ #: includes/classes/UI.php:351
334
  msgid ""
335
  "This theme uses a RTL (right-to-left) stylesheet that is not being loaded in "
336
  "the child theme."
337
  msgstr ""
338
 
339
+ #: includes/classes/UI.php:352
340
  msgid ""
341
  "Use the Web Fonts tab to add a link to the parent RTL stylesheet. See the "
342
  "documentation for more information.</p>"
343
  msgstr ""
344
 
345
+ #: includes/classes/UI.php:353
346
  msgid "Both WP Rocket and Autoptimize plugins are enabled."
347
  msgstr ""
348
 
349
+ #: includes/classes/UI.php:354
350
  msgid ""
351
  "The combination of these two plugins interferes with the Analysis results. "
352
  "Please temporarily deactivate one of them and Analyze again."
353
  msgstr ""
354
 
355
+ #: includes/classes/UI.php:355
356
  msgid ""
357
  "<p><strong>The WordPress configuration file has been modified incorrectly.</"
358
  "strong> Please see <a href=\"http://www.childthemeconfigurator.com/child-"
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: child, theme, child theme, child themes, custom styles, customize styles,
5
  Requires at least: 4.0
6
  Requires PHP: 5.6.36
7
  Tested up to: 5.0.3
8
- Stable tag: 2.4.1
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -296,6 +296,12 @@ https://www.youtube.com/watch?v=iBiiAgsK4G4
296
  7. Files tab
297
 
298
  == Changelog ==
 
 
 
 
 
 
299
  = 2.4.1 =
300
  * Fixed localization issues (thanks @alexclassroom for identifying these)
301
  * Modified style_loader_src hook to only add timestamp under certain conditions to prevent loading delay for most requests. (thanks @anthony750)
@@ -562,7 +568,7 @@ https://www.youtube.com/watch?v=iBiiAgsK4G4
562
  * Initial release.
563
 
564
  == Upgrade Notice ==
565
- 2.3.0.x Several bug fixes and functionality improvements. See changelog for details.
566
 
567
  == Query/Selector Tab ==
568
 
5
  Requires at least: 4.0
6
  Requires PHP: 5.6.36
7
  Tested up to: 5.0.3
8
+ Stable tag: 2.4.2
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
296
  7. Files tab
297
 
298
  == Changelog ==
299
+ = 2.4.2 =
300
+ * Added call to customizer.php to initialize theme mods prior to analyzing child theme
301
+ * Deferred copy_theme_mods until after child theme analysis. This allows hooks in Preview to initialize custom theme mods
302
+ * Added mpriority (max priority) to CSS object to accommodate multiple irregular stylesheet hooks
303
+ * Restored original (pre 2.4.1) version filter hook style_loader_src to child theme stylesheets to prevent caching
304
+ * Strip closing php tag from functions.php to prevent premature response header
305
  = 2.4.1 =
306
  * Fixed localization issues (thanks @alexclassroom for identifying these)
307
  * Modified style_loader_src hook to only add timestamp under certain conditions to prevent loading delay for most requests. (thanks @anthony750)
568
  * Initial release.
569
 
570
  == Upgrade Notice ==
571
+ 2.4.x Several bug fixes and functionality improvements. See changelog for details.
572
 
573
  == Query/Selector Tab ==
574