Child Theme Configurator - Version 2.1.0

Version Description

  • Loading dictionaries on demand
  • Reversed key/value dictionary structure for huge memory improvement
  • Added packer class to flatten multidim arrays for huge memory improvement
  • Reduced key name lengths throughout
  • Improved data validation on inputs
  • Minimum Pro version
  • Move html output to separate view includes
  • Move theme mod routines to own functions
Download this release

Release Info

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

Code changes from version 2.0.5 to 2.1.0

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.0.5
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com
12
  Text Domain: child-theme-configurator
@@ -44,15 +44,16 @@ if ( !defined( 'ABSPATH' ) ) exit;
44
  register_uninstall_hook( __FILE__, 'chld_thm_cfg_uninstall' );
45
 
46
  function chld_thm_cfg_uninstall() {
47
- delete_option( CHLD_THM_CFG_OPTIONS );
48
- delete_option( CHLD_THM_CFG_OPTIONS . '_configvars' );
49
- delete_option( CHLD_THM_CFG_OPTIONS . '_dict_qs' );
50
- delete_option( CHLD_THM_CFG_OPTIONS . '_dict_sel' );
51
- delete_option( CHLD_THM_CFG_OPTIONS . '_dict_query' );
52
- delete_option( CHLD_THM_CFG_OPTIONS . '_dict_rule' );
53
- delete_option( CHLD_THM_CFG_OPTIONS . '_dict_val' );
54
- delete_option( CHLD_THM_CFG_OPTIONS . '_dict_seq' );
55
- delete_option( CHLD_THM_CFG_OPTIONS . '_sel_ndx' );
56
- delete_option( CHLD_THM_CFG_OPTIONS . '_val_ndx' );
 
57
  }
58
 
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.1.0
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com
12
  Text Domain: child-theme-configurator
44
  register_uninstall_hook( __FILE__, 'chld_thm_cfg_uninstall' );
45
 
46
  function chld_thm_cfg_uninstall() {
47
+ delete_site_option( CHLD_THM_CFG_OPTIONS );
48
+ delete_site_option( CHLD_THM_CFG_OPTIONS . '_configvars' );
49
+ delete_site_option( CHLD_THM_CFG_OPTIONS . '_dict_qs' );
50
+ delete_site_option( CHLD_THM_CFG_OPTIONS . '_dict_sel' );
51
+ delete_site_option( CHLD_THM_CFG_OPTIONS . '_dict_query' );
52
+ delete_site_option( CHLD_THM_CFG_OPTIONS . '_dict_rule' );
53
+ delete_site_option( CHLD_THM_CFG_OPTIONS . '_dict_val' );
54
+ delete_site_option( CHLD_THM_CFG_OPTIONS . '_dict_seq' );
55
+ delete_site_option( CHLD_THM_CFG_OPTIONS . '_dict_token' );
56
+ delete_site_option( CHLD_THM_CFG_OPTIONS . '_sel_ndx' );
57
+ delete_site_option( CHLD_THM_CFG_OPTIONS . '_val_ndx' );
58
  }
59
 
css/chldthmcfg.css CHANGED
@@ -1,8 +1,8 @@
1
  body {
2
- background:none !important;
3
  }
4
  p {
5
- line-height:1.4;
6
  }
7
  .wrap h1, .wrap h2 {
8
  font-size: 23px;
@@ -26,21 +26,25 @@ h2 .nav-tab, h2 .ctc-recent-tab {
26
  font-size: 13px;
27
  padding: 6px 8px;
28
  font-weight: 700;
29
- line-height: 24px;
 
 
 
 
30
  }
31
  .ctc-option-panel-container {
32
  position: relative;
33
  min-height: 1100px;
34
- width:100%;
35
  overflow: auto;
36
  }
37
  .ctc-three-col {
38
- -moz-columns:3;
39
- -moz-column-gap:3em;
40
- -webkit-columns:3;
41
- -webkit-column-gap:3em;
42
- columns:3;
43
- column-gap:3em;
44
  }
45
  #ctc_recent_selectors ul li, #all_styles_panel ul li {
46
  margin: 0;
@@ -53,21 +57,18 @@ h2 .nav-tab, h2 .ctc-recent-tab {
53
  display: block;
54
  padding: .5em;
55
  }
56
-
57
  #ctc_recent_selectors ul li a:hover, #ctc_recent_selectors ul li a:focus, #all_styles_panel ul li a:hover, #all_styles_panel ul li a:focus {
58
  background-color: #fff;
59
  -webkit-box-shadow: none;
60
  -moz-box-shadow: none;
61
  box-shadow: none;
62
  }
63
-
64
  #view_child_options_panel, #view_parnt_options_panel {
65
  white-space: pre;
66
  overflow: auto;
67
  font-family: monospace;
68
  word-wrap: normal;
69
  }
70
-
71
  .ctc-option-panel {
72
  visibility: hidden;
73
  position: absolute;
@@ -75,22 +76,21 @@ h2 .nav-tab, h2 .ctc-recent-tab {
75
  width: 100%;
76
  top: 0;
77
  left: 0;
78
- padding: 10px 0 0;
79
- /* transition: width 1s ease;
80
  -moz-transition: width 1s ease;
81
  -webkit-transition: width 1s ease;
82
  -o-transition: width 1s ease; */
83
  }
84
  .ctc-recent-container {
85
- top:0;
86
- right:0;
87
- position:absolute;
88
  max-width: 200px;
89
  width: 17%;
90
  display: none;
91
  overflow: auto;
92
- visibility:visible;
93
- left:inherit;
94
  background-color: #E4E4E4;
95
  }
96
  #ctc_recent_selectors {
@@ -101,69 +101,65 @@ h2 .nav-tab, h2 .ctc-recent-tab {
101
  min-height: 1100px;
102
  }
103
  a.ctc-recent-tab {
104
- float:right;
105
- border:1px solid #ccc;
106
  border-bottom: none;
107
  background-color: #E4E4E4;
108
  color: #555;
109
  display: inline-block;
110
  text-decoration: none;
111
  margin: -1px 0 0 0;
112
- /* margin: 1px 0 -1px; */
113
  box-shadow: none;
114
- -moz-box-shadow:none;
115
  -webkit-box-shadow: none;
116
- outline:none;
117
  }
118
  .ctc-recent-tab h3 {
119
  }
120
-
121
  .ctc-option-panel-active {
122
  visibility: visible;
123
  }
124
  .ctc-step {
125
- -moz-border-radius:50%;
126
- -webkit-border-radius:50%;
127
- border-radius:50%;
128
- text-align:center;
129
- font-weight:700;
130
- font-style:normal;
131
-
132
  }
133
  .ctc-step-number {
134
- color:#fff;
135
- font-size:20px;
136
- width:24px;
137
- height:24px;
138
- line-height:1.1;
139
- padding:8px;
140
- float:left;
141
- display:block;
142
- margin-right:8px;
143
- margin-bottom:2em;
144
  }
145
  .ctc-step-letter {
146
- color:#fff;
147
- font-size:1em;
148
- width:24px;
149
- height:24px;
150
- padding:8px;
151
- line-height:1;
152
- float:right;
153
- display:block;
154
- margin-right:-8px;
155
- margin-top:8px;
156
-
157
  }
158
  .ctc-step + strong {
159
- font-size:1.1em;
160
  }
161
  .ctc-step + strong.shift:before {
162
- position:relative;
163
- content:'';
164
- display:block;
165
- height:10px;
166
-
167
  }
168
  .ctc-swatch {
169
  display: block;
@@ -173,11 +169,9 @@ a.ctc-recent-tab {
173
  line-height: 1;
174
  overflow: hidden;
175
  }
176
-
177
  .ctc-hidden {
178
  display: none;
179
  }
180
-
181
  .ctc-swatch.ctc-specific {
182
  min-height: 60px;
183
  max-height: 100px;
@@ -186,17 +180,15 @@ a.ctc-recent-tab {
186
  border: 1px solid #ddd;*/
187
  }
188
  .ctc-selector-inner-container .ctc-swatch.ctc-specific {
189
- max-width:13%;
190
  }
191
  .ctc-parent-row {
192
  clear: both;
193
  position: relative;
194
  margin: 4px 0;
195
  }
196
-
197
  .ctc-parent-value {
198
  }
199
-
200
  .ctc-input-cell {
201
  display: block;
202
  float: left;
@@ -206,7 +198,7 @@ a.ctc-recent-tab {
206
  word-wrap: break-word;
207
  }
208
  .ctc-selector-inner-container .ctc-input-cell {
209
- width:35%;
210
  }
211
  .ctc-input-cell-wide {
212
  display: block;
@@ -214,7 +206,6 @@ a.ctc-recent-tab {
214
  width: 60%;
215
  margin-right: 2%;
216
  }
217
-
218
  .ctc-input-cell-wide input[type="text"] {
219
  width: 100%;
220
  }
@@ -234,24 +225,19 @@ a.ctc-recent-tab {
234
  }
235
  .ctc-save-input {
236
  }
237
-
238
  .ctc-selector-inner-container .ctc-button-cell, .ctc-selector-inner-container .ctc-input-cell.ctc-button-cell {
239
  width: 8%;
240
  }
241
-
242
  .ctc-textarea-button-cell {
243
  margin: 4px 10px 15px;
244
  /*width: 85px;*/
245
  text-align: right;
246
  float: right;
247
  }
248
-
249
  .ctc-selector-link {
250
  }
251
-
252
  .ctc-selector-handle {
253
  }
254
-
255
  .ctc-rewrite-toggle {
256
  font-size: 0.8em;
257
  padding-left: 1em;
@@ -260,11 +246,10 @@ a.ctc-recent-tab {
260
  }
261
  .ctc-delete-input {
262
  font-size: 0.8em;
263
- float:right;
264
  color: darkred;
265
- text-decoration:none;
266
  }
267
-
268
  .ctc-selector-container {
269
  clear: both;
270
  background: #f9f9f9;
@@ -281,18 +266,15 @@ a.ctc-recent-tab {
281
  -webkit-box-shadow: 0 2px 10px rgba(0,0,0,0.3);
282
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
283
  }
284
-
285
  .ctc-selector-inner-container {
286
  position: relative;
287
  min-height: 300px;
288
  /*max-height: 500px;*/
289
  overflow: auto;
290
  }
291
-
292
  .ctc-status-icon {
293
- /*max-width: 4%;*/
294
  }
295
-
296
  .ctc-status-icon.success {
297
  display: block;
298
  float: right;
@@ -301,7 +283,6 @@ a.ctc-recent-tab {
301
  width: 16px;
302
  margin: 4px;
303
  }
304
-
305
  .ctc-status-icon.failure {
306
  display: block;
307
  float: right;
@@ -310,7 +291,6 @@ a.ctc-recent-tab {
310
  width: 16px;
311
  margin: 4px;
312
  }
313
-
314
  .ctc-exit {
315
  display: block;
316
  width: 20px;
@@ -325,14 +305,11 @@ a.ctc-recent-tab {
325
  -webkit-border-radius: 16px;
326
  border-radius: 16px;
327
  }
328
-
329
  .ctc-exit:hover, .ctc-exit:active {
330
  background-position: right top;
331
  }
332
-
333
  .ctc-query-heading {
334
  }
335
-
336
  .ctc-selector-row {
337
  clear: both;
338
  margin: 0;
@@ -340,7 +317,6 @@ a.ctc-recent-tab {
340
  border-top: 1px solid #ddd;
341
  border-bottom: 1px solid #fff;
342
  }
343
-
344
  .ctc-input-row {
345
  clear: both;
346
  margin: 4px 0;
@@ -348,7 +324,6 @@ a.ctc-recent-tab {
348
  border-bottom: 1px solid #ddd;
349
  position: relative;
350
  }
351
-
352
  .ctc-selector-value {
353
  }
354
  .howto.sep {
@@ -357,86 +332,72 @@ a.ctc-recent-tab {
357
  padding-bottom: 1em;
358
  }
359
  .howto.indent {
360
- padding-left:1.75em;
361
- margin-top:.25em;
362
  }
363
  .ctc-selector-cell {
364
  float: left;
365
  width: 30%;
366
  margin-right: 2%;
367
  }
368
-
369
  .ctc-child-input-cell {
370
  display: block;
371
  float: left;
372
  margin-right: 2%;
373
  }
374
-
375
  .ctc-child-input-cell-container {
376
  float: left;
377
  width: 40%;
378
  margin-right: 2%;
379
  }
380
-
381
  .ctc-child-input-cell-container label {
382
  float: left;
383
  clear: both;
384
  width: 100px;
385
  margin-right: 2%;
386
  }
387
-
388
  .ctc-child-input-cell input[type="text"] {
389
  /*width:60px;*/
390
  }
391
-
392
  .ctc-disabled {
393
  opacity: 0.5;
394
  }
395
-
396
  .ctc-select {
397
  max-width: 100%;
398
  }
399
-
400
  .ctc-child-input-cell input[type="text"].ctc-input-wide {
401
  width: 200px;
402
  }
403
-
404
  #ctc_additional_css_label {
405
  cursor: pointer;
406
  }
407
-
408
  #ctc_additional_css_label span {
409
  white-space: nowrap;
410
  }
411
- .clearfix:before,.clearfix:after{
412
  content: ' ';
413
  display: table;
414
  margin: 0;
415
  padding: 0;
416
  }
417
-
418
  .clearfix:after, .clear {
419
  clear: both;
420
  }
421
-
422
  .ie7 .clearfix {
423
  zoom: 1;
424
  }
425
-
426
  .smaller {
427
  font-size: .85em;
428
  }
429
 
430
- .writable {
431
  color: red;
432
  }
433
-
434
  /* added in 1.5.4 because it is not being loaded by the admin */
435
  .ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus {
436
  background-color: #DADADA;
437
  color: #212121;
438
  }
439
-
440
  .ui-menu .ui-menu-item {
441
  position: relative;
442
  margin: 0px;
@@ -447,7 +408,6 @@ a.ctc-recent-tab {
447
  text-overflow: ellipsis;
448
  max-width: 450px;
449
  }
450
-
451
  /*** Added in 1.6.0 for new options ***/
452
  .ctc-section-toggle {
453
  /*margin:0;
@@ -455,62 +415,54 @@ a.ctc-recent-tab {
455
  position: relative;
456
  cursor: pointer;
457
  }
458
-
459
  .ctc-section-toggle:before {
460
  content: "\f140";
461
  font-weight: 400;
462
  font-size: 1.5em;
463
- line-height:1;
464
  font-family: dashicons;
465
  color: #999;
466
- display:block;
467
- float:right;
468
- width:1em;
469
- height:1em;
470
-
471
  }
472
-
473
  .ctc-section-toggle.open:before {
474
  content: "\f142";
475
  }
476
  a.ctc-section-toggle, a.ctc-section-toggle:hover, a.ctc-section-toggle:active, a.ctc-section-toggle:visited {
477
  text-decoration: none;
478
- float:right;
479
- font-size:.85em;
480
- box-shadow:none;
481
- -moz-box-shadow:none;
482
- -webkit-box-shadow:none;
483
- outline:none;
484
  }
485
  .ctc-section-toggle-content {
486
  display: none;
487
  position: relative;
488
- margin:0;
489
- padding:1px 0;
490
  }
491
-
492
  /*** Added in 1.6.0 for new Theme chooser ***/
493
  .ctc-theme-only {
494
  margin: 0;
495
  padding: 0;
496
  position: relative;
497
  }
498
-
499
  h3.theme-name {
500
  margin: .25em 0;
501
  font-size: 1.2em;
502
  }
503
-
504
  .ctc-theme-option {
505
  max-width: 250px;
506
  }
507
-
508
  .ctc-theme-option-left {
509
  float: left;
510
  width: 40%;
511
  margin-right: 5%;
512
  }
513
-
514
  .ctc-theme-option-right {
515
  float: right;
516
  width: 55%;
@@ -518,13 +470,12 @@ h3.theme-name {
518
  font-size: .9em;
519
  line-height: 1.3;
520
  }
521
-
522
  .ctc-theme-option-image {
523
  height: auto;
524
  width: 100%;
525
  border: 1px solid #ddd;
526
  }
527
- #ctc_theme_attributes_content,#ctc_stylesheet_handling_content {
528
  padding: 1.5em 2.5em;
529
  }
530
  /* jquery UI widget classes */
@@ -533,29 +484,24 @@ h3.theme-name {
533
  border: 1px solid #aaa;
534
  background-color: #fff;
535
  }
536
-
537
  .ui-widget-header {
538
  border: 1px solid #aaa;
539
  background-color: #ccc;
540
  font-weight: bold;
541
  }
542
-
543
  .ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default {
544
  border: 1px solid #d3d3d3;
545
  font-weight: normal;
546
  color: #555555;
547
  }
548
-
549
  .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus {
550
  font-weight: normal;
551
  color: #212121;
552
  }
553
-
554
  .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active {
555
  font-weight: normal;
556
  color: #212121;
557
  }
558
-
559
  /* jQuery UI selectmenu classes */
560
 
561
  .ui-selectmenu-menu {
@@ -566,7 +512,6 @@ h3.theme-name {
566
  left: 0;
567
  display: none;
568
  }
569
-
570
  .ui-selectmenu-menu .ui-menu {
571
  overflow: auto;
572
  max-height: 372px;
@@ -574,15 +519,12 @@ h3.theme-name {
574
  /* Support: IE7 */
575
  overflow-x: hidden;/*padding-bottom: 1px;*/
576
  }
577
-
578
  .ui-selectmenu-menu .ui-menu .ui-menu-item {
579
  padding: 6px;
580
  }
581
-
582
  .ui-selectmenu-open {
583
  display: block;
584
  }
585
-
586
  .ui-selectmenu-button {
587
  display: inline-block;
588
  overflow: hidden;
@@ -590,9 +532,8 @@ h3.theme-name {
590
  text-decoration: none;
591
  cursor: pointer;
592
  min-width: 200px;
593
- padding:.4em 0;
594
  }
595
-
596
  .ui-selectmenu-button span.ui-icon {
597
  right: 0.5em;
598
  left: auto;
@@ -600,14 +541,12 @@ h3.theme-name {
600
  position: absolute;
601
  top: 50%;
602
  }
603
-
604
  .ui-icon-triangle-1-s:before {
605
  display: inline-block;
606
  -webkit-font-smoothing: antialiased;
607
  font: normal 20px/1 'dashicons';
608
  content: "\f140";
609
  }
610
-
611
  .ui-selectmenu-button span.ui-selectmenu-text {
612
  text-align: left;
613
  padding: 0.4em 2.1em 0.4em 1em;
@@ -619,39 +558,37 @@ h3.theme-name {
619
  }
620
  /* get pro tab styles */
621
  #get_pro_panel h1 {
622
- font-size:1.75em;
623
  color: rgb(198, 66, 0);
624
  }
625
  #get_pro_panel h3 {
626
- font-size:1.4em;
627
- margin-bottom:0;
628
  }
629
-
630
  #get_pro_panel p {
631
- font-size:1em;
632
  margin: .5em 0;
633
  }
634
  .ctc-input-cell .notice-warning, .ctc-input-cell-wide.notice-warning {
635
  margin: 0;
636
  }
637
  .ctc-input-cell-wide.notice-warning {
638
- margin-bottom:1em;
639
  }
640
  #get_pro_panel ul, .ctc-input-cell-wide.notice-warning ul {
641
  list-style: square;
642
  }
643
  #get_pro_panel li, .ctc-input-cell-wide.notice-warning li {
644
- margin-left:2em;
645
  }
646
  #get_pro_panel h3 a {
647
  display: block;
648
- padding:5px 10px;
649
  background-color: rgb(198, 66, 0);
650
  color: #fff;
651
  text-decoration: none;
652
  text-align: center;
653
  }
654
-
655
  #get_pro_panel h3 a:hover {
656
  background-color: #FF902E;
657
  color: #fff;
@@ -661,27 +598,26 @@ h3.theme-name {
661
  height: auto;
662
  }
663
  .ctc_analyze_loading {
664
- display:inline-block;
665
- line-height:2em;
666
  }
667
  #ctc_main .dashicons-before:before {
668
  float: left;
669
- margin-top:.5em;
670
- margin-right:.5em;
671
- font-size:2em;
672
  content: "\f534";
673
  }
674
  #ctc_main .dashicons-before.error:before {
675
- color:#DC3232;
676
  }
677
  #ctc_main .dashicons-before.notice-warning:before {
678
- color:#FFBA00;
679
  }
680
  #ctc_main .dashicons-before.updated:before {
681
- color:#46B450;
682
  content: "\f147";
683
  }
684
-
685
  /* big buttons that are hard to miss */
686
 
687
  .wp-core-ui .button-primary, .wp-core-ui .button-secondary {
@@ -696,7 +632,18 @@ h3.theme-name {
696
  -webkit-border-radius: 3px;
697
  border-radius: 3px;
698
  }
699
-
 
 
 
 
 
 
 
 
 
 
 
700
  /***
701
  Spectrum Colorpicker v1.7.0
702
  https://github.com/bgrins/spectrum
@@ -705,12 +652,12 @@ License: MIT
705
  ***/
706
 
707
  .sp-container {
708
- position:absolute;
709
- top:0;
710
- left:0;
711
- display:inline-block;
712
- *display: inline;
713
- *zoom: 1;
714
  /* https://github.com/bgrins/spectrum/issues/40 */
715
  z-index: 9999994;
716
  overflow: hidden;
@@ -718,60 +665,54 @@ License: MIT
718
  .sp-container.sp-flat {
719
  position: relative;
720
  }
721
-
722
  /* Fix for * { box-sizing: border-box; } */
723
- .sp-container,
724
- .sp-container * {
725
  -webkit-box-sizing: content-box;
726
- -moz-box-sizing: content-box;
727
- box-sizing: content-box;
728
  }
729
-
730
  /* http://ansciath.tumblr.com/post/7347495869/css-aspect-ratio */
731
  .sp-top {
732
- position:relative;
733
- width: 100%;
734
- display:inline-block;
735
  }
736
  .sp-top-inner {
737
- position:absolute;
738
- top:0;
739
- left:0;
740
- bottom:0;
741
- right:0;
742
  }
743
  .sp-color {
744
  position: absolute;
745
- top:0;
746
- left:0;
747
- bottom:0;
748
- right:20%;
749
  }
750
  .sp-hue {
751
  position: absolute;
752
- top:0;
753
- right:0;
754
- bottom:0;
755
- left:84%;
756
  height: 100%;
757
  }
758
-
759
  .sp-clear-enabled .sp-hue {
760
- top:33px;
761
  height: 77.5%;
762
  }
763
-
764
  .sp-fill {
765
  padding-top: 80%;
766
  }
767
  .sp-sat, .sp-val {
768
  position: absolute;
769
- top:0;
770
- left:0;
771
- right:0;
772
- bottom:0;
773
  }
774
-
775
  .sp-alpha-enabled .sp-top {
776
  margin-bottom: 18px;
777
  }
@@ -779,8 +720,8 @@ License: MIT
779
  display: block;
780
  }
781
  .sp-alpha-handle {
782
- position:absolute;
783
- top:-4px;
784
  bottom: -4px;
785
  width: 6px;
786
  left: 50%;
@@ -800,33 +741,28 @@ License: MIT
800
  .sp-alpha-inner {
801
  border: solid 1px #333;
802
  }
803
-
804
  .sp-clear {
805
  display: none;
806
  }
807
-
808
  .sp-clear.sp-clear-display {
809
  background-position: center;
810
  }
811
-
812
  .sp-clear-enabled .sp-clear {
813
  display: block;
814
- position:absolute;
815
- top:0px;
816
- right:0;
817
- bottom:0;
818
- left:84%;
819
  height: 28px;
820
  }
821
-
822
  /* Don't allow text selection */
823
- .sp-container, .sp-replacer, .sp-preview, .sp-dragger, .sp-slider, .sp-alpha, .sp-clear, .sp-alpha-handle, .sp-container.sp-dragging .sp-input, .sp-container button {
824
- -webkit-user-select:none;
825
  -moz-user-select: -moz-none;
826
- -o-user-select:none;
827
  user-select: none;
828
  }
829
-
830
  .sp-container.sp-input-disabled .sp-input-container {
831
  display: none;
832
  }
@@ -842,22 +778,19 @@ License: MIT
842
  .sp-palette-disabled .sp-palette-container {
843
  display: none;
844
  }
845
-
846
  .sp-initial-disabled .sp-initial {
847
  display: none;
848
  }
849
-
850
-
851
  /* Gradients for hue, saturation and value instead of images. Not pretty... but it works */
852
  .sp-sat {
853
- background-image: -webkit-gradient(linear, 0 0, 100% 0, from(#FFF), to(rgba(204, 154, 129, 0)));
854
  background-image: -webkit-linear-gradient(left, #FFF, rgba(204, 154, 129, 0));
855
  background-image: -moz-linear-gradient(left, #fff, rgba(204, 154, 129, 0));
856
  background-image: -o-linear-gradient(left, #fff, rgba(204, 154, 129, 0));
857
  background-image: -ms-linear-gradient(left, #fff, rgba(204, 154, 129, 0));
858
  background-image: linear-gradient(to right, #fff, rgba(204, 154, 129, 0));
859
  -ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType = 1, startColorstr=#FFFFFFFF, endColorstr=#00CC9A81)";
860
- filter : progid:DXImageTransform.Microsoft.gradient(GradientType = 1, startColorstr='#FFFFFFFF', endColorstr='#00CC9A81');
861
  }
862
  .sp-val {
863
  background-image: -webkit-gradient(linear, 0 100%, 0 0, from(#000000), to(rgba(204, 154, 129, 0)));
@@ -867,9 +800,8 @@ License: MIT
867
  background-image: -ms-linear-gradient(bottom, #000, rgba(204, 154, 129, 0));
868
  background-image: linear-gradient(to top, #000, rgba(204, 154, 129, 0));
869
  -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00CC9A81, endColorstr=#FF000000)";
870
- filter : progid:DXImageTransform.Microsoft.gradient(startColorstr='#00CC9A81', endColorstr='#FF000000');
871
  }
872
-
873
  .sp-hue {
874
  background: -moz-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
875
  background: -ms-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
@@ -878,66 +810,76 @@ License: MIT
878
  background: -webkit-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
879
  background: linear-gradient(to bottom, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
880
  }
881
-
882
  /* IE filters do not support multiple color stops.
883
  Generate 6 divs, line them up, and do two color gradients for each.
884
  Yes, really.
885
  */
886
  .sp-1 {
887
- height:17%;
888
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0000', endColorstr='#ffff00');
889
  }
890
  .sp-2 {
891
- height:16%;
892
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffff00', endColorstr='#00ff00');
893
  }
894
  .sp-3 {
895
- height:17%;
896
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ff00', endColorstr='#00ffff');
897
  }
898
  .sp-4 {
899
- height:17%;
900
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ffff', endColorstr='#0000ff');
901
  }
902
  .sp-5 {
903
- height:16%;
904
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0000ff', endColorstr='#ff00ff');
905
  }
906
  .sp-6 {
907
- height:17%;
908
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff00ff', endColorstr='#ff0000');
909
  }
910
-
911
  .sp-hidden {
912
  display: none !important;
913
  }
914
-
915
  /* Clearfix hack */
916
- .sp-cf:before, .sp-cf:after { content: ""; display: table; }
917
- .sp-cf:after { clear: both; }
918
- .sp-cf { *zoom: 1; }
 
 
 
 
 
 
 
919
 
920
  /* Mobile devices, make hue slider bigger so it is easier to slide */
921
  @media (max-device-width: 480px) {
922
- .sp-color { right: 40%; }
923
- .sp-hue { left: 63%; }
924
- .sp-fill { padding-top: 60%; }
 
 
 
 
 
 
925
  }
926
  .sp-dragger {
927
- border-radius: 5px;
928
- height: 5px;
929
- width: 5px;
930
- border: 1px solid #fff;
931
- background: #000;
932
- cursor: pointer;
933
- position:absolute;
934
- top:0;
935
- left: 0;
936
  }
937
  .sp-slider {
938
  position: absolute;
939
- top:0;
940
- cursor:pointer;
941
  height: 3px;
942
  left: -1px;
943
  right: -1px;
@@ -945,7 +887,6 @@ License: MIT
945
  background: white;
946
  opacity: .8;
947
  }
948
-
949
  /*
950
  Theme authors:
951
  Here are the basic themeable display options (colors, fonts, global widths).
@@ -971,35 +912,34 @@ See http://bgrins.github.io/spectrum/themes/ for instructions.
971
  .sp-color, .sp-hue, .sp-clear {
972
  border: solid 1px #666;
973
  }
974
-
975
  /* Input */
976
  .sp-input-container {
977
- float:right;
978
  width: 100px;
979
  margin-bottom: 4px;
980
  }
981
- .sp-initial-disabled .sp-input-container {
982
  width: 100%;
983
  }
984
  .sp-input {
985
- font-size: 12px !important;
986
- border: 1px inset;
987
- padding: 4px 5px;
988
- margin: 0;
989
- width: 100%;
990
- background:transparent;
991
- border-radius: 3px;
992
- color: #222;
993
- }
994
- .sp-input:focus {
995
  border: 1px solid orange;
996
  }
997
  .sp-input.sp-validation-error {
998
  border: 1px solid red;
999
  background: #fdd;
1000
  }
1001
- .sp-picker-container , .sp-palette-container {
1002
- float:left;
1003
  position: relative;
1004
  padding: 10px;
1005
  padding-bottom: 300px;
@@ -1009,34 +949,30 @@ See http://bgrins.github.io/spectrum/themes/ for instructions.
1009
  width: 172px;
1010
  border-left: solid 1px #fff;
1011
  }
1012
-
1013
  /* Palettes */
1014
  .sp-palette-container {
1015
  border-right: solid 1px #ccc;
1016
  max-width: 60px;
1017
  }
1018
-
1019
  .sp-palette-only .sp-palette-container {
1020
  border: 0;
1021
  }
1022
-
1023
  .sp-palette .sp-thumb-el {
1024
  display: block;
1025
- position:relative;
1026
- float:left;
1027
  width: 24px;
1028
  height: 15px;
1029
  margin: 3px;
1030
  cursor: pointer;
1031
- border:solid 2px transparent;
1032
  }
1033
  .sp-palette .sp-thumb-el:hover, .sp-palette .sp-thumb-el.sp-thumb-active {
1034
  border-color: orange;
1035
  }
1036
  .sp-thumb-el {
1037
- position:relative;
1038
  }
1039
-
1040
  /* Initial */
1041
  .sp-initial {
1042
  float: left;
@@ -1045,31 +981,27 @@ See http://bgrins.github.io/spectrum/themes/ for instructions.
1045
  .sp-initial span {
1046
  width: 30px;
1047
  height: 25px;
1048
- border:none;
1049
- display:block;
1050
- float:left;
1051
- margin:0;
1052
  }
1053
-
1054
  .sp-initial .sp-clear-display {
1055
  background-position: center;
1056
  }
1057
-
1058
  /* Buttons */
1059
- .sp-palette-button-container,
1060
- .sp-button-container {
1061
  float: right;
1062
  }
1063
-
1064
  /* Replacer (the little preview div that shows up instead of the <input>) */
1065
  .sp-replacer {
1066
- margin:0;
1067
- overflow:hidden;
1068
- cursor:pointer;
1069
  padding: 4px;
1070
- display:inline-block;
1071
- *zoom: 1;
1072
- *display: inline;
1073
  border: solid 1px #91765d;
1074
  background: #eee;
1075
  color: #333;
@@ -1080,7 +1012,7 @@ See http://bgrins.github.io/spectrum/themes/ for instructions.
1080
  color: #111;
1081
  }
1082
  .sp-replacer.sp-disabled {
1083
- cursor:default;
1084
  border-color: silver;
1085
  color: silver;
1086
  }
@@ -1088,54 +1020,50 @@ See http://bgrins.github.io/spectrum/themes/ for instructions.
1088
  padding: 2px 0;
1089
  height: 16px;
1090
  line-height: 16px;
1091
- float:left;
1092
- font-size:10px;
1093
- font-family:sans-serif;
1094
  }
1095
  .sp-preview {
1096
- position:relative;
1097
- width:25px;
1098
  height: 20px;
1099
  border: solid 1px #222;
1100
  margin-right: 5px;
1101
- float:left;
1102
  z-index: 0;
1103
  }
1104
-
1105
  .sp-palette {
1106
- *width: 220px;
1107
  max-width: 220px;
1108
  }
1109
  .sp-palette .sp-thumb-el {
1110
- width:16px;
1111
  height: 16px;
1112
- margin:2px 1px;
1113
  border: solid 1px #d0d0d0;
1114
  }
1115
-
1116
  .sp-container {
1117
- padding-bottom:0;
1118
  }
1119
-
1120
-
1121
  /* Buttons: http://hellohappy.org/css3-buttons/ */
1122
  .sp-container button {
1123
- background-color: #eeeeee;
1124
- background-image: -webkit-linear-gradient(top, #eeeeee, #cccccc);
1125
- background-image: -moz-linear-gradient(top, #eeeeee, #cccccc);
1126
- background-image: -ms-linear-gradient(top, #eeeeee, #cccccc);
1127
- background-image: -o-linear-gradient(top, #eeeeee, #cccccc);
1128
- background-image: linear-gradient(to bottom, #eeeeee, #cccccc);
1129
- border: 1px solid #ccc;
1130
- border-bottom: 1px solid #bbb;
1131
- border-radius: 3px;
1132
- color: #333;
1133
- font-size: 14px;
1134
- line-height: 1;
1135
- padding: 5px 4px;
1136
- text-align: center;
1137
- text-shadow: 0 1px 0 #eee;
1138
- vertical-align: middle;
1139
  }
1140
  .sp-container button:hover {
1141
  background-color: #dddddd;
@@ -1161,48 +1089,43 @@ See http://bgrins.github.io/spectrum/themes/ for instructions.
1161
  .sp-cancel {
1162
  font-size: 11px;
1163
  color: #d93f3f !important;
1164
- margin:0;
1165
- padding:2px;
1166
  margin-right: 5px;
1167
  vertical-align: middle;
1168
- text-decoration:none;
1169
-
1170
  }
1171
  .sp-cancel:hover {
1172
  color: #d93f3f !important;
1173
  text-decoration: underline;
1174
  }
1175
-
1176
-
1177
  .sp-palette span:hover, .sp-palette span.sp-thumb-active {
1178
  border-color: #000;
1179
  }
1180
-
1181
  .sp-preview, .sp-alpha, .sp-thumb-el {
1182
- position:relative;
1183
  background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==);
1184
  }
1185
  .sp-preview-inner, .sp-alpha-inner, .sp-thumb-inner {
1186
- display:block;
1187
- position:absolute;
1188
- top:0;left:0;bottom:0;right:0;
 
 
 
1189
  }
1190
-
1191
  .sp-palette .sp-thumb-inner {
1192
  background-position: 50% 50%;
1193
  background-repeat: no-repeat;
1194
  }
1195
-
1196
  .sp-palette .sp-thumb-light.sp-thumb-active .sp-thumb-inner {
1197
  background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAIVJREFUeNpiYBhsgJFMffxAXABlN5JruT4Q3wfi/0DsT64h8UD8HmpIPCWG/KemIfOJCUB+Aoacx6EGBZyHBqI+WsDCwuQ9mhxeg2A210Ntfo8klk9sOMijaURm7yc1UP2RNCMbKE9ODK1HM6iegYLkfx8pligC9lCD7KmRof0ZhjQACDAAceovrtpVBRkAAAAASUVORK5CYII=);
1198
  }
1199
-
1200
  .sp-palette .sp-thumb-dark.sp-thumb-active .sp-thumb-inner {
1201
  background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAAAMdJREFUOE+tkgsNwzAMRMugEAahEAahEAZhEAqlEAZhEAohEAYh81X2dIm8fKpEspLGvudPOsUYpxE2BIJCroJmEW9qJ+MKaBFhEMNabSy9oIcIPwrB+afvAUFoK4H0tMaQ3XtlrggDhOVVMuT4E5MMG0FBbCEYzjYT7OxLEvIHQLY2zWwQ3D+9luyOQTfKDiFD3iUIfPk8VqrKjgAiSfGFPecrg6HN6m/iBcwiDAo7WiBeawa+Kwh7tZoSCGLMqwlSAzVDhoK+6vH4G0P5wdkAAAAASUVORK5CYII=);
1202
  }
1203
-
1204
  .sp-clear-display {
1205
- background-repeat:no-repeat;
1206
  background-position: center;
1207
  background-image: url(data:image/gif;base64,R0lGODlhFAAUAPcAAAAAAJmZmZ2dnZ6enqKioqOjo6SkpKWlpaampqenp6ioqKmpqaqqqqurq/Hx8fLy8vT09PX19ff39/j4+Pn5+fr6+vv7+wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAP8ALAAAAAAUABQAAAihAP9FoPCvoMGDBy08+EdhQAIJCCMybCDAAYUEARBAlFiQQoMABQhKUJBxY0SPICEYHBnggEmDKAuoPMjS5cGYMxHW3IiT478JJA8M/CjTZ0GgLRekNGpwAsYABHIypcAgQMsITDtWJYBR6NSqMico9cqR6tKfY7GeBCuVwlipDNmefAtTrkSzB1RaIAoXodsABiZAEFB06gIBWC1mLVgBa0AAOw==);
1208
  }
1
  body {
2
+ background: none !important;
3
  }
4
  p {
5
+ line-height: 1.4;
6
  }
7
  .wrap h1, .wrap h2 {
8
  font-size: 23px;
26
  font-size: 13px;
27
  padding: 6px 8px;
28
  font-weight: 700;
29
+ line-height: 1.2;
30
+ height:32px;
31
+ max-width:60px;
32
+ white-space:normal;
33
+ text-align:center;
34
  }
35
  .ctc-option-panel-container {
36
  position: relative;
37
  min-height: 1100px;
38
+ width: 100%;
39
  overflow: auto;
40
  }
41
  .ctc-three-col {
42
+ -moz-columns: 3;
43
+ -moz-column-gap: 3em;
44
+ -webkit-columns: 3;
45
+ -webkit-column-gap: 3em;
46
+ columns: 3;
47
+ column-gap: 3em;
48
  }
49
  #ctc_recent_selectors ul li, #all_styles_panel ul li {
50
  margin: 0;
57
  display: block;
58
  padding: .5em;
59
  }
 
60
  #ctc_recent_selectors ul li a:hover, #ctc_recent_selectors ul li a:focus, #all_styles_panel ul li a:hover, #all_styles_panel ul li a:focus {
61
  background-color: #fff;
62
  -webkit-box-shadow: none;
63
  -moz-box-shadow: none;
64
  box-shadow: none;
65
  }
 
66
  #view_child_options_panel, #view_parnt_options_panel {
67
  white-space: pre;
68
  overflow: auto;
69
  font-family: monospace;
70
  word-wrap: normal;
71
  }
 
72
  .ctc-option-panel {
73
  visibility: hidden;
74
  position: absolute;
76
  width: 100%;
77
  top: 0;
78
  left: 0;
79
+ padding: 10px 0 0;/* transition: width 1s ease;
 
80
  -moz-transition: width 1s ease;
81
  -webkit-transition: width 1s ease;
82
  -o-transition: width 1s ease; */
83
  }
84
  .ctc-recent-container {
85
+ top: 0;
86
+ right: 0;
87
+ position: absolute;
88
  max-width: 200px;
89
  width: 17%;
90
  display: none;
91
  overflow: auto;
92
+ visibility: visible;
93
+ left: inherit;
94
  background-color: #E4E4E4;
95
  }
96
  #ctc_recent_selectors {
101
  min-height: 1100px;
102
  }
103
  a.ctc-recent-tab {
104
+ float: right;
105
+ border: 1px solid #ccc;
106
  border-bottom: none;
107
  background-color: #E4E4E4;
108
  color: #555;
109
  display: inline-block;
110
  text-decoration: none;
111
  margin: -1px 0 0 0;
112
+ /* margin: 1px 0 -1px; */
113
  box-shadow: none;
114
+ -moz-box-shadow: none;
115
  -webkit-box-shadow: none;
116
+ outline: none;
117
  }
118
  .ctc-recent-tab h3 {
119
  }
 
120
  .ctc-option-panel-active {
121
  visibility: visible;
122
  }
123
  .ctc-step {
124
+ -moz-border-radius: 50%;
125
+ -webkit-border-radius: 50%;
126
+ border-radius: 50%;
127
+ text-align: center;
128
+ font-weight: 700;
129
+ font-style: normal;
 
130
  }
131
  .ctc-step-number {
132
+ color: #fff;
133
+ font-size: 20px;
134
+ width: 24px;
135
+ height: 24px;
136
+ line-height: 1.1;
137
+ padding: 8px;
138
+ float: left;
139
+ display: block;
140
+ margin-right: 8px;
141
+ margin-bottom: 2em;
142
  }
143
  .ctc-step-letter {
144
+ color: #fff;
145
+ font-size: 1em;
146
+ width: 24px;
147
+ height: 24px;
148
+ padding: 8px;
149
+ line-height: 1;
150
+ float: right;
151
+ display: block;
152
+ margin-right: -8px;
153
+ margin-top: 8px;
 
154
  }
155
  .ctc-step + strong {
156
+ font-size: 1.1em;
157
  }
158
  .ctc-step + strong.shift:before {
159
+ position: relative;
160
+ content: '';
161
+ display: block;
162
+ height: 10px;
 
163
  }
164
  .ctc-swatch {
165
  display: block;
169
  line-height: 1;
170
  overflow: hidden;
171
  }
 
172
  .ctc-hidden {
173
  display: none;
174
  }
 
175
  .ctc-swatch.ctc-specific {
176
  min-height: 60px;
177
  max-height: 100px;
180
  border: 1px solid #ddd;*/
181
  }
182
  .ctc-selector-inner-container .ctc-swatch.ctc-specific {
183
+ max-width: 13%;
184
  }
185
  .ctc-parent-row {
186
  clear: both;
187
  position: relative;
188
  margin: 4px 0;
189
  }
 
190
  .ctc-parent-value {
191
  }
 
192
  .ctc-input-cell {
193
  display: block;
194
  float: left;
198
  word-wrap: break-word;
199
  }
200
  .ctc-selector-inner-container .ctc-input-cell {
201
+ width: 35%;
202
  }
203
  .ctc-input-cell-wide {
204
  display: block;
206
  width: 60%;
207
  margin-right: 2%;
208
  }
 
209
  .ctc-input-cell-wide input[type="text"] {
210
  width: 100%;
211
  }
225
  }
226
  .ctc-save-input {
227
  }
 
228
  .ctc-selector-inner-container .ctc-button-cell, .ctc-selector-inner-container .ctc-input-cell.ctc-button-cell {
229
  width: 8%;
230
  }
 
231
  .ctc-textarea-button-cell {
232
  margin: 4px 10px 15px;
233
  /*width: 85px;*/
234
  text-align: right;
235
  float: right;
236
  }
 
237
  .ctc-selector-link {
238
  }
 
239
  .ctc-selector-handle {
240
  }
 
241
  .ctc-rewrite-toggle {
242
  font-size: 0.8em;
243
  padding-left: 1em;
246
  }
247
  .ctc-delete-input {
248
  font-size: 0.8em;
249
+ float: right;
250
  color: darkred;
251
+ text-decoration: none;
252
  }
 
253
  .ctc-selector-container {
254
  clear: both;
255
  background: #f9f9f9;
266
  -webkit-box-shadow: 0 2px 10px rgba(0,0,0,0.3);
267
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
268
  }
 
269
  .ctc-selector-inner-container {
270
  position: relative;
271
  min-height: 300px;
272
  /*max-height: 500px;*/
273
  overflow: auto;
274
  }
 
275
  .ctc-status-icon {
276
+ /*max-width: 4%;*/
277
  }
 
278
  .ctc-status-icon.success {
279
  display: block;
280
  float: right;
283
  width: 16px;
284
  margin: 4px;
285
  }
 
286
  .ctc-status-icon.failure {
287
  display: block;
288
  float: right;
291
  width: 16px;
292
  margin: 4px;
293
  }
 
294
  .ctc-exit {
295
  display: block;
296
  width: 20px;
305
  -webkit-border-radius: 16px;
306
  border-radius: 16px;
307
  }
 
308
  .ctc-exit:hover, .ctc-exit:active {
309
  background-position: right top;
310
  }
 
311
  .ctc-query-heading {
312
  }
 
313
  .ctc-selector-row {
314
  clear: both;
315
  margin: 0;
317
  border-top: 1px solid #ddd;
318
  border-bottom: 1px solid #fff;
319
  }
 
320
  .ctc-input-row {
321
  clear: both;
322
  margin: 4px 0;
324
  border-bottom: 1px solid #ddd;
325
  position: relative;
326
  }
 
327
  .ctc-selector-value {
328
  }
329
  .howto.sep {
332
  padding-bottom: 1em;
333
  }
334
  .howto.indent {
335
+ padding-left: 1.75em;
336
+ margin-top: .25em;
337
  }
338
  .ctc-selector-cell {
339
  float: left;
340
  width: 30%;
341
  margin-right: 2%;
342
  }
 
343
  .ctc-child-input-cell {
344
  display: block;
345
  float: left;
346
  margin-right: 2%;
347
  }
 
348
  .ctc-child-input-cell-container {
349
  float: left;
350
  width: 40%;
351
  margin-right: 2%;
352
  }
 
353
  .ctc-child-input-cell-container label {
354
  float: left;
355
  clear: both;
356
  width: 100px;
357
  margin-right: 2%;
358
  }
 
359
  .ctc-child-input-cell input[type="text"] {
360
  /*width:60px;*/
361
  }
 
362
  .ctc-disabled {
363
  opacity: 0.5;
364
  }
 
365
  .ctc-select {
366
  max-width: 100%;
367
  }
 
368
  .ctc-child-input-cell input[type="text"].ctc-input-wide {
369
  width: 200px;
370
  }
 
371
  #ctc_additional_css_label {
372
  cursor: pointer;
373
  }
 
374
  #ctc_additional_css_label span {
375
  white-space: nowrap;
376
  }
377
+ .clearfix:before, .clearfix:after {
378
  content: ' ';
379
  display: table;
380
  margin: 0;
381
  padding: 0;
382
  }
 
383
  .clearfix:after, .clear {
384
  clear: both;
385
  }
 
386
  .ie7 .clearfix {
387
  zoom: 1;
388
  }
 
389
  .smaller {
390
  font-size: .85em;
391
  }
392
 
393
+ .writable, .writable a {
394
  color: red;
395
  }
 
396
  /* added in 1.5.4 because it is not being loaded by the admin */
397
  .ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus {
398
  background-color: #DADADA;
399
  color: #212121;
400
  }
 
401
  .ui-menu .ui-menu-item {
402
  position: relative;
403
  margin: 0px;
408
  text-overflow: ellipsis;
409
  max-width: 450px;
410
  }
 
411
  /*** Added in 1.6.0 for new options ***/
412
  .ctc-section-toggle {
413
  /*margin:0;
415
  position: relative;
416
  cursor: pointer;
417
  }
 
418
  .ctc-section-toggle:before {
419
  content: "\f140";
420
  font-weight: 400;
421
  font-size: 1.5em;
422
+ line-height: 1;
423
  font-family: dashicons;
424
  color: #999;
425
+ display: block;
426
+ float: right;
427
+ width: 1em;
428
+ height: 1em;
 
429
  }
 
430
  .ctc-section-toggle.open:before {
431
  content: "\f142";
432
  }
433
  a.ctc-section-toggle, a.ctc-section-toggle:hover, a.ctc-section-toggle:active, a.ctc-section-toggle:visited {
434
  text-decoration: none;
435
+ float: right;
436
+ font-size: .85em;
437
+ box-shadow: none;
438
+ -moz-box-shadow: none;
439
+ -webkit-box-shadow: none;
440
+ outline: none;
441
  }
442
  .ctc-section-toggle-content {
443
  display: none;
444
  position: relative;
445
+ margin: 0;
446
+ padding: 1px 0;
447
  }
 
448
  /*** Added in 1.6.0 for new Theme chooser ***/
449
  .ctc-theme-only {
450
  margin: 0;
451
  padding: 0;
452
  position: relative;
453
  }
 
454
  h3.theme-name {
455
  margin: .25em 0;
456
  font-size: 1.2em;
457
  }
 
458
  .ctc-theme-option {
459
  max-width: 250px;
460
  }
 
461
  .ctc-theme-option-left {
462
  float: left;
463
  width: 40%;
464
  margin-right: 5%;
465
  }
 
466
  .ctc-theme-option-right {
467
  float: right;
468
  width: 55%;
470
  font-size: .9em;
471
  line-height: 1.3;
472
  }
 
473
  .ctc-theme-option-image {
474
  height: auto;
475
  width: 100%;
476
  border: 1px solid #ddd;
477
  }
478
+ #ctc_theme_attributes_content, #ctc_stylesheet_handling_content {
479
  padding: 1.5em 2.5em;
480
  }
481
  /* jquery UI widget classes */
484
  border: 1px solid #aaa;
485
  background-color: #fff;
486
  }
 
487
  .ui-widget-header {
488
  border: 1px solid #aaa;
489
  background-color: #ccc;
490
  font-weight: bold;
491
  }
 
492
  .ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default {
493
  border: 1px solid #d3d3d3;
494
  font-weight: normal;
495
  color: #555555;
496
  }
 
497
  .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus {
498
  font-weight: normal;
499
  color: #212121;
500
  }
 
501
  .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active {
502
  font-weight: normal;
503
  color: #212121;
504
  }
 
505
  /* jQuery UI selectmenu classes */
506
 
507
  .ui-selectmenu-menu {
512
  left: 0;
513
  display: none;
514
  }
 
515
  .ui-selectmenu-menu .ui-menu {
516
  overflow: auto;
517
  max-height: 372px;
519
  /* Support: IE7 */
520
  overflow-x: hidden;/*padding-bottom: 1px;*/
521
  }
 
522
  .ui-selectmenu-menu .ui-menu .ui-menu-item {
523
  padding: 6px;
524
  }
 
525
  .ui-selectmenu-open {
526
  display: block;
527
  }
 
528
  .ui-selectmenu-button {
529
  display: inline-block;
530
  overflow: hidden;
532
  text-decoration: none;
533
  cursor: pointer;
534
  min-width: 200px;
535
+ padding: .4em 0;
536
  }
 
537
  .ui-selectmenu-button span.ui-icon {
538
  right: 0.5em;
539
  left: auto;
541
  position: absolute;
542
  top: 50%;
543
  }
 
544
  .ui-icon-triangle-1-s:before {
545
  display: inline-block;
546
  -webkit-font-smoothing: antialiased;
547
  font: normal 20px/1 'dashicons';
548
  content: "\f140";
549
  }
 
550
  .ui-selectmenu-button span.ui-selectmenu-text {
551
  text-align: left;
552
  padding: 0.4em 2.1em 0.4em 1em;
558
  }
559
  /* get pro tab styles */
560
  #get_pro_panel h1 {
561
+ font-size: 1.75em;
562
  color: rgb(198, 66, 0);
563
  }
564
  #get_pro_panel h3 {
565
+ font-size: 1.4em;
566
+ margin-bottom: 0;
567
  }
 
568
  #get_pro_panel p {
569
+ font-size: 1em;
570
  margin: .5em 0;
571
  }
572
  .ctc-input-cell .notice-warning, .ctc-input-cell-wide.notice-warning {
573
  margin: 0;
574
  }
575
  .ctc-input-cell-wide.notice-warning {
576
+ margin-bottom: 1em;
577
  }
578
  #get_pro_panel ul, .ctc-input-cell-wide.notice-warning ul {
579
  list-style: square;
580
  }
581
  #get_pro_panel li, .ctc-input-cell-wide.notice-warning li {
582
+ margin-left: 2em;
583
  }
584
  #get_pro_panel h3 a {
585
  display: block;
586
+ padding: 5px 10px;
587
  background-color: rgb(198, 66, 0);
588
  color: #fff;
589
  text-decoration: none;
590
  text-align: center;
591
  }
 
592
  #get_pro_panel h3 a:hover {
593
  background-color: #FF902E;
594
  color: #fff;
598
  height: auto;
599
  }
600
  .ctc_analyze_loading {
601
+ display: inline-block;
602
+ line-height: 2em;
603
  }
604
  #ctc_main .dashicons-before:before {
605
  float: left;
606
+ margin-top: .5em;
607
+ margin-right: .5em;
608
+ font-size: 2em;
609
  content: "\f534";
610
  }
611
  #ctc_main .dashicons-before.error:before {
612
+ color: #DC3232;
613
  }
614
  #ctc_main .dashicons-before.notice-warning:before {
615
+ color: #FFBA00;
616
  }
617
  #ctc_main .dashicons-before.updated:before {
618
+ color: #46B450;
619
  content: "\f147";
620
  }
 
621
  /* big buttons that are hard to miss */
622
 
623
  .wp-core-ui .button-primary, .wp-core-ui .button-secondary {
632
  -webkit-border-radius: 3px;
633
  border-radius: 3px;
634
  }
635
+ /* fixed position debug output */
636
+ #ctc_main textarea#ctc_debug_box {
637
+ position: fixed;
638
+ bottom: 0;
639
+ z-index: 10000;
640
+ width: 82%;
641
+ height: 170px;
642
+ font-size:11px;
643
+ }
644
+ #ctc_stylesheet_files {
645
+ display:none;
646
+ }
647
  /***
648
  Spectrum Colorpicker v1.7.0
649
  https://github.com/bgrins/spectrum
652
  ***/
653
 
654
  .sp-container {
655
+ position: absolute;
656
+ top: 0;
657
+ left: 0;
658
+ display: inline-block;
659
+ *display: inline;
660
+ *zoom: 1;
661
  /* https://github.com/bgrins/spectrum/issues/40 */
662
  z-index: 9999994;
663
  overflow: hidden;
665
  .sp-container.sp-flat {
666
  position: relative;
667
  }
 
668
  /* Fix for * { box-sizing: border-box; } */
669
+ .sp-container, .sp-container * {
 
670
  -webkit-box-sizing: content-box;
671
+ -moz-box-sizing: content-box;
672
+ box-sizing: content-box;
673
  }
 
674
  /* http://ansciath.tumblr.com/post/7347495869/css-aspect-ratio */
675
  .sp-top {
676
+ position: relative;
677
+ width: 100%;
678
+ display: inline-block;
679
  }
680
  .sp-top-inner {
681
+ position: absolute;
682
+ top: 0;
683
+ left: 0;
684
+ bottom: 0;
685
+ right: 0;
686
  }
687
  .sp-color {
688
  position: absolute;
689
+ top: 0;
690
+ left: 0;
691
+ bottom: 0;
692
+ right: 20%;
693
  }
694
  .sp-hue {
695
  position: absolute;
696
+ top: 0;
697
+ right: 0;
698
+ bottom: 0;
699
+ left: 84%;
700
  height: 100%;
701
  }
 
702
  .sp-clear-enabled .sp-hue {
703
+ top: 33px;
704
  height: 77.5%;
705
  }
 
706
  .sp-fill {
707
  padding-top: 80%;
708
  }
709
  .sp-sat, .sp-val {
710
  position: absolute;
711
+ top: 0;
712
+ left: 0;
713
+ right: 0;
714
+ bottom: 0;
715
  }
 
716
  .sp-alpha-enabled .sp-top {
717
  margin-bottom: 18px;
718
  }
720
  display: block;
721
  }
722
  .sp-alpha-handle {
723
+ position: absolute;
724
+ top: -4px;
725
  bottom: -4px;
726
  width: 6px;
727
  left: 50%;
741
  .sp-alpha-inner {
742
  border: solid 1px #333;
743
  }
 
744
  .sp-clear {
745
  display: none;
746
  }
 
747
  .sp-clear.sp-clear-display {
748
  background-position: center;
749
  }
 
750
  .sp-clear-enabled .sp-clear {
751
  display: block;
752
+ position: absolute;
753
+ top: 0px;
754
+ right: 0;
755
+ bottom: 0;
756
+ left: 84%;
757
  height: 28px;
758
  }
 
759
  /* Don't allow text selection */
760
+ .sp-container, .sp-replacer, .sp-preview, .sp-dragger, .sp-slider, .sp-alpha, .sp-clear, .sp-alpha-handle, .sp-container.sp-dragging .sp-input, .sp-container button {
761
+ -webkit-user-select: none;
762
  -moz-user-select: -moz-none;
763
+ -o-user-select: none;
764
  user-select: none;
765
  }
 
766
  .sp-container.sp-input-disabled .sp-input-container {
767
  display: none;
768
  }
778
  .sp-palette-disabled .sp-palette-container {
779
  display: none;
780
  }
 
781
  .sp-initial-disabled .sp-initial {
782
  display: none;
783
  }
 
 
784
  /* Gradients for hue, saturation and value instead of images. Not pretty... but it works */
785
  .sp-sat {
786
+ background-image: -webkit-gradient(linear, 0 0, 100% 0, from(#FFF), to(rgba(204, 154, 129, 0)));
787
  background-image: -webkit-linear-gradient(left, #FFF, rgba(204, 154, 129, 0));
788
  background-image: -moz-linear-gradient(left, #fff, rgba(204, 154, 129, 0));
789
  background-image: -o-linear-gradient(left, #fff, rgba(204, 154, 129, 0));
790
  background-image: -ms-linear-gradient(left, #fff, rgba(204, 154, 129, 0));
791
  background-image: linear-gradient(to right, #fff, rgba(204, 154, 129, 0));
792
  -ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType = 1, startColorstr=#FFFFFFFF, endColorstr=#00CC9A81)";
793
+ filter : progid:DXImageTransform.Microsoft.gradient(GradientType = 1, startColorstr='#FFFFFFFF', endColorstr='#00CC9A81');
794
  }
795
  .sp-val {
796
  background-image: -webkit-gradient(linear, 0 100%, 0 0, from(#000000), to(rgba(204, 154, 129, 0)));
800
  background-image: -ms-linear-gradient(bottom, #000, rgba(204, 154, 129, 0));
801
  background-image: linear-gradient(to top, #000, rgba(204, 154, 129, 0));
802
  -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00CC9A81, endColorstr=#FF000000)";
803
+ filter : progid:DXImageTransform.Microsoft.gradient(startColorstr='#00CC9A81', endColorstr='#FF000000');
804
  }
 
805
  .sp-hue {
806
  background: -moz-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
807
  background: -ms-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
810
  background: -webkit-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
811
  background: linear-gradient(to bottom, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
812
  }
 
813
  /* IE filters do not support multiple color stops.
814
  Generate 6 divs, line them up, and do two color gradients for each.
815
  Yes, really.
816
  */
817
  .sp-1 {
818
+ height: 17%;
819
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0000', endColorstr='#ffff00');
820
  }
821
  .sp-2 {
822
+ height: 16%;
823
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffff00', endColorstr='#00ff00');
824
  }
825
  .sp-3 {
826
+ height: 17%;
827
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ff00', endColorstr='#00ffff');
828
  }
829
  .sp-4 {
830
+ height: 17%;
831
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ffff', endColorstr='#0000ff');
832
  }
833
  .sp-5 {
834
+ height: 16%;
835
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0000ff', endColorstr='#ff00ff');
836
  }
837
  .sp-6 {
838
+ height: 17%;
839
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff00ff', endColorstr='#ff0000');
840
  }
 
841
  .sp-hidden {
842
  display: none !important;
843
  }
 
844
  /* Clearfix hack */
845
+ .sp-cf:before, .sp-cf:after {
846
+ content: "";
847
+ display: table;
848
+ }
849
+ .sp-cf:after {
850
+ clear: both;
851
+ }
852
+ .sp-cf {
853
+ *zoom: 1;
854
+ }
855
 
856
  /* Mobile devices, make hue slider bigger so it is easier to slide */
857
  @media (max-device-width: 480px) {
858
+ .sp-color {
859
+ right: 40%;
860
+ }
861
+ .sp-hue {
862
+ left: 63%;
863
+ }
864
+ .sp-fill {
865
+ padding-top: 60%;
866
+ }
867
  }
868
  .sp-dragger {
869
+ border-radius: 5px;
870
+ height: 5px;
871
+ width: 5px;
872
+ border: 1px solid #fff;
873
+ background: #000;
874
+ cursor: pointer;
875
+ position: absolute;
876
+ top: 0;
877
+ left: 0;
878
  }
879
  .sp-slider {
880
  position: absolute;
881
+ top: 0;
882
+ cursor: pointer;
883
  height: 3px;
884
  left: -1px;
885
  right: -1px;
887
  background: white;
888
  opacity: .8;
889
  }
 
890
  /*
891
  Theme authors:
892
  Here are the basic themeable display options (colors, fonts, global widths).
912
  .sp-color, .sp-hue, .sp-clear {
913
  border: solid 1px #666;
914
  }
 
915
  /* Input */
916
  .sp-input-container {
917
+ float: right;
918
  width: 100px;
919
  margin-bottom: 4px;
920
  }
921
+ .sp-initial-disabled .sp-input-container {
922
  width: 100%;
923
  }
924
  .sp-input {
925
+ font-size: 12px !important;
926
+ border: 1px inset;
927
+ padding: 4px 5px;
928
+ margin: 0;
929
+ width: 100%;
930
+ background: transparent;
931
+ border-radius: 3px;
932
+ color: #222;
933
+ }
934
+ .sp-input:focus {
935
  border: 1px solid orange;
936
  }
937
  .sp-input.sp-validation-error {
938
  border: 1px solid red;
939
  background: #fdd;
940
  }
941
+ .sp-picker-container, .sp-palette-container {
942
+ float: left;
943
  position: relative;
944
  padding: 10px;
945
  padding-bottom: 300px;
949
  width: 172px;
950
  border-left: solid 1px #fff;
951
  }
 
952
  /* Palettes */
953
  .sp-palette-container {
954
  border-right: solid 1px #ccc;
955
  max-width: 60px;
956
  }
 
957
  .sp-palette-only .sp-palette-container {
958
  border: 0;
959
  }
 
960
  .sp-palette .sp-thumb-el {
961
  display: block;
962
+ position: relative;
963
+ float: left;
964
  width: 24px;
965
  height: 15px;
966
  margin: 3px;
967
  cursor: pointer;
968
+ border: solid 2px transparent;
969
  }
970
  .sp-palette .sp-thumb-el:hover, .sp-palette .sp-thumb-el.sp-thumb-active {
971
  border-color: orange;
972
  }
973
  .sp-thumb-el {
974
+ position: relative;
975
  }
 
976
  /* Initial */
977
  .sp-initial {
978
  float: left;
981
  .sp-initial span {
982
  width: 30px;
983
  height: 25px;
984
+ border: none;
985
+ display: block;
986
+ float: left;
987
+ margin: 0;
988
  }
 
989
  .sp-initial .sp-clear-display {
990
  background-position: center;
991
  }
 
992
  /* Buttons */
993
+ .sp-palette-button-container, .sp-button-container {
 
994
  float: right;
995
  }
 
996
  /* Replacer (the little preview div that shows up instead of the <input>) */
997
  .sp-replacer {
998
+ margin: 0;
999
+ overflow: hidden;
1000
+ cursor: pointer;
1001
  padding: 4px;
1002
+ display: inline-block;
1003
+ *zoom: 1;
1004
+ *display: inline;
1005
  border: solid 1px #91765d;
1006
  background: #eee;
1007
  color: #333;
1012
  color: #111;
1013
  }
1014
  .sp-replacer.sp-disabled {
1015
+ cursor: default;
1016
  border-color: silver;
1017
  color: silver;
1018
  }
1020
  padding: 2px 0;
1021
  height: 16px;
1022
  line-height: 16px;
1023
+ float: left;
1024
+ font-size: 10px;
1025
+ font-family: sans-serif;
1026
  }
1027
  .sp-preview {
1028
+ position: relative;
1029
+ width: 25px;
1030
  height: 20px;
1031
  border: solid 1px #222;
1032
  margin-right: 5px;
1033
+ float: left;
1034
  z-index: 0;
1035
  }
 
1036
  .sp-palette {
1037
+ *width: 220px;
1038
  max-width: 220px;
1039
  }
1040
  .sp-palette .sp-thumb-el {
1041
+ width: 16px;
1042
  height: 16px;
1043
+ margin: 2px 1px;
1044
  border: solid 1px #d0d0d0;
1045
  }
 
1046
  .sp-container {
1047
+ padding-bottom: 0;
1048
  }
 
 
1049
  /* Buttons: http://hellohappy.org/css3-buttons/ */
1050
  .sp-container button {
1051
+ background-color: #eeeeee;
1052
+ background-image: -webkit-linear-gradient(top, #eeeeee, #cccccc);
1053
+ background-image: -moz-linear-gradient(top, #eeeeee, #cccccc);
1054
+ background-image: -ms-linear-gradient(top, #eeeeee, #cccccc);
1055
+ background-image: -o-linear-gradient(top, #eeeeee, #cccccc);
1056
+ background-image: linear-gradient(to bottom, #eeeeee, #cccccc);
1057
+ border: 1px solid #ccc;
1058
+ border-bottom: 1px solid #bbb;
1059
+ border-radius: 3px;
1060
+ color: #333;
1061
+ font-size: 14px;
1062
+ line-height: 1;
1063
+ padding: 5px 4px;
1064
+ text-align: center;
1065
+ text-shadow: 0 1px 0 #eee;
1066
+ vertical-align: middle;
1067
  }
1068
  .sp-container button:hover {
1069
  background-color: #dddddd;
1089
  .sp-cancel {
1090
  font-size: 11px;
1091
  color: #d93f3f !important;
1092
+ margin: 0;
1093
+ padding: 2px;
1094
  margin-right: 5px;
1095
  vertical-align: middle;
1096
+ text-decoration: none;
 
1097
  }
1098
  .sp-cancel:hover {
1099
  color: #d93f3f !important;
1100
  text-decoration: underline;
1101
  }
 
 
1102
  .sp-palette span:hover, .sp-palette span.sp-thumb-active {
1103
  border-color: #000;
1104
  }
 
1105
  .sp-preview, .sp-alpha, .sp-thumb-el {
1106
+ position: relative;
1107
  background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==);
1108
  }
1109
  .sp-preview-inner, .sp-alpha-inner, .sp-thumb-inner {
1110
+ display: block;
1111
+ position: absolute;
1112
+ top: 0;
1113
+ left: 0;
1114
+ bottom: 0;
1115
+ right: 0;
1116
  }
 
1117
  .sp-palette .sp-thumb-inner {
1118
  background-position: 50% 50%;
1119
  background-repeat: no-repeat;
1120
  }
 
1121
  .sp-palette .sp-thumb-light.sp-thumb-active .sp-thumb-inner {
1122
  background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAIVJREFUeNpiYBhsgJFMffxAXABlN5JruT4Q3wfi/0DsT64h8UD8HmpIPCWG/KemIfOJCUB+Aoacx6EGBZyHBqI+WsDCwuQ9mhxeg2A210Ntfo8klk9sOMijaURm7yc1UP2RNCMbKE9ODK1HM6iegYLkfx8pligC9lCD7KmRof0ZhjQACDAAceovrtpVBRkAAAAASUVORK5CYII=);
1123
  }
 
1124
  .sp-palette .sp-thumb-dark.sp-thumb-active .sp-thumb-inner {
1125
  background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAAAMdJREFUOE+tkgsNwzAMRMugEAahEAahEAZhEAqlEAZhEAohEAYh81X2dIm8fKpEspLGvudPOsUYpxE2BIJCroJmEW9qJ+MKaBFhEMNabSy9oIcIPwrB+afvAUFoK4H0tMaQ3XtlrggDhOVVMuT4E5MMG0FBbCEYzjYT7OxLEvIHQLY2zWwQ3D+9luyOQTfKDiFD3iUIfPk8VqrKjgAiSfGFPecrg6HN6m/iBcwiDAo7WiBeawa+Kwh7tZoSCGLMqwlSAzVDhoK+6vH4G0P5wdkAAAAASUVORK5CYII=);
1126
  }
 
1127
  .sp-clear-display {
1128
+ background-repeat: no-repeat;
1129
  background-position: center;
1130
  background-image: url(data:image/gif;base64,R0lGODlhFAAUAPcAAAAAAJmZmZ2dnZ6enqKioqOjo6SkpKWlpaampqenp6ioqKmpqaqqqqurq/Hx8fLy8vT09PX19ff39/j4+Pn5+fr6+vv7+wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAP8ALAAAAAAUABQAAAihAP9FoPCvoMGDBy08+EdhQAIJCCMybCDAAYUEARBAlFiQQoMABQhKUJBxY0SPICEYHBnggEmDKAuoPMjS5cGYMxHW3IiT478JJA8M/CjTZ0GgLRekNGpwAsYABHIypcAgQMsITDtWJYBR6NSqMico9cqR6tKfY7GeBCuVwlipDNmefAtTrkSzB1RaIAoXodsABiZAEFB06gIBWC1mLVgBa0AAOw==);
1131
  }
includes/class-ctc-admin.php CHANGED
@@ -3,10 +3,10 @@
3
  if ( !defined( 'ABSPATH' ) ) exit;
4
 
5
  /*
6
- Class: Child_Theme_Configurator
7
  Plugin URI: http://www.childthemeconfigurator.com/
8
  Description: Main Controller Class
9
- Version: 2.0.5
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: child-theme-configurator
@@ -18,7 +18,7 @@ class ChildThemeConfiguratorAdmin {
18
 
19
  // state
20
  var $genesis;
21
- var $reorder;
22
  var $processdone;
23
  var $childtype;
24
  var $template;
@@ -35,7 +35,8 @@ class ChildThemeConfiguratorAdmin {
35
  var $menuName; // backward compatibility with plugin extension
36
  var $cache_updates = TRUE;
37
  var $debug;
38
- var $is_debug = 0;
 
39
  // memory checks
40
  var $max_sel;
41
  var $sel_limit;
@@ -45,7 +46,6 @@ class ChildThemeConfiguratorAdmin {
45
  var $errors = array();
46
  var $files = array();
47
  var $updates = array();
48
- var $memory = array();
49
  // objects
50
  var $css;
51
  var $ui;
@@ -97,15 +97,15 @@ class ChildThemeConfiguratorAdmin {
97
  function __construct() {
98
  $this->processdone = FALSE;
99
  $this->genesis = FALSE;
100
- $this->reorder = FALSE;
101
  $this->is_new = FALSE;
102
  $this->encoding = WP_Http_Encoding::is_available();
103
  $this->menuName = CHLD_THM_CFG_MENU; // backward compatability for plugins extension
104
  $this->is_post = ( 'POST' == $_SERVER[ 'REQUEST_METHOD' ] );
105
  $this->is_get = ( 'GET' == $_SERVER[ 'REQUEST_METHOD' ] );
106
  $this->is_debug = get_option( CHLD_THM_CFG_OPTIONS . '_debug' );
107
- if ( $this->is_debug )
108
- $this->debug = get_site_transient( CHLD_THM_CFG_OPTIONS . '_debug' );
109
  }
110
 
111
  /**
@@ -121,7 +121,7 @@ class ChildThemeConfiguratorAdmin {
121
  // perform any checks prior to processing config data
122
  do_action( 'chld_thm_cfg_preprocess' );
123
  // process any additional forms
124
- do_action( 'chld_thm_cfg_forms', $this ); // hook for custom forms
125
  // process main post data
126
  $this->process_post();
127
  // initialize UI
@@ -180,17 +180,17 @@ class ChildThemeConfiguratorAdmin {
180
  include_once( CHLD_THM_CFG_DIR . '/includes/class-ctc-css.php' );
181
  $this->css = new ChildThemeConfiguratorCSS();
182
  if ( FALSE !== $this->css->load_config() ):
183
- $this->debug( 'config exists', __FUNCTION__ );
184
  // if themes do not exist reinitialize
185
  if ( ! $this->check_theme_exists( $this->get( 'child' ) )
186
  || ! $this->check_theme_exists( $this->get( 'parnt' ) ) ):
187
- $this->debug( 'theme does not exist', __FUNCTION__ );
188
  add_action( 'admin_notices', array( $this, 'config_notice' ) );
189
  $this->css = new ChildThemeConfiguratorCSS();
190
  $this->css->enqueue = 'enqueue';
191
  endif;
192
  else:
193
- $this->debug( 'config does not exist', __FUNCTION__ );
194
  // this is a fresh install
195
  $this->css->enqueue = 'enqueue';
196
  endif;
@@ -208,13 +208,13 @@ class ChildThemeConfiguratorAdmin {
208
  add_action( 'admin_notices', array( $this, 'writable_notice' ) );
209
  if ( $fsize = $this->get( 'fsize' ) ):
210
  $test = filesize( $stylesheet );
211
- $this->debug( 'filesize saved: ' . $fsize . ' current: ' . $test, __FUNCTION__ );
212
  if ( $test != $fsize )
213
  add_action( 'admin_notices', array( $this, 'changed_notice' ) );
214
  endif;
215
  // enqueue flag will be null for existing install < 1.6.0
216
  if ( !$this->get( 'enqueue' ) ):
217
- $this->debug( 'no enqueue:', __FUNCTION__ );
218
 
219
  add_action( 'admin_notices', array( $this, 'enqueue_notice' ) );
220
  endif;
@@ -226,7 +226,7 @@ class ChildThemeConfiguratorAdmin {
226
  * Future use: check if max selectors reached
227
  *
228
  if ( $this->get( 'max_sel' ) ):
229
- $this->debug( 'Max selectors exceeded.', __FUNCTION__ );
230
  //$this->errors[] = __( 'Maximum number of styles exceeded.', 'child-theme-configurator' );
231
  add_action( 'admin_notices', array( $this, 'max_styles_notice' ) );
232
  endif;
@@ -238,23 +238,17 @@ class ChildThemeConfiguratorAdmin {
238
  endif;
239
  }
240
 
241
- function cache_debug() {
242
- $this->updates[] = array(
243
- 'obj' => 'debug',
244
- 'key' => '',
245
- 'data' => $this->print_debug( TRUE ),
246
- );
247
- }
248
  /**
249
  * ajax callback for saving form data
250
  */
251
  function ajax_save_postdata( $action = 'ctc_update' ) {
252
  $this->is_ajax = TRUE;
253
-
254
  // security check
255
  if ( $this->validate_post( $action ) ):
256
  if ( 'ctc_plugin' == $action ) do_action( 'chld_thm_cfg_pluginmode' );
257
  $this->verify_creds(); // initialize filesystem access
 
258
  // get configuration data from options API
259
  if ( FALSE !== $this->load_config() ): // sanity check: only update if config data exists
260
  if ( isset( $_POST[ 'ctc_is_debug' ] ) ):
@@ -266,10 +260,8 @@ class ChildThemeConfiguratorAdmin {
266
  // return recent edits and selected stylesheets as cache updates
267
  if ( $this->get( 'child' ) ):
268
  // hook for add'l plugin files and subdirectories
269
- do_action( 'chld_thm_cfg_addl_files', $this );
270
  $this->css->write_css();
271
- // add any additional updates to pass back to browser
272
- do_action( 'chld_thm_cfg_cache_updates' );
273
  /*
274
  $this->updates[] = array(
275
  'obj' => 'addl_css',
@@ -282,6 +274,8 @@ class ChildThemeConfiguratorAdmin {
282
  // update config data in options API
283
  $this->save_config();
284
  endif;
 
 
285
  endif;
286
  endif;
287
  $result = $this->css->obj_to_utf8( $this->updates );
@@ -302,11 +296,13 @@ class ChildThemeConfiguratorAdmin {
302
  if ( $this->validate_post( $action ) ):
303
  if ( 'ctc_plugin' == $action ) do_action( 'chld_thm_cfg_pluginmode' );
304
  $this->load_config();
 
305
  $regex = "/^ctc_query_/";
306
  foreach( preg_grep( $regex, array_keys( $_POST ) ) as $key ):
307
  $name = preg_replace( $regex, '', $key );
308
  $param[ $name ] = sanitize_text_field( $_POST[ $key ] );
309
  endforeach;
 
310
  if ( !empty( $param[ 'obj' ] ) ):
311
  // add any additional updates to pass back to browser
312
  $this->updates[] = array(
@@ -346,10 +342,14 @@ class ChildThemeConfiguratorAdmin {
346
  die( 0 );
347
  }
348
 
 
 
 
 
 
349
  /**
350
  * Handles processing for all form submissions.
351
- * Older versions ( < 1.6.0 ) smelled like spaghetti so we moved conditions
352
- * to switch statement with the main setup logic in a separate function.
353
  */
354
  function process_post() {
355
  // make sure this is a post
@@ -364,121 +364,120 @@ class ChildThemeConfiguratorAdmin {
364
  if ( empty( $actionfield ) ) return FALSE;
365
 
366
  // make sure post passes security checkpoint
367
- $this->errors = array();
368
  if ( $this->validate_post( apply_filters( 'chld_thm_cfg_action', 'ctc_update' ) ) ):
369
  // reset debug log
370
  delete_site_transient( CHLD_THM_CFG_OPTIONS . '_debug' );
371
- // zip export does not require filesystem access so check that first
372
- // handle uploaded file before checking filesystem
373
- if ( 'theme_image_submit' == $actionfield && isset( $_FILES[ 'ctc_theme_image' ] ) ):
374
- $this->handle_file_upload( 'ctc_theme_image', $this->imgmimes );
375
- elseif ( 'theme_screenshot_submit' == $actionfield && isset( $_FILES[ 'ctc_theme_screenshot' ] ) ):
376
- $this->handle_file_upload( 'ctc_theme_screenshot', $this->imgmimes );
377
- endif;
378
- // now we need to check filesystem access
379
- $args = preg_grep( "/nonce/", array_keys( $_POST ), PREG_GREP_INVERT );
380
- $this->verify_creds( $args );
381
- if ( $this->fs ):
382
- $msg = FALSE;
383
- // we have filesystem access so proceed with specific actions
384
- switch( $actionfield ):
385
- case 'export_child_zip':
386
- case 'export_theme':
387
- $this->export_zip();
388
- // if we get here the zip failed
389
- $this->errors[] = __( 'Zip file creation failed.', 'child-theme-configurator' );
390
- break;
391
- case 'load_styles':
392
- // main child theme setup function
393
- $msg = $this->setup_child_theme();
394
- break;
 
 
 
 
 
 
 
 
 
 
395
 
396
- case 'parnt_templates_submit':
397
- // copy parent templates to child
398
- if ( isset( $_POST[ 'ctc_file_parnt' ] ) ):
399
- foreach ( $_POST[ 'ctc_file_parnt' ] as $file ):
400
- $this->copy_parent_file( sanitize_text_field( $file ) );
401
- endforeach;
402
- $msg = '8&tab=file_options';
403
- endif;
404
- break;
405
 
406
- case 'child_templates_submit':
407
- // delete child theme files
408
- if ( isset( $_POST[ 'ctc_file_child' ] ) ):
409
- if ( in_array( 'functions', $_POST[ 'ctc_file_child' ] ) ):
410
  $this->errors[] =
411
  __( 'The Functions file is required and cannot be deleted.', 'child-theme-configurator' );
 
412
  else:
413
- foreach ( $_POST[ 'ctc_file_child' ] as $file ):
414
- $this->delete_child_file( sanitize_text_field( $file ),
415
- ( preg_match( "/^style|ctc\-plugins/", $file ) ? 'css' : 'php' ) );
416
- endforeach;
417
- $msg = '8&tab=file_options';
418
  endif;
419
- endif;
420
- break;
421
-
422
- case 'image_submit':
423
- // delete child theme images
424
- if ( isset( $_POST[ 'ctc_img' ] ) ):
425
- foreach ( $_POST[ 'ctc_img' ] as $file ):
426
- $this->delete_child_file( 'images/' . sanitize_text_field( $file ), 'img' );
427
- endforeach;
428
- $msg = '8&tab=file_options';
429
- endif;
430
- break;
431
-
432
- case 'templates_writable_submit':
433
- // make specific files writable ( systems not running suExec )
434
- if ( isset( $_POST[ 'ctc_file_child' ] ) ):
435
- foreach ( $_POST[ 'ctc_file_child' ] as $file ):
436
- $this->set_writable( sanitize_text_field( $file ),
437
- ( 0 === strpos( $file, 'style' ) ? 'css' : 'php' ) );
438
- endforeach;
439
- $msg = '8&tab=file_options';
440
- endif;
441
- break;
442
-
443
- case 'set_writable':
444
- // make child theme style.css and functions.php writable ( systems not running suExec )
445
- $this->set_writable(); // no argument defaults to style.css
446
- $this->set_writable( 'functions' );
447
  $msg = '8&tab=file_options';
448
- break;
 
449
 
450
- case 'reset_permission':
451
- // make child theme read-only ( systems not running suExec )
452
- $this->unset_writable();
 
 
453
  $msg = '8&tab=file_options';
454
- break;
 
455
 
456
- case 'theme_image_submit':
457
- // move uploaded child theme images (now we have filesystem access)
458
- if ( isset( $_POST[ 'movefile' ] ) ):
459
- $this->move_file_upload( 'images' );
460
- $msg = '8&tab=file_options';
461
- endif;
462
- break;
 
 
 
463
 
464
- case 'theme_screenshot_submit':
465
- // move uploaded child theme screenshot (now we have filesystem access)
466
- if ( isset( $_POST[ 'movefile' ] ) ):
467
- // remove old screenshot
468
- foreach( array_keys( $this->imgmimes ) as $extreg ):
469
- foreach ( explode( '|', $extreg ) as $ext ):
470
- $this->delete_child_file( 'screenshot', $ext );
471
- endforeach;
472
- endforeach;
473
- $this->move_file_upload( '' );
474
- $msg = '8&tab=file_options';
475
- endif;
476
- break;
477
- default:
478
- // assume we are on the files tab so just redirect there
 
 
479
  $msg = '8&tab=file_options';
480
- endswitch;
481
- endif; // end filesystem condition
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
482
  if ( empty( $this->errors ) && empty( $this->fs_prompt ) ):
483
  $this->processdone = TRUE;
484
  //die( '<pre><code><small>' . print_r( $_POST, TRUE ) . '</small></code></pre>' );
@@ -501,13 +500,14 @@ class ChildThemeConfiguratorAdmin {
501
  */
502
  function setup_child_theme() {
503
  $msg = 1;
 
504
  // sanitize and extract config fields into local vars
505
  foreach ( $this->configfields as $configfield ):
506
  $varparts = explode( '_', $configfield );
507
  $varname = end( $varparts );
508
  ${$varname} = empty( $_POST[ 'ctc_' . $configfield ] ) ? '' :
509
  preg_replace( "/\s+/s", ' ', sanitize_text_field( $_POST[ 'ctc_' . $configfield ] ) );
510
- $this->debug( 'Extracting var ' . $varname . ' from ctc_' . $configfield . ' value: ' . ${$varname} , __FUNCTION__ );
511
  endforeach;
512
 
513
  if ( isset( $type ) ) $this->childtype = $type;
@@ -566,9 +566,9 @@ class ChildThemeConfiguratorAdmin {
566
 
567
  // load or reset config
568
  if ( 'reset' == $type ):
569
- $this->debug( 'resetting child theme', __FUNCTION__ );
570
  $this->reset_child_theme();
571
- $this->enqueue_parent_css( $this );
572
  $msg = 4;
573
  else:
574
 
@@ -618,7 +618,7 @@ class ChildThemeConfiguratorAdmin {
618
  foreach ( $_POST[ 'ctc_additional_css' ] as $file )
619
  $this->css->addl_css[] = sanitize_text_field( $file );
620
  endif;
621
- add_action( 'chld_thm_cfg_parse_stylesheets', array( &$this, 'parse_child_stylesheet_to_target' ) );
622
  elseif ( isset( $_POST[ 'ctc_analysis' ] ) ):
623
  // this is for themes
624
  $this->evaluate_signals();
@@ -647,51 +647,44 @@ class ChildThemeConfiguratorAdmin {
647
  // do we parse parent stylesheet?
648
 
649
  if ( $this->get( 'hasstyles' ) && !$ignoreparnt ):
650
- $this->debug( 'Adding action: parse_parent_stylesheet_to_source', __FUNCTION__ );
651
- add_action( 'chld_thm_cfg_parse_stylesheets', array( &$this, 'parse_parent_stylesheet_to_source' ) );
652
  endif;
653
 
654
  // automatically network enable new theme // FIXME: shouldn't this be an option?
655
  if ( is_multisite() )
656
- add_action( 'chld_thm_cfg_addl_options', array( &$this, 'network_enable' ) );
657
  endif;
658
- $this->debug( 'Adding action: parse_additional_stylesheets_to_source', __FUNCTION__ );
659
- add_action( 'chld_thm_cfg_parse_stylesheets', array( &$this, 'parse_additional_stylesheets_to_source' ) );
660
 
661
  if ( 'separate' == $handling ):
662
  // parse child theme style.css into source config
663
- $this->debug( 'Adding action: parse_child_stylesheet_to_source', __FUNCTION__ );
664
- add_action( 'chld_thm_cfg_parse_stylesheets', array( &$this, 'parse_child_stylesheet_to_source' ) );
665
  // parse child theme ctc-style.css into target config
666
- $this->debug( 'Adding action: parse_custom_stylesheet_to_target', __FUNCTION__ );
667
- add_action( 'chld_thm_cfg_parse_stylesheets', array( &$this, 'parse_custom_stylesheet_to_target' ) );
668
  elseif ( 'primary' == $handling ):
669
  // parse child theme style.css into target config
670
- $this->debug( 'Adding action: parse_child_stylesheet_to_target', __FUNCTION__ );
671
- add_action( 'chld_thm_cfg_parse_stylesheets', array( &$this, 'parse_child_stylesheet_to_target' ) );
672
  if ( $oldhandling != $handling ):
673
- $this->debug( 'Adding action: parse_custom_stylesheet_to_target', __FUNCTION__ );
674
- add_action( 'chld_thm_cfg_parse_stylesheets', array( &$this, 'parse_custom_stylesheet_to_target' ) );
675
  endif;
676
  endif;
677
 
678
  // function to support wp_filesystem requirements
679
  if ( $this->is_theme( $configtype ) ):
680
  // is theme means this is not a plugin stylesheet config
681
- add_action( 'chld_thm_cfg_addl_files', array( &$this, 'add_base_files' ), 10, 2 );
682
- add_action( 'chld_thm_cfg_addl_files', array( &$this, 'copy_screenshot' ), 10, 2 );
683
- add_action( 'chld_thm_cfg_addl_files', array( &$this, 'enqueue_parent_css' ), 15, 2 );
684
  if ( $repairheader && 'reset' != $type ):
685
- add_action( 'chld_thm_cfg_addl_files', array( &$this, 'repair_header' ) );
686
  endif;
687
 
688
- // legacy -- do we still need???
689
- elseif( $this->is_legacy() && has_action( 'chld_thm_cfg_addl_files' ) ):
690
- // backwards compatability for plugins extension < 2.0.0 (before pro)
691
- // action exists so we have to hijack it to use new filesystem checks
692
- remove_all_actions( 'chld_thm_cfg_addl_files' );
693
- add_action( 'chld_thm_cfg_addl_files', array( &$this, 'write_addl_files' ), 10, 2 );
694
- $this->css->set_prop( 'configtype', $configtype );
695
  endif;
696
 
697
  // plugin hooks for additional stylesheet handling options
@@ -700,28 +693,27 @@ class ChildThemeConfiguratorAdmin {
700
 
701
  // plugin hook to parse additional or non-standard files
702
  do_action( 'chld_thm_cfg_parse_stylesheets' );
703
-
704
  // copy menus, widgets and other customizer options from parent to child if selected
705
  if ( isset( $_POST[ 'ctc_parent_mods' ] ) && 'duplicate' != $type )
706
  $this->copy_theme_mods( $parnt, $child );
707
  // run code generation function in read-only mode to add existing external stylesheet links to config data
708
- $this->enqueue_parent_css( $this->css, TRUE );
709
  // hook for add'l plugin files and subdirectories. Must run after stylesheets are parsed to apply latest options
710
- do_action( 'chld_thm_cfg_addl_files', $this );
711
  // do not continue if errors
712
  if ( !empty ( $this->errors ) ) return FALSE;
713
  //echo ' no errors! saving...' . LF;
714
  if ( 'separate' == $handling ):
715
- $this->debug( 'Writing new stylesheet header...', __FUNCTION__ );
716
  $this->rewrite_stylesheet_header();
717
  endif;
718
  // set flag to skip import link conversion on ajax save
719
  $this->css->set_prop( 'converted', 1 );
720
 
721
  // try to write new stylsheet. If it fails send alert.
722
- $this->debug( 'Writing new CSS...', __FUNCTION__ );
723
  if ( FALSE === $this->css->write_css() ):
724
- //$this->debug( print_r( debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS ), TRUE ), __FUNCTION__ );
725
  $this->errors[] = __( 'Your stylesheet is not writable.', 'child-theme-configurator' );
726
  add_action( 'admin_notices', array( $this, 'writable_notice' ) );
727
  return FALSE;
@@ -729,13 +721,13 @@ class ChildThemeConfiguratorAdmin {
729
  // get files to reload templates in new css object
730
  $this->get_files( $parnt );
731
  endif;
732
- $this->debug( 'Saving new config...', __FUNCTION__ );
733
  // save new object to WP options table
734
  $this->save_config();
735
- $this->debug( 'Firing additional options action...', __FUNCTION__ );
736
  // plugin hook for additional child theme setup functions
737
- do_action( 'chld_thm_cfg_addl_options', $this );
738
-
739
  // return message id 1, which says new child theme created successfully;
740
  return $msg;
741
  }
@@ -755,7 +747,7 @@ class ChildThemeConfiguratorAdmin {
755
  }
756
 
757
  function update_redirect( $msg = 1 ) {
758
- $this->print_debug( TRUE );
759
  if ( empty( $this->is_ajax ) ):
760
  $ctcpage = apply_filters( 'chld_thm_cfg_admin_page', CHLD_THM_CFG_MENU );
761
  $screen = get_current_screen()->id;
@@ -767,15 +759,15 @@ class ChildThemeConfiguratorAdmin {
767
  }
768
 
769
  function verify_child_dir( $path ) {
770
- $this->debug( 'Verifying child dir: ' . $path, __FUNCTION__ );
771
  if ( !$this->fs ):
772
- $this->debug( 'No filesystem access.', __FUNCTION__ );
773
  return FALSE; // return if no filesystem access
774
  endif;
775
  global $wp_filesystem;
776
  $themedir = $wp_filesystem->find_folder( get_theme_root() );
777
  if ( ! $wp_filesystem->is_writable( $themedir ) ):
778
- $this->debug( 'Directory not writable: ' . $themedir, __FUNCTION__ );
779
  return FALSE;
780
  endif;
781
  $childparts = explode( '/', $this->normalize_path( $path ) );
@@ -785,20 +777,20 @@ class ChildThemeConfiguratorAdmin {
785
  $themedir = trailingslashit( $themedir ) . $subdir;
786
  if ( ! $wp_filesystem->is_dir( $themedir ) ):
787
  if ( ! $wp_filesystem->mkdir( $themedir, FS_CHMOD_DIR ) ):
788
- $this->debug( 'Could not make directory: ' . $themedir, __FUNCTION__ );
789
  return FALSE;
790
  endif;
791
  elseif ( ! $wp_filesystem->is_writable( $themedir ) ):
792
- $this->debug( 'Directory not writable: ' . $themedir, __FUNCTION__ );
793
  return FALSE;
794
  endif;
795
  endwhile;
796
- $this->debug( 'Child dir verified: ' . $themedir, __FUNCTION__ );
797
  return TRUE;
798
  }
799
 
800
  function add_base_files( $obj ){
801
- //$this->debug( LF . LF, __FUNCTION__ );
802
  // add functions.php file
803
  $contents = "<?php
804
  // Exit if accessed directly
@@ -808,7 +800,7 @@ if ( !defined( 'ABSPATH' ) ) exit;
808
  $this->write_child_file( 'functions.php', $contents );
809
  $this->backup_or_restore_file( 'style.css' );
810
  $contents = $this->css->get_css_header_comment( $handling );
811
- $this->debug( 'writing initial stylesheet header...' . LF . $contents, __FUNCTION__ );
812
  $this->write_child_file( 'style.css', $contents );
813
  if ( 'separate' == $handling ):
814
  $this->backup_or_restore_file( 'ctc-style.css' );
@@ -855,7 +847,7 @@ if ( !defined( 'ABSPATH' ) ) exit;
855
  * If external imports are present, it enqueues them as well.
856
  */
857
  function enqueue_parent_code(){
858
- //$this->debug( print_r( debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS ), TRUE ), __FUNCTION__ );
859
  $imports = $this->get( 'imports' );
860
  $enqueues = array();
861
  $code = "// AUTO GENERATED - Do not modify or remove comment markers above or below:" . LF;
@@ -870,9 +862,10 @@ if ( !defined( 'ABSPATH' ) ) exit;
870
  $cssnotheme = $this->get( 'cssnotheme' );
871
  $ignoreparnt = $this->get( 'ignoreparnt' );
872
  $priority = $this->get( 'qpriority' );
 
873
  $this->debug( 'deps: ' . print_r( $deps, TRUE ) . ' enq: ' . $enq . ' handling: ' . $handling
874
- . ' hasstyles: ' . $hasstyles . ' parntloaded: ' . $parntloaded . ' childloaded: ' . $childloaded
875
- . ' ignoreparnt: ' . $ignoreparnt . ' priority: ' . $priority . ' childtype: ' . $this->childtype, __FUNCTION__ );
876
  // enqueue parent stylesheet
877
  if ( 'enqueue' == $enq && $hasstyles && !$parntloaded && !$ignoreparnt ):
878
  $code .= "
@@ -886,19 +879,22 @@ add_action( 'wp_enqueue_scripts', 'chld_thm_cfg_parent_css', " . $priority . " )
886
  // if loading parent theme, reset deps and add parent stylesheet
887
  $deps = array( "'chld_thm_cfg_parent'" );
888
 
889
- // force a stylesheet dependency if parent is loading out of sequence
890
- if ( $childloaded && $this->reorder ):
891
- $code .= "
 
 
 
892
  if ( !function_exists( 'chld_thm_cfg_add_parent_dep' ) ):
893
- function chld_thm_cfg_add_parent_dep() {
894
- global \$wp_styles;
895
- array_unshift( \$wp_styles->registered[ '" . $childloaded . "' ]->deps, 'chld_thm_cfg_parent' );
896
- }
897
  endif;
898
  add_action( 'wp_head', 'chld_thm_cfg_add_parent_dep', 2 );
899
  ";
900
- endif;
901
  endif;
 
902
  // enqueue external stylesheets (previously used @import in the stylesheet)
903
  if ( !empty( $imports ) ):
904
  $ext = 0;
@@ -935,13 +931,13 @@ add_action( 'wp_enqueue_scripts', 'child_theme_configurator_css' );" . LF;
935
  if ( $ignoreparnt )
936
  $code .= "
937
  defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT', TRUE );" . LF;
938
- //$this->debug( $code, __FUNCTION__ );
939
  return explode( "\n", $code ); // apply_filters( 'chld_thm_cfg_enqueue_code_filter', $code ) ); // FIXME?
940
  }
941
 
942
  // updates function file with wp_enqueue_script code block. If getexternals flag is passed function is run in read-only mode
943
- function enqueue_parent_css( $obj, $getexternals = FALSE ) {
944
- $this->debug( 'enqueueing parent css: getexternals = ' . $getexternals, __FUNCTION__ );
945
  $marker = 'ENQUEUE PARENT ACTION';
946
  $insertion = $this->enqueue_parent_code();
947
  if ( $filename = $this->css->is_file_ok( $this->css->get_child_target( 'functions.php' ), 'write' ) ):
@@ -962,26 +958,26 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
962
  */
963
  function insert_with_markers( $filename, $marker, $insertion, $getexternals = FALSE ) {
964
  if ( count( $this->errors ) ):
965
- $this->debug( 'Errors detected, returning', __FUNCTION__ );
966
  return FALSE;
967
  endif;
968
  // first check if this is an ajax update
969
  if ( $this->is_ajax && is_readable( $filename ) && is_writable( $filename ) ):
970
  // ok to proceed
971
- $this->debug( 'Ajax update, bypassing wp filesystem.', __FUNCTION__ );
972
  $markerdata = explode( "\n", @file_get_contents( $filename ) );
973
  elseif ( !$this->fs ):
974
- $this->debug( 'No filesystem access.', __FUNCTION__ );
975
  return FALSE; // return if no filesystem access
976
  else:
977
  global $wp_filesystem;
978
  if( !$wp_filesystem->exists( $this->fspath( $filename ) ) ):
979
  if ( $getexternals ):
980
- $this->debug( 'Read only and no functions file yet, returning...', __FUNCTION__ );
981
  return FALSE;
982
  else:
983
  // make sure file exists with php header
984
- $this->debug( 'No functions file, creating...', __FUNCTION__ );
985
  $this->add_base_files( $this );
986
  endif;
987
  endif;
@@ -1039,16 +1035,16 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
1039
  endif;
1040
  endforeach;
1041
  else:
1042
- $this->debug( 'Could not parse functions file', __FUNCTION__ );
1043
  return FALSE;
1044
  endif;
1045
  if ( $foundit ):
1046
- $this->debug( 'Found marker, replaced inline', __FUNCTION__ );
1047
  else:
1048
  if ( 'reset' != $this->childtype ):
1049
  // verify there is no PHP close tag at end of file
1050
  if ( ! $phpopen ):
1051
- $this->debug( 'PHP not open', __FUNCTION__ );
1052
  //$this->errors[] = __( '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' );
1053
  //return FALSE;
1054
  $newfile .= '<?php' . LF;
@@ -1061,14 +1057,14 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
1061
  endif;
1062
  // only write file when getexternals is false
1063
  if ( $getexternals ):
1064
- $this->debug( 'Read only, returning.', __FUNCTION__ );
1065
  else:
1066
  $mode = 'direct' == $this->fs_method ? FALSE : 0666;
1067
- $this->debug( 'Writing new functions file...', __FUNCTION__ );
1068
  if ( $this->is_ajax && is_writable( $filename ) ):
1069
  // with ajax we have to bypass wp filesystem so file must already be writable
1070
  if ( FALSE === @file_put_contents( $filename, $newfile ) ):
1071
- $this->debug( 'Ajax write failed.', __FUNCTION__ );
1072
  return FALSE;
1073
  endif;
1074
  elseif ( FALSE === $wp_filesystem->put_contents(
@@ -1076,7 +1072,7 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
1076
  $newfile,
1077
  $mode
1078
  ) ): // chmod will fail unless we have fs access. user can secure files after configuring
1079
- $this->debug( 'Filesystem write failed.', __FUNCTION__ );
1080
  return FALSE;
1081
  endif;
1082
  $this->css->set_prop( 'converted', 1 );
@@ -1085,9 +1081,9 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
1085
 
1086
  // creates/updates file via filesystem API
1087
  function write_child_file( $file, $contents ) {
1088
- //$this->debug( LF . LF, __FUNCTION__ );
1089
  if ( !$this->fs ):
1090
- $this->debug( 'No filesystem access, returning.', __FUNCTION__ );
1091
  return FALSE; // return if no filesystem access
1092
  endif;
1093
  global $wp_filesystem;
@@ -1095,34 +1091,34 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
1095
  $mode = 'direct' == $this->fs_method ? FALSE : 0666;
1096
  $file = $this->fspath( $file );
1097
  if ( $wp_filesystem->exists( $file ) ):
1098
- $this->debug( 'File exists, returning.', __FUNCTION__ );
1099
  return FALSE;
1100
  else:
1101
- $this->debug( 'Writing to filesystem: ' . $file . LF . $contents, __FUNCTION__ );
1102
  if ( FALSE === $wp_filesystem->put_contents(
1103
  $file,
1104
  $contents,
1105
  $mode
1106
  ) ):
1107
- $this->debug( 'Filesystem write failed, returning.', __FUNCTION__ );
1108
  return FALSE;
1109
  endif;
1110
  endif;
1111
  else:
1112
- $this->debug( 'No directory, returning.', __FUNCTION__ );
1113
  return FALSE;
1114
  endif;
1115
- $this->debug( 'Filesystem write successful.', __FUNCTION__ );
1116
  }
1117
 
1118
- function copy_screenshot( $obj ) {
1119
  // always copy screenshot
1120
  $this->copy_parent_file( 'screenshot' );
1121
  }
1122
 
1123
  function copy_parent_file( $file, $ext = 'php' ) {
1124
  if ( !$this->fs ):
1125
- $this->debug( 'No filesystem access.', __FUNCTION__ );
1126
  return FALSE; // return if no filesystem access
1127
  endif;
1128
  global $wp_filesystem;
@@ -1145,12 +1141,12 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
1145
  // return true if file already exists
1146
  if ( $wp_filesystem->exists( $this->fspath( $child_file ) ) ) return TRUE;
1147
  $child_dir = dirname( $this->theme_basename( '', $child_file ) );
1148
- $this->debug( 'Verifying child dir... ', __FUNCTION__ );
1149
  if ( $parent_file // sanity check
1150
  && $child_file // sanity check
1151
  && $this->verify_child_dir( $child_dir ) //create child subdir if necessary
1152
  && $wp_filesystem->copy( $parent_file, $this->fspath( $child_file ), FS_CHMOD_FILE ) ):
1153
- $this->debug( 'Filesystem copy successful', __FUNCTION__ );
1154
  return TRUE;
1155
  endif;
1156
  $this->errors[] = __( 'Could not copy file:' . $parent_file, 'child-theme-configurator' );
@@ -1158,7 +1154,7 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
1158
 
1159
  function delete_child_file( $file, $ext = 'php' ) {
1160
  if ( !$this->fs ):
1161
- $this->debug( 'No filesystem access.', __FUNCTION__ );
1162
  return FALSE; // return if no filesystem access
1163
  endif;
1164
  global $wp_filesystem;
@@ -1170,37 +1166,39 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
1170
  return TRUE;
1171
  else:
1172
  $this->errors[] = __( 'Could not delete ' . $ext . ' file.', 'child-theme-configurator' );
1173
- $this->debug( 'Could not delete ' . $ext . ' file', __FUNCTION__ );
1174
  endif;
1175
  endif;
1176
  endif;
1177
  }
1178
 
1179
  function get_files( $theme, $type = 'template' ) {
1180
- //$this->debug( LF . LF, __FUNCTION__ );
1181
  $isparent = ( $theme === $this->get( 'parnt' ) );
1182
- if ( ( $templates = $this->get( 'templates' ) ) && $isparent && 'template' == $type ):
1183
  return $templates;
1184
  elseif ( !isset( $this->files[ $theme ] ) ):
1185
 
1186
  $this->files[ $theme ] = array();
1187
  $imgext = '(' . implode( '|', array_keys( $this->imgmimes ) ) . ')';
1188
  foreach ( $this->css->recurse_directory(
1189
- trailingslashit( get_theme_root() ) . $theme, '', TRUE ) as $file ):
1190
- $file = $this->theme_basename( $theme, $file );
1191
  if ( preg_match( "/^style\-(\d+)\.css$/", $file, $matches ) ):
1192
  $date = date_i18n( 'D, j M Y g:i A', strtotime( $matches[ 1 ] ) );
1193
  $this->files[ $theme ][ 'backup' ][ $file ] = $date;
1194
- //$this->debug( 'This is a backup file', __FUNCTION__ );
 
 
 
1195
  elseif ( preg_match( "/^ctc\-plugins\-(\d+)\.css$/", $file, $matches ) ):
1196
  $date = date_i18n( 'D, j M Y g:i A', strtotime( $matches[ 1 ] ) );
1197
  $this->files[ $theme ][ 'pluginbackup' ][ $file ] = $date;
1198
- //$this->debug( 'This is a plugin backup file', __FUNCTION__ );
1199
  elseif ( preg_match( "/\.php$/", $file ) ):
1200
  if ( $isparent ):
1201
 
1202
  if ( ( $file_verified = $this->css->is_file_ok( $this->css->get_parent_source( $file, $theme ) , 'read' ) ) ):
1203
- $this->debug( 'scanning ' . $file_verified . '... ', __FUNCTION__ );
1204
  // read 2k at a time and bail if code detected
1205
  $template = FALSE;
1206
  if ( $handle = fopen( $file_verified, "rb") ):
@@ -1220,27 +1218,37 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
1220
  $this->files[ $theme ][ 'template' ][] = $file;
1221
  endif;
1222
  else:
1223
- //$this->debug( 'Child PHP, adding to templates', __FUNCTION__ );
1224
  $this->files[ $theme ][ 'template' ][] = $file;
1225
  endif;
1226
- elseif ( preg_match( "/\.css$/", $file ) && 'style.css' != $file ):
 
 
 
 
 
1227
  $this->files[ $theme ][ 'stylesheet' ][] = $file;
1228
- //$this->debug( 'This is a stylesheet', __FUNCTION__ );
 
 
1229
  elseif ( preg_match( "/^images\/.+?\." . $imgext . "$/", $file ) ):
1230
  $this->files[ $theme ][ 'img' ][] = $file;
1231
- //$this->debug( 'This is an image file', __FUNCTION__ );
 
 
1232
  endif;
1233
  endforeach;
1234
  endif;
1235
  if ( $isparent ):
1236
- //$this->debug( 'Setting CSS object templates parameter', __FUNCTION__ );
1237
  $this->css->templates = $this->files[ $theme ][ 'template' ];
1238
  endif;
1239
- $types = explode(",", $type);
1240
  $files = array();
1241
- foreach ( $types as $type )
1242
  if ( isset( $this->files[ $theme ][ $type ] ) )
1243
  $files = array_merge( $this->files[ $theme ][ $type ], $files );
 
1244
  return $files;
1245
  }
1246
 
@@ -1248,7 +1256,7 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
1248
  $file = $this->normalize_path( $file );
1249
  // if no theme passed, returns theme + file
1250
  $themedir = trailingslashit( $this->normalize_path( get_theme_root() ) ) . ( '' == $theme ? '' : trailingslashit( $theme ) );
1251
- //$this->debug( 'Themedir: ' . $themedir . ' File: ' . $file , __FUNCTION__ );
1252
  return preg_replace( '%^' . preg_quote( $themedir ) . '%', '', $file );
1253
  }
1254
 
@@ -1311,7 +1319,7 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
1311
  $newfile = trailingslashit( $clone ) . $childfile;
1312
  $childpath = $fsthemedir . trailingslashit( $child ) . $childfile;
1313
  $newpath = $fsthemedir . $newfile;
1314
- $this->debug( 'Verifying child dir... ', __FUNCTION__ );
1315
  if ( $this->verify_child_dir( is_dir( $file ) ? $newfile : dirname( $newfile ) ) ):
1316
  if ( is_file( $file ) && !@$wp_filesystem->copy( $childpath, $newpath ) ):
1317
  $errors[] = 'could not copy ' . $newpath;
@@ -1350,7 +1358,7 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
1350
  $childpath = $fsthemedir . trailingslashit( $child ) . $childfile;
1351
  $newpath = $fsthemedir . $newfile;
1352
  if ( $copy ):
1353
- $this->debug( 'Verifying child dir... ' . $file, __FUNCTION__ );
1354
  if ( $this->verify_child_dir( is_dir( $file ) ? $newfile : dirname( $newfile ) ) ):
1355
  if ( is_file( $file ) && !$wp_filesystem->copy( $childpath, $newpath ) ):
1356
  $errors[] = 'could not copy ' . $newpath;
@@ -1422,15 +1430,47 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
1422
  $target_file = ( '' == $subdir ?
1423
  preg_replace( "%^.+(\.\w+)$%", "screenshot$1", basename( $source_file ) ) :
1424
  trailingslashit( $subdir ) . basename( $source_file ) );
1425
- $this->debug( 'Verifying child dir... ', __FUNCTION__ );
 
 
1426
  if ( FALSE !== $this->verify_child_dir( trailingslashit( $this->get( 'child' ) ) . $subdir ) ):
1427
- $source_path = $this->fspath( $this->uploads_fullpath( $source_file ) );
1428
  if ( $target_path = $this->css->is_file_ok( $this->css->get_child_target( $target_file ), 'write' ) ):
1429
- $target_path = $this->fspath( $target_path );
1430
- if ( $wp_filesystem->exists( $source_path ) ):
1431
- if ( $wp_filesystem->move( $source_path, $target_path ) ) return TRUE;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1432
  endif;
 
 
1433
  endif;
 
 
1434
  endif;
1435
 
1436
  $this->errors[] = __( 'Could not upload file.', 'child-theme-configurator' );
@@ -1440,7 +1480,7 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
1440
  * exports theme as zip archive.
1441
  * As of version 2.03, parent themes can be exported as well
1442
  */
1443
- function export_zip() {
1444
  $version = '';
1445
  if ( empty( $_POST[ 'ctc_export_theme' ] ) ):
1446
  $template = $this->get( 'child' );
@@ -1452,48 +1492,58 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
1452
  endif;
1453
  // make sure directory exists and is in themes folder
1454
  if ( ( $dir = $this->css->is_file_ok( trailingslashit( get_theme_root() ) . $template, 'search' ) ) ):
1455
- // Try to use php system upload dir to store temp files first
1456
- $tmpdir = ini_get( 'upload_tmp_dir' ) ? ini_get( 'upload_tmp_dir' ) : sys_get_temp_dir();
1457
- if ( !is_writable( $tmpdir ) ):
1458
- // try uploads directory
1459
- $uploads = wp_upload_dir();
1460
- $tmpdir = $uploads[ 'basedir' ];
1461
- if ( !is_writable( $tmpdir ) ):
1462
- $this->errors[] = __( 'No writable temp directory.', 'child-theme-configurator' );
1463
- return FALSE;
1464
- endif;
1465
- endif;
1466
- $file = trailingslashit( $tmpdir ) . $template . ( empty( $version ) ? '' : '-' . $version ) . '.zip';
1467
- if ( file_exists( $file ) ) unlink ( $file );
1468
-
1469
- mbstring_binary_safe_encoding();
1470
-
1471
- // PclZip ships with WordPress
1472
- require_once( ABSPATH . 'wp-admin/includes/class-pclzip.php' );
1473
-
1474
- $archive = new PclZip( $file );
1475
- if ( $response = $archive->create( $dir, PCLZIP_OPT_REMOVE_PATH, dirname( $dir ) ) ):
1476
-
1477
- reset_mbstring_encoding();
1478
- header( 'Content-Description: File Transfer' );
1479
- header( 'Content-Type: application/octet-stream' );
1480
- header( 'Content-Length: ' . filesize( $file ) );
1481
- header( 'Content-Disposition: attachment; filename=' . basename( $file ) );
1482
- header( 'Expires: 0' );
1483
- header( 'Cache-Control: must-revalidate' );
1484
- header( 'Pragma: public' );
1485
- readfile( $file );
1486
- unlink( $file );
1487
- die();
1488
  else:
1489
- $this->errors[] = __( 'PclZip returned zero bytes.', 'child-theme-configurator' );
1490
  endif;
1491
  else:
1492
  $this->errors = __( 'Invalid theme root directory.', 'child-theme-configurator' );
1493
  endif;
1494
-
1495
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1496
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1497
  /*
1498
  *
1499
  */
@@ -1544,38 +1594,7 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
1544
  $fsdir = $wp_filesystem->find_folder( $dir );
1545
  return trailingslashit( $fsdir ) . $base;
1546
  }
1547
-
1548
- // back compatibility function for legacy plugins extension
1549
- function write_addl_files( $obj ) {
1550
- global $chld_thm_cfg_plugins;
1551
- if ( !is_object( $chld_thm_cfg_plugins ) || !$this->fs ) return FALSE;
1552
- $configtype = $this->get( 'configtype' );
1553
- //echo $configtype . LF;
1554
- if ( 'theme' == $configtype || !( $def = $chld_thm_cfg_plugins->defs->get_def( $configtype ) ) ) return FALSE;
1555
- $child = trailingslashit( $this->get( 'child' ) );
1556
- if ( isset( $def[ 'addl' ] ) && is_array( $def[ 'addl' ] ) && count( $def[ 'addl' ] ) ):
1557
- foreach ( $def[ 'addl' ] as $path => $type ):
1558
-
1559
- // sanitize the crap out of the target data -- it will be used to create paths
1560
- $path = $this->normalize_path( preg_replace( "%[^\w\\//\-]%", '', sanitize_text_field( $child . $path ) ) );
1561
- $this->debug( 'Verifying child dir... ', __FUNCTION__ );
1562
- if ( ( 'dir' == $type && FALSE === $this->verify_child_dir( $path ) )
1563
- || ( 'dir' != $type && FALSE === $this->write_child_file( $path, '' ) ) ):
1564
- //$this->errors[] = __( 'Your theme directories are not writable.', 'chld_thm_cfg_plugins' );
1565
- endif;
1566
- endforeach;
1567
- endif;
1568
- // write main def file
1569
- if ( isset( $def[ 'target' ] ) ):
1570
- $path = $this->normalize_path( preg_replace( "%[^\w\\//\-\.]%", '', sanitize_text_field( $def[ 'target' ] ) ) ); //$child .
1571
- if ( FALSE === $this->write_child_file( $path, '' ) ):
1572
- //echo "invalid path: " . $path . ' ' . ' was: ' . $def[ 'target' ] . LF;
1573
- //$this->errors[] = __( 'Your stylesheet is not writable.', 'chld_thm_cfg_plugins' );
1574
- return FALSE;
1575
- endif;
1576
- endif;
1577
- }
1578
-
1579
  // backwards compatability < WP 3.9
1580
  function normalize_path( $path ) {
1581
  $path = str_replace( '\\', '/', $path );
@@ -1646,31 +1665,34 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
1646
  $debug = '';
1647
  if ( $_POST[ 'ctc_is_debug' ] ):
1648
  $this->is_debug = 1;
1649
- $debug = $this->print_debug( TRUE );
1650
  else:
1651
  $this->is_debug = 0;
1652
  endif;
1653
- update_option( CHLD_THM_CFG_OPTIONS . '_debug', $this->is_debug );
1654
- $this->updates[] = array(
1655
- 'obj' => 'debug',
1656
- 'key' => '',
1657
- 'data' => $debug,
1658
- );
1659
  }
1660
 
1661
- function debug( $msg = NULL, $fn = NULL) {
1662
- $this->debug .= ( isset( $fn ) ? $fn . ': ' : '' ) . ( isset( $msg ) ? $msg . LF : '' );
 
1663
  }
1664
 
1665
- function print_debug( $noecho = FALSE ) {
1666
- $this->debug( '*** END OF REQUEST ***', __FUNCTION__ );
1667
  // save debug data for 1 hour
1668
  set_site_transient( CHLD_THM_CFG_OPTIONS . '_debug', $this->debug, 3600 );
1669
- $debug = '<textarea style="width:100%;height:200px">' . LF . $this->debug . LF . '</textarea>' . LF;
1670
- if ( $noecho ) return $debug;
1671
- echo $debug;
1672
  }
1673
-
 
 
 
 
 
 
 
 
 
 
1674
  function parse_parent_stylesheet_to_source() {
1675
  $this->css->parse_css_file( 'parnt' );
1676
  }
@@ -1697,7 +1719,7 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
1697
  //$file = sanitize_text_field( $file );
1698
  $this->css->parse_css_file( 'parnt', $file );
1699
  endforeach;
1700
- $this->debug( print_r( $this->css->addl_css, TRUE ), __FUNCTION__ );
1701
  //endif;
1702
  }
1703
 
@@ -1718,41 +1740,52 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
1718
  $this->delete_child_file( 'ctc-style.ctcbackup', 'css' );
1719
  }
1720
 
 
 
1721
  function copy_theme_mods( $from, $to ) {
1722
-
1723
- // we can copy settings from parent to child even if neither is currently active
1724
- // so we need cases for active parent, active child or neither
1725
-
 
 
 
1726
  // get active theme
1727
  $active_theme = get_stylesheet();
1728
- $this->debug( 'from: ' . $from . ' to: ' . $to . ' active: ' . $active_theme, __FUNCTION__ );
1729
  // create temp array from parent settings
1730
- $child_mods = get_option( 'theme_mods_' . $from );
1731
- if ( $active_theme == $from ):
1732
- $this->debug( 'from is active, using active widgets', __FUNCTION__ );
1733
  // if parent theme is active, get widgets from active sidebars_widgets array
1734
- $child_widgets = retrieve_widgets();
1735
  else:
1736
- $this->debug( 'from not active, using theme mods widgets', __FUNCTION__ );
1737
  // otherwise get widgets from parent theme mods
1738
- $child_widgets = empty( $child_mods[ 'sidebars_widgets' ][ 'data' ] ) ?
1739
- array( 'wp_inactive_widgets' => array() ) : $child_mods[ 'sidebars_widgets' ][ 'data' ];
1740
  endif;
1741
- if ( $active_theme == $to ):
1742
- $this->debug( 'to active, setting active widgets', __FUNCTION__ );
1743
- // if child theme is active, remove widgets from temp array
1744
- unset( $child_mods[ 'sidebars_widgets' ] );
 
 
 
 
1745
  // copy widgets to active sidebars_widgets array
1746
- wp_set_sidebars_widgets( $child_widgets );
 
 
1747
  else:
1748
- $this->debug( 'child not active, saving widgets in theme mods', __FUNCTION__ );
1749
  // otherwise copy widgets to temp array with time stamp
1750
- $child_mods[ 'sidebars_widgets' ][ 'data' ] = $child_widgets;
1751
- $child_mods[ 'sidebars_widgets' ][ 'time' ] = time();
 
1752
  endif;
1753
- $this->debug( 'saving child theme mods:' . LF . print_r( $child_mods, TRUE ), __FUNCTION__ );
1754
  // copy temp array to child mods
1755
- update_option( 'theme_mods_' . $to, $child_mods );
1756
  }
1757
 
1758
  function network_enable() {
@@ -1765,9 +1798,9 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
1765
 
1766
  function backup_or_restore_file( $source, $restore = FALSE, $target = NULL ){
1767
  $action = $restore ? 'Restore' : 'Backup';
1768
- $this->debug( LF . LF . $action . ' main stylesheet...', __FUNCTION__ );
1769
  if ( !$this->fs ):
1770
- $this->debug( 'No filesystem access, returning', __FUNCTION__ );
1771
  return FALSE; // return if no filesystem access
1772
  endif;
1773
  list( $base, $suffix ) = explode( '.', $source );
@@ -1781,29 +1814,29 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
1781
  $fssource = $this->fspath( $this->css->get_child_target( $source ) );
1782
  global $wp_filesystem;
1783
  if ( ( !$wp_filesystem->exists( $fssource ) ) || ( !$restore && $wp_filesystem->exists( $fstarget ) ) ):
1784
- $this->debug( 'No stylesheet, returning', __FUNCTION__ );
1785
  return FALSE;
1786
  endif;
1787
  if ( $wp_filesystem->copy( $fssource, $fstarget, FS_CHMOD_FILE ) ):
1788
- $this->debug( 'Filesystem ' . $action . ' successful', __FUNCTION__ );
1789
  return TRUE;
1790
  else:
1791
- $this->debug( 'Filesystem ' . $action . ' failed', __FUNCTION__ );
1792
  return FALSE;
1793
  endif;
1794
  }
1795
 
1796
  function rewrite_stylesheet_header(){
1797
- $this->debug( LF . LF . 'Rewriting main stylesheet header...', __FUNCTION__ );
1798
  if ( !$this->fs ):
1799
- $this->debug( 'No filesystem access, returning', __FUNCTION__ );
1800
  return FALSE; // return if no filesystem access
1801
  endif;
1802
  $origcss = $this->css->get_child_target( 'style.css' );
1803
  $fspath = $this->fspath( $origcss );
1804
  global $wp_filesystem;
1805
  if( !$wp_filesystem->exists( $fspath ) ):
1806
- $this->debug( 'No stylesheet, returning', __FUNCTION__ );
1807
  return FALSE;
1808
  endif;
1809
  // get_contents_array returns extra linefeeds so just split it ourself
@@ -1813,11 +1846,11 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
1813
  $regex = implode( '|', array_map( 'preg_quote', array_keys( $child_headers ) ) );
1814
  else $regex = 'NO HEADERS';
1815
  $regex = '/(' . $regex . '):.*$/';
1816
- $this->debug( 'regex: ' . $regex, __FUNCTION__ );
1817
  $header = str_replace( "\r", LF, substr( $contents, 0, 8192 ) );
1818
  $contents = substr( $contents, 8192 );
1819
- $this->debug( 'original header: ' . LF . $header, __FUNCTION__ );
1820
- //$this->debug( 'stripping @import rules...', __FUNCTION__ );
1821
  // strip out existing @import lines
1822
  $header = preg_replace( '#\@import\s+url\(.+?\);\s*#s', '', $header );
1823
  // parse header line by line
@@ -1827,7 +1860,7 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
1827
  $headerdone = 0;
1828
  $newheader = '';
1829
  if ( $headerdata ):
1830
- $this->debug( 'parsing header...', __FUNCTION__ );
1831
  foreach ( $headerdata as $n => $headerline ):
1832
  preg_match_all("/(\*\/|\/\*)/", $headerline, $matches );
1833
  if ( $matches ):
@@ -1840,17 +1873,17 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
1840
  endforeach;
1841
  endif;
1842
  if ( $in_comment ):
1843
- $this->debug( 'in comment', __FUNCTION__ );
1844
  if ( preg_match( $regex, $headerline, $matches ) && !empty( $matches[ 1 ] ) ):
1845
  $found_header = 1;
1846
  $key = $matches[ 1 ];
1847
- $this->debug( 'found header: ' . $key, __FUNCTION__ );
1848
  if ( array_key_exists( $key, $child_headers ) ):
1849
- $this->debug( 'child header value exists: ', __FUNCTION__ );
1850
  $value = trim( $child_headers[ $key ] );
1851
  unset( $child_headers[ $key ] );
1852
  if ( $value ):
1853
- $this->debug( 'setting ' . $key . ' to ' . $value, __FUNCTION__ );
1854
  $count = 0;
1855
  $headerline = preg_replace(
1856
  $regex,
@@ -1858,16 +1891,16 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
1858
  $headerline
1859
  );
1860
  else:
1861
- $this->debug( 'removing ' . $key, __FUNCTION__ );
1862
  continue;
1863
  endif;
1864
  endif;
1865
  endif;
1866
  $newheader .= $headerline . LF;
1867
  elseif ( $found_header && !$headerdone ): // we have gone in and out of header block; insert any remaining parameters
1868
- $this->debug( 'not in comment and after header', __FUNCTION__ );
1869
  foreach ( $child_headers as $key => $value ):
1870
- $this->debug( 'inserting ' . $key . ': ' . $value, __FUNCTION__ );
1871
  if ( empty( $value ) ) continue;
1872
  $newheader .= $key . ': ' . trim( $value ) . "\n";
1873
  endforeach;
@@ -1875,48 +1908,48 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
1875
  $newheader .= $headerline . "\n" . $this->css->get_css_imports();
1876
  $headerdone = 1;
1877
  else:
1878
- $this->debug( 'not in comment', __FUNCTION__ );
1879
  $newheader .= $headerline . LF;
1880
  endif;
1881
  endforeach;
1882
- $this->debug( 'new header: ' . LF . $newheader, __FUNCTION__ );
1883
  if ( !$found_header ) return FALSE;
1884
  endif;
1885
  $contents = $newheader . $contents;
1886
  if ( FALSE === $wp_filesystem->put_contents( $fspath, $contents ) ):
1887
- //$this->debug( 'Filesystem write to ' . $fspath . ' failed.', __FUNCTION__ );
1888
  else:
1889
- //$this->debug( 'Filesystem write to ' . $fspath . ' successful.', __FUNCTION__ );
1890
  endif;
1891
  //die( '<pre><code>' . $contents . '</code></pre>');
1892
  }
1893
 
1894
  function max_styles_notice() {
1895
- $this->ui->notices( 'max_styles' );
1896
  }
1897
 
1898
  function config_notice() {
1899
- $this->ui->notices( 'config' );
1900
  }
1901
 
1902
  function writable_notice() {
1903
- $this->ui->notices( 'writable' );
1904
  }
1905
 
1906
  function enqueue_notice() {
1907
- $this->ui->notices( 'enqueue' );
1908
  }
1909
 
1910
  function owner_notice() {
1911
- $this->ui->notices( 'owner' );
1912
  }
1913
 
1914
  function changed_notice() {
1915
- $this->ui->notices( 'changed' );
1916
  }
1917
 
1918
  function upgrade_notice() {
1919
- $this->ui->notices( 'upgrade' );
1920
  }
1921
 
1922
  function get_child_stylesheet() {
@@ -1936,7 +1969,7 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
1936
  function repair_header() {
1937
  // return if no flaws detected
1938
  if ( ! $this->get( 'cssunreg' ) && !$this->get( 'csswphead' ) ) return;
1939
- $this->debug( 'repairing parent header', __FUNCTION__ );
1940
  // try to copy from parent
1941
  $this->copy_parent_file( 'header' );
1942
  // try to backup child header template
@@ -1972,9 +2005,9 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
1972
  endif;
1973
 
1974
  // write new header template to child theme
1975
- $this->debug( 'Writing to filesystem: ' . $filename . LF . $contents, __FUNCTION__ );
1976
  if ( FALSE === $wp_filesystem->put_contents( $this->fspath( $filename ), $contents ) ):
1977
- $this->debug( 'Filesystem write failed, returning.', __FUNCTION__ );
1978
  return FALSE;
1979
  endif;
1980
  //die( '<textarea>' . $contents . '</textarea>' );
@@ -1993,7 +2026,7 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
1993
 
1994
  // if this is a self-contained child theme ( e.g., Genesis ) use child as baseline
1995
  $baseline = $this->get( 'ignoreparnt' ) ? 'child' : 'parnt';
1996
- $this->debug( 'baseline: ' . $baseline, __FUNCTION__ );
1997
  $this->css->parnt_deps = array();
1998
  $this->css->child_deps = array();
1999
  $this->css->addl_css = array();
@@ -2057,12 +2090,13 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
2057
 
2058
  // if main styleheet is loading out of sequence, force dependency
2059
  if ( isset( $analysis->child->signals->ctc_parnt_reorder ) )
2060
- $this->reorder = TRUE;
2061
  // roll back CTC Pro Genesis handling option
2062
  if ( isset( $analysis->child->signals->ctc_gen_loaded ) )
2063
  $this->genesis = TRUE;
2064
  endif;
2065
  }
 
2066
  /**
2067
  * Set the priority of the enqueue hook
2068
  * by matching the hook handle of the primary stylesheet ( thm_parnt_loaded or thm_child_loaded )
@@ -2075,10 +2109,11 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
2075
  $priority = array_shift( $handles );
2076
  $handle = $analysis->{ $baseline }->signals->{ 'thm_' . $baseline . '_loaded' };
2077
  if ( in_array( $handle, $handles ) ):
2078
- $this->debug( '(baseline: ' . $baseline . ') match: ' . $handle . ' setting priority: ' . $priority, __FUNCTION__ );
2079
  $this->css->set_prop( 'qpriority', $priority );
2080
  break;
2081
  endif;
2082
  endforeach;
2083
  }
 
2084
  }
3
  if ( !defined( 'ABSPATH' ) ) exit;
4
 
5
  /*
6
+ Class: ChildThemeConfiguratorAdmin
7
  Plugin URI: http://www.childthemeconfigurator.com/
8
  Description: Main Controller Class
9
+ Version: 2.1.0
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: child-theme-configurator
18
 
19
  // state
20
  var $genesis;
21
+ //var $reorder;
22
  var $processdone;
23
  var $childtype;
24
  var $template;
35
  var $menuName; // backward compatibility with plugin extension
36
  var $cache_updates = TRUE;
37
  var $debug;
38
+ var $is_debug;
39
+ var $is_new;
40
  // memory checks
41
  var $max_sel;
42
  var $sel_limit;
46
  var $errors = array();
47
  var $files = array();
48
  var $updates = array();
 
49
  // objects
50
  var $css;
51
  var $ui;
97
  function __construct() {
98
  $this->processdone = FALSE;
99
  $this->genesis = FALSE;
100
+ //$this->reorder = FALSE;
101
  $this->is_new = FALSE;
102
  $this->encoding = WP_Http_Encoding::is_available();
103
  $this->menuName = CHLD_THM_CFG_MENU; // backward compatability for plugins extension
104
  $this->is_post = ( 'POST' == $_SERVER[ 'REQUEST_METHOD' ] );
105
  $this->is_get = ( 'GET' == $_SERVER[ 'REQUEST_METHOD' ] );
106
  $this->is_debug = get_option( CHLD_THM_CFG_OPTIONS . '_debug' );
107
+ $this->debug = '';
108
+ $this->errors = array();
109
  }
110
 
111
  /**
121
  // perform any checks prior to processing config data
122
  do_action( 'chld_thm_cfg_preprocess' );
123
  // process any additional forms
124
+ do_action( 'chld_thm_cfg_forms' ); // hook for custom forms
125
  // process main post data
126
  $this->process_post();
127
  // initialize UI
180
  include_once( CHLD_THM_CFG_DIR . '/includes/class-ctc-css.php' );
181
  $this->css = new ChildThemeConfiguratorCSS();
182
  if ( FALSE !== $this->css->load_config() ):
183
+ $this->debug( 'config exists', __FUNCTION__, __CLASS__, __CLASS__ );
184
  // if themes do not exist reinitialize
185
  if ( ! $this->check_theme_exists( $this->get( 'child' ) )
186
  || ! $this->check_theme_exists( $this->get( 'parnt' ) ) ):
187
+ $this->debug( 'theme does not exist', __FUNCTION__, __CLASS__, __CLASS__ );
188
  add_action( 'admin_notices', array( $this, 'config_notice' ) );
189
  $this->css = new ChildThemeConfiguratorCSS();
190
  $this->css->enqueue = 'enqueue';
191
  endif;
192
  else:
193
+ $this->debug( 'config does not exist', __FUNCTION__, __CLASS__, __CLASS__ );
194
  // this is a fresh install
195
  $this->css->enqueue = 'enqueue';
196
  endif;
208
  add_action( 'admin_notices', array( $this, 'writable_notice' ) );
209
  if ( $fsize = $this->get( 'fsize' ) ):
210
  $test = filesize( $stylesheet );
211
+ $this->debug( 'filesize saved: ' . $fsize . ' current: ' . $test, __FUNCTION__, __CLASS__, __CLASS__ );
212
  if ( $test != $fsize )
213
  add_action( 'admin_notices', array( $this, 'changed_notice' ) );
214
  endif;
215
  // enqueue flag will be null for existing install < 1.6.0
216
  if ( !$this->get( 'enqueue' ) ):
217
+ $this->debug( 'no enqueue:', __FUNCTION__, __CLASS__, __CLASS__ );
218
 
219
  add_action( 'admin_notices', array( $this, 'enqueue_notice' ) );
220
  endif;
226
  * Future use: check if max selectors reached
227
  *
228
  if ( $this->get( 'max_sel' ) ):
229
+ $this->debug( 'Max selectors exceeded.', __FUNCTION__, __CLASS__, __CLASS__ );
230
  //$this->errors[] = __( 'Maximum number of styles exceeded.', 'child-theme-configurator' );
231
  add_action( 'admin_notices', array( $this, 'max_styles_notice' ) );
232
  endif;
238
  endif;
239
  }
240
 
 
 
 
 
 
 
 
241
  /**
242
  * ajax callback for saving form data
243
  */
244
  function ajax_save_postdata( $action = 'ctc_update' ) {
245
  $this->is_ajax = TRUE;
246
+ $this->debug( 'ajax save ', __FUNCTION__, __CLASS__ );
247
  // security check
248
  if ( $this->validate_post( $action ) ):
249
  if ( 'ctc_plugin' == $action ) do_action( 'chld_thm_cfg_pluginmode' );
250
  $this->verify_creds(); // initialize filesystem access
251
+ add_action( 'chld_thm_cfg_cache_updates', array( $this, 'cache_debug' ) );
252
  // get configuration data from options API
253
  if ( FALSE !== $this->load_config() ): // sanity check: only update if config data exists
254
  if ( isset( $_POST[ 'ctc_is_debug' ] ) ):
260
  // return recent edits and selected stylesheets as cache updates
261
  if ( $this->get( 'child' ) ):
262
  // hook for add'l plugin files and subdirectories
263
+ do_action( 'chld_thm_cfg_addl_files' );
264
  $this->css->write_css();
 
 
265
  /*
266
  $this->updates[] = array(
267
  'obj' => 'addl_css',
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
  endif;
281
  $result = $this->css->obj_to_utf8( $this->updates );
296
  if ( $this->validate_post( $action ) ):
297
  if ( 'ctc_plugin' == $action ) do_action( 'chld_thm_cfg_pluginmode' );
298
  $this->load_config();
299
+ add_action( 'chld_thm_cfg_cache_updates', array( $this, 'cache_debug' ) );
300
  $regex = "/^ctc_query_/";
301
  foreach( preg_grep( $regex, array_keys( $_POST ) ) as $key ):
302
  $name = preg_replace( $regex, '', $key );
303
  $param[ $name ] = sanitize_text_field( $_POST[ $key ] );
304
  endforeach;
305
+ $this->debug( 'ajax params: ' . print_r( $param, TRUE ), __FUNCTION__, __CLASS__, __CLASS__ );
306
  if ( !empty( $param[ 'obj' ] ) ):
307
  // add any additional updates to pass back to browser
308
  $this->updates[] = array(
342
  die( 0 );
343
  }
344
 
345
+ function get_pathinfo( $path ){
346
+ $pathinfo = pathinfo( $path );
347
+ $path = ( preg_match( "/^[\.\/]/", $pathinfo[ 'dirname' ] ) ? '' : $pathinfo[ 'dirname' ] . '/' ) . $pathinfo[ 'filename' ];
348
+ return array( $path, $pathinfo[ 'extension' ] );
349
+ }
350
  /**
351
  * Handles processing for all form submissions.
352
+ * Moved conditions to switch statement with the main setup logic in a separate function.
 
353
  */
354
  function process_post() {
355
  // make sure this is a post
364
  if ( empty( $actionfield ) ) return FALSE;
365
 
366
  // make sure post passes security checkpoint
 
367
  if ( $this->validate_post( apply_filters( 'chld_thm_cfg_action', 'ctc_update' ) ) ):
368
  // reset debug log
369
  delete_site_transient( CHLD_THM_CFG_OPTIONS . '_debug' );
370
+ // handle uploaded file before checking filesystem
371
+ if ( 'theme_image_submit' == $actionfield && isset( $_FILES[ 'ctc_theme_image' ] ) ):
372
+ $this->handle_file_upload( 'ctc_theme_image', $this->imgmimes );
373
+ elseif ( 'theme_screenshot_submit' == $actionfield && isset( $_FILES[ 'ctc_theme_screenshot' ] ) ):
374
+ $this->handle_file_upload( 'ctc_theme_screenshot', $this->imgmimes );
375
+ endif;
376
+ // now we need to check filesystem access
377
+ $args = preg_grep( "/nonce/", array_keys( $_POST ), PREG_GREP_INVERT );
378
+ $this->verify_creds( $args );
379
+ if ( $this->fs ):
380
+ $msg = FALSE;
381
+ // we have filesystem access so proceed with specific actions
382
+ switch( $actionfield ):
383
+ case 'export_child_zip':
384
+ case 'export_theme':
385
+ $this->export_theme();
386
+ // if we get here the zip failed
387
+ $this->errors[] = __( 'Zip file creation failed.', 'child-theme-configurator' );
388
+ break;
389
+ case 'load_styles':
390
+ // main child theme setup function
391
+ $msg = $this->setup_child_theme();
392
+ break;
393
+
394
+ case 'parnt_templates_submit':
395
+ // copy parent templates to child
396
+ if ( isset( $_POST[ 'ctc_file_parnt' ] ) ):
397
+ foreach ( $_POST[ 'ctc_file_parnt' ] as $file ):
398
+ list( $path, $ext ) = $this->get_pathinfo( sanitize_text_field( $file ) );
399
+ $this->copy_parent_file( $path, $ext );
400
+ endforeach;
401
+ $msg = '8&tab=file_options';
402
+ endif;
403
+ break;
404
 
405
+ case 'child_templates_submit':
406
+ // delete child theme files
407
+ if ( isset( $_POST[ 'ctc_file_child' ] ) ):
 
 
 
 
 
 
408
 
409
+ foreach ( $_POST[ 'ctc_file_child' ] as $file ):
410
+ list( $path, $ext ) = $this->get_pathinfo( sanitize_text_field( $file ) );
411
+ if ( 'functions' == $path ):
 
412
  $this->errors[] =
413
  __( 'The Functions file is required and cannot be deleted.', 'child-theme-configurator' );
414
+ continue;
415
  else:
416
+ $this->delete_child_file( $path, $ext );
 
 
 
 
417
  endif;
418
+ endforeach;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
419
  $msg = '8&tab=file_options';
420
+ endif;
421
+ break;
422
 
423
+ case 'image_submit':
424
+ // delete child theme images
425
+ if ( isset( $_POST[ 'ctc_img' ] ) ):
426
+ foreach ( $_POST[ 'ctc_img' ] as $file )
427
+ $this->delete_child_file( 'images/' . sanitize_text_field( $file ), 'img' );
428
  $msg = '8&tab=file_options';
429
+ endif;
430
+ break;
431
 
432
+ case 'templates_writable_submit':
433
+ // make specific files writable ( systems not running suExec )
434
+ if ( isset( $_POST[ 'ctc_file_child' ] ) ):
435
+ foreach ( $_POST[ 'ctc_file_child' ] as $file ):
436
+ list( $path, $ext ) = $this->get_pathinfo( sanitize_text_field( $file ) );
437
+ $this->set_writable( $path, $ext );
438
+ endforeach;
439
+ $msg = '8&tab=file_options';
440
+ endif;
441
+ break;
442
 
443
+ case 'set_writable':
444
+ // make child theme style.css and functions.php writable ( systems not running suExec )
445
+ $this->set_writable(); // no argument defaults to style.css
446
+ $this->set_writable( 'functions' );
447
+ $msg = '8&tab=file_options';
448
+ break;
449
+
450
+ case 'reset_permission':
451
+ // make child theme read-only ( systems not running suExec )
452
+ $this->unset_writable();
453
+ $msg = '8&tab=file_options';
454
+ break;
455
+
456
+ case 'theme_image_submit':
457
+ // move uploaded child theme images (now we have filesystem access)
458
+ if ( isset( $_POST[ 'movefile' ] ) ):
459
+ $this->move_file_upload( 'images' );
460
  $msg = '8&tab=file_options';
461
+ endif;
462
+ break;
463
+
464
+ case 'theme_screenshot_submit':
465
+ // move uploaded child theme screenshot (now we have filesystem access)
466
+ if ( isset( $_POST[ 'movefile' ] ) ):
467
+ // remove old screenshot
468
+ foreach( array_keys( $this->imgmimes ) as $extreg ):
469
+ foreach ( explode( '|', $extreg ) as $ext )
470
+ $this->delete_child_file( 'screenshot', $ext );
471
+ endforeach;
472
+ $this->move_file_upload( '' );
473
+ $msg = '8&tab=file_options';
474
+ endif;
475
+ break;
476
+ default:
477
+ // assume we are on the files tab so just redirect there
478
+ $msg = '8&tab=file_options';
479
+ endswitch;
480
+ endif; // end filesystem condition
481
  if ( empty( $this->errors ) && empty( $this->fs_prompt ) ):
482
  $this->processdone = TRUE;
483
  //die( '<pre><code><small>' . print_r( $_POST, TRUE ) . '</small></code></pre>' );
500
  */
501
  function setup_child_theme() {
502
  $msg = 1;
503
+ $this->is_new = TRUE;
504
  // sanitize and extract config fields into local vars
505
  foreach ( $this->configfields as $configfield ):
506
  $varparts = explode( '_', $configfield );
507
  $varname = end( $varparts );
508
  ${$varname} = empty( $_POST[ 'ctc_' . $configfield ] ) ? '' :
509
  preg_replace( "/\s+/s", ' ', sanitize_text_field( $_POST[ 'ctc_' . $configfield ] ) );
510
+ $this->debug( 'Extracting var ' . $varname . ' from ctc_' . $configfield . ' value: ' . ${$varname} , __FUNCTION__, __CLASS__ );
511
  endforeach;
512
 
513
  if ( isset( $type ) ) $this->childtype = $type;
566
 
567
  // load or reset config
568
  if ( 'reset' == $type ):
569
+ $this->debug( 'resetting child theme', __FUNCTION__, __CLASS__ );
570
  $this->reset_child_theme();
571
+ $this->enqueue_parent_css();
572
  $msg = 4;
573
  else:
574
 
618
  foreach ( $_POST[ 'ctc_additional_css' ] as $file )
619
  $this->css->addl_css[] = sanitize_text_field( $file );
620
  endif;
621
+ add_action( 'chld_thm_cfg_parse_stylesheets', array( $this, 'parse_child_stylesheet_to_target' ) );
622
  elseif ( isset( $_POST[ 'ctc_analysis' ] ) ):
623
  // this is for themes
624
  $this->evaluate_signals();
647
  // do we parse parent stylesheet?
648
 
649
  if ( $this->get( 'hasstyles' ) && !$ignoreparnt ):
650
+ $this->debug( 'Adding action: parse_parent_stylesheet_to_source', __FUNCTION__, __CLASS__ );
651
+ add_action( 'chld_thm_cfg_parse_stylesheets', array( $this, 'parse_parent_stylesheet_to_source' ) );
652
  endif;
653
 
654
  // automatically network enable new theme // FIXME: shouldn't this be an option?
655
  if ( is_multisite() )
656
+ add_action( 'chld_thm_cfg_addl_options', array( $this, 'network_enable' ) );
657
  endif;
658
+ $this->debug( 'Adding action: parse_additional_stylesheets_to_source', __FUNCTION__, __CLASS__ );
659
+ add_action( 'chld_thm_cfg_parse_stylesheets', array( $this, 'parse_additional_stylesheets_to_source' ) );
660
 
661
  if ( 'separate' == $handling ):
662
  // parse child theme style.css into source config
663
+ $this->debug( 'Adding action: parse_child_stylesheet_to_source', __FUNCTION__, __CLASS__ );
664
+ add_action( 'chld_thm_cfg_parse_stylesheets', array( $this, 'parse_child_stylesheet_to_source' ) );
665
  // parse child theme ctc-style.css into target config
666
+ $this->debug( 'Adding action: parse_custom_stylesheet_to_target', __FUNCTION__, __CLASS__ );
667
+ add_action( 'chld_thm_cfg_parse_stylesheets', array( $this, 'parse_custom_stylesheet_to_target' ) );
668
  elseif ( 'primary' == $handling ):
669
  // parse child theme style.css into target config
670
+ $this->debug( 'Adding action: parse_child_stylesheet_to_target', __FUNCTION__, __CLASS__ );
671
+ add_action( 'chld_thm_cfg_parse_stylesheets', array( $this, 'parse_child_stylesheet_to_target' ) );
672
  if ( $oldhandling != $handling ):
673
+ $this->debug( 'Adding action: parse_custom_stylesheet_to_target', __FUNCTION__, __CLASS__ );
674
+ add_action( 'chld_thm_cfg_parse_stylesheets', array( $this, 'parse_custom_stylesheet_to_target' ) );
675
  endif;
676
  endif;
677
 
678
  // function to support wp_filesystem requirements
679
  if ( $this->is_theme( $configtype ) ):
680
  // is theme means this is not a plugin stylesheet config
681
+ add_action( 'chld_thm_cfg_addl_files', array( $this, 'add_base_files' ), 10, 2 );
682
+ add_action( 'chld_thm_cfg_addl_files', array( $this, 'copy_screenshot' ), 10, 2 );
683
+ add_action( 'chld_thm_cfg_addl_files', array( $this, 'enqueue_parent_css' ), 15, 2 );
684
  if ( $repairheader && 'reset' != $type ):
685
+ add_action( 'chld_thm_cfg_addl_files', array( $this, 'repair_header' ) );
686
  endif;
687
 
 
 
 
 
 
 
 
688
  endif;
689
 
690
  // plugin hooks for additional stylesheet handling options
693
 
694
  // plugin hook to parse additional or non-standard files
695
  do_action( 'chld_thm_cfg_parse_stylesheets' );
 
696
  // copy menus, widgets and other customizer options from parent to child if selected
697
  if ( isset( $_POST[ 'ctc_parent_mods' ] ) && 'duplicate' != $type )
698
  $this->copy_theme_mods( $parnt, $child );
699
  // run code generation function in read-only mode to add existing external stylesheet links to config data
700
+ $this->enqueue_parent_css( TRUE );
701
  // hook for add'l plugin files and subdirectories. Must run after stylesheets are parsed to apply latest options
702
+ do_action( 'chld_thm_cfg_addl_files' );
703
  // do not continue if errors
704
  if ( !empty ( $this->errors ) ) return FALSE;
705
  //echo ' no errors! saving...' . LF;
706
  if ( 'separate' == $handling ):
707
+ $this->debug( 'Writing new stylesheet header...', __FUNCTION__, __CLASS__ );
708
  $this->rewrite_stylesheet_header();
709
  endif;
710
  // set flag to skip import link conversion on ajax save
711
  $this->css->set_prop( 'converted', 1 );
712
 
713
  // try to write new stylsheet. If it fails send alert.
714
+ $this->debug( 'Writing new CSS...', __FUNCTION__, __CLASS__ );
715
  if ( FALSE === $this->css->write_css() ):
716
+ //$this->debug( print_r( debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS ), TRUE ), __FUNCTION__, __CLASS__ );
717
  $this->errors[] = __( 'Your stylesheet is not writable.', 'child-theme-configurator' );
718
  add_action( 'admin_notices', array( $this, 'writable_notice' ) );
719
  return FALSE;
721
  // get files to reload templates in new css object
722
  $this->get_files( $parnt );
723
  endif;
724
+ $this->debug( 'Saving new config...', __FUNCTION__, __CLASS__ );
725
  // save new object to WP options table
726
  $this->save_config();
727
+ $this->debug( 'Firing additional options action...', __FUNCTION__, __CLASS__ );
728
  // plugin hook for additional child theme setup functions
729
+ do_action( 'chld_thm_cfg_addl_options' );
730
+ //$this->dump_configs();
731
  // return message id 1, which says new child theme created successfully;
732
  return $msg;
733
  }
747
  }
748
 
749
  function update_redirect( $msg = 1 ) {
750
+ $this->log_debug();
751
  if ( empty( $this->is_ajax ) ):
752
  $ctcpage = apply_filters( 'chld_thm_cfg_admin_page', CHLD_THM_CFG_MENU );
753
  $screen = get_current_screen()->id;
759
  }
760
 
761
  function verify_child_dir( $path ) {
762
+ $this->debug( 'Verifying child dir: ' . $path, __FUNCTION__, __CLASS__ );
763
  if ( !$this->fs ):
764
+ $this->debug( 'No filesystem access.', __FUNCTION__, __CLASS__ );
765
  return FALSE; // return if no filesystem access
766
  endif;
767
  global $wp_filesystem;
768
  $themedir = $wp_filesystem->find_folder( get_theme_root() );
769
  if ( ! $wp_filesystem->is_writable( $themedir ) ):
770
+ $this->debug( 'Directory not writable: ' . $themedir, __FUNCTION__, __CLASS__ );
771
  return FALSE;
772
  endif;
773
  $childparts = explode( '/', $this->normalize_path( $path ) );
777
  $themedir = trailingslashit( $themedir ) . $subdir;
778
  if ( ! $wp_filesystem->is_dir( $themedir ) ):
779
  if ( ! $wp_filesystem->mkdir( $themedir, FS_CHMOD_DIR ) ):
780
+ $this->debug( 'Could not make directory: ' . $themedir, __FUNCTION__, __CLASS__ );
781
  return FALSE;
782
  endif;
783
  elseif ( ! $wp_filesystem->is_writable( $themedir ) ):
784
+ $this->debug( 'Directory not writable: ' . $themedir, __FUNCTION__, __CLASS__ );
785
  return FALSE;
786
  endif;
787
  endwhile;
788
+ $this->debug( 'Child dir verified: ' . $themedir, __FUNCTION__, __CLASS__ );
789
  return TRUE;
790
  }
791
 
792
  function add_base_files( $obj ){
793
+ //$this->debug( LF . LF, __FUNCTION__, __CLASS__ );
794
  // add functions.php file
795
  $contents = "<?php
796
  // Exit if accessed directly
800
  $this->write_child_file( 'functions.php', $contents );
801
  $this->backup_or_restore_file( 'style.css' );
802
  $contents = $this->css->get_css_header_comment( $handling );
803
+ $this->debug( 'writing initial stylesheet header...' . LF . $contents, __FUNCTION__, __CLASS__ );
804
  $this->write_child_file( 'style.css', $contents );
805
  if ( 'separate' == $handling ):
806
  $this->backup_or_restore_file( 'ctc-style.css' );
847
  * If external imports are present, it enqueues them as well.
848
  */
849
  function enqueue_parent_code(){
850
+ //$this->debug( print_r( debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS ), TRUE ), __FUNCTION__, __CLASS__ );
851
  $imports = $this->get( 'imports' );
852
  $enqueues = array();
853
  $code = "// AUTO GENERATED - Do not modify or remove comment markers above or below:" . LF;
862
  $cssnotheme = $this->get( 'cssnotheme' );
863
  $ignoreparnt = $this->get( 'ignoreparnt' );
864
  $priority = $this->get( 'qpriority' );
865
+ $reorder = $this->get( 'reorder' );
866
  $this->debug( 'deps: ' . print_r( $deps, TRUE ) . ' enq: ' . $enq . ' handling: ' . $handling
867
+ . ' hasstyles: ' . $hasstyles . ' parntloaded: ' . $parntloaded . ' childloaded: ' . $childloaded . ' reorder: ' . $reorder
868
+ . ' ignoreparnt: ' . $ignoreparnt . ' priority: ' . $priority . ' childtype: ' . $this->childtype, __FUNCTION__, __CLASS__ );
869
  // enqueue parent stylesheet
870
  if ( 'enqueue' == $enq && $hasstyles && !$parntloaded && !$ignoreparnt ):
871
  $code .= "
879
  // if loading parent theme, reset deps and add parent stylesheet
880
  $deps = array( "'chld_thm_cfg_parent'" );
881
 
882
+ endif;
883
+
884
+ // force a stylesheet dependency if parent is loading out of sequence
885
+ if ( 'separate' != $handling && $childloaded && $reorder && ( $parntloaded || in_array( 'chld_thm_cfg_parent', $deps ) ) ):
886
+ $dephandle = $parntloaded ? $parntloaded : 'chld_thm_cfg_parent';
887
+ $code .= "
888
  if ( !function_exists( 'chld_thm_cfg_add_parent_dep' ) ):
889
+ function chld_thm_cfg_add_parent_dep() {
890
+ global \$wp_styles;
891
+ array_unshift( \$wp_styles->registered[ '" . $childloaded . "' ]->deps, '" . $dephandle . "' );
892
+ }
893
  endif;
894
  add_action( 'wp_head', 'chld_thm_cfg_add_parent_dep', 2 );
895
  ";
 
896
  endif;
897
+
898
  // enqueue external stylesheets (previously used @import in the stylesheet)
899
  if ( !empty( $imports ) ):
900
  $ext = 0;
931
  if ( $ignoreparnt )
932
  $code .= "
933
  defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT', TRUE );" . LF;
934
+ //$this->debug( $code, __FUNCTION__, __CLASS__ );
935
  return explode( "\n", $code ); // apply_filters( 'chld_thm_cfg_enqueue_code_filter', $code ) ); // FIXME?
936
  }
937
 
938
  // updates function file with wp_enqueue_script code block. If getexternals flag is passed function is run in read-only mode
939
+ function enqueue_parent_css( $getexternals = FALSE ) {
940
+ $this->debug( 'enqueueing parent css: getexternals = ' . $getexternals, __FUNCTION__, __CLASS__ );
941
  $marker = 'ENQUEUE PARENT ACTION';
942
  $insertion = $this->enqueue_parent_code();
943
  if ( $filename = $this->css->is_file_ok( $this->css->get_child_target( 'functions.php' ), 'write' ) ):
958
  */
959
  function insert_with_markers( $filename, $marker, $insertion, $getexternals = FALSE ) {
960
  if ( count( $this->errors ) ):
961
+ $this->debug( 'Errors detected, returning', __FUNCTION__, __CLASS__ );
962
  return FALSE;
963
  endif;
964
  // first check if this is an ajax update
965
  if ( $this->is_ajax && is_readable( $filename ) && is_writable( $filename ) ):
966
  // ok to proceed
967
+ $this->debug( 'Ajax update, bypassing wp filesystem.', __FUNCTION__, __CLASS__ );
968
  $markerdata = explode( "\n", @file_get_contents( $filename ) );
969
  elseif ( !$this->fs ):
970
+ $this->debug( 'No filesystem access.', __FUNCTION__, __CLASS__ );
971
  return FALSE; // return if no filesystem access
972
  else:
973
  global $wp_filesystem;
974
  if( !$wp_filesystem->exists( $this->fspath( $filename ) ) ):
975
  if ( $getexternals ):
976
+ $this->debug( 'Read only and no functions file yet, returning...', __FUNCTION__, __CLASS__ );
977
  return FALSE;
978
  else:
979
  // make sure file exists with php header
980
+ $this->debug( 'No functions file, creating...', __FUNCTION__, __CLASS__ );
981
  $this->add_base_files( $this );
982
  endif;
983
  endif;
1035
  endif;
1036
  endforeach;
1037
  else:
1038
+ $this->debug( 'Could not parse functions file', __FUNCTION__, __CLASS__ );
1039
  return FALSE;
1040
  endif;
1041
  if ( $foundit ):
1042
+ $this->debug( 'Found marker, replaced inline', __FUNCTION__, __CLASS__ );
1043
  else:
1044
  if ( 'reset' != $this->childtype ):
1045
  // verify there is no PHP close tag at end of file
1046
  if ( ! $phpopen ):
1047
+ $this->debug( 'PHP not open', __FUNCTION__, __CLASS__ );
1048
  //$this->errors[] = __( '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' );
1049
  //return FALSE;
1050
  $newfile .= '<?php' . LF;
1057
  endif;
1058
  // only write file when getexternals is false
1059
  if ( $getexternals ):
1060
+ $this->debug( 'Read only, returning.', __FUNCTION__, __CLASS__ );
1061
  else:
1062
  $mode = 'direct' == $this->fs_method ? FALSE : 0666;
1063
+ $this->debug( 'Writing new functions file...', __FUNCTION__, __CLASS__ );
1064
  if ( $this->is_ajax && is_writable( $filename ) ):
1065
  // with ajax we have to bypass wp filesystem so file must already be writable
1066
  if ( FALSE === @file_put_contents( $filename, $newfile ) ):
1067
+ $this->debug( 'Ajax write failed.', __FUNCTION__, __CLASS__ );
1068
  return FALSE;
1069
  endif;
1070
  elseif ( FALSE === $wp_filesystem->put_contents(
1072
  $newfile,
1073
  $mode
1074
  ) ): // chmod will fail unless we have fs access. user can secure files after configuring
1075
+ $this->debug( 'Filesystem write failed.', __FUNCTION__, __CLASS__ );
1076
  return FALSE;
1077
  endif;
1078
  $this->css->set_prop( 'converted', 1 );
1081
 
1082
  // creates/updates file via filesystem API
1083
  function write_child_file( $file, $contents ) {
1084
+ //$this->debug( LF . LF, __FUNCTION__, __CLASS__ );
1085
  if ( !$this->fs ):
1086
+ $this->debug( 'No filesystem access, returning.', __FUNCTION__, __CLASS__ );
1087
  return FALSE; // return if no filesystem access
1088
  endif;
1089
  global $wp_filesystem;
1091
  $mode = 'direct' == $this->fs_method ? FALSE : 0666;
1092
  $file = $this->fspath( $file );
1093
  if ( $wp_filesystem->exists( $file ) ):
1094
+ $this->debug( 'File exists, returning.', __FUNCTION__, __CLASS__ );
1095
  return FALSE;
1096
  else:
1097
+ $this->debug( 'Writing to filesystem: ' . $file . LF . $contents, __FUNCTION__, __CLASS__ );
1098
  if ( FALSE === $wp_filesystem->put_contents(
1099
  $file,
1100
  $contents,
1101
  $mode
1102
  ) ):
1103
+ $this->debug( 'Filesystem write failed, returning.', __FUNCTION__, __CLASS__ );
1104
  return FALSE;
1105
  endif;
1106
  endif;
1107
  else:
1108
+ $this->debug( 'No directory, returning.', __FUNCTION__, __CLASS__ );
1109
  return FALSE;
1110
  endif;
1111
+ $this->debug( 'Filesystem write successful.', __FUNCTION__, __CLASS__ );
1112
  }
1113
 
1114
+ function copy_screenshot() {
1115
  // always copy screenshot
1116
  $this->copy_parent_file( 'screenshot' );
1117
  }
1118
 
1119
  function copy_parent_file( $file, $ext = 'php' ) {
1120
  if ( !$this->fs ):
1121
+ $this->debug( 'No filesystem access.', __FUNCTION__, __CLASS__ );
1122
  return FALSE; // return if no filesystem access
1123
  endif;
1124
  global $wp_filesystem;
1141
  // return true if file already exists
1142
  if ( $wp_filesystem->exists( $this->fspath( $child_file ) ) ) return TRUE;
1143
  $child_dir = dirname( $this->theme_basename( '', $child_file ) );
1144
+ $this->debug( 'Verifying child dir... ', __FUNCTION__, __CLASS__ );
1145
  if ( $parent_file // sanity check
1146
  && $child_file // sanity check
1147
  && $this->verify_child_dir( $child_dir ) //create child subdir if necessary
1148
  && $wp_filesystem->copy( $parent_file, $this->fspath( $child_file ), FS_CHMOD_FILE ) ):
1149
+ $this->debug( 'Filesystem copy successful', __FUNCTION__, __CLASS__ );
1150
  return TRUE;
1151
  endif;
1152
  $this->errors[] = __( 'Could not copy file:' . $parent_file, 'child-theme-configurator' );
1154
 
1155
  function delete_child_file( $file, $ext = 'php' ) {
1156
  if ( !$this->fs ):
1157
+ $this->debug( 'No filesystem access.', __FUNCTION__, __CLASS__ );
1158
  return FALSE; // return if no filesystem access
1159
  endif;
1160
  global $wp_filesystem;
1166
  return TRUE;
1167
  else:
1168
  $this->errors[] = __( 'Could not delete ' . $ext . ' file.', 'child-theme-configurator' );
1169
+ $this->debug( 'Could not delete ' . $ext . ' file', __FUNCTION__, __CLASS__ );
1170
  endif;
1171
  endif;
1172
  endif;
1173
  }
1174
 
1175
  function get_files( $theme, $type = 'template' ) {
 
1176
  $isparent = ( $theme === $this->get( 'parnt' ) );
1177
+ if ( 'template' == $type && $isparent && ( $templates = $this->get( 'templates' ) ) ):
1178
  return $templates;
1179
  elseif ( !isset( $this->files[ $theme ] ) ):
1180
 
1181
  $this->files[ $theme ] = array();
1182
  $imgext = '(' . implode( '|', array_keys( $this->imgmimes ) ) . ')';
1183
  foreach ( $this->css->recurse_directory(
1184
+ trailingslashit( get_theme_root() ) . $theme, '', TRUE ) as $filepath ):
1185
+ $file = $this->theme_basename( $theme, $filepath );
1186
  if ( preg_match( "/^style\-(\d+)\.css$/", $file, $matches ) ):
1187
  $date = date_i18n( 'D, j M Y g:i A', strtotime( $matches[ 1 ] ) );
1188
  $this->files[ $theme ][ 'backup' ][ $file ] = $date;
1189
+ //$this->debug( 'This is a backup file', __FUNCTION__, __CLASS__ );
1190
+ elseif ( strstr( $file, "ctcbackup" ) ):
1191
+ $date = date_i18n( 'D, j M Y g:i A', filemtime( $filepath ) );
1192
+ $this->files[ $theme ][ 'backup' ][ $file ] = $date;
1193
  elseif ( preg_match( "/^ctc\-plugins\-(\d+)\.css$/", $file, $matches ) ):
1194
  $date = date_i18n( 'D, j M Y g:i A', strtotime( $matches[ 1 ] ) );
1195
  $this->files[ $theme ][ 'pluginbackup' ][ $file ] = $date;
1196
+ //$this->debug( 'This is a plugin backup file', __FUNCTION__, __CLASS__ );
1197
  elseif ( preg_match( "/\.php$/", $file ) ):
1198
  if ( $isparent ):
1199
 
1200
  if ( ( $file_verified = $this->css->is_file_ok( $this->css->get_parent_source( $file, $theme ) , 'read' ) ) ):
1201
+ $this->debug( 'scanning ' . $file_verified . '... ', __FUNCTION__, __CLASS__ );
1202
  // read 2k at a time and bail if code detected
1203
  $template = FALSE;
1204
  if ( $handle = fopen( $file_verified, "rb") ):
1218
  $this->files[ $theme ][ 'template' ][] = $file;
1219
  endif;
1220
  else:
1221
+ //$this->debug( 'Child PHP, adding to templates', __FUNCTION__, __CLASS__ );
1222
  $this->files[ $theme ][ 'template' ][] = $file;
1223
  endif;
1224
+ elseif ( preg_match( "/\.css$/", $file )
1225
+ && ( !in_array( $file, array(
1226
+ 'style.css',
1227
+ 'ctc-style.css',
1228
+ 'ctc-plugins.css'
1229
+ ) ) ) ):
1230
  $this->files[ $theme ][ 'stylesheet' ][] = $file;
1231
+ //$this->debug( 'This is a stylesheet', __FUNCTION__, __CLASS__ );
1232
+ elseif ( preg_match( "/\.(js|txt)$/", $file ) ):
1233
+ $this->files[ $theme ][ 'txt' ][] = $file;
1234
  elseif ( preg_match( "/^images\/.+?\." . $imgext . "$/", $file ) ):
1235
  $this->files[ $theme ][ 'img' ][] = $file;
1236
+ //$this->debug( 'This is an image file', __FUNCTION__, __CLASS__ );
1237
+ else:
1238
+ $this->files[ $theme ][ 'other' ][] = $file;
1239
  endif;
1240
  endforeach;
1241
  endif;
1242
  if ( $isparent ):
1243
+ //$this->debug( 'Setting CSS object templates parameter', __FUNCTION__, __CLASS__ );
1244
  $this->css->templates = $this->files[ $theme ][ 'template' ];
1245
  endif;
1246
+ $types = explode( ",", $type );
1247
  $files = array();
1248
+ foreach ( $types as $type ):
1249
  if ( isset( $this->files[ $theme ][ $type ] ) )
1250
  $files = array_merge( $this->files[ $theme ][ $type ], $files );
1251
+ endforeach;
1252
  return $files;
1253
  }
1254
 
1256
  $file = $this->normalize_path( $file );
1257
  // if no theme passed, returns theme + file
1258
  $themedir = trailingslashit( $this->normalize_path( get_theme_root() ) ) . ( '' == $theme ? '' : trailingslashit( $theme ) );
1259
+ //$this->debug( 'Themedir: ' . $themedir . ' File: ' . $file , __FUNCTION__, __CLASS__ );
1260
  return preg_replace( '%^' . preg_quote( $themedir ) . '%', '', $file );
1261
  }
1262
 
1319
  $newfile = trailingslashit( $clone ) . $childfile;
1320
  $childpath = $fsthemedir . trailingslashit( $child ) . $childfile;
1321
  $newpath = $fsthemedir . $newfile;
1322
+ $this->debug( 'Verifying child dir... ', __FUNCTION__, __CLASS__ );
1323
  if ( $this->verify_child_dir( is_dir( $file ) ? $newfile : dirname( $newfile ) ) ):
1324
  if ( is_file( $file ) && !@$wp_filesystem->copy( $childpath, $newpath ) ):
1325
  $errors[] = 'could not copy ' . $newpath;
1358
  $childpath = $fsthemedir . trailingslashit( $child ) . $childfile;
1359
  $newpath = $fsthemedir . $newfile;
1360
  if ( $copy ):
1361
+ $this->debug( 'Verifying child dir... ' . $file, __FUNCTION__, __CLASS__ );
1362
  if ( $this->verify_child_dir( is_dir( $file ) ? $newfile : dirname( $newfile ) ) ):
1363
  if ( is_file( $file ) && !$wp_filesystem->copy( $childpath, $newpath ) ):
1364
  $errors[] = 'could not copy ' . $newpath;
1430
  $target_file = ( '' == $subdir ?
1431
  preg_replace( "%^.+(\.\w+)$%", "screenshot$1", basename( $source_file ) ) :
1432
  trailingslashit( $subdir ) . basename( $source_file ) );
1433
+ $source_path = $this->uploads_fullpath( $source_file );
1434
+ $source_dir = dirname( $source_path );
1435
+ $mode = 0;
1436
  if ( FALSE !== $this->verify_child_dir( trailingslashit( $this->get( 'child' ) ) . $subdir ) ):
1437
+
1438
  if ( $target_path = $this->css->is_file_ok( $this->css->get_child_target( $target_file ), 'write' ) ):
1439
+ $fs_target_path = $this->fspath( $target_path );
1440
+ $fs_source_path = $this->fspath( $source_path );
1441
+ if ( $wp_filesystem->exists( $fs_source_path ) ):
1442
+ // in case source dir is not writable by wp_filesystem
1443
+ //$fs_source_dir = dirname( $fs_source_path );
1444
+ //if ( !$wp_filesystem->is_writable( $fs_source_dir ) ):
1445
+ // wp_filesystem->is_writable always returns true so just try chmod as webserver
1446
+ $mode = fileperms( $source_dir );
1447
+ if ( $mode ) :
1448
+ $writemode = $mode | 0666;
1449
+ if ( $set_perms = @chmod( $source_dir, $writemode ) )
1450
+ $this->debug( 'Changed source dir permissions from ' . substr( sprintf( '%o', $mode ), -4 ) . ' to ' . substr( sprintf( '%o', $writemode ), -4 ), __FUNCTION__ );
1451
+ endif;
1452
+ //endif;
1453
+ if ( @$wp_filesystem->move( $fs_source_path, $fs_target_path ) ):
1454
+ if ( $mode && $set_perms ):
1455
+ if ( @chmod( $source_dir, $mode ) )
1456
+ $this->debug( 'Reset source dir permissions to ' . substr( sprintf( '%o', $mode ), -4 ), __FUNCTION__ );
1457
+ endif;
1458
+ return TRUE;
1459
+ else:
1460
+ if ( $mode && $set_perms ):
1461
+ if ( @chmod( $source_dir, $mode ) )
1462
+ $this->debug( 'Reset source dir permissions to ' . substr( sprintf( '%o', $mode ), -4 ), __FUNCTION__ );
1463
+ endif;
1464
+ $this->debug( 'Could not move file from ' . $source_path . ' to ' . $target_file, __FUNCTION__ );
1465
+ endif;
1466
+ else:
1467
+ $this->debug( 'Source file does not exist: ' . $source_path, __FUNCTION__ );
1468
  endif;
1469
+ else:
1470
+ $this->debug( 'Target file not OK: ' . $target_file, __FUNCTION__ );
1471
  endif;
1472
+ else:
1473
+ $this->debug( 'Could not verify child dir', __FUNCTION__ );
1474
  endif;
1475
 
1476
  $this->errors[] = __( 'Could not upload file.', 'child-theme-configurator' );
1480
  * exports theme as zip archive.
1481
  * As of version 2.03, parent themes can be exported as well
1482
  */
1483
+ function export_theme() {
1484
  $version = '';
1485
  if ( empty( $_POST[ 'ctc_export_theme' ] ) ):
1486
  $template = $this->get( 'child' );
1492
  endif;
1493
  // make sure directory exists and is in themes folder
1494
  if ( ( $dir = $this->css->is_file_ok( trailingslashit( get_theme_root() ) . $template, 'search' ) ) ):
1495
+ if ( $tmpdir = $this->get_tmp_dir() ):
1496
+ $file = trailingslashit( $tmpdir ) . $template . ( empty( $version ) ? '' : '-' . $version ) . '.zip';
1497
+ $this->export_zip_file( $file, $dir );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1498
  else:
1499
+ return FALSE;
1500
  endif;
1501
  else:
1502
  $this->errors = __( 'Invalid theme root directory.', 'child-theme-configurator' );
1503
  endif;
 
1504
  }
1505
+
1506
+ function get_tmp_dir(){
1507
+ // Try to use php system upload dir to store temp files first
1508
+ $tmpdir = ini_get( 'upload_tmp_dir' ) ? ini_get( 'upload_tmp_dir' ) : sys_get_temp_dir();
1509
+ if ( !is_writable( $tmpdir ) ):
1510
+ // try uploads directory
1511
+ $uploads = wp_upload_dir();
1512
+ $tmpdir = $uploads[ 'basedir' ];
1513
+ if ( !is_writable( $tmpdir ) ):
1514
+ $this->errors[] = __( 'No writable temp directory.', 'child-theme-configurator' );
1515
+ return FALSE;
1516
+ endif;
1517
+ endif;
1518
+ return $tmpdir;
1519
+ }
1520
+
1521
+ function export_zip_file( $file, $source ) {
1522
+ if ( file_exists( $file ) ) unlink ( $file );
1523
+
1524
+ mbstring_binary_safe_encoding();
1525
 
1526
+ // PclZip ships with WordPress
1527
+ require_once( ABSPATH . 'wp-admin/includes/class-pclzip.php' );
1528
+
1529
+ $archive = new PclZip( $file );
1530
+ if ( $response = $archive->create( $source, PCLZIP_OPT_REMOVE_PATH, dirname( $source ) ) ):
1531
+
1532
+ reset_mbstring_encoding();
1533
+ header( 'Content-Description: File Transfer' );
1534
+ header( 'Content-Type: application/octet-stream' );
1535
+ header( 'Content-Length: ' . filesize( $file ) );
1536
+ header( 'Content-Disposition: attachment; filename=' . basename( $file ) );
1537
+ header( 'Expires: 0' );
1538
+ header( 'Cache-Control: must-revalidate' );
1539
+ header( 'Pragma: public' );
1540
+ readfile( $file );
1541
+ unlink( $file );
1542
+ die();
1543
+ else:
1544
+ $this->errors[] = __( 'PclZip returned zero bytes.', 'child-theme-configurator' );
1545
+ endif;
1546
+ }
1547
  /*
1548
  *
1549
  */
1594
  $fsdir = $wp_filesystem->find_folder( $dir );
1595
  return trailingslashit( $fsdir ) . $base;
1596
  }
1597
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1598
  // backwards compatability < WP 3.9
1599
  function normalize_path( $path ) {
1600
  $path = str_replace( '\\', '/', $path );
1665
  $debug = '';
1666
  if ( $_POST[ 'ctc_is_debug' ] ):
1667
  $this->is_debug = 1;
 
1668
  else:
1669
  $this->is_debug = 0;
1670
  endif;
1671
+ update_option( CHLD_THM_CFG_OPTIONS . '_debug', $this->is_debug, FALSE );
1672
+ delete_site_transient( CHLD_THM_CFG_OPTIONS . '_debug' );
 
 
 
 
1673
  }
1674
 
1675
+ function debug( $msg = NULL, $fn = NULL, $cl = NULL ) {
1676
+ if ( $this->is_debug )
1677
+ $this->debug .= ( isset( $cl ) ? $cl . '::' : '' ) . ( isset( $fn ) ? $fn . ' -- ' : '' ) . ( isset( $msg ) ? $msg . LF : '' );
1678
  }
1679
 
1680
+ function log_debug() {
1681
+ $this->debug( '*** END OF REQUEST ***', __FUNCTION__, __CLASS__ );
1682
  // save debug data for 1 hour
1683
  set_site_transient( CHLD_THM_CFG_OPTIONS . '_debug', $this->debug, 3600 );
 
 
 
1684
  }
1685
+ function get_debug() {
1686
+ return get_site_transient( CHLD_THM_CFG_OPTIONS . '_debug' ) . LF . $this->debug;
1687
+ }
1688
+ function cache_debug() {
1689
+ $this->debug( '*** END OF REQUEST ***', __FUNCTION__, __CLASS__ );
1690
+ $this->updates[] = array(
1691
+ 'obj' => 'debug',
1692
+ 'key' => '',
1693
+ 'data' => $this->debug,
1694
+ );
1695
+ }
1696
  function parse_parent_stylesheet_to_source() {
1697
  $this->css->parse_css_file( 'parnt' );
1698
  }
1719
  //$file = sanitize_text_field( $file );
1720
  $this->css->parse_css_file( 'parnt', $file );
1721
  endforeach;
1722
+ $this->debug( print_r( $this->css->addl_css, TRUE ), __FUNCTION__, __CLASS__ );
1723
  //endif;
1724
  }
1725
 
1740
  $this->delete_child_file( 'ctc-style.ctcbackup', 'css' );
1741
  }
1742
 
1743
+ // we can copy settings from parent to child even if neither is currently active
1744
+ // so we need cases for active parent, active child or neither
1745
  function copy_theme_mods( $from, $to ) {
1746
+ if ( strlen( $from ) && strlen( $to ) ):
1747
+ $this->set_theme_mods( $to, $this->get_theme_mods( $from ) );
1748
+ endif;
1749
+ }
1750
+
1751
+
1752
+ function get_theme_mods( $theme ){
1753
  // get active theme
1754
  $active_theme = get_stylesheet();
 
1755
  // create temp array from parent settings
1756
+ $mods = get_option( 'theme_mods_' . $theme );
1757
+ if ( $active_theme == $theme ):
1758
+ $this->debug( 'from is active, using active widgets', __FUNCTION__, __CLASS__ );
1759
  // if parent theme is active, get widgets from active sidebars_widgets array
1760
+ $mods[ 'sidebars_widgets' ][ 'data' ] = retrieve_widgets();
1761
  else:
1762
+ $this->debug( 'from not active, using theme mods widgets', __FUNCTION__, __CLASS__ );
1763
  // otherwise get widgets from parent theme mods
1764
+ $mods[ 'sidebars_widgets' ][ 'data' ] = empty( $mods[ 'sidebars_widgets' ][ 'data' ] ) ?
1765
+ array( 'wp_inactive_widgets' => array() ) : $mods[ 'sidebars_widgets' ][ 'data' ];
1766
  endif;
1767
+ return $mods;
1768
+ }
1769
+
1770
+ function set_theme_mods( $theme, $mods ){
1771
+ $active_theme = get_stylesheet();
1772
+ $widgets = $mods[ 'sidebars_widgets' ][ 'data' ];
1773
+ if ( $active_theme == $theme ):
1774
+ $this->debug( 'to active, setting active widgets', __FUNCTION__, __CLASS__ );
1775
  // copy widgets to active sidebars_widgets array
1776
+ wp_set_sidebars_widgets( $mods[ 'sidebars_widgets' ][ 'data' ] );
1777
+ // if child theme is active, remove widgets from temp array
1778
+ unset( $mods[ 'sidebars_widgets' ] );
1779
  else:
1780
+ $this->debug( 'child not active, saving widgets in theme mods', __FUNCTION__, __CLASS__ );
1781
  // otherwise copy widgets to temp array with time stamp
1782
+ // array value is already set
1783
+ //$mods[ 'sidebars_widgets' ][ 'data' ] = $widgets;
1784
+ $mods[ 'sidebars_widgets' ][ 'time' ] = time();
1785
  endif;
1786
+ //$this->debug( 'saving child theme mods:' . LF . print_r( $mods, TRUE ), __FUNCTION__, __CLASS__ );
1787
  // copy temp array to child mods
1788
+ update_option( 'theme_mods_' . $theme, $mods );
1789
  }
1790
 
1791
  function network_enable() {
1798
 
1799
  function backup_or_restore_file( $source, $restore = FALSE, $target = NULL ){
1800
  $action = $restore ? 'Restore' : 'Backup';
1801
+ $this->debug( LF . LF . $action . ' main stylesheet...', __FUNCTION__, __CLASS__ );
1802
  if ( !$this->fs ):
1803
+ $this->debug( 'No filesystem access, returning', __FUNCTION__, __CLASS__ );
1804
  return FALSE; // return if no filesystem access
1805
  endif;
1806
  list( $base, $suffix ) = explode( '.', $source );
1814
  $fssource = $this->fspath( $this->css->get_child_target( $source ) );
1815
  global $wp_filesystem;
1816
  if ( ( !$wp_filesystem->exists( $fssource ) ) || ( !$restore && $wp_filesystem->exists( $fstarget ) ) ):
1817
+ $this->debug( 'No stylesheet, returning', __FUNCTION__, __CLASS__ );
1818
  return FALSE;
1819
  endif;
1820
  if ( $wp_filesystem->copy( $fssource, $fstarget, FS_CHMOD_FILE ) ):
1821
+ $this->debug( 'Filesystem ' . $action . ' successful', __FUNCTION__, __CLASS__ );
1822
  return TRUE;
1823
  else:
1824
+ $this->debug( 'Filesystem ' . $action . ' failed', __FUNCTION__, __CLASS__ );
1825
  return FALSE;
1826
  endif;
1827
  }
1828
 
1829
  function rewrite_stylesheet_header(){
1830
+ $this->debug( LF . LF . 'Rewriting main stylesheet header...', __FUNCTION__, __CLASS__ );
1831
  if ( !$this->fs ):
1832
+ $this->debug( 'No filesystem access, returning', __FUNCTION__, __CLASS__ );
1833
  return FALSE; // return if no filesystem access
1834
  endif;
1835
  $origcss = $this->css->get_child_target( 'style.css' );
1836
  $fspath = $this->fspath( $origcss );
1837
  global $wp_filesystem;
1838
  if( !$wp_filesystem->exists( $fspath ) ):
1839
+ $this->debug( 'No stylesheet, returning', __FUNCTION__, __CLASS__ );
1840
  return FALSE;
1841
  endif;
1842
  // get_contents_array returns extra linefeeds so just split it ourself
1846
  $regex = implode( '|', array_map( 'preg_quote', array_keys( $child_headers ) ) );
1847
  else $regex = 'NO HEADERS';
1848
  $regex = '/(' . $regex . '):.*$/';
1849
+ $this->debug( 'regex: ' . $regex, __FUNCTION__, __CLASS__ );
1850
  $header = str_replace( "\r", LF, substr( $contents, 0, 8192 ) );
1851
  $contents = substr( $contents, 8192 );
1852
+ $this->debug( 'original header: ' . LF . substr( $header, 0, 1024 ), __FUNCTION__, __CLASS__ );
1853
+ //$this->debug( 'stripping @import rules...', __FUNCTION__, __CLASS__ );
1854
  // strip out existing @import lines
1855
  $header = preg_replace( '#\@import\s+url\(.+?\);\s*#s', '', $header );
1856
  // parse header line by line
1860
  $headerdone = 0;
1861
  $newheader = '';
1862
  if ( $headerdata ):
1863
+ $this->debug( 'parsing header...', __FUNCTION__, __CLASS__ );
1864
  foreach ( $headerdata as $n => $headerline ):
1865
  preg_match_all("/(\*\/|\/\*)/", $headerline, $matches );
1866
  if ( $matches ):
1873
  endforeach;
1874
  endif;
1875
  if ( $in_comment ):
1876
+ $this->debug( 'in comment', __FUNCTION__, __CLASS__ );
1877
  if ( preg_match( $regex, $headerline, $matches ) && !empty( $matches[ 1 ] ) ):
1878
  $found_header = 1;
1879
  $key = $matches[ 1 ];
1880
+ $this->debug( 'found header: ' . $key, __FUNCTION__, __CLASS__ );
1881
  if ( array_key_exists( $key, $child_headers ) ):
1882
+ $this->debug( 'child header value exists: ', __FUNCTION__, __CLASS__ );
1883
  $value = trim( $child_headers[ $key ] );
1884
  unset( $child_headers[ $key ] );
1885
  if ( $value ):
1886
+ $this->debug( 'setting ' . $key . ' to ' . $value, __FUNCTION__, __CLASS__ );
1887
  $count = 0;
1888
  $headerline = preg_replace(
1889
  $regex,
1891
  $headerline
1892
  );
1893
  else:
1894
+ $this->debug( 'removing ' . $key, __FUNCTION__, __CLASS__ );
1895
  continue;
1896
  endif;
1897
  endif;
1898
  endif;
1899
  $newheader .= $headerline . LF;
1900
  elseif ( $found_header && !$headerdone ): // we have gone in and out of header block; insert any remaining parameters
1901
+ //$this->debug( 'not in comment and after header', __FUNCTION__, __CLASS__ );
1902
  foreach ( $child_headers as $key => $value ):
1903
+ $this->debug( 'inserting ' . $key . ': ' . $value, __FUNCTION__, __CLASS__ );
1904
  if ( empty( $value ) ) continue;
1905
  $newheader .= $key . ': ' . trim( $value ) . "\n";
1906
  endforeach;
1908
  $newheader .= $headerline . "\n" . $this->css->get_css_imports();
1909
  $headerdone = 1;
1910
  else:
1911
+ //$this->debug( 'not in comment', __FUNCTION__, __CLASS__ );
1912
  $newheader .= $headerline . LF;
1913
  endif;
1914
  endforeach;
1915
+ $this->debug( 'new header: ' . LF . substr( $newheader, 0, 1024 ), __FUNCTION__, __CLASS__ );
1916
  if ( !$found_header ) return FALSE;
1917
  endif;
1918
  $contents = $newheader . $contents;
1919
  if ( FALSE === $wp_filesystem->put_contents( $fspath, $contents ) ):
1920
+ //$this->debug( 'Filesystem write to ' . $fspath . ' failed.', __FUNCTION__, __CLASS__ );
1921
  else:
1922
+ //$this->debug( 'Filesystem write to ' . $fspath . ' successful.', __FUNCTION__, __CLASS__ );
1923
  endif;
1924
  //die( '<pre><code>' . $contents . '</code></pre>');
1925
  }
1926
 
1927
  function max_styles_notice() {
1928
+ $this->ui->render_notices( 'max_styles' );
1929
  }
1930
 
1931
  function config_notice() {
1932
+ $this->ui->render_notices( 'config' );
1933
  }
1934
 
1935
  function writable_notice() {
1936
+ $this->ui->render_notices( 'writable' );
1937
  }
1938
 
1939
  function enqueue_notice() {
1940
+ $this->ui->render_notices( 'enqueue' );
1941
  }
1942
 
1943
  function owner_notice() {
1944
+ $this->ui->render_notices( 'owner' );
1945
  }
1946
 
1947
  function changed_notice() {
1948
+ $this->ui->render_notices( 'changed' );
1949
  }
1950
 
1951
  function upgrade_notice() {
1952
+ $this->ui->render_notices( 'upgrade' );
1953
  }
1954
 
1955
  function get_child_stylesheet() {
1969
  function repair_header() {
1970
  // return if no flaws detected
1971
  if ( ! $this->get( 'cssunreg' ) && !$this->get( 'csswphead' ) ) return;
1972
+ $this->debug( 'repairing parent header', __FUNCTION__, __CLASS__ );
1973
  // try to copy from parent
1974
  $this->copy_parent_file( 'header' );
1975
  // try to backup child header template
2005
  endif;
2006
 
2007
  // write new header template to child theme
2008
+ $this->debug( 'Writing to filesystem: ' . $filename . LF . $contents, __FUNCTION__, __CLASS__ );
2009
  if ( FALSE === $wp_filesystem->put_contents( $this->fspath( $filename ), $contents ) ):
2010
+ $this->debug( 'Filesystem write failed, returning.', __FUNCTION__, __CLASS__ );
2011
  return FALSE;
2012
  endif;
2013
  //die( '<textarea>' . $contents . '</textarea>' );
2026
 
2027
  // if this is a self-contained child theme ( e.g., Genesis ) use child as baseline
2028
  $baseline = $this->get( 'ignoreparnt' ) ? 'child' : 'parnt';
2029
+ $this->debug( 'baseline: ' . $baseline, __FUNCTION__, __CLASS__ );
2030
  $this->css->parnt_deps = array();
2031
  $this->css->child_deps = array();
2032
  $this->css->addl_css = array();
2090
 
2091
  // if main styleheet is loading out of sequence, force dependency
2092
  if ( isset( $analysis->child->signals->ctc_parnt_reorder ) )
2093
+ $this->css->set_prop( 'reorder', 1 );
2094
  // roll back CTC Pro Genesis handling option
2095
  if ( isset( $analysis->child->signals->ctc_gen_loaded ) )
2096
  $this->genesis = TRUE;
2097
  endif;
2098
  }
2099
+
2100
  /**
2101
  * Set the priority of the enqueue hook
2102
  * by matching the hook handle of the primary stylesheet ( thm_parnt_loaded or thm_child_loaded )
2109
  $priority = array_shift( $handles );
2110
  $handle = $analysis->{ $baseline }->signals->{ 'thm_' . $baseline . '_loaded' };
2111
  if ( in_array( $handle, $handles ) ):
2112
+ $this->debug( '(baseline: ' . $baseline . ') match: ' . $handle . ' setting priority: ' . $priority, __FUNCTION__, __CLASS__ );
2113
  $this->css->set_prop( 'qpriority', $priority );
2114
  break;
2115
  endif;
2116
  endforeach;
2117
  }
2118
+
2119
  }
includes/class-ctc-css.php CHANGED
@@ -6,7 +6,7 @@ if ( !defined( 'ABSPATH' ) ) exit;
6
  Class: ChildThemeConfiguratorCSS
7
  Plugin URI: http://www.childthemeconfigurator.com/
8
  Description: Handles all CSS input, output, parsing, normalization and storage
9
- Version: 2.0.5
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
@@ -14,6 +14,7 @@ if ( !defined( 'ABSPATH' ) ) exit;
14
  License: GPLv2
15
  Copyright (C) 2014-2016 Lilaea Media
16
  */
 
17
  class ChildThemeConfiguratorCSS {
18
 
19
  // data dictionaries
@@ -23,8 +24,8 @@ class ChildThemeConfiguratorCSS {
23
  var $dict_rule; // css rules
24
  var $dict_val; // css values
25
  var $dict_seq; // child load order (priority)
 
26
  // hierarchies
27
- var $sel_ndx; // query => selector hierarchy
28
  var $val_ndx; // selector => rule => value hierarchy
29
  // key counters
30
  var $qskey; // counter for dict_qs
@@ -32,6 +33,7 @@ class ChildThemeConfiguratorCSS {
32
  var $selkey; // counter for dict_sel
33
  var $rulekey; // counter for dict_rule
34
  var $valkey; // counter for dict_val
 
35
 
36
  // from parent/child form
37
  var $child; // child theme slug
@@ -50,6 +52,7 @@ class ChildThemeConfiguratorCSS {
50
  var $cssunreg;
51
  var $csswphead;
52
  var $cssnotheme;
 
53
 
54
  // header settings
55
  var $child_name; // child theme name
@@ -63,13 +66,16 @@ class ChildThemeConfiguratorCSS {
63
  // miscellaneous properties
64
  var $fsize; // used to check if styles changed since last update
65
  var $converted; // @imports coverted to <link>?
 
66
  var $templates; // cache of parent template files
67
  var $imports; // @import rules
68
  var $recent; // history of edited styles
69
  var $max_sel;
 
70
  var $styles; // temporary update cache
71
  var $temparray;
72
- var $vendorrule = array(
 
73
  'box\-sizing',
74
  'font\-smoothing',
75
  'border(\-(top|right|bottom|left))*\-radius',
@@ -90,6 +96,7 @@ class ChildThemeConfiguratorCSS {
90
  'cssunreg',
91
  'csswphead',
92
  'cssnotheme',
 
93
  'parnt_deps',
94
  'child_deps',
95
  'hasstyles',
@@ -117,22 +124,26 @@ class ChildThemeConfiguratorCSS {
117
  'qskey',
118
  'selkey',
119
  'querykey',
 
120
  'recent',
121
  'converted',
122
  'fsize',
 
123
  );
124
  var $dicts = array(
125
- 'dict_qs',
126
- 'dict_sel',
127
- 'dict_query',
128
- 'dict_rule',
129
- 'dict_val',
130
- 'dict_seq',
131
- 'sel_ndx',
132
- 'val_ndx',
133
  );
 
134
 
135
  function __construct() {
 
136
  // scalars
137
  $this->querykey = 0;
138
  $this->selkey = 0;
@@ -154,6 +165,7 @@ class ChildThemeConfiguratorCSS {
154
  $this->parnt = '';
155
  $this->ignoreparnt = 0;
156
  $this->qpriority = 10;
 
157
 
158
  // do not set enqueue, not being set is used to flag old versions
159
 
@@ -162,41 +174,59 @@ class ChildThemeConfiguratorCSS {
162
  $this->imports = array( 'child' => array(), 'parnt' => array() );
163
 
164
  $this->recent = array();
165
-
166
- $this->dict_qs = array();
167
- $this->dict_sel = array();
168
- $this->dict_query = array();
169
- $this->dict_rule = array();
170
- $this->dict_val = array();
171
- $this->dict_seq = array();
172
- $this->sel_ndx = array();
173
- $this->val_ndx = array();
174
  }
175
 
176
  // helper function to globalize ctc object
177
  function ctc() {
178
  return ChildThemeConfigurator::ctc();
179
  }
180
-
181
- // loads current ctc config data into local memory
182
- function load_config() {
183
- $option = CHLD_THM_CFG_OPTIONS . apply_filters( 'chld_thm_cfg_option', '' );
184
- //echo 'loading option: ' . $option . LF;
185
- if ( ( $configarray = get_site_option( $option . '_configvars' ) ) && count( $configarray ) ):
186
- foreach ( $this->configvars as $configkey ):
187
- if ( isset( $configarray[ $configkey ] ) )
188
- $this->{$configkey} = $configarray[ $configkey ];
189
- endforeach;
190
- //$this->ctc()->debug( 'load_config vars: ' . print_r( $configarray, TRUE ), __FUNCTION__ );
191
- foreach ( $this->dicts as $configkey ):
192
- if ( ( $configarray = get_site_option( $option . '_' . $configkey ) ) ):
193
- if ( count( $configarray ) )
194
- $this->{$configkey} = $configarray;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
195
  endif;
196
- endforeach;
197
- else:
198
- return FALSE;
199
  endif;
 
200
  }
201
 
202
  // writes ctc config data to options api
@@ -207,26 +237,29 @@ class ChildThemeConfiguratorCSS {
207
  if ( isset( $override ) ) $option = $override;
208
  else $option = apply_filters( 'chld_thm_cfg_option', '' );
209
  $option = CHLD_THM_CFG_OPTIONS . $option;
210
- //echo 'saving option: ' . $option . LF;
211
  $configarray = array();
212
  foreach ( $this->configvars as $configkey )
213
  $configarray[ $configkey ] = empty( $this->{$configkey} ) ? NULL : $this->{ $configkey };
214
- //$this->ctc()->debug( 'save_config vars: ' . print_r( $configarray, TRUE ), __FUNCTION__ );
215
  if ( is_multisite() ):
216
  update_site_option( $option . '_configvars', $configarray );
217
  else:
218
  // do not autoload ( passing false above only works if value changes
219
  update_option( $option . '_configvars', $configarray, FALSE );
220
  endif;
221
- foreach ( $this->dicts as $configkey ):
222
-
223
- if ( is_multisite() ):
224
- update_site_option( $option . '_' . $configkey, $this->{$configkey} );
225
- else:
226
- // do not autoload ( passing false above only works if value changes
227
- update_option( $option . '_' . $configkey, $this->{$configkey}, FALSE );
 
 
 
228
  endif;
229
  endforeach;
 
230
  }
231
 
232
  /**
@@ -235,7 +268,7 @@ class ChildThemeConfiguratorCSS {
235
  function get_stylesheet_path() {
236
  $stylesheet = apply_filters( 'chld_thm_cfg_target', $this->get_child_target( $this->ctc()->get_child_stylesheet() ), $this );
237
  $this->fsize = filesize( $stylesheet );
238
- $this->ctc()->debug( 'updated file size: ' . $this->fsize, __FUNCTION__ );
239
  return $stylesheet;
240
  }
241
  /**
@@ -258,14 +291,14 @@ class ChildThemeConfiguratorCSS {
258
  array_keys( array_flip( $this->imports[ 'child' ] ) ) ) :
259
  array() );
260
  case 'queries':
261
- return $this->obj_to_utf8( $this->denorm_sel_ndx() );
262
  case 'selectors':
263
  return empty( $params[ 'key' ] ) ?
264
- array() : $this->obj_to_utf8( $this->denorm_sel_ndx( $params[ 'key' ] ) );
265
  case 'rule_val':
266
  return empty( $params[ 'key' ] ) ? array() : $this->denorm_rule_val( $params[ 'key' ] );
267
  case 'val_qry':
268
- if ( isset( $params[ 'rule' ] ) && isset( $this->dict_rule[ $params[ 'rule' ] ] ) ):
269
  return empty( $params[ 'key' ] ) ?
270
  array() : $this->denorm_val_query( $params[ 'key' ], $params[ 'rule' ] );
271
  endif;
@@ -273,8 +306,12 @@ class ChildThemeConfiguratorCSS {
273
  return empty( $params[ 'key' ] ) ?
274
  array() : $this->obj_to_utf8( $this->denorm_sel_val( $params[ 'key' ] ) );
275
  case 'rules':
276
- ksort( $this->dict_rule );
277
- return $this->obj_to_utf8( $this->dict_rule );
 
 
 
 
278
  case 'child':
279
  return $this->child;
280
  case 'parnt':
@@ -307,6 +344,8 @@ class ChildThemeConfiguratorCSS {
307
  return empty( $this->csswphead ) ? 0 : 1;
308
  case 'cssnotheme':
309
  return empty( $this->cssnotheme ) ? 0 : 1;
 
 
310
  case 'handling':
311
  return empty( $this->handling ) ? 'primary' : $this->handling;
312
  case 'child_name':
@@ -418,7 +457,7 @@ class ChildThemeConfiguratorCSS {
418
  function get_css_imports() {
419
  $newheader = '';
420
  if ( 'import' == $this->get_prop( 'enqueue' ) ):
421
- $this->ctc()->debug( 'using import ', __FUNCTION__ );
422
  if ( ! $this->get_prop( 'ignoreparnt' ) )
423
  $newheader .= "@import url('../" . $this->get_prop( 'parnt' ) . "/style.css');" . LF;
424
  endif;
@@ -442,42 +481,63 @@ class ChildThemeConfiguratorCSS {
442
  * incrementing key value for dictionary
443
  */
444
  function get_dict_id( $dict, $value ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
445
  $property = 'dict_' . $dict;
446
- $key = $dict . 'key';
447
- if ( !isset( $this->{ $property }[ $value ] ) )
448
- // add value to index
449
- $this->{ $property }[ $value ] = ++$this->{ $key };
450
- return $this->{ $property }[ $value ];
451
  }
452
 
 
 
 
 
 
453
  /**
454
  * get_qsid
455
  * query/selector id is the combination of two dictionary values
456
  * also throttles parsing if memory limit is reached
457
  */
458
  function get_qsid( $query, $sel ) {
459
- $q = $this->get_dict_id( 'query', $query );
460
- $s = $this->get_dict_id( 'sel', $sel );
461
- if ( !isset( $this->sel_ndx[ $q ][ $s ] ) ):
462
- /**
463
- * Future use: stop parsing if limit is reached to prevent out of memory on serialize
464
- *
465
- if ( $this->qskey >= $this->ctc()->sel_limit ):
466
- $this->max_sel = 1;
467
- $this->ctc()->debug( 'Maximum num selectors reached ( limit: ' . $this->ctc()->sel_limit . ' )', __FUNCTION__ );
 
 
468
  return FALSE;
469
- endif;
470
- */
471
- // increment key number
472
- $this->sel_ndx[ $q ][ $s ] = ++$this->qskey;
473
- $this->dict_qs[ $this->qskey ][ 's' ] = $s;
474
- $this->dict_qs[ $this->qskey ][ 'q' ] = $q;
475
- // update sequence for this selector if this is a later instance to keep cascade priority
476
- if ( !isset( $this->dict_seq[ $this->qskey ] ) )
477
- $this->dict_seq[ $this->qskey ] = $this->qskey;
478
-
479
  endif;
480
- return $this->sel_ndx[ $q ][ $s ];
 
 
 
 
 
 
 
 
481
  }
482
 
483
  /**
@@ -486,7 +546,7 @@ class ChildThemeConfiguratorCSS {
486
  * CTC object arrays, creating update cache in the process.
487
  * ( Update cache is returned to UI via AJAX to refresh page )
488
  * This has been refactored in v1.7.5 to accommodate multiple values per property.
489
- * @param $template parnt or child
490
  * @param $query media query
491
  * @param $sel selector
492
  * @param $rule property (rule)
@@ -507,55 +567,68 @@ class ChildThemeConfiguratorCSS {
507
  $reset = FALSE
508
  ) {
509
  // if ( $this->max_sel ) return; // Future use
510
- if ( FALSE === strpos( $query, '@' ) ):
511
  $query = 'base';
512
- endif;
513
  // normalize selector styling
514
  $sel = implode( ', ', preg_split( '#\s*,\s*#s', trim( $sel ) ) );
515
- if ( !( $qsid = $this->get_qsid( $query, $sel ) ) ) return;
516
-
517
  // set data and value
518
  if ( $rule ):
519
  // get ids and quit if max is reached ( get_qsid handles )
520
  $ruleid = $this->get_dict_id( 'rule', $rule );
521
  $valid = $this->get_dict_id( 'val', $value );
522
-
523
  /**
524
- * v1.7.5
525
- * modify existing data sructure to allow multiple property values
526
  */
527
-
528
- // create empty array if reset is TRUE
529
- // OR IF ruleval array does not exist
530
- if ( $reset || !isset( $this->val_ndx[ $qsid ][ $ruleid ][ $template ] )
531
- || !is_array( $this->val_ndx[ $qsid ][ $ruleid ][ $template ] ) )
532
- $this->val_ndx[ $qsid ][ $ruleid ][ $template ] = array();
533
- $this->convert_ruleval_array( $this->val_ndx[ $qsid ][ $ruleid ] );
534
- // rulevalid passed
 
 
 
 
 
 
 
 
 
 
 
535
  if ( isset( $rulevalid ) ):
536
- $this->unset_rule_value( $this->val_ndx[ $qsid ][ $ruleid ][ $template ], $rulevalid );
537
  // value empty?
538
  if ( '' === $value ):
539
  // value exist?
540
- elseif ( $id = $this->rule_value_exists( $this->val_ndx[ $qsid ][ $ruleid ][ $template ], $valid ) ):
541
- $this->unset_rule_value( $this->val_ndx[ $qsid ][ $ruleid ][ $template ], $id );
542
- $this->update_rule_value( $this->val_ndx[ $qsid ][ $ruleid ][ $template ], $rulevalid, $valid, $important );
543
  // update new value
544
  else:
545
- $this->update_rule_value( $this->val_ndx[ $qsid ][ $ruleid ][ $template ], $rulevalid, $valid, $important );
546
  endif;
547
  // rulevalid not passed
548
  else:
549
  // value exist?
550
- if ( $id = $this->rule_value_exists( $this->val_ndx[ $qsid ][ $ruleid ][ $template ], $valid ) ):
551
- $this->unset_rule_value( $this->val_ndx[ $qsid ][ $ruleid ][ $template ], $id );
552
- $this->update_rule_value( $this->val_ndx[ $qsid ][ $ruleid ][ $template ], $id, $valid, $important );
553
  // get new id and update new value
554
  else:
555
- $id = $this->get_rule_value_id( $this->val_ndx[ $qsid ][ $ruleid ][ $template ] );
556
- $this->update_rule_value( $this->val_ndx[ $qsid ][ $ruleid ][ $template ], $id, $valid, $important );
557
  endif;
558
  endif;
 
 
 
 
 
559
  // return query selector id
560
  return $qsid;
561
  endif;
@@ -607,7 +680,6 @@ class ChildThemeConfiguratorCSS {
607
  $index = 0;
608
  foreach ( $arr as $valarr ):
609
  if ( $id == $valarr[ 2 ] ):
610
- //echo 'found ' . $valarr[ 2 ] . '(index ' . $index . " )\n";
611
  array_splice( $arr, $index, 1 );
612
  break;
613
  endif;
@@ -620,10 +692,10 @@ class ChildThemeConfiguratorCSS {
620
  * Automatically cleans up hierarchies when no values exist
621
  * in either parent or child for a given selector.
622
  */
623
- function prune_if_empty( $qsid ) {
624
  $empty = $this->get_dict_id( 'val', '' );
625
- foreach ( $this->val_ndx[ $qsid ] as $ruleid => $arr ):
626
- foreach ( array( 'child', 'parnt' ) as $template ):
627
  if ( isset( $arr[ $template ] ) ):
628
  // v1.7.5: don't prune until converted to multi value format
629
  if ( !is_array( $arr[ $template ] ) ) return FALSE;
@@ -634,10 +706,10 @@ class ChildThemeConfiguratorCSS {
634
  endforeach;
635
  endforeach;
636
  // no values, prune from sel index, val index and qs dict data ( keep other dictionary records )
637
- unset( $this->sel_ndx[ $this->dict_qs[ $qsid ][ 'q' ] ][ $this->dict_qs[ $qsid ][ 's' ] ] );
638
  unset( $this->val_ndx[ $qsid ] );
639
  unset( $this->dict_qs[ $qsid ] );
640
  unset( $this->dict_seq[ $qsid ] );
 
641
  }
642
 
643
  /**
@@ -682,6 +754,14 @@ class ChildThemeConfiguratorCSS {
682
  * FIXME - this function has grown too monolithic - refactor and componentize
683
  */
684
  function parse_post_data() {
 
 
 
 
 
 
 
 
685
  $this->cache_updates = TRUE;
686
  if ( isset( $_POST[ 'ctc_new_selectors' ] ) ):
687
  $this->styles = $this->parse_css_input( LF . $_POST[ 'ctc_new_selectors' ] );
@@ -733,7 +813,13 @@ class ChildThemeConfiguratorCSS {
733
  foreach ( preg_grep( '#^ctc_ovrd_child_seq_#', array_keys( $_POST ) ) as $post_key ):
734
  if ( preg_match( '#^ctc_ovrd_child_seq_(\d+)$#', $post_key, $matches ) ):
735
  $qsid = $matches[ 1 ];
736
- $this->dict_seq[ $qsid ] = intval( $_POST[ $post_key ] );
 
 
 
 
 
 
737
  endif;
738
  endforeach;
739
  $parts = array();
@@ -741,8 +827,8 @@ class ChildThemeConfiguratorCSS {
741
  if ( preg_match( '#^ctc_(ovrd|\d+)_child_([\w\-]+?)_(\d+?)_(\d+?)(_(.+))?$#', $post_key, $matches ) ):
742
  $valid = $matches[ 1 ];
743
  $rule = $matches[ 2 ];
744
- if ( NULL == $rule || !isset( $this->dict_rule[ $rule ] ) ) continue;
745
- $ruleid = $this->dict_rule[ $rule ];
746
  $qsid = $matches[ 3 ];
747
  $rulevalid = $matches[ 4 ];
748
  $value = $this->normalize_color( $this->sanitize( $this->parse_css_input( $_POST[ $post_key ] ) ) );
@@ -754,11 +840,12 @@ class ChildThemeConfiguratorCSS {
754
  $parts[ $qsid ][ $rule ][ 'values' ][ $rulevalid ][ 'important' ] = $important;
755
  $parts[ $qsid ][ $rule ][ 'query' ] = $selarr[ 'query' ];
756
  $parts[ $qsid ][ $rule ][ 'selector' ] = $selarr[ 'selector' ];
 
757
  else:
758
  if ( $newselector && $newselector != $selarr[ 'selector' ] ):
759
  // If this is a renamed selector, add new selector to array
760
  $newqsid = $this->update_arrays(
761
- 'child',
762
  $selarr[ 'query' ],
763
  $newselector,
764
  $rule,
@@ -768,7 +855,7 @@ class ChildThemeConfiguratorCSS {
768
  );
769
  // clear the original selector's new value:
770
  $this->update_arrays(
771
- 'child',
772
  $selarr[ 'query' ],
773
  $selarr[ 'selector' ],
774
  $rule,
@@ -776,11 +863,16 @@ class ChildThemeConfiguratorCSS {
776
  0,
777
  $rulevalid
778
  );
779
- $this->dict_seq[ $newqsid ] = $this->dict_seq[ $qsid ];
 
 
 
 
 
780
  else:
781
  // otherwise, just update with the new values:
782
  $this->update_arrays(
783
- 'child',
784
  $selarr[ 'query' ],
785
  $selarr[ 'selector' ],
786
  $rule,
@@ -835,10 +927,12 @@ class ChildThemeConfiguratorCSS {
835
  else:
836
  $value = '';
837
  endif;
 
 
838
  if ( $newselector && $newselector != $rule_arr[ 'selector' ] ):
839
  // If this is a renamed selector, add new selector to array
840
  $newqsid = $this->update_arrays(
841
- 'child',
842
  $rule_arr[ 'query' ],
843
  $newselector,
844
  $rule,
@@ -848,7 +942,7 @@ class ChildThemeConfiguratorCSS {
848
  );
849
  // clear the original selector's new value:
850
  $this->update_arrays(
851
- 'child',
852
  $rule_arr[ 'query' ],
853
  $rule_arr[ 'selector' ],
854
  $rule,
@@ -859,7 +953,7 @@ class ChildThemeConfiguratorCSS {
859
  else:
860
  // otherwise, just update with the new values:
861
  $this->update_arrays(
862
- 'child',
863
  $rule_arr[ 'query' ],
864
  $rule_arr[ 'selector' ],
865
  $rule,
@@ -871,14 +965,8 @@ class ChildThemeConfiguratorCSS {
871
  endforeach;
872
  endforeach;
873
  endforeach;
874
- // if this is a renamed selector, update sequence dict
875
- if ( $newqsid ):
876
- if ( !isset( $this->dict_seq[ $newqsid ] ) )
877
- $this->dict_seq[ $newqsid ] = $this->dict_seq[ $qsid ];
878
- endif;
879
- // remove if all values have been cleared
880
- $this->prune_if_empty( $qsid );
881
- $qsid = $newqsid ? $newqsid : $qsid;
882
  // return updated qsid to browser to update form
883
  if ( $this->ctc()->cache_updates ):
884
  $this->ctc()->updates[] = array(
@@ -905,7 +993,7 @@ class ChildThemeConfiguratorCSS {
905
 
906
  // strips non printables and potential commands
907
  function sanitize( $styles ) {
908
- return sanitize_text_field( preg_replace( '/[^[:print:]]|\{.*/', '', $styles ) );
909
  }
910
 
911
  // escapes octal values in input to allow for specific ascii strings in content rule
@@ -929,7 +1017,7 @@ class ChildThemeConfiguratorCSS {
929
  * Future use: have we run out of memory?
930
  *
931
  if ( $this->max_sel ):
932
- //$this->ctc()->debug( 'Insufficient memory to parse file.', __FUNCTION__ );
933
  return FALSE;
934
  endif;
935
  */
@@ -972,7 +1060,7 @@ class ChildThemeConfiguratorCSS {
972
  *
973
  if ( filesize( $stylesheet_verified ) * 3 > $this->ctc()->get_free_memory() ):
974
  $this->max_sel = 1;
975
- //$this->ctc()->debug( 'Insufficient memory to read file', __FUNCTION__ );
976
  return;
977
  endif;
978
  */
@@ -989,6 +1077,15 @@ class ChildThemeConfiguratorCSS {
989
  * FIXME - this function has grown too monolithic - refactor and componentize
990
  */
991
  function parse_css( $template, $basequery = NULL, $parse_imports = TRUE, $relpath = '', $reset = FALSE ) {
 
 
 
 
 
 
 
 
 
992
  if ( FALSE === strpos( $basequery, '@' ) ):
993
  $basequery = 'base';
994
  endif;
@@ -1043,7 +1140,7 @@ class ChildThemeConfiguratorCSS {
1043
  foreach( $matches[ 1 ] as $sel ):
1044
  $stuff = array_shift( $matches[ 2 ] );
1045
  $this->update_arrays(
1046
- $template,
1047
  $query,
1048
  $sel
1049
  );
@@ -1095,11 +1192,17 @@ class ChildThemeConfiguratorCSS {
1095
  $rule = preg_replace( '#(\-(o|ms|moz|webkit)\-)?(' . implode( '|', $this->vendorrule ) . ')#', "$3", $rule );
1096
  if ( 'parnt' == $template && 'background-image' == $rule && strstr( $value, 'url(' ) )
1097
  $value = $this->convert_rel_url( $value, $relpath );
1098
- // by default, set semaphore true to allow multiple values
 
 
 
 
 
 
1099
  if ( !$reset ) $resetrule[ $rule ] = TRUE;
1100
 
1101
  $qsid = $this->update_arrays(
1102
- $template,
1103
  $query,
1104
  $sel,
1105
  $rule,
@@ -1122,6 +1225,7 @@ class ChildThemeConfiguratorCSS {
1122
  );
1123
  do_action( 'chld_thm_cfg_update_qsid', $qsid );
1124
  endif;
 
1125
  }
1126
 
1127
  // converts relative path to absolute path for preview
@@ -1140,7 +1244,7 @@ class ChildThemeConfiguratorCSS {
1140
  $newvalue = ( $url ? 'url(' : '' )
1141
  . ( $fileparts ? trailingslashit( implode( '/', $fileparts ) ) : '' )
1142
  . implode( '/', $newparts ) . ( $url ? ')' : '' );
1143
- $this->ctc()->debug( 'converted ' . $value . ' to ' . $newvalue . ' with ' . $relpath, __FUNCTION__ );
1144
  return $newvalue;
1145
  }
1146
 
@@ -1153,33 +1257,28 @@ class ChildThemeConfiguratorCSS {
1153
  * FIXME - this function has grown too monolithic - refactor and componentize
1154
  */
1155
  function write_css() {
1156
- // turn the dictionaries into indexes (value => id into id => value):
1157
- $rulearr = array_flip( $this->dict_rule );
1158
- $valarr = array_flip( $this->dict_val );
1159
- $selarr = array_flip( $this->dict_sel );
1160
  $output = '';
1161
  foreach ( $this->sort_queries() as $query => $sort_order ):
1162
  $has_selector = 0;
1163
  $sel_output = '';
1164
- $selectors = $this->sel_ndx[ $this->dict_query[ $query ] ];
1165
  uasort( $selectors, array( $this, 'cmp_seq' ) );
1166
  if ( 'base' != $query ) $sel_output .= $query . ' {' . LF;
1167
  foreach ( $selectors as $selid => $qsid ):
1168
- if ( !empty( $this->val_ndx[ $qsid ] ) ):
1169
- $sel = $selarr[ $selid ];
1170
  $shorthand = array();
1171
  $rule_output = array();
1172
- foreach ( $this->val_ndx[ $qsid ] as $ruleid => $temparr ):
1173
  // normalize values for backward compatability
1174
- $this->convert_ruleval_array( $temparr );
1175
- if ( isset( $temparr[ 'child' ] ) &&
1176
- ( !isset( $temparr[ 'parnt' ] ) || $temparr[ 'parnt' ] != $temparr[ 'child' ] ) ):
1177
- foreach ( $temparr[ 'child' ] as $rulevalarr ):
1178
  $this->add_vendor_rules(
1179
  $rule_output,
1180
  $shorthand,
1181
- $rulearr[ $ruleid ],
1182
- $valarr[ $rulevalarr[ 0 ] ],
1183
  $rulevalarr[ 1 ],
1184
  $rulevalarr[ 2 ]
1185
  );
@@ -1215,7 +1314,7 @@ class ChildThemeConfiguratorCSS {
1215
  endforeach;
1216
  $output = $this->get_css_header_comment( $this->get_prop( 'handling' ) ) . LF . $output;
1217
  $stylesheet = $this->get_stylesheet_path();
1218
- $this->ctc()->debug( 'writing stylesheet: ' . $stylesheet, __FUNCTION__ );
1219
  //echo //print_r(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS), true) . LF;
1220
  if ( $stylesheet_verified = $this->is_file_ok( $stylesheet, 'write' ) ):
1221
  global $wp_filesystem; // this was initialized earlier;
@@ -1225,11 +1324,11 @@ class ChildThemeConfiguratorCSS {
1225
  // stylesheet must already exist and be writable by web server
1226
  if ( $this->ctc()->is_ajax && is_writable( $stylesheet_verified ) ):
1227
  if ( FALSE === @file_put_contents( $stylesheet_verified, $output ) ):
1228
- $this->ctc()->debug( 'Ajax write failed.', __FUNCTION__ );
1229
  return FALSE;
1230
  endif;
1231
  elseif ( FALSE === $wp_filesystem->put_contents( $this->ctc()->fspath( $stylesheet_verified ), $output, $mode ) ):
1232
- $this->ctc()->debug( 'Filesystem write failed.', __FUNCTION__ );
1233
  return FALSE;
1234
  endif;
1235
  return TRUE;
@@ -1240,7 +1339,6 @@ class ChildThemeConfiguratorCSS {
1240
  function stringify_rule_output( &$rule_output ) {
1241
  $output = '';
1242
  asort( $rule_output );
1243
- //print_r( $rule_output );
1244
  foreach ( $rule_output as $rule => $sortstr )
1245
  $output .= ' ' . $rule . ";\n";
1246
  return $output;
@@ -1254,21 +1352,20 @@ class ChildThemeConfiguratorCSS {
1254
  * encode_shorthand
1255
  * converts CTC long syntax into CSS shorthand
1256
  * v1.7.5 refactored for multiple values per property
1257
- * FIXME - somehow condense all these foreach loops?
1258
  */
1259
  function encode_shorthand( $shorthand, &$rule_output ) {
1260
- //if ( $shorthand ) print_r( $shorthand );
1261
  foreach ( $shorthand as $property => $sides ):
1262
- if ( isset( $sides[ 'top' ] ) ):
1263
  foreach ( $sides[ 'top' ] as $tval => $tarr ):
1264
- if ( isset( $sides[ 'right' ] ) ):
1265
  $currseq = $tarr[ 1 ];
1266
  foreach ( $sides[ 'right' ] as $rval => $rarr ):
1267
  // value must exist from side and priority must match all sides
1268
- if ( isset( $sides[ 'bottom' ] ) && $tarr[ 0 ] == $rarr[ 0 ] ):
1269
  if ( $rarr[ 1 ] > $currseq ) $currseq = $rarr[ 1 ];
1270
  foreach ( $sides[ 'bottom' ] as $bval => $barr ):
1271
- if ( isset( $sides[ 'left' ] ) && $tarr[ 0 ] == $barr[ 0 ] ):
1272
  // use highest sort sequence of all sides
1273
  if ( $barr[ 1 ] > $currseq ) $currseq = $barr[ 1 ];
1274
  foreach ( $sides[ 'left' ] as $lval => $larr ):
@@ -1500,10 +1597,38 @@ class ChildThemeConfiguratorCSS {
1500
  */
1501
  function encode_gradient( $value ) {
1502
  // don't try this at home, kids
1503
- $regex = '#gradient[^\)]*?\((((to )?(top|bottom|left|right)?( (top|bottom|left|right))?|\d+deg),)?([^\w\#\)]*[\'"]?(\#\w{3,8}|rgba?\([\d., ]+?\)|hsla?\([\d%., ]+?\)|[a-z]+)( [\d.]+%)?)([^\w\#\)]*[\'"]?(\#\w{3,8}|rgba?\([\d., ]+?\)|hsla?\([\d%., ]+?\)|[a-z]+)( [\d.]+%)?)([^\w\)]*gradienttype=[\'"]?(\d)[\'"]?)?[^\w\)]*\)#i';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1504
  $param = $parts = array();
1505
  preg_match( $regex, $value, $parts );
1506
- if ( empty( $parts[ 14 ] ) ):
 
1507
  if ( empty( $parts[ 2 ] ) ):
1508
  $param[ 0 ] = 'top';
1509
  elseif ( 'to ' == $parts[ 3 ] ):
@@ -1515,28 +1640,28 @@ class ChildThemeConfiguratorCSS {
1515
  else:
1516
  $param[ 0 ] = trim( $parts[ 2 ] );
1517
  endif;
1518
- if ( empty( $parts[ 9 ] ) ):
1519
  $param[ 2 ] = '0%';
1520
  else:
1521
- $param[ 2 ] = trim( $parts[ 9 ] );
1522
  endif;
1523
- if ( empty( $parts[ 12 ] ) ):
1524
  $param[ 4 ] = '100%';
1525
  else:
1526
- $param[ 4 ] = trim( $parts[ 12 ] );
1527
  endif;
1528
- elseif( '0' == $parts[ 14 ] ):
1529
  $param[ 0 ] = 'top';
1530
  $param[ 2 ] = '0%';
1531
  $param[ 4 ] = '100%';
1532
- elseif ( '1' == $parts[ 14 ] ):
1533
  $param[ 0 ] = 'left';
1534
  $param[ 2 ] = '0%';
1535
  $param[ 4 ] = '100%';
1536
  endif;
1537
- if ( isset( $parts[ 8 ] ) && isset( $parts[ 11 ] ) ):
1538
- $param[ 1 ] = $parts[ 8 ];
1539
- $param[ 3 ] = $parts[ 11 ];
1540
  ksort( $param );
1541
  return implode( ':', $param );
1542
  else:
@@ -1585,18 +1710,20 @@ class ChildThemeConfiguratorCSS {
1585
  * FIXME: only return child if no original value exists
1586
  */
1587
  function denorm_rule_val( $ruleid ) {
 
 
1588
  $rule_sel_arr = array();
1589
- $val_arr = array_flip( $this->dict_val );
1590
- foreach ( $this->val_ndx as $qsid => $rules ):
1591
- if ( !isset( $rules[ $ruleid ] ) ) continue;
1592
- $this->convert_ruleval_array( $rules[ $ruleid ] );
1593
- foreach ( array( 'parnt', 'child' ) as $template ):
1594
- if ( isset( $rules[ $ruleid ][ $template ] ) ):
1595
- foreach ( $rules[ $ruleid ][ $template ] as $rulevalarr ):
1596
- $rule_sel_arr[ $rulevalarr[ 0 ] ] = $val_arr[ $rulevalarr[ 0 ] ];
1597
- endforeach;
1598
- endif;
1599
- endforeach;
1600
  endforeach;
1601
  return $rule_sel_arr;
1602
  }
@@ -1608,23 +1735,26 @@ class ChildThemeConfiguratorCSS {
1608
  * FIXME: only return new values corresponding to specific rulevalid of matching original value
1609
  */
1610
  function denorm_val_query( $valid, $rule ) {
 
 
1611
  $value_query_arr = array();
1612
- if( $thisruleid = $this->get_dict_id( 'rule', $rule ) ):
1613
- foreach ( $this->val_ndx as $qsid => $rules ):
1614
- foreach ( $rules as $ruleid => $values ):
1615
- if ( $ruleid != $thisruleid ) continue;
1616
- $this->convert_ruleval_array( $values );
1617
- foreach ( array( 'parnt', 'child' ) as $template ):
1618
- if ( isset( $values[ $template ] ) ):
1619
- foreach ( $values[ $template ] as $rulevalarr ):
1620
- if ( $rulevalarr[ 0 ] != $valid ) continue;
1621
- $selarr = $this->denorm_query_sel( $qsid );
1622
- $value_query_arr[ $rule ][ $selarr[ 'query' ] ][ $qsid ] = $this->denorm_sel_val( $qsid );
 
 
1623
  endforeach;
1624
- endif;
1625
- endforeach;
1626
  endforeach;
1627
- endforeach;
1628
  endif;
1629
  return $value_query_arr;
1630
  }
@@ -1634,16 +1764,29 @@ class ChildThemeConfiguratorCSS {
1634
  * Return id, query and selector values of a specific qsid (query-selector ID)
1635
  */
1636
  function denorm_query_sel( $qsid ) {
1637
- if ( !isset( $this->dict_qs[ $qsid ] ) ) return array();
1638
- $queryarr = array_flip( $this->dict_query );
1639
- $selarr = array_flip( $this->dict_sel );
1640
- $this->dict_seq[ $qsid ] = isset( $this->dict_seq[ $qsid ] ) ? $this->dict_seq[ $qsid ] : $qsid;
1641
- return array(
 
 
 
 
 
 
 
 
 
 
 
 
1642
  'id' => $qsid,
1643
- 'query' => $queryarr[ $this->dict_qs[ $qsid ][ 'q' ] ],
1644
- 'selector' => $selarr[ $this->dict_qs[ $qsid ][ 's' ] ],
1645
- 'seq' => $this->dict_seq[ $qsid ],
1646
  );
 
1647
  }
1648
 
1649
  /**
@@ -1652,18 +1795,21 @@ class ChildThemeConfiguratorCSS {
1652
  * grouped by query, selector
1653
  */
1654
  function denorm_sel_val( $qsid ) {
 
 
 
1655
  $selarr = $this->denorm_query_sel( $qsid );
1656
- $valarr = array_flip( $this->dict_val );
1657
- $rulearr = array_flip( $this->dict_rule );
1658
- if ( isset( $this->val_ndx[ $qsid ] ) && is_array( $this->val_ndx[ $qsid ] ) ):
1659
- foreach ( $this->val_ndx[ $qsid ] as $ruleid => $values ):
1660
- // convert old value to new format
1661
- $this->convert_ruleval_array( $values );
1662
- foreach ( array( 'parnt', 'child' ) as $template ):
1663
  if ( isset( $values[ $template ] ) ):
1664
  foreach ( $values[ $template ] as $rulevalarr ):
1665
- $selarr[ 'value' ][ $rulearr[ $ruleid ] ][ $template ][] = array(
1666
- $valarr[ $rulevalarr[ 0 ] ],
1667
  $rulevalarr[ 1 ],
1668
  isset( $rulevalarr[ 2 ] ) ? $rulevalarr[ 2 ] : 1,
1669
  );
@@ -1672,18 +1818,23 @@ class ChildThemeConfiguratorCSS {
1672
  endforeach;
1673
  endforeach;
1674
  endif;
 
1675
  return $selarr;
1676
  }
1677
 
1678
  /**
 
 
1679
  * convert and/or normalize rule/value index
1680
  * to support multiple values per property ( rule )
1681
  * allows backward compatility with < v1.7.5
1682
  */
1683
  function convert_ruleval_array( &$arr ) {
 
1684
  foreach ( array( 'parnt', 'child' ) as $template ):
1685
  // skip if empty array
1686
  if ( !isset( $arr[ $template ] ) ) continue;
 
1687
  // check if using original data structure ( value is scalar )
1688
  if ( ! is_array( $arr[ $template ] ) ):
1689
  /**
@@ -1693,9 +1844,15 @@ class ChildThemeConfiguratorCSS {
1693
  * [1] => important
1694
  * [2] => priority
1695
  */
1696
- $temparr = array( array( $arr[ $template ], $arr[ 'i_' . $template ], 0, 1 ) );
1697
- $arr[ $template ] = $temparr;
 
1698
  endif;
 
 
 
 
 
1699
  $newarr = array();
1700
  // iterate each value and enforce array structure
1701
  foreach ( $arr[ $template ] as $rulevalid => $rulevalarr ):
@@ -1703,7 +1860,7 @@ class ChildThemeConfiguratorCSS {
1703
  if ( empty ( $rulevalarr ) ) continue;
1704
  //
1705
  if ( ! is_array( $rulevalarr ) ):
1706
- // important flag moves to individual value array
1707
  $important = isset( $arr[ 'i_' . $template ] ) ? $arr[ 'i_' . $template ] : 0;
1708
  unset( $arr[ 'i_' . $template ] );
1709
  $val = (int) $rulevalarr;
@@ -1715,22 +1872,78 @@ class ChildThemeConfiguratorCSS {
1715
  endforeach;
1716
  $arr[ $template ] = $newarr;
1717
  endforeach;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1718
  }
1719
 
1720
  /**
1721
- * denorm_sel_ndx
1722
  * Return denormalized array containing query and selector heirarchy
1723
  */
1724
- function denorm_sel_ndx( $query = NULL ) {
1725
- $sel_ndx_norm = array();
1726
- $queryarr = array_flip( $this->dict_query );
1727
- $selarr = array_flip( $this->dict_sel );
1728
- foreach( $this->sel_ndx as $queryid => $sel ):
1729
- foreach( $sel as $selid => $qsid ):
1730
- $sel_ndx_norm[ $queryarr[ $queryid ] ][ $selarr[ $selid ] ] = $qsid;
 
 
 
 
 
 
 
 
1731
  endforeach;
1732
- endforeach;
1733
- return empty( $query ) ? array_keys( $sel_ndx_norm ) : $this->sort_selectors( $sel_ndx_norm[ $query ] );
 
 
 
 
1734
  }
1735
 
1736
  /**
@@ -1753,10 +1966,10 @@ class ChildThemeConfiguratorCSS {
1753
  * @media min-width queries in ascending order
1754
  */
1755
  function sort_queries() {
 
1756
  $queries = array();
1757
- $queryarr = array_flip( $this->dict_query );
1758
- foreach ( array_keys( $this->sel_ndx ) as $queryid ):
1759
- $query = $queryarr[ $queryid ];
1760
  if ( 'base' == $query ):
1761
  $queries[ 'base' ] = -999999;
1762
  continue;
@@ -1772,8 +1985,9 @@ class ChildThemeConfiguratorCSS {
1772
  }
1773
 
1774
  function sort_selectors( $selarr ) {
1775
- uksort( $selarr, array( $this, 'cmp_sel' ) );
1776
- return $selarr;
 
1777
  }
1778
 
1779
  function cmp_sel( $a, $b ) {
@@ -1785,8 +1999,10 @@ class ChildThemeConfiguratorCSS {
1785
 
1786
  // sort selectors based on dict_seq if exists, otherwise qsid
1787
  function cmp_seq( $a, $b ) {
1788
- $cmpa = isset( $this->dict_seq[ $a ] ) ? $this->dict_seq[ $a ] : $a;
1789
- $cmpb = isset( $this->dict_seq[ $b ] ) ? $this->dict_seq[ $b ] : $b;
 
 
1790
  if ( $cmpa == $cmpb ) return 0;
1791
  return ( $cmpa < $cmpb ) ? -1 : 1;
1792
  }
@@ -1824,32 +2040,32 @@ class ChildThemeConfiguratorCSS {
1824
  function is_file_ok( $stylesheet, $permission = 'read' ) {
1825
  // remove any ../ manipulations
1826
  $stylesheet = $this->ctc()->normalize_path( preg_replace( "%\.\./%", '/', $stylesheet ) );
1827
- $this->ctc()->debug( 'checking file: ' . $stylesheet, __FUNCTION__ );
1828
  if ( 'read' == $permission && !is_file( $stylesheet ) ):
1829
- $this->ctc()->debug( 'read: no file!', __FUNCTION__ );
1830
  return FALSE;
1831
  elseif ( 'write' == $permission && !is_dir( dirname( $stylesheet ) ) ):
1832
- $this->ctc()->debug( 'write: no dir!', __FUNCTION__ );
1833
  return FALSE;
1834
  elseif ( 'search' == $permission && !is_dir( $stylesheet ) ):
1835
- $this->ctc()->debug( 'search: no dir!', __FUNCTION__ );
1836
  return FALSE;
1837
  endif;
1838
  // check if in themes dir;
1839
  $regex = '%^' . preg_quote( $this->ctc()->normalize_path( get_theme_root() ) ) . '%';
1840
- $this->ctc()->debug( 'theme regex: ' . $regex, __FUNCTION__ );
1841
  if ( preg_match( $regex, $stylesheet ) ):
1842
- $this->ctc()->debug( $stylesheet . ' ok!', __FUNCTION__ );
1843
  return $stylesheet;
1844
  endif;
1845
  // check if in plugins dir
1846
  $regex = '%^' . preg_quote( $this->ctc()->normalize_path( WP_PLUGIN_DIR ) ) . '%';
1847
- $this->ctc()->debug( 'plugin regex: ' . $regex, __FUNCTION__ );
1848
  if ( preg_match( $regex, $stylesheet ) ):
1849
- $this->ctc()->debug( $stylesheet . ' ok!', __FUNCTION__ );
1850
  return $stylesheet;
1851
  endif;
1852
- $this->ctc()->debug( $stylesheet . ' is not in wp folders!', __FUNCTION__ );
1853
  return FALSE;
1854
  }
1855
 
@@ -1879,4 +2095,58 @@ class ChildThemeConfiguratorCSS {
1879
  function tolower( $matches ) {
1880
  return '#' . strtolower( $matches[ 1 ] );
1881
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1882
  }
6
  Class: ChildThemeConfiguratorCSS
7
  Plugin URI: http://www.childthemeconfigurator.com/
8
  Description: Handles all CSS input, output, parsing, normalization and storage
9
+ Version: 2.1.0
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
14
  License: GPLv2
15
  Copyright (C) 2014-2016 Lilaea Media
16
  */
17
+
18
  class ChildThemeConfiguratorCSS {
19
 
20
  // data dictionaries
24
  var $dict_rule; // css rules
25
  var $dict_val; // css values
26
  var $dict_seq; // child load order (priority)
27
+ var $dict_token;
28
  // hierarchies
 
29
  var $val_ndx; // selector => rule => value hierarchy
30
  // key counters
31
  var $qskey; // counter for dict_qs
33
  var $selkey; // counter for dict_sel
34
  var $rulekey; // counter for dict_rule
35
  var $valkey; // counter for dict_val
36
+ var $tokenkey; // counter for dict_token
37
 
38
  // from parent/child form
39
  var $child; // child theme slug
52
  var $cssunreg;
53
  var $csswphead;
54
  var $cssnotheme;
55
+ var $reorder;
56
 
57
  // header settings
58
  var $child_name; // child theme name
66
  // miscellaneous properties
67
  var $fsize; // used to check if styles changed since last update
68
  var $converted; // @imports coverted to <link>?
69
+ var $version; // version of last saved data
70
  var $templates; // cache of parent template files
71
  var $imports; // @import rules
72
  var $recent; // history of edited styles
73
  var $max_sel;
74
+ var $memory;
75
  var $styles; // temporary update cache
76
  var $temparray;
77
+ var $instances = array();
78
+ var $vendorrule = array(
79
  'box\-sizing',
80
  'font\-smoothing',
81
  'border(\-(top|right|bottom|left))*\-radius',
96
  'cssunreg',
97
  'csswphead',
98
  'cssnotheme',
99
+ 'reorder',
100
  'parnt_deps',
101
  'child_deps',
102
  'hasstyles',
124
  'qskey',
125
  'selkey',
126
  'querykey',
127
+ 'tokenkey',
128
  'recent',
129
  'converted',
130
  'fsize',
131
+ 'version',
132
  );
133
  var $dicts = array(
134
+ 'dict_qs' => 0,
135
+ 'dict_sel' => 0,
136
+ 'dict_query' => 0,
137
+ 'dict_rule' => 0,
138
+ 'dict_val' => 0,
139
+ 'dict_seq' => 0,
140
+ 'dict_token' => 0,
141
+ 'val_ndx' => 0,
142
  );
143
+ var $packer; // packer object
144
 
145
  function __construct() {
146
+ $this->mem_chk();
147
  // scalars
148
  $this->querykey = 0;
149
  $this->selkey = 0;
165
  $this->parnt = '';
166
  $this->ignoreparnt = 0;
167
  $this->qpriority = 10;
168
+ $this->version = '2.1.0';
169
 
170
  // do not set enqueue, not being set is used to flag old versions
171
 
174
  $this->imports = array( 'child' => array(), 'parnt' => array() );
175
 
176
  $this->recent = array();
177
+ include_once( CHLD_THM_CFG_DIR . '/includes/class-ctc-packer.php' );
178
+ $this->packer = new ChildThemeConfiguratorPacker();
 
 
 
 
 
 
 
179
  }
180
 
181
  // helper function to globalize ctc object
182
  function ctc() {
183
  return ChildThemeConfigurator::ctc();
184
  }
185
+ function mem_chk() {
186
+ $currmemory = $this->memory;
187
+ if ( function_exists( 'memory_get_peak_usage' ) ) {
188
+ $usage = memory_get_peak_usage();
189
+ } else {
190
+ $usage = memory_get_usage();
191
+ }
192
+ $this->memory = $usage;
193
+ $usage -= $currmemory;
194
+ return number_format( $this->memory / ( 1024 * 1024 ), 2 ) . ' MB diff ' . number_format( $usage / 1024, 2 ) . ' kB';
195
+ }
196
+ // loads current ctc config data
197
+ function load_config( $key = NULL ) {
198
+ //list(, $callerarr) = debug_backtrace(false);
199
+ //$caller = ( isset( $callerarr[ 'class' ] ) ? $callerarr[ 'class' ] . '::' : '' ) . $callerarr[ 'function' ];
200
+ if ( $key && isset( $this->dicts[ $key ] ) ):
201
+ $option = CHLD_THM_CFG_OPTIONS . apply_filters( 'chld_thm_cfg_option', '' );
202
+ if ( !$this->dicts[ $key ] ): // dict not loaded yet
203
+ //$this->ctc()->debug( 'memory before load: ' . $this->mem_chk(), __FUNCTION__, __CLASS__ );
204
+ //$this->ctc()->debug( $option . '_' . $key . ' -- called from ' . $caller, __FUNCTION__, __CLASS__ );
205
+ $this->{ $key } = $this->ctc()->is_new ? array() : get_site_option( $option . '_' . $key );
206
+ $this->dicts[ $key ] = 1; // flag as loaded
207
+ //$this->ctc()->debug( 'memory after load: ' . $this->mem_chk(), __FUNCTION__, __CLASS__ );
208
+ else:
209
+ //$this->ctc()->debug( $key . ' already loaded -- called from ' . $caller, __FUNCTION__, __CLASS__ );
210
+ endif;
211
+ endif;
212
+ if ( empty( $key ) && !isset( $this->enqueue ) ):
213
+ $option = CHLD_THM_CFG_OPTIONS . apply_filters( 'chld_thm_cfg_option', '' );
214
+ //$this->ctc()->debug( 'loading option: ' . $option . '_' . ( $key ? $key : 'configvars' )
215
+ // . ' -- called from ' . $caller, __FUNCTION__, __CLASS__ );
216
+ if ( ( $configarray = get_site_option( $option . '_configvars' ) ) && count( $configarray ) ):
217
+ foreach ( $this->configvars as $configkey ):
218
+ if ( isset( $configarray[ $configkey ] ) )
219
+ $this->{$configkey} = $configarray[ $configkey ];
220
+ endforeach;
221
+ // convert dictionaries from < 2.1.0
222
+ if ( empty( $configarray[ 'version' ] ) || version_compare( $configarray[ 'version' ], '2.1.0', '<' ) ):
223
+ $this->convert_dict_arrays();
224
+ else:
225
+ $this->ctc()->debug( 'dict format up to date', __FUNCTION__, __CLASS__ );
226
  endif;
227
+ endif;
 
 
228
  endif;
229
+
230
  }
231
 
232
  // writes ctc config data to options api
237
  if ( isset( $override ) ) $option = $override;
238
  else $option = apply_filters( 'chld_thm_cfg_option', '' );
239
  $option = CHLD_THM_CFG_OPTIONS . $option;
 
240
  $configarray = array();
241
  foreach ( $this->configvars as $configkey )
242
  $configarray[ $configkey ] = empty( $this->{$configkey} ) ? NULL : $this->{ $configkey };
243
+ //$this->ctc()->debug( 'saving option: ' . $option . '_configvars', __FUNCTION__, __CLASS__ );
244
  if ( is_multisite() ):
245
  update_site_option( $option . '_configvars', $configarray );
246
  else:
247
  // do not autoload ( passing false above only works if value changes
248
  update_option( $option . '_configvars', $configarray, FALSE );
249
  endif;
250
+
251
+ foreach ( $this->dicts as $configkey => $loaded ):
252
+ if ( $loaded ): // only save if dict is loaded
253
+ //$this->ctc()->debug( 'saving option: ' . $option . '_' . $configkey, __FUNCTION__, __CLASS__ );
254
+ if ( is_multisite() ):
255
+ update_site_option( $option . '_' . $configkey, $this->{$configkey} );
256
+ else:
257
+ // do not autoload ( passing false for update_site_option only works if value changes )
258
+ update_option( $option . '_' . $configkey, $this->{$configkey}, FALSE );
259
+ endif;
260
  endif;
261
  endforeach;
262
+
263
  }
264
 
265
  /**
268
  function get_stylesheet_path() {
269
  $stylesheet = apply_filters( 'chld_thm_cfg_target', $this->get_child_target( $this->ctc()->get_child_stylesheet() ), $this );
270
  $this->fsize = filesize( $stylesheet );
271
+ $this->ctc()->debug( 'updated file size: ' . $this->fsize, __FUNCTION__, __CLASS__ );
272
  return $stylesheet;
273
  }
274
  /**
291
  array_keys( array_flip( $this->imports[ 'child' ] ) ) ) :
292
  array() );
293
  case 'queries':
294
+ return $this->obj_to_utf8( $this->denorm_dict_qs() );
295
  case 'selectors':
296
  return empty( $params[ 'key' ] ) ?
297
+ array() : $this->obj_to_utf8( $this->denorm_dict_qs( $params[ 'key' ] ) );
298
  case 'rule_val':
299
  return empty( $params[ 'key' ] ) ? array() : $this->denorm_rule_val( $params[ 'key' ] );
300
  case 'val_qry':
301
+ if ( isset( $params[ 'rule' ] ) ):
302
  return empty( $params[ 'key' ] ) ?
303
  array() : $this->denorm_val_query( $params[ 'key' ], $params[ 'rule' ] );
304
  endif;
306
  return empty( $params[ 'key' ] ) ?
307
  array() : $this->obj_to_utf8( $this->denorm_sel_val( $params[ 'key' ] ) );
308
  case 'rules':
309
+ $this->load_config( 'dict_rule' );
310
+ asort( $this->dict_rule );
311
+ //ksort( $this->dict_rule );
312
+ //return $this->obj_to_utf8( $this->dict_rule );
313
+ /** lookup ** -- need to flip array??? */
314
+ return $this->obj_to_utf8( array_flip( $this->dict_rule ) );
315
  case 'child':
316
  return $this->child;
317
  case 'parnt':
344
  return empty( $this->csswphead ) ? 0 : 1;
345
  case 'cssnotheme':
346
  return empty( $this->cssnotheme ) ? 0 : 1;
347
+ case 'reorder':
348
+ return empty( $this->reorder ) ? 0 : 1;
349
  case 'handling':
350
  return empty( $this->handling ) ? 'primary' : $this->handling;
351
  case 'child_name':
457
  function get_css_imports() {
458
  $newheader = '';
459
  if ( 'import' == $this->get_prop( 'enqueue' ) ):
460
+ $this->ctc()->debug( 'using import ', __FUNCTION__, __CLASS__ );
461
  if ( ! $this->get_prop( 'ignoreparnt' ) )
462
  $newheader .= "@import url('../" . $this->get_prop( 'parnt' ) . "/style.css');" . LF;
463
  endif;
481
  * incrementing key value for dictionary
482
  */
483
  function get_dict_id( $dict, $value ) {
484
+ if ( FALSE === ( $id = $this->lookup_dict_value( $dict, $value ) ) ):
485
+ // add value to dictionary
486
+ $id = ++$this->{ $dict . 'key' };
487
+ $this->set_dict_value( $dict, $value, $id );
488
+ endif;
489
+ return $id;
490
+ }
491
+
492
+ function lookup_dict_value( $dict, $value ){
493
+ //$this->ctc()->debug( 'dict: ' . $dict . ' value: %' . $value . '%', __FUNCTION__, __CLASS__ );
494
+ $property = 'dict_' . $dict;
495
+ if ( $id = array_search( (string) $value, $this->{ $property } ) )
496
+ return $id;
497
+ return FALSE;
498
+ }
499
+
500
+ function get_dict_value( $dict, $id ) {
501
  $property = 'dict_' . $dict;
502
+ return ( isset( $this->{ $property }[ $id ] ) )
503
+ ? $this->{ $property }[ $id ]
504
+ : FALSE;
 
 
505
  }
506
 
507
+ function set_dict_value( $dict, $value, $id ) {
508
+ $property = 'dict_' . $dict;
509
+ $this->{ $property }[ $id ] = ( string ) $value;
510
+ }
511
+
512
  /**
513
  * get_qsid
514
  * query/selector id is the combination of two dictionary values
515
  * also throttles parsing if memory limit is reached
516
  */
517
  function get_qsid( $query, $sel ) {
518
+ $qs = $this->get_dict_id( 'query', $query ) . ':' . $this->get_dict_id( 'sel', $sel );
519
+ return $this->get_dict_id( 'qs', $qs );
520
+ }
521
+
522
+ function unpack_val_ndx( $qsid ){
523
+ if ( isset( $this->val_ndx[ $qsid ] ) ):
524
+ try {
525
+ $this->packer->reset( $this->packer->decode( $this->val_ndx[ $qsid ] ) );
526
+ return $this->packer->unpack();
527
+ } catch ( Exception $e ){
528
+ $this->ctc()->errors[] = 'Unpack failed -- ' . $e->getMessage();
529
  return FALSE;
530
+ }
 
 
 
 
 
 
 
 
 
531
  endif;
532
+ return FALSE;
533
+ }
534
+
535
+ function pack_val_ndx( $qsid, $valarr ){
536
+ try {
537
+ $this->val_ndx[ $qsid ] = $this->packer->encode( $this->packer->pack( $valarr ) );
538
+ } catch ( Exception $e ){
539
+ $this->ctc()->errors[] = 'Pack failed -- ' . $e->getMessage();
540
+ }
541
  }
542
 
543
  /**
546
  * CTC object arrays, creating update cache in the process.
547
  * ( Update cache is returned to UI via AJAX to refresh page )
548
  * This has been refactored in v1.7.5 to accommodate multiple values per property.
549
+ * @param $template p or c
550
  * @param $query media query
551
  * @param $sel selector
552
  * @param $rule property (rule)
567
  $reset = FALSE
568
  ) {
569
  // if ( $this->max_sel ) return; // Future use
570
+ if ( FALSE === strpos( $query, '@' ) )
571
  $query = 'base';
 
572
  // normalize selector styling
573
  $sel = implode( ', ', preg_split( '#\s*,\s*#s', trim( $sel ) ) );
574
+ $qsid = $this->get_qsid( $query, $this->tokenize( $sel ) );
 
575
  // set data and value
576
  if ( $rule ):
577
  // get ids and quit if max is reached ( get_qsid handles )
578
  $ruleid = $this->get_dict_id( 'rule', $rule );
579
  $valid = $this->get_dict_id( 'val', $value );
 
580
  /**
581
+ * v2.1.0
582
+ * pack/unpack val_ndx
583
  */
584
+ // create empty array IF value array does not exist
585
+ if ( FALSE === ( $valarr = $this->unpack_val_ndx( $qsid ) ) )
586
+ $valarr = array(
587
+ $ruleid => array(
588
+ $template => array(),
589
+ ),
590
+ );
591
+ // create empty array IF rule array does not exist
592
+ if ( !isset( $valarr[ $ruleid ] ) )
593
+ $valarr[ $ruleid ] = array(
594
+ $template => array(),
595
+ );
596
+ // create empty rule array if template is child and reset is TRUE
597
+ // or IF template array does not exist
598
+ if ( ( $reset && 'child' == $template ) || !isset( $valarr[ $ruleid ][ $template ] ) )
599
+ $valarr[ $ruleid ][ $template ] = array();
600
+
601
+ // rulevalid passed
602
+ //$this->ctc()->debug( 'rule: ' . $rule . ' ' . $ruleid . ' value: ' . ( '' == $value? 'NULL' : '%' . $value . '%' ) . ' ' . ( FALSE == $valid ? 'FALSE' : $valid ) . ' valarr: ' . print_r( $valarr, TRUE ), __FUNCTION__, __CLASS__ );
603
  if ( isset( $rulevalid ) ):
604
+ $this->unset_rule_value( $valarr[ $ruleid ][ $template ], $rulevalid );
605
  // value empty?
606
  if ( '' === $value ):
607
  // value exist?
608
+ elseif ( $id = $this->rule_value_exists( $valarr[ $ruleid ][ $template ], $valid ) ):
609
+ $this->unset_rule_value( $valarr[ $ruleid ][ $template ], $id );
610
+ $this->update_rule_value( $valarr[ $ruleid ][ $template ], $rulevalid, $valid, $important );
611
  // update new value
612
  else:
613
+ $this->update_rule_value( $valarr[ $ruleid ][ $template ], $rulevalid, $valid, $important );
614
  endif;
615
  // rulevalid not passed
616
  else:
617
  // value exist?
618
+ if ( $id = $this->rule_value_exists( $valarr[ $ruleid ][ $template ], $valid ) ):
619
+ $this->unset_rule_value( $valarr[ $ruleid ][ $template ], $id );
620
+ $this->update_rule_value( $valarr[ $ruleid ][ $template ], $id, $valid, $important );
621
  // get new id and update new value
622
  else:
623
+ $id = $this->get_rule_value_id( $valarr[ $ruleid ][ $template ] );
624
+ $this->update_rule_value( $valarr[ $ruleid ][ $template ], $id, $valid, $important );
625
  endif;
626
  endif;
627
+ // remove if all values have been cleared
628
+ if ( $this->prune_if_empty( $qsid, $valarr ) )
629
+ return FALSE;
630
+ //$this->ctc()->debug( 'revised valarr: ' . print_r( $valarr, TRUE ), __FUNCTION__, __CLASS__ );
631
+ $this->pack_val_ndx( $qsid, $valarr );
632
  // return query selector id
633
  return $qsid;
634
  endif;
680
  $index = 0;
681
  foreach ( $arr as $valarr ):
682
  if ( $id == $valarr[ 2 ] ):
 
683
  array_splice( $arr, $index, 1 );
684
  break;
685
  endif;
692
  * Automatically cleans up hierarchies when no values exist
693
  * in either parent or child for a given selector.
694
  */
695
+ function prune_if_empty( $qsid, $valarr ) {
696
  $empty = $this->get_dict_id( 'val', '' );
697
+ foreach ( $valarr as $ruleid => $arr ):
698
+ foreach ( array( 'c', 'p' ) as $template ):
699
  if ( isset( $arr[ $template ] ) ):
700
  // v1.7.5: don't prune until converted to multi value format
701
  if ( !is_array( $arr[ $template ] ) ) return FALSE;
706
  endforeach;
707
  endforeach;
708
  // no values, prune from sel index, val index and qs dict data ( keep other dictionary records )
 
709
  unset( $this->val_ndx[ $qsid ] );
710
  unset( $this->dict_qs[ $qsid ] );
711
  unset( $this->dict_seq[ $qsid ] );
712
+ return TRUE;
713
  }
714
 
715
  /**
754
  * FIXME - this function has grown too monolithic - refactor and componentize
755
  */
756
  function parse_post_data() {
757
+ $this->load_config( 'dict_query' );
758
+ $this->load_config( 'dict_sel' );
759
+ $this->load_config( 'dict_token' );
760
+ $this->load_config( 'dict_rule' );
761
+ $this->load_config( 'dict_val' );
762
+ $this->load_config( 'val_ndx' );
763
+ $this->load_config( 'dict_seq' );
764
+ $this->load_config( 'dict_qs' );
765
  $this->cache_updates = TRUE;
766
  if ( isset( $_POST[ 'ctc_new_selectors' ] ) ):
767
  $this->styles = $this->parse_css_input( LF . $_POST[ 'ctc_new_selectors' ] );
813
  foreach ( preg_grep( '#^ctc_ovrd_child_seq_#', array_keys( $_POST ) ) as $post_key ):
814
  if ( preg_match( '#^ctc_ovrd_child_seq_(\d+)$#', $post_key, $matches ) ):
815
  $qsid = $matches[ 1 ];
816
+ $seq = intval( $_POST[ $post_key ] );
817
+ $this->ctc()->debug( 'set seq( ' . $qsid . ' ): custom: ' . $seq, __FUNCTION__, __CLASS__ );
818
+ if ( $seq != $qsid ):
819
+ $this->set_dict_value( 'seq', $seq, $qsid );
820
+ else:
821
+ unset( $this->dict_seq[ $seq ] );
822
+ endif;
823
  endif;
824
  endforeach;
825
  $parts = array();
827
  if ( preg_match( '#^ctc_(ovrd|\d+)_child_([\w\-]+?)_(\d+?)_(\d+?)(_(.+))?$#', $post_key, $matches ) ):
828
  $valid = $matches[ 1 ];
829
  $rule = $matches[ 2 ];
830
+ if ( NULL == $rule || FALSE === $this->lookup_dict_value( 'rule', $rule ) )
831
+ continue;
832
  $qsid = $matches[ 3 ];
833
  $rulevalid = $matches[ 4 ];
834
  $value = $this->normalize_color( $this->sanitize( $this->parse_css_input( $_POST[ $post_key ] ) ) );
840
  $parts[ $qsid ][ $rule ][ 'values' ][ $rulevalid ][ 'important' ] = $important;
841
  $parts[ $qsid ][ $rule ][ 'query' ] = $selarr[ 'query' ];
842
  $parts[ $qsid ][ $rule ][ 'selector' ] = $selarr[ 'selector' ];
843
+ //$this->ctc()->debug( 'value: ' . $value . ' parts: ' . print_r( $parts, TRUE ), __FUNCTION__, __CLASS__ );
844
  else:
845
  if ( $newselector && $newselector != $selarr[ 'selector' ] ):
846
  // If this is a renamed selector, add new selector to array
847
  $newqsid = $this->update_arrays(
848
+ 'c',
849
  $selarr[ 'query' ],
850
  $newselector,
851
  $rule,
855
  );
856
  // clear the original selector's new value:
857
  $this->update_arrays(
858
+ 'c',
859
  $selarr[ 'query' ],
860
  $selarr[ 'selector' ],
861
  $rule,
863
  0,
864
  $rulevalid
865
  );
866
+ $seq = $this->get_dict_value( 'seq', $qsid );
867
+ if ( $seq != $newqsid ):
868
+ $this->set_dict_value( 'seq', $newqsid, $seq );
869
+ else:
870
+ unset( $this->dict_seq[ $newqsid ] );
871
+ endif;
872
  else:
873
  // otherwise, just update with the new values:
874
  $this->update_arrays(
875
+ 'c',
876
  $selarr[ 'query' ],
877
  $selarr[ 'selector' ],
878
  $rule,
927
  else:
928
  $value = '';
929
  endif;
930
+
931
+ //$this->ctc()->debug( 'modified value: ' . $value, __FUNCTION__, __CLASS__ );
932
  if ( $newselector && $newselector != $rule_arr[ 'selector' ] ):
933
  // If this is a renamed selector, add new selector to array
934
  $newqsid = $this->update_arrays(
935
+ 'c',
936
  $rule_arr[ 'query' ],
937
  $newselector,
938
  $rule,
942
  );
943
  // clear the original selector's new value:
944
  $this->update_arrays(
945
+ 'c',
946
  $rule_arr[ 'query' ],
947
  $rule_arr[ 'selector' ],
948
  $rule,
953
  else:
954
  // otherwise, just update with the new values:
955
  $this->update_arrays(
956
+ 'c',
957
  $rule_arr[ 'query' ],
958
  $rule_arr[ 'selector' ],
959
  $rule,
965
  endforeach;
966
  endforeach;
967
  endforeach;
968
+ if ( $newqsid )
969
+ $qsid = $newqsid;
 
 
 
 
 
 
970
  // return updated qsid to browser to update form
971
  if ( $this->ctc()->cache_updates ):
972
  $this->ctc()->updates[] = array(
993
 
994
  // strips non printables and potential commands
995
  function sanitize( $styles ) {
996
+ return sanitize_text_field( preg_replace( '/[^[:print:]]|[\{\}].*/', '', $styles ) );
997
  }
998
 
999
  // escapes octal values in input to allow for specific ascii strings in content rule
1017
  * Future use: have we run out of memory?
1018
  *
1019
  if ( $this->max_sel ):
1020
+ //$this->ctc()->debug( 'Insufficient memory to parse file.', __FUNCTION__, __CLASS__ );
1021
  return FALSE;
1022
  endif;
1023
  */
1060
  *
1061
  if ( filesize( $stylesheet_verified ) * 3 > $this->ctc()->get_free_memory() ):
1062
  $this->max_sel = 1;
1063
+ //$this->ctc()->debug( 'Insufficient memory to read file', __FUNCTION__, __CLASS__ );
1064
  return;
1065
  endif;
1066
  */
1077
  * FIXME - this function has grown too monolithic - refactor and componentize
1078
  */
1079
  function parse_css( $template, $basequery = NULL, $parse_imports = TRUE, $relpath = '', $reset = FALSE ) {
1080
+ //$this->load_config( 'sel_ndx' );
1081
+ $this->load_config( 'val_ndx' );
1082
+ $this->load_config( 'dict_query' );
1083
+ $this->load_config( 'dict_sel' );
1084
+ $this->load_config( 'dict_token' );
1085
+ $this->load_config( 'dict_qs' );
1086
+ $this->load_config( 'dict_val' );
1087
+ $this->load_config( 'dict_rule' );
1088
+ $this->load_config( 'dict_seq' );
1089
  if ( FALSE === strpos( $basequery, '@' ) ):
1090
  $basequery = 'base';
1091
  endif;
1140
  foreach( $matches[ 1 ] as $sel ):
1141
  $stuff = array_shift( $matches[ 2 ] );
1142
  $this->update_arrays(
1143
+ 'child' == $template ? 'c' : 'p',
1144
  $query,
1145
  $sel
1146
  );
1192
  $rule = preg_replace( '#(\-(o|ms|moz|webkit)\-)?(' . implode( '|', $this->vendorrule ) . ')#', "$3", $rule );
1193
  if ( 'parnt' == $template && 'background-image' == $rule && strstr( $value, 'url(' ) )
1194
  $value = $this->convert_rel_url( $value, $relpath );
1195
+ /**
1196
+ * The reset flag forces the values for a given property (rule) to be rewritten completely
1197
+ * when using the raw CSS input or when reading from a stylesheet.
1198
+ * This permits complete blocks of style data to be entered verbatim, replacing existing styles.
1199
+ * When entering individual values from the Query/Selector inputs, multiple fallback values for existing
1200
+ * properties can be added in the order they are entered (e.g., margin: 1rem; margin: 1em;)
1201
+ */
1202
  if ( !$reset ) $resetrule[ $rule ] = TRUE;
1203
 
1204
  $qsid = $this->update_arrays(
1205
+ 'child' == $template ? 'c' : 'p',
1206
  $query,
1207
  $sel,
1208
  $rule,
1225
  );
1226
  do_action( 'chld_thm_cfg_update_qsid', $qsid );
1227
  endif;
1228
+
1229
  }
1230
 
1231
  // converts relative path to absolute path for preview
1244
  $newvalue = ( $url ? 'url(' : '' )
1245
  . ( $fileparts ? trailingslashit( implode( '/', $fileparts ) ) : '' )
1246
  . implode( '/', $newparts ) . ( $url ? ')' : '' );
1247
+ $this->ctc()->debug( 'converted ' . $value . ' to ' . $newvalue . ' with ' . $relpath, __FUNCTION__, __CLASS__ );
1248
  return $newvalue;
1249
  }
1250
 
1257
  * FIXME - this function has grown too monolithic - refactor and componentize
1258
  */
1259
  function write_css() {
 
 
 
 
1260
  $output = '';
1261
  foreach ( $this->sort_queries() as $query => $sort_order ):
1262
  $has_selector = 0;
1263
  $sel_output = '';
1264
+ $selectors = $this->denorm_dict_qs( $query, FALSE );
1265
  uasort( $selectors, array( $this, 'cmp_seq' ) );
1266
  if ( 'base' != $query ) $sel_output .= $query . ' {' . LF;
1267
  foreach ( $selectors as $selid => $qsid ):
1268
+ if ( $valarr = $this->unpack_val_ndx( $qsid ) ):
1269
+ $sel = $this->detokenize( $this->get_dict_value( 'sel', $selid ) );
1270
  $shorthand = array();
1271
  $rule_output = array();
1272
+ foreach ( $valarr as $ruleid => $temparr ):
1273
  // normalize values for backward compatability
1274
+ if ( isset( $temparr[ 'c' ] ) &&
1275
+ ( !isset( $temparr[ 'p' ] ) || $temparr[ 'p' ] != $temparr[ 'c' ] ) ):
1276
+ foreach ( $temparr[ 'c' ] as $rulevalarr ):
 
1277
  $this->add_vendor_rules(
1278
  $rule_output,
1279
  $shorthand,
1280
+ $this->get_dict_value( 'rule', $ruleid ),
1281
+ $this->get_dict_value( 'val', $rulevalarr[ 0 ] ),
1282
  $rulevalarr[ 1 ],
1283
  $rulevalarr[ 2 ]
1284
  );
1314
  endforeach;
1315
  $output = $this->get_css_header_comment( $this->get_prop( 'handling' ) ) . LF . $output;
1316
  $stylesheet = $this->get_stylesheet_path();
1317
+ $this->ctc()->debug( 'writing stylesheet: ' . $stylesheet, __FUNCTION__, __CLASS__ );
1318
  //echo //print_r(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS), true) . LF;
1319
  if ( $stylesheet_verified = $this->is_file_ok( $stylesheet, 'write' ) ):
1320
  global $wp_filesystem; // this was initialized earlier;
1324
  // stylesheet must already exist and be writable by web server
1325
  if ( $this->ctc()->is_ajax && is_writable( $stylesheet_verified ) ):
1326
  if ( FALSE === @file_put_contents( $stylesheet_verified, $output ) ):
1327
+ $this->ctc()->debug( 'Ajax write failed.', __FUNCTION__, __CLASS__ );
1328
  return FALSE;
1329
  endif;
1330
  elseif ( FALSE === $wp_filesystem->put_contents( $this->ctc()->fspath( $stylesheet_verified ), $output, $mode ) ):
1331
+ $this->ctc()->debug( 'Filesystem write failed.', __FUNCTION__, __CLASS__ );
1332
  return FALSE;
1333
  endif;
1334
  return TRUE;
1339
  function stringify_rule_output( &$rule_output ) {
1340
  $output = '';
1341
  asort( $rule_output );
 
1342
  foreach ( $rule_output as $rule => $sortstr )
1343
  $output .= ' ' . $rule . ";\n";
1344
  return $output;
1352
  * encode_shorthand
1353
  * converts CTC long syntax into CSS shorthand
1354
  * v1.7.5 refactored for multiple values per property
1355
+ * v2.1.0 to prevent incorrect rendering, do not use shorthand if multiple values exist for any side property.
1356
  */
1357
  function encode_shorthand( $shorthand, &$rule_output ) {
 
1358
  foreach ( $shorthand as $property => $sides ):
1359
+ if ( isset( $sides[ 'top' ] ) && 1 == count( $sides[ 'top' ] ) ):
1360
  foreach ( $sides[ 'top' ] as $tval => $tarr ):
1361
+ if ( isset( $sides[ 'right' ] ) && 1 == count( $sides[ 'right' ] ) ):
1362
  $currseq = $tarr[ 1 ];
1363
  foreach ( $sides[ 'right' ] as $rval => $rarr ):
1364
  // value must exist from side and priority must match all sides
1365
+ if ( isset( $sides[ 'bottom' ] ) && 1 == count( $sides[ 'bottom' ] ) && $tarr[ 0 ] == $rarr[ 0 ] ):
1366
  if ( $rarr[ 1 ] > $currseq ) $currseq = $rarr[ 1 ];
1367
  foreach ( $sides[ 'bottom' ] as $bval => $barr ):
1368
+ if ( isset( $sides[ 'left' ] ) && 1 == count( $sides[ 'left' ] ) && $tarr[ 0 ] == $barr[ 0 ] ):
1369
  // use highest sort sequence of all sides
1370
  if ( $barr[ 1 ] > $currseq ) $currseq = $barr[ 1 ];
1371
  foreach ( $sides[ 'left' ] as $lval => $larr ):
1597
  */
1598
  function encode_gradient( $value ) {
1599
  // don't try this at home, kids
1600
+ $regex = '/gradient[^\)]*?\( #exp descr
1601
+ ( #[1]
1602
+ ( #[2]
1603
+ (to\x20)? #[3] reverse
1604
+ (top|bottom|left|right)? #[4] direction1
1605
+ (\x20 #[5]
1606
+ (top|bottom|left|right))? #[6] direction2
1607
+ |\d+deg),)? # or angle
1608
+ (color-stop\()? #[7] optional
1609
+ ([^\w\#\)]*[\'"]? #[8]
1610
+ (\#\w{3,8} #[9] color (hex)
1611
+ |rgba?\([\d.,\x20]+?\) # red green blue (alpha)
1612
+ |hsla?\([\d%.,\x20]+?\) # hue sat. lum. (alpha)
1613
+ |[a-z]+) # color (name)
1614
+ (\x20+[\d.]+%?)?) #[10] stop position
1615
+ (\),\x20*)? #[11] optional close
1616
+ (color-stop\()? #[12] optional
1617
+ ([^\w\#\)]*[\'"]? #[13]
1618
+ (\#\w{3,8} #[14] color (hex)
1619
+ |rgba?\([\d.,\x20]+?\) # red green blue (alpha)
1620
+ |hsla?\([\d%.,\x20]+?\) # hue sat. lum. (alpha)
1621
+ |[a-z]+) # color (name)
1622
+ (\x20+[\d.]+%?)?) #[15] stop position
1623
+ (\))? #[16] optional close
1624
+ ([^\w\)]*gradienttype=[\'"]? #[17] IE
1625
+ (\d) #[18] IE
1626
+ [\'"]?)? # IE
1627
+ [^\w\)]*\)/ix';
1628
  $param = $parts = array();
1629
  preg_match( $regex, $value, $parts );
1630
+ //$this->ctc()->debug( 'gradient value: ' . $value . ' parts: ' . print_r( $parts, TRUE ), __FUNCTION__, __CLASS__ );
1631
+ if ( empty( $parts[ 18 ] ) ):
1632
  if ( empty( $parts[ 2 ] ) ):
1633
  $param[ 0 ] = 'top';
1634
  elseif ( 'to ' == $parts[ 3 ] ):
1640
  else:
1641
  $param[ 0 ] = trim( $parts[ 2 ] );
1642
  endif;
1643
+ if ( empty( $parts[ 10 ] ) ):
1644
  $param[ 2 ] = '0%';
1645
  else:
1646
+ $param[ 2 ] = trim( $parts[ 10 ] );
1647
  endif;
1648
+ if ( empty( $parts[ 15 ] ) ):
1649
  $param[ 4 ] = '100%';
1650
  else:
1651
+ $param[ 4 ] = trim( $parts[ 15 ] );
1652
  endif;
1653
+ elseif( '0' == $parts[ 18 ] ):
1654
  $param[ 0 ] = 'top';
1655
  $param[ 2 ] = '0%';
1656
  $param[ 4 ] = '100%';
1657
+ elseif ( '1' == $parts[ 18 ] ):
1658
  $param[ 0 ] = 'left';
1659
  $param[ 2 ] = '0%';
1660
  $param[ 4 ] = '100%';
1661
  endif;
1662
+ if ( isset( $parts[ 9 ] ) && isset( $parts[ 14 ] ) ):
1663
+ $param[ 1 ] = $parts[ 9 ];
1664
+ $param[ 3 ] = $parts[ 14 ];
1665
  ksort( $param );
1666
  return implode( ':', $param );
1667
  else:
1710
  * FIXME: only return child if no original value exists
1711
  */
1712
  function denorm_rule_val( $ruleid ) {
1713
+ $this->load_config( 'dict_val' );
1714
+ $this->load_config( 'val_ndx' );
1715
  $rule_sel_arr = array();
1716
+ foreach ( $this->val_ndx as $qsid => $p ):
1717
+ if ( $valarr = $this->unpack_val_ndx( $qsid ) ):
1718
+ if ( !isset( $valarr[ $ruleid ] ) ) continue;
1719
+ foreach ( array( 'p', 'c' ) as $template ):
1720
+ if ( isset( $valarr[ $ruleid ][ $template ] ) ):
1721
+ foreach ( $valarr[ $ruleid ][ $template ] as $rulevalarr ):
1722
+ $rule_sel_arr[ $rulevalarr[ 0 ] ] = $this->get_dict_value( 'val', $rulevalarr[ 0 ] );
1723
+ endforeach;
1724
+ endif;
1725
+ endforeach;
1726
+ endif;
1727
  endforeach;
1728
  return $rule_sel_arr;
1729
  }
1735
  * FIXME: only return new values corresponding to specific rulevalid of matching original value
1736
  */
1737
  function denorm_val_query( $valid, $rule ) {
1738
+ $this->load_config( 'dict_rule' );
1739
+ $this->load_config( 'val_ndx' );
1740
  $value_query_arr = array();
1741
+ if ( $thisruleid = $this->get_dict_id( 'rule', $rule ) ):
1742
+ foreach ( $this->val_ndx as $qsid => $p ):
1743
+ if ( $valarr = $this->unpack_val_ndx( $qsid ) ):
1744
+ foreach ( $valarr as $ruleid => $values ):
1745
+ if ( $ruleid != $thisruleid ) continue;
1746
+ foreach ( array( 'p', 'c' ) as $template ):
1747
+ if ( isset( $values[ $template ] ) ):
1748
+ foreach ( $values[ $template ] as $rulevalarr ):
1749
+ if ( $rulevalarr[ 0 ] != $valid ) continue;
1750
+ $selarr = $this->denorm_query_sel( $qsid );
1751
+ $value_query_arr[ $rule ][ $selarr[ 'query' ] ][ $qsid ] = $this->denorm_sel_val( $qsid );
1752
+ endforeach;
1753
+ endif;
1754
  endforeach;
1755
+ endforeach;
1756
+ endif;
1757
  endforeach;
 
1758
  endif;
1759
  return $value_query_arr;
1760
  }
1764
  * Return id, query and selector values of a specific qsid (query-selector ID)
1765
  */
1766
  function denorm_query_sel( $qsid ) {
1767
+ $this->load_config( 'dict_query' );
1768
+ $this->load_config( 'dict_sel' );
1769
+ $this->load_config( 'dict_seq' );
1770
+ $this->load_config( 'dict_qs' );
1771
+ $this->load_config( 'dict_token' );
1772
+ if ( FALSE === ( $qs = $this->get_dict_value( 'qs', $qsid ) ) ):
1773
+ $this->ctc()->debug( $qsid . ' does not exist', __FUNCTION__, __CLASS__ );
1774
+ return array();
1775
+ endif;
1776
+ list( $q, $s ) = explode( ':', $qs );
1777
+ if ( $seq = $this->get_dict_value( 'seq', $qsid ) ):
1778
+ $this->ctc()->debug( 'get seq: custom: ' . $seq, __FUNCTION__, __CLASS__ );
1779
+ else:
1780
+ $seq = $qsid;
1781
+ $this->ctc()->debug( 'get seq: using qsid: ' . $qsid, __FUNCTION__, __CLASS__ );
1782
+ endif;
1783
+ $qselarr = array(
1784
  'id' => $qsid,
1785
+ 'query' => $this->get_dict_value( 'query', $q ),
1786
+ 'selector' => $this->detokenize( $this->get_dict_value( 'sel', $s ) ),
1787
+ 'seq' => $seq,
1788
  );
1789
+ return $qselarr;
1790
  }
1791
 
1792
  /**
1795
  * grouped by query, selector
1796
  */
1797
  function denorm_sel_val( $qsid ) {
1798
+ $this->load_config( 'dict_val' );
1799
+ $this->load_config( 'dict_rule' );
1800
+ $this->load_config( 'val_ndx' );
1801
  $selarr = $this->denorm_query_sel( $qsid );
1802
+ if ( $valarr = $this->unpack_val_ndx( $qsid ) ):
1803
+ //$this->ctc()->debug( 'valarr: ' . print_r( $valarr, TRUE ), __FUNCTION__, __CLASS__ );
1804
+ foreach ( $valarr as $ruleid => $values ):
1805
+ //$this->ctc()->debug( 'ruleid: ' . $ruleid, __FUNCTION__, __CLASS__ );
1806
+ foreach ( array( 'p', 'c' ) as $template ):
1807
+ $t = 'c' == $template ? 'child' : 'parnt';
1808
+ //$this->ctc()->debug( 'template: ' . $t, __FUNCTION__, __CLASS__ );
1809
  if ( isset( $values[ $template ] ) ):
1810
  foreach ( $values[ $template ] as $rulevalarr ):
1811
+ $selarr[ 'value' ][ $this->get_dict_value( 'rule', $ruleid ) ][ $t ][] = array(
1812
+ $this->get_dict_value( 'val', $rulevalarr[ 0 ] ),
1813
  $rulevalarr[ 1 ],
1814
  isset( $rulevalarr[ 2 ] ) ? $rulevalarr[ 2 ] : 1,
1815
  );
1818
  endforeach;
1819
  endforeach;
1820
  endif;
1821
+ //$this->ctc()->debug( print_r( $selarr, TRUE ), __FUNCTION__, __CLASS__ );
1822
  return $selarr;
1823
  }
1824
 
1825
  /**
1826
+ /**
1827
+ * v1.7.5
1828
  * convert and/or normalize rule/value index
1829
  * to support multiple values per property ( rule )
1830
  * allows backward compatility with < v1.7.5
1831
  */
1832
  function convert_ruleval_array( &$arr ) {
1833
+ //$this->ctc()->debug( 'original array: ' . print_r( $arr, TRUE ), __FUNCTION__, __CLASS__ );
1834
  foreach ( array( 'parnt', 'child' ) as $template ):
1835
  // skip if empty array
1836
  if ( !isset( $arr[ $template ] ) ) continue;
1837
+ $t = 'child' == $template ? 'c' : 'p';
1838
  // check if using original data structure ( value is scalar )
1839
  if ( ! is_array( $arr[ $template ] ) ):
1840
  /**
1844
  * [1] => important
1845
  * [2] => priority
1846
  */
1847
+ $arr[ $t ] = array( array( $arr[ $template ], $arr[ 'i_' . $template ], 0, 1 ) );
1848
+ else:
1849
+ $arr[ $t ] = $arr[ $template ];
1850
  endif;
1851
+ unset( $arr[ $template ] );
1852
+ endforeach;
1853
+ //$this->ctc()->debug( 'first pass: ' . print_r( $arr, TRUE ), __FUNCTION__, __CLASS__ );
1854
+ foreach ( array( 'p', 'c' ) as $template ):
1855
+ if ( !isset( $arr[ $template ] ) ) continue;
1856
  $newarr = array();
1857
  // iterate each value and enforce array structure
1858
  foreach ( $arr[ $template ] as $rulevalid => $rulevalarr ):
1860
  if ( empty ( $rulevalarr ) ) continue;
1861
  //
1862
  if ( ! is_array( $rulevalarr ) ):
1863
+ // important flag moves to individual value in array
1864
  $important = isset( $arr[ 'i_' . $template ] ) ? $arr[ 'i_' . $template ] : 0;
1865
  unset( $arr[ 'i_' . $template ] );
1866
  $val = (int) $rulevalarr;
1872
  endforeach;
1873
  $arr[ $template ] = $newarr;
1874
  endforeach;
1875
+ //$this->ctc()->debug( 'second pass: ' . print_r( $arr, TRUE ), __FUNCTION__, __CLASS__ );
1876
+ }
1877
+
1878
+ /**
1879
+ * Convert all internal data dictionaries to latest format.
1880
+ */
1881
+ function convert_dict_arrays(){
1882
+ $this->ctc()->debug( 'converting dictionaries from old format', __FUNCTION__, __CLASS__ );
1883
+ foreach ( $this->dicts as $dict => $loaded ):
1884
+ $this->load_config( $dict );
1885
+ switch ( $dict ):
1886
+ case 'dict_seq':
1887
+ case 'dict_token':
1888
+ continue;
1889
+ case 'sel_ndx':
1890
+ $this->{ $dict } = array();
1891
+ continue;
1892
+ case 'val_ndx':
1893
+ foreach ( $this->val_ndx as $qsid => $rulearr ):
1894
+ foreach ( $rulearr as $ruleid => $valarr )
1895
+ $this->convert_ruleval_array( $this->val_ndx[ $qsid ][ $ruleid ] );
1896
+ $this->pack_val_ndx( $qsid, $this->val_ndx[ $qsid ] );
1897
+ endforeach;
1898
+ continue;
1899
+ case 'dict_qs':
1900
+ $qsarr = array();
1901
+ foreach ( $this->dict_qs as $qsid => $arr ):
1902
+ $qs = $arr[ 'q' ] . ':' . $arr[ 's' ];
1903
+ $qsarr[ $qsid ] = $qs;
1904
+ endforeach;
1905
+ $this->dict_qs = $qsarr;
1906
+ continue;
1907
+ default:
1908
+ $this->{ $dict } = array_flip( $this->{ $dict } );
1909
+ foreach ( $this->{ $dict } as $key => $val ):
1910
+ if ( 'dict_sel' == $dict )
1911
+ $this->dict_sel[ $key ] = $this->tokenize( (string) $val );
1912
+ else
1913
+ $this->{ $dict }[ $key ] = ( string ) $val;
1914
+ endforeach;
1915
+ endswitch;
1916
+ //echo '<pre><code><small><strong>' . $dict . '</strong>' . print_r( $this->{ $dict }, TRUE) . '</small></code></pre>' . LF;
1917
+ endforeach;
1918
+ $this->save_config();
1919
  }
1920
 
1921
  /**
1922
+ * denorm_dict_qs
1923
  * Return denormalized array containing query and selector heirarchy
1924
  */
1925
+ function denorm_dict_qs( $query = NULL, $norm = TRUE ) {
1926
+ $this->load_config( 'dict_query' );
1927
+ $this->load_config( 'dict_sel' );
1928
+ $this->load_config( 'dict_token' );
1929
+ $this->load_config( 'dict_qs' );
1930
+ $retarray = array();
1931
+ if ( $query ):
1932
+ $q = $this->get_dict_id( 'query', $query );
1933
+ $selarr = preg_grep( '/^' . $q . ':/', $this->dict_qs );
1934
+ foreach ( $selarr as $qsid => $qs ):
1935
+ list( $q, $s ) = explode( ':', $qs );
1936
+ if ( $norm )
1937
+ $retarray[ $qsid ] = $this->detokenize( $this->get_dict_value( 'sel', $s ) );
1938
+ else
1939
+ $retarray[ $s ] = $qsid;
1940
  endforeach;
1941
+ else:
1942
+ return array_values( $this->dict_query );
1943
+ endif;
1944
+ if ( $norm )
1945
+ return $this->sort_selectors( $retarray );
1946
+ return $retarray;
1947
  }
1948
 
1949
  /**
1966
  * @media min-width queries in ascending order
1967
  */
1968
  function sort_queries() {
1969
+ $this->load_config( 'dict_query' );
1970
  $queries = array();
1971
+ foreach ( $this->dict_query as $queryid => $query ):
1972
+ /** lookup **/
 
1973
  if ( 'base' == $query ):
1974
  $queries[ 'base' ] = -999999;
1975
  continue;
1985
  }
1986
 
1987
  function sort_selectors( $selarr ) {
1988
+ $selarr = ( array ) $selarr;
1989
+ uasort( $selarr, array( $this, 'cmp_sel' ) );
1990
+ return array_flip( $selarr );
1991
  }
1992
 
1993
  function cmp_sel( $a, $b ) {
1999
 
2000
  // sort selectors based on dict_seq if exists, otherwise qsid
2001
  function cmp_seq( $a, $b ) {
2002
+ if ( FALSE === ( $cmpa = $this->get_dict_value( 'seq', $a ) ) )
2003
+ $cmpa = $a;
2004
+ if ( FALSE === ( $cmpb = $this->get_dict_value( 'seq', $b ) ) )
2005
+ $cmpb = $b;
2006
  if ( $cmpa == $cmpb ) return 0;
2007
  return ( $cmpa < $cmpb ) ? -1 : 1;
2008
  }
2040
  function is_file_ok( $stylesheet, $permission = 'read' ) {
2041
  // remove any ../ manipulations
2042
  $stylesheet = $this->ctc()->normalize_path( preg_replace( "%\.\./%", '/', $stylesheet ) );
2043
+ //$this->ctc()->debug( 'checking file: ' . $stylesheet, __FUNCTION__, __CLASS__ );
2044
  if ( 'read' == $permission && !is_file( $stylesheet ) ):
2045
+ $this->ctc()->debug( 'read ' . $stylesheet . ' no file!', __FUNCTION__, __CLASS__ );
2046
  return FALSE;
2047
  elseif ( 'write' == $permission && !is_dir( dirname( $stylesheet ) ) ):
2048
+ $this->ctc()->debug( 'write ' . $stylesheet . ' no dir!', __FUNCTION__, __CLASS__ );
2049
  return FALSE;
2050
  elseif ( 'search' == $permission && !is_dir( $stylesheet ) ):
2051
+ $this->ctc()->debug( 'search ' . $stylesheet . ' no dir!', __FUNCTION__, __CLASS__ );
2052
  return FALSE;
2053
  endif;
2054
  // check if in themes dir;
2055
  $regex = '%^' . preg_quote( $this->ctc()->normalize_path( get_theme_root() ) ) . '%';
2056
+ //$this->ctc()->debug( 'theme regex: ' . $regex, __FUNCTION__, __CLASS__ );
2057
  if ( preg_match( $regex, $stylesheet ) ):
2058
+ //$this->ctc()->debug( $stylesheet . ' ok!', __FUNCTION__, __CLASS__ );
2059
  return $stylesheet;
2060
  endif;
2061
  // check if in plugins dir
2062
  $regex = '%^' . preg_quote( $this->ctc()->normalize_path( WP_PLUGIN_DIR ) ) . '%';
2063
+ //$this->ctc()->debug( 'plugin regex: ' . $regex, __FUNCTION__, __CLASS__ );
2064
  if ( preg_match( $regex, $stylesheet ) ):
2065
+ //$this->ctc()->debug( $stylesheet . ' ok!', __FUNCTION__, __CLASS__ );
2066
  return $stylesheet;
2067
  endif;
2068
+ $this->ctc()->debug( $stylesheet . ' is not in wp folders!', __FUNCTION__, __CLASS__ );
2069
  return FALSE;
2070
  }
2071
 
2095
  function tolower( $matches ) {
2096
  return '#' . strtolower( $matches[ 1 ] );
2097
  }
2098
+
2099
+ function tokenize( $value ){
2100
+ return $value;
2101
+ // swap out commas and/or consecutive alphas with leading non-alpha if present
2102
+ $value = preg_replace_callback( "/(, |[_\W]?[^\W_]+)/", array( $this, 'get_token' ), $value );
2103
+ // trim off leading/trailing delimiter
2104
+ $value = preg_replace( "/^%%|%%$/", '', $value );
2105
+ // split into packable array
2106
+ $array = array_map( array( $this, 'to_int' ), preg_split( "/(%%)+/", $value ) );
2107
+ //echo '<pre><code><small>';
2108
+ //var_dump( $array );
2109
+ //echo '</small></code></pre>';
2110
+ try {
2111
+ return $this->packer->encode( $this->packer->pack( $array ) );
2112
+ } catch ( Exception $e ) {
2113
+ $this->ctc()->errors[] = 'Pack failed -- ' . $e->getMessage();
2114
+ }
2115
+ }
2116
+
2117
+ function to_int( $val ){
2118
+ return intval( $val ) == $val ? (int) $val : $val;
2119
+ }
2120
+
2121
+ function detokenize( $packed ){
2122
+ return $packed;
2123
+ // unpack array
2124
+ try {
2125
+ $this->packer->reset( $this->packer->decode( $packed ) );
2126
+ $array = $this->packer->unpack();
2127
+ } catch ( Exception $e ) {
2128
+ $this->ctc()->errors[] = 'Unpack failed -- ' . $e->getMessage();
2129
+ }
2130
+ $unpacked = array();
2131
+ // iterate array and replace tokens
2132
+ do {
2133
+ $token = array_shift( $array );
2134
+ if ( 'integer' == gettype( $token ) )
2135
+ $unpacked[] = $this->get_dict_value( 'token', $token );
2136
+ else
2137
+ $unpacked[] = $token;
2138
+ } while( $array );
2139
+
2140
+ // assemble array
2141
+ return implode( '', $unpacked );
2142
+ }
2143
+
2144
+ function get_token( $matches ){
2145
+ $token = $matches[ 1 ];
2146
+ $id = $this->get_dict_id( 'token', $token );
2147
+ $this->instances[ $id ] = isset( $this->instances[ $id ] )
2148
+ ? $this->instances[ $id ] + 1
2149
+ : 1;
2150
+ return '%%' . $id . '%%';
2151
+ }
2152
  }
includes/class-ctc-packer.php ADDED
@@ -0,0 +1,398 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ Some portions based on msgpack.php
5
+ Copyright (c) 2015-2016 Eugene Leonovich
6
+ The MIT License (MIT)
7
+ Some portions based on base91.php
8
+ Copyright (c) 2005-2006 Joachim Henke
9
+ http://base91.sourceforge.net/
10
+ */
11
+
12
+ class ChildThemeConfiguratorPacker {
13
+
14
+ const NON_UTF8_REGEX = '/(
15
+ [\xC0-\xC1] # Invalid UTF-8 Bytes
16
+ | [\xF5-\xFF] # Invalid UTF-8 Bytes
17
+ | \xE0[\x80-\x9F] # Overlong encoding of prior code point
18
+ | \xF0[\x80-\x8F] # Overlong encoding of prior code point
19
+ | [\xC2-\xDF](?![\x80-\xBF]) # Invalid UTF-8 Sequence Start
20
+ | [\xE0-\xEF](?![\x80-\xBF]{2}) # Invalid UTF-8 Sequence Start
21
+ | [\xF0-\xF4](?![\x80-\xBF]{3}) # Invalid UTF-8 Sequence Start
22
+ | (?<=[\x0-\x7F\xF5-\xFF])[\x80-\xBF] # Invalid UTF-8 Sequence Middle
23
+ | (?<![\xC2-\xDF]|[\xE0-\xEF]|[\xE0-\xEF][\x80-\xBF]|[\xF0-\xF4]|[\xF0-\xF4][\x80-\xBF]|[\xF0-\xF4][\x80-\xBF]{2})[\x80-\xBF] # Overlong Sequence
24
+ | (?<=[\xE0-\xEF])[\x80-\xBF](?![\x80-\xBF]) # Short 3 byte sequence
25
+ | (?<=[\xF0-\xF4])[\x80-\xBF](?![\x80-\xBF]{2}) # Short 4 byte sequence
26
+ | (?<=[\xF0-\xF4][\x80-\xBF])[\x80-\xBF](?![\x80-\xBF]) # Short 4 byte sequence (2)
27
+ )/x';
28
+ var $enctab = array(
29
+ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
30
+ 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
31
+ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
32
+ 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
33
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '!', '#', '$',
34
+ '%', '&', '(', ')', '*', '+', ',', '.', '/', ':', ';', '<', '=',
35
+ '>', '?', '@', '[', ']', '^', '_', '`', '{', '|', '}', '~', '"'
36
+ );
37
+ var $dectab;
38
+ var $buffer;
39
+ var $offset;
40
+
41
+ function __construct(){
42
+ $this->dectab = array_flip( $this->enctab );
43
+ }
44
+
45
+ function reset( $buffer = '' ){
46
+ $this->buffer = $buffer;
47
+ $this->offset = 0;
48
+ }
49
+
50
+ public function pack( $value ) {
51
+
52
+ switch ( gettype( $value ) ) {
53
+ case 'array': return array_values( $value ) === $value
54
+ ? $this->packArray( $value )
55
+ : $this->packMap( $value );
56
+
57
+ case 'string': return preg_match( self::NON_UTF8_REGEX, $value )
58
+ ? $this->packBin( $value )
59
+ : $this->packStr( $value );
60
+
61
+ case 'integer': return $this->packInt( $value );
62
+ case 'NULL': return $this->packNil();
63
+ case 'boolean': return $this->packBool( $value );
64
+ }
65
+
66
+ throw new PackingFailedException( $value, 'Unsupported type.' );
67
+ }
68
+
69
+ public function packNil() {
70
+
71
+ return "\xc0";
72
+ }
73
+
74
+ public function packBool( $val ) {
75
+
76
+ return $val ? "\xc3" : "\xc2";
77
+ }
78
+
79
+ public function packArray( array $array ) {
80
+
81
+ $size = count( $array );
82
+ $data = self::packArrayHeader( $size );
83
+
84
+ foreach ( $array as $val ) {
85
+ $data .= $this->pack( $val );
86
+ }
87
+
88
+ return $data;
89
+ }
90
+
91
+ private static function packArrayHeader( $size ) {
92
+
93
+ if ( $size <= 0xf ) {
94
+ return chr( 0x90 | $size );
95
+ }
96
+ if ( $size <= 0xffff ) {
97
+ return pack( 'Cn', 0xdc, $size );
98
+ }
99
+
100
+ return pack( 'CN', 0xdd, $size );
101
+ }
102
+
103
+ public function packMap( array $map ) {
104
+
105
+ $size = count( $map );
106
+ $data = self::packMapHeader( $size );
107
+
108
+ foreach ( $map as $key => $val ) {
109
+ $data .= $this->pack( $key );
110
+ $data .= $this->pack( $val );
111
+ }
112
+
113
+ return $data;
114
+ }
115
+
116
+ private static function packMapHeader( $size ) {
117
+
118
+ if ( $size <= 0xf ) {
119
+ return chr( 0x80 | $size );
120
+ }
121
+ if ( $size <= 0xffff ) {
122
+ return pack( 'Cn', 0xde, $size );
123
+ }
124
+
125
+ return pack( 'CN', 0xdf, $size );
126
+ }
127
+
128
+ public function packStr( $str ) {
129
+
130
+ $len = strlen( $str );
131
+
132
+ if ( $len < 32 ) {
133
+ return chr( 0xa0 | $len ) . $str;
134
+ }
135
+ if ( $len <= 0xff ) {
136
+ return pack( 'CC', 0xd9, $len ) . $str;
137
+ }
138
+ if ( $len <= 0xffff ) {
139
+ return pack( 'Cn', 0xda, $len ) . $str;
140
+ }
141
+
142
+ return pack( 'CN', 0xdb, $len ) . $str;
143
+ }
144
+
145
+ public function packBin( $str ) {
146
+
147
+ $len = strlen( $str );
148
+
149
+ if ( $len <= 0xff ) {
150
+ return pack( 'CC', 0xc4, $len ) . $str;
151
+ }
152
+ if ( $len <= 0xffff ) {
153
+ return pack( 'Cn', 0xc5, $len ) . $str;
154
+ }
155
+
156
+ return pack( 'CN', 0xc6, $len ) . $str;
157
+ }
158
+
159
+ public function packInt( $num ) {
160
+
161
+ if ( $num >= 0 ) {
162
+ if ( $num <= 0x7f ) {
163
+ return chr( $num );
164
+ }
165
+ if ( $num <= 0xff ) {
166
+ return pack( 'CC', 0xcc, $num );
167
+ }
168
+ if ( $num <= 0xffff ) {
169
+ return pack( 'Cn', 0xcd, $num );
170
+ }
171
+ if ( $num <= 0xffffffff ) {
172
+ return pack( 'CN', 0xce, $num );
173
+ }
174
+
175
+ }
176
+ // no negative integers allowed
177
+ throw new PackingFailedException( $value, 'Unsupported type.' );
178
+ }
179
+
180
+ function unpack() {
181
+
182
+ $this->ensureLength( 1 );
183
+
184
+ $c = ord( $this->buffer[ $this->offset ] );
185
+ ++$this->offset;
186
+
187
+ // fixint
188
+ if ( $c <= 0x7f ) {
189
+ return $c;
190
+ }
191
+ // fixstr
192
+ if ( $c >= 0xa0 && $c <= 0xbf ) {
193
+ return $this->unpackStr( $c & 0x1f );
194
+ }
195
+ // fixarray
196
+ if ( $c >= 0x90 && $c <= 0x9f ) {
197
+ return $this->unpackArray( $c & 0xf );
198
+ }
199
+ // fixmap
200
+ if ( $c >= 0x80 && $c <= 0x8f ) {
201
+ return $this->unpackMap( $c & 0xf );
202
+ }
203
+ switch ( $c ) {
204
+ case 0xc0: return null;
205
+ case 0xc2: return false;
206
+ case 0xc3: return true;
207
+
208
+ // MP_BIN
209
+ case 0xc4: return $this->unpackStr( $this->unpackU8() );
210
+ case 0xc5: return $this->unpackStr( $this->unpackU16() );
211
+ case 0xc6: return $this->unpackStr( $this->unpackU32() );
212
+
213
+ // MP_UINT
214
+ case 0xcc: return $this->unpackU8();
215
+ case 0xcd: return $this->unpackU16();
216
+ case 0xce: return $this->unpackU32();
217
+
218
+ // MP_STR
219
+ case 0xd9: return $this->unpackStr( $this->unpackU8() );
220
+ case 0xda: return $this->unpackStr( $this->unpackU16() );
221
+ case 0xdb: return $this->unpackStr( $this->unpackU32() );
222
+
223
+ // MP_ARRAY
224
+ case 0xdc: return $this->unpackArray( $this->unpackU16() );
225
+ case 0xdd: return $this->unpackArray( $this->unpackU32() );
226
+
227
+ // MP_MAP
228
+ case 0xde: return $this->unpackMap( $this->unpackU16() );
229
+ case 0xdf: return $this->unpackMap( $this->unpackU32() );
230
+
231
+ }
232
+
233
+ throw new UnpackingFailedException( sprintf( 'Unknown code: 0x%x.', $c ) );
234
+ }
235
+
236
+ private function unpackU8() {
237
+
238
+ $this->ensureLength( 1 );
239
+
240
+ $num = $this->buffer[ $this->offset ];
241
+ ++$this->offset;
242
+
243
+ return ord( $num );
244
+ }
245
+
246
+ private function unpackU16() {
247
+
248
+ $this->ensureLength( 2 );
249
+
250
+ $hi = ord( $this->buffer[ $this->offset ] );
251
+ $lo = ord( $this->buffer[ $this->offset + 1 ] );
252
+ $this->offset += 2;
253
+
254
+ return $hi << 8 | $lo;
255
+ }
256
+
257
+ private function unpackU32() {
258
+
259
+ $this->ensureLength( 4 );
260
+
261
+ $num = substr( $this->buffer, $this->offset, 4 );
262
+ $this->offset += 4;
263
+
264
+ $num = unpack( 'N', $num );
265
+
266
+ return $num[ 1 ];
267
+ }
268
+
269
+ private function unpackStr( $length ) {
270
+
271
+ if ( !$length ) {
272
+ return '';
273
+ }
274
+
275
+ $this->ensureLength( $length );
276
+
277
+ $str = substr( $this->buffer, $this->offset, $length );
278
+ $this->offset += $length;
279
+
280
+ return $str;
281
+ }
282
+
283
+ private function unpackArray( $size ) {
284
+
285
+ $array = [];
286
+ for ( $i = $size; $i; --$i ) {
287
+ $array[] = $this->unpack();
288
+ }
289
+
290
+ return $array;
291
+ }
292
+
293
+ private function unpackMap( $size ) {
294
+
295
+ $map = [];
296
+ for ( $i = $size; $i; --$i ) {
297
+ $map[ $this->unpack() ] = $this->unpack();
298
+ }
299
+
300
+ return $map;
301
+ }
302
+
303
+ private function ensureLength( $length ) {
304
+
305
+ if ( !isset( $this->buffer[ $this->offset + $length - 1 ] ) ) {
306
+ throw new InsufficientDataException( $length, strlen( $this->buffer ) - $this->offset );
307
+ }
308
+ }
309
+
310
+
311
+ public function decode( $d )
312
+ {
313
+ $l = strlen( $d );
314
+ $v = -1;
315
+ $n = 0;
316
+ $o = '';
317
+ $b = 0;
318
+ for ( $i = 0; $i < $l; ++$i ):
319
+ $c = $this->dectab[ $d{ $i } ];
320
+ if ( !isset( $c ) )
321
+ continue;
322
+ if ( $v < 0 ):
323
+ $v = $c;
324
+ else:
325
+ $v += $c * 91;
326
+ $b |= $v << $n;
327
+ $n += ( $v & 8191 ) > 88 ? 13 : 14;
328
+ do {
329
+ $o .= chr( $b & 255 );
330
+ $b >>= 8;
331
+ $n -= 8;
332
+ } while ( $n > 7 );
333
+ $v = -1;
334
+ endif;
335
+ endfor;
336
+ if ( $v + 1 )
337
+ $o .= chr( ( $b | $v << $n ) & 255 );
338
+ return $o;
339
+ }
340
+
341
+ public function encode( $d )
342
+ {
343
+ $l = strlen( $d );
344
+ $n = 0;
345
+ $o = '';
346
+ $b = 0;
347
+ for ( $i = 0; $i < $l; ++$i ):
348
+ $b |= ord( $d{ $i } ) << $n;
349
+ $n += 8;
350
+ if ( $n > 13 ):
351
+ $v = $b & 8191;
352
+ if ( $v > 88 ):
353
+ $b >>= 13;
354
+ $n -= 13;
355
+ else:
356
+ $v = $b & 16383;
357
+ $b >>= 14;
358
+ $n -= 14;
359
+ endif;
360
+ $o .= $this->enctab[ $v % 91 ] . $this->enctab[ $v / 91 ];
361
+ endif;
362
+ endfor;
363
+ if ( $n ):
364
+ $o .= $this->enctab[ $b % 91 ];
365
+ if ( $n > 7 || $b > 90 )
366
+ $o .= $this->enctab[ $b / 91 ];
367
+ endif;
368
+ return $o;
369
+ }
370
+ }
371
+
372
+ class PackingFailedException extends RuntimeException {
373
+
374
+ private $value;
375
+
376
+ public function __construct( $value, $message = null, $code = null, Exception $previous = null ){
377
+ parent::__construct( $message, $code, $previous );
378
+
379
+ $this->value = $value;
380
+ }
381
+
382
+ public function getValue(){
383
+ return $this->value;
384
+ }
385
+ }
386
+
387
+ class UnpackingFailedException extends RuntimeException {
388
+
389
+ }
390
+
391
+ class InsufficientDataException extends UnpackingFailedException {
392
+
393
+ public function __construct( $expectedLength, $actualLength, $code = null, Exception $previous = null ){
394
+ $message = sprintf( 'Not enough data to unpack: need %d, have %d.', $expectedLength, $actualLength );
395
+ parent::__construct( $message, $code, $previous );
396
+ }
397
+ }
398
+
includes/class-ctc-preview.php CHANGED
@@ -6,202 +6,150 @@ error_reporting( E_ALL );
6
  ini_set( 'display_errors', 1 );
7
 
8
  /**
9
- * Modified lightweight version of WP Customize Manager class.
10
  * Provides methods required for preview to work without customizer options.
11
  * This only loads when CTC preview is loaded.
12
  */
13
- if ( !class_exists( 'WP_Customize_Manager' ) ):
14
- final class WP_Customize_Manager {
15
-
16
- protected $theme;
17
- protected $original_stylesheet;
18
-
19
- public function __construct(){
 
 
 
20
 
21
- add_action( 'wp_loaded', array( $this, 'wp_loaded' ) );
22
- add_action( 'setup_theme', array( $this, 'setup_theme' ) );
23
- add_action( 'wp_redirect_status', array( $this, 'wp_redirect_status', 1000 ) );
24
 
25
- // Do not spawn cron (especially the alternate cron) while running the Customizer.
26
- remove_action( 'init', 'wp_cron' );
 
 
 
27
 
28
- // Do not run update checks when rendering the controls.
29
- remove_action( 'admin_init', '_maybe_update_core' );
30
- remove_action( 'admin_init', '_maybe_update_plugins' );
31
- remove_action( 'admin_init', '_maybe_update_themes' );
32
-
33
- }
34
-
35
- public function setup_theme() {
36
- send_origin_headers();
37
- // are we previewing?
38
- if ( ! isset( $_GET[ 'stylesheet' ] ) || !wp_verify_nonce( $_GET['preview_ctc'] ) || !current_user_can( 'switch_themes' ) )
39
- return;
40
 
41
- $this->original_stylesheet = get_stylesheet();
42
- $this->theme = wp_get_theme( $_GET[ 'stylesheet' ] );
43
- if ( ! $this->is_theme_active() ):
44
- add_filter( 'template', array( $this, 'get_template' ) );
45
- add_filter( 'stylesheet', array( $this, 'get_stylesheet' ) );
46
- /*
47
- add_filter( 'pre_option_current_theme', array( $this, 'current_theme' ) );
 
48
 
49
- add_filter( 'pre_option_stylesheet', array( $this, 'get_stylesheet' ) );
50
- add_filter( 'pre_option_template', array( $this, 'get_template' ) );
 
 
 
 
 
51
 
52
- // Handle custom theme roots.
53
- add_filter( 'pre_option_stylesheet_root', array( $this, 'get_stylesheet_root' ) );
54
- add_filter( 'pre_option_template_root', array( $this, 'get_template_root' ) );
55
- */
56
- // swap out theme mods with preview theme mods
57
- add_filter( 'pre_option_theme_mods_' . $this->original_stylesheet, array( $this, 'preview_mods' ) );
58
- endif;
59
-
60
- // impossibly high priority to test for stylesheets loaded after wp_head()
61
- add_action( 'wp_print_styles', array( $this, 'test_css' ), 999999 );
62
- // pass the wp_styles queue back to use for stylesheet handle verification
63
- add_action( 'wp_footer', array( $this, 'parse_stylesheet' ) );
64
- // hide admin bar in preview
65
- if ( isset( $_GET[ 'preview_iframe' ] ) )
66
- show_admin_bar( false );
67
- }
68
-
69
- /**
70
- * Retrieves child theme mods for preview
71
- */
72
- public function preview_mods() {
73
- if ( $this->is_theme_active() ) return false;
74
- return get_option( 'theme_mods_' . $this->get_stylesheet() );
75
- }
76
-
77
- public function parse_stylesheet() {
78
- echo '<script>/*<![CDATA[' . LF;
79
- global $wp_styles, $wp_filter;
80
- $queue = implode( "\n", $wp_styles->queue );
81
- echo 'BEGIN WP QUEUE' . LF . $queue . LF . 'END WP QUEUE' . LF;
82
- if ( is_child_theme() ):
83
- // check for signals that indicate specific settings
84
- $file = get_stylesheet_directory() . '/style.css';
85
- if ( file_exists( $file ) && ( $styles = @file_get_contents( $file ) ) ):
86
- // is this child theme a standalone ( framework ) theme?
87
- if ( defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) ):
88
- echo 'CHLD_THM_CFG_IGNORE_PARENT' . LF;
89
- endif;
90
- // has this child theme been configured by CTC? ( If it has the timestamp, it is one of ours. )
91
- if ( preg_match( '#\nUpdated: \d\d\d\d\-\d\d\-\d\d \d\d:\d\d:\d\d\n#s', $styles ) ):
92
- echo 'IS_CTC_THEME' . LF;
93
- endif;
94
- // is this child theme using the @import method?
95
- if ( preg_match( '#\@import\s+url\(.+?\/' . preg_quote( get_template() ) . '\/style\.css.*?\);#s', $styles ) ):
96
- echo 'HAS_CTC_IMPORT' . LF;
97
- endif;
98
  endif;
99
- else:
100
- // Check if the parent style.css file is used at all. If not we can skip the parent stylesheet handling altogether.
101
- $file = get_template_directory() . '/style.css';
102
- if ( file_exists( $file ) && ( $styles = @file_get_contents( $file ) ) ):
103
- $styles = preg_replace( '#\/\*.*?\*\/#s', '', $styles );
104
- if ( !preg_match( '#\n\s*([\[\.\#\:\w][\w\-\s\(\)\[\]\'\^\*\.\#\+:,"=>]+?)\s*\{(.*?)\}#s', $styles ) ):
105
- echo 'NO_CTC_STYLES' . LF;
106
- endif;
107
  endif;
108
  endif;
109
- /**
110
- * Use the filter api to determine the parent stylesheet enqueue priority
111
- * because some themes do not use the standard 10 for various reasons.
112
- * We need to match this priority so that the stylesheets load in the correct order.
113
- */
114
- echo 'BEGIN CTC IRREGULAR' . LF;
115
- // Iterate through all the added hook priorities
116
- foreach ( $wp_filter[ 'wp_enqueue_scripts' ] as $priority => $arr ):
117
- // If this is a non-standard priority hook, determine which handles are being enqueued.
118
- // These will then be compared to the primary handle ( style.css )
119
- // to determine the enqueue priority to use for the parent stylesheet.
120
- if ( $priority != 10 ):
121
- // iterate through each hook in this priority group
122
- foreach ( $arr as $funcarr ):
123
- // clear the queue
124
- $wp_styles->queue = array();
125
- // now call the hooked function to populate the queue
126
- if ( !is_null($funcarr['function']) )
127
- call_user_func_array( $funcarr[ 'function' ], array() );
128
- endforeach;
129
- // report the priority, and any handles that were added
130
- if ( !empty( $wp_styles->queue ) )
131
- echo $priority . ',' . implode( ",", $wp_styles->queue ) . LF;
132
  endif;
133
- endforeach;
134
- echo 'END CTC IRREGULAR' . LF;
135
- echo '*/]]></script>' . LF;
136
- }
137
-
138
- // enqueue dummy stylesheet with extremely high priority to test wp_head()
139
- public function test_css() {
140
- wp_enqueue_style( 'ctc-test', get_stylesheet_directory_uri() . '/ctc-test.css' );
141
- }
142
-
143
- public function woocommerce_unforce_ssl_checkout( $bool ){
144
- return FALSE;
145
- }
146
-
147
- public function wp_die(){
148
- die();
149
- }
150
-
151
- public function doing_ajax(){
152
- return FALSE;
153
- }
154
-
155
- public function theme() {
156
- if ( ! $this->theme ) {
157
- $this->theme = wp_get_theme();
158
- }
159
- return $this->theme;
160
- }
161
-
162
- public function is_preview() {
163
- return TRUE;
164
- }
165
-
166
- public function is_theme_active() {
167
- return $this->get_stylesheet() == $this->original_stylesheet;
168
- }
169
-
170
- public function get_template() {
171
- return $this->theme()->get_template();
172
- }
173
-
174
- public function get_stylesheet() {
175
- return $this->theme()->get_stylesheet();
176
- }
177
-
178
- public function get_template_root() {
179
- return get_raw_theme_root( $this->get_template(), true );
180
- }
181
-
182
- public function get_stylesheet_root() {
183
- return get_raw_theme_root( $this->get_stylesheet(), true );
184
- }
185
-
186
- public function current_theme( $current_theme ) {
187
- return $this->theme()->display( 'Name' );
188
- }
189
-
190
- public function wp_redirect_status( $status ) {
191
- return 200;
192
- }
193
-
194
- public function wp_loaded() {
195
- //do_action( 'customize_register', $this );
196
- $this->customize_preview_init();
197
- }
198
-
199
- public function customize_preview_init() {
200
- do_action( 'customize_preview_init', $this );
201
- }
202
  }
203
 
204
- global $wp_customize;
205
- $wp_customize = new WP_Customize_Manager();
 
206
 
207
- endif;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  ini_set( 'display_errors', 1 );
7
 
8
  /**
 
9
  * Provides methods required for preview to work without customizer options.
10
  * This only loads when CTC preview is loaded.
11
  */
12
+ class ChildThemeConfiguratorPreview {
13
+ protected $theme;
14
+ protected $original_stylesheet;
15
+ protected $stylesheet;
16
+ protected $template;
17
+
18
+ public function __construct(){
19
+
20
+ add_action( 'setup_theme', array( $this, 'setup_theme' ) );
21
+ add_filter( 'wp_redirect_status', array( $this, 'wp_redirect_status' ), 1000 );
22
 
23
+ // Do not spawn cron (especially the alternate cron) while running the Customizer.
24
+ remove_action( 'init', 'wp_cron' );
 
25
 
26
+ // Do not run update checks when rendering the controls.
27
+ remove_action( 'admin_init', '_maybe_update_core' );
28
+ remove_action( 'admin_init', '_maybe_update_plugins' );
29
+ remove_action( 'admin_init', '_maybe_update_themes' );
30
+ }
31
 
32
+ public function setup_theme() {
33
+ // are we previewing?
34
+ if ( !wp_verify_nonce( $_GET['preview_ctc'] ) || !current_user_can( 'switch_themes' ) )
35
+ return;
36
+ $this->original_stylesheet = get_stylesheet();
37
+ $this->theme = wp_get_theme( isset( $_GET[ 'stylesheet' ] ) ? $_GET[ 'stylesheet' ] : NULL );
38
+ if ( ! $this->is_theme_active() ):
39
+ add_filter( 'template', array( $this, 'get_template' ) );
40
+ add_filter( 'stylesheet', array( $this, 'get_stylesheet' ) );
41
+ // swap out theme mods with preview theme mods
42
+ add_filter( 'pre_option_theme_mods_' . $this->original_stylesheet, array( $this, 'preview_mods' ) );
43
+ endif;
44
 
45
+ // impossibly high priority to test for stylesheets loaded after wp_head()
46
+ add_action( 'wp_print_styles', array( $this, 'test_css' ), 999999 );
47
+ // pass the wp_styles queue back to use for stylesheet handle verification
48
+ add_action( 'wp_footer', array( $this, 'parse_stylesheet' ) );
49
+ send_origin_headers();
50
+ // hide admin bar in preview
51
+ show_admin_bar( false );
52
+ }
53
 
54
+ /**
55
+ * Retrieves child theme mods for preview
56
+ */
57
+ public function preview_mods() {
58
+ if ( $this->is_theme_active() ) return false;
59
+ return get_option( 'theme_mods_' . $this->get_stylesheet() );
60
+ }
61
 
62
+ public function parse_stylesheet() {
63
+ echo '<script>/*<![CDATA[' . LF;
64
+ global $wp_styles, $wp_filter;
65
+ $queue = implode( "\n", $wp_styles->queue );
66
+ echo 'BEGIN WP QUEUE' . LF . $queue . LF . 'END WP QUEUE' . LF;
67
+ if ( is_child_theme() ):
68
+ // check for signals that indicate specific settings
69
+ $file = get_stylesheet_directory() . '/style.css';
70
+ if ( file_exists( $file ) && ( $styles = @file_get_contents( $file ) ) ):
71
+ // is this child theme a standalone ( framework ) theme?
72
+ if ( defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) ):
73
+ echo 'CHLD_THM_CFG_IGNORE_PARENT' . LF;
74
+ endif;
75
+ // has this child theme been configured by CTC? ( If it has the timestamp, it is one of ours. )
76
+ if ( preg_match( '#\nUpdated: \d\d\d\d\-\d\d\-\d\d \d\d:\d\d:\d\d\n#s', $styles ) ):
77
+ echo 'IS_CTC_THEME' . LF;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  endif;
79
+ // is this child theme using the @import method?
80
+ if ( preg_match( '#\@import\s+url\(.+?\/' . preg_quote( get_template() ) . '\/style\.css.*?\);#s', $styles ) ):
81
+ echo 'HAS_CTC_IMPORT' . LF;
 
 
 
 
 
82
  endif;
83
  endif;
84
+ else:
85
+ // Check if the parent style.css file is used at all. If not we can skip the parent stylesheet handling altogether.
86
+ $file = get_template_directory() . '/style.css';
87
+ if ( file_exists( $file ) && ( $styles = @file_get_contents( $file ) ) ):
88
+ $styles = preg_replace( '#\/\*.*?\*\/#s', '', $styles );
89
+ if ( !preg_match( '#\s*([\[\.\#\:\w][\w\-\s\(\)\[\]\'\^\*\.\#\+:,"=>]+?)\s*\{(.*?)\}#s', $styles ) ):
90
+ echo 'NO_CTC_STYLES' . LF;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  endif;
92
+ endif;
93
+ endif;
94
+ /**
95
+ * Use the filter api to determine the parent stylesheet enqueue priority
96
+ * because some themes do not use the standard 10 for various reasons.
97
+ * We need to match this priority so that the stylesheets load in the correct order.
98
+ */
99
+ echo 'BEGIN CTC IRREGULAR' . LF;
100
+ // Iterate through all the added hook priorities
101
+ foreach ( $wp_filter[ 'wp_enqueue_scripts' ] as $priority => $arr ):
102
+ // If this is a non-standard priority hook, determine which handles are being enqueued.
103
+ // These will then be compared to the primary handle ( style.css )
104
+ // to determine the enqueue priority to use for the parent stylesheet.
105
+ if ( $priority != 10 ):
106
+ // iterate through each hook in this priority group
107
+ foreach ( $arr as $funcarr ):
108
+ // clear the queue
109
+ $wp_styles->queue = array();
110
+ // now call the hooked function to populate the queue
111
+ if ( !is_null($funcarr['function']) )
112
+ call_user_func_array( $funcarr[ 'function' ], array() );
113
+ endforeach;
114
+ // report the priority, and any handles that were added
115
+ if ( !empty( $wp_styles->queue ) )
116
+ echo $priority . ',' . implode( ",", $wp_styles->queue ) . LF;
117
+ endif;
118
+ endforeach;
119
+ echo 'END CTC IRREGULAR' . LF;
120
+ echo ']]>*/</script>' . LF;
121
+ }
122
+
123
+ // enqueue dummy stylesheet with extremely high priority to test wp_head()
124
+ public function test_css() {
125
+ wp_enqueue_style( 'ctc-test', get_stylesheet_directory_uri() . '/ctc-test.css' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  }
127
 
128
+ public function woocommerce_unforce_ssl_checkout( $bool ){
129
+ return FALSE;
130
+ }
131
 
132
+ public function wp_redirect_status( $status ) {
133
+ return 200;
134
+ }
135
+
136
+ public function is_theme_active() {
137
+ return $this->get_stylesheet() == $this->original_stylesheet;
138
+ }
139
+
140
+ public function get_template() {
141
+ return $this->theme()->get_template();
142
+ }
143
+
144
+ public function get_stylesheet() {
145
+ return $this->theme()->get_stylesheet();
146
+ }
147
+
148
+
149
+ public function theme() {
150
+ return $this->theme;
151
+ }
152
+
153
+ }
154
+
155
+ new ChildThemeConfiguratorPreview();
includes/class-ctc-ui.php CHANGED
@@ -2,10 +2,10 @@
2
  // Exit if accessed directly
3
  if ( !defined( 'ABSPATH' ) ) exit;
4
  /*
5
- Class: Child_Theme_Configurator_UI
6
  Plugin URI: http://www.childthemeconfigurator.com/
7
  Description: Handles the plugin User Interface
8
- Version: 2.0.5
9
  Author: Lilaea Media
10
  Author URI: http://www.lilaeamedia.com/
11
  Text Domain: chld_thm_cfg
@@ -20,32 +20,30 @@ class ChildThemeConfiguratorUI {
20
  var $colors;
21
 
22
  function __construct() {
23
- add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 99 );
 
24
  add_filter( 'chld_thm_cfg_files_tab_filter', array( $this, 'render_files_tab_options' ) );
25
  add_action( 'chld_thm_cfg_tabs', array( $this, 'render_addl_tabs' ), 10, 4 );
26
  add_action( 'chld_thm_cfg_panels', array( $this, 'render_addl_panels' ), 10, 4 );
27
- add_action( 'chld_thm_cfg_related_links', array( $this, 'lilaea_plug' ) );
 
 
 
28
  add_action( 'admin_notices', array( $this, 'get_colors' ) );
29
- // temporary hook until Pro is updated
30
  add_filter( 'chld_thm_cfg_localize_array', array( $this, 'filter_localize_array' ) );
31
- if ( $this->ctc()->is_debug )
32
- //$this->ctc()->debug( 'adding new debug action...', __FUNCTION__ );
33
- add_action( 'chld_thm_cfg_print_debug', array( $this->ctc(), 'print_debug' ) );
34
  $this->swatch_txt = __( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', 'child-theme-configurator' );
35
  }
 
36
  // helper function to globalize ctc object
37
  function ctc() {
38
  return ChildThemeConfigurator::ctc();
39
  }
 
40
  function css() {
41
  return ChildThemeConfigurator::ctc()->css;
42
  }
43
- function get_colors(){
44
- global $_wp_admin_css_colors;
45
- $user_admin_color = get_user_meta( get_current_user_id(), 'admin_color', TRUE );
46
- $this->colors = $_wp_admin_css_colors[ $user_admin_color ]->colors;
47
-
48
- }
49
  function render() {
50
  // load web fonts for this theme
51
  if ( $imports = $this->css()->get_prop( 'imports' ) ):
@@ -56,9 +54,9 @@ class ChildThemeConfiguratorUI {
56
  endif;
57
  $themes = $this->ctc()->themes;
58
  $child = $this->css()->get_prop( 'child' );
59
- $hidechild = ( count( $themes[ 'child' ] ) ? '' : 'style="display:none"' );
60
  $enqueueset = ( isset( $this->css()->enqueue ) && $child );
61
- $this->ctc()->debug( 'Enqueue set: ' . ( $enqueueset ? 'TRUE' : 'FALSE' ), __FUNCTION__ );
62
  $imports = $this->css()->get_prop( 'imports' );
63
  $id = 0;
64
  $this->ctc()->fs_method = get_filesystem_method();
@@ -66,48 +64,52 @@ class ChildThemeConfiguratorUI {
66
  include ( CHLD_THM_CFG_DIR . '/includes/forms/main.php' );
67
  }
68
 
69
- function render_theme_menu( $template = 'child', $selected = NULL ) {
70
-
71
- ?>
72
- <select class="ctc-select" id="ctc_theme_<?php echo $template; ?>" name="ctc_theme_<?php echo $template; ?>"
73
- style="visibility:hidden" <?php echo $this->ctc()->is_theme() ? '' : ' disabled '; ?> autocomplete="off" >
74
- <?php
75
- uasort( $this->ctc()->themes[ $template ], array( $this, 'cmp_theme' ) );
76
- foreach ( $this->ctc()->themes[ $template ] as $slug => $theme )
77
- echo '<option value="' . $slug . '"' . ( $slug == $selected ? ' selected' : '' ) . '>'
78
- . esc_attr( $theme[ 'Name' ] ) . '</option>' . LF;
79
- ?>
80
- </select>
81
- <div style="display:none">
82
- <?php
83
- foreach ( $this->ctc()->themes[ $template ] as $slug => $theme )
84
- include ( CHLD_THM_CFG_DIR . '/includes/forms/themepreview.php' ); ?>
85
- </div>
86
- <?php
87
  }
88
 
89
- function cmp_theme( $a, $b ) {
90
- return strcmp( strtolower( $a[ 'Name' ] ), strtolower( $b[ 'Name' ] ) );
91
  }
92
-
 
 
 
 
 
 
 
 
 
 
 
 
93
  function render_file_form( $template = 'parnt' ) {
94
  global $wp_filesystem;
95
  if ( $theme = $this->ctc()->css->get_prop( $template ) ):
96
  $themeroot = trailingslashit( get_theme_root() ) . trailingslashit( $theme );
97
- $files = $this->ctc()->get_files( $theme );
 
 
 
 
 
 
 
 
 
 
 
 
98
  $counter = 0;
99
  sort( $files );
100
  ob_start();
101
  foreach ( $files as $file ):
102
- $templatefile = preg_replace( '%\.php$%', '', $file );
103
  include ( CHLD_THM_CFG_DIR . '/includes/forms/file.php' );
104
  endforeach;
105
- if ( 'child' == $template && ( $backups = $this->ctc()->get_files( $theme, 'backup,pluginbackup' ) ) ):
106
- foreach ( $backups as $backup => $label ):
107
- $templatefile = preg_replace( '%\.css$%', '', $backup );
108
- include ( CHLD_THM_CFG_DIR . '/includes/forms/backup.php' );
109
- endforeach;
110
- endif;
111
  $inputs = ob_get_contents();
112
  ob_end_clean();
113
  if ( $counter ):
@@ -137,48 +139,8 @@ class ChildThemeConfiguratorUI {
137
  endif;
138
  }
139
 
140
- function get_theme_screenshot() {
141
-
142
- foreach ( array_keys( $this->ctc()->imgmimes ) as $extreg ):
143
- foreach ( explode( '|', $extreg ) as $ext ):
144
- if ( $screenshot = $this->ctc()->css->is_file_ok( $this->ctc()->css->get_child_target( 'screenshot.' . $ext ) ) ):
145
- $screenshot = trailingslashit( get_theme_root_uri() ) . $this->ctc()->theme_basename( '', $screenshot );
146
- return $screenshot . '?' . time();
147
- endif;
148
- endforeach;
149
- endforeach;
150
- return FALSE;
151
- }
152
-
153
- function settings_errors() {
154
-
155
- if ( count( $this->ctc()->errors ) ):
156
- echo '<div class="error notice is-dismissible"><ul>' . LF;
157
- foreach ( $this->ctc()->errors as $err ):
158
- echo '<li>' . $err . '</li>' . LF;
159
- endforeach;
160
- echo '</ul></div>' . LF;
161
- elseif ( isset( $_GET[ 'updated' ] ) ):
162
- $child_theme = wp_get_theme( $this->ctc()->css->get_prop( 'child' ) );
163
- echo '<div class="updated notice is-dismissible">' . LF;
164
- if ( 8 == $_GET[ 'updated' ] ):
165
- echo '<p>' . __( 'Child Theme files modified successfully.', 'child-theme-configurator' ) . '</p>' . LF;
166
- elseif ( 4 == $_GET[ 'updated' ] ):
167
- echo '<p>' . sprintf( __( 'Child Theme <strong>%s</strong> has been reset. Please configure it using the settings below.', 'child-theme-configurator' ), $child_theme->Name ) . '</p>' . LF;
168
- else:
169
- echo '<p class="ctc-success-response">' . apply_filters( 'chld_thm_cfg_update_msg', sprintf( __( 'Child Theme <strong>%s</strong> has been generated successfully.', 'child-theme-configurator' ), $child_theme->Name ), $this->ctc() ) . LF;
170
- if ( $this->ctc()->is_theme() ):
171
- echo '<strong>' . __( 'IMPORTANT:', 'child-theme-configurator' ) . LF;
172
- if ( is_multisite() && !$child_theme->is_allowed() ):
173
- echo 'You must <a href="' . network_admin_url( '/themes.php' ) . '" title="' . __( 'Go to Themes', 'child-theme-configurator' ) . '" class="ctc-live-preview">' . __( 'Network enable', 'child-theme-configurator' ) . '</a> ' . __( 'your child theme.', 'child-theme-configurator' );
174
- else:
175
- echo '<a href="' . admin_url( '/customize.php?theme=' . $this->ctc()->css->get_prop( 'child' ) ) . '" title="' . __( 'Live Preview', 'child-theme-configurator' ) . '" class="ctc-live-preview">' . __( 'Preview your child theme', 'child-theme-configurator' ) . '</a> ' . __( 'before activating.', 'child-theme-configurator' );
176
- endif;
177
- echo '</strong></p>' . LF;
178
- endif;
179
- endif;
180
- echo '</div>' . LF;
181
- endif;
182
  }
183
 
184
  function render_help_content() {
@@ -225,15 +187,15 @@ class ChildThemeConfiguratorUI {
225
  endif;
226
  }
227
 
228
- function render_addl_tabs( $ctc, $active_tab = NULL, $hidechild = '' ) {
229
  include ( CHLD_THM_CFG_DIR . '/includes/forms/addl_tabs.php' );
230
  }
231
 
232
- function render_addl_panels( $ctc, $active_tab = NULL, $hidechild = '' ) {
233
  include ( CHLD_THM_CFG_DIR . '/includes/forms/addl_panels.php' );
234
  }
235
 
236
- function lilaea_plug() {
237
  include ( CHLD_THM_CFG_DIR . '/includes/forms/related.php' );
238
  }
239
 
@@ -243,6 +205,27 @@ class ChildThemeConfiguratorUI {
243
  return $output;
244
  }
245
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
246
  function enqueue_scripts() {
247
  wp_enqueue_style( 'chld-thm-cfg-admin', CHLD_THM_CFG_URL . 'css/chldthmcfg.css', array(), CHLD_THM_CFG_VERSION );
248
 
@@ -257,6 +240,7 @@ class ChildThemeConfiguratorUI {
257
  wp_enqueue_script( 'chld-thm-cfg-spectrum', CHLD_THM_CFG_URL . 'js/spectrum.min.js', array( 'jquery' ), FALSE, TRUE );
258
  wp_enqueue_script( 'chld-thm-cfg-ctcgrad', CHLD_THM_CFG_URL . 'js/ctcgrad.min.js', array( 'jquery' ), FALSE, TRUE );
259
  wp_enqueue_script( 'chld-thm-cfg-admin', CHLD_THM_CFG_URL . 'js/chldthmcfg' . ( $this->ctc()->is_debug ? '' : '.min' ) . '.js',
 
260
  array(
261
  'jquery-ui-autocomplete',
262
  'jquery-ui-selectmenu',
@@ -265,23 +249,23 @@ class ChildThemeConfiguratorUI {
265
  ), FALSE, TRUE );
266
 
267
  $localize_array = apply_filters( 'chld_thm_cfg_localize_script', array(
268
- 'converted' => $this->css()->get_prop( 'converted' ),
269
- 'ssl' => is_ssl(),
270
- 'homeurl' => get_home_url() . '?preview_ctc=' . wp_create_nonce(),
271
- 'ajaxurl' => admin_url( 'admin-ajax.php' ),
272
- 'theme_uri' => get_theme_root_uri(),
273
- 'page' => CHLD_THM_CFG_MENU,
274
- 'themes' => $this->ctc()->themes,
275
- 'source' => apply_filters( 'chld_thm_cfg_source_uri', get_theme_root_uri() . '/'
276
- . $this->css()->get_prop( 'parnt' ) . '/style.css', $this->css() ),
277
- 'target' => apply_filters( 'chld_thm_cfg_target_uri', get_theme_root_uri() . '/'
278
- . $this->css()->get_prop( 'child' ) . '/style.css', $this->css() ),
279
- 'parnt' => $this->css()->get_prop( 'parnt' ),
280
- 'child' => $this->css()->get_prop( 'child' ),
281
- 'addl_css' => $this->css()->get_prop( 'addl_css' ),
282
- 'imports' => $this->css()->get_prop( 'imports' ),
283
- 'converted' => $this->css()->get_prop( 'converted' ),
284
- 'is_debug' => $this->ctc()->is_debug,
285
  '_background_url_txt' => __( 'URL/None', 'child-theme-configurator' ),
286
  '_background_origin_txt' => __( 'Origin', 'child-theme-configurator' ),
287
  '_background_color1_txt' => __( 'Color 1', 'child-theme-configurator' ),
@@ -289,58 +273,59 @@ class ChildThemeConfiguratorUI {
289
  '_border_width_txt' => __( 'Width/None', 'child-theme-configurator' ),
290
  '_border_style_txt' => __( 'Style', 'child-theme-configurator' ),
291
  '_border_color_txt' => __( 'Color', 'child-theme-configurator' ),
292
- 'swatch_txt' => $this->swatch_txt,
293
- 'load_txt' => __( 'Are you sure you wish to RESET? This will destroy any work you have done in the Configurator.', 'child-theme-configurator' ),
294
- 'important_txt' => __( '<span style="font-size:10px">!</span>', 'child-theme-configurator' ),
295
- 'selector_txt' => __( 'Selectors', 'child-theme-configurator' ),
296
- 'close_txt' => __( 'Close', 'child-theme-configurator' ),
297
- 'edit_txt' => __( 'Edit Selector', 'child-theme-configurator' ),
298
- 'cancel_txt' => __( 'Cancel', 'child-theme-configurator' ),
299
- 'rename_txt' => __( 'Rename', 'child-theme-configurator' ),
300
- 'css_fail_txt' => __( 'The stylesheet cannot be displayed.', 'child-theme-configurator' ),
301
- 'child_only_txt' => __( '(Child Only)', 'child-theme-configurator' ),
302
- 'inval_theme_txt' => __( 'Please enter a valid Child Theme.', 'child-theme-configurator' ),
303
- 'inval_name_txt' => __( 'Please enter a valid Child Theme name.', 'child-theme-configurator' ),
304
- 'theme_exists_txt' => __( '<strong>%s</strong> exists. Please enter a different Child Theme', 'child-theme-configurator' ),
305
- 'js_txt' => __( 'The page could not be loaded correctly.', 'child-theme-configurator' ),
306
- 'jquery_txt' => __( 'Conflicting or out-of-date jQuery libraries were loaded by another plugin:', 'child-theme-configurator' ),
307
- 'plugin_txt' => __( 'Deactivating or replacing plugins may resolve this issue.', 'child-theme-configurator' ),
308
- 'contact_txt' => sprintf( __( '%sWhy am I seeing this?%s', 'child-theme-configurator' ),
309
  '<a target="_blank" href="' . CHLD_THM_CFG_DOCS_URL . '/how-to-use/#script_dep">',
310
  '</a>' ),
311
- 'nosels_txt' => __( 'No Styles Available. Check Parent/Child settings.', 'child-theme-configurator' ),
312
- 'anlz1_txt' => __( 'Updating', 'child-theme-configurator' ),
313
- 'anlz2_txt' => __( 'Checking', 'child-theme-configurator' ),
314
- 'anlz3_txt' => __( 'The theme "%s" generated unexpected PHP debug output.', 'child-theme-configurator' ),
315
- 'anlz4_txt' => __( 'The theme "%s" could not be analyzed because the preview did not render correctly.', 'child-theme-configurator' ),
316
- 'anlz5_txt' => __( '<p>You can still generate a child theme by manually selecting the settings below, but there will be no baseline styles available in the Configurator.</strong></p><p>You might try temporarily disabling plugins that <strong>minify CSS</strong> or that <strong>force redirects between HTTP and HTTPS</strong> and try analyzing again.</p>', 'child-theme-configurator' ),
317
- 'anlz6_txt' => __( 'Show Debug Output', 'child-theme-configurator' ),
318
- 'anlz7_txt' => __( "<p>Please contact this Theme's author and report the items above. You may or may not be able to use this Theme as a Child Theme while these conditions exist.</p><p>It is possible that this theme has specific requirements to work correctly as a child theme. Please make sure you are using the latest version of this theme and check your theme's documentation for more information.</p>", 'child-theme-configurator' ),
319
- 'anlz8_txt' => __( 'Do Not Activate "%s"! A PHP FATAL ERROR has been detected.', 'child-theme-configurator' ),
320
- 'anlz9_txt' => __( 'This theme loads stylesheets after the wp_styles queue.', 'child-theme-configurator' ),
321
- 'anlz10_txt' => __( '<p>This makes it difficult for plugins to override these styles. You can try to resolve this using the "Repair header template" option (Step 6, "Additional handling options", below).</p>', 'child-theme-configurator' ),
322
- 'anlz11_txt' => __( "This theme loads the parent theme's <code>style.css</code> file outside the wp_styles queue.", 'child-theme-configurator' ),
323
- 'anlz12_txt' => __( '<p>This is common with older themes but requires the use of <code>@import</code>, which is no longer recommended. You can try to resolve this using the "Repair header template" option (see step 6, "Additional handling options", below).</p>', 'child-theme-configurator' ),
324
- 'anlz13_txt' => __( 'This child theme does not load a Configurator stylesheet.', 'child-theme-configurator' ),
325
- 'anlz14_txt' => __( '<p>If you want to customize styles using this plugin, please click "Configure Child Theme" again to add this to the settings.</p>', 'child-theme-configurator' ),
326
- 'anlz15_txt' => __( "This child theme uses the parent stylesheet but does not load the parent theme's <code>style.css</code> file.", 'child-theme-configurator' ),
327
- 'anlz16_txt' => __( '<p>Please select a stylesheet handling method or check "Ignore parent theme stylesheets" (see step 6, below).</p>', 'child-theme-configurator' ),
328
- 'anlz17_txt' => __( 'This child theme appears to be functioning correctly.', 'child-theme-configurator' ),
329
- 'anlz18_txt' => __( 'This theme appears OK to use as a Child theme.', 'child-theme-configurator' ),
330
- 'anlz19_txt' => __( 'This Child Theme has not been configured for this plugin.', 'child-theme-configurator' ),
331
- 'anlz20_txt' => __( '<p>The Configurator makes significant modifications to the child theme, including stylesheet changes and additional php functions. Please consider using the DUPLICATE child theme option (see step 1, above) and keeping the original as a backup.</p>', 'child-theme-configurator' ),
332
- 'anlz21_txt' => __( "This child theme uses <code>@import</code> to load the parent theme's <code>style.css</code> file.", 'child-theme-configurator' ),
333
- 'anlz22_txt' => __( '<p>Please consider selecting "Use the WordPress style queue" for the parent stylesheet handling option (see step 6, below).</p>', 'child-theme-configurator' ),
334
- 'anlz23_txt' => __( 'This theme loads additional stylesheets after the <code>style.css</code> file:', 'child-theme-configurator' ),
335
- 'anlz24_txt' => __( '<p>Consider saving new custom styles to a "Separate stylesheet" (see step 5, below) so that you can customize these styles.</p>', 'child-theme-configurator' ),
336
- 'anlz25_txt' => __( "The parent theme's <code>style.css</code> file is being loaded automatically.", 'child-theme-configurator' ),
337
- 'anlz26_txt' => __( '<p>The Configurator selected "Do not add any parent stylesheet handling" for the "Parent stylesheet handling" option (see step 6, below).</p>', 'child-theme-configurator' ),
338
- 'anlz27_txt' => __( "This theme does not require the parent theme's <code>style.css</code> file for its appearance.", 'child-theme-configurator' ),
339
- 'anlz28_txt' => __( "This Child Theme was configured with an earlier version.", 'child-theme-configurator' ),
340
- 'anlz29_txt' => __( '<p>The selected stylesheet handling method is no longer used. Please update the configuration using the "Repair header template" option (see step 6, "Additional handling options", below).</p>', 'child-theme-configurator' ),
341
- 'anlz30_txt' => __( 'Show Analysis Object', 'child-theme-configurator' ),
342
- 'anlz31_txt' => __( 'This child theme was configured using the CTC Pro "Genesis stylesheet handling" method.', 'child-theme-configurator' ),
343
- 'anlz32_txt' => __( '<p>This method has been replaced by the "Separate stylesheet" and "Ignore Parent Theme" options ( selected below ) for broader framework compatability.</p>', 'child-theme-configurator' ),
 
344
  ) );
345
  wp_localize_script(
346
  'chld-thm-cfg-admin',
@@ -353,84 +338,6 @@ class ChildThemeConfiguratorUI {
353
  $arr[ 'pluginmode' ] = !$this->ctc()->is_theme();
354
  return $arr;
355
  }
356
- function notices( $msg ) {
357
- ?>
358
- <div class="notice-warning notice is-dismissible<?php echo ( 'upgrade' == $msg ? ' ctc-upgrade-notice' : '' ); ?>" style="display:block"><?php
359
- switch( $msg ):
360
-
361
- case 'writable': ?>
362
-
363
- <p class="ctc-section-toggle" id="ctc_perm_options"><?php _e( 'The child theme is in read-only mode and Child Theme Configurator cannot apply changes. Click to see options', 'child-theme-configurator' ); ?></p><div class="ctc-section-toggle-content" id="ctc_perm_options_content"><p><ol><?php
364
- $ctcpage = apply_filters( 'chld_thm_cfg_admin_page', CHLD_THM_CFG_MENU );
365
- if ( 'WIN' != substr( strtoupper( PHP_OS ), 0, 3 ) ):
366
- _e( '<li>Temporarily set write permissions by clicking the button below. When you are finished editing, revert to read-only by clicking "Make read-only" under the "Files" tab.</li>', 'child-theme-configurator' );
367
- ?><form action="?page=<?php echo $ctcpage; ?>" method="post">
368
- <?php wp_nonce_field( apply_filters( 'chld_thm_cfg_action', 'ctc_update' ) ); ?>
369
- <input name="ctc_set_writable" class="button" type="submit" value="<?php _e( 'Make files writable', 'child-theme-configurator' ); ?>"/></form><?php endif;
370
- _e( '<li><a target="_blank" href="http://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants" title="Editin wp-config.php">Add your FTP/SSH credentials to the WordPress config file</a>.</li>', 'child-theme-configurator' );
371
- if ( isset( $_SERVER[ 'SERVER_SOFTWARE' ] ) && preg_match( '%iis%i',$_SERVER[ 'SERVER_SOFTWARE' ] ) )
372
- _e( '<li><a target="_blank" href="http://technet.microsoft.com/en-us/library/cc771170" title="Setting Application Pool Identity">Assign WordPress to an application pool that has write permissions</a> (Windows IIS systems).</li>', 'child-theme-configurator' );
373
- _e( '<li><a target="_blank" href="http://codex.wordpress.org/Changing_File_Permissions" title="Changing File Permissions">Set write permissions on the server manually</a> (not recommended).</li>', 'child-theme-configurator' );
374
- if ( 'WIN' != substr( strtoupper( PHP_OS ), 0, 3 ) ):
375
- _e( '<li>Run PHP under Apache with suEXEC (contact your web host).</li>', 'child-theme-configurator' );
376
- endif; ?>
377
- </ol></p></div><?php
378
- break;
379
-
380
-
381
- case 'owner':
382
-
383
- $ctcpage = apply_filters( 'chld_thm_cfg_admin_page', CHLD_THM_CFG_MENU ); // FIXME? ?>
384
- <p><?php _e( 'This Child Theme has incorrect ownership permissions. Child Theme Configurator will attempt to correct this when you click the button below.', 'child-theme-configurator' ) ?></p>
385
- <p><form action="?page=<?php echo $ctcpage; ?>" method="post"><?php
386
- wp_nonce_field( apply_filters( 'chld_thm_cfg_action', 'ctc_update' ) ); ?>
387
- <input name="ctc_reset_permission" class="button" type="submit" value="<?php _e( 'Correct Child Theme Permissions', 'child-theme-configurator' ); ?>"/></form></p><?php
388
- break;
389
-
390
-
391
- case 'enqueue': ?>
392
-
393
- <p><?php _e( 'Child Theme Configurator needs to update its internal data. Please set your preferences below and click "Generate Child Theme Files" to update your configuration.', 'child-theme-configurator' ) ?></p><?php
394
- break;
395
-
396
-
397
- case 'max_styles':
398
-
399
- echo sprintf( __( '<strong>However, some styles could not be parsed due to memory limits.</strong> Try deselecting "Additional Stylesheets" below and click "Generate/Rebuild Child Theme Files". %sWhy am I seeing this?%s', 'child-theme-configurator' ),
400
- '<a target="_blank" href="' . LILAEAMEDIA_URL . '/child-theme-configurator#php_memory">',
401
- '</a>' );
402
- break;
403
-
404
-
405
- case 'config': ?>
406
-
407
- <p><?php _e( 'Child Theme Configurator did not detect any configuration data because a previously configured Child Theme has been removed. Please follow the steps for "CONFIGURE an existing Child Theme" under the "Parent/Child" Tab.', 'child-theme-configurator' ) ?></p><?php
408
- break;
409
-
410
-
411
- case 'changed': ?>
412
-
413
- <p><?php _e( 'Your stylesheet has changed since the last time you used the Configurator. Please follow the steps for "CONFIGURE an existing Child Theme" under the "Parent/Child" Tab or you will lose these changes.', 'child-theme-configurator' ) ?></p><?php
414
- break;
415
-
416
-
417
- case 'upgrade':
418
- $child = $this->css()->get_prop( 'child' );
419
- ?>
420
-
421
- <?php if ( $child ): ?>
422
- <div class="clearfix">
423
- <?php endif; ?>
424
- <h3><?php _e( 'This version of Child Theme Configurator includes significant updates.', 'child-theme-configurator' ); ?></h3>
425
- <p class="howto"><?php _e( 'A lot of time and testing has gone into this release but there are always edge cases. If you have any questions, please', 'child-theme-configurator' ); ?> <a href="<?php echo LILAEAMEDIA_URL; ?>/contact" target="_blank"><?php _e( 'Contact Us.', 'child-theme-configurator' ); ?></a></p>
426
- <p class="howto"><?php _e( 'For more information, please open the Help tab at the top right or ', 'child-theme-configurator' ) ?> <a href="http://www.childthemeconfigurator.com/tutorial-videos/" target="_blank"><?php _e( 'click here to view the latest videos.', 'child-theme-configurator' ); ?></a></p>
427
- <?php if ( $child ): ?>
428
- <p><?php _e( 'It is a good idea to save a Zip Archive of your Child Theme before using this version for the first time. Click "Export Zip" ( see Step 3, below ) to backup your themes.', 'child-theme-configurator' ); ?></p>
429
- </div>
430
- <?php endif; ?>
431
- <?php endswitch; ?>
432
- </div><?php
433
- }
434
-
435
  }
436
  ?>
2
  // Exit if accessed directly
3
  if ( !defined( 'ABSPATH' ) ) exit;
4
  /*
5
+ Class: ChildThemeConfiguratorUI
6
  Plugin URI: http://www.childthemeconfigurator.com/
7
  Description: Handles the plugin User Interface
8
+ Version: 2.1.0
9
  Author: Lilaea Media
10
  Author URI: http://www.lilaeamedia.com/
11
  Text Domain: chld_thm_cfg
20
  var $colors;
21
 
22
  function __construct() {
23
+ // always load dict_sel for UI
24
+ $this->css()->load_config( 'dict_sel' );
25
  add_filter( 'chld_thm_cfg_files_tab_filter', array( $this, 'render_files_tab_options' ) );
26
  add_action( 'chld_thm_cfg_tabs', array( $this, 'render_addl_tabs' ), 10, 4 );
27
  add_action( 'chld_thm_cfg_panels', array( $this, 'render_addl_panels' ), 10, 4 );
28
+ add_action( 'chld_thm_cfg_related_links', array( $this, 'render_lilaea_plug' ) );
29
+ add_action( 'chld_thm_cfg_before_tabs', array( $this, 'render_current_theme' ), 5 );
30
+ add_action( 'chld_thm_cfg_before_tabs', array( $this, 'render_debug_toggle' ), 100 );
31
+ add_action( 'chld_thm_cfg_file_form_buttons', array( $this, 'render_file_form_buttons' ), 10, 1 );
32
  add_action( 'admin_notices', array( $this, 'get_colors' ) );
33
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 99 );
34
  add_filter( 'chld_thm_cfg_localize_array', array( $this, 'filter_localize_array' ) );
 
 
 
35
  $this->swatch_txt = __( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', 'child-theme-configurator' );
36
  }
37
+
38
  // helper function to globalize ctc object
39
  function ctc() {
40
  return ChildThemeConfigurator::ctc();
41
  }
42
+
43
  function css() {
44
  return ChildThemeConfigurator::ctc()->css;
45
  }
46
+
 
 
 
 
 
47
  function render() {
48
  // load web fonts for this theme
49
  if ( $imports = $this->css()->get_prop( 'imports' ) ):
54
  endif;
55
  $themes = $this->ctc()->themes;
56
  $child = $this->css()->get_prop( 'child' );
57
+ $hidechild = apply_filters( 'chld_thm_cfg_hidechild', ( count( $themes[ 'child' ] ) ? '' : 'style="display:none"' ) );
58
  $enqueueset = ( isset( $this->css()->enqueue ) && $child );
59
+ $this->ctc()->debug( 'Enqueue set: ' . ( $enqueueset ? 'TRUE' : 'FALSE' ), __FUNCTION__, __CLASS__ );
60
  $imports = $this->css()->get_prop( 'imports' );
61
  $id = 0;
62
  $this->ctc()->fs_method = get_filesystem_method();
64
  include ( CHLD_THM_CFG_DIR . '/includes/forms/main.php' );
65
  }
66
 
67
+ function get_colors(){
68
+ global $_wp_admin_css_colors;
69
+ $user_admin_color = get_user_meta( get_current_user_id(), 'admin_color', TRUE );
70
+ $this->colors = $_wp_admin_css_colors[ $user_admin_color ]->colors;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  }
72
 
73
+ function render_current_theme(){
74
+ include ( CHLD_THM_CFG_DIR . '/includes/forms/current-theme.php' );
75
  }
76
+
77
+ function render_debug_toggle(){
78
+ include ( CHLD_THM_CFG_DIR . '/includes/forms/debug-toggle.php' );
79
+ }
80
+
81
+ function render_file_form_buttons( $template ){
82
+ include ( CHLD_THM_CFG_DIR . '/includes/forms/file-form-buttons.php' );
83
+ }
84
+
85
+ function render_theme_menu( $template = 'child', $selected = NULL ) {
86
+ include ( CHLD_THM_CFG_DIR . '/includes/forms/theme-menu.php' );
87
+ }
88
+
89
  function render_file_form( $template = 'parnt' ) {
90
  global $wp_filesystem;
91
  if ( $theme = $this->ctc()->css->get_prop( $template ) ):
92
  $themeroot = trailingslashit( get_theme_root() ) . trailingslashit( $theme );
93
+ $files = $this->ctc()->get_files( $theme, 'child' == $template ? 'template,stylesheet,txt' : 'template' );
94
+ // This include is used for both parent template section and the child files section
95
+ $ctcpage = apply_filters( 'chld_thm_cfg_admin_page', CHLD_THM_CFG_MENU );
96
+
97
+ if ( defined( 'DISALLOW_FILE_EDIT' ) && DISALLOW_FILE_EDIT ):
98
+ $linktext = __( 'The Theme editor has been disabled. Template files must be edited offline.', 'child-theme-configurator' );
99
+ $editorbase = '';
100
+ $editorlink = '';
101
+ else:
102
+ $linktext = __( 'Click here to edit template files using the Theme Editor', 'child-theme-configurator' );
103
+ $editorbase = apply_filters( 'chld_thm_cfg_editor_base', ( is_multisite() ? network_admin_url( 'theme-editor.php' ) : admin_url( 'theme-editor.php' ) ) . '?' ) . 'theme=' . $this->ctc()->css->get_prop( 'child' );
104
+ $editorlink = '<a href="' . $editorbase . '&file=%s" title="%s">%s</a>';
105
+ endif;
106
  $counter = 0;
107
  sort( $files );
108
  ob_start();
109
  foreach ( $files as $file ):
110
+ $templatefile = $file; //preg_replace( '%\.php$%', '', $file );
111
  include ( CHLD_THM_CFG_DIR . '/includes/forms/file.php' );
112
  endforeach;
 
 
 
 
 
 
113
  $inputs = ob_get_contents();
114
  ob_end_clean();
115
  if ( $counter ):
139
  endif;
140
  }
141
 
142
+ function render_settings_errors() {
143
+ include ( CHLD_THM_CFG_DIR . '/includes/forms/settings-errors.php' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
  }
145
 
146
  function render_help_content() {
187
  endif;
188
  }
189
 
190
+ function render_addl_tabs( $active_tab = NULL, $hidechild = '' ) {
191
  include ( CHLD_THM_CFG_DIR . '/includes/forms/addl_tabs.php' );
192
  }
193
 
194
+ function render_addl_panels( $active_tab = NULL, $hidechild = '' ) {
195
  include ( CHLD_THM_CFG_DIR . '/includes/forms/addl_panels.php' );
196
  }
197
 
198
+ function render_lilaea_plug() {
199
  include ( CHLD_THM_CFG_DIR . '/includes/forms/related.php' );
200
  }
201
 
205
  return $output;
206
  }
207
 
208
+ function render_notices( $msg ) {
209
+ include ( CHLD_THM_CFG_DIR . '/includes/forms/notices.php' );
210
+ }
211
+
212
+ function get_theme_screenshot() {
213
+
214
+ foreach ( array_keys( $this->ctc()->imgmimes ) as $extreg ):
215
+ foreach ( explode( '|', $extreg ) as $ext ):
216
+ if ( $screenshot = $this->ctc()->css->is_file_ok( $this->ctc()->css->get_child_target( 'screenshot.' . $ext ) ) ):
217
+ $screenshot = trailingslashit( get_theme_root_uri() ) . $this->ctc()->theme_basename( '', $screenshot );
218
+ return $screenshot . '?' . time();
219
+ endif;
220
+ endforeach;
221
+ endforeach;
222
+ return FALSE;
223
+ }
224
+
225
+ function cmp_theme( $a, $b ) {
226
+ return strcmp( strtolower( $a[ 'Name' ] ), strtolower( $b[ 'Name' ] ) );
227
+ }
228
+
229
  function enqueue_scripts() {
230
  wp_enqueue_style( 'chld-thm-cfg-admin', CHLD_THM_CFG_URL . 'css/chldthmcfg.css', array(), CHLD_THM_CFG_VERSION );
231
 
240
  wp_enqueue_script( 'chld-thm-cfg-spectrum', CHLD_THM_CFG_URL . 'js/spectrum.min.js', array( 'jquery' ), FALSE, TRUE );
241
  wp_enqueue_script( 'chld-thm-cfg-ctcgrad', CHLD_THM_CFG_URL . 'js/ctcgrad.min.js', array( 'jquery' ), FALSE, TRUE );
242
  wp_enqueue_script( 'chld-thm-cfg-admin', CHLD_THM_CFG_URL . 'js/chldthmcfg' . ( $this->ctc()->is_debug ? '' : '.min' ) . '.js',
243
+ //wp_enqueue_script( 'chld-thm-cfg-admin', CHLD_THM_CFG_URL . 'js/chldthmcfg.js',
244
  array(
245
  'jquery-ui-autocomplete',
246
  'jquery-ui-selectmenu',
249
  ), FALSE, TRUE );
250
 
251
  $localize_array = apply_filters( 'chld_thm_cfg_localize_script', array(
252
+ 'converted' => $this->css()->get_prop( 'converted' ),
253
+ 'ssl' => is_ssl(),
254
+ 'homeurl' => get_home_url() . '?preview_ctc=' . wp_create_nonce(),
255
+ 'ajaxurl' => admin_url( 'admin-ajax.php' ),
256
+ 'theme_uri' => get_theme_root_uri(),
257
+ 'page' => CHLD_THM_CFG_MENU,
258
+ 'themes' => $this->ctc()->themes,
259
+ 'source' => apply_filters( 'chld_thm_cfg_source_uri', get_theme_root_uri() . '/'
260
+ . $this->css()->get_prop( 'parnt' ) . '/style.css', $this->css() ),
261
+ 'target' => apply_filters( 'chld_thm_cfg_target_uri', get_theme_root_uri() . '/'
262
+ . $this->css()->get_prop( 'child' ) . '/style.css', $this->css() ),
263
+ 'parnt' => $this->css()->get_prop( 'parnt' ),
264
+ 'child' => $this->css()->get_prop( 'child' ),
265
+ 'addl_css' => $this->css()->get_prop( 'addl_css' ),
266
+ 'imports' => $this->css()->get_prop( 'imports' ),
267
+ 'converted' => $this->css()->get_prop( 'converted' ),
268
+ 'is_debug' => $this->ctc()->is_debug,
269
  '_background_url_txt' => __( 'URL/None', 'child-theme-configurator' ),
270
  '_background_origin_txt' => __( 'Origin', 'child-theme-configurator' ),
271
  '_background_color1_txt' => __( 'Color 1', 'child-theme-configurator' ),
273
  '_border_width_txt' => __( 'Width/None', 'child-theme-configurator' ),
274
  '_border_style_txt' => __( 'Style', 'child-theme-configurator' ),
275
  '_border_color_txt' => __( 'Color', 'child-theme-configurator' ),
276
+ 'swatch_txt' => $this->swatch_txt,
277
+ 'load_txt' => __( 'Are you sure you wish to RESET? This will destroy any work you have done in the Configurator.', 'child-theme-configurator' ),
278
+ 'important_txt' => __( '<span style="font-size:10px">!</span>', 'child-theme-configurator' ),
279
+ 'selector_txt' => __( 'Selectors', 'child-theme-configurator' ),
280
+ 'close_txt' => __( 'Close', 'child-theme-configurator' ),
281
+ 'edit_txt' => __( 'Edit Selector', 'child-theme-configurator' ),
282
+ 'cancel_txt' => __( 'Cancel', 'child-theme-configurator' ),
283
+ 'rename_txt' => __( 'Rename', 'child-theme-configurator' ),
284
+ 'css_fail_txt' => __( 'The stylesheet cannot be displayed.', 'child-theme-configurator' ),
285
+ 'child_only_txt' => __( '(Child Only)', 'child-theme-configurator' ),
286
+ 'inval_theme_txt' => __( 'Please enter a valid Child Theme.', 'child-theme-configurator' ),
287
+ 'inval_name_txt' => __( 'Please enter a valid Child Theme name.', 'child-theme-configurator' ),
288
+ 'theme_exists_txt' => __( '<strong>%s</strong> exists. Please enter a different Child Theme', 'child-theme-configurator' ),
289
+ 'js_txt' => __( 'The page could not be loaded correctly.', 'child-theme-configurator' ),
290
+ 'jquery_txt' => __( 'Conflicting or out-of-date jQuery libraries were loaded by another plugin:', 'child-theme-configurator' ),
291
+ 'plugin_txt' => __( 'Deactivating or replacing plugins may resolve this issue.', 'child-theme-configurator' ),
292
+ 'contact_txt' => sprintf( __( '%sWhy am I seeing this?%s', 'child-theme-configurator' ),
293
  '<a target="_blank" href="' . CHLD_THM_CFG_DOCS_URL . '/how-to-use/#script_dep">',
294
  '</a>' ),
295
+ 'nosels_txt' => __( 'No Styles Available. Check Parent/Child settings.', 'child-theme-configurator' ),
296
+ 'anlz1_txt' => __( 'Updating', 'child-theme-configurator' ),
297
+ 'anlz2_txt' => __( 'Checking', 'child-theme-configurator' ),
298
+ 'anlz3_txt' => __( 'The theme "%s" generated unexpected PHP debug output.', 'child-theme-configurator' ),
299
+ 'anlz4_txt' => __( 'The theme "%s" could not be analyzed because the preview did not render correctly.', 'child-theme-configurator' ),
300
+ 'anlz5_txt' => sprintf( __( '<p>First, <a href="%s">refresh this page</a> and try analyzing again.</p><p>If that does not work, try temporarily disabling plugins that <strong>minify CSS</strong> or that <strong>force redirects between HTTP and HTTPS</strong>.</p>', 'child-theme-configurator' ), '?page=' . CHLD_THM_CFG_MENU ),
301
+ 'anlz6_txt' => __( 'Click to show/hide PHP debug output', 'child-theme-configurator' ),
302
+ 'anlz7_txt' => __( "<p>Please contact this Theme's author and report the items inside the box above. You may or may not be able to use this Theme as a Child Theme while these conditions exist.</p><p>It is possible that this theme has specific requirements to work correctly as a child theme. Please make sure you are using the latest version of this theme and check your theme's documentation for more information.</p>", 'child-theme-configurator' ),
303
+ 'anlz8_txt' => __( 'Do Not Activate "%s"! A PHP FATAL ERROR has been detected.', 'child-theme-configurator' ),
304
+ 'anlz9_txt' => __( 'This theme loads stylesheets after the wp_styles queue.', 'child-theme-configurator' ),
305
+ 'anlz10_txt' => __( '<p>This makes it difficult for plugins to override these styles. You can try to resolve this using the "Repair header template" option (Step 6, "Additional handling options", below).</p>', 'child-theme-configurator' ),
306
+ 'anlz11_txt' => __( "This theme loads the parent theme's <code>style.css</code> file outside the wp_styles queue.", 'child-theme-configurator' ),
307
+ 'anlz12_txt' => __( '<p>This is common with older themes but requires the use of <code>@import</code>, which is no longer recommended. You can try to resolve this using the "Repair header template" option (see step 6, "Additional handling options", below).</p>', 'child-theme-configurator' ),
308
+ 'anlz13_txt' => __( 'This child theme does not load a Configurator stylesheet.', 'child-theme-configurator' ),
309
+ 'anlz14_txt' => __( '<p>If you want to customize styles using this plugin, please click "Configure Child Theme" again to add this to the settings.</p>', 'child-theme-configurator' ),
310
+ 'anlz15_txt' => __( "This child theme uses the parent stylesheet but does not load the parent theme's <code>style.css</code> file.", 'child-theme-configurator' ),
311
+ 'anlz16_txt' => __( '<p>Please select a stylesheet handling method or check "Ignore parent theme stylesheets" (see step 6, below).</p>', 'child-theme-configurator' ),
312
+ 'anlz17_txt' => __( 'This child theme appears to be functioning correctly.', 'child-theme-configurator' ),
313
+ 'anlz18_txt' => __( 'This theme appears OK to use as a Child theme.', 'child-theme-configurator' ),
314
+ 'anlz19_txt' => __( 'This Child Theme has not been configured for this plugin.', 'child-theme-configurator' ),
315
+ 'anlz20_txt' => __( '<p>The Configurator makes significant modifications to the child theme, including stylesheet changes and additional php functions. Please consider using the DUPLICATE child theme option (see step 1, above) and keeping the original as a backup.</p>', 'child-theme-configurator' ),
316
+ 'anlz21_txt' => __( "This child theme uses <code>@import</code> to load the parent theme's <code>style.css</code> file.", 'child-theme-configurator' ),
317
+ 'anlz22_txt' => __( '<p>Please consider selecting "Use the WordPress style queue" for the parent stylesheet handling option (see step 6, below).</p>', 'child-theme-configurator' ),
318
+ 'anlz23_txt' => __( 'This theme loads additional stylesheets after the <code>style.css</code> file:', 'child-theme-configurator' ),
319
+ 'anlz24_txt' => __( '<p>Consider saving new custom styles to a "Separate stylesheet" (see step 5, below) so that you can customize these styles.</p>', 'child-theme-configurator' ),
320
+ 'anlz25_txt' => __( "The parent theme's <code>style.css</code> file is being loaded automatically.", 'child-theme-configurator' ),
321
+ 'anlz26_txt' => __( '<p>The Configurator selected "Do not add any parent stylesheet handling" for the "Parent stylesheet handling" option (see step 6, below).</p>', 'child-theme-configurator' ),
322
+ 'anlz27_txt' => __( "This theme does not require the parent theme's <code>style.css</code> file for its appearance.", 'child-theme-configurator' ),
323
+ 'anlz28_txt' => __( "This Child Theme was configured with an earlier version.", 'child-theme-configurator' ),
324
+ 'anlz29_txt' => __( '<p>The selected stylesheet handling method is no longer used. Please update the configuration using the "Repair header template" option (see step 6, "Additional handling options", below).</p>', 'child-theme-configurator' ),
325
+ 'anlz30_txt' => __( 'Click to show/hide analysis data. Please include contents below with any support requests.', 'child-theme-configurator' ),
326
+ 'anlz31_txt' => __( 'This child theme was configured using the CTC Pro "Genesis stylesheet handling" method.', 'child-theme-configurator' ),
327
+ 'anlz32_txt' => __( '<p>This method has been replaced by the "Separate stylesheet" and "Ignore Parent Theme" options ( selected below ) for broader framework compatability.</p>', 'child-theme-configurator' ),
328
+ 'anlz33_txt' => __( '<p>%1Click Here%2 to view the theme as viewed by the Analyzer.</p>', 'child-theme-configurator' ),
329
  ) );
330
  wp_localize_script(
331
  'chld-thm-cfg-admin',
338
  $arr[ 'pluginmode' ] = !$this->ctc()->is_theme();
339
  return $arr;
340
  }
341
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
342
  }
343
  ?>
includes/class-ctc.php CHANGED
@@ -3,48 +3,63 @@
3
  if ( !defined( 'ABSPATH' ) ) exit;
4
 
5
  class ChildThemeConfigurator {
 
6
  static $instance;
 
 
 
 
7
  static function init() {
8
 
9
  // verify WP version support
10
  global $wp_version;
11
- if ( version_compare( $wp_version, CHLD_THM_CFG_MIN_WP_VERSION ) < 0 ):
12
  add_action( 'admin_notices', 'ChildthemeConfigurator::version_notice' );
13
  return;
14
- endif;
 
15
  // setup admin hooks
16
  if ( is_multisite() )
17
  add_action( 'network_admin_menu', 'ChildThemeConfigurator::network_admin' );
18
  add_action( 'admin_menu', 'ChildThemeConfigurator::admin' );
 
 
 
19
  // setup ajax actions
20
  add_action( 'wp_ajax_ctc_update', 'ChildThemeConfigurator::save' );
21
  add_action( 'wp_ajax_ctc_query', 'ChildThemeConfigurator::query' );
22
  add_action( 'wp_ajax_ctc_dismiss', 'ChildThemeConfigurator::dismiss' );
23
  // initialize languages
24
  add_action( 'init', 'ChildThemeConfigurator::lang' );
 
 
 
25
  }
 
26
  static function ctc() {
27
  // create admin object
28
- global $chld_thm_cfg; /// backward compat
29
  if ( !isset( self::$instance ) ):
30
  include_once( CHLD_THM_CFG_DIR . '/includes/class-ctc-admin.php' );
31
  self::$instance = new ChildThemeConfiguratorAdmin( __FILE__ );
32
  endif;
33
- $chld_thm_cfg = self::$instance; // backward compat
34
  return self::$instance;
35
  }
 
36
  static function lang() {
37
  // initialize languages
38
  load_plugin_textdomain( 'child-theme-configurator', FALSE, basename( CHLD_THM_CFG_DIR ) . '/lang' );
39
  }
 
40
  static function save() {
41
  // ajax write
42
  self::ctc()->ajax_save_postdata();
43
  }
 
44
  static function query() {
45
  // ajax read
46
  self::ctc()->ajax_query_css();
47
- }
 
48
  static function network_admin() {
49
  $hook = add_theme_page(
50
  __( 'Child Theme Configurator', 'child-theme-configurator' ),
@@ -53,8 +68,9 @@ if ( !defined( 'ABSPATH' ) ) exit;
53
  CHLD_THM_CFG_MENU,
54
  'ChildThemeConfigurator::render'
55
  );
56
- add_action( 'load-' . $hook, 'ChildThemeConfigurator::page_init' );
57
  }
 
58
  static function admin() {
59
  $hook = add_management_page(
60
  __( 'Child Theme Configurator', 'child-theme-configurator' ),
@@ -66,37 +82,97 @@ if ( !defined( 'ABSPATH' ) ) exit;
66
  add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'ChildThemeConfigurator::action_links' );
67
  add_action( 'load-' . $hook, 'ChildThemeConfigurator::page_init' );
68
  }
 
69
  static function action_links( $actions ) {
70
  $actions[] = '<a href="' . admin_url( 'tools.php?page=' . CHLD_THM_CFG_MENU ). '">'
71
  . __( 'Child Themes', 'child-theme-configurator' ) . '</a>' . LF;
72
  return $actions;
73
  }
 
74
  static function page_init() {
75
  // start admin controller
76
  self::ctc()->ctc_page_init();
77
  }
 
78
  static function render() {
79
  // display admin page
80
  self::ctc()->render();
81
  }
 
82
  static function version_notice() {
83
  deactivate_plugins( plugin_basename( __FILE__ ) );
84
  unset( $_GET[ 'activate' ] );
85
- echo '<div class="notice-warning"><p>' .
86
  sprintf( __( 'Child Theme Configurator requires WordPress version %s or later.', 'child-theme-configurator' ),
87
  CHLD_THM_CFG_MIN_WP_VERSION ) . '</p></div>' . LF;
88
  }
 
89
  static function dismiss() {
90
  self::ctc()->ajax_dismiss_notice();
91
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  }
 
93
  defined( 'LILAEAMEDIA_URL' ) or
94
  define( 'LILAEAMEDIA_URL', "http://www.lilaeamedia.com" );
95
  defined( 'CHLD_THM_CFG_DOCS_URL' ) or
96
  define( 'CHLD_THM_CFG_DOCS_URL', "http://www.childthemeconfigurator.com" );
97
- define( 'CHLD_THM_CFG_VERSION', '2.0.5' );
98
  define( 'CHLD_THM_CFG_PREV_VERSION', '1.7.9.1' );
99
  define( 'CHLD_THM_CFG_MIN_WP_VERSION', '3.7' );
 
100
  defined( 'CHLD_THM_CFG_BPSEL' ) or
101
  define( 'CHLD_THM_CFG_BPSEL', '2500' );
102
  defined( 'CHLD_THM_CFG_MAX_RECURSE_LOOPS' ) or
3
  if ( !defined( 'ABSPATH' ) ) exit;
4
 
5
  class ChildThemeConfigurator {
6
+
7
  static $instance;
8
+ static $plugin = 'child-theme-configurator/child-theme-configurator.php';
9
+ static $oldpro = 'child-theme-configurator-plugins/child-theme-configurator-plugins.php';
10
+ static $ctcpro = 'child-theme-configurator-pro/child-theme-configurator-pro.php';
11
+
12
  static function init() {
13
 
14
  // verify WP version support
15
  global $wp_version;
16
+ if ( version_compare( $wp_version, CHLD_THM_CFG_MIN_WP_VERSION, '<' ) ):
17
  add_action( 'admin_notices', 'ChildthemeConfigurator::version_notice' );
18
  return;
19
+ endif;
20
+ add_action( 'admin_init', 'ChildThemeConfigurator::check_ctc_pro', 15 );
21
  // setup admin hooks
22
  if ( is_multisite() )
23
  add_action( 'network_admin_menu', 'ChildThemeConfigurator::network_admin' );
24
  add_action( 'admin_menu', 'ChildThemeConfigurator::admin' );
25
+ // add plugin upgrade notification
26
+ add_action( 'in_plugin_update_message-' . self::$plugin,
27
+ 'ChildThemeConfigurator::upgrade_notice', 10, 2 );
28
  // setup ajax actions
29
  add_action( 'wp_ajax_ctc_update', 'ChildThemeConfigurator::save' );
30
  add_action( 'wp_ajax_ctc_query', 'ChildThemeConfigurator::query' );
31
  add_action( 'wp_ajax_ctc_dismiss', 'ChildThemeConfigurator::dismiss' );
32
  // initialize languages
33
  add_action( 'init', 'ChildThemeConfigurator::lang' );
34
+ // prevent old Pro activation
35
+ if ( isset( $_GET[ 'action' ] ) && isset( $_GET[ 'plugin' ] ) && 'activate' == $_GET[ 'action' ] && self::$oldpro == $_GET[ 'plugin' ] )
36
+ unset( $_GET[ 'action' ] );
37
  }
38
+
39
  static function ctc() {
40
  // create admin object
 
41
  if ( !isset( self::$instance ) ):
42
  include_once( CHLD_THM_CFG_DIR . '/includes/class-ctc-admin.php' );
43
  self::$instance = new ChildThemeConfiguratorAdmin( __FILE__ );
44
  endif;
 
45
  return self::$instance;
46
  }
47
+
48
  static function lang() {
49
  // initialize languages
50
  load_plugin_textdomain( 'child-theme-configurator', FALSE, basename( CHLD_THM_CFG_DIR ) . '/lang' );
51
  }
52
+
53
  static function save() {
54
  // ajax write
55
  self::ctc()->ajax_save_postdata();
56
  }
57
+
58
  static function query() {
59
  // ajax read
60
  self::ctc()->ajax_query_css();
61
+ }
62
+
63
  static function network_admin() {
64
  $hook = add_theme_page(
65
  __( 'Child Theme Configurator', 'child-theme-configurator' ),
68
  CHLD_THM_CFG_MENU,
69
  'ChildThemeConfigurator::render'
70
  );
71
+ add_action( 'load-' . $hook, 'ChildThemeConfigurator::page_init' );
72
  }
73
+
74
  static function admin() {
75
  $hook = add_management_page(
76
  __( 'Child Theme Configurator', 'child-theme-configurator' ),
82
  add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'ChildThemeConfigurator::action_links' );
83
  add_action( 'load-' . $hook, 'ChildThemeConfigurator::page_init' );
84
  }
85
+
86
  static function action_links( $actions ) {
87
  $actions[] = '<a href="' . admin_url( 'tools.php?page=' . CHLD_THM_CFG_MENU ). '">'
88
  . __( 'Child Themes', 'child-theme-configurator' ) . '</a>' . LF;
89
  return $actions;
90
  }
91
+
92
  static function page_init() {
93
  // start admin controller
94
  self::ctc()->ctc_page_init();
95
  }
96
+
97
  static function render() {
98
  // display admin page
99
  self::ctc()->render();
100
  }
101
+
102
  static function version_notice() {
103
  deactivate_plugins( plugin_basename( __FILE__ ) );
104
  unset( $_GET[ 'activate' ] );
105
+ echo '<div class="notice-warning notice is-dismissible"><p>' .
106
  sprintf( __( 'Child Theme Configurator requires WordPress version %s or later.', 'child-theme-configurator' ),
107
  CHLD_THM_CFG_MIN_WP_VERSION ) . '</p></div>' . LF;
108
  }
109
+
110
  static function dismiss() {
111
  self::ctc()->ajax_dismiss_notice();
112
  }
113
+
114
+ static function upgrade_ctc_pro_notice() {
115
+ $key = 'unregistered';
116
+ if ( $options = get_site_option( CHLD_THM_CFG_OPTIONS ) )
117
+ $key = $options[ 'update_key' ];
118
+
119
+ $download = '<a href="' . LILAEAMEDIA_URL . '/ctc-pro-latest-version/' . ( empty( $key )
120
+ ? ''
121
+ : '?lilaea_update_key=' . $key ) . '" target="_blank">'
122
+ . __( 'Click here to download and save the latest version to your computer.', 'child-theme-configurator' ) . '</a>';
123
+
124
+ $install = '<a href="' . ( is_multisite()
125
+ ? network_admin_url( 'plugin-install.php?tab=upload' )
126
+ : admin_url( 'plugin-install.php?tab=upload' ) ) . '">'
127
+ . __( 'Click here to switch to the plugin install page.', 'child-theme-configurator' ) . '</a>';
128
+ ?>
129
+ <div class="notice-warning notice is-dismissible">
130
+ <p><?php printf( __( 'Child Theme Configurator Pro version %s is not compatible with this version of Child Theme Configurator and has been deactivated.'), CHLD_THM_CFG_PLUGINS_VERSION ); ?></p>
131
+ <p><strong><?php _e( 'Please follow these steps carefully to upgrade to the latest version.', 'child-theme-configurator' ); ?></strong></p>
132
+ <ol><li><?php _e( 'DO NOT DELETE THE EXISTING PRO PLUGIN or you will lose your settings.', 'child-theme-configurator' ); ?></li>
133
+ <li><?php echo $download; ?></li>
134
+ <li><?php echo $install; ?></li>
135
+ <li><?php printf( __( 'Click the "Browse" button in the center of the page (NOT the button at the top) and select the "%s" file from your computer.', 'child-theme-configurator' ), 'child-theme-configurator-pro-' . CHLD_THM_CFG_PRO_MIN_VERSION . '.zip' ); ?></li>
136
+ <li><?php _e( 'Click "Install Now."', 'child-theme-configurator' ); ?></li>
137
+ <li><?php _e( 'Click "Activate Plugin"', 'child-theme-configurator' ); ?></li>
138
+ <li><?php _e( 'WordPress will automatically remove the original plugin when you activate the new version.', 'child-theme-configurator' ); ?></li></ol>
139
+ </div>
140
+ <?php
141
+ }
142
+
143
+ static function deactivate_ctc_pro() {
144
+ if ( current_user_can( 'activate_plugins' ) )
145
+ deactivate_plugins( self::$oldpro, FALSE, is_network_admin() );
146
+ }
147
+
148
+ static function check_ctc_pro() {
149
+ $plugindir = '/' . dirname( self::$oldpro );
150
+ $pluginhandle = basename( self::$oldpro );
151
+ if ( $oldpro = get_plugins( $plugindir ) ):
152
+ self::deactivate_ctc_pro();
153
+ defined( 'CHLD_THM_CFG_PLUGINS_VERSION' ) or define( 'CHLD_THM_CFG_PLUGINS_VERSION', $oldpro[ $pluginhandle ][ 'Version' ] );
154
+ add_action( 'admin_notices', 'ChildThemeConfigurator::upgrade_ctc_pro_notice' );
155
+ add_action( 'network_admin_notices','ChildThemeConfigurator::upgrade_ctc_pro_notice' );
156
+ endif;
157
+
158
+ }
159
+
160
+ static function upgrade_notice( $current, $new ){
161
+ if ( isset( $new->upgrade_notice ) && strlen( trim ( $new->upgrade_notice ) ) )
162
+ echo '<p style="background-color:#d54d21;padding:1em;color:#fff;margin: 9px 0">'
163
+ . esc_html( $new->upgrade_notice ) . '</p>';
164
+ }
165
+
166
  }
167
+
168
  defined( 'LILAEAMEDIA_URL' ) or
169
  define( 'LILAEAMEDIA_URL', "http://www.lilaeamedia.com" );
170
  defined( 'CHLD_THM_CFG_DOCS_URL' ) or
171
  define( 'CHLD_THM_CFG_DOCS_URL', "http://www.childthemeconfigurator.com" );
172
+ define( 'CHLD_THM_CFG_VERSION', '2.1.0' );
173
  define( 'CHLD_THM_CFG_PREV_VERSION', '1.7.9.1' );
174
  define( 'CHLD_THM_CFG_MIN_WP_VERSION', '3.7' );
175
+ define( 'CHLD_THM_CFG_PRO_MIN_VERSION', '2.2.0' );
176
  defined( 'CHLD_THM_CFG_BPSEL' ) or
177
  define( 'CHLD_THM_CFG_BPSEL', '2500' );
178
  defined( 'CHLD_THM_CFG_MAX_RECURSE_LOOPS' ) or
includes/forms/addl_panels.php CHANGED
@@ -1,13 +1,13 @@
1
  <?php
2
  // Exit if accessed directly
3
  if ( !defined( 'ABSPATH' ) ) exit;
4
- if ( !defined( 'CHLD_THM_CFG_PLUGINS_VERSION' ) ):
5
  ?><div id="get_pro_panel" class="ctc-option-panel<?php echo 'get_pro' == $active_tab ? ' ctc-option-panel-active' : ''; ?>" <?php echo $hidechild; ?> >
6
  <div class="ctc-input-row clearfix">
7
  <div class="ctc-input-cell"><div style="padding:0 40px">
8
  <h1>Upgrade Offer</h1>
9
  <p class="larger"><?php _e( 'Use coupon code', 'child-theme-configurator' ); ?><code><strong><?php _e( 'wordpress-org', 'child-theme-configurator' ); ?></strong></code><?php _e( 'and get <strong>20% off entire order</strong>.', 'child-theme-configurator' ); ?></p>
10
- <h3><a target="_blank" href="<?php echo LILAEAMEDIA_URL; ?>/cart/?add-to-cart=1710" title="<?php _e( 'Order Now', 'child-theme-configurator' ); ?>"><?php _e( 'Order Now', 'child-theme-configurator' ); ?></a></h3><small><?php _e( '*Prices and offers subject to change.', 'child-theme-configurator' ); ?></small><hr style="margin:20px 0" />
11
  <a target="_blank" href="<?php echo LILAEAMEDIA_URL; ?>/plugins/intelliwidget/" title="<?php _e( 'Learn more about IntelliWidget', 'child-theme-configurator' ); ?>"><img src="<?php echo CHLD_THM_CFG_URL . 'css/iw-banner.jpg'; ?>" width="430" height="430" /></a>
12
  <p><?php _e( 'IntelliWidget is a versatile widget manager that does the work of multiple plugins by combining custom page menus, featured posts, sliders and other dynamic content features into a single plugin that can display on a per-page or site-wide basis.', 'child-theme-configurator' ); ?> <a target="_blank" href="<?php echo LILAEAMEDIA_URL; ?>/plugins/intelliwidget/" title="<?php _e( 'Learn more about IntelliWidget', 'child-theme-configurator' ); ?>">
13
  <?php _e( 'Learn more', 'child-theme-configurator'); ?><i class="dashicons dashicons-external" style="text-decoration:none"></i></a></p><hr style="margin:20px 0" />
@@ -29,15 +29,15 @@ if ( !defined( 'CHLD_THM_CFG_PLUGINS_VERSION' ) ):
29
  <li><h3><?php _e( 'Find related styles', 'child-theme-configurator' ); ?></h3><p><?php _e( 'Use the "All Styles" panel to edit groups of selectors from a single combined list.', 'child-theme-configurator' ); ?></p></li>
30
  <li><h3><?php _e( 'Find styles by Nav Menu', 'child-theme-configurator' ); ?></h3><p><?php _e( 'Tweak menus quickly and easily.', 'child-theme-configurator' ); ?></p></li>
31
  <li><h3><?php _e( 'Most recent edits', 'child-theme-configurator' ); ?></h3><p><?php _e( 'Return to recently edited selectors from a toggleable sidebar.', 'child-theme-configurator' ); ?></p></li>
32
- <li><h3><?php _e( 'Genesis Framework Support', 'child-theme-configurator' ); ?></h3>
33
- <p><?php _e( 'Automatically detects and configures Genesis Child Themes with more frameworks on the way.', 'child-theme-configurator' ); ?></p></li>
34
  <li><h3><?php _e( 'Top-rated Online Support', 'child-theme-configurator' ); ?></h3></li>
35
  <li><h3><?php _e( 'Online Documentation', 'child-theme-configurator' ); ?></h3></li>
36
  <li><h3><?php _e( 'Tutorial Videos', 'child-theme-configurator' ); ?></h3></li>
37
  </ul>
38
  <h1>Upgrade Offer</h1>
39
  <p class="larger"><?php _e( 'Use coupon code', 'child-theme-configurator' ); ?><code><strong><?php _e( 'wordpress-org', 'child-theme-configurator' ); ?></strong></code><?php _e( 'and get <strong>20% off entire order</strong>.', 'child-theme-configurator' ); ?></p>
40
- <h3><a target="_blank" href="<?php echo LILAEAMEDIA_URL; ?>/cart/?add-to-cart=1710" title="<?php _e( 'Order Now', 'child-theme-configurator' ); ?>"><?php _e( 'Order Now', 'child-theme-configurator' ); ?></a></h3><small><?php _e( '*Prices and offers subject to change.', 'child-theme-configurator' ); ?></small>
41
  </div>
42
  </div></div><?php
43
  endif;
1
  <?php
2
  // Exit if accessed directly
3
  if ( !defined( 'ABSPATH' ) ) exit;
4
+ if ( !defined( 'CHLD_THM_CFG_PRO_VERSION' ) ):
5
  ?><div id="get_pro_panel" class="ctc-option-panel<?php echo 'get_pro' == $active_tab ? ' ctc-option-panel-active' : ''; ?>" <?php echo $hidechild; ?> >
6
  <div class="ctc-input-row clearfix">
7
  <div class="ctc-input-cell"><div style="padding:0 40px">
8
  <h1>Upgrade Offer</h1>
9
  <p class="larger"><?php _e( 'Use coupon code', 'child-theme-configurator' ); ?><code><strong><?php _e( 'wordpress-org', 'child-theme-configurator' ); ?></strong></code><?php _e( 'and get <strong>20% off entire order</strong>.', 'child-theme-configurator' ); ?></p>
10
+ <h3><a target="_blank" href="<?php echo LILAEAMEDIA_URL; ?>/cart/?add-to-cart=4549" title="<?php _e( 'Order Now', 'child-theme-configurator' ); ?>"><?php _e( 'Order Now', 'child-theme-configurator' ); ?></a></h3><small><?php _e( '*Prices and offers subject to change.', 'child-theme-configurator' ); ?></small><hr style="margin:20px 0" />
11
  <a target="_blank" href="<?php echo LILAEAMEDIA_URL; ?>/plugins/intelliwidget/" title="<?php _e( 'Learn more about IntelliWidget', 'child-theme-configurator' ); ?>"><img src="<?php echo CHLD_THM_CFG_URL . 'css/iw-banner.jpg'; ?>" width="430" height="430" /></a>
12
  <p><?php _e( 'IntelliWidget is a versatile widget manager that does the work of multiple plugins by combining custom page menus, featured posts, sliders and other dynamic content features into a single plugin that can display on a per-page or site-wide basis.', 'child-theme-configurator' ); ?> <a target="_blank" href="<?php echo LILAEAMEDIA_URL; ?>/plugins/intelliwidget/" title="<?php _e( 'Learn more about IntelliWidget', 'child-theme-configurator' ); ?>">
13
  <?php _e( 'Learn more', 'child-theme-configurator'); ?><i class="dashicons dashicons-external" style="text-decoration:none"></i></a></p><hr style="margin:20px 0" />
29
  <li><h3><?php _e( 'Find related styles', 'child-theme-configurator' ); ?></h3><p><?php _e( 'Use the "All Styles" panel to edit groups of selectors from a single combined list.', 'child-theme-configurator' ); ?></p></li>
30
  <li><h3><?php _e( 'Find styles by Nav Menu', 'child-theme-configurator' ); ?></h3><p><?php _e( 'Tweak menus quickly and easily.', 'child-theme-configurator' ); ?></p></li>
31
  <li><h3><?php _e( 'Most recent edits', 'child-theme-configurator' ); ?></h3><p><?php _e( 'Return to recently edited selectors from a toggleable sidebar.', 'child-theme-configurator' ); ?></p></li>
32
+ <li><h3><?php _e( 'Add Child Theme Files', 'child-theme-configurator' ); ?></h3>
33
+ <p><?php _e( 'Create new template and script files right from the admin.', 'child-theme-configurator' ); ?></p></li>
34
  <li><h3><?php _e( 'Top-rated Online Support', 'child-theme-configurator' ); ?></h3></li>
35
  <li><h3><?php _e( 'Online Documentation', 'child-theme-configurator' ); ?></h3></li>
36
  <li><h3><?php _e( 'Tutorial Videos', 'child-theme-configurator' ); ?></h3></li>
37
  </ul>
38
  <h1>Upgrade Offer</h1>
39
  <p class="larger"><?php _e( 'Use coupon code', 'child-theme-configurator' ); ?><code><strong><?php _e( 'wordpress-org', 'child-theme-configurator' ); ?></strong></code><?php _e( 'and get <strong>20% off entire order</strong>.', 'child-theme-configurator' ); ?></p>
40
+ <h3><a target="_blank" href="<?php echo LILAEAMEDIA_URL; ?>/cart/?add-to-cart=4549" title="<?php _e( 'Order Now', 'child-theme-configurator' ); ?>"><?php _e( 'Order Now', 'child-theme-configurator' ); ?></a></h3><small><?php _e( '*Prices and offers subject to change.', 'child-theme-configurator' ); ?></small>
41
  </div>
42
  </div></div><?php
43
  endif;
includes/forms/addl_tabs.php CHANGED
@@ -1,11 +1,11 @@
1
  <?php
2
  // Exit if accessed directly
3
  if ( !defined( 'ABSPATH' ) ) exit;
4
- if ( !defined( 'CHLD_THM_CFG_PLUGINS_VERSION' ) ):
5
  ?>
6
  <a id="get_pro" href="?page=<?php echo CHLD_THM_CFG_MENU; ?>&amp;tab=get_pro"
7
  class="nav-tab<?php echo 'get_pro' == $active_tab ? ' nav-tab-active' : ''; ?>" <?php echo $hidechild; ?>>
8
- <?php _e( 'Upgrade', 'chld_thm_cfg_plugins' ); ?>
9
  </a>
10
  <?php
11
  endif;
1
  <?php
2
  // Exit if accessed directly
3
  if ( !defined( 'ABSPATH' ) ) exit;
4
+ if ( !defined( 'CHLD_THM_CFG_PRO_VERSION' ) ):
5
  ?>
6
  <a id="get_pro" href="?page=<?php echo CHLD_THM_CFG_MENU; ?>&amp;tab=get_pro"
7
  class="nav-tab<?php echo 'get_pro' == $active_tab ? ' nav-tab-active' : ''; ?>" <?php echo $hidechild; ?>>
8
+ <?php _e( 'Upgrade', 'child-theme-configurator' ); ?>
9
  </a>
10
  <?php
11
  endif;
includes/forms/current-theme.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Exit if accessed directly
3
+ if ( !defined( 'ABSPATH' ) ) exit;
4
+ if ( $childname = $this->css()->get_prop( 'child_name' ) ): ?>
5
+ <div class="ctc-input-cell">
6
+ <h3><?php echo __( 'Currently loaded', 'child-theme-configurator' ). ': ' . $childname; ?></h3>
7
+ </div>
8
+ <?php endif;
includes/forms/debug-toggle.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Exit if accessed directly
3
+ if ( !defined( 'ABSPATH' ) ) exit;
4
+ ?>
5
+ <label for="ctc_is_debug" style="font-size:9px;float:right">
6
+ <input class="ctc_checkbox" id="ctc_is_debug" name="ctc_is_debug" type="checkbox"
7
+ value="1" <?php echo checked( $this->ctc()->is_debug, 1 ); ?> autocomplete="off" />
8
+ <?php _e( 'Debug', 'child-theme-configurator' ); ?>
9
+ </label>
includes/forms/file-form-buttons.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Exit if accessed directly
3
+ if ( !defined( 'ABSPATH' ) ) exit;
4
+
5
+ if ( 'child' == $template && !$this->ctc()->fs ): ?>
6
+
7
+ <input class="ctc_submit button button-primary" id="ctc_templates_writable_submit"
8
+ name="ctc_templates_writable_submit" type="submit"
9
+ value="<?php _e( 'Make Selected Writable', 'child-theme-configurator' ); ?>" />
10
+ <?php endif; ?>
11
+ <input class="ctc_submit button button-primary" id="ctc_<?php echo $template; ?>_templates_submit"
12
+ name="ctc_<?php echo $template; ?>_templates_submit" type="submit"
13
+ value="<?php echo ( 'parnt' == $template ? __( 'Copy Selected to Child Theme', 'child-theme-configurator' ) : __( 'Delete Selected', 'child-theme-configurator' ) ); ?>" />
includes/forms/file.php CHANGED
@@ -6,4 +6,6 @@ if ( !defined( 'ABSPATH' ) ) exit;
6
  <input class="ctc_checkbox" id="ctc_file_<?php echo $template . '_' . ++$counter; ?>"
7
  name="ctc_file_<?php echo $template; ?>[]" type="checkbox"
8
  value="<?php echo $templatefile; ?>" />
9
- <?php echo $templatefile; ?></label>
 
 
6
  <input class="ctc_checkbox" id="ctc_file_<?php echo $template . '_' . ++$counter; ?>"
7
  name="ctc_file_<?php echo $template; ?>[]" type="checkbox"
8
  value="<?php echo $templatefile; ?>" />
9
+ <?php echo 'child' == $template ? apply_filters( 'chld_thm_cfg_editor_link', $templatefile, $editorlink ) : $templatefile; ?></label>
10
+
11
+
includes/forms/fileform.php CHANGED
@@ -1,20 +1,6 @@
1
  <?php
2
  if ( !defined( 'ABSPATH' ) ) exit;
3
  // Files Section
4
- // This include is used for both parent template section and the child files section
5
- $ctcpage = apply_filters( 'chld_thm_cfg_admin_page', CHLD_THM_CFG_MENU );
6
-
7
- if ( defined( 'DISALLOW_FILE_EDIT' ) && DISALLOW_FILE_EDIT ):
8
- $linktext = __( 'The Theme editor has been disabled. Template files must be edited offline.', 'child-theme-configurator' );
9
- $editorlink = '';
10
- $editorlinkend = '';
11
- else:
12
- $linktext = __( 'Click here to edit template files using the Theme Editor', 'child-theme-configurator' );
13
- $adminbase = 'theme-editor.php?theme=' . $this->ctc()->css->get_prop( 'child' )
14
- . ( 'parnt' == $template ? '&file=functions.php' : '' );
15
- $editorlink = '<a href="' . ( is_multisite() ? network_admin_url( $adminbase ) : admin_url( $adminbase ) ) . '" title="' . $linktext . '">';
16
- $editorlinkend = '</a>';
17
- endif;
18
  ?>
19
  <div class="ctc-input-row clearfix" id="input_row_<?php echo $template; ?>_templates">
20
  <form id="ctc_<?php echo $template; ?>_templates_form" method="post" action="?page=<?php echo $ctcpage; ?>&amp;tab=file_options">
@@ -30,12 +16,12 @@ if ( 'parnt' == $template ): ?>
30
  <p class="howto"><strong>
31
  <?php _e( 'CAUTION: If your child theme is active, the child theme version of the file will be used instead of the parent immediately after it is copied.', 'child-theme-configurator' );?>
32
  </strong></p>
33
- <p class="howto"> <?php echo sprintf( __( 'The %s file is generated separately and cannot be copied here.', 'child-theme-configurator' ),
34
- $editorlink . '<code>functions.php</code>' . $editorlinkend
35
  );
36
  else: ?>
37
  <p class="howto">
38
- <?php echo $editorlink . $linktext . $editorlinkend; ?>
39
  </p>
40
  <p class="howto">
41
  <?php
@@ -51,14 +37,7 @@ else: ?>
51
  <div class="ctc-input-cell-wide"> <?php echo $inputs; ?></div>
52
  <div class="ctc-input-cell"> <strong>&nbsp;</strong> </div>
53
  <div class="ctc-input-cell-wide" style="margin-top:10px;margin-bottom:10px">
54
- <?php if ( 'child' == $template && !$this->ctc()->fs ): ?>
55
- <input class="ctc_submit button button-primary" id="ctc_templates_writable_submit"
56
- name="ctc_templates_writable_submit" type="submit"
57
- value="<?php _e( 'Make Selected Writable', 'child-theme-configurator' ); ?>" />&nbsp; &nbsp;
58
- <?php endif; ?>
59
- <input class="ctc_submit button button-primary" id="ctc_<?php echo $template; ?>_templates_submit"
60
- name="ctc_<?php echo $template; ?>_templates_submit" type="submit"
61
- value="<?php echo ( 'parnt' == $template ? __( 'Copy Selected to Child Theme', 'child-theme-configurator' ) : __( 'Delete Selected', 'child-theme-configurator' ) ); ?>" />
62
  </div>
63
  </form>
64
  </div>
1
  <?php
2
  if ( !defined( 'ABSPATH' ) ) exit;
3
  // Files Section
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  ?>
5
  <div class="ctc-input-row clearfix" id="input_row_<?php echo $template; ?>_templates">
6
  <form id="ctc_<?php echo $template; ?>_templates_form" method="post" action="?page=<?php echo $ctcpage; ?>&amp;tab=file_options">
16
  <p class="howto"><strong>
17
  <?php _e( 'CAUTION: If your child theme is active, the child theme version of the file will be used instead of the parent immediately after it is copied.', 'child-theme-configurator' );?>
18
  </strong></p>
19
+ <p class="howto"> <?php printf( __( 'The %s file is generated separately and cannot be copied here.', 'child-theme-configurator' ),
20
+ sprintf( $editorlink, 'functions.php', 'Click to edit functions.php', '<code>functions.php</code>' )
21
  );
22
  else: ?>
23
  <p class="howto">
24
+ <?php printf( $editorlink, 'functions.php', 'Click to edit functions.php', 'Click to edit files using the Theme Editor' ); ?>
25
  </p>
26
  <p class="howto">
27
  <?php
37
  <div class="ctc-input-cell-wide"> <?php echo $inputs; ?></div>
38
  <div class="ctc-input-cell"> <strong>&nbsp;</strong> </div>
39
  <div class="ctc-input-cell-wide" style="margin-top:10px;margin-bottom:10px">
40
+ <?php do_action( 'chld_thm_cfg_file_form_buttons', $template ); ?>
 
 
 
 
 
 
 
41
  </div>
42
  </form>
43
  </div>
includes/forms/main.php CHANGED
@@ -6,24 +6,25 @@ $css = $this->css();
6
  ?>
7
  <style type="text/css">
8
  .ctc-step-number {
9
- background-color: <?php echo $this->colors[ 3 ]; ?>;
 
10
  }
11
  .ctc-step-letter {
12
- background-color: <?php echo $this->colors[ 2 ]; ?>;
 
13
  }
14
  .ctc-step + strong {
15
- color: <?php echo $this->colors[ 1 ]; ?>;
 
16
  }
17
  .ctc-status-icon.success {
18
  background:url(<?php echo admin_url( 'images/yes.png' );
19
  ?>) no-repeat;
20
  }
21
-
22
  .ctc-status-icon.failure {
23
  background:url(<?php echo admin_url( 'images/no.png' );
24
  ?>) no-repeat;
25
  }
26
-
27
  .ctc-exit {
28
  background:#f9f9f9 url(<?php echo includes_url( 'images/xit-2x.gif' );
29
  ?>) left top no-repeat;
@@ -32,20 +33,17 @@ background:#f9f9f9 url(<?php echo includes_url( 'images/xit-2x.gif' );
32
  <div class="wrap" id="ctc_main">
33
  <?php do_action( 'chld_thm_cfg_related_links' ); ?>
34
  <h2><?php echo apply_filters( 'chld_thm_cfg_header', __( 'Child Theme Configurator', 'child-theme-configurator' ) . ' ' . __( 'version', 'child-theme-configurator' ) . ' ' . CHLD_THM_CFG_VERSION ); ?></h2>
35
- <label for="ctc_is_debug" style="float:right;font-size:9px">
36
- <input class="ctc_checkbox" id="ctc_is_debug" name="ctc_is_debug" type="checkbox"
37
- value="1" <?php echo checked( $this->ctc()->is_debug, 1 ); ?> autocomplete="off" />
38
- <?php _e( 'Debug', 'chld_thm_cfg_plugins' ); ?>
39
- </label><?php if ( $childname = $this->css()->get_prop( 'child_name' ) ): ?>
40
- <h3>
41
- <?php _e( 'Currently Loaded', 'child-theme-configurator' ); echo ': ' . $childname;?>
42
- </h3>
43
- <?php endif;
44
  if ( $this->ctc()->is_post && !$this->ctc()->fs ):
 
45
  echo $this->ctc()->fs_prompt;
46
- else: ?>
 
 
 
 
47
  <div id="ctc_error_notice">
48
- <?php $this->settings_errors(); ?>
49
  </div>
50
  <?php
51
  // if flag has been set because an action is required, do not render interface
@@ -55,23 +53,20 @@ else: ?>
55
  <div id="ctc_option_panel_wrapper" style="position:relative">
56
  <div class="ctc-option-panel-container">
57
  <?php
58
- //$parent_child_panel = apply_filters( 'chld_thm_cfg_pc_panel',
59
- // CHLD_THM_CFG_DIR . '/includes/forms/parent-child.php' );
60
- //include ( $parent_child_panel );
61
  include ( CHLD_THM_CFG_DIR . '/includes/forms/parent-child.php' );
62
  if ( $enqueueset ):
63
  include ( CHLD_THM_CFG_DIR . '/includes/forms/rule-value.php' );
64
- include ( CHLD_THM_CFG_DIR . '/includes/forms/query-selector.php' );
65
- include ( CHLD_THM_CFG_DIR . '/includes/forms/webfonts.php' ); ?>
 
66
  <div id="view_child_options_panel"
67
  class="ctc-option-panel<?php echo 'view_child_options' == $active_tab ? ' ctc-option-panel-active' : ''; ?>" <?php echo $hidechild; ?>> </div>
68
  <div id="view_parnt_options_panel"
69
  class="ctc-option-panel<?php echo 'view_parnt_options' == $active_tab ? ' ctc-option-panel-active' : ''; ?>" <?php echo $hidechild; ?>> </div>
70
  <?php
71
- if ( '' == $hidechild ):
72
  include ( CHLD_THM_CFG_DIR . '/includes/forms/files.php' );
73
- endif;
74
- do_action( 'chld_thm_cfg_panels', $this->ctc(), $active_tab, $hidechild );
75
  endif;
76
  ?>
77
  </div>
@@ -82,6 +77,8 @@ else: ?>
82
  endif;
83
  ?>
84
  <div id="ctc_debug_container">
85
- <?php do_action( 'chld_thm_cfg_print_debug' ); ?>
 
 
86
  </div>
87
  </div>
6
  ?>
7
  <style type="text/css">
8
  .ctc-step-number {
9
+ background-color: <?php echo $this->colors[ 3 ];
10
+ ?>;
11
  }
12
  .ctc-step-letter {
13
+ background-color: <?php echo $this->colors[ 2 ];
14
+ ?>;
15
  }
16
  .ctc-step + strong {
17
+ color: <?php echo $this->colors[ 1 ];
18
+ ?>;
19
  }
20
  .ctc-status-icon.success {
21
  background:url(<?php echo admin_url( 'images/yes.png' );
22
  ?>) no-repeat;
23
  }
 
24
  .ctc-status-icon.failure {
25
  background:url(<?php echo admin_url( 'images/no.png' );
26
  ?>) no-repeat;
27
  }
 
28
  .ctc-exit {
29
  background:#f9f9f9 url(<?php echo includes_url( 'images/xit-2x.gif' );
30
  ?>) left top no-repeat;
33
  <div class="wrap" id="ctc_main">
34
  <?php do_action( 'chld_thm_cfg_related_links' ); ?>
35
  <h2><?php echo apply_filters( 'chld_thm_cfg_header', __( 'Child Theme Configurator', 'child-theme-configurator' ) . ' ' . __( 'version', 'child-theme-configurator' ) . ' ' . CHLD_THM_CFG_VERSION ); ?></h2>
36
+ <?php
 
 
 
 
 
 
 
 
37
  if ( $this->ctc()->is_post && !$this->ctc()->fs ):
38
+ //die( 'in fs prompt' );
39
  echo $this->ctc()->fs_prompt;
40
+ else:
41
+ ?>
42
+ <div class="clearfix" >
43
+ <?php do_action( 'chld_thm_cfg_before_tabs' ); ?>
44
+ </div>
45
  <div id="ctc_error_notice">
46
+ <?php $this->render_settings_errors(); ?>
47
  </div>
48
  <?php
49
  // if flag has been set because an action is required, do not render interface
53
  <div id="ctc_option_panel_wrapper" style="position:relative">
54
  <div class="ctc-option-panel-container">
55
  <?php
 
 
 
56
  include ( CHLD_THM_CFG_DIR . '/includes/forms/parent-child.php' );
57
  if ( $enqueueset ):
58
  include ( CHLD_THM_CFG_DIR . '/includes/forms/rule-value.php' );
59
+ include ( CHLD_THM_CFG_DIR . '/includes/forms/query-selector.php' );
60
+ if ( $this->ctc()->is_theme() )
61
+ include ( CHLD_THM_CFG_DIR . '/includes/forms/webfonts.php' ); ?>
62
  <div id="view_child_options_panel"
63
  class="ctc-option-panel<?php echo 'view_child_options' == $active_tab ? ' ctc-option-panel-active' : ''; ?>" <?php echo $hidechild; ?>> </div>
64
  <div id="view_parnt_options_panel"
65
  class="ctc-option-panel<?php echo 'view_parnt_options' == $active_tab ? ' ctc-option-panel-active' : ''; ?>" <?php echo $hidechild; ?>> </div>
66
  <?php
67
+ if ( '' == $hidechild && $this->ctc()->is_theme() )
68
  include ( CHLD_THM_CFG_DIR . '/includes/forms/files.php' );
69
+ do_action( 'chld_thm_cfg_panels', $active_tab, $hidechild );
 
70
  endif;
71
  ?>
72
  </div>
77
  endif;
78
  ?>
79
  <div id="ctc_debug_container">
80
+ <?php if ( $this->ctc()->is_debug ): ?>
81
+ <textarea id="ctc_debug_box"><?php echo $this->ctc()->get_debug(); ?></textarea>
82
+ <?php endif; ?>
83
  </div>
84
  </div>
includes/forms/notices.php ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Exit if accessed directly
3
+ if ( !defined( 'ABSPATH' ) ) exit;
4
+ ?>
5
+
6
+ <div class="notice-warning notice is-dismissible<?php echo ( 'upgrade' == $msg ? ' ctc-upgrade-notice' : '' ); ?>" style="display:block">
7
+ <?php
8
+ switch( $msg ):
9
+
10
+ case 'writable': ?>
11
+ <p class="ctc-section-toggle" id="ctc_perm_options">
12
+ <?php _e( 'The child theme is in read-only mode and Child Theme Configurator cannot apply changes. Click to see options', 'child-theme-configurator' ); ?>
13
+ </p>
14
+ <div class="ctc-section-toggle-content" id="ctc_perm_options_content">
15
+ <p>
16
+ <ol>
17
+ <?php
18
+ $ctcpage = apply_filters( 'chld_thm_cfg_admin_page', CHLD_THM_CFG_MENU );
19
+ if ( 'WIN' != substr( strtoupper( PHP_OS ), 0, 3 ) ):
20
+ _e( '<li>Temporarily set write permissions by clicking the button below. When you are finished editing, revert to read-only by clicking "Make read-only" under the "Files" tab.</li>', 'child-theme-configurator' );
21
+ ?>
22
+ <form action="" method="post">
23
+ <?php wp_nonce_field( apply_filters( 'chld_thm_cfg_action', 'ctc_update' ) ); ?>
24
+ <input name="ctc_set_writable" class="button" type="submit" value="<?php _e( 'Make files writable', 'child-theme-configurator' ); ?>"/>
25
+ </form>
26
+ <?php endif;
27
+ _e( '<li><a target="_blank" href="http://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants" title="Editin wp-config.php">Add your FTP/SSH credentials to the WordPress config file</a>.</li>', 'child-theme-configurator' );
28
+ if ( isset( $_SERVER[ 'SERVER_SOFTWARE' ] ) && preg_match( '%iis%i',$_SERVER[ 'SERVER_SOFTWARE' ] ) )
29
+ _e( '<li><a target="_blank" href="http://technet.microsoft.com/en-us/library/cc771170" title="Setting Application Pool Identity">Assign WordPress to an application pool that has write permissions</a> (Windows IIS systems).</li>', 'child-theme-configurator' );
30
+ _e( '<li><a target="_blank" href="http://codex.wordpress.org/Changing_File_Permissions" title="Changing File Permissions">Set write permissions on the server manually</a> (not recommended).</li>', 'child-theme-configurator' );
31
+ if ( 'WIN' != substr( strtoupper( PHP_OS ), 0, 3 ) ):
32
+ _e( '<li>Run PHP under Apache with suEXEC (contact your web host).</li>', 'child-theme-configurator' );
33
+ endif; ?>
34
+ </ol>
35
+ </p>
36
+ </div>
37
+ <?php
38
+ break;
39
+
40
+
41
+ case 'owner':
42
+
43
+ $ctcpage = apply_filters( 'chld_thm_cfg_admin_page', CHLD_THM_CFG_MENU ); // FIXME? ?>
44
+ <p>
45
+ <?php _e( 'This Child Theme has incorrect ownership permissions. Child Theme Configurator will attempt to correct this when you click the button below.', 'child-theme-configurator' ) ?>
46
+ </p>
47
+ <p>
48
+ <form action="" method="post">
49
+ <?php
50
+ wp_nonce_field( apply_filters( 'chld_thm_cfg_action', 'ctc_update' ) ); ?>
51
+ <input name="ctc_reset_permission" class="button" type="submit" value="<?php _e( 'Correct Child Theme Permissions', 'child-theme-configurator' ); ?>"/>
52
+ </form>
53
+ </p>
54
+ <?php
55
+ break;
56
+
57
+
58
+ case 'enqueue': ?>
59
+ <p>
60
+ <?php _e( 'Child Theme Configurator needs to update its internal data. Please set your preferences below and click "Generate Child Theme Files" to update your configuration.', 'child-theme-configurator' ) ?>
61
+ </p>
62
+ <?php
63
+ break;
64
+
65
+
66
+ case 'max_styles':
67
+
68
+ echo sprintf( __( '<strong>However, some styles could not be parsed due to memory limits.</strong> Try deselecting "Additional Stylesheets" below and click "Generate/Rebuild Child Theme Files". %sWhy am I seeing this?%s', 'child-theme-configurator' ),
69
+ '<a target="_blank" href="' . LILAEAMEDIA_URL . '/child-theme-configurator#php_memory">',
70
+ '</a>' );
71
+ break;
72
+
73
+
74
+ case 'config': ?>
75
+ <p>
76
+ <?php _e( 'Child Theme Configurator did not detect any configuration data because a previously configured Child Theme has been removed. Please follow the steps for "CONFIGURE an existing Child Theme" under the "Parent/Child" Tab.', 'child-theme-configurator' ) ?>
77
+ </p>
78
+ <?php
79
+ break;
80
+
81
+
82
+ case 'changed': ?>
83
+ <p>
84
+ <?php _e( 'Your stylesheet has changed since the last time you used the Configurator. Please follow the steps for "CONFIGURE an existing Child Theme" under the "Parent/Child" Tab or you will lose these changes.', 'child-theme-configurator' ) ?>
85
+ </p>
86
+ <?php
87
+ break;
88
+
89
+
90
+ case 'upgrade':
91
+ $child = $this->css()->get_prop( 'child' );
92
+ ?>
93
+ <?php if ( $child ): ?>
94
+ <div class="clearfix">
95
+ <?php endif; ?>
96
+ <h3>
97
+ <?php _e( 'Thank you for installing Child Theme Configurator.', 'child-theme-configurator' ); ?>
98
+ </h3>
99
+ <p class="howto">
100
+ <?php _e( 'A lot of time and testing has gone into this release but there may be edge cases. If you have any questions, please', 'child-theme-configurator' ); ?>
101
+ <a href="<?php echo LILAEAMEDIA_URL; ?>/contact" target="_blank">
102
+ <?php _e( 'Contact Us.', 'child-theme-configurator' ); ?>
103
+ </a></p>
104
+ <p class="howto">
105
+ <?php _e( 'For more information, please open the Help tab at the top right or ', 'child-theme-configurator' ) ?>
106
+ <a href="http://www.childthemeconfigurator.com/tutorial-videos/" target="_blank">
107
+ <?php _e( 'click here to view the latest videos.', 'child-theme-configurator' ); ?>
108
+ </a></p>
109
+ <?php if ( $child ): ?>
110
+ <p>
111
+ <?php _e( 'It is a good idea to save a Zip Archive of your Child Theme before using CTC for the first time. Click the "save backup" link ( see Step 2, below ) to export your themes.', 'child-theme-configurator' ); ?>
112
+ </p>
113
+ </div>
114
+ <?php endif; ?>
115
+ <?php endswitch; ?>
116
+ </div>
includes/forms/parent-child.php CHANGED
@@ -11,7 +11,7 @@ if ( !defined( 'ABSPATH' ) ) exit;
11
  <?php // theme inputs
12
  wp_nonce_field( 'ctc_update' );
13
  //if ( '' == $hidechild )
14
- do_action( 'chld_thm_cfg_controls', $this->ctc() );
15
  $disabled = $this->ctc()->is_legacy() && !$this->ctc()->is_theme() ? ' disabled ' : '';
16
  $disabledclass = $this->ctc()->is_legacy() && !$this->ctc()->is_theme() ? ' ctc-disabled ' : '';
17
 
@@ -334,8 +334,9 @@ if ( !defined( 'ABSPATH' ) ) exit;
334
  <input class="ctc-hidden" id="ctc_theme_child" name="ctc_theme_child" type="hidden" value="<?php echo $this->ctc()->css->get_prop( 'child' ); ?>" />
335
  <input class="ctc-hidden" id="ctc_action" name="ctc_action" type="hidden" value="plugin" />
336
  <input class="ctc-hidden" id="ctc_child_type" name="ctc_child_type" type="hidden" value="existing" />
 
337
  <div class="ctc-input-row clearfix" id="ctc_stylesheet_files"><?php
338
- $stylesheets = ChildThemeConfiguratorPlugins::ctcp()->get_css_files();
339
  if ( count( $stylesheets ) ):?>
340
  <div class="ctc-input-cell ctc-section-toggle" id="ctc_additional_css_files"> <strong>
341
  <?php _e( 'Parse Plugin stylesheets:', 'chld_thm_cfg' ); ?>
@@ -353,14 +354,13 @@ if ( !defined( 'ABSPATH' ) ) exit;
353
  </ul></div><?php
354
  endif; ?>
355
  </div>
356
- <div class="ctc-input-row clearfix">
357
  <div class="ctc-input-cell"><strong class="shift"><?php _e( 'Click to run the Configurator:', 'child-theme-configurator' ); ?></strong> </div>
358
  <div class="ctc-input-cell-wide">
359
- <input class="ctc_submit button button-primary" id="ctc_load_styles" name="ctc_load_styles" type="submit"
360
  value="<?php _e( 'Configure Plugin Styles', 'child-theme-configurator' ); ?>" disabled />
361
  </div>
362
  </div>
363
  <?php endif; ?>
364
-
365
  </form>
366
  </div>
11
  <?php // theme inputs
12
  wp_nonce_field( 'ctc_update' );
13
  //if ( '' == $hidechild )
14
+ do_action( 'chld_thm_cfg_controls' );
15
  $disabled = $this->ctc()->is_legacy() && !$this->ctc()->is_theme() ? ' disabled ' : '';
16
  $disabledclass = $this->ctc()->is_legacy() && !$this->ctc()->is_theme() ? ' ctc-disabled ' : '';
17
 
334
  <input class="ctc-hidden" id="ctc_theme_child" name="ctc_theme_child" type="hidden" value="<?php echo $this->ctc()->css->get_prop( 'child' ); ?>" />
335
  <input class="ctc-hidden" id="ctc_action" name="ctc_action" type="hidden" value="plugin" />
336
  <input class="ctc-hidden" id="ctc_child_type" name="ctc_child_type" type="hidden" value="existing" />
337
+ <div class="ctc-input-cell-wide ctc-analysis" id="child_analysis_notice">&nbsp;</div>
338
  <div class="ctc-input-row clearfix" id="ctc_stylesheet_files"><?php
339
+ $stylesheets = ChildThemeConfiguratorPro::ctcp()->get_css_files();
340
  if ( count( $stylesheets ) ):?>
341
  <div class="ctc-input-cell ctc-section-toggle" id="ctc_additional_css_files"> <strong>
342
  <?php _e( 'Parse Plugin stylesheets:', 'chld_thm_cfg' ); ?>
354
  </ul></div><?php
355
  endif; ?>
356
  </div>
357
+ <div class="ctc-input-row clearfix" id="ctc_configure_submit_plugins" style="display:none">
358
  <div class="ctc-input-cell"><strong class="shift"><?php _e( 'Click to run the Configurator:', 'child-theme-configurator' ); ?></strong> </div>
359
  <div class="ctc-input-cell-wide">
360
+ <input class="ctc_submit button button-primary" id="ctc_load_styles_plugins" name="ctc_load_styles" type="submit"
361
  value="<?php _e( 'Configure Plugin Styles', 'child-theme-configurator' ); ?>" disabled />
362
  </div>
363
  </div>
364
  <?php endif; ?>
 
365
  </form>
366
  </div>
includes/forms/query-selector.php CHANGED
@@ -6,6 +6,7 @@ if ( !defined( 'ABSPATH' ) ) exit;
6
 
7
  <div id="query_selector_options_panel"
8
  class="ctc-option-panel<?php echo 'query_selector_options' == $active_tab ? ' ctc-option-panel-active' : ''; ?>" <?php echo $hidechild; ?>>
 
9
  <form id="ctc_query_selector_form" method="post" action="?page=<?php echo $ctcpage; ?>">
10
  <?php wp_nonce_field( apply_filters( 'chld_thm_cfg_action', 'ctc_update' ) ); ?>
11
  <div class="ctc-input-row clearfix" id="input_row_query">
6
 
7
  <div id="query_selector_options_panel"
8
  class="ctc-option-panel<?php echo 'query_selector_options' == $active_tab ? ' ctc-option-panel-active' : ''; ?>" <?php echo $hidechild; ?>>
9
+ <p class="howto"><?php _e( 'To find and edit specific selectors within @media query blocks, first choose the query, then the selector. Use the "base" query to edit all other selectors.', 'child-theme-configurator' ); ?></p>
10
  <form id="ctc_query_selector_form" method="post" action="?page=<?php echo $ctcpage; ?>">
11
  <?php wp_nonce_field( apply_filters( 'chld_thm_cfg_action', 'ctc_update' ) ); ?>
12
  <div class="ctc-input-row clearfix" id="input_row_query">
includes/forms/rule-value.php CHANGED
@@ -6,6 +6,7 @@ if ( !defined( 'ABSPATH' ) ) exit;
6
 
7
  <div id="rule_value_options_panel"
8
  class="ctc-option-panel<?php echo 'rule_value_options' == $active_tab ? ' ctc-option-panel-active' : ''; ?>" <?php echo $hidechild; ?>>
 
9
  <form id="ctc_rule_value_form" method="post" action="?page=<?php echo $ctcpage; ?>">
10
  <?php wp_nonce_field( apply_filters( 'chld_thm_cfg_action', 'ctc_update' ) ); ?>
11
  <div class="ctc-input-row clearfix" id="ctc_input_row_rule_menu">
6
 
7
  <div id="rule_value_options_panel"
8
  class="ctc-option-panel<?php echo 'rule_value_options' == $active_tab ? ' ctc-option-panel-active' : ''; ?>" <?php echo $hidechild; ?>>
9
+ <p class="howto"><?php _e( 'To find and edit selectors containing specific values for a given property, first choose the property (e.g., "color"), then click "Selectors" for any resulting value. A dialog panel will open with the corresponding selectors, grouped by media query.', 'child-theme-configurator' ); ?></p>
10
  <form id="ctc_rule_value_form" method="post" action="?page=<?php echo $ctcpage; ?>">
11
  <?php wp_nonce_field( apply_filters( 'chld_thm_cfg_action', 'ctc_update' ) ); ?>
12
  <div class="ctc-input-row clearfix" id="ctc_input_row_rule_menu">
includes/forms/settings-errors.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Exit if accessed directly
3
+ if ( !defined( 'ABSPATH' ) ) exit;
4
+ if ( count( $this->ctc()->errors ) ): ?>
5
+
6
+ <div class="error notice is-dismissible">
7
+ <ul>
8
+ <?php
9
+ foreach ( $this->ctc()->errors as $err ):
10
+ echo '<li>' . $err . '</li>' . LF;
11
+ endforeach; ?>
12
+ </ul>
13
+ </div>
14
+ <?php
15
+ elseif ( isset( $_GET[ 'updated' ] ) ):
16
+ $child_theme = wp_get_theme( $this->ctc()->get( 'child' ) ); ?>
17
+ <div class="updated notice is-dismissible">
18
+ <?php
19
+ if ( 4 == $_GET[ 'updated' ] ): ?>
20
+ <p> <?php printf( __( 'Child Theme <strong>%s</strong> has been reset. Please configure it using the settings below.', 'child-theme-configurator' ), $child_theme->Name ); ?> </p>
21
+ <?php
22
+ elseif ( 7 == $_GET[ 'updated' ] ): ?>
23
+ <p>
24
+ <?php _e( 'Update Key saved successfully.', 'child-theme-configurator' ); ?>
25
+ </p>
26
+ <?php
27
+ elseif ( 8 == $_GET[ 'updated' ] ): ?>
28
+ <p>
29
+ <?php _e( 'Child Theme files modified successfully.', 'child-theme-configurator' ); ?>
30
+ </p>
31
+ <?php else: ?>
32
+ <p class="ctc-success-response"><?php echo apply_filters( 'chld_thm_cfg_update_msg', sprintf( __( 'Child Theme <strong>%s</strong> has been generated successfully.', 'child-theme-configurator' ), $child_theme->Name ), $this->ctc() ); ?>
33
+ <?php
34
+ if ( $this->ctc()->is_theme() ): ?>
35
+ <strong>
36
+ <?php _e( 'IMPORTANT:', 'child-theme-configurator' ); ?>
37
+ <?php
38
+ if ( is_multisite() && !$child_theme->is_allowed() ):
39
+ printf( __( 'You must %sNetwork enable%s your child theme.', 'child-theme-configurator' ),
40
+ sprintf( '<a href="%s" title="%s" class="ctc-live-preview">',
41
+ network_admin_url( '/themes.php' ),
42
+ __( 'Go to Themes', 'child-theme-configurator' ) ),
43
+ '</a>'
44
+ );
45
+ else:
46
+ printf( __( '%sPreview your child theme%s before activating.', 'child-theme-configurator' ),
47
+ sprintf( '<a href="%s" title="%s" class="ctc-live-preview">',
48
+ admin_url( '/customize.php?theme=' . $this->ctc()->css->get_prop( 'child' ) ),
49
+ __( 'Live Preview', 'child-theme-configurator' ) ),
50
+ '</a>'
51
+ );
52
+ endif; ?>
53
+ </strong></p>
54
+ <?php
55
+ endif;
56
+ endif; ?>
57
+ </div>
58
+ <?php
59
+ endif;
60
+
includes/forms/tabs.php CHANGED
@@ -8,29 +8,32 @@ $active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : 'parent_child_options';
8
  <h2 class="nav-tab-wrapper clearfix">
9
  <a id="parent_child_options" href=""
10
  class="nav-tab<?php echo 'parent_child_options' == $active_tab ? ' nav-tab-active' : ''; ?>">
11
- <?php _e( 'Parent/Child', 'child-theme-configurator' ); ?>
12
  </a><?php if ( $enqueueset ): ?><a id="query_selector_options" href=""
13
  class="nav-tab<?php echo 'query_selector_options' == $active_tab ? ' nav-tab-active' : ''; ?>" <?php echo $hidechild; ?>>
14
- <?php _e( 'Query/Selector', 'child-theme-configurator' ); ?>
15
  </a><a id="rule_value_options" href=""
16
  class="nav-tab<?php echo 'rule_value_options' == $active_tab ? ' nav-tab-active' : ''; ?>" <?php echo $hidechild; ?>>
17
- <?php _e( 'Property/Value', 'child-theme-configurator' ); ?>
18
- </a><a id="import_options" href=""
 
 
19
  class="nav-tab<?php echo 'import_options' == $active_tab ? ' nav-tab-active' : ''; ?>" <?php echo $hidechild; ?>>
20
  <?php _e( 'Web Fonts', 'child-theme-configurator' ); ?>
21
- </a><a id="view_parnt_options" href=""
 
22
  class="nav-tab<?php echo 'view_parnt_options' == $active_tab ? ' nav-tab-active' : ''; ?>" <?php echo $hidechild; ?>>
23
  <?php _e( 'Baseline Styles', 'child-theme-configurator' ); ?>
24
  </a><a id="view_child_options" href=""
25
  class="nav-tab<?php echo 'view_child_options' == $active_tab ? ' nav-tab-active' : ''; ?>" <?php echo $hidechild; ?>>
26
  <?php _e( 'Child Styles', 'child-theme-configurator' ); ?>
27
  </a><?php
28
- if ( '' == $hidechild ):
29
  ?><a id="file_options" href="" class="nav-tab<?php echo 'file_options' == $active_tab ? ' nav-tab-active' : ''; ?>" <?php echo $hidechild; ?>>
30
  <?php _e( 'Files', 'child-theme-configurator' ); ?>
31
  </a><?php
32
  endif;
33
- do_action( 'chld_thm_cfg_tabs', $this->ctc(), $active_tab, $hidechild );
34
  endif; ?>
35
  <i id="ctc_status_preview"></i>
36
  </h2>
8
  <h2 class="nav-tab-wrapper clearfix">
9
  <a id="parent_child_options" href=""
10
  class="nav-tab<?php echo 'parent_child_options' == $active_tab ? ' nav-tab-active' : ''; ?>">
11
+ <?php _e( 'Parent/ Child', 'child-theme-configurator' ); ?>
12
  </a><?php if ( $enqueueset ): ?><a id="query_selector_options" href=""
13
  class="nav-tab<?php echo 'query_selector_options' == $active_tab ? ' nav-tab-active' : ''; ?>" <?php echo $hidechild; ?>>
14
+ <?php _e( 'Query/ Selector', 'child-theme-configurator' ); ?>
15
  </a><a id="rule_value_options" href=""
16
  class="nav-tab<?php echo 'rule_value_options' == $active_tab ? ' nav-tab-active' : ''; ?>" <?php echo $hidechild; ?>>
17
+ <?php _e( 'Property/ Value', 'child-theme-configurator' ); ?>
18
+ </a><?php
19
+ if ( $this->ctc()->is_theme() ):
20
+ ?><a id="import_options" href=""
21
  class="nav-tab<?php echo 'import_options' == $active_tab ? ' nav-tab-active' : ''; ?>" <?php echo $hidechild; ?>>
22
  <?php _e( 'Web Fonts', 'child-theme-configurator' ); ?>
23
+ </a><?php
24
+ endif; ?><a id="view_parnt_options" href=""
25
  class="nav-tab<?php echo 'view_parnt_options' == $active_tab ? ' nav-tab-active' : ''; ?>" <?php echo $hidechild; ?>>
26
  <?php _e( 'Baseline Styles', 'child-theme-configurator' ); ?>
27
  </a><a id="view_child_options" href=""
28
  class="nav-tab<?php echo 'view_child_options' == $active_tab ? ' nav-tab-active' : ''; ?>" <?php echo $hidechild; ?>>
29
  <?php _e( 'Child Styles', 'child-theme-configurator' ); ?>
30
  </a><?php
31
+ if ( '' == $hidechild && $this->ctc()->is_theme() ):
32
  ?><a id="file_options" href="" class="nav-tab<?php echo 'file_options' == $active_tab ? ' nav-tab-active' : ''; ?>" <?php echo $hidechild; ?>>
33
  <?php _e( 'Files', 'child-theme-configurator' ); ?>
34
  </a><?php
35
  endif;
36
+ do_action( 'chld_thm_cfg_tabs', $active_tab, $hidechild );
37
  endif; ?>
38
  <i id="ctc_status_preview"></i>
39
  </h2>
includes/forms/theme-menu.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Exit if accessed directly
3
+ if ( !defined( 'ABSPATH' ) ) exit;
4
+ ?>
5
+
6
+ <select class="ctc-select" id="ctc_theme_<?php echo $template; ?>" name="ctc_theme_<?php echo $template; ?>"
7
+ style="visibility:hidden" <?php echo $this->ctc()->is_theme() ? '' : ' disabled '; ?> autocomplete="off" >
8
+ <?php
9
+ uasort( $this->ctc()->themes[ $template ], array( $this, 'cmp_theme' ) );
10
+ foreach ( $this->ctc()->themes[ $template ] as $slug => $theme )
11
+ echo '<option value="' . $slug . '"' . ( $slug == $selected ? ' selected' : '' ) . '>'
12
+ . esc_attr( $theme[ 'Name' ] ) . '</option>' . LF;
13
+ ?>
14
+ </select>
15
+ <div style="display:none">
16
+ <?php
17
+ foreach ( $this->ctc()->themes[ $template ] as $slug => $theme )
18
+ include ( CHLD_THM_CFG_DIR . '/includes/forms/themepreview.php' ); ?>
19
+ </div>
includes/forms/zipform.php CHANGED
@@ -3,7 +3,7 @@ if ( !defined( 'ABSPATH' ) ) exit;
3
  ?>
4
  <form id="ctc_export_theme_form" method="post" action="?page=<?php echo CHLD_THM_CFG_MENU; ?>">
5
  <?php wp_nonce_field( apply_filters( 'chld_thm_cfg_action', 'ctc_update' ) ); ?>
6
- <input class="ctc_submit button button-primary" name="ctc_export_child_zip" type="submit" value="<?php _e( 'Export Zip', 'child-theme-configurator' ); ?>" />
7
  <input type="hidden" id="ctc_export_theme" name="ctc_export_theme" value="" />
8
  </form>
9
 
3
  ?>
4
  <form id="ctc_export_theme_form" method="post" action="?page=<?php echo CHLD_THM_CFG_MENU; ?>">
5
  <?php wp_nonce_field( apply_filters( 'chld_thm_cfg_action', 'ctc_update' ) ); ?>
6
+ <input class="ctc_submit button button-primary" name="ctc_export_child_zip" type="submit" value="<?php _e( 'Export Child Theme', 'child-theme-configurator' ); ?>" />
7
  <input type="hidden" id="ctc_export_theme" name="ctc_export_theme" value="" />
8
  </form>
9
 
includes/help/de_DE.php CHANGED
@@ -4,8 +4,8 @@ if ( !defined( 'ABSPATH' ) ) exit;
4
  ?>
5
  <!-- BEGIN tab -->
6
  <h3 id="ctc_tutorial">Hier starten: Anleitungs-Videos</h3>
7
- <p><iframe width="560" height="315" src="https://www.youtube.com/embed/xL0YmieF6d0?rel=0&modestbranding=1" frameborder="0" allowfullscreen></iframe></p>
8
- <p><iframe width="560" height="315" src="https://www.youtube.com/embed/vhQ5oi20rYE?rel=0&modestbranding=1" frameborder="0" allowfullscreen></iframe></p>
9
  <p>Wir betten aus Leistungsgründen keine Anleitungsvideos mehr ein. <a href="http://www.childthemeconfigurator.com/tutorial-videos" target="_blank">Hier klicken, um die Videos anzuschauen.</a></p><!-- END tab -->
10
  <!-- BEGIN tab -->
11
  <h3 id="ctc_getting_started">Eltern/Kind-Tab</h3>
4
  ?>
5
  <!-- BEGIN tab -->
6
  <h3 id="ctc_tutorial">Hier starten: Anleitungs-Videos</h3>
7
+ <!-- p><iframe width="560" height="315" src="https://www.youtube.com/embed/xL0YmieF6d0?rel=0&modestbranding=1" frameborder="0" allowfullscreen></iframe></p>
8
+ <p><iframe width="560" height="315" src="https://www.youtube.com/embed/vhQ5oi20rYE?rel=0&modestbranding=1" frameborder="0" allowfullscreen></iframe></p -->
9
  <p>Wir betten aus Leistungsgründen keine Anleitungsvideos mehr ein. <a href="http://www.childthemeconfigurator.com/tutorial-videos" target="_blank">Hier klicken, um die Videos anzuschauen.</a></p><!-- END tab -->
10
  <!-- BEGIN tab -->
11
  <h3 id="ctc_getting_started">Eltern/Kind-Tab</h3>
includes/help/en_US.php CHANGED
@@ -4,9 +4,9 @@ if ( !defined( 'ABSPATH' ) ) exit;
4
  ?>
5
  <!-- BEGIN tab -->
6
  <h3 id="ctc_tutorial">Start Here: Tutorial Videos</h3>
7
- <p><iframe width="560" height="315" src="https://www.youtube.com/embed/xL0YmieF6d0?rel=0&modestbranding=1" frameborder="0" allowfullscreen></iframe></p>
8
- <p><iframe width="560" height="315" src="https://www.youtube.com/embed/vhQ5oi20rYE?rel=0&modestbranding=1" frameborder="0" allowfullscreen></iframe></p>
9
- <p>Many more videos are available. <a href="<?php echo CHLD_THM_CFG_DOCS_URL; ?>/tutorial-videos" target="_blank">Click here to view videos.</a></p><!-- END tab -->
10
  <!-- BEGIN tab -->
11
  <h3 id="ctc_getting_started">Parent/Child Tab</h3>
12
  <ol><li><strong>Select an action:</strong>
4
  ?>
5
  <!-- BEGIN tab -->
6
  <h3 id="ctc_tutorial">Start Here: Tutorial Videos</h3>
7
+ <!--p><iframe width="560" height="315" src="https://www.youtube.com/embed/xL0YmieF6d0?rel=0&modestbranding=1" frameborder="0" allowfullscreen></iframe></p>
8
+ <p><iframe width="560" height="315" src="https://www.youtube.com/embed/vhQ5oi20rYE?rel=0&modestbranding=1" frameborder="0" allowfullscreen></iframe></p -->
9
+ <p><a href="<?php echo CHLD_THM_CFG_DOCS_URL; ?>/tutorial-videos" target="_blank">Click here to view videos.</a></p><!-- END tab -->
10
  <!-- BEGIN tab -->
11
  <h3 id="ctc_getting_started">Parent/Child Tab</h3>
12
  <ol><li><strong>Select an action:</strong>
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.0.5
6
  * Author: Lilaea Media
7
  * Author URI: http://www.lilaeamedia.com/
8
  * License: GPLv2
@@ -33,7 +33,12 @@
33
  }
34
  return '';
35
  },
36
-
 
 
 
 
 
37
  frascii: function( str ) {
38
  var ascii = parseInt( str ),
39
  chr = String.fromCharCode( ascii );
@@ -146,7 +151,7 @@
146
  parent = $( '#ctc_theme_parnt' ).val(),
147
  slugbase= parent + '-child',
148
  slug = slugbase,
149
- name = window.ctcAjax.themes.parnt[ parent ].Name + ' Child',
150
  suffix = '',
151
  padded = '',
152
  pad = '00';
@@ -861,7 +866,7 @@
861
  self.currparnt = window.ctcAjax.themes.child[ themedir ].Template;
862
  self.autogen_slugs();
863
  $( '#ctc_theme_parnt' ).val( self.currparnt );
864
- $( '#ctc_theme_parnt-button .ui-selectmenu-text' ).text( window.ctcAjax.themes.parnt[ self.currparnt ].Name );
865
  self.set_theme_params( 'child', themedir );
866
  //self.set_child_menu( document.getElementById( 'ctc_theme_child' ) );
867
  if ( $( '#ctc_child_type_duplicate' ).is( ':checked' ) ) {
@@ -881,7 +886,7 @@
881
  $( '#ctc_child_template' ).val( '' );
882
  $( '#theme_slug_container' ).text( themedir );
883
  $( '.ctc-analyze-theme, .ctc-analyze-howto' ).show();
884
- $( '#ctc_child_name' ).val( window.ctcAjax.themes.child[ themedir ].Name );
885
  $( '#ctc_load_styles' ).val( 'Configure Child Theme' );
886
  }
887
  $( '#input_row_existing_theme_option' ).slideDown( 'fast' );
@@ -891,7 +896,7 @@
891
  self.autogen_slugs();
892
  //themedir = $( '#ctc_theme_parnt' ).val();
893
  $( '#ctc_theme_parnt' ).val( self.currparnt );
894
- $( '#ctc_theme_parnt-button .ui-selectmenu-text' ).text( window.ctcAjax.themes.parnt[ self.currparnt ].Name );
895
  //console.log( 'update_form (new) ... ' + self.currparnt );
896
  //self.set_parent_menu( document.getElementById( 'ctc_theme_parnt' ) );
897
  //console.log( 'setting to new...' + $( '#ctc_theme_parnt' ).val() );
@@ -1091,13 +1096,16 @@
1091
  var self = this;
1092
  //console.log( 'ajax_post: ' + obj );
1093
  //console.log( data );
 
 
1094
  // get ajax url from localized object
1095
  $.ajax( {
1096
  url: window.ctcAjax.ajaxurl,
1097
  data: data,
1098
  dataType:
1099
  //'ctc_update' === data.action && 'qsid' === obj ? 'text' :
1100
- //'ctc_update' == data.action && // 'rule_val' == obj ? 'text' : // 'qsid' == obj ? 'text' :
 
1101
  ( self.is_empty( datatype ) ? 'json' : datatype ),
1102
  type: 'POST'
1103
  } ).done( function( response ) {
@@ -1355,7 +1363,7 @@
1355
  },
1356
  // render debug output
1357
  debug: function( res ) {
1358
- $( '#ctc_debug_container' ).html( res.data );
1359
  //console.log( 'debug:' );
1360
  //console.log( res.data );
1361
  },
@@ -1644,6 +1652,13 @@
1644
  } );
1645
 
1646
  $( '#ctc_is_debug' ).on( 'change', function( ) {
 
 
 
 
 
 
 
1647
  self.save( this );
1648
  } );
1649
 
@@ -1693,10 +1708,9 @@
1693
  //console.log( 'trmcss: ' + str );
1694
  return 'undefined' === typeof str ? '' : str.replace( /\-css$/, '' );
1695
  },
1696
- show_loading: function( resubmit ) {
1697
  var template = $.chldthmcfg.existing ? 'child' : 'parnt',
1698
- stylesheet = ( 'child' === template ? $.chldthmcfg.currchild : $.chldthmcfg.currparnt ),
1699
- name = window.ctcAjax.themes[ template ][ stylesheet ].Name,
1700
  notice = '<strong class="ctc_analyze_loading"><span class="spinner is-active"></span>' +
1701
  $.chldthmcfg.getxt( resubmit ? 'anlz1' : 'anlz2' ) + ' ' + name + '...</strong>';
1702
  self.noticediv = ( 'child' === template ? '' : '' );
@@ -1745,6 +1759,7 @@
1745
  ctc_ext_loaded: 0,
1746
  ctc_child_loaded: 0,
1747
  ctc_parnt_loaded: 0,
 
1748
  thm_past_wphead: 0,
1749
  thm_unregistered: 0,
1750
  thm_parnt_loaded: 0,
@@ -1760,10 +1775,10 @@
1760
 
1761
  //console.log( 'Fetching home page: ' + url );
1762
  $.get( url, function( data ) {
1763
-
1764
- //if ( 'child' === template ) {
1765
- console.log( data );
1766
- //}
1767
  // retrieve enqueued stylesheet ids
1768
  if ( ( queue = data.match( /BEGIN WP QUEUE\n([\s\S]*?)\nEND WP QUEUE/ ) ) ) {
1769
  analysis.queue = queue[ 1 ].split(/\n/);
@@ -1855,7 +1870,15 @@
1855
  themeloaded = 1; // flag that main theme stylesheet has been detected
1856
  // if main theme stylesheet link has no id then it is unregistered ( hard-wired )
1857
  if ( 'parnt' === linktheme ) {
1858
- analysis.signals.thm_parnt_loaded = noid ? 'thm_unregistered' : stylesheetid;
 
 
 
 
 
 
 
 
1859
  } else {
1860
  analysis.signals.thm_child_loaded = noid ? 'thm_unregistered' : stylesheetid;
1861
  }
@@ -1924,8 +1947,7 @@
1924
  //console.log( 'in css_notice' );
1925
  var self = this,
1926
  template = $.chldthmcfg.existing ? 'child' : 'parnt',
1927
- stylesheet = ( 'child' === template ? $.chldthmcfg.currchild : $.chldthmcfg.currparnt ),
1928
- name = window.ctcAjax.themes[ template ][ stylesheet ].Name,
1929
  hidden = '',
1930
  notice = {
1931
  notices: [],
@@ -1937,20 +1959,17 @@
1937
  },
1938
  resubmit = 0,
1939
  resubmitdata= {},
1940
- anlz;
1941
- // legacy support for Pro
1942
- $( window.ctcAjax.addl_css ).each( function( ndx, el ) {
1943
- $( '#ctc_stylesheet_files .ctc_checkbox' ).each( function() {
1944
- //console.log( 'plugin stylesheet match' );
1945
- if ( el === $( this ).val() ) { $( this ).prop( 'checked', true ); }
1946
- } );
1947
- } );
1948
 
1949
  if ( self.analysis[ template ].signals.failure ||
1950
  ( self.analysis[ template ].signals.thm_noqueue && !self.phperr[ template ].length ) ) {
 
 
 
1951
  notice.notices.push( {
1952
  headline: $.chldthmcfg.getxt( 'anlz4', name ),
1953
- msg: $.chldthmcfg.getxt( 'anlz5' ), // + self.analysis[ template ].signals.xhrerr,
1954
  style: 'notice-warning'
1955
  } );
1956
  } else {
@@ -2271,7 +2290,7 @@
2271
  self.do_analysis();
2272
  } );
2273
  // if page is success response run the analyzer on load
2274
- if ( self.is_success() || window.ctcAjax.pluginmode ) {
2275
  self.do_analysis();
2276
  }
2277
  },
2
  * Script: chldthmcfg.js
3
  * Plugin URI: http://www.childthemeconfigurator.com/
4
  * Description: Handles jQuery, AJAX and other UI
5
+ * Version: 2.1.0
6
  * Author: Lilaea Media
7
  * Author URI: http://www.lilaeamedia.com/
8
  * License: GPLv2
33
  }
34
  return '';
35
  },
36
+
37
+ getname: function( template ){
38
+ var stylesheet = ( 'child' === template ? $.chldthmcfg.currchild : $.chldthmcfg.currparnt );
39
+ return window.ctcAjax.themes[ template ][ stylesheet ].Name;
40
+ },
41
+
42
  frascii: function( str ) {
43
  var ascii = parseInt( str ),
44
  chr = String.fromCharCode( ascii );
151
  parent = $( '#ctc_theme_parnt' ).val(),
152
  slugbase= parent + '-child',
153
  slug = slugbase,
154
+ name = $.chldthmcfg.getname( 'parnt' ) + ' Child',
155
  suffix = '',
156
  padded = '',
157
  pad = '00';
866
  self.currparnt = window.ctcAjax.themes.child[ themedir ].Template;
867
  self.autogen_slugs();
868
  $( '#ctc_theme_parnt' ).val( self.currparnt );
869
+ $( '#ctc_theme_parnt-button .ui-selectmenu-text' ).text( self.getname( 'parnt' ) );
870
  self.set_theme_params( 'child', themedir );
871
  //self.set_child_menu( document.getElementById( 'ctc_theme_child' ) );
872
  if ( $( '#ctc_child_type_duplicate' ).is( ':checked' ) ) {
886
  $( '#ctc_child_template' ).val( '' );
887
  $( '#theme_slug_container' ).text( themedir );
888
  $( '.ctc-analyze-theme, .ctc-analyze-howto' ).show();
889
+ $( '#ctc_child_name' ).val( self.getname( 'child' ) );
890
  $( '#ctc_load_styles' ).val( 'Configure Child Theme' );
891
  }
892
  $( '#input_row_existing_theme_option' ).slideDown( 'fast' );
896
  self.autogen_slugs();
897
  //themedir = $( '#ctc_theme_parnt' ).val();
898
  $( '#ctc_theme_parnt' ).val( self.currparnt );
899
+ $( '#ctc_theme_parnt-button .ui-selectmenu-text' ).text( $.chldthmcfg.getname( 'parnt' ) );
900
  //console.log( 'update_form (new) ... ' + self.currparnt );
901
  //self.set_parent_menu( document.getElementById( 'ctc_theme_parnt' ) );
902
  //console.log( 'setting to new...' + $( '#ctc_theme_parnt' ).val() );
1096
  var self = this;
1097
  //console.log( 'ajax_post: ' + obj );
1098
  //console.log( data );
1099
+ //console.log( window.ctcAjax.ajaxurl );
1100
+ //console.log( window.ctcAjax.ajaxurl );
1101
  // get ajax url from localized object
1102
  $.ajax( {
1103
  url: window.ctcAjax.ajaxurl,
1104
  data: data,
1105
  dataType:
1106
  //'ctc_update' === data.action && 'qsid' === obj ? 'text' :
1107
+ //'ctc_update' == data.action && //
1108
+ //'rule_val' === obj ? 'text' : // 'qsid' == obj ? 'text' :
1109
  ( self.is_empty( datatype ) ? 'json' : datatype ),
1110
  type: 'POST'
1111
  } ).done( function( response ) {
1363
  },
1364
  // render debug output
1365
  debug: function( res ) {
1366
+ $( '#ctc_debug_box' ).val( $( '#ctc_debug_box' ).val() + res.data );
1367
  //console.log( 'debug:' );
1368
  //console.log( res.data );
1369
  },
1652
  } );
1653
 
1654
  $( '#ctc_is_debug' ).on( 'change', function( ) {
1655
+ if ( $( this ).is( ':checked' ) ){
1656
+ if ( !$( '#ctc_debug_box' ).length ){
1657
+ $( '#ctc_debug_container' ).html( '<textarea id="ctc_debug_box"></textarea>' );
1658
+ }
1659
+ } else {
1660
+ $( '#ctc_debug_box' ).remove();
1661
+ }
1662
  self.save( this );
1663
  } );
1664
 
1708
  //console.log( 'trmcss: ' + str );
1709
  return 'undefined' === typeof str ? '' : str.replace( /\-css$/, '' );
1710
  },
1711
+ show_loading: function( resubmit, text ) {
1712
  var template = $.chldthmcfg.existing ? 'child' : 'parnt',
1713
+ name = text ? text : $.chldthmcfg.getname( template ),
 
1714
  notice = '<strong class="ctc_analyze_loading"><span class="spinner is-active"></span>' +
1715
  $.chldthmcfg.getxt( resubmit ? 'anlz1' : 'anlz2' ) + ' ' + name + '...</strong>';
1716
  self.noticediv = ( 'child' === template ? '' : '' );
1759
  ctc_ext_loaded: 0,
1760
  ctc_child_loaded: 0,
1761
  ctc_parnt_loaded: 0,
1762
+ thm_wrong_order: 0,
1763
  thm_past_wphead: 0,
1764
  thm_unregistered: 0,
1765
  thm_parnt_loaded: 0,
1775
 
1776
  //console.log( 'Fetching home page: ' + url );
1777
  $.get( url, function( data ) {
1778
+ //data = '';
1779
+ if ( 'child' === template ) {
1780
+ //console.log( data );
1781
+ }
1782
  // retrieve enqueued stylesheet ids
1783
  if ( ( queue = data.match( /BEGIN WP QUEUE\n([\s\S]*?)\nEND WP QUEUE/ ) ) ) {
1784
  analysis.queue = queue[ 1 ].split(/\n/);
1870
  themeloaded = 1; // flag that main theme stylesheet has been detected
1871
  // if main theme stylesheet link has no id then it is unregistered ( hard-wired )
1872
  if ( 'parnt' === linktheme ) {
1873
+ if ( noid ) {
1874
+ analysis.signals.thm_parnt_loaded = 'thm_unregistered';
1875
+ } else {
1876
+ analysis.signals.thm_parnt_loaded = stylesheetid;
1877
+ // check that parent stylesheet is loaded before child stylesheet
1878
+ if ( 'child' === template && analysis.signals.thm_child_loaded ) {
1879
+ analysis.signals.ctc_parnt_reorder = 1;
1880
+ }
1881
+ }
1882
  } else {
1883
  analysis.signals.thm_child_loaded = noid ? 'thm_unregistered' : stylesheetid;
1884
  }
1947
  //console.log( 'in css_notice' );
1948
  var self = this,
1949
  template = $.chldthmcfg.existing ? 'child' : 'parnt',
1950
+ name = $.chldthmcfg.getname( template ),
 
1951
  hidden = '',
1952
  notice = {
1953
  notices: [],
1959
  },
1960
  resubmit = 0,
1961
  resubmitdata= {},
1962
+ anlz,
1963
+ debugtxt = '';
 
 
 
 
 
 
1964
 
1965
  if ( self.analysis[ template ].signals.failure ||
1966
  ( self.analysis[ template ].signals.thm_noqueue && !self.phperr[ template ].length ) ) {
1967
+ if ( $( '#ctc_is_debug' ).is( ':checked' ) ) {
1968
+ debugtxt = $.chldthmcfg.getxt( 'anlz33' ).replace(/%1/, '<a href="' + self.analysis[ template ].url + '" target="_new">' ).replace( /%2/, '</a>' );
1969
+ }
1970
  notice.notices.push( {
1971
  headline: $.chldthmcfg.getxt( 'anlz4', name ),
1972
+ msg: $.chldthmcfg.getxt( 'anlz5' ) + debugtxt, // + self.analysis[ template ].signals.xhrerr,
1973
  style: 'notice-warning'
1974
  } );
1975
  } else {
2290
  self.do_analysis();
2291
  } );
2292
  // if page is success response run the analyzer on load
2293
+ if ( self.is_success() && !window.ctcAjax.pluginmode ) {
2294
  self.do_analysis();
2295
  }
2296
  },
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):""},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(i,s){return e.each(s,function(e,s){return s=null,e.toLowerCase()!==t.toLowerCase()||"parnt"!==i&&"new"!==c?void 0:(n=!0,!1)}),n?!1:void 0}),n},validate:function(){var t=this,c=/[^\w\-]/,n=e("#ctc_child_template").length?e("#ctc_child_template").val().toString().replace(c):"",i=e("#ctc_theme_child").length?e("#ctc_theme_child").val().toString().replace(c):n,s=e("input[name=ctc_child_type]:checked").val(),a=[];return"new"===s&&(i=n),t.theme_exists(i,s)&&a.push(t.getxt("theme_exists").toString().replace(/%s/,i)),t.is_empty(i)&&a.push(t.getxt("inval_theme")),a.length?(t.set_notice({error:a}),!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=c+"-child",i=n,s=window.ctcAjax.themes.parnt[c].Name+" Child",a="",r="",l="00";t.theme_exists(i,"new");)a=t.is_empty(a)?2:a+1,r=l.substring(0,l.length-a.toString().length)+a.toString(),i=n+r;t.testslug=i,t.testname=s+(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")},selector_input_toggle:function(t){var c,n=this;e("#ctc_rewrite_selector").length?(c=e("#ctc_rewrite_selector_orig").val(),e("#ctc_sel_ovrd_selector_selected").text(c),e(t).text(n.getxt("rename"))):(c=e("#ctc_sel_ovrd_selector_selected").text(),e("#ctc_sel_ovrd_selector_selected").html('<textarea id="ctc_rewrite_selector" name="ctc_rewrite_selector" autocomplete="off"></textarea><input id="ctc_rewrite_selector_orig" name="ctc_rewrite_selector_orig" type="hidden" value="'+n.escquo(c)+'"/>'),e("#ctc_rewrite_selector").val(c),e(t).text(n.getxt("cancel")))},coalesce_inputs:function(t){var c=this,n=e(t).attr("id"),i=/^(ctc_(ovrd|\d+)_(parent|child)_([0-9a-z\-]+)_(\d+?)(_(\d+))?)(_\w+)?$/,s=e(t).parents(".ctc-selector-row, .ctc-parent-row").first(),a=s.find(".ctc-swatch").first(),r={parent:{},child:{}},l={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,a=e(this).attr("id"),d=a.toString().match(i),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],v="parent"===h?e(this).text().replace(/!$/,""):"seq"!==p&&"ctc_delete_query_selector"===n?"":e(this).val(),y="seq"===p?!1:"ctc_"+u+"_child_"+p+"_i_"+g+"_"+m;if("child"===h&&(c.is_empty(e(this).data("color"))||(v=c.color_text(e(this).data("color")),e(this).data("color",null)),_[a]=v,y&&(_[y]=e("#"+y).is(":checked")?1:0)),""!==v)if(c.is_empty(f))if(t=p.toString().match(/^border(\-(top|right|bottom|left))?$/)&&!v.match(/none/)){var w=new RegExp(c.border_regx+c.color_regx,"i");s=v.toString().match(w),c.is_empty(s)||(s.shift(),r[h][p+"-width"]=s.shift()||"",s.shift(),r[h][p+"-style"]=s.shift()||"",r[h][p+"-color"]=s.shift()||"")}else if("background-image"!==p||v.match(/none/))"seq"!==p&&(r[h][p]=v);else if(v.toString().match(/url\(/))r[h]["background-image"]=c.image_url(h,v);else{var x=new RegExp(c.grad_regx+c.color_regx+c.color_regx,"i");s=v.toString().match(x),!c.is_empty(s)&&s.length>2?(s.shift(),l[h].origin=s.shift()||"top",l[h].start=s.shift()||"transparent",l[h].end=s.shift()||"transparent",o[h]=!0):r[h]["background-image"]=v}else switch(f){case"_border_width":r[h][p+"-width"]="none"===v?0:v;break;case"_border_style":r[h][p+"-style"]=v;break;case"_border_color":r[h][p+"-color"]=v;break;case"_background_url":r[h]["background-image"]=c.image_url(h,v);break;case"_background_color":r[h]["background-color"]=v;break;case"_background_color1":l[h].start=v,o[h]=!0;break;case"_background_color2":l[h].end=v,o[h]=!0;break;case"_background_origin":l[h].origin=v,o[h]=!0}}),"undefined"==typeof a||c.is_empty(a.attr("id"))||(a.removeAttr("style"),o.parent&&a.ctcgrad(l.parent.origin,[l.parent.start,l.parent.end]),a.css(r.parent),a.attr("id").toString().match(/parent/)||(o.child&&a.ctcgrad(l.child.origin,[l.child.start,l.child.end]),a.css(r.child)),a.css({"z-index":-1})),_},decode_value:function(e,t){t="undefined"==typeof t?"":t;var c,n=this,i={orig:t,names:[""],values:[t]};if(e.toString().match(/^border(\-(top|right|bottom|left))?$/)){var s,a=new RegExp(n.border_regx+"("+n.color_regx+")?","i");c=t.toString().match(a),n.is_empty(c)&&(c=[]),i.names=["_border_width","_border_style","_border_color"],s=c.shift(),i.values[0]=c.shift()||"",c.shift(),i.values[1]=c.shift()||"",c.shift(),i.values[2]=c.shift()||""}else if(e.toString().match(/^background\-image/))if(i.names=["_background_url","_background_origin","_background_color1","_background_color2"],i.values=["","","",""],n.is_empty(t)||t.toString().match(/(url|none)/))i.values[0]=t;else{var r,l;c=t.toString().split(/:/),i.values[1]=c.shift()||"",i.values[2]=c.shift()||"",r=c.shift()||"",i.values[3]=c.shift()||"",l=c.shift()||"",i.orig=[i.values[1],i.values[2],i.values[3]].join(" ")}return i},image_url:function(e,t){var c,n=this,i=t.toString().match(/url\(['" ]*(.+?)['" ]*\)/),s=n.is_empty(i)?null:i[1],a=window.ctcAjax.theme_uri+"/"+("parent"===e?window.ctcAjax.parnt:window.ctcAjax.child)+"/";return s?c=s.toString().match(/^(data:|https?:|\/)/)?t:"url("+a+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=[],i=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){i.test(t)&&n.push({label:t,value:t})}),c(n)},get_selectors:function(t,c){var n=[],i=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){i.test(e)&&n.push({label:e,value:t})}),c(n)},get_rules:function(t,c){var n=[],i=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){i.test(e)&&n.push({label:e,value:t})}),c(n)},get_filtered_rules:function(t,c){var n=[],i=new RegExp(e.ui.autocomplete.escapeRegex(t.term),"i");e.each(e("#ctc_rule_menu").data("menu"),function(e,t){i.test(e)&&n.push({label:e,value:t})}),c(n)},merge_ruleval_arrays:function(t,c,n){var i=this,s={},a=n?c.child.pop():null;return e.each(["parnt","child"],function(t,r){i.is_empty(c[r])||e.each(c[r],function(e,t){n?parseInt(t[2])>=parseInt(a[2])&&(a[2]=parseInt(t[2])+1):(i.is_empty(s[t[2]])&&(s[t[2]]={}),s[t[2]][r]=t)})}),n&&(s[a[2]]={parnt:[],child:a}),s},input_row:function(t,c,n,i,s){var a=this,r="";if(!a.is_empty(i)&&!a.is_empty(i.value)&&!a.is_empty(i.value[c])){var l=i.value[c],o=a.merge_ruleval_arrays(c,l,s);e.each(o,function(s,l){var o=a.decode_value(c,a.is_empty(l.parnt)?"":l.parnt[0]),_=a.is_empty(l.parnt)||a.is_empty(l.parnt[1],1)?0:1,d=a.decode_value(c,a.is_empty(l.child)?"":l.child[0]),u=a.is_empty(l.child)||a.is_empty(l.child[1],1)?0:1;if(r+='<div class="ctc-'+("ovrd"===n?"input":"selector")+'-row clearfix"><div class="ctc-input-cell">',r+="ovrd"===n?c.replace(/\d+/g,a.frascii):i.selector+'<br/><a href="#" class="ctc-selector-edit" id="ctc_selector_edit_'+t+'" >'+a.getxt("edit")+"</a> "+(a.is_empty(o.orig)?a.getxt("child_only"):""),r+='</div><div class="ctc-parent-value ctc-input-cell"'+("ovrd"!==n?' style="display:none"':"")+' id="ctc_'+n+"_parent_"+c+"_"+t+"_"+s+'">'+(a.is_empty(o.orig)?"[no value]":o.orig+(_?a.getxt("important"):""))+'</div><div class="ctc-input-cell">',!a.is_empty(o.names)){e.each(o.names,function(e,i){i=a.is_empty(i)?"":i,r+='<div class="ctc-child-input-cell clear">';var l,o="ctc_"+n+"_child_"+c+"_"+t+"_"+s+i;!1===(l=d.values.shift())&&(l=""),r+=(a.is_empty(i)?"":a.getxt(i)+":<br/>")+'<input type="text" id="'+o+'" name="'+o+'" class="ctc-child-value'+((i+c).toString().match(/color/)?" color-picker":"")+(i.toString().match(/url/)?" ctc-input-wide":"")+'" value="'+a.escquo(l)+'" /></div>'});var h="ctc_"+n+"_child_"+c+"_i_"+t+"_"+s;r+='<label for="'+h+'"><input type="checkbox" id="'+h+'" name="'+h+'" value="1" '+(u?"checked":"")+" />"+a.getxt("important")+"</label>"}r+="</div>","ovrd"!==n&&(r+='<div class="ctc-swatch ctc-specific" id="ctc_child_'+c+"_"+t+"_"+s+'_swatch">'+a.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>'),r+="</div><!-- end input row -->\n"})}return r},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(i){c.jquery_exception(i,"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(e,c){return t.set_query(c.item.value),!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(e,c){return t.set_selector(c.item.value,c.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 i,s,a=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]),i=e(t.input_row(t.currqsid,a,"ovrd",t.currdata,!0)),e("#ctc_sel_ovrd_rule_inputs").append(i),e("#ctc_new_rule_menu").val(""),i.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(window.ctcAjax.themes.parnt[c.currparnt].Name),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(window.ctcAjax.themes.child[t].Name),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(window.ctcAjax.themes.parnt[c.currparnt].Name),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,i="";n.is_empty(t)||e.each(t,function(t,c){i+='<div class="'+t+' notice is-dismissible dashicons-before"><ul>\n',e(c).each(function(e,t){i+="<li>"+t.toString()+"</li>\n"}),i+="</ul></div>"}),c=e(i),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())},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 i=this,s={ctc_query_obj:t,ctc_query_key:c},a="#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(a+" .ctc-status-icon").remove(),e(a).append('<span class="ctc-status-icon spinner is-active query-icon"></span>'),s.action=i.is_empty(e("#ctc_action").val())||"plugin"!==e("#ctc_action").val()?"ctc_query":"ctc_plgqry",s._wpnonce=e("#_wpnonce").val(),i.ajax_post(t,s)},save:function(t){var c,n,i,s,a,r=this,l={},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>'),l.ctc_configtype=e(t).val()):(c=e("#ctc_new_selectors"))&&"ctc_save_new_selectors"===e(t).attr("id")?(l.ctc_new_selectors=c.val(),(n=e("#ctc_sel_ovrd_query_selected"))&&(l.ctc_sel_ovrd_query=n.text()),r.reload=!0):(i=e("#ctc_child_imports"))&&"ctc_save_imports"===o?l.ctc_child_imports=i.val():"ctc_is_debug"===o?l.ctc_is_debug=e("#ctc_is_debug").is(":checked")?1:0:l=r.coalesce_inputs(t),e(".save-icon").addClass("is-active"),e("#ctc_sel_ovrd_selector_selected").find("#ctc_rewrite_selector").each(function(){s=e("#ctc_rewrite_selector").val(),a=e("#ctc_rewrite_selector_orig").val(),r.is_empty(s)||!s.toString().match(/\w/)?s=a:(l.ctc_rewrite_selector=s,r.reload=!0),e(".ctc-rewrite-toggle").text(r.getxt("rename")),e("#ctc_sel_ovrd_selector_selected").html(s)}),l.action=r.is_empty(e("#ctc_action").val())||"plugin"!==e("#ctc_action").val()?"ctc_update":"ctc_plugin",l._wpnonce=e("#_wpnonce").val(),r.ajax_post("qsid",l)},ajax_post:function(t,c,n){var i=this;e.ajax({url:window.ctcAjax.ajaxurl,data:c,dataType:i.is_empty(n)?"json":n,type:"POST"}).done(function(e){i.handle_success(t,e)}).fail(function(){i.handle_failure(t)}).always(function(){i.jqueryerr.length&&i.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,i=c.is_empty(e.fileName)?"":" "+e.fileName.split(/\?/)[0];c.jqueryerr.push("<code><small>"+t+": "+e.message+i+n+"</small></code>")},jquery_notice:function(t){t=null;var c=this,n=[],i=[];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>")}),i.push("<strong>"+c.getxt("js")+"</strong> "+c.getxt("contact")),i.push(c.jqueryerr.join("<br/>")),n.length&&i.push(c.getxt("jquery")+"<br/>"+n.join("<br/>")),i.push(c.getxt("plugin"))),c.set_notice({error:i})},update:{qsid:function(t){var c,n,i,s,a=this;a.currqsid=t.key,a.currdata=t.data,e("#ctc_sel_ovrd_qsid").val(a.currqsid),a.is_empty(a.currdata.seq)?e("#ctc_child_load_order_container").empty():(c="ctc_ovrd_child_seq_"+a.currqsid,i=parseInt(a.currdata.seq),n='<input type="text" id="'+c+'" name="'+c+'" class="ctc-child-value" value="'+i+'" />',e("#ctc_child_load_order_container").html(n)),a.is_empty(a.currdata.value)?(s=!0,e("#ctc_sel_ovrd_rule_inputs").empty()):(s=!1,n="",e.each(a.currdata.value,function(e,t){t=null,n+=a.input_row(a.currqsid,e,"ovrd",a.currdata)}),e("#ctc_sel_ovrd_rule_inputs").html(n).find(".color-picker").each(function(){a.setup_spectrum(this)}),a.coalesce_inputs("#ctc_child_all_0_swatch")),a.reload&&(a.load_queries(),a.set_query(a.currdata.query),a.load_rules()),e("#ctc_sel_ovrd_selector_selected").text(a.currdata.selector),e(".ctc-rewrite-toggle").text(a.getxt("rename")),e(".ctc-rewrite-toggle").show(),s?e("#ctc_sel_ovrd_rule_header,#ctc_sel_ovrd_new_rule,#ctc_sel_ovrd_rule_inputs_container,#ctc_sel_ovrd_rule_inputs").hide():e("#ctc_sel_ovrd_rule_header,#ctc_sel_ovrd_new_rule,#ctc_sel_ovrd_rule_inputs_container,#ctc_sel_ovrd_rule_inputs").show()},rule_val:function(t){var c=this,n=e("#ctc_rule_menu_selected").text(),i='<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);i+='<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'}),i+="</div>\n"),e("#ctc_rule_value_inputs").html(i).find(".ctc-swatch").each(function(){c.coalesce_inputs(this)})},val_qry:function(t){var c,n,i=this,s="";i.is_empty(t.data)||e.each(t.data,function(n,a){c=n,e.each(a,function(c,a){s+='<h4 class="ctc-query-heading">'+c+"</h4>\n",i.is_empty(a)||e.each(a,function(e,c){s+=i.input_row(e,n,t.key,c)})})}),n="#ctc_selector_"+c+"_"+t.key+"_rows",e(n).html(s).find(".color-picker").each(function(){i.setup_spectrum(this)}),e(n).find(".ctc-swatch").each(function(){i.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_container").html(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),i=e('<button type="button" class="notice-dismiss"><span class="screen-reader-text"></span></button>'),s=window.commonL10n.dismiss||"";i.find(".screen-reader-text").text(s),n.append(i),i.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>"),i=c.value.replace(/[^\w\-]/,"");return e("#ctc_theme_option_"+i).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,i,s=e(this).attr("id").toString().replace("_close",""),a=s.toString().match(/_([^_]+)_(\d+)$/);e("#"+s+"_container").is(":hidden")&&(t.is_empty(a[1])||t.is_empty(a[2])||(n=a[1],i=a[2],t.query_css("val_qry",i,{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){c.preventDefault(),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(){return e(this).hasClass("ajax-pending")?!1:(e(this).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(){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){var c=e.chldthmcfg.existing?"child":"parnt",n="child"===c?e.chldthmcfg.currchild:e.chldthmcfg.currparnt,i=window.ctcAjax.themes[c][n].Name,s='<strong class="ctc_analyze_loading"><span class="spinner is-active"></span>'+e.chldthmcfg.getxt(t?"anlz1":"anlz2")+" "+i+"...</strong>";self.noticediv="",e("#"+c+"_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,n,i,s=this,a=Math.floor(e.now()/1e3),r="child"===t?e.chldthmcfg.currchild:e.chldthmcfg.currparnt,l="&template="+e.chldthmcfg.currparnt+"&stylesheet="+r+"&now="+a,o=s.setssl(window.ctcAjax.homeurl),_=window.ctcAjax.theme_uri.replace(/^https?:\/\//,""),d=o+l,u=s.escrgx(e.chldthmcfg.currparnt)+("child"===t?"|"+s.escrgx(r):""),h=new RegExp("<link( rel=[\"']stylesheet[\"'] id=['\"]([^'\"]+?)['\"])?[^>]+?"+s.escrgx(_)+"/("+u+")/([^\"']+\\.css)(\\?[^\"']+)?[\"'][^>]+>","gi"),p=/<br \/>\n[^\n]+?(fatal|strict|notice|warning|error)[\s\S]+?<br \/>/gi,m=0,g=0,f={url:d,deps:[[],[]],signals:{},queue:[],irreg:[]};e.get(d,function(a){for((n=a.match(/BEGIN WP QUEUE\n([\s\S]*?)\nEND WP QUEUE/))?f.queue=n[1].split(/\n/):(f.queue=[],f.signals.thm_noqueue=1),(n=a.match(/BEGIN CTC IRREGULAR\n([\s\S]*?)\nEND CTC IRREGULAR/))?f.irreg=n[1].split(/\n/):f.irreg=[],a.match(/CHLD_THM_CFG_IGNORE_PARENT/)&&(f.signals.thm_ignoreparnt=1),a.match(/IS_CTC_THEME/)&&(f.signals.thm_is_ctc=1),a.match(/NO_CTC_STYLES/)&&(f.signals.thm_no_styles=1),a.match(/HAS_CTC_IMPORT/)&&(f.signals.thm_has_import=1),a=a.replace(/<!\-\-[\s\S]*?\-\->/g,"");c=p.exec(a);){var r=c[0].replace(/<.*?>/g,"");s.phperr[t].push(r),f.signals.err_php=1,r.match(/Fatal error/i)&&(f.signals.err_fatal=1)}for(;i=h.exec(a);){var l=s.trmcss(i[2]),o=i[3],_=i[4],d=e.chldthmcfg.currparnt===o?"parnt":"child",u=0;if(""===l||-1===e.inArray(l,f.queue))u=1;else if(0===l.indexOf("chld_thm_cfg")){_.match(/^ctc\-style([\-\.]min)?\.css$/)?(m=1,f.signals.ctc_sep_loaded=1):_.match(/^ctc\-genesis([\-\.]min)?\.css$/)?(m=1,f.signals.ctc_gen_loaded=1):l.match(/$chld_thm_cfg_ext/)?(f.signals.ctc_ext_loaded=1,
2
- f.deps[m].push([l,_])):"chld_thm_cfg_child"===l?(f.signals.ctc_child_loaded=1,f.deps[m].push([l,_])):"chld_thm_cfg_parent"===l&&(f.signals.ctc_parnt_loaded=1,f.deps[m].push([l,_]),m&&(f.signals.ctc_parnt_reorder=1));continue}if(_.match(/^style([\-\.]min)?\.css$/))m=1,"parnt"===d?f.signals.thm_parnt_loaded=u?"thm_unregistered":l:f.signals.thm_child_loaded=u?"thm_unregistered":l,u?g?(f.signals.thm_past_wphead=1,f.deps[m].push(["thm_past_wphead",_])):(f.signals.thm_unregistered=1,f.deps[m].push(["thm_unregistered",_])):f.deps[m].push([l,_]);else if("ctc-test.css"===_)g=1;else{var v=null;u&&(v="dep_unregistered"),g&&(v=m?"css_past_wphead":"dep_past_wphead"),v&&(f.signals[v]=1,l=v),f.deps[m].push([l,_])}}m||(f.signals.thm_notheme=1),a=null,s.analysis[t]=f,e(document).trigger("analysisdone")}).fail(function(c,n,i){f.signals.failure=1,f.signals.xhrerr=i,s.analysis[t]=f,e(document).trigger("analysisdone")})},css_notice:function(){var t,c=this,n=e.chldthmcfg.existing?"child":"parnt",i="child"===n?e.chldthmcfg.currchild:e.chldthmcfg.currparnt,s=window.ctcAjax.themes[n][i].Name,a="",r={notices:[]},l={style:"notice-warning",headline:e.chldthmcfg.getxt("anlz3",s),errlist:""},o=0,_={};if(e(window.ctcAjax.addl_css).each(function(t,c){e("#ctc_stylesheet_files .ctc_checkbox").each(function(){c===e(this).val()&&e(this).prop("checked",!0)})}),c.analysis[n].signals.failure||c.analysis[n].signals.thm_noqueue&&!c.phperr[n].length)r.notices.push({headline:e.chldthmcfg.getxt("anlz4",s),msg:e.chldthmcfg.getxt("anlz5"),style:"notice-warning"});else{if(c.phperr[n].length&&(e.each(c.phperr[n],function(t,c){c.match(/Fatal error/i)&&(l.style="error",l.headline=e.chldthmcfg.getxt("anlz8",s)),l.errlist+=c+"\n"}),l.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" style="display:none"><textarea>'+l.errlist+"</textarea></div></div>"+e.chldthmcfg.getxt("anlz7"),r.notices.push(l)),(c.analysis[n].signals.thm_past_wphead||c.analysis[n].signals.dep_past_wphead)&&(r.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()),c.analysis[n].signals.thm_unregistered&&(c.analysis[n].signals.ctc_child_loaded||c.analysis[n].signals.ctc_sep_loaded||(r.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"===n&&(c.analysis.child.signals.ctc_parnt_reorder&&(o=1),c.analysis.child.signals.ctc_child_loaded||c.analysis.child.signals.ctc_sep_loaded||c.analysis.child.signals.thm_child_loaded||(r.notices.push({headline:e.chldthmcfg.getxt("anlz13"),style:"notice-warning",msg:e.chldthmcfg.getxt("anlz14")}),o=1),c.analysis[n].signals.ctc_gen_loaded&&r.notices.push({headline:e.chldthmcfg.getxt("anlz31"),msg:e.chldthmcfg.getxt("anlz32"),style:"notice-warning"}),c.analysis.parnt.signals.thm_no_styles||c.analysis.child.signals.ctc_gen_loaded||c.analysis.child.signals.thm_parnt_loaded||c.analysis.child.signals.ctc_parnt_loaded||c.analysis.child.signals.thm_ignoreparnt||c.analysis.child.signals.thm_has_import||(r.notices.push({headline:e.chldthmcfg.getxt("anlz15"),style:"notice-warning",msg:e.chldthmcfg.getxt("anlz16")}),o=1),c.analysis.child.signals.thm_unregistered&&c.analysis.child.signals.thm_child_loaded&&"thm_unregistered"===c.analysis.child.signals.thm_child_loaded&&c.analysis.child.signals.ctc_child_loaded&&c.analysis.child.signals.ctc_parnt_loaded&&(r.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)),c.analysis.child.signals.thm_is_ctc||e("#ctc_child_type_duplicate").is(":checked")||r.notices.push({headline:e.chldthmcfg.getxt("anlz19"),msg:e.chldthmcfg.getxt("anlz20"),style:"notice-warning"})),(c.analysis[n].signals.ctc_sep_loaded||c.analysis[n].signals.ctc_gen_loaded)&&e("#ctc_handling_separate").prop("checked",!0),r.notices.length||r.notices.push({headline:""+("child"===n?e.chldthmcfg.getxt("anlz17"):e.chldthmcfg.getxt("anlz18")),style:"updated",msg:""}),"child"===n&&c.analysis.child.signals.thm_has_import&&(r.notices.push({headline:e.chldthmcfg.getxt("anlz21"),msg:e.chldthmcfg.getxt("anlz22"),style:"notice-warning"}),e("#ctc_enqueue_import").prop("checked",!0)),c.analysis[n].signals.thm_ignoreparnt||c.analysis[n].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),c.analysis[n].signals.thm_keepdeps?e("#ctc_keepdeps").prop("checked",!0):e("#ctc_keepdeps").prop("checked",!1),!c.analysis[n].signals.ctc_sep_loaded&&!c.analysis[n].signals.ctc_gen_loaded&&!c.analysis[n].signals.ctc_child_loaded&&!c.analysis[n].signals.thm_unregistered&&!c.analysis[n].signals.thm_past_wphead&&c.analysis[n].deps[1].length){var d="";e.each(c.analysis[n].deps[1],function(e,t){t[1].match(/^style([\-\.]min)?\.css$/)||(d+="<li>"+t[1]+"</li>\n")}),""!==d&&(d="<ul class='howto' style='padding-left:1em'>\n"+d+"</ul>\n",r.notices.push({headline:e.chldthmcfg.getxt("anlz23"),msg:d+e.chldthmcfg.getxt("anlz24"),style:"updated"}))}"child"===n&&c.analysis[n].signals.thm_parnt_loaded&&(r.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"),c.analysis.parnt.signals.thm_no_styles&&(r.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 a=encodeURIComponent(JSON.stringify(c.analysis)),e('input[name="ctc_analysis"]').val(a),_.ctc_analysis=a,c.is_success()&&o&&!c.resubmitting?(c.resubmitting=1,void c.resubmit(_)):(c.resubmitting=0,c.hide_loading(),e.each(r.notices,function(t,c){var i=e('<div class="'+c.style+' notice is-dismissible dashicons-before" ><h4>'+c.headline+"</h4>"+c.msg+"</div>");e.chldthmcfg.bind_dismiss(i),i.hide().appendTo("#"+n+"_analysis_notice").slideDown()}),e("#ctc_is_debug").is(":checked")&&(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(c.analysis,null,2)+"</textarea></div></div>",e(t).appendTo("#"+n+"_analysis_notice")),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:{},child:{}},t.phperr={parnt:[],child:[]},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,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="child"===t?e.chldthmcfg.currchild:e.chldthmcfg.currparnt;return window.ctcAjax.themes[t][c].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(i,s){return e.each(s,function(e,s){return s=null,e.toLowerCase()!==t.toLowerCase()||"parnt"!==i&&"new"!==c?void 0:(n=!0,!1)}),n?!1:void 0}),n},validate:function(){var t=this,c=/[^\w\-]/,n=e("#ctc_child_template").length?e("#ctc_child_template").val().toString().replace(c):"",i=e("#ctc_theme_child").length?e("#ctc_theme_child").val().toString().replace(c):n,s=e("input[name=ctc_child_type]:checked").val(),a=[];return"new"===s&&(i=n),t.theme_exists(i,s)&&a.push(t.getxt("theme_exists").toString().replace(/%s/,i)),t.is_empty(i)&&a.push(t.getxt("inval_theme")),a.length?(t.set_notice({error:a}),!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=c+"-child",i=n,s=e.chldthmcfg.getname("parnt")+" Child",a="",l="",r="00";t.theme_exists(i,"new");)a=t.is_empty(a)?2:a+1,l=r.substring(0,r.length-a.toString().length)+a.toString(),i=n+l;t.testslug=i,t.testname=s+(l.length?" "+l:"")}},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")},selector_input_toggle:function(t){var c,n=this;e("#ctc_rewrite_selector").length?(c=e("#ctc_rewrite_selector_orig").val(),e("#ctc_sel_ovrd_selector_selected").text(c),e(t).text(n.getxt("rename"))):(c=e("#ctc_sel_ovrd_selector_selected").text(),e("#ctc_sel_ovrd_selector_selected").html('<textarea id="ctc_rewrite_selector" name="ctc_rewrite_selector" autocomplete="off"></textarea><input id="ctc_rewrite_selector_orig" name="ctc_rewrite_selector_orig" type="hidden" value="'+n.escquo(c)+'"/>'),e("#ctc_rewrite_selector").val(c),e(t).text(n.getxt("cancel")))},coalesce_inputs:function(t){var c=this,n=e(t).attr("id"),i=/^(ctc_(ovrd|\d+)_(parent|child)_([0-9a-z\-]+)_(\d+?)(_(\d+))?)(_\w+)?$/,s=e(t).parents(".ctc-selector-row, .ctc-parent-row").first(),a=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,a=e(this).attr("id"),d=a.toString().match(i),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],v="parent"===h?e(this).text().replace(/!$/,""):"seq"!==p&&"ctc_delete_query_selector"===n?"":e(this).val(),y="seq"===p?!1:"ctc_"+u+"_child_"+p+"_i_"+g+"_"+m;if("child"===h&&(c.is_empty(e(this).data("color"))||(v=c.color_text(e(this).data("color")),e(this).data("color",null)),_[a]=v,y&&(_[y]=e("#"+y).is(":checked")?1:0)),""!==v)if(c.is_empty(f))if(t=p.toString().match(/^border(\-(top|right|bottom|left))?$/)&&!v.match(/none/)){var w=new RegExp(c.border_regx+c.color_regx,"i");s=v.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||v.match(/none/))"seq"!==p&&(l[h][p]=v);else if(v.toString().match(/url\(/))l[h]["background-image"]=c.image_url(h,v);else{var x=new RegExp(c.grad_regx+c.color_regx+c.color_regx,"i");s=v.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"]=v}else switch(f){case"_border_width":l[h][p+"-width"]="none"===v?0:v;break;case"_border_style":l[h][p+"-style"]=v;break;case"_border_color":l[h][p+"-color"]=v;break;case"_background_url":l[h]["background-image"]=c.image_url(h,v);break;case"_background_color":l[h]["background-color"]=v;break;case"_background_color1":r[h].start=v,o[h]=!0;break;case"_background_color2":r[h].end=v,o[h]=!0;break;case"_background_origin":r[h].origin=v,o[h]=!0}}),"undefined"==typeof a||c.is_empty(a.attr("id"))||(a.removeAttr("style"),o.parent&&a.ctcgrad(r.parent.origin,[r.parent.start,r.parent.end]),a.css(l.parent),a.attr("id").toString().match(/parent/)||(o.child&&a.ctcgrad(r.child.origin,[r.child.start,r.child.end]),a.css(l.child)),a.css({"z-index":-1})),_},decode_value:function(e,t){t="undefined"==typeof t?"":t;var c,n=this,i={orig:t,names:[""],values:[t]};if(e.toString().match(/^border(\-(top|right|bottom|left))?$/)){var s,a=new RegExp(n.border_regx+"("+n.color_regx+")?","i");c=t.toString().match(a),n.is_empty(c)&&(c=[]),i.names=["_border_width","_border_style","_border_color"],s=c.shift(),i.values[0]=c.shift()||"",c.shift(),i.values[1]=c.shift()||"",c.shift(),i.values[2]=c.shift()||""}else if(e.toString().match(/^background\-image/))if(i.names=["_background_url","_background_origin","_background_color1","_background_color2"],i.values=["","","",""],n.is_empty(t)||t.toString().match(/(url|none)/))i.values[0]=t;else{var l,r;c=t.toString().split(/:/),i.values[1]=c.shift()||"",i.values[2]=c.shift()||"",l=c.shift()||"",i.values[3]=c.shift()||"",r=c.shift()||"",i.orig=[i.values[1],i.values[2],i.values[3]].join(" ")}return i},image_url:function(e,t){var c,n=this,i=t.toString().match(/url\(['" ]*(.+?)['" ]*\)/),s=n.is_empty(i)?null:i[1],a=window.ctcAjax.theme_uri+"/"+("parent"===e?window.ctcAjax.parnt:window.ctcAjax.child)+"/";return s?c=s.toString().match(/^(data:|https?:|\/)/)?t:"url("+a+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=[],i=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){i.test(t)&&n.push({label:t,value:t})}),c(n)},get_selectors:function(t,c){var n=[],i=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){i.test(e)&&n.push({label:e,value:t})}),c(n)},get_rules:function(t,c){var n=[],i=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){i.test(e)&&n.push({label:e,value:t})}),c(n)},get_filtered_rules:function(t,c){var n=[],i=new RegExp(e.ui.autocomplete.escapeRegex(t.term),"i");e.each(e("#ctc_rule_menu").data("menu"),function(e,t){i.test(e)&&n.push({label:e,value:t})}),c(n)},merge_ruleval_arrays:function(t,c,n){var i=this,s={},a=n?c.child.pop():null;return e.each(["parnt","child"],function(t,l){i.is_empty(c[l])||e.each(c[l],function(e,t){n?parseInt(t[2])>=parseInt(a[2])&&(a[2]=parseInt(t[2])+1):(i.is_empty(s[t[2]])&&(s[t[2]]={}),s[t[2]][l]=t)})}),n&&(s[a[2]]={parnt:[],child:a}),s},input_row:function(t,c,n,i,s){var a=this,l="";if(!a.is_empty(i)&&!a.is_empty(i.value)&&!a.is_empty(i.value[c])){var r=i.value[c],o=a.merge_ruleval_arrays(c,r,s);e.each(o,function(s,r){var o=a.decode_value(c,a.is_empty(r.parnt)?"":r.parnt[0]),_=a.is_empty(r.parnt)||a.is_empty(r.parnt[1],1)?0:1,d=a.decode_value(c,a.is_empty(r.child)?"":r.child[0]),u=a.is_empty(r.child)||a.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,a.frascii):i.selector+'<br/><a href="#" class="ctc-selector-edit" id="ctc_selector_edit_'+t+'" >'+a.getxt("edit")+"</a> "+(a.is_empty(o.orig)?a.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+'">'+(a.is_empty(o.orig)?"[no value]":o.orig+(_?a.getxt("important"):""))+'</div><div class="ctc-input-cell">',!a.is_empty(o.names)){e.each(o.names,function(e,i){i=a.is_empty(i)?"":i,l+='<div class="ctc-child-input-cell clear">';var r,o="ctc_"+n+"_child_"+c+"_"+t+"_"+s+i;!1===(r=d.values.shift())&&(r=""),l+=(a.is_empty(i)?"":a.getxt(i)+":<br/>")+'<input type="text" id="'+o+'" name="'+o+'" class="ctc-child-value'+((i+c).toString().match(/color/)?" color-picker":"")+(i.toString().match(/url/)?" ctc-input-wide":"")+'" value="'+a.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":"")+" />"+a.getxt("important")+"</label>"}l+="</div>","ovrd"!==n&&(l+='<div class="ctc-swatch ctc-specific" id="ctc_child_'+c+"_"+t+"_"+s+'_swatch">'+a.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(i){c.jquery_exception(i,"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(e,c){return t.set_query(c.item.value),!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(e,c){return t.set_selector(c.item.value,c.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 i,s,a=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]),i=e(t.input_row(t.currqsid,a,"ovrd",t.currdata,!0)),e("#ctc_sel_ovrd_rule_inputs").append(i),e("#ctc_new_rule_menu").val(""),i.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,i="";n.is_empty(t)||e.each(t,function(t,c){i+='<div class="'+t+' notice is-dismissible dashicons-before"><ul>\n',e(c).each(function(e,t){i+="<li>"+t.toString()+"</li>\n"}),i+="</ul></div>"}),c=e(i),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())},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 i=this,s={ctc_query_obj:t,ctc_query_key:c},a="#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(a+" .ctc-status-icon").remove(),e(a).append('<span class="ctc-status-icon spinner is-active query-icon"></span>'),s.action=i.is_empty(e("#ctc_action").val())||"plugin"!==e("#ctc_action").val()?"ctc_query":"ctc_plgqry",s._wpnonce=e("#_wpnonce").val(),i.ajax_post(t,s)},save:function(t){var c,n,i,s,a,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):(i=e("#ctc_child_imports"))&&"ctc_save_imports"===o?r.ctc_child_imports=i.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("#ctc_sel_ovrd_selector_selected").find("#ctc_rewrite_selector").each(function(){s=e("#ctc_rewrite_selector").val(),a=e("#ctc_rewrite_selector_orig").val(),l.is_empty(s)||!s.toString().match(/\w/)?s=a:(r.ctc_rewrite_selector=s,l.reload=!0),e(".ctc-rewrite-toggle").text(l.getxt("rename")),e("#ctc_sel_ovrd_selector_selected").html(s)}),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 i=this;e.ajax({url:window.ctcAjax.ajaxurl,data:c,dataType:i.is_empty(n)?"json":n,type:"POST"}).done(function(e){i.handle_success(t,e)}).fail(function(){i.handle_failure(t)}).always(function(){i.jqueryerr.length&&i.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,i=c.is_empty(e.fileName)?"":" "+e.fileName.split(/\?/)[0];c.jqueryerr.push("<code><small>"+t+": "+e.message+i+n+"</small></code>")},jquery_notice:function(t){t=null;var c=this,n=[],i=[];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>")}),i.push("<strong>"+c.getxt("js")+"</strong> "+c.getxt("contact")),i.push(c.jqueryerr.join("<br/>")),n.length&&i.push(c.getxt("jquery")+"<br/>"+n.join("<br/>")),i.push(c.getxt("plugin"))),c.set_notice({error:i})},update:{qsid:function(t){var c,n,i,s,a=this;a.currqsid=t.key,a.currdata=t.data,e("#ctc_sel_ovrd_qsid").val(a.currqsid),a.is_empty(a.currdata.seq)?e("#ctc_child_load_order_container").empty():(c="ctc_ovrd_child_seq_"+a.currqsid,i=parseInt(a.currdata.seq),n='<input type="text" id="'+c+'" name="'+c+'" class="ctc-child-value" value="'+i+'" />',e("#ctc_child_load_order_container").html(n)),a.is_empty(a.currdata.value)?(s=!0,e("#ctc_sel_ovrd_rule_inputs").empty()):(s=!1,n="",e.each(a.currdata.value,function(e,t){t=null,n+=a.input_row(a.currqsid,e,"ovrd",a.currdata)}),e("#ctc_sel_ovrd_rule_inputs").html(n).find(".color-picker").each(function(){a.setup_spectrum(this)}),a.coalesce_inputs("#ctc_child_all_0_swatch")),a.reload&&(a.load_queries(),a.set_query(a.currdata.query),a.load_rules()),e("#ctc_sel_ovrd_selector_selected").text(a.currdata.selector),e(".ctc-rewrite-toggle").text(a.getxt("rename")),e(".ctc-rewrite-toggle").show(),s?e("#ctc_sel_ovrd_rule_header,#ctc_sel_ovrd_new_rule,#ctc_sel_ovrd_rule_inputs_container,#ctc_sel_ovrd_rule_inputs").hide():e("#ctc_sel_ovrd_rule_header,#ctc_sel_ovrd_new_rule,#ctc_sel_ovrd_rule_inputs_container,#ctc_sel_ovrd_rule_inputs").show()},rule_val:function(t){var c=this,n=e("#ctc_rule_menu_selected").text(),i='<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);i+='<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'}),i+="</div>\n"),e("#ctc_rule_value_inputs").html(i).find(".ctc-swatch").each(function(){c.coalesce_inputs(this)})},val_qry:function(t){var c,n,i=this,s="";i.is_empty(t.data)||e.each(t.data,function(n,a){c=n,e.each(a,function(c,a){s+='<h4 class="ctc-query-heading">'+c+"</h4>\n",i.is_empty(a)||e.each(a,function(e,c){s+=i.input_row(e,n,t.key,c)})})}),n="#ctc_selector_"+c+"_"+t.key+"_rows",e(n).html(s).find(".color-picker").each(function(){i.setup_spectrum(this)}),e(n).find(".ctc-swatch").each(function(){i.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),i=e('<button type="button" class="notice-dismiss"><span class="screen-reader-text"></span></button>'),s=window.commonL10n.dismiss||"";i.find(".screen-reader-text").text(s),n.append(i),i.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>"),i=c.value.replace(/[^\w\-]/,"");return e("#ctc_theme_option_"+i).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,i,s=e(this).attr("id").toString().replace("_close",""),a=s.toString().match(/_([^_]+)_(\d+)$/);e("#"+s+"_container").is(":hidden")&&(t.is_empty(a[1])||t.is_empty(a[2])||(n=a[1],i=a[2],t.query_css("val_qry",i,{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){c.preventDefault(),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(){return e(this).hasClass("ajax-pending")?!1:(e(this).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",i=c?c:e.chldthmcfg.getname(n),s='<strong class="ctc_analyze_loading"><span class="spinner is-active"></span>'+e.chldthmcfg.getxt(t?"anlz1":"anlz2")+" "+i+"...</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,n,i,s=this,a=Math.floor(e.now()/1e3),l="child"===t?e.chldthmcfg.currchild:e.chldthmcfg.currparnt,r="&template="+e.chldthmcfg.currparnt+"&stylesheet="+l+"&now="+a,o=s.setssl(window.ctcAjax.homeurl),_=window.ctcAjax.theme_uri.replace(/^https?:\/\//,""),d=o+r,u=s.escrgx(e.chldthmcfg.currparnt)+("child"===t?"|"+s.escrgx(l):""),h=new RegExp("<link( rel=[\"']stylesheet[\"'] id=['\"]([^'\"]+?)['\"])?[^>]+?"+s.escrgx(_)+"/("+u+")/([^\"']+\\.css)(\\?[^\"']+)?[\"'][^>]+>","gi"),p=/<br \/>\n[^\n]+?(fatal|strict|notice|warning|error)[\s\S]+?<br \/>/gi,m=0,g=0,f={url:d,deps:[[],[]],signals:{},queue:[],irreg:[]};e.get(d,function(a){for((n=a.match(/BEGIN WP QUEUE\n([\s\S]*?)\nEND WP QUEUE/))?f.queue=n[1].split(/\n/):(f.queue=[],f.signals.thm_noqueue=1),(n=a.match(/BEGIN CTC IRREGULAR\n([\s\S]*?)\nEND CTC IRREGULAR/))?f.irreg=n[1].split(/\n/):f.irreg=[],a.match(/CHLD_THM_CFG_IGNORE_PARENT/)&&(f.signals.thm_ignoreparnt=1),a.match(/IS_CTC_THEME/)&&(f.signals.thm_is_ctc=1),a.match(/NO_CTC_STYLES/)&&(f.signals.thm_no_styles=1),a.match(/HAS_CTC_IMPORT/)&&(f.signals.thm_has_import=1),a=a.replace(/<!\-\-[\s\S]*?\-\->/g,"");c=p.exec(a);){var l=c[0].replace(/<.*?>/g,"");s.phperr[t].push(l),f.signals.err_php=1,l.match(/Fatal error/i)&&(f.signals.err_fatal=1)}for(;i=h.exec(a);){var r=s.trmcss(i[2]),o=i[3],_=i[4],d=e.chldthmcfg.currparnt===o?"parnt":"child",u=0;if(""===r||-1===e.inArray(r,f.queue))u=1;else if(0===r.indexOf("chld_thm_cfg")){
2
+ _.match(/^ctc\-style([\-\.]min)?\.css$/)?(m=1,f.signals.ctc_sep_loaded=1):_.match(/^ctc\-genesis([\-\.]min)?\.css$/)?(m=1,f.signals.ctc_gen_loaded=1):r.match(/$chld_thm_cfg_ext/)?(f.signals.ctc_ext_loaded=1,f.deps[m].push([r,_])):"chld_thm_cfg_child"===r?(f.signals.ctc_child_loaded=1,f.deps[m].push([r,_])):"chld_thm_cfg_parent"===r&&(f.signals.ctc_parnt_loaded=1,f.deps[m].push([r,_]),m&&(f.signals.ctc_parnt_reorder=1));continue}if(_.match(/^style([\-\.]min)?\.css$/))m=1,"parnt"===d?u?f.signals.thm_parnt_loaded="thm_unregistered":(f.signals.thm_parnt_loaded=r,"child"===t&&f.signals.thm_child_loaded&&(f.signals.ctc_parnt_reorder=1)):f.signals.thm_child_loaded=u?"thm_unregistered":r,u?g?(f.signals.thm_past_wphead=1,f.deps[m].push(["thm_past_wphead",_])):(f.signals.thm_unregistered=1,f.deps[m].push(["thm_unregistered",_])):f.deps[m].push([r,_]);else if("ctc-test.css"===_)g=1;else{var v=null;u&&(v="dep_unregistered"),g&&(v=m?"css_past_wphead":"dep_past_wphead"),v&&(f.signals[v]=1,r=v),f.deps[m].push([r,_])}}m||(f.signals.thm_notheme=1),a=null,s.analysis[t]=f,e(document).trigger("analysisdone")}).fail(function(c,n,i){f.signals.failure=1,f.signals.xhrerr=i,s.analysis[t]=f,e(document).trigger("analysisdone")})},css_notice:function(){var t,c=this,n=e.chldthmcfg.existing?"child":"parnt",i=e.chldthmcfg.getname(n),s="",a={notices:[]},l={style:"notice-warning",headline:e.chldthmcfg.getxt("anlz3",i),errlist:""},r=0,o={},_="";if(c.analysis[n].signals.failure||c.analysis[n].signals.thm_noqueue&&!c.phperr[n].length)e("#ctc_is_debug").is(":checked")&&(_=e.chldthmcfg.getxt("anlz33").replace(/%1/,'<a href="'+c.analysis[n].url+'" target="_new">').replace(/%2/,"</a>")),a.notices.push({headline:e.chldthmcfg.getxt("anlz4",i),msg:e.chldthmcfg.getxt("anlz5")+_,style:"notice-warning"});else{if(c.phperr[n].length&&(e.each(c.phperr[n],function(t,c){c.match(/Fatal error/i)&&(l.style="error",l.headline=e.chldthmcfg.getxt("anlz8",i)),l.errlist+=c+"\n"}),l.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" style="display:none"><textarea>'+l.errlist+"</textarea></div></div>"+e.chldthmcfg.getxt("anlz7"),a.notices.push(l)),(c.analysis[n].signals.thm_past_wphead||c.analysis[n].signals.dep_past_wphead)&&(a.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()),c.analysis[n].signals.thm_unregistered&&(c.analysis[n].signals.ctc_child_loaded||c.analysis[n].signals.ctc_sep_loaded||(a.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"===n&&(c.analysis.child.signals.ctc_parnt_reorder&&(r=1),c.analysis.child.signals.ctc_child_loaded||c.analysis.child.signals.ctc_sep_loaded||c.analysis.child.signals.thm_child_loaded||(a.notices.push({headline:e.chldthmcfg.getxt("anlz13"),style:"notice-warning",msg:e.chldthmcfg.getxt("anlz14")}),r=1),c.analysis[n].signals.ctc_gen_loaded&&a.notices.push({headline:e.chldthmcfg.getxt("anlz31"),msg:e.chldthmcfg.getxt("anlz32"),style:"notice-warning"}),c.analysis.parnt.signals.thm_no_styles||c.analysis.child.signals.ctc_gen_loaded||c.analysis.child.signals.thm_parnt_loaded||c.analysis.child.signals.ctc_parnt_loaded||c.analysis.child.signals.thm_ignoreparnt||c.analysis.child.signals.thm_has_import||(a.notices.push({headline:e.chldthmcfg.getxt("anlz15"),style:"notice-warning",msg:e.chldthmcfg.getxt("anlz16")}),r=1),c.analysis.child.signals.thm_unregistered&&c.analysis.child.signals.thm_child_loaded&&"thm_unregistered"===c.analysis.child.signals.thm_child_loaded&&c.analysis.child.signals.ctc_child_loaded&&c.analysis.child.signals.ctc_parnt_loaded&&(a.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)),c.analysis.child.signals.thm_is_ctc||e("#ctc_child_type_duplicate").is(":checked")||a.notices.push({headline:e.chldthmcfg.getxt("anlz19"),msg:e.chldthmcfg.getxt("anlz20"),style:"notice-warning"})),(c.analysis[n].signals.ctc_sep_loaded||c.analysis[n].signals.ctc_gen_loaded)&&e("#ctc_handling_separate").prop("checked",!0),a.notices.length||a.notices.push({headline:""+("child"===n?e.chldthmcfg.getxt("anlz17"):e.chldthmcfg.getxt("anlz18")),style:"updated",msg:""}),"child"===n&&c.analysis.child.signals.thm_has_import&&(a.notices.push({headline:e.chldthmcfg.getxt("anlz21"),msg:e.chldthmcfg.getxt("anlz22"),style:"notice-warning"}),e("#ctc_enqueue_import").prop("checked",!0)),c.analysis[n].signals.thm_ignoreparnt||c.analysis[n].signals.ctc_gen_loaded?(e("#ctc_ignoreparnt").prop("checked",!0),e("#ctc_enqueue_none").is(":checked")||(e("#ctc_enqueue_none").prop("checked",!0),r=1,o.ctc_enqueue="none")):e("#ctc_ignoreparnt").prop("checked",!1),c.analysis[n].signals.thm_keepdeps?e("#ctc_keepdeps").prop("checked",!0):e("#ctc_keepdeps").prop("checked",!1),!c.analysis[n].signals.ctc_sep_loaded&&!c.analysis[n].signals.ctc_gen_loaded&&!c.analysis[n].signals.ctc_child_loaded&&!c.analysis[n].signals.thm_unregistered&&!c.analysis[n].signals.thm_past_wphead&&c.analysis[n].deps[1].length){var d="";e.each(c.analysis[n].deps[1],function(e,t){t[1].match(/^style([\-\.]min)?\.css$/)||(d+="<li>"+t[1]+"</li>\n")}),""!==d&&(d="<ul class='howto' style='padding-left:1em'>\n"+d+"</ul>\n",a.notices.push({headline:e.chldthmcfg.getxt("anlz23"),msg:d+e.chldthmcfg.getxt("anlz24"),style:"updated"}))}"child"===n&&c.analysis[n].signals.thm_parnt_loaded&&(a.notices.push({headline:e.chldthmcfg.getxt("anlz25"),msg:e.chldthmcfg.getxt("anlz26"),style:"updated"}),e("#ctc_enqueue_none").prop("checked",!0),r=1,o.ctc_enqueue="none"),c.analysis.parnt.signals.thm_no_styles&&(a.notices.push({headline:e.chldthmcfg.getxt("anlz27"),msg:e.chldthmcfg.getxt("anlz26"),style:"updated"}),e("#ctc_enqueue_none").prop("checked",!0),r=1,o.ctc_enqueue="none")}return s=encodeURIComponent(JSON.stringify(c.analysis)),e('input[name="ctc_analysis"]').val(s),o.ctc_analysis=s,c.is_success()&&r&&!c.resubmitting?(c.resubmitting=1,void c.resubmit(o)):(c.resubmitting=0,c.hide_loading(),e.each(a.notices,function(t,c){var i=e('<div class="'+c.style+' notice is-dismissible dashicons-before" ><h4>'+c.headline+"</h4>"+c.msg+"</div>");e.chldthmcfg.bind_dismiss(i),i.hide().appendTo("#"+n+"_analysis_notice").slideDown()}),e("#ctc_is_debug").is(":checked")&&(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(c.analysis,null,2)+"</textarea></div></div>",e(t).appendTo("#"+n+"_analysis_notice")),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:{},child:{}},t.phperr={parnt:[],child:[]},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,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
@@ -1,10 +1,10 @@
1
- # Copyright (C) 2016 Lilaea Media
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.0.2\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/child-theme-configurator\n"
7
- "POT-Creation-Date: 2016-04-06 02:18:30+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,15 +12,15 @@ msgstr ""
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
15
- #: includes/class-ctc-admin.php:374
16
  msgid "Zip file creation failed."
17
  msgstr ""
18
 
19
- #: includes/class-ctc-admin.php:410
20
  msgid "The Functions file is required and cannot be deleted."
21
  msgstr ""
22
 
23
- #: includes/class-ctc-admin.php:494
24
  msgid "You do not have permission to configure child themes."
25
  msgstr ""
26
 
@@ -54,225 +54,208 @@ msgstr ""
54
  msgid "Could not upgrade child theme"
55
  msgstr ""
56
 
57
- #: includes/class-ctc-admin.php:725
58
  msgid "Your stylesheet is not writable."
59
  msgstr ""
60
 
61
- #: includes/class-ctc-admin.php:1293
62
  msgid "Could not set write permissions."
63
  msgstr ""
64
 
65
- #: includes/class-ctc-admin.php:1394
66
  msgid "There were errors while resetting permissions."
67
  msgstr ""
68
 
69
- #: includes/class-ctc-admin.php:1436
70
  msgid "Could not upload file."
71
  msgstr ""
72
 
73
- #: includes/class-ctc-ui.php:34
74
- msgid "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
75
  msgstr ""
76
 
77
- #: includes/class-ctc-ui.php:165
78
- msgid "Child Theme files modified successfully."
79
  msgstr ""
80
 
81
- #: includes/class-ctc-ui.php:167
82
- msgid ""
83
- "Child Theme <strong>%s</strong> has been reset. Please configure it using "
84
- "the settings below."
85
- msgstr ""
86
-
87
- #: includes/class-ctc-ui.php:169
88
- msgid "Child Theme <strong>%s</strong> has been generated successfully."
89
- msgstr ""
90
-
91
- #: includes/class-ctc-ui.php:171
92
- msgid "IMPORTANT:"
93
  msgstr ""
94
 
95
- #: includes/class-ctc-ui.php:173 includes/forms/themepreview.php:20
96
- msgid "Go to Themes"
97
- msgstr ""
98
-
99
- #: includes/class-ctc-ui.php:173
100
- msgid "Network enable"
101
- msgstr ""
102
-
103
- #: includes/class-ctc-ui.php:173
104
- msgid "your child theme."
105
- msgstr ""
106
-
107
- #: includes/class-ctc-ui.php:175 includes/forms/themepreview.php:18
108
- msgid "Live Preview"
109
  msgstr ""
110
 
111
- #: includes/class-ctc-ui.php:175
112
- msgid "Preview your child theme"
 
113
  msgstr ""
114
 
115
- #: includes/class-ctc-ui.php:175
116
- msgid "before activating."
117
  msgstr ""
118
 
119
- #: includes/class-ctc-ui.php:285
120
  msgid "URL/None"
121
  msgstr ""
122
 
123
- #: includes/class-ctc-ui.php:286
124
  msgid "Origin"
125
  msgstr ""
126
 
127
- #: includes/class-ctc-ui.php:287
128
  msgid "Color 1"
129
  msgstr ""
130
 
131
- #: includes/class-ctc-ui.php:288
132
  msgid "Color 2"
133
  msgstr ""
134
 
135
- #: includes/class-ctc-ui.php:289
136
  msgid "Width/None"
137
  msgstr ""
138
 
139
- #: includes/class-ctc-ui.php:290
140
  msgid "Style"
141
  msgstr ""
142
 
143
- #: includes/class-ctc-ui.php:291
144
  msgid "Color"
145
  msgstr ""
146
 
147
- #: includes/class-ctc-ui.php:293
148
  msgid ""
149
  "Are you sure you wish to RESET? This will destroy any work you have done in "
150
  "the Configurator."
151
  msgstr ""
152
 
153
- #: includes/class-ctc-ui.php:294
154
  msgid "<span style=\"font-size:10px\">!</span>"
155
  msgstr ""
156
 
157
- #: includes/class-ctc-ui.php:295 includes/forms/rule-value.php:32
158
  msgid "Selectors"
159
  msgstr ""
160
 
161
- #: includes/class-ctc-ui.php:296
162
  msgid "Close"
163
  msgstr ""
164
 
165
- #: includes/class-ctc-ui.php:297
166
  msgid "Edit Selector"
167
  msgstr ""
168
 
169
- #: includes/class-ctc-ui.php:298
170
  msgid "Cancel"
171
  msgstr ""
172
 
173
- #: includes/class-ctc-ui.php:299
174
  msgid "Rename"
175
  msgstr ""
176
 
177
- #: includes/class-ctc-ui.php:300
178
  msgid "The stylesheet cannot be displayed."
179
  msgstr ""
180
 
181
- #: includes/class-ctc-ui.php:301
182
  msgid "(Child Only)"
183
  msgstr ""
184
 
185
- #: includes/class-ctc-ui.php:302
186
  msgid "Please enter a valid Child Theme."
187
  msgstr ""
188
 
189
- #: includes/class-ctc-ui.php:303
190
  msgid "Please enter a valid Child Theme name."
191
  msgstr ""
192
 
193
- #: includes/class-ctc-ui.php:304
194
  msgid "<strong>%s</strong> exists. Please enter a different Child Theme"
195
  msgstr ""
196
 
197
- #: includes/class-ctc-ui.php:305
198
  msgid "The page could not be loaded correctly."
199
  msgstr ""
200
 
201
- #: includes/class-ctc-ui.php:306
202
  msgid ""
203
  "Conflicting or out-of-date jQuery libraries were loaded by another plugin:"
204
  msgstr ""
205
 
206
- #: includes/class-ctc-ui.php:307
207
  msgid "Deactivating or replacing plugins may resolve this issue."
208
  msgstr ""
209
 
210
- #: includes/class-ctc-ui.php:308
211
  msgid "%sWhy am I seeing this?%s"
212
  msgstr ""
213
 
214
- #: includes/class-ctc-ui.php:311
215
  msgid "No Styles Available. Check Parent/Child settings."
216
  msgstr ""
217
 
218
- #: includes/class-ctc-ui.php:312
219
  msgid "Updating"
220
  msgstr ""
221
 
222
- #: includes/class-ctc-ui.php:313
223
  msgid "Checking"
224
  msgstr ""
225
 
226
- #: includes/class-ctc-ui.php:314
227
  msgid "The theme \"%s\" generated unexpected PHP debug output."
228
  msgstr ""
229
 
230
- #: includes/class-ctc-ui.php:315
231
- msgid "The theme \"%s\" could not be analyzed."
 
 
232
  msgstr ""
233
 
234
- #: includes/class-ctc-ui.php:316
235
  msgid ""
236
- "<p>Please try temporarily disabling plugins that <strong>minify CSS</strong> "
237
- "or that <strong>force redirects between HTTP and HTTPS</strong>.</p>"
 
 
238
  msgstr ""
239
 
240
- #: includes/class-ctc-ui.php:317
241
- msgid "Show Debug Output"
242
  msgstr ""
243
 
244
- #: includes/class-ctc-ui.php:318
245
  msgid ""
246
- "<p>You may not be able to use this Theme as a Child Theme while these "
247
- "conditions exist.</p><p>It is possible that this theme has specific "
248
- "requirements to work correctly as a child theme. Check your theme's "
249
- "documentation for more information.</p><p>Please make sure you are using the "
250
- "latest version of this theme. If so, please contact this Theme's author and "
251
- "report the error list above.</p>"
252
  msgstr ""
253
 
254
- #: includes/class-ctc-ui.php:319
255
  msgid "Do Not Activate \"%s\"! A PHP FATAL ERROR has been detected."
256
  msgstr ""
257
 
258
- #: includes/class-ctc-ui.php:320
259
  msgid "This theme loads stylesheets after the wp_styles queue."
260
  msgstr ""
261
 
262
- #: includes/class-ctc-ui.php:321
263
  msgid ""
264
  "<p>This makes it difficult for plugins to override these styles. You can try "
265
  "to resolve this using the \"Repair header template\" option (Step 6, "
266
  "\"Additional handling options\", below).</p>"
267
  msgstr ""
268
 
269
- #: includes/class-ctc-ui.php:322
270
  msgid ""
271
  "This theme loads the parent theme's <code>style.css</code> file outside the "
272
  "wp_styles queue."
273
  msgstr ""
274
 
275
- #: includes/class-ctc-ui.php:323
276
  msgid ""
277
  "<p>This is common with older themes but requires the use of <code>@import</"
278
  "code>, which is no longer recommended. You can try to resolve this using the "
@@ -280,41 +263,41 @@ msgid ""
280
  "\", below).</p>"
281
  msgstr ""
282
 
283
- #: includes/class-ctc-ui.php:324
284
  msgid "This child theme does not load a Configurator stylesheet."
285
  msgstr ""
286
 
287
- #: includes/class-ctc-ui.php:325
288
  msgid ""
289
  "<p>If you want to customize styles using this plugin, please click "
290
  "\"Configure Child Theme\" again to add this to the settings.</p>"
291
  msgstr ""
292
 
293
- #: includes/class-ctc-ui.php:326
294
  msgid ""
295
  "This child theme uses the parent stylesheet but does not load the parent "
296
  "theme's <code>style.css</code> file."
297
  msgstr ""
298
 
299
- #: includes/class-ctc-ui.php:327
300
  msgid ""
301
  "<p>Please select a stylesheet handling method or check \"Ignore parent theme "
302
  "stylesheets\" (see step 6, below).</p>"
303
  msgstr ""
304
 
305
- #: includes/class-ctc-ui.php:328
306
  msgid "This child theme appears to be functioning correctly."
307
  msgstr ""
308
 
309
- #: includes/class-ctc-ui.php:329
310
  msgid "This theme appears OK to use as a Child theme."
311
  msgstr ""
312
 
313
- #: includes/class-ctc-ui.php:330
314
  msgid "This Child Theme has not been configured for this plugin."
315
  msgstr ""
316
 
317
- #: includes/class-ctc-ui.php:331
318
  msgid ""
319
  "<p>The Configurator makes significant modifications to the child theme, "
320
  "including stylesheet changes and additional php functions. Please consider "
@@ -322,202 +305,137 @@ msgid ""
322
  "original as a backup.</p>"
323
  msgstr ""
324
 
325
- #: includes/class-ctc-ui.php:332
326
  msgid ""
327
  "This child theme uses <code>@import</code> to load the parent theme's "
328
  "<code>style.css</code> file."
329
  msgstr ""
330
 
331
- #: includes/class-ctc-ui.php:333
332
  msgid ""
333
  "<p>Please consider selecting \"Use the WordPress style queue\" for the "
334
  "parent stylesheet handling option (see step 6, below).</p>"
335
  msgstr ""
336
 
337
- #: includes/class-ctc-ui.php:334
338
  msgid ""
339
  "This theme loads additional stylesheets after the <code>style.css</code> "
340
  "file:"
341
  msgstr ""
342
 
343
- #: includes/class-ctc-ui.php:335
344
  msgid ""
345
  "<p>Consider saving new custom styles to a \"Separate stylesheet\" (see step "
346
  "5, below) so that you can customize these styles.</p>"
347
  msgstr ""
348
 
349
- #: includes/class-ctc-ui.php:336
350
  msgid ""
351
  "The parent theme's <code>style.css</code> file is being loaded automatically."
352
  msgstr ""
353
 
354
- #: includes/class-ctc-ui.php:337
355
  msgid ""
356
  "<p>The Configurator selected \"Do not add any parent stylesheet handling\" "
357
  "for the \"Parent stylesheet handling\" option (see step 6, below).</p>"
358
  msgstr ""
359
 
360
- #: includes/class-ctc-ui.php:338
361
  msgid ""
362
  "This theme does not require the parent theme's <code>style.css</code> file "
363
  "for its appearance."
364
  msgstr ""
365
 
366
- #: includes/class-ctc-ui.php:339
367
  msgid "This Child Theme was configured with an earlier version."
368
  msgstr ""
369
 
370
- #: includes/class-ctc-ui.php:340
371
  msgid ""
372
  "<p>The selected stylesheet handling method is no longer used. Please update "
373
  "the configuration using the \"Repair header template\" option (see step 6, "
374
  "\"Additional handling options\", below).</p>"
375
  msgstr ""
376
 
377
- #: includes/class-ctc-ui.php:341
378
- msgid "Show Analysis Object"
 
 
379
  msgstr ""
380
 
381
- #: includes/class-ctc-ui.php:342
382
  msgid ""
383
  "This child theme was configured using the CTC Pro \"Genesis stylesheet "
384
  "handling\" method."
385
  msgstr ""
386
 
387
- #: includes/class-ctc-ui.php:343
388
  msgid ""
389
  "<p>This method has been replaced by the \"Separate stylesheet\" and \"Ignore "
390
  "Parent Theme\" options ( selected below ) for broader framework "
391
  "compatability.</p>"
392
  msgstr ""
393
 
394
- #: includes/class-ctc-ui.php:363
395
- msgid ""
396
- "The child theme is in read-only mode and Child Theme Configurator cannot "
397
- "apply changes. Click to see options"
398
- msgstr ""
399
-
400
- #: includes/class-ctc-ui.php:366
401
- msgid ""
402
- "<li>Temporarily set write permissions by clicking the button below. When you "
403
- "are finished editing, revert to read-only by clicking \"Make read-only\" "
404
- "under the \"Files\" tab.</li>"
405
- msgstr ""
406
-
407
- #: includes/class-ctc-ui.php:369
408
- msgid "Make files writable"
409
- msgstr ""
410
-
411
- #: includes/class-ctc-ui.php:370
412
- msgid ""
413
- "<li><a target=\"_blank\" href=\"http://codex.wordpress.org/Editing_wp-"
414
- "config.php#WordPress_Upgrade_Constants\" title=\"Editin wp-config.php\">Add "
415
- "your FTP/SSH credentials to the WordPress config file</a>.</li>"
416
- msgstr ""
417
-
418
- #: includes/class-ctc-ui.php:372
419
- msgid ""
420
- "<li><a target=\"_blank\" href=\"http://technet.microsoft.com/en-us/library/"
421
- "cc771170\" title=\"Setting Application Pool Identity\">Assign WordPress to "
422
- "an application pool that has write permissions</a> (Windows IIS systems).</"
423
- "li>"
424
  msgstr ""
425
 
426
- #: includes/class-ctc-ui.php:373
427
- msgid ""
428
- "<li><a target=\"_blank\" href=\"http://codex.wordpress.org/"
429
- "Changing_File_Permissions\" title=\"Changing File Permissions\">Set write "
430
- "permissions on the server manually</a> (not recommended).</li>"
431
  msgstr ""
432
 
433
- #: includes/class-ctc-ui.php:375
434
- msgid "<li>Run PHP under Apache with suEXEC (contact your web host).</li>"
 
435
  msgstr ""
436
 
437
- #: includes/class-ctc-ui.php:384
438
- msgid ""
439
- "This Child Theme is not owned by your website account. It may have been "
440
- "created by a prior version of this plugin or by another program. Moving "
441
- "forward, it must be owned by your website account to make changes. Child "
442
- "Theme Configurator will attempt to correct this when you click the button "
443
- "below."
444
  msgstr ""
445
 
446
- #: includes/class-ctc-ui.php:392
447
- msgid ""
448
- "Child Theme Configurator needs to update its internal data. Please set your "
449
- "preferences below and click \"Generate Child Theme Files\" to update your "
450
- "configuration."
451
  msgstr ""
452
 
453
- #: includes/class-ctc-ui.php:398
454
- msgid ""
455
- "<strong>However, some styles could not be parsed due to memory limits.</"
456
- "strong> Try deselecting \"Additional Stylesheets\" below and click "
457
- "\"Generate/Rebuild Child Theme Files\". %sWhy am I seeing this?%s"
458
  msgstr ""
459
 
460
- #: includes/class-ctc-ui.php:406
461
  msgid ""
462
- "Child Theme Configurator did not detect any configuration data because a "
463
- "previously configured Child Theme has been removed. Please follow the steps "
464
- "for \"CONFIGURE an existing Child Theme\" under the \"Parent/Child\" Tab."
465
  msgstr ""
466
 
467
- #: includes/class-ctc-ui.php:412
468
- msgid ""
469
- "Your stylesheet has changed since the last time you used the Configurator. "
470
- "Please follow the steps for \"CONFIGURE an existing Child Theme\" under the "
471
- "\"Parent/Child\" Tab or you will lose these changes."
472
  msgstr ""
473
 
474
- #: includes/class-ctc-ui.php:424
475
- msgid "This version of Child Theme Configurator includes significant updates."
476
  msgstr ""
477
 
478
- #: includes/class-ctc-ui.php:425
479
  msgid ""
480
- "A lot of time and testing has gone into this release but there are always "
481
- "edge cases. If you have any questions, please"
482
- msgstr ""
483
-
484
- #: includes/class-ctc-ui.php:425
485
- msgid "Contact Us."
486
  msgstr ""
487
 
488
- #: includes/class-ctc-ui.php:426
489
- msgid "For more information, please open the Help tab at the top right or "
490
  msgstr ""
491
 
492
- #: includes/class-ctc-ui.php:426
493
- msgid "click here to view the latest videos."
494
  msgstr ""
495
 
496
- #: includes/class-ctc-ui.php:428
497
  msgid ""
498
- "It is a good idea to save a Zip Archive of your Child Theme before using "
499
- "this version for the first time (click the button to the right to download). "
500
- "Remember you can always export your child themes from the \"Files\" Tab."
501
- msgstr ""
502
-
503
- #: includes/class-ctc-ui.php:430
504
- msgid "Backup Child Theme"
505
- msgstr ""
506
-
507
- #. #-#-#-#-# child-theme-configurator.pot (Child Theme Configurator 2.0.2) #-#-#-#-#
508
- #. Plugin Name of the plugin/theme
509
- #: includes/class-ctc.php:50 includes/class-ctc.php:60
510
- #: includes/forms/main.php:34
511
- msgid "Child Theme Configurator"
512
- msgstr ""
513
-
514
- #: includes/class-ctc.php:51 includes/class-ctc.php:61
515
- #: includes/class-ctc.php:71
516
- msgid "Child Themes"
517
- msgstr ""
518
-
519
- #: includes/class-ctc.php:86
520
- msgid "Child Theme Configurator requires WordPress version %s or later."
521
  msgstr ""
522
 
523
  #: includes/forms/addl_css.php:7
@@ -659,13 +577,11 @@ msgid "Return to recently edited selectors from a toggleable sidebar."
659
  msgstr ""
660
 
661
  #: includes/forms/addl_panels.php:32
662
- msgid "Genesis Framework Support"
663
  msgstr ""
664
 
665
  #: includes/forms/addl_panels.php:33
666
- msgid ""
667
- "Automatically detects and configures Genesis Child Themes with more "
668
- "frameworks on the way."
669
  msgstr ""
670
 
671
  #: includes/forms/addl_panels.php:34
@@ -692,62 +608,61 @@ msgstr ""
692
  msgid "Restore backup from"
693
  msgstr ""
694
 
695
- #: includes/forms/fileform.php:8
696
- msgid ""
697
- "The Theme editor has been disabled. Template files must be edited offline."
698
  msgstr ""
699
 
700
- #: includes/forms/fileform.php:12
701
- msgid "Click here to edit template files using the Theme Editor"
702
  msgstr ""
703
 
704
- #: includes/forms/fileform.php:23
 
 
 
 
 
 
 
 
 
 
 
 
705
  msgid "Parent Templates"
706
  msgstr ""
707
 
708
- #: includes/forms/fileform.php:23
709
  msgid "Child Theme Files"
710
  msgstr ""
711
 
712
- #: includes/forms/fileform.php:28
713
  msgid ""
714
  "Copy PHP templates from the parent theme by selecting them here. The "
715
  "Configurator defines a template as a Theme PHP file having no PHP functions "
716
  "or classes. Other PHP files cannot be safely overridden by a child theme."
717
  msgstr ""
718
 
719
- #: includes/forms/fileform.php:31
720
  msgid ""
721
  "CAUTION: If your child theme is active, the child theme version of the file "
722
  "will be used instead of the parent immediately after it is copied."
723
  msgstr ""
724
 
725
- #: includes/forms/fileform.php:33
726
  msgid "The %s file is generated separately and cannot be copied here."
727
  msgstr ""
728
 
729
- #: includes/forms/fileform.php:43
730
  msgid "Delete child theme templates by selecting them here."
731
  msgstr ""
732
 
733
- #: includes/forms/fileform.php:44
734
  msgid ""
735
  "Delete child theme templates or make them writable by selecting them here. "
736
  "Writable files are displayed in <span style=\"color:red\">red</span>."
737
  msgstr ""
738
 
739
- #: includes/forms/fileform.php:57
740
- msgid "Make Selected Writable"
741
- msgstr ""
742
-
743
- #: includes/forms/fileform.php:61
744
- msgid "Copy Selected to Child Theme"
745
- msgstr ""
746
-
747
- #: includes/forms/fileform.php:61 includes/forms/images.php:21
748
- msgid "Delete Selected"
749
- msgstr ""
750
-
751
  #: includes/forms/files.php:15
752
  msgid "Upload New Child Theme Image"
753
  msgstr ""
@@ -781,6 +696,12 @@ msgstr ""
781
  msgid "Export Child Theme as Zip Archive"
782
  msgstr ""
783
 
 
 
 
 
 
 
784
  #: includes/forms/files.php:68
785
  msgid "Secure Child Theme"
786
  msgstr ""
@@ -803,16 +724,118 @@ msgstr ""
803
  msgid "Delete child theme images by selecting them here."
804
  msgstr ""
805
 
806
- #: includes/forms/main.php:34
807
  msgid "version"
808
  msgstr ""
809
 
810
- #: includes/forms/main.php:38
811
- msgid "Debug"
 
 
812
  msgstr ""
813
 
814
- #: includes/forms/main.php:41
815
- msgid "Currently Loaded"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
816
  msgstr ""
817
 
818
  #: includes/forms/parent-child.php:21
@@ -866,76 +889,80 @@ msgstr ""
866
  msgid "Select a Parent Theme:"
867
  msgstr ""
868
 
869
- #: includes/forms/parent-child.php:82 includes/forms/parent-child.php:95
 
 
 
 
870
  msgid "Analyze"
871
  msgstr ""
872
 
873
- #: includes/forms/parent-child.php:84
874
  msgid "Analyze Parent Theme"
875
  msgstr ""
876
 
877
- #: includes/forms/parent-child.php:84 includes/forms/parent-child.php:97
878
  msgid ""
879
  "Click \"Analyze\" to determine stylesheet dependencies and other potential "
880
  "issues."
881
  msgstr ""
882
 
883
- #: includes/forms/parent-child.php:91
884
  msgid "Select a Child Theme:"
885
  msgstr ""
886
 
887
- #: includes/forms/parent-child.php:97
888
  msgid "Analyze Child Theme"
889
  msgstr ""
890
 
891
- #: includes/forms/parent-child.php:105
892
  msgid "Name the new theme directory:"
893
  msgstr ""
894
 
895
- #: includes/forms/parent-child.php:108
896
  msgid "Directory Name"
897
  msgstr ""
898
 
899
- #: includes/forms/parent-child.php:112 includes/forms/parent-child.php:307
900
  msgid "NOTE:"
901
  msgstr ""
902
 
903
- #: includes/forms/parent-child.php:114
904
  msgid ""
905
  "This is NOT the name of the Child Theme. You can customize the name, "
906
  "description, etc. in step 7, below."
907
  msgstr ""
908
 
909
- #: includes/forms/parent-child.php:118
910
  msgid "Verify Child Theme directory:"
911
  msgstr ""
912
 
913
- #: includes/forms/parent-child.php:124
914
  msgid ""
915
  "For verification only (you cannot modify the directory of an existing Child "
916
  "Theme)."
917
  msgstr ""
918
 
919
- #: includes/forms/parent-child.php:136
920
  msgid "Select where to save new styles:"
921
  msgstr ""
922
 
923
- #: includes/forms/parent-child.php:143
924
  msgid "Primary Stylesheet (style.css)"
925
  msgstr ""
926
 
927
- #: includes/forms/parent-child.php:146
928
  msgid ""
929
  "Save new custom styles directly to the Child Theme primary stylesheet, "
930
  "replacing the existing values. The primary stylesheet will load in the order "
931
  "set by the theme."
932
  msgstr ""
933
 
934
- #: includes/forms/parent-child.php:156
935
  msgid "Separate Stylesheet"
936
  msgstr ""
937
 
938
- #: includes/forms/parent-child.php:159
939
  msgid ""
940
  "Save new custom styles to a separate stylesheet and use any existing child "
941
  "theme styles as a baseline. Select this option if you want to preserve the "
@@ -943,216 +970,223 @@ msgid ""
943
  "allows you to customize stylesheets that load after the primary stylesheet."
944
  msgstr ""
945
 
946
- #: includes/forms/parent-child.php:165
947
  msgid "Click to expand"
948
  msgstr ""
949
 
950
- #: includes/forms/parent-child.php:166
951
  msgid "Select Parent Theme stylesheet handling:"
952
  msgstr ""
953
 
954
- #: includes/forms/parent-child.php:179
955
  msgid "Use the WordPress style queue."
956
  msgstr ""
957
 
958
- #: includes/forms/parent-child.php:183
959
  msgid ""
960
  "Let the Configurator determine the appropriate actions and dependencies and "
961
  "update the functions file automatically."
962
  msgstr ""
963
 
964
- #: includes/forms/parent-child.php:189
965
  msgid "Use <code>@import</code> in the child theme stylesheet."
966
  msgstr ""
967
 
968
- #: includes/forms/parent-child.php:193
969
  msgid ""
970
  "Only use this option if the parent stylesheet cannot be loaded using the "
971
  "WordPress style queue. Using <code>@import</code> is not recommended."
972
  msgstr ""
973
 
974
- #: includes/forms/parent-child.php:199
975
  msgid "Do not add any parent stylesheet handling."
976
  msgstr ""
977
 
978
- #: includes/forms/parent-child.php:202
979
  msgid ""
980
  "Select this option if this theme already handles the parent theme stylesheet "
981
  "or if the parent theme's <code>style.css</code> file is not used for its "
982
  "appearance."
983
  msgstr ""
984
 
985
- #: includes/forms/parent-child.php:205
986
  msgid "Additional handling options"
987
  msgstr ""
988
 
989
- #: includes/forms/parent-child.php:212
990
  msgid "Ignore parent theme stylesheets."
991
  msgstr ""
992
 
993
- #: includes/forms/parent-child.php:213
994
  msgid ""
995
  "Do not load or parse the parent theme styles. Only use this option if the "
996
  "Child Theme uses a Framework like Genesis and only uses child theme "
997
  "stylesheets for its appearance."
998
  msgstr ""
999
 
1000
- #: includes/forms/parent-child.php:222
1001
  msgid "Repair the header template in the child theme."
1002
  msgstr ""
1003
 
1004
- #: includes/forms/parent-child.php:223
1005
  msgid ""
1006
  "Let the Configurator (try to) resolve any stylesheet issues listed above. "
1007
  "This can fix many, but not all, common problems."
1008
  msgstr ""
1009
 
1010
- #: includes/forms/parent-child.php:228
1011
  msgid "Click to toggle form"
1012
  msgstr ""
1013
 
1014
- #: includes/forms/parent-child.php:229
1015
  msgid "Customize the Child Theme Name, Description, Author, Version, etc.:"
1016
  msgstr ""
1017
 
1018
- #: includes/forms/parent-child.php:230
1019
  msgid "(Click to toggle form)"
1020
  msgstr ""
1021
 
1022
- #: includes/forms/parent-child.php:234
1023
  msgid "Child Theme Name"
1024
  msgstr ""
1025
 
1026
- #: includes/forms/parent-child.php:238
1027
  msgid "Theme Name"
1028
  msgstr ""
1029
 
1030
- #: includes/forms/parent-child.php:243 includes/forms/parent-child.php:247
1031
  msgid "Theme Website"
1032
  msgstr ""
1033
 
1034
- #: includes/forms/parent-child.php:252 includes/forms/parent-child.php:256
1035
  msgid "Author"
1036
  msgstr ""
1037
 
1038
- #: includes/forms/parent-child.php:261 includes/forms/parent-child.php:265
1039
  msgid "Author Website"
1040
  msgstr ""
1041
 
1042
- #: includes/forms/parent-child.php:270
1043
  msgid "Theme Description"
1044
  msgstr ""
1045
 
1046
- #: includes/forms/parent-child.php:273
1047
  msgid "Description"
1048
  msgstr ""
1049
 
1050
- #: includes/forms/parent-child.php:278
1051
  msgid "Theme Tags"
1052
  msgstr ""
1053
 
1054
- #: includes/forms/parent-child.php:281
1055
  msgid "Tags"
1056
  msgstr ""
1057
 
1058
- #: includes/forms/parent-child.php:286 includes/forms/parent-child.php:290
1059
  msgid "Version"
1060
  msgstr ""
1061
 
1062
- #: includes/forms/parent-child.php:299
1063
  msgid ""
1064
  "Copy Menus, Widgets and other Customizer Settings from the Parent Theme to "
1065
  "the Child Theme:"
1066
  msgstr ""
1067
 
1068
- #: includes/forms/parent-child.php:309
1069
  msgid ""
1070
  "This option replaces the Child Theme's existing Menus, Widgets and other "
1071
  "Customizer Settings with those from the Parent Theme. You should only need "
1072
  "to use this option the first time you configure a Child Theme."
1073
  msgstr ""
1074
 
1075
- #: includes/forms/parent-child.php:316 includes/forms/parent-child.php:353
1076
  msgid "Click to run the Configurator:"
1077
  msgstr ""
1078
 
1079
- #: includes/forms/parent-child.php:319
1080
  msgid "Configure Child Theme"
1081
  msgstr ""
1082
 
1083
- #: includes/forms/parent-child.php:337
1084
  msgid "Parse Plugin stylesheets:"
1085
  msgstr ""
1086
 
1087
- #: includes/forms/parent-child.php:341
1088
  msgid "Select the plugin stylesheets you wish to customize below."
1089
  msgstr ""
1090
 
1091
- #: includes/forms/parent-child.php:356
1092
  msgid "Configure Plugin Styles"
1093
  msgstr ""
1094
 
1095
- #: includes/forms/query-selector.php:13
1096
- msgid "@media Query"
 
 
 
1097
  msgstr ""
1098
 
1099
  #: includes/forms/query-selector.php:14
 
 
 
 
1100
  msgid "( or \"base\" )"
1101
  msgstr ""
1102
 
1103
- #: includes/forms/query-selector.php:24
1104
  msgid "Selector"
1105
  msgstr ""
1106
 
1107
- #: includes/forms/query-selector.php:37 includes/forms/rule-value.php:29
1108
  msgid "Sample"
1109
  msgstr ""
1110
 
1111
- #: includes/forms/query-selector.php:45
1112
  msgid "Save Child Values"
1113
  msgstr ""
1114
 
1115
- #: includes/forms/query-selector.php:46
1116
  msgid "Delete Child Values"
1117
  msgstr ""
1118
 
1119
- #: includes/forms/query-selector.php:53 includes/forms/rule-value.php:13
1120
  msgid "Property"
1121
  msgstr ""
1122
 
1123
- #: includes/forms/query-selector.php:56
1124
  msgid "Baseline Value"
1125
  msgstr ""
1126
 
1127
- #: includes/forms/query-selector.php:59
1128
  msgid "Child Value"
1129
  msgstr ""
1130
 
1131
- #: includes/forms/query-selector.php:65
1132
  msgid "New Property"
1133
  msgstr ""
1134
 
1135
- #: includes/forms/query-selector.php:75
1136
  msgid "Order"
1137
  msgstr ""
1138
 
1139
- #: includes/forms/query-selector.php:84
1140
  msgid "Copy Selector"
1141
  msgstr ""
1142
 
1143
- #: includes/forms/query-selector.php:86 includes/forms/webfonts.php:15
1144
  msgid "Save"
1145
  msgstr ""
1146
 
1147
- #: includes/forms/query-selector.php:89
1148
  msgid "Raw CSS"
1149
  msgstr ""
1150
 
1151
- #: includes/forms/query-selector.php:91
1152
  msgid "Use to enter shorthand CSS or new @media queries and selectors."
1153
  msgstr ""
1154
 
1155
- #: includes/forms/query-selector.php:91
1156
  msgid ""
1157
  "Values entered here are merged into existing child styles or added to the "
1158
  "child stylesheet if they do not exist in the parent."
@@ -1174,35 +1208,81 @@ msgstr ""
1174
  msgid "Lilaea Media - Responsive Tools for a Mobile World"
1175
  msgstr ""
1176
 
1177
- #: includes/forms/rule-value.php:26
 
 
 
 
 
 
 
 
1178
  msgid "Value"
1179
  msgstr ""
1180
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1181
  #: includes/forms/tabs.php:11
1182
- msgid "Parent/Child"
1183
  msgstr ""
1184
 
1185
  #: includes/forms/tabs.php:14
1186
- msgid "Query/Selector"
1187
  msgstr ""
1188
 
1189
  #: includes/forms/tabs.php:17
1190
- msgid "Property/Value"
1191
  msgstr ""
1192
 
1193
- #: includes/forms/tabs.php:20
1194
  msgid "Web Fonts"
1195
  msgstr ""
1196
 
1197
- #: includes/forms/tabs.php:23
1198
  msgid "Baseline Styles"
1199
  msgstr ""
1200
 
1201
- #: includes/forms/tabs.php:26
1202
  msgid "Child Styles"
1203
  msgstr ""
1204
 
1205
- #: includes/forms/tabs.php:30
1206
  msgid "Files"
1207
  msgstr ""
1208
 
@@ -1238,8 +1318,8 @@ msgid ""
1238
  "strong>"
1239
  msgstr ""
1240
 
1241
- #: includes/forms/zipform.php:8
1242
- msgid "Export Zip"
1243
  msgstr ""
1244
 
1245
  #. Plugin URI of the plugin/theme
1
+ # Copyright (C) 2016 Child Theme Configurator
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.1.0\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/child-theme-configurator\n"
7
+ "POT-Creation-Date: 2016-08-14 01:03:04+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
+ #: includes/class-ctc-admin.php:387
16
  msgid "Zip file creation failed."
17
  msgstr ""
18
 
19
+ #: includes/class-ctc-admin.php:413
20
  msgid "The Functions file is required and cannot be deleted."
21
  msgstr ""
22
 
23
+ #: includes/class-ctc-admin.php:493
24
  msgid "You do not have permission to configure child themes."
25
  msgstr ""
26
 
54
  msgid "Could not upgrade child theme"
55
  msgstr ""
56
 
57
+ #: includes/class-ctc-admin.php:717
58
  msgid "Your stylesheet is not writable."
59
  msgstr ""
60
 
61
+ #: includes/class-ctc-admin.php:1301
62
  msgid "Could not set write permissions."
63
  msgstr ""
64
 
65
+ #: includes/class-ctc-admin.php:1402
66
  msgid "There were errors while resetting permissions."
67
  msgstr ""
68
 
69
+ #: includes/class-ctc-admin.php:1476
70
  msgid "Could not upload file."
71
  msgstr ""
72
 
73
+ #: includes/class-ctc-admin.php:1502
74
+ msgid "Invalid theme root directory."
75
  msgstr ""
76
 
77
+ #: includes/class-ctc-admin.php:1514
78
+ msgid "No writable temp directory."
79
  msgstr ""
80
 
81
+ #: includes/class-ctc-admin.php:1544
82
+ msgid "PclZip returned zero bytes."
 
 
 
 
 
 
 
 
 
 
83
  msgstr ""
84
 
85
+ #: includes/class-ctc-ui.php:35
86
+ msgid "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
 
 
 
 
 
 
 
 
 
 
 
 
87
  msgstr ""
88
 
89
+ #: includes/class-ctc-ui.php:98
90
+ msgid ""
91
+ "The Theme editor has been disabled. Template files must be edited offline."
92
  msgstr ""
93
 
94
+ #: includes/class-ctc-ui.php:102
95
+ msgid "Click here to edit template files using the Theme Editor"
96
  msgstr ""
97
 
98
+ #: includes/class-ctc-ui.php:269
99
  msgid "URL/None"
100
  msgstr ""
101
 
102
+ #: includes/class-ctc-ui.php:270
103
  msgid "Origin"
104
  msgstr ""
105
 
106
+ #: includes/class-ctc-ui.php:271
107
  msgid "Color 1"
108
  msgstr ""
109
 
110
+ #: includes/class-ctc-ui.php:272
111
  msgid "Color 2"
112
  msgstr ""
113
 
114
+ #: includes/class-ctc-ui.php:273
115
  msgid "Width/None"
116
  msgstr ""
117
 
118
+ #: includes/class-ctc-ui.php:274
119
  msgid "Style"
120
  msgstr ""
121
 
122
+ #: includes/class-ctc-ui.php:275
123
  msgid "Color"
124
  msgstr ""
125
 
126
+ #: includes/class-ctc-ui.php:277
127
  msgid ""
128
  "Are you sure you wish to RESET? This will destroy any work you have done in "
129
  "the Configurator."
130
  msgstr ""
131
 
132
+ #: includes/class-ctc-ui.php:278
133
  msgid "<span style=\"font-size:10px\">!</span>"
134
  msgstr ""
135
 
136
+ #: includes/class-ctc-ui.php:279 includes/forms/rule-value.php:33
137
  msgid "Selectors"
138
  msgstr ""
139
 
140
+ #: includes/class-ctc-ui.php:280
141
  msgid "Close"
142
  msgstr ""
143
 
144
+ #: includes/class-ctc-ui.php:281
145
  msgid "Edit Selector"
146
  msgstr ""
147
 
148
+ #: includes/class-ctc-ui.php:282
149
  msgid "Cancel"
150
  msgstr ""
151
 
152
+ #: includes/class-ctc-ui.php:283
153
  msgid "Rename"
154
  msgstr ""
155
 
156
+ #: includes/class-ctc-ui.php:284
157
  msgid "The stylesheet cannot be displayed."
158
  msgstr ""
159
 
160
+ #: includes/class-ctc-ui.php:285
161
  msgid "(Child Only)"
162
  msgstr ""
163
 
164
+ #: includes/class-ctc-ui.php:286
165
  msgid "Please enter a valid Child Theme."
166
  msgstr ""
167
 
168
+ #: includes/class-ctc-ui.php:287
169
  msgid "Please enter a valid Child Theme name."
170
  msgstr ""
171
 
172
+ #: includes/class-ctc-ui.php:288
173
  msgid "<strong>%s</strong> exists. Please enter a different Child Theme"
174
  msgstr ""
175
 
176
+ #: includes/class-ctc-ui.php:289
177
  msgid "The page could not be loaded correctly."
178
  msgstr ""
179
 
180
+ #: includes/class-ctc-ui.php:290
181
  msgid ""
182
  "Conflicting or out-of-date jQuery libraries were loaded by another plugin:"
183
  msgstr ""
184
 
185
+ #: includes/class-ctc-ui.php:291
186
  msgid "Deactivating or replacing plugins may resolve this issue."
187
  msgstr ""
188
 
189
+ #: includes/class-ctc-ui.php:292
190
  msgid "%sWhy am I seeing this?%s"
191
  msgstr ""
192
 
193
+ #: includes/class-ctc-ui.php:295
194
  msgid "No Styles Available. Check Parent/Child settings."
195
  msgstr ""
196
 
197
+ #: includes/class-ctc-ui.php:296
198
  msgid "Updating"
199
  msgstr ""
200
 
201
+ #: includes/class-ctc-ui.php:297
202
  msgid "Checking"
203
  msgstr ""
204
 
205
+ #: includes/class-ctc-ui.php:298
206
  msgid "The theme \"%s\" generated unexpected PHP debug output."
207
  msgstr ""
208
 
209
+ #: includes/class-ctc-ui.php:299
210
+ msgid ""
211
+ "The theme \"%s\" could not be analyzed because the preview did not render "
212
+ "correctly."
213
  msgstr ""
214
 
215
+ #: includes/class-ctc-ui.php:300
216
  msgid ""
217
+ "<p>First, <a href=\"%s\">refresh this page</a> and try analyzing again.</"
218
+ "p><p>If that does not work, try temporarily disabling plugins that "
219
+ "<strong>minify CSS</strong> or that <strong>force redirects between HTTP and "
220
+ "HTTPS</strong>.</p>"
221
  msgstr ""
222
 
223
+ #: includes/class-ctc-ui.php:301
224
+ msgid "Click to show/hide PHP debug output"
225
  msgstr ""
226
 
227
+ #: includes/class-ctc-ui.php:302
228
  msgid ""
229
+ "<p>Please contact this Theme's author and report the items inside the box "
230
+ "above. You may or may not be able to use this Theme as a Child Theme while "
231
+ "these conditions exist.</p><p>It is possible that this theme has specific "
232
+ "requirements to work correctly as a child theme. Please make sure you are "
233
+ "using the latest version of this theme and check your theme's documentation "
234
+ "for more information.</p>"
235
  msgstr ""
236
 
237
+ #: includes/class-ctc-ui.php:303
238
  msgid "Do Not Activate \"%s\"! A PHP FATAL ERROR has been detected."
239
  msgstr ""
240
 
241
+ #: includes/class-ctc-ui.php:304
242
  msgid "This theme loads stylesheets after the wp_styles queue."
243
  msgstr ""
244
 
245
+ #: includes/class-ctc-ui.php:305
246
  msgid ""
247
  "<p>This makes it difficult for plugins to override these styles. You can try "
248
  "to resolve this using the \"Repair header template\" option (Step 6, "
249
  "\"Additional handling options\", below).</p>"
250
  msgstr ""
251
 
252
+ #: includes/class-ctc-ui.php:306
253
  msgid ""
254
  "This theme loads the parent theme's <code>style.css</code> file outside the "
255
  "wp_styles queue."
256
  msgstr ""
257
 
258
+ #: includes/class-ctc-ui.php:307
259
  msgid ""
260
  "<p>This is common with older themes but requires the use of <code>@import</"
261
  "code>, which is no longer recommended. You can try to resolve this using the "
263
  "\", below).</p>"
264
  msgstr ""
265
 
266
+ #: includes/class-ctc-ui.php:308
267
  msgid "This child theme does not load a Configurator stylesheet."
268
  msgstr ""
269
 
270
+ #: includes/class-ctc-ui.php:309
271
  msgid ""
272
  "<p>If you want to customize styles using this plugin, please click "
273
  "\"Configure Child Theme\" again to add this to the settings.</p>"
274
  msgstr ""
275
 
276
+ #: includes/class-ctc-ui.php:310
277
  msgid ""
278
  "This child theme uses the parent stylesheet but does not load the parent "
279
  "theme's <code>style.css</code> file."
280
  msgstr ""
281
 
282
+ #: includes/class-ctc-ui.php:311
283
  msgid ""
284
  "<p>Please select a stylesheet handling method or check \"Ignore parent theme "
285
  "stylesheets\" (see step 6, below).</p>"
286
  msgstr ""
287
 
288
+ #: includes/class-ctc-ui.php:312
289
  msgid "This child theme appears to be functioning correctly."
290
  msgstr ""
291
 
292
+ #: includes/class-ctc-ui.php:313
293
  msgid "This theme appears OK to use as a Child theme."
294
  msgstr ""
295
 
296
+ #: includes/class-ctc-ui.php:314
297
  msgid "This Child Theme has not been configured for this plugin."
298
  msgstr ""
299
 
300
+ #: includes/class-ctc-ui.php:315
301
  msgid ""
302
  "<p>The Configurator makes significant modifications to the child theme, "
303
  "including stylesheet changes and additional php functions. Please consider "
305
  "original as a backup.</p>"
306
  msgstr ""
307
 
308
+ #: includes/class-ctc-ui.php:316
309
  msgid ""
310
  "This child theme uses <code>@import</code> to load the parent theme's "
311
  "<code>style.css</code> file."
312
  msgstr ""
313
 
314
+ #: includes/class-ctc-ui.php:317
315
  msgid ""
316
  "<p>Please consider selecting \"Use the WordPress style queue\" for the "
317
  "parent stylesheet handling option (see step 6, below).</p>"
318
  msgstr ""
319
 
320
+ #: includes/class-ctc-ui.php:318
321
  msgid ""
322
  "This theme loads additional stylesheets after the <code>style.css</code> "
323
  "file:"
324
  msgstr ""
325
 
326
+ #: includes/class-ctc-ui.php:319
327
  msgid ""
328
  "<p>Consider saving new custom styles to a \"Separate stylesheet\" (see step "
329
  "5, below) so that you can customize these styles.</p>"
330
  msgstr ""
331
 
332
+ #: includes/class-ctc-ui.php:320
333
  msgid ""
334
  "The parent theme's <code>style.css</code> file is being loaded automatically."
335
  msgstr ""
336
 
337
+ #: includes/class-ctc-ui.php:321
338
  msgid ""
339
  "<p>The Configurator selected \"Do not add any parent stylesheet handling\" "
340
  "for the \"Parent stylesheet handling\" option (see step 6, below).</p>"
341
  msgstr ""
342
 
343
+ #: includes/class-ctc-ui.php:322
344
  msgid ""
345
  "This theme does not require the parent theme's <code>style.css</code> file "
346
  "for its appearance."
347
  msgstr ""
348
 
349
+ #: includes/class-ctc-ui.php:323
350
  msgid "This Child Theme was configured with an earlier version."
351
  msgstr ""
352
 
353
+ #: includes/class-ctc-ui.php:324
354
  msgid ""
355
  "<p>The selected stylesheet handling method is no longer used. Please update "
356
  "the configuration using the \"Repair header template\" option (see step 6, "
357
  "\"Additional handling options\", below).</p>"
358
  msgstr ""
359
 
360
+ #: includes/class-ctc-ui.php:325
361
+ msgid ""
362
+ "Click to show/hide analysis data. Please include contents below with any "
363
+ "support requests."
364
  msgstr ""
365
 
366
+ #: includes/class-ctc-ui.php:326
367
  msgid ""
368
  "This child theme was configured using the CTC Pro \"Genesis stylesheet "
369
  "handling\" method."
370
  msgstr ""
371
 
372
+ #: includes/class-ctc-ui.php:327
373
  msgid ""
374
  "<p>This method has been replaced by the \"Separate stylesheet\" and \"Ignore "
375
  "Parent Theme\" options ( selected below ) for broader framework "
376
  "compatability.</p>"
377
  msgstr ""
378
 
379
+ #: includes/class-ctc-ui.php:328
380
+ msgid "<p>%1Click Here%2 to view the theme as viewed by the Analyzer.</p>"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
381
  msgstr ""
382
 
383
+ #. #-#-#-#-# child-theme-configurator.pot (Child Theme Configurator 2.1.0) #-#-#-#-#
384
+ #. Plugin Name of the plugin/theme
385
+ #: includes/class-ctc.php:65 includes/class-ctc.php:76
386
+ #: includes/forms/main.php:35
387
+ msgid "Child Theme Configurator"
388
  msgstr ""
389
 
390
+ #: includes/class-ctc.php:66 includes/class-ctc.php:77
391
+ #: includes/class-ctc.php:88
392
+ msgid "Child Themes"
393
  msgstr ""
394
 
395
+ #: includes/class-ctc.php:106
396
+ msgid "Child Theme Configurator requires WordPress version %s or later."
 
 
 
 
 
397
  msgstr ""
398
 
399
+ #: includes/class-ctc.php:122
400
+ msgid "Click here to download and save the latest version to your computer."
 
 
 
401
  msgstr ""
402
 
403
+ #: includes/class-ctc.php:127
404
+ msgid "Click here to switch to the plugin install page."
 
 
 
405
  msgstr ""
406
 
407
+ #: includes/class-ctc.php:130
408
  msgid ""
409
+ "Child Theme Configurator Pro version %s is not compatible with this version "
410
+ "of Child Theme Configurator and has been deactivated."
 
411
  msgstr ""
412
 
413
+ #: includes/class-ctc.php:131
414
+ msgid "Please follow these steps carefully to upgrade to the latest version."
 
 
 
415
  msgstr ""
416
 
417
+ #: includes/class-ctc.php:132
418
+ msgid "DO NOT DELETE THE EXISTING PRO PLUGIN or you will lose your settings."
419
  msgstr ""
420
 
421
+ #: includes/class-ctc.php:135
422
  msgid ""
423
+ "Click the \"Browse\" button in the center of the page (NOT the button at the "
424
+ "top) and select the \"%s\" file from your computer."
 
 
 
 
425
  msgstr ""
426
 
427
+ #: includes/class-ctc.php:136
428
+ msgid "Click \"Install Now.\""
429
  msgstr ""
430
 
431
+ #: includes/class-ctc.php:137
432
+ msgid "Click \"Activate Plugin\""
433
  msgstr ""
434
 
435
+ #: includes/class-ctc.php:138
436
  msgid ""
437
+ "WordPress will automatically remove the original plugin when you activate "
438
+ "the new version."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
439
  msgstr ""
440
 
441
  #: includes/forms/addl_css.php:7
577
  msgstr ""
578
 
579
  #: includes/forms/addl_panels.php:32
580
+ msgid "Add Child Theme Files"
581
  msgstr ""
582
 
583
  #: includes/forms/addl_panels.php:33
584
+ msgid "Create new template and script files right from the admin."
 
 
585
  msgstr ""
586
 
587
  #: includes/forms/addl_panels.php:34
608
  msgid "Restore backup from"
609
  msgstr ""
610
 
611
+ #: includes/forms/current-theme.php:6
612
+ msgid "Currently loaded"
 
613
  msgstr ""
614
 
615
+ #: includes/forms/debug-toggle.php:8
616
+ msgid "Debug"
617
  msgstr ""
618
 
619
+ #: includes/forms/file-form-buttons.php:9
620
+ msgid "Make Selected Writable"
621
+ msgstr ""
622
+
623
+ #: includes/forms/file-form-buttons.php:13
624
+ msgid "Copy Selected to Child Theme"
625
+ msgstr ""
626
+
627
+ #: includes/forms/file-form-buttons.php:13 includes/forms/images.php:21
628
+ msgid "Delete Selected"
629
+ msgstr ""
630
+
631
+ #: includes/forms/fileform.php:9
632
  msgid "Parent Templates"
633
  msgstr ""
634
 
635
+ #: includes/forms/fileform.php:9
636
  msgid "Child Theme Files"
637
  msgstr ""
638
 
639
+ #: includes/forms/fileform.php:14
640
  msgid ""
641
  "Copy PHP templates from the parent theme by selecting them here. The "
642
  "Configurator defines a template as a Theme PHP file having no PHP functions "
643
  "or classes. Other PHP files cannot be safely overridden by a child theme."
644
  msgstr ""
645
 
646
+ #: includes/forms/fileform.php:17
647
  msgid ""
648
  "CAUTION: If your child theme is active, the child theme version of the file "
649
  "will be used instead of the parent immediately after it is copied."
650
  msgstr ""
651
 
652
+ #: includes/forms/fileform.php:19
653
  msgid "The %s file is generated separately and cannot be copied here."
654
  msgstr ""
655
 
656
+ #: includes/forms/fileform.php:29
657
  msgid "Delete child theme templates by selecting them here."
658
  msgstr ""
659
 
660
+ #: includes/forms/fileform.php:30
661
  msgid ""
662
  "Delete child theme templates or make them writable by selecting them here. "
663
  "Writable files are displayed in <span style=\"color:red\">red</span>."
664
  msgstr ""
665
 
 
 
 
 
 
 
 
 
 
 
 
 
666
  #: includes/forms/files.php:15
667
  msgid "Upload New Child Theme Image"
668
  msgstr ""
696
  msgid "Export Child Theme as Zip Archive"
697
  msgstr ""
698
 
699
+ #: includes/forms/files.php:58
700
+ msgid ""
701
+ "Click \"Export Zip\" to save a backup of the currently loaded child theme. "
702
+ "You can export any of your themes from the Parent/Child tab."
703
+ msgstr ""
704
+
705
  #: includes/forms/files.php:68
706
  msgid "Secure Child Theme"
707
  msgstr ""
724
  msgid "Delete child theme images by selecting them here."
725
  msgstr ""
726
 
727
+ #: includes/forms/main.php:35
728
  msgid "version"
729
  msgstr ""
730
 
731
+ #: includes/forms/notices.php:12
732
+ msgid ""
733
+ "The child theme is in read-only mode and Child Theme Configurator cannot "
734
+ "apply changes. Click to see options"
735
  msgstr ""
736
 
737
+ #: includes/forms/notices.php:20
738
+ msgid ""
739
+ "<li>Temporarily set write permissions by clicking the button below. When you "
740
+ "are finished editing, revert to read-only by clicking \"Make read-only\" "
741
+ "under the \"Files\" tab.</li>"
742
+ msgstr ""
743
+
744
+ #: includes/forms/notices.php:24
745
+ msgid "Make files writable"
746
+ msgstr ""
747
+
748
+ #: includes/forms/notices.php:27
749
+ msgid ""
750
+ "<li><a target=\"_blank\" href=\"http://codex.wordpress.org/Editing_wp-"
751
+ "config.php#WordPress_Upgrade_Constants\" title=\"Editin wp-config.php\">Add "
752
+ "your FTP/SSH credentials to the WordPress config file</a>.</li>"
753
+ msgstr ""
754
+
755
+ #: includes/forms/notices.php:29
756
+ msgid ""
757
+ "<li><a target=\"_blank\" href=\"http://technet.microsoft.com/en-us/library/"
758
+ "cc771170\" title=\"Setting Application Pool Identity\">Assign WordPress to "
759
+ "an application pool that has write permissions</a> (Windows IIS systems).</"
760
+ "li>"
761
+ msgstr ""
762
+
763
+ #: includes/forms/notices.php:30
764
+ msgid ""
765
+ "<li><a target=\"_blank\" href=\"http://codex.wordpress.org/"
766
+ "Changing_File_Permissions\" title=\"Changing File Permissions\">Set write "
767
+ "permissions on the server manually</a> (not recommended).</li>"
768
+ msgstr ""
769
+
770
+ #: includes/forms/notices.php:32
771
+ msgid "<li>Run PHP under Apache with suEXEC (contact your web host).</li>"
772
+ msgstr ""
773
+
774
+ #: includes/forms/notices.php:45
775
+ msgid ""
776
+ "This Child Theme has incorrect ownership permissions. Child Theme "
777
+ "Configurator will attempt to correct this when you click the button below."
778
+ msgstr ""
779
+
780
+ #: includes/forms/notices.php:51
781
+ msgid "Correct Child Theme Permissions"
782
+ msgstr ""
783
+
784
+ #: includes/forms/notices.php:60
785
+ msgid ""
786
+ "Child Theme Configurator needs to update its internal data. Please set your "
787
+ "preferences below and click \"Generate Child Theme Files\" to update your "
788
+ "configuration."
789
+ msgstr ""
790
+
791
+ #: includes/forms/notices.php:68
792
+ msgid ""
793
+ "<strong>However, some styles could not be parsed due to memory limits.</"
794
+ "strong> Try deselecting \"Additional Stylesheets\" below and click "
795
+ "\"Generate/Rebuild Child Theme Files\". %sWhy am I seeing this?%s"
796
+ msgstr ""
797
+
798
+ #: includes/forms/notices.php:76
799
+ msgid ""
800
+ "Child Theme Configurator did not detect any configuration data because a "
801
+ "previously configured Child Theme has been removed. Please follow the steps "
802
+ "for \"CONFIGURE an existing Child Theme\" under the \"Parent/Child\" Tab."
803
+ msgstr ""
804
+
805
+ #: includes/forms/notices.php:84
806
+ msgid ""
807
+ "Your stylesheet has changed since the last time you used the Configurator. "
808
+ "Please follow the steps for \"CONFIGURE an existing Child Theme\" under the "
809
+ "\"Parent/Child\" Tab or you will lose these changes."
810
+ msgstr ""
811
+
812
+ #: includes/forms/notices.php:97
813
+ msgid "Thank you for installing Child Theme Configurator."
814
+ msgstr ""
815
+
816
+ #: includes/forms/notices.php:100
817
+ msgid ""
818
+ "A lot of time and testing has gone into this release but there may be edge "
819
+ "cases. If you have any questions, please"
820
+ msgstr ""
821
+
822
+ #: includes/forms/notices.php:102
823
+ msgid "Contact Us."
824
+ msgstr ""
825
+
826
+ #: includes/forms/notices.php:105
827
+ msgid "For more information, please open the Help tab at the top right or "
828
+ msgstr ""
829
+
830
+ #: includes/forms/notices.php:107
831
+ msgid "click here to view the latest videos."
832
+ msgstr ""
833
+
834
+ #: includes/forms/notices.php:111
835
+ msgid ""
836
+ "It is a good idea to save a Zip Archive of your Child Theme before using CTC "
837
+ "for the first time. Click the \"save backup\" link ( see Step 2, below ) to "
838
+ "export your themes."
839
  msgstr ""
840
 
841
  #: includes/forms/parent-child.php:21
889
  msgid "Select a Parent Theme:"
890
  msgstr ""
891
 
892
+ #: includes/forms/parent-child.php:80 includes/forms/parent-child.php:95
893
+ msgid "Click here to save a backup of the selected theme."
894
+ msgstr ""
895
+
896
+ #: includes/forms/parent-child.php:84 includes/forms/parent-child.php:99
897
  msgid "Analyze"
898
  msgstr ""
899
 
900
+ #: includes/forms/parent-child.php:86
901
  msgid "Analyze Parent Theme"
902
  msgstr ""
903
 
904
+ #: includes/forms/parent-child.php:86 includes/forms/parent-child.php:101
905
  msgid ""
906
  "Click \"Analyze\" to determine stylesheet dependencies and other potential "
907
  "issues."
908
  msgstr ""
909
 
910
+ #: includes/forms/parent-child.php:93
911
  msgid "Select a Child Theme:"
912
  msgstr ""
913
 
914
+ #: includes/forms/parent-child.php:101
915
  msgid "Analyze Child Theme"
916
  msgstr ""
917
 
918
+ #: includes/forms/parent-child.php:109
919
  msgid "Name the new theme directory:"
920
  msgstr ""
921
 
922
+ #: includes/forms/parent-child.php:112
923
  msgid "Directory Name"
924
  msgstr ""
925
 
926
+ #: includes/forms/parent-child.php:116 includes/forms/parent-child.php:311
927
  msgid "NOTE:"
928
  msgstr ""
929
 
930
+ #: includes/forms/parent-child.php:118
931
  msgid ""
932
  "This is NOT the name of the Child Theme. You can customize the name, "
933
  "description, etc. in step 7, below."
934
  msgstr ""
935
 
936
+ #: includes/forms/parent-child.php:122
937
  msgid "Verify Child Theme directory:"
938
  msgstr ""
939
 
940
+ #: includes/forms/parent-child.php:128
941
  msgid ""
942
  "For verification only (you cannot modify the directory of an existing Child "
943
  "Theme)."
944
  msgstr ""
945
 
946
+ #: includes/forms/parent-child.php:140
947
  msgid "Select where to save new styles:"
948
  msgstr ""
949
 
950
+ #: includes/forms/parent-child.php:147
951
  msgid "Primary Stylesheet (style.css)"
952
  msgstr ""
953
 
954
+ #: includes/forms/parent-child.php:150
955
  msgid ""
956
  "Save new custom styles directly to the Child Theme primary stylesheet, "
957
  "replacing the existing values. The primary stylesheet will load in the order "
958
  "set by the theme."
959
  msgstr ""
960
 
961
+ #: includes/forms/parent-child.php:160
962
  msgid "Separate Stylesheet"
963
  msgstr ""
964
 
965
+ #: includes/forms/parent-child.php:163
966
  msgid ""
967
  "Save new custom styles to a separate stylesheet and use any existing child "
968
  "theme styles as a baseline. Select this option if you want to preserve the "
970
  "allows you to customize stylesheets that load after the primary stylesheet."
971
  msgstr ""
972
 
973
+ #: includes/forms/parent-child.php:169
974
  msgid "Click to expand"
975
  msgstr ""
976
 
977
+ #: includes/forms/parent-child.php:170
978
  msgid "Select Parent Theme stylesheet handling:"
979
  msgstr ""
980
 
981
+ #: includes/forms/parent-child.php:183
982
  msgid "Use the WordPress style queue."
983
  msgstr ""
984
 
985
+ #: includes/forms/parent-child.php:187
986
  msgid ""
987
  "Let the Configurator determine the appropriate actions and dependencies and "
988
  "update the functions file automatically."
989
  msgstr ""
990
 
991
+ #: includes/forms/parent-child.php:193
992
  msgid "Use <code>@import</code> in the child theme stylesheet."
993
  msgstr ""
994
 
995
+ #: includes/forms/parent-child.php:197
996
  msgid ""
997
  "Only use this option if the parent stylesheet cannot be loaded using the "
998
  "WordPress style queue. Using <code>@import</code> is not recommended."
999
  msgstr ""
1000
 
1001
+ #: includes/forms/parent-child.php:203
1002
  msgid "Do not add any parent stylesheet handling."
1003
  msgstr ""
1004
 
1005
+ #: includes/forms/parent-child.php:206
1006
  msgid ""
1007
  "Select this option if this theme already handles the parent theme stylesheet "
1008
  "or if the parent theme's <code>style.css</code> file is not used for its "
1009
  "appearance."
1010
  msgstr ""
1011
 
1012
+ #: includes/forms/parent-child.php:209
1013
  msgid "Additional handling options"
1014
  msgstr ""
1015
 
1016
+ #: includes/forms/parent-child.php:216
1017
  msgid "Ignore parent theme stylesheets."
1018
  msgstr ""
1019
 
1020
+ #: includes/forms/parent-child.php:217
1021
  msgid ""
1022
  "Do not load or parse the parent theme styles. Only use this option if the "
1023
  "Child Theme uses a Framework like Genesis and only uses child theme "
1024
  "stylesheets for its appearance."
1025
  msgstr ""
1026
 
1027
+ #: includes/forms/parent-child.php:226
1028
  msgid "Repair the header template in the child theme."
1029
  msgstr ""
1030
 
1031
+ #: includes/forms/parent-child.php:227
1032
  msgid ""
1033
  "Let the Configurator (try to) resolve any stylesheet issues listed above. "
1034
  "This can fix many, but not all, common problems."
1035
  msgstr ""
1036
 
1037
+ #: includes/forms/parent-child.php:232
1038
  msgid "Click to toggle form"
1039
  msgstr ""
1040
 
1041
+ #: includes/forms/parent-child.php:233
1042
  msgid "Customize the Child Theme Name, Description, Author, Version, etc.:"
1043
  msgstr ""
1044
 
1045
+ #: includes/forms/parent-child.php:234
1046
  msgid "(Click to toggle form)"
1047
  msgstr ""
1048
 
1049
+ #: includes/forms/parent-child.php:238
1050
  msgid "Child Theme Name"
1051
  msgstr ""
1052
 
1053
+ #: includes/forms/parent-child.php:242
1054
  msgid "Theme Name"
1055
  msgstr ""
1056
 
1057
+ #: includes/forms/parent-child.php:247 includes/forms/parent-child.php:251
1058
  msgid "Theme Website"
1059
  msgstr ""
1060
 
1061
+ #: includes/forms/parent-child.php:256 includes/forms/parent-child.php:260
1062
  msgid "Author"
1063
  msgstr ""
1064
 
1065
+ #: includes/forms/parent-child.php:265 includes/forms/parent-child.php:269
1066
  msgid "Author Website"
1067
  msgstr ""
1068
 
1069
+ #: includes/forms/parent-child.php:274
1070
  msgid "Theme Description"
1071
  msgstr ""
1072
 
1073
+ #: includes/forms/parent-child.php:277
1074
  msgid "Description"
1075
  msgstr ""
1076
 
1077
+ #: includes/forms/parent-child.php:282
1078
  msgid "Theme Tags"
1079
  msgstr ""
1080
 
1081
+ #: includes/forms/parent-child.php:285
1082
  msgid "Tags"
1083
  msgstr ""
1084
 
1085
+ #: includes/forms/parent-child.php:290 includes/forms/parent-child.php:294
1086
  msgid "Version"
1087
  msgstr ""
1088
 
1089
+ #: includes/forms/parent-child.php:303
1090
  msgid ""
1091
  "Copy Menus, Widgets and other Customizer Settings from the Parent Theme to "
1092
  "the Child Theme:"
1093
  msgstr ""
1094
 
1095
+ #: includes/forms/parent-child.php:313
1096
  msgid ""
1097
  "This option replaces the Child Theme's existing Menus, Widgets and other "
1098
  "Customizer Settings with those from the Parent Theme. You should only need "
1099
  "to use this option the first time you configure a Child Theme."
1100
  msgstr ""
1101
 
1102
+ #: includes/forms/parent-child.php:320 includes/forms/parent-child.php:358
1103
  msgid "Click to run the Configurator:"
1104
  msgstr ""
1105
 
1106
+ #: includes/forms/parent-child.php:323
1107
  msgid "Configure Child Theme"
1108
  msgstr ""
1109
 
1110
+ #: includes/forms/parent-child.php:342
1111
  msgid "Parse Plugin stylesheets:"
1112
  msgstr ""
1113
 
1114
+ #: includes/forms/parent-child.php:346
1115
  msgid "Select the plugin stylesheets you wish to customize below."
1116
  msgstr ""
1117
 
1118
+ #: includes/forms/parent-child.php:361
1119
  msgid "Configure Plugin Styles"
1120
  msgstr ""
1121
 
1122
+ #: includes/forms/query-selector.php:9
1123
+ msgid ""
1124
+ "To find and edit specific selectors within @media query blocks, first choose "
1125
+ "the query, then the selector. Use the \"base\" query to edit all other "
1126
+ "selectors."
1127
  msgstr ""
1128
 
1129
  #: includes/forms/query-selector.php:14
1130
+ msgid "@media Query"
1131
+ msgstr ""
1132
+
1133
+ #: includes/forms/query-selector.php:15
1134
  msgid "( or \"base\" )"
1135
  msgstr ""
1136
 
1137
+ #: includes/forms/query-selector.php:25
1138
  msgid "Selector"
1139
  msgstr ""
1140
 
1141
+ #: includes/forms/query-selector.php:38 includes/forms/rule-value.php:30
1142
  msgid "Sample"
1143
  msgstr ""
1144
 
1145
+ #: includes/forms/query-selector.php:46
1146
  msgid "Save Child Values"
1147
  msgstr ""
1148
 
1149
+ #: includes/forms/query-selector.php:47
1150
  msgid "Delete Child Values"
1151
  msgstr ""
1152
 
1153
+ #: includes/forms/query-selector.php:54 includes/forms/rule-value.php:14
1154
  msgid "Property"
1155
  msgstr ""
1156
 
1157
+ #: includes/forms/query-selector.php:57
1158
  msgid "Baseline Value"
1159
  msgstr ""
1160
 
1161
+ #: includes/forms/query-selector.php:60
1162
  msgid "Child Value"
1163
  msgstr ""
1164
 
1165
+ #: includes/forms/query-selector.php:66
1166
  msgid "New Property"
1167
  msgstr ""
1168
 
1169
+ #: includes/forms/query-selector.php:76
1170
  msgid "Order"
1171
  msgstr ""
1172
 
1173
+ #: includes/forms/query-selector.php:85
1174
  msgid "Copy Selector"
1175
  msgstr ""
1176
 
1177
+ #: includes/forms/query-selector.php:87 includes/forms/webfonts.php:15
1178
  msgid "Save"
1179
  msgstr ""
1180
 
1181
+ #: includes/forms/query-selector.php:90
1182
  msgid "Raw CSS"
1183
  msgstr ""
1184
 
1185
+ #: includes/forms/query-selector.php:92
1186
  msgid "Use to enter shorthand CSS or new @media queries and selectors."
1187
  msgstr ""
1188
 
1189
+ #: includes/forms/query-selector.php:92
1190
  msgid ""
1191
  "Values entered here are merged into existing child styles or added to the "
1192
  "child stylesheet if they do not exist in the parent."
1208
  msgid "Lilaea Media - Responsive Tools for a Mobile World"
1209
  msgstr ""
1210
 
1211
+ #: includes/forms/rule-value.php:9
1212
+ msgid ""
1213
+ "To find and edit selectors containing specific values for a given property, "
1214
+ "first choose the property (e.g., \"color\"), then click \"Selectors\" for "
1215
+ "any resulting value. A dialog panel will open with the corresponding "
1216
+ "selectors, grouped by media query."
1217
+ msgstr ""
1218
+
1219
+ #: includes/forms/rule-value.php:27
1220
  msgid "Value"
1221
  msgstr ""
1222
 
1223
+ #: includes/forms/settings-errors.php:20
1224
+ msgid ""
1225
+ "Child Theme <strong>%s</strong> has been reset. Please configure it using "
1226
+ "the settings below."
1227
+ msgstr ""
1228
+
1229
+ #: includes/forms/settings-errors.php:24
1230
+ msgid "Update Key saved successfully."
1231
+ msgstr ""
1232
+
1233
+ #: includes/forms/settings-errors.php:29
1234
+ msgid "Child Theme files modified successfully."
1235
+ msgstr ""
1236
+
1237
+ #: includes/forms/settings-errors.php:32
1238
+ msgid "Child Theme <strong>%s</strong> has been generated successfully."
1239
+ msgstr ""
1240
+
1241
+ #: includes/forms/settings-errors.php:36
1242
+ msgid "IMPORTANT:"
1243
+ msgstr ""
1244
+
1245
+ #: includes/forms/settings-errors.php:39
1246
+ msgid "You must %sNetwork enable%s your child theme."
1247
+ msgstr ""
1248
+
1249
+ #: includes/forms/settings-errors.php:42 includes/forms/themepreview.php:20
1250
+ msgid "Go to Themes"
1251
+ msgstr ""
1252
+
1253
+ #: includes/forms/settings-errors.php:46
1254
+ msgid "%sPreview your child theme%s before activating."
1255
+ msgstr ""
1256
+
1257
+ #: includes/forms/settings-errors.php:49 includes/forms/themepreview.php:18
1258
+ msgid "Live Preview"
1259
+ msgstr ""
1260
+
1261
  #: includes/forms/tabs.php:11
1262
+ msgid "Parent/ Child"
1263
  msgstr ""
1264
 
1265
  #: includes/forms/tabs.php:14
1266
+ msgid "Query/ Selector"
1267
  msgstr ""
1268
 
1269
  #: includes/forms/tabs.php:17
1270
+ msgid "Property/ Value"
1271
  msgstr ""
1272
 
1273
+ #: includes/forms/tabs.php:22
1274
  msgid "Web Fonts"
1275
  msgstr ""
1276
 
1277
+ #: includes/forms/tabs.php:26
1278
  msgid "Baseline Styles"
1279
  msgstr ""
1280
 
1281
+ #: includes/forms/tabs.php:29
1282
  msgid "Child Styles"
1283
  msgstr ""
1284
 
1285
+ #: includes/forms/tabs.php:33
1286
  msgid "Files"
1287
  msgstr ""
1288
 
1318
  "strong>"
1319
  msgstr ""
1320
 
1321
+ #: includes/forms/zipform.php:6
1322
+ msgid "Export Child Theme"
1323
  msgstr ""
1324
 
1325
  #. Plugin URI of the plugin/theme
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: lilaeamedia
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8QE5YJ8WE96AJ
4
  Tags: child, theme, child theme, child themes, custom styles, customize styles, customize theme, css, responsive, css editor, child theme editor, child theme generator, child theme creator, style, stylesheet, customizer, childtheme, childthemes
5
- Requires at least: 3.9
6
- Tested up to: 4.5.2
7
- Stable tag: 2.0.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -287,6 +287,21 @@ https://www.youtube.com/watch?v=iBiiAgsK4G4
287
  7. Files tab
288
 
289
  == Changelog ==
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
290
  = 2.0.5 =
291
  * Updated child theme preview class to use is_theme_active and other methods to eliminate conflicts with Jetpack and any other plugin that references the customize manager.
292
 
@@ -598,7 +613,7 @@ https://www.youtube.com/watch?v=iBiiAgsK4G4
598
  * Initial release.
599
 
600
  == Upgrade Notice ==
601
- 2.0 is a major version release and some updates to your child themes may be required. Please watch the videos to learn about the new features.
602
 
603
  == Query/Selector Tab ==
604
 
2
  Contributors: lilaeamedia
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8QE5YJ8WE96AJ
4
  Tags: child, theme, child theme, child themes, custom styles, customize styles, customize theme, css, responsive, css editor, child theme editor, child theme generator, child theme creator, style, stylesheet, customizer, childtheme, childthemes
5
+ Requires at least: 4.0
6
+ Tested up to: 4.6
7
+ Stable tag: 2.1.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
287
  7. Files tab
288
 
289
  == Changelog ==
290
+ = 2.1.0 =
291
+ * Loading dictionaries on demand
292
+ * Reversed key/value dictionary structure for huge memory improvement
293
+ * Added packer class to flatten multidim arrays for huge memory improvement
294
+ * Reduced key name lengths throughout
295
+ * Improved data validation on inputs
296
+ * Minimum Pro version
297
+ * Move html output to separate view includes
298
+ * Move theme mod routines to own functions
299
+
300
+ = 2.0.6 =
301
+ * Fix: preview not parsing parent styles correctly when minimized.
302
+ * Fix: cast argument to array in sort functions.
303
+ * Updated Child Theme Configurator language template.
304
+
305
  = 2.0.5 =
306
  * Updated child theme preview class to use is_theme_active and other methods to eliminate conflicts with Jetpack and any other plugin that references the customize manager.
307
 
613
  * Initial release.
614
 
615
  == Upgrade Notice ==
616
+ 2.1.0 Redesigned internal data structures to significantly decrease memory footprint.
617
 
618
  == Query/Selector Tab ==
619