Child Theme Configurator - Version 1.6.0

Version Description

  • New Feature: option to load parent stylesheet using wp_enqueue_style (link), @import or none. Thanks to cmwwebfx and Shapeshifter3 for pushing me on this
  • New Feature: automatically-generated child theme slug and name
  • New Feature: restore from backup and reset options
  • New Feature: backup files to "Child Theme Files" on Files Tab so they can be deleted
  • New Feature: Added new theme chooser select menu with screenshot, theme info and link to live preview.
  • Fix: Admin scripts now only load when CTC page is being viewed.
  • Fix: parent CSS preview to correctly display all parsed parent stylesheets in sequence
  • Fix: Refactored throughout for maintainability
Download this release

Release Info

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

Code changes from version 1.5.4 to 1.6.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.lilaeamedia.com/plugins/child-theme-configurator/
8
  Description: Create a Child Theme from any installed Theme. Each CSS selector, rule and value can then be searched, previewed and modified.
9
- Version: 1.5.4
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
@@ -15,29 +15,74 @@ if ( !defined('ABSPATH')) exit;
15
  Copyright (C) 2014 Lilaea Media
16
  */
17
 
18
- defined('LF') or define('LF', "\n");
19
- defined('CHLD_THM_CFG_OPTIONS') or define('CHLD_THM_CFG_OPTIONS', 'chld_thm_cfg_options');
20
- defined('CHLD_THM_CFG_VERSION') or define('CHLD_THM_CFG_VERSION', '1.5.4');
21
- defined('CHLD_THM_CFG_MAX_SELECTORS') or define('CHLD_THM_CFG_MAX_SELECTORS', '50000');
22
- defined('CHLD_THM_CFG_MAX_RECURSE_LOOPS') or define('CHLD_THM_CFG_MAX_RECURSE_LOOPS', '1000');
 
23
 
24
- if (is_admin()):
25
- include_once( 'includes/class-ctc.php' );
26
- global $chld_thm_cfg;
27
- $chld_thm_cfg = new Child_Theme_Configurator( __FILE__ );
28
- endif;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
 
30
- register_uninstall_hook( __FILE__ , 'child_theme_configurator_delete_plugin');
 
31
  function child_theme_configurator_delete_plugin() {
32
- delete_option(CHLD_THM_CFG_OPTIONS);
33
- delete_option(CHLD_THM_CFG_OPTIONS . '_configvars');
34
- delete_option(CHLD_THM_CFG_OPTIONS . '_dict_qs');
35
- delete_option(CHLD_THM_CFG_OPTIONS . '_dict_sel');
36
- delete_option(CHLD_THM_CFG_OPTIONS . '_dict_query');
37
- delete_option(CHLD_THM_CFG_OPTIONS . '_dict_rule');
38
- delete_option(CHLD_THM_CFG_OPTIONS . '_dict_val');
39
- delete_option(CHLD_THM_CFG_OPTIONS . '_dict_seq');
40
- delete_option(CHLD_THM_CFG_OPTIONS . '_sel_ndx');
41
- delete_option(CHLD_THM_CFG_OPTIONS . '_val_ndx');
42
  }
43
 
6
  Plugin Name: Child Theme Configurator
7
  Plugin URI: http://www.lilaeamedia.com/plugins/child-theme-configurator/
8
  Description: Create a Child Theme from any installed Theme. Each CSS selector, rule and value can then be searched, previewed and modified.
9
+ Version: 1.6.0
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
15
  Copyright (C) 2014 Lilaea Media
16
  */
17
 
18
+ defined( 'LF' ) or define( 'LF', "\n");
19
+ defined( 'CHLD_THM_CFG_OPTIONS' ) or define( 'CHLD_THM_CFG_OPTIONS', 'chld_thm_cfg_options' );
20
+ defined( 'CHLD_THM_CFG_VERSION' ) or define( 'CHLD_THM_CFG_VERSION', '1.6.0' );
21
+ defined( 'CHLD_THM_CFG_MAX_SELECTORS' ) or define( 'CHLD_THM_CFG_MAX_SELECTORS', '50000' );
22
+ defined( 'CHLD_THM_CFG_MAX_RECURSE_LOOPS' ) or define( 'CHLD_THM_CFG_MAX_RECURSE_LOOPS', '1000' );
23
+ defined( 'CHLD_THM_CFG_MENU' ) or define( 'CHLD_THM_CFG_MENU', 'chld_thm_cfg_menu' );
24
 
25
+ class ChildThemeConfigurator {
26
+ static function init() {
27
+ // setup admin hooks
28
+ $lang_dir = dirname(__FILE__) . '/lang';
29
+ load_plugin_textdomain('chld_thm_cfg', FALSE, $lang_dir, $lang_dir);
30
+ add_action( 'admin_menu', 'ChildThemeConfigurator::admin' );
31
+ add_action( 'wp_ajax_ctc_update', 'ChildThemeConfigurator::save' );
32
+ add_action( 'wp_ajax_ctc_query', 'ChildThemeConfigurator::query' );
33
+ }
34
+ static function ctc() {
35
+ // create admin object
36
+ global $chld_thm_cfg;
37
+ if ( !isset( $chld_thm_cfg ) ):
38
+ include_once( dirname(__FILE__) . '/includes/class-ctc.php' );
39
+ $chld_thm_cfg = new ChildThemeConfiguratorAdmin( __FILE__ );
40
+ endif;
41
+ return $chld_thm_cfg;
42
+ }
43
+ static function save() {
44
+ // ajax write
45
+ self::ctc()->ajax_save_postdata();
46
+ }
47
+ static function query() {
48
+ // ajax read
49
+ self::ctc()->ajax_query_css();
50
+ }
51
+ static function admin() {
52
+ // setup admin page
53
+ $hook = add_management_page(
54
+ __( 'Child Theme Configurator', 'chld_thm_cfg' ),
55
+ __( 'Child Themes', 'chld_thm_cfg' ),
56
+ 'edit_theme_options',
57
+ CHLD_THM_CFG_MENU,
58
+ 'ChildThemeConfigurator::render'
59
+ );
60
+ add_action('load-' . $hook, 'ChildThemeConfigurator::page_init');
61
+ }
62
+ static function page_init() {
63
+ // start admin controller
64
+ self::ctc()->ctc_page_init();
65
+ }
66
+ static function render() {
67
+ // display admin page
68
+ self::ctc()->render();
69
+ }
70
+ }
71
+
72
+ if ( is_admin() ) ChildThemeConfigurator::init();
73
 
74
+ register_uninstall_hook( __FILE__ , 'child_theme_configurator_delete_plugin' );
75
+
76
  function child_theme_configurator_delete_plugin() {
77
+ delete_option( CHLD_THM_CFG_OPTIONS );
78
+ delete_option( CHLD_THM_CFG_OPTIONS . '_configvars' );
79
+ delete_option( CHLD_THM_CFG_OPTIONS . '_dict_qs' );
80
+ delete_option( CHLD_THM_CFG_OPTIONS . '_dict_sel' );
81
+ delete_option( CHLD_THM_CFG_OPTIONS . '_dict_query' );
82
+ delete_option( CHLD_THM_CFG_OPTIONS . '_dict_rule' );
83
+ delete_option( CHLD_THM_CFG_OPTIONS . '_dict_val' );
84
+ delete_option( CHLD_THM_CFG_OPTIONS . '_dict_seq' );
85
+ delete_option( CHLD_THM_CFG_OPTIONS . '_sel_ndx' );
86
+ delete_option( CHLD_THM_CFG_OPTIONS . '_val_ndx' );
87
  }
88
 
css/chld-thm-cfg.css CHANGED
@@ -1,9 +1,9 @@
1
 
2
  a.nav-tab, a.nav-tab:focus, a.nav-tab:active {
3
  outline: none;
4
- -moz-box-shadow:none;
5
- -webkit-box-shadow:none;
6
- box-shadow:none;
7
  }
8
 
9
  .nav-tab-active {
@@ -74,7 +74,7 @@ a.nav-tab, a.nav-tab:focus, a.nav-tab:active {
74
  width: 25%;
75
  max-width: 250px;
76
  margin-right: 2.13%;
77
- word-wrap:break-word;
78
  }
79
 
80
  .ctc-input-cell-wide {
@@ -110,29 +110,72 @@ a.nav-tab, a.nav-tab:focus, a.nav-tab:active {
110
 
111
  .ctc-selector-handle {
112
  }
 
113
  .ctc-rewrite-toggle {
114
- font-size:0.8em;
115
- padding-left:1em;
116
- display:none;
117
- outline:none;
118
  }
 
119
  .ctc-selector-container {
120
  clear: both;
121
  background: #f9f9f9;
122
  border: 1px solid #ddd;
123
  padding: 10px;
124
- min-height: 300px;
125
- max-height: 500px;
126
  position: absolute;
 
127
  width: 80%;
128
- overflow: auto;
129
  left: 15%;
130
  top: 30px;
131
  display: none;
132
  z-index: 99999;
133
- -moz-box-shadow: 1px 2px 10px rgba(51,51,51,0.4);
134
- -webkit-box-shadow: 1px 2px 10px rgba(51,51,51,0.4);
135
- box-shadow: 1px 2px 10px rgba(51,51,51,0.4);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136
  }
137
 
138
  .ctc-query-heading {
@@ -151,6 +194,7 @@ a.nav-tab, a.nav-tab:focus, a.nav-tab:active {
151
  margin: 4px 0;
152
  padding: 4px 0;
153
  border-bottom: 1px solid #ddd;
 
154
  }
155
 
156
  .ctc-selector-value {
@@ -184,27 +228,23 @@ a.nav-tab, a.nav-tab:focus, a.nav-tab:active {
184
  .ctc-child-input-cell input[type="text"] {
185
  /*width:60px;*/
186
  }
 
187
  .ctc-select {
188
- max-width:100%;
189
  }
 
190
  .ctc-child-input-cell input[type="text"].ctc-input-wide {
191
  width: 200px;
192
  }
 
193
  #ctc_additional_css_label {
194
- cursor:pointer;
195
  }
 
196
  #ctc_additional_css_label span {
197
- white-space:nowrap;
198
- }
199
- #ctc_additional_css_label span:after {
200
- content: "\f140";
201
- font: 400 20px/1 dashicons;
202
- color:#999;
203
- vertical-align:bottom;
204
- }
205
- #ctc_additional_css_label.open span:after {
206
- content: "\f142";
207
  }
 
208
  .clearfix:after, .clearfix:before {
209
  content: ' ';
210
  display: table;
@@ -212,28 +252,181 @@ a.nav-tab, a.nav-tab:focus, a.nav-tab:active {
212
  padding: 0;
213
  }
214
 
215
- .clearfix:after {
216
  clear: both;
217
  }
218
 
219
  .ie7 .clearfix {
220
  zoom: 1;
221
  }
 
222
  .smaller {
223
  font-size: .85em;
224
  }
 
225
  .writable {
226
  color: red;
227
  }
 
228
  /* added in 1.5.4 because it is not being loaded by the admin */
229
  .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 {
230
  background-color: #DADADA;
231
  color: #212121;
232
  }
 
233
  .ui-menu .ui-menu-item {
234
  position: relative;
235
  margin: 0px;
236
  padding: 3px 1em 3px 0.4em;
237
  cursor: pointer;
238
  min-height: 0px;
239
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
 
2
  a.nav-tab, a.nav-tab:focus, a.nav-tab:active {
3
  outline: none;
4
+ -moz-box-shadow: none;
5
+ -webkit-box-shadow: none;
6
+ box-shadow: none;
7
  }
8
 
9
  .nav-tab-active {
74
  width: 25%;
75
  max-width: 250px;
76
  margin-right: 2.13%;
77
+ word-wrap: break-word;
78
  }
79
 
80
  .ctc-input-cell-wide {
110
 
111
  .ctc-selector-handle {
112
  }
113
+
114
  .ctc-rewrite-toggle {
115
+ font-size: 0.8em;
116
+ padding-left: 1em;
117
+ display: none;
118
+ outline: none;
119
  }
120
+
121
  .ctc-selector-container {
122
  clear: both;
123
  background: #f9f9f9;
124
  border: 1px solid #ddd;
125
  padding: 10px;
 
 
126
  position: absolute;
127
+ min-height: 300px;
128
  width: 80%;
 
129
  left: 15%;
130
  top: 30px;
131
  display: none;
132
  z-index: 99999;
133
+ -moz-box-shadow: 0 2px 10px rgba(0,0,0,0.3);
134
+ -webkit-box-shadow: 0 2px 10px rgba(0,0,0,0.3);
135
+ box-shadow: 0 2px 10px rgba(0,0,0,0.3);
136
+ }
137
+
138
+ .ctc-selector-inner-container {
139
+ position: relative;
140
+ max-height: 500px;
141
+ overflow: auto;
142
+ }
143
+
144
+ .ctc-status-icon.success {
145
+ display: block;
146
+ float: right;
147
+ position: relative;
148
+ height: 16px;
149
+ width: 16px;
150
+ margin: 4px;
151
+ }
152
+
153
+ .ctc-status-icon.failure {
154
+ display: block;
155
+ float: right;
156
+ position: relative;
157
+ height: 16px;
158
+ width: 16px;
159
+ margin: 4px;
160
+ }
161
+
162
+ .ctc-exit {
163
+ display: block;
164
+ width: 20px;
165
+ height: 20px;
166
+ position: absolute;
167
+ top: -13px;
168
+ right: -13px;
169
+ transition: none !important;
170
+ z-index: 999;
171
+ border: 3px solid #f9f9f9;
172
+ -moz-border-radius: 16px;
173
+ -webkit-border-radius: 16px;
174
+ border-radius: 16px;
175
+ }
176
+
177
+ .ctc-exit:hover, .ctc-exit:active {
178
+ background-position: right top;
179
  }
180
 
181
  .ctc-query-heading {
194
  margin: 4px 0;
195
  padding: 4px 0;
196
  border-bottom: 1px solid #ddd;
197
+ position: relative;
198
  }
199
 
200
  .ctc-selector-value {
228
  .ctc-child-input-cell input[type="text"] {
229
  /*width:60px;*/
230
  }
231
+
232
  .ctc-select {
233
+ max-width: 100%;
234
  }
235
+
236
  .ctc-child-input-cell input[type="text"].ctc-input-wide {
237
  width: 200px;
238
  }
239
+
240
  #ctc_additional_css_label {
241
+ cursor: pointer;
242
  }
243
+
244
  #ctc_additional_css_label span {
245
+ white-space: nowrap;
 
 
 
 
 
 
 
 
 
246
  }
247
+
248
  .clearfix:after, .clearfix:before {
249
  content: ' ';
250
  display: table;
252
  padding: 0;
253
  }
254
 
255
+ .clearfix:after, .clear {
256
  clear: both;
257
  }
258
 
259
  .ie7 .clearfix {
260
  zoom: 1;
261
  }
262
+
263
  .smaller {
264
  font-size: .85em;
265
  }
266
+
267
  .writable {
268
  color: red;
269
  }
270
+
271
  /* added in 1.5.4 because it is not being loaded by the admin */
272
  .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 {
273
  background-color: #DADADA;
274
  color: #212121;
275
  }
276
+
277
  .ui-menu .ui-menu-item {
278
  position: relative;
279
  margin: 0px;
280
  padding: 3px 1em 3px 0.4em;
281
  cursor: pointer;
282
  min-height: 0px;
283
+ }
284
+
285
+ /*** Added in 1.6.0 for new options ***/
286
+ .ctc-section-toggle {
287
+ /*margin:0;
288
+ padding:0;*/
289
+ position: relative;
290
+ }
291
+
292
+ .ctc-section-toggle:after {
293
+ content: "\f140";
294
+ font: 400 20px/1 dashicons;
295
+ color: #999;
296
+ vertical-align: bottom;
297
+ }
298
+
299
+ .ctc-section-toggle.open:after {
300
+ content: "\f142";
301
+ }
302
+
303
+ .ctc-section-toggle-content {
304
+ display: none;
305
+ position: relative;
306
+ }
307
+
308
+ /*** Added in 1.6.0 for new Theme chooser ***/
309
+ .ctc-theme-only {
310
+ margin: 0;
311
+ padding: 0;
312
+ position: relative;
313
+ }
314
+
315
+ h3.theme-name {
316
+ margin: .25em 0;
317
+ font-size: 1.2em;
318
+ }
319
+
320
+ .ctc-theme-option {
321
+ max-width: 250px;
322
+ }
323
+
324
+ .ctc-theme-option-left {
325
+ float: left;
326
+ width: 40%;
327
+ margin-right: 5%;
328
+ }
329
+
330
+ .ctc-theme-option-right {
331
+ float: right;
332
+ width: 55%;
333
+ margin-right: 0;
334
+ font-size: .9em;
335
+ line-height: 1.3;
336
+ }
337
+
338
+ .ctc-theme-option-image {
339
+ height: auto;
340
+ width: 100%;
341
+ border: 1px solid #ddd;
342
+ }
343
+
344
+ /* jquery UI widget classes */
345
+
346
+ .ui-widget-content {
347
+ border: 1px solid #aaa;
348
+ background-color: #fff;
349
+ }
350
+
351
+ .ui-widget-header {
352
+ border: 1px solid #aaa;
353
+ background-color: #ccc;
354
+ font-weight: bold;
355
+ }
356
+
357
+ .ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default {
358
+ border: 1px solid #d3d3d3;
359
+ font-weight: normal;
360
+ color: #555555;
361
+ }
362
+
363
+ .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 {
364
+ font-weight: normal;
365
+ color: #212121;
366
+ }
367
+
368
+ .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active {
369
+ font-weight: normal;
370
+ color: #212121;
371
+ }
372
+
373
+ /* jQuery UI selectmenu classes */
374
+
375
+ .ui-selectmenu-menu {
376
+ padding: 0;
377
+ margin: 0;
378
+ position: absolute;
379
+ top: 0;
380
+ left: 0;
381
+ display: none;
382
+ }
383
+
384
+ .ui-selectmenu-menu .ui-menu {
385
+ overflow: auto;
386
+ max-height: 372px;
387
+ margin-top: 0;
388
+ /* Support: IE7 */
389
+ overflow-x: hidden;/*padding-bottom: 1px;*/
390
+ }
391
+
392
+ .ui-selectmenu-menu .ui-menu .ui-menu-item {
393
+ padding: 6px;
394
+ }
395
+
396
+ .ui-selectmenu-open {
397
+ display: block;
398
+ }
399
+
400
+ .ui-selectmenu-button {
401
+ display: inline-block;
402
+ overflow: hidden;
403
+ position: relative;
404
+ text-decoration: none;
405
+ cursor: pointer;
406
+ min-width: 200px;
407
+ }
408
+
409
+ .ui-selectmenu-button span.ui-icon {
410
+ right: 0.5em;
411
+ left: auto;
412
+ margin-top: -10px;
413
+ position: absolute;
414
+ top: 50%;
415
+ }
416
+
417
+ .ui-icon-triangle-1-s:before {
418
+ display: inline-block;
419
+ -webkit-font-smoothing: antialiased;
420
+ font: normal 20px/1 'dashicons';
421
+ content: "\f140";
422
+ }
423
+
424
+ .ui-selectmenu-button span.ui-selectmenu-text {
425
+ text-align: left;
426
+ padding: 0.4em 2.1em 0.4em 1em;
427
+ display: block;
428
+ line-height: 1.4;
429
+ overflow: hidden;
430
+ text-overflow: ellipsis;
431
+ white-space: nowrap;
432
+ }
includes/class-ctc-css.php CHANGED
@@ -3,10 +3,10 @@
3
  if ( !defined('ABSPATH')) exit;
4
 
5
  /*
6
- Class: Child_Theme_Configurator_CSS
7
  Plugin URI: http://www.lilaeamedia.com/plugins/child-theme-configurator/
8
  Description: Handles all CSS output, parsing, normalization
9
- Version: 1.5.4
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
@@ -14,7 +14,7 @@ if ( !defined('ABSPATH')) exit;
14
  License: GPLv2
15
  Copyright (C) 2014 Lilaea Media
16
  */
17
- class Child_Theme_Configurator_CSS {
18
  // data dictionaries
19
  var $dict_query; // @media queries and 'base'
20
  var $dict_sel; // selectors
@@ -36,7 +36,8 @@ class Child_Theme_Configurator_CSS {
36
  var $styles; // temporary update cache
37
  var $child; // child theme slug
38
  var $parnt; // parent theme slug
39
- var $parntss; // parent additional stylesheets
 
40
  var $configtype; // theme or plugin extension
41
  var $child_name; // child theme name
42
  var $child_author; // stylesheet author
@@ -51,6 +52,12 @@ class Child_Theme_Configurator_CSS {
51
  );
52
  var $configvars = array(
53
  'parntss',
 
 
 
 
 
 
54
  'imports',
55
  'child_version',
56
  'child_author',
@@ -85,7 +92,7 @@ class Child_Theme_Configurator_CSS {
85
  $this->parnt = '';
86
  $this->configtype = 'theme';
87
  $this->child_name = '';
88
- $this->child_author = 'Child Theme Configurator by Lilaea Media';
89
  $this->child_version = '1.0';
90
  // multi-dim arrays
91
  $this->dict_qs = array();
@@ -100,11 +107,17 @@ class Child_Theme_Configurator_CSS {
100
  $this->imports = array('child' => array(), 'parnt' => array());
101
  }
102
 
103
- function read_config() {
104
  global $chld_thm_cfg;
 
 
 
 
 
105
  if ($configarray = get_option(CHLD_THM_CFG_OPTIONS . '_configvars')):
106
  foreach ($this->configvars as $configkey)
107
- $this->{$configkey} = $configarray[$configkey];
 
108
  foreach ($this->dicts as $configkey):
109
  if ($configarray = get_option(CHLD_THM_CFG_OPTIONS . '_' . $configkey))
110
  $this->{$configkey} = $configarray;
@@ -115,7 +128,7 @@ class Child_Theme_Configurator_CSS {
115
  }
116
 
117
  function save_config() {
118
- global $chld_thm_cfg;
119
  $configarray = array();
120
  foreach ($this->configvars as $configkey)
121
  $configarray[$configkey] = $this->{$configkey};
@@ -166,10 +179,16 @@ class Child_Theme_Configurator_CSS {
166
  if (empty($params['key']) || 'child' == $params['key']):
167
  $this->read_stylesheet('child');
168
  else:
169
- if (isset($this->parentss))
170
- foreach ($this->parntss as $template)
 
171
  $this->read_stylesheet('parnt', $template);
 
 
 
 
172
  $this->read_stylesheet('parnt');
 
173
  endif;
174
  $this->normalize_css();
175
  return $this->styles;
@@ -188,7 +207,7 @@ class Child_Theme_Configurator_CSS {
188
  }
189
 
190
  function normalize_css() {
191
- if (preg_match("/\}[\w\#\.]/", $this->styles)): // prettify compressed CSS
192
  $this->styles = preg_replace("/\*\/\s*/s", "*/\n", $this->styles); // end comment
193
  $this->styles = preg_replace("/\{\s*/s", " {\n ", $this->styles); // open brace
194
  $this->styles = preg_replace("/;\s*/s", ";\n ", $this->styles); // semicolon
@@ -205,8 +224,8 @@ class Child_Theme_Configurator_CSS {
205
  . 'Version: ' . $this->get_prop('version') . LF
206
  . 'Updated: ' . current_time('mysql') . LF
207
  . '*/' . LF . LF
208
- . '@charset "UTF-8";' . LF
209
- . '@import url(\'../' . $parnt . '/style.css\');' . LF;
210
  }
211
 
212
  function get_child_target($file = 'style.css') {
@@ -223,7 +242,7 @@ class Child_Theme_Configurator_CSS {
223
  * Update cache is returned to UI via AJAX to refresh page
224
  */
225
  function update_arrays($template, $query, $sel, $rule = null, $value = null, $important = 0, $seq = null) {
226
- global $chld_thm_cfg;
227
  // normalize selector styling
228
  $sel = implode(', ', preg_split('#\s*,\s*#s', trim($sel)));
229
  // add selector and query to index
@@ -237,8 +256,8 @@ class Child_Theme_Configurator_CSS {
237
  $this->dict_qs[$this->qskey]['q'] = $this->dict_query[$query];
238
  // tell the UI to update a single cached query/selector lookup by passing 'qsid' as the key
239
  // (normally the entire array is replaced):
240
- if ($chld_thm_cfg->cache_updates)
241
- $chld_thm_cfg->updates[] = array(
242
  'obj' => 'sel_ndx',
243
  'key' => 'qsid',
244
  'data' => array(
@@ -256,8 +275,8 @@ class Child_Theme_Configurator_CSS {
256
  if (!isset($this->dict_rule[$rule])):
257
  $this->dict_rule[$rule] = ++$this->rulekey;
258
  // tell the UI to update a single cached rule:
259
- if ($chld_thm_cfg->cache_updates):
260
- $chld_thm_cfg->updates[] = array(
261
  'obj' => 'rule',
262
  'key' => $this->rulekey,
263
  'data' => $rule,
@@ -273,18 +292,18 @@ class Child_Theme_Configurator_CSS {
273
  // set the important flag for this value
274
  $this->val_ndx[$qsid][$ruleid]['i_' . $template] = $important;
275
  // tell the UI to add a single cached query/selector data array:
276
- if ($chld_thm_cfg->cache_updates):
277
  $updatearr = array(
278
  'obj' => 'sel_val',
279
  'key' => $qsid,
280
  'data' => $this->denorm_sel_val($qsid),
281
  );
282
- $chld_thm_cfg->updates[] = $updatearr;
283
  endif;
284
  if (isset($seq)): // this is a renamed selector
285
  $this->dict_seq[$qsid] = $seq;
286
- if ($chld_thm_cfg->cache_updates):
287
- $chld_thm_cfg->updates[] = array(
288
  'obj' => 'rewrite',
289
  'key' => $qsid,
290
  'data' => $sel,
@@ -295,6 +314,12 @@ class Child_Theme_Configurator_CSS {
295
  }
296
 
297
  function read_stylesheet($template = 'child', $file = 'style.css') {
 
 
 
 
 
 
298
  $source = $this->get_prop($template);
299
  $configtype = $this->get_prop('configtype');
300
  if (empty($source) || !is_scalar($source)) return FALSE;
@@ -308,16 +333,16 @@ class Child_Theme_Configurator_CSS {
308
  endif;
309
  }
310
 
311
- function recurse_directory($rootdir, $ext = 'css', $all = FALSE) {
312
- if (!$this->is_file_ok($rootdir, 'search')) return array(); // make sure we are only recursing theme and plugin files
313
  $files = array();
314
  $dirs = array($rootdir);
315
  $loops = 0;
316
- if ('img' == $ext):
317
- global $chld_thm_cfg;
318
- $ext = '(' . implode('|', array_keys($chld_thm_cfg->imgmimes)) . ')';
319
  endif;
320
- while(count($dirs) && $loops < CHLD_THM_CFG_MAX_RECURSE_LOOPS):
321
  $loops++;
322
  $dir = array_shift($dirs);
323
  if ($handle = opendir($dir)):
@@ -479,8 +504,8 @@ class Child_Theme_Configurator_CSS {
479
  * reads stylesheet to get WordPress meta data and passes rest to parse_css
480
  */
481
  function parse_css_file($template, $file = 'style.css') {
482
- global $chld_thm_cfg;
483
- $chld_thm_cfg->cache_updates = FALSE;
484
  $this->styles = ''; // reset styles
485
  $this->read_stylesheet($template, $file);
486
  // get theme name
@@ -506,13 +531,13 @@ class Child_Theme_Configurator_CSS {
506
  $this->styles = preg_replace('#(\{\s*)#', "$1\n", $this->styles);
507
  // get all imports
508
  if ($parse_imports):
509
- global $chld_thm_cfg;
510
  $regex = '#(\@import.+?);#';
511
  preg_match_all($regex, $this->styles, $matches);
512
  foreach (preg_grep('#' . $this->get_prop('parnt') . '\/style\.css#', $matches[1], PREG_GREP_INVERT) as $import)
513
  $this->imports[$template][$import] = 1;
514
- if ($chld_thm_cfg->cache_updates):
515
- $chld_thm_cfg->updates[] = array(
516
  'obj' => 'imports',
517
  'data' => array_keys($this->imports[$template]),
518
  );
@@ -647,20 +672,20 @@ class Child_Theme_Configurator_CSS {
647
  endforeach;
648
  $stylesheet = apply_filters('chld_thm_cfg_target', $this->get_child_target(), $this);
649
  if ($stylesheet_verified = $this->is_file_ok($stylesheet, 'write')):
650
- global $chld_thm_cfg, $wp_filesystem; // this was initialized earlier;
651
  // backup current stylesheet
652
  if ($backup && is_file($stylesheet_verified)):
653
  $timestamp = date('YmdHis', current_time('timestamp'));
654
  $bakfile = preg_replace("/\.css$/", '', $stylesheet_verified) . '-' . $timestamp . '.css';
655
  // don't write new stylesheet if backup fails
656
- if (!$wp_filesystem->copy($chld_thm_cfg->fspath($stylesheet_verified), $chld_thm_cfg->fspath($bakfile))) return FALSE;
657
  endif;
658
  // write new stylesheet:
659
  // try direct write first, then wp_filesystem write
660
  // stylesheet must already exist and be writable by web server
661
  if (FALSE !== @file_put_contents($stylesheet_verified, $output)): //is_writable($stylesheet_verified) &&
662
  return TRUE;
663
- elseif (FALSE !== $wp_filesystem->put_contents($chld_thm_cfg->fspath($stylesheet_verified), $output)):
664
  return TRUE;
665
  endif;
666
  endif;
3
  if ( !defined('ABSPATH')) exit;
4
 
5
  /*
6
+ Class: ChildThemeConfiguratorCSS
7
  Plugin URI: http://www.lilaeamedia.com/plugins/child-theme-configurator/
8
  Description: Handles all CSS output, parsing, normalization
9
+ Version: 1.6.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 Lilaea Media
16
  */
17
+ class ChildThemeConfiguratorCSS {
18
  // data dictionaries
19
  var $dict_query; // @media queries and 'base'
20
  var $dict_sel; // selectors
36
  var $styles; // temporary update cache
37
  var $child; // child theme slug
38
  var $parnt; // parent theme slug
39
+ var $parntss; // parent additional stylesheets
40
+ var $enqueue; // load parent css method (enqueue, import, none)
41
  var $configtype; // theme or plugin extension
42
  var $child_name; // child theme name
43
  var $child_author; // stylesheet author
52
  );
53
  var $configvars = array(
54
  'parntss',
55
+ // the enqueue flag prevents the transition from 1.5.4
56
+ // from breaking the stylesheet by forcing the user to regenerate
57
+ // the config data before updating the stylesheet. Otherwise,
58
+ // removing the @import for the parent stylesheet will cause
59
+ // the parent core styles to be missing.
60
+ 'enqueue',
61
  'imports',
62
  'child_version',
63
  'child_author',
92
  $this->parnt = '';
93
  $this->configtype = 'theme';
94
  $this->child_name = '';
95
+ $this->child_author = 'Child Theme Configurator';
96
  $this->child_version = '1.0';
97
  // multi-dim arrays
98
  $this->dict_qs = array();
107
  $this->imports = array('child' => array(), 'parnt' => array());
108
  }
109
 
110
+ function ctc() {
111
  global $chld_thm_cfg;
112
+ return $chld_thm_cfg;
113
+ }
114
+
115
+ function read_config() {
116
+
117
  if ($configarray = get_option(CHLD_THM_CFG_OPTIONS . '_configvars')):
118
  foreach ($this->configvars as $configkey)
119
+ if (isset($configarray[$configkey]))
120
+ $this->{$configkey} = $configarray[$configkey];
121
  foreach ($this->dicts as $configkey):
122
  if ($configarray = get_option(CHLD_THM_CFG_OPTIONS . '_' . $configkey))
123
  $this->{$configkey} = $configarray;
128
  }
129
 
130
  function save_config() {
131
+
132
  $configarray = array();
133
  foreach ($this->configvars as $configkey)
134
  $configarray[$configkey] = $this->{$configkey};
179
  if (empty($params['key']) || 'child' == $params['key']):
180
  $this->read_stylesheet('child');
181
  else:
182
+ if (isset($this->parntss)):
183
+ foreach ($this->parntss as $template):
184
+ $this->styles .= '/*** BEGIN ' . $template . ' ***/' . LF;
185
  $this->read_stylesheet('parnt', $template);
186
+ $this->styles .= '/*** END ' . $template . ' ***/' . LF;
187
+ endforeach;
188
+ endif;
189
+ $this->styles .= '/*** BEGIN style.css ***/' . LF;
190
  $this->read_stylesheet('parnt');
191
+ $this->styles .= '/*** END style.css ***/' . LF;
192
  endif;
193
  $this->normalize_css();
194
  return $this->styles;
207
  }
208
 
209
  function normalize_css() {
210
+ if (preg_match("/(\}[\w\#\.]|; *\})/", $this->styles)): // prettify compressed CSS
211
  $this->styles = preg_replace("/\*\/\s*/s", "*/\n", $this->styles); // end comment
212
  $this->styles = preg_replace("/\{\s*/s", " {\n ", $this->styles); // open brace
213
  $this->styles = preg_replace("/;\s*/s", ";\n ", $this->styles); // semicolon
224
  . 'Version: ' . $this->get_prop('version') . LF
225
  . 'Updated: ' . current_time('mysql') . LF
226
  . '*/' . LF . LF
227
+ . '@charset "UTF-8";' . LF . LF
228
+ . ('import' == $this->enqueue ? '@import url(\'../' . $parnt . '/style.css\');' . LF : '');
229
  }
230
 
231
  function get_child_target($file = 'style.css') {
242
  * Update cache is returned to UI via AJAX to refresh page
243
  */
244
  function update_arrays($template, $query, $sel, $rule = null, $value = null, $important = 0, $seq = null) {
245
+
246
  // normalize selector styling
247
  $sel = implode(', ', preg_split('#\s*,\s*#s', trim($sel)));
248
  // add selector and query to index
256
  $this->dict_qs[$this->qskey]['q'] = $this->dict_query[$query];
257
  // tell the UI to update a single cached query/selector lookup by passing 'qsid' as the key
258
  // (normally the entire array is replaced):
259
+ if ($this->ctc()->cache_updates)
260
+ $this->ctc()->updates[] = array(
261
  'obj' => 'sel_ndx',
262
  'key' => 'qsid',
263
  'data' => array(
275
  if (!isset($this->dict_rule[$rule])):
276
  $this->dict_rule[$rule] = ++$this->rulekey;
277
  // tell the UI to update a single cached rule:
278
+ if ($this->ctc()->cache_updates):
279
+ $this->ctc()->updates[] = array(
280
  'obj' => 'rule',
281
  'key' => $this->rulekey,
282
  'data' => $rule,
292
  // set the important flag for this value
293
  $this->val_ndx[$qsid][$ruleid]['i_' . $template] = $important;
294
  // tell the UI to add a single cached query/selector data array:
295
+ if ($this->ctc()->cache_updates):
296
  $updatearr = array(
297
  'obj' => 'sel_val',
298
  'key' => $qsid,
299
  'data' => $this->denorm_sel_val($qsid),
300
  );
301
+ $this->ctc()->updates[] = $updatearr;
302
  endif;
303
  if (isset($seq)): // this is a renamed selector
304
  $this->dict_seq[$qsid] = $seq;
305
+ if ($this->ctc()->cache_updates):
306
+ $this->ctc()->updates[] = array(
307
  'obj' => 'rewrite',
308
  'key' => $qsid,
309
  'data' => $sel,
314
  }
315
 
316
  function read_stylesheet($template = 'child', $file = 'style.css') {
317
+
318
+ // these conditions support revert/restore option in 1.6.0+
319
+ if ('all' == $file) return;
320
+ elseif ('' == $file) $file = 'style.css';
321
+ // end revert/restore conditions
322
+
323
  $source = $this->get_prop($template);
324
  $configtype = $this->get_prop('configtype');
325
  if (empty($source) || !is_scalar($source)) return FALSE;
333
  endif;
334
  }
335
 
336
+ function recurse_directory( $rootdir, $ext = 'css', $all = FALSE ) {
337
+ if ( !$this->is_file_ok( $rootdir, 'search' ) ) return array(); // make sure we are only recursing theme and plugin files
338
  $files = array();
339
  $dirs = array($rootdir);
340
  $loops = 0;
341
+ if ( 'img' == $ext ):
342
+
343
+ $ext = '(' . implode('|', array_keys($this->ctc()->imgmimes)) . ')';
344
  endif;
345
+ while(count($dirs) && $loops < CHLD_THM_CFG_MAX_RECURSE_LOOPS ):
346
  $loops++;
347
  $dir = array_shift($dirs);
348
  if ($handle = opendir($dir)):
504
  * reads stylesheet to get WordPress meta data and passes rest to parse_css
505
  */
506
  function parse_css_file($template, $file = 'style.css') {
507
+
508
+ $this->ctc()->cache_updates = FALSE;
509
  $this->styles = ''; // reset styles
510
  $this->read_stylesheet($template, $file);
511
  // get theme name
531
  $this->styles = preg_replace('#(\{\s*)#', "$1\n", $this->styles);
532
  // get all imports
533
  if ($parse_imports):
534
+
535
  $regex = '#(\@import.+?);#';
536
  preg_match_all($regex, $this->styles, $matches);
537
  foreach (preg_grep('#' . $this->get_prop('parnt') . '\/style\.css#', $matches[1], PREG_GREP_INVERT) as $import)
538
  $this->imports[$template][$import] = 1;
539
+ if ($this->ctc()->cache_updates):
540
+ $this->ctc()->updates[] = array(
541
  'obj' => 'imports',
542
  'data' => array_keys($this->imports[$template]),
543
  );
672
  endforeach;
673
  $stylesheet = apply_filters('chld_thm_cfg_target', $this->get_child_target(), $this);
674
  if ($stylesheet_verified = $this->is_file_ok($stylesheet, 'write')):
675
+ global $wp_filesystem; // this was initialized earlier;
676
  // backup current stylesheet
677
  if ($backup && is_file($stylesheet_verified)):
678
  $timestamp = date('YmdHis', current_time('timestamp'));
679
  $bakfile = preg_replace("/\.css$/", '', $stylesheet_verified) . '-' . $timestamp . '.css';
680
  // don't write new stylesheet if backup fails
681
+ if (!$wp_filesystem->copy($this->ctc()->fspath($stylesheet_verified), $this->ctc()->fspath($bakfile))) return FALSE;
682
  endif;
683
  // write new stylesheet:
684
  // try direct write first, then wp_filesystem write
685
  // stylesheet must already exist and be writable by web server
686
  if (FALSE !== @file_put_contents($stylesheet_verified, $output)): //is_writable($stylesheet_verified) &&
687
  return TRUE;
688
+ elseif (FALSE !== $wp_filesystem->put_contents($this->ctc()->fspath($stylesheet_verified), $output)):
689
  return TRUE;
690
  endif;
691
  endif;
includes/class-ctc-ui.php CHANGED
@@ -5,7 +5,7 @@ if ( !defined('ABSPATH')) exit;
5
  Class: Child_Theme_Configurator_UI
6
  Plugin URI: http://www.lilaeamedia.com/plugins/child-theme-configurator/
7
  Description: Handles the plugin User Interface
8
- Version: 1.5.4
9
  Author: Lilaea Media
10
  Author URI: http://www.lilaeamedia.com/
11
  Text Domain: chld_thm_cfg
@@ -13,613 +13,110 @@ if ( !defined('ABSPATH')) exit;
13
  License: GPLv2
14
  Copyright (C) 2014 Lilaea Media
15
  */
16
- class Child_Theme_Configurator_UI {
17
- var $swatch_text;
18
- var $themes;
19
- var $extLink;
20
 
21
- function __construct() {
22
- $this->swatch_text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
23
- add_action( 'admin_enqueue_scripts', array($this, 'load_imports') );
24
- }
25
-
26
- function render_options() {
27
  global $chld_thm_cfg;
28
- $css = $chld_thm_cfg->css;
29
- $themes = $chld_thm_cfg->themes;
 
 
 
 
30
  $parent = isset($_GET['ctc_parent']) ? sanitize_text_field($_GET['ctc_parent']) : $css->get_prop('parnt');
31
  $child = $css->get_prop('child');
32
- $configtype = $css->get_prop('configtype');
33
  $hidechild = (count($themes['child']) ? '' : 'style="display:none"');
 
34
  $imports = $css->get_prop('imports');
35
  $id = 0;
36
- $chld_thm_cfg->fs_method = get_filesystem_method();
37
- add_thickbox(); ?>
38
-
39
- <div class="wrap">
40
- <a href="http://www.lilaeamedia.com/plugins/child-theme-plugin-styles/" target="_blank" title="<?php _e('Get CTC for Plugins and other tools', 'chld_thm_cfg'); ?>" style="float:right"><img src="<?php echo $chld_thm_cfg->pluginURL; ?>/css/lilaea-logo.png" height="36" width="145" alt="<?php _e('Lilaea Media - Responsive Tools for a Mobile World', 'chld_thm_cfg'); ?>" /></a>
41
- <h2><?php echo $chld_thm_cfg->pluginName; ?> v.<?php echo CHLD_THM_CFG_VERSION;?></h2>
42
- <?php if ('POST' == $_SERVER['REQUEST_METHOD'] && !$chld_thm_cfg->fs):
43
- echo $chld_thm_cfg->fs_prompt;
44
- else: ?>
45
- <div id="ctc_error_notice">
46
- <?php $this->settings_errors(); ?>
47
- </div>
48
- <?php
49
- $active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : 'parent_child_options';
50
- ?>
51
- <h2 class="nav-tab-wrapper"><a id="parent_child_options" href="?page=<?php echo $chld_thm_cfg->menuName; ?>&amp;tab=parent_child_options"
52
- class="nav-tab<?php echo 'parent_child_options' == $active_tab ? ' nav-tab-active' : ''; ?>">
53
- <?php _e('Parent/Child', 'chld_thm_cfg'); ?>
54
- </a><!----><a id="query_selector_options" href="?page=<?php echo $chld_thm_cfg->menuName; ?>&amp;tab=query_selector_options"
55
- class="nav-tab<?php echo 'query_selector_options' == $active_tab ? ' nav-tab-active' : ''; ?>" <?php echo $hidechild; ?>>
56
- <?php _e('Query/Selector', 'chld_thm_cfg'); ?>
57
- </a><!----><a id="rule_value_options" href="?page=<?php echo $chld_thm_cfg->menuName; ?>&amp;tab=rule_value_options"
58
- class="nav-tab<?php echo 'rule_value_options' == $active_tab ? ' nav-tab-active' : ''; ?>" <?php echo $hidechild; ?>>
59
- <?php _e('Rule/Value', 'chld_thm_cfg'); ?>
60
- </a><!----><a id="import_options" href="?page=<?php echo $chld_thm_cfg->menuName; ?>&amp;tab=import_options"
61
- class="nav-tab<?php echo 'import_options' == $active_tab ? ' nav-tab-active' : ''; ?>" <?php echo $hidechild; ?>>
62
- <?php _e('@import', 'chld_thm_cfg'); ?>
63
- </a><!----><a id="view_child_options" href="?page=<?php echo $chld_thm_cfg->menuName; ?>&amp;tab=view_child_options"
64
- class="nav-tab<?php echo 'view_child_options' == $active_tab ? ' nav-tab-active' : ''; ?>" <?php echo $hidechild; ?>>
65
- <?php _e('Child CSS', 'chld_thm_cfg'); ?>
66
- </a><!----><a id="view_parnt_options" href="?page=<?php echo $chld_thm_cfg->menuName; ?>&amp;tab=view_parnt_options"
67
- class="nav-tab<?php echo 'view_parnt_options' == $active_tab ? ' nav-tab-active' : ''; ?>" <?php echo $hidechild; ?>>
68
- <?php _e('Parent CSS', 'chld_thm_cfg'); ?>
69
- </a>
70
- <?php
71
- if ('' == $hidechild): // && (empty($configtype) || 'theme' == $configtype)):
72
- ?>
73
- <a id="file_options" href="?page=<?php echo $chld_thm_cfg->menuName; ?>&amp;tab=file_options"
74
- class="nav-tab<?php echo 'file_options' == $active_tab ? ' nav-tab-active' : ''; ?>" <?php echo $hidechild; ?>>
75
- <?php _e('Files', 'chld_thm_cfg'); ?>
76
- </a>
77
- <?php
78
- endif;
79
-
80
- do_action('chld_thm_cfg_tabs', $chld_thm_cfg, $active_tab, $hidechild);?>
81
- <i id="ctc_status_preview"></i></h2>
82
- <div class="ctc-option-panel-container">
83
- <div id="parent_child_options_panel" class="ctc-option-panel<?php echo 'parent_child_options' == $active_tab ? ' ctc-option-panel-active' : ''; ?>">
84
- <form id="ctc_load_form" method="post" action="?page=<?php echo $chld_thm_cfg->menuName; ?>">
85
- <?php wp_nonce_field( 'ctc_update' ); ?>
86
- <div class="ctc-input-row clearfix" id="input_row_parnt">
87
- <div class="ctc-input-cell"> <strong>
88
- <?php _e('Parent Theme', 'chld_thm_cfg'); ?>
89
- </strong> </div>
90
- <div class="ctc-input-cell">
91
- <select class="ctc-select" id="ctc_theme_parnt" name="ctc_theme_parnt">
92
- <?php echo $chld_thm_cfg->render_menu('parnt', $parent); ?>
93
- </select>
94
- </div>
95
- </div>
96
- <div class="ctc-input-row clearfix" id="input_row_child">
97
- <div class="ctc-input-cell"> <strong>
98
- <?php _e('Child Theme', 'chld_thm_cfg'); ?>
99
- </strong> </div>
100
- <div class="ctc-input-cell">
101
- <input class="ctc-radio" id="ctc_child_type_new" name="ctc_child_type" type="radio" value="new"
102
- <?php echo (!empty($hidechild) ? 'checked' : ''); ?>
103
- <?php echo $hidechild;?> />
104
- <label for="ctc_child_type_new">
105
- <?php _e('Create New Child Theme', 'chld_thm_cfg'); ?>
106
- </label>
107
- </div>
108
- <div class="ctc-input-cell">
109
- <input class="ctc-radio" id="ctc_child_type_existing" name="ctc_child_type" type="radio" value="existing"
110
- <?php echo (empty($hidechild) ? 'checked' : ''); ?>
111
- <?php echo $hidechild; ?>/>
112
- &nbsp;
113
- <label for="ctc_child_type_existing" <?php echo $hidechild;?>>
114
- <?php _e('Use Existing Child Theme', 'chld_thm_cfg'); ?>
115
- </label>
116
- </div>
117
- <div class="ctc-input-cell" style="clear:both"> <strong>&nbsp;</strong> </div>
118
- <div class="ctc-input-cell" >
119
- <input class="ctc_text" id="ctc_child_template" name="ctc_child_template" type="text" placeholder="<?php _e('Theme Slug', 'chld_thm_cfg'); ?>" autocomplete="off"/>
120
- </div>
121
- <div class="ctc-input-cell">
122
- <select class="ctc-select" id="ctc_theme_child" name="ctc_theme_child" <?php echo $hidechild; ?>>
123
- <?php echo $chld_thm_cfg->render_menu('child', $child); ?>
124
- </select>
125
- </div>
126
- </div>
127
- <div class="ctc-input-row clearfix" id="input_row_child_name">
128
- <div class="ctc-input-cell"> <strong>
129
- <?php _e('Child Theme Name', 'chld_thm_cfg'); ?>
130
- </strong> </div>
131
- <div class="ctc-input-cell">
132
- <input class="ctc_text" id="ctc_child_name" name="ctc_child_name" type="text"
133
- value="<?php echo esc_attr($css->get_prop('child_name')); ?>" placeholder="<?php _e('Theme Name', 'chld_thm_cfg'); ?>" autocomplete="off" />
134
- </div>
135
- </div>
136
- <?php if ('' == $hidechild) do_action('chld_thm_cfg_controls', $chld_thm_cfg); ?>
137
- <div class="ctc-input-row clearfix" id="input_row_child_template">
138
- <div class="ctc-input-cell"> <strong>
139
- <?php _e('Author', 'chld_thm_cfg'); ?>
140
- </strong> </div>
141
- <div class="ctc-input-cell">
142
- <input class="ctc_text" id="ctc_child_author" name="ctc_child_author" type="text"
143
- value="<?php echo esc_attr($css->get_prop('author')); ?>" placeholder="<?php _e('Author', 'chld_thm_cfg'); ?>" autocomplete="off" />
144
- </div>
145
- </div>
146
- <div class="ctc-input-row clearfix" id="input_row_child_template">
147
- <div class="ctc-input-cell"> <strong>
148
- <?php _e('Version', 'chld_thm_cfg'); ?>
149
- </strong> </div>
150
- <div class="ctc-input-cell">
151
- <input class="ctc_text" id="ctc_child_version" name="ctc_child_version" type="text"
152
- value="<?php echo esc_attr($css->get_prop('version')); ?>" placeholder="<?php _e('Version', 'chld_thm_cfg'); ?>" autocomplete="off" />
153
- </div>
154
- </div>
155
- <div class="ctc-input-row clearfix" id="input_row_child_template">
156
- <div class="ctc-input-cell"> <strong>
157
- <?php _e('Copy Parent Theme Menus, Widgets and other Options', 'chld_thm_cfg'); ?>
158
- </strong>
159
- <p><?php _e('NOTE: This will overwrite existing child theme options.', 'chld_thm_cfg'); ?></p>
160
- </div>
161
- <div class="ctc-input-cell">
162
- <input class="ctc_checkbox" id="ctc_parent_mods" name="ctc_parent_mods" type="checkbox"
163
- value="1" />
164
- </div>
165
- </div>
166
- <div class="ctc-input-row clearfix" id="input_row_child_template">
167
- <div class="ctc-input-cell"> <strong>
168
- <?php _e('Backup Child Stylesheet', 'chld_thm_cfg'); ?>
169
- </strong> </div>
170
- <div class="ctc-input-cell">
171
- <input class="ctc_checkbox" id="ctc_backup" name="ctc_backup" type="checkbox"
172
- value="1" />
173
- </div>
174
- </div>
175
- <?php if (empty($configtype) || 'theme' == $configtype):
176
- $stylesheets = $chld_thm_cfg->get_additional_css($parent);
177
- if (count($stylesheets)):?>
178
- <div class="ctc-input-row clearfix" id="input_row_child_template">
179
- <div class="ctc-input-cell" id="ctc_additional_css_label"> <strong> <span><?php _e('Parse additional stylesheets:', 'chld_thm_cfg'); ?></span> </strong>
180
- <p><?php _e('(click to toggle)', 'chld_thm_cfg'); ?></p>
181
- </div>
182
- <div class="ctc-input-cell-wide" id="ctc_additional_css_files" style="display:none">
183
- <p style="margin-top:0">
184
- <?php _e('Select only the stylesheets you wish to customize to reduce overhead.', 'chld_thm_cfg'); ?>
185
- </p>
186
- <?php
187
- foreach ($stylesheets as $stylesheet): ?>
188
- <div class="ctc-input-cell">
189
- <label>
190
- <input class="ctc_checkbox" name="ctc_additional_css[]" type="checkbox"
191
- value="<?php echo $stylesheet; ?>" /><?php echo $stylesheet; ?></label>
192
- </div>
193
- <?php endforeach; ?>
194
- </div>
195
- </div>
196
- <?php endif; endif; ?>
197
- <div class="ctc-input-row clearfix" id="input_row_child_template">
198
- <div class="ctc-input-cell"> <strong>&nbsp;</strong> </div>
199
- <div class="ctc-input-cell">
200
- <input class="ctc_submit button button-primary" id="ctc_load_styles" name="ctc_load_styles" type="submit"
201
- value="<?php _e('Generate Child Theme Files', 'chld_thm_cfg'); ?>" disabled />
202
- </div>
203
- </div>
204
- </form>
205
- </div>
206
- <div id="rule_value_options_panel"
207
- class="ctc-option-panel<?php echo 'rule_value_options' == $active_tab ? ' ctc-option-panel-active' : ''; ?>" <?php echo $hidechild; ?>>
208
- <form id="ctc_rule_value_form" method="post" action="?page=<?php echo $chld_thm_cfg->menuName; ?>&amp;tab=rule_value_options">
209
- <?php wp_nonce_field( 'ctc_update' ); ?>
210
- <div class="ctc-input-row clearfix" id="ctc_input_row_rule_menu">
211
- <div class="ctc-input-cell"> <strong>
212
- <?php _e('Rule', 'chld_thm_cfg'); ?>
213
- </strong> </div>
214
- <div class="ctc-input-cell" id="ctc_rule_menu_selected">&nbsp;</div>
215
- <div id="ctc_status_rule_val"></div>
216
- <div class="ctc-input-cell">
217
- <div class="ui-widget">
218
- <input id="ctc_rule_menu"/>
219
- <div id="ctc_status_rule"></div>
220
- </div>
221
- </div>
222
- </div>
223
- <div class="ctc-input-row clearfix" id="ctc_input_row_rule_header" style="display:none">
224
- <div class="ctc-input-cell"> <strong>
225
- <?php _e('Value', 'chld_thm_cfg'); ?>
226
- </strong> </div>
227
- <div class="ctc-input-cell"> <strong>
228
- <?php _e('Sample', 'chld_thm_cfg'); ?>
229
- </strong> </div>
230
- <div class="ctc-input-cell"> <strong>
231
- <?php _e('Selectors', 'chld_thm_cfg'); ?>
232
- </strong> </div>
233
- </div>
234
- <div class="ctc-rule-value-input-container clearfix" id="ctc_rule_value_inputs" style="display:none"> </div>
235
- </form>
236
- </div>
237
- <div id="query_selector_options_panel"
238
- class="ctc-option-panel<?php echo 'query_selector_options' == $active_tab ? ' ctc-option-panel-active' : ''; ?>" <?php echo $hidechild; ?>>
239
- <form id="ctc_query_selector_form" method="post" action="?page=<?php echo $chld_thm_cfg->menuName; ?>&amp;tab=query_selector_options">
240
- <div class="ctc-input-row clearfix" id="input_row_query">
241
- <div class="ctc-input-cell"> <strong>
242
- <?php _e('Query', 'chld_thm_cfg'); ?>
243
- </strong> </div>
244
- <div class="ctc-input-cell" id="ctc_sel_ovrd_query_selected">&nbsp;</div>
245
- <div class="ctc-input-cell">
246
- <div class="ui-widget">
247
- <input id="ctc_sel_ovrd_query" />
248
- </div>
249
- </div>
250
- </div>
251
- <div class="ctc-input-row clearfix" id="input_row_selector">
252
- <div class="ctc-input-cell"> <strong>
253
- <?php _e('Selector', 'chld_thm_cfg'); ?>
254
- </strong> <a href="#" class="ctc-rewrite-toggle"></a></div>
255
- <div class="ctc-input-cell" id="ctc_sel_ovrd_selector_selected">&nbsp;</div>
256
- <div class="ctc-input-cell">
257
- <div class="ui-widget">
258
- <input id="ctc_sel_ovrd_selector" />
259
- <div id="ctc_status_sel_ndx"></div>
260
- </div>
261
- </div>
262
- </div>
263
- <div class="ctc-selector-row clearfix" id="ctc_sel_ovrd_rule_inputs_container" style="display:none">
264
- <div class="ctc-input-row clearfix">
265
- <div class="ctc-input-cell"><strong>
266
- <?php _e('Sample', 'chld_thm_cfg'); ?>
267
- </strong></div>
268
- <div class="ctc-input-cell clearfix" style="max-height:150px;overflow:hidden">
269
- <div class="ctc-swatch" id="ctc_child_all_0_swatch"><?php echo $this->swatch_text; ?></div>
270
- </div>
271
- <div id="ctc_status_sel_val"></div>
272
- <div class="ctc-input-cell ctc-button-cell" id="ctc_save_query_selector_cell">
273
- <input type="button" class="button button-primary ctc-save-input" id="ctc_save_query_selector"
274
- name="ctc_save_query_selector" value="<?php _e('Save', 'chld_thm_cfg'); ?>" disabled />
275
- <input type="hidden" id="ctc_sel_ovrd_qsid"
276
- name="ctc_sel_ovrd_qsid" value="" />
277
- </div>
278
- </div>
279
- <div class="ctc-input-row clearfix" id="ctc_sel_ovrd_rule_header" style="display:none">
280
- <div class="ctc-input-cell"> <strong>
281
- <?php _e('Rule', 'chld_thm_cfg'); ?>
282
- </strong> </div>
283
- <div class="ctc-input-cell"> <strong>
284
- <?php _e('Parent Value', 'chld_thm_cfg'); ?>
285
- </strong> </div>
286
- <div class="ctc-input-cell"> <strong>
287
- <?php _e('Child Value', 'chld_thm_cfg'); ?>
288
- </strong> </div>
289
- </div>
290
- <div id="ctc_sel_ovrd_rule_inputs" style="display:none"> </div>
291
- <div class="ctc-input-row clearfix" id="ctc_sel_ovrd_new_rule" style="display:none">
292
- <div class="ctc-input-cell"> <strong>
293
- <?php _e('New Rule', 'chld_thm_cfg'); ?>
294
- </strong> </div>
295
- <div class="ctc-input-cell">
296
- <div class="ui-widget">
297
- <input id="ctc_new_rule_menu" />
298
- </div>
299
- </div>
300
- </div>
301
- <div class="ctc-input-row clearfix" id="input_row_selector">
302
- <div class="ctc-input-cell"> <strong>
303
- <?php _e('Order', 'chld_thm_cfg'); ?>
304
- </strong> </div>
305
- <div class="ctc-input-cell" id="ctc_child_load_order_container">&nbsp;</div>
306
- </div>
307
- </div>
308
- <div class="ctc-selector-row clearfix" id="ctc_new_selector_row">
309
- <div class="ctc-input-cell"> <strong>
310
- <?php _e('Raw CSS', 'chld_thm_cfg'); ?>
311
- </strong>
312
- <div class="ctc-textarea-button-cell" id="ctc_save_query_selector_cell">
313
- <input type="button" class="button ctc-save-input" id="ctc_save_new_selectors"
314
- name="ctc_save_new_selectors" value="<?php _e('Save', 'chld_thm_cfg'); ?>" disabled />
315
- </div>
316
- </div>
317
- <div class="ctc-input-cell-wide">
318
- <textarea id="ctc_new_selectors" name="ctc_new_selectors" wrap="off"></textarea>
319
- </div>
320
- </div>
321
- </form>
322
- </div>
323
- <div id="import_options_panel"
324
- class="ctc-option-panel<?php echo 'import_options' == $active_tab ? ' ctc-option-panel-active' : ''; ?>" <?php echo $hidechild; ?>>
325
- <form id="ctc_import_form" method="post" action="?page=<?php echo $chld_thm_cfg->menuName; ?>&amp;tab=import_options">
326
- <?php wp_nonce_field( 'ctc_update' ); ?>
327
- <div class="ctc-input-row clearfix" id="ctc_child_imports_row">
328
- <div class="ctc-input-cell"> <strong>
329
- <?php _e('@import Statements', 'chld_thm_cfg'); ?>
330
- </strong>
331
- <div class="ctc-textarea-button-cell" id="ctc_save_imports_cell">
332
- <input type="button" class="button ctc-save-input" id="ctc_save_imports"
333
- name="ctc_save_imports" value="<?php _e('Save', 'chld_thm_cfg'); ?>" disabled />
334
- </div>
335
- </div>
336
- <div class="ctc-input-cell-wide">
337
- <textarea id="ctc_child_imports" name="ctc_child_imports" wrap="off">
338
- <?php if (!empty($imports)):
339
- foreach ($imports as $import):
340
- echo esc_textarea($import . ';' . LF);
341
- endforeach; endif;?>
342
- </textarea>
343
- </div>
344
- </div>
345
- </form>
346
- </div>
347
- <div id="view_child_options_panel"
348
- class="ctc-option-panel<?php echo 'view_child_options' == $active_tab ? ' ctc-option-panel-active' : ''; ?>" <?php echo $hidechild; ?>> </div>
349
- <div id="view_parnt_options_panel"
350
- class="ctc-option-panel<?php echo 'view_parnt_options' == $active_tab ? ' ctc-option-panel-active' : ''; ?>" <?php echo $hidechild; ?>> </div>
351
- <?php if ('' == $hidechild): // && (empty($configtype) || 'theme' == $configtype)): ?>
352
- <div id="file_options_panel"
353
- class="ctc-option-panel<?php echo 'file_options' == $active_tab ? ' ctc-option-panel-active' : ''; ?>" <?php echo $hidechild; ?>>
354
- <?php $this->render_file_form('parnt'); ?>
355
- <?php $this->render_file_form('child'); ?>
356
- <?php $this->render_image_form(); ?>
357
- <div class="ctc-input-row clearfix" id="input_row_theme_image">
358
- <form id="ctc_theme_image_form" method="post" action="?page=<?php echo $chld_thm_cfg->menuName; ?>&amp;tab=file_options" enctype="multipart/form-data">
359
- <?php wp_nonce_field( 'ctc_update' ); ?>
360
- <div class="ctc-input-cell"> <strong>
361
- <?php _e('Upload New Child Theme Image', 'chld_thm_cfg'); ?>
362
- </strong>
363
- <p class="howto">
364
- <?php _e('Theme images reside under the <code>images</code> directory in your child theme and are meant for stylesheet use only. Use the Media Library for content images.', 'chld_thm_cfg'); ?>
365
- </p>
366
- </div>
367
- <div class="ctc-input-cell-wide">
368
- <input type="file" id="ctc_theme_image" name="ctc_theme_image" value="" />
369
- <input class="ctc_submit button button-primary" id="ctc_theme_image_submit"
370
- name="ctc_theme_image_submit" type="submit"
371
- value="<?php _e('Upload', 'chld_thm_cfg'); ?>" />
372
- </div>
373
- </form>
374
- </div>
375
- <?php if ($screenshot = $this->get_theme_screenshot()): ?>
376
- <div class="ctc-input-row clearfix" id="input_row_screenshot_view">
377
- <div class="ctc-input-cell"> <strong>
378
- <?php _e('Child Theme Screenshot', 'chld_thm_cfg'); ?>
379
- </strong> </div>
380
- <div class="ctc-input-cell-wide"> <a href="<?php echo $screenshot; ?>" class="thickbox"><img src="<?php echo $screenshot; ?>" height="150" width="200" style="max-height:150px;max-width:200px;width:auto;height:auto" /></a> </div>
381
- </div>
382
- <?php endif; ?>
383
- <div class="ctc-input-row clearfix" id="input_row_screenshot">
384
- <form id="ctc_screenshot_form" method="post" action="?page=<?php echo $chld_thm_cfg->menuName; ?>&amp;tab=file_options" enctype="multipart/form-data">
385
- <?php wp_nonce_field( 'ctc_update' ); ?>
386
- <div class="ctc-input-cell"> <strong>
387
- <?php _e('Upload New Screenshot', 'chld_thm_cfg'); ?>
388
- </strong>
389
- <p class="howto">
390
- <?php _e('The theme screenshot should be a 4:3 ratio (e.g., 880px x 660px) JPG, PNG or GIF. It will be renamed <code>screenshot</code>.', 'chld_thm_cfg'); ?>
391
- </p>
392
- </div>
393
- <div class="ctc-input-cell-wide">
394
- <input type="file" id="ctc_theme_screenshot" name="ctc_theme_screenshot" value="" />
395
- <input class="ctc_submit button button-primary" id="ctc_theme_screenshot_submit"
396
- name="ctc_theme_screenshot_submit" type="submit"
397
- value="<?php _e('Upload', 'chld_thm_cfg'); ?>" />
398
- </div>
399
- </form>
400
- </div>
401
- <div class="ctc-input-row clearfix" id="input_row_screenshot">
402
- <form id="ctc_export_form" method="post" action="?page=<?php echo $chld_thm_cfg->menuName; ?>&amp;tab=file_options">
403
- <?php wp_nonce_field( 'ctc_update' ); ?>
404
- <div class="ctc-input-cell"> <strong>
405
- <?php _e('Export Child Theme as Zip Archive', 'chld_thm_cfg'); ?>
406
- </strong>
407
- </div>
408
- <div class="ctc-input-cell-wide">
409
- <input class="ctc_submit button button-primary" id="ctc_export_child_zip"
410
- name="ctc_export_child_zip" type="submit"
411
- value="<?php _e('Export', 'chld_thm_cfg'); ?>" />
412
- </div>
413
- </form>
414
- </div>
415
- <?php if ('direct' != $chld_thm_cfg->fs_method): ?>
416
- <div class="ctc-input-row clearfix" id="input_row_permissions">
417
- <form id="ctc_permission_form" method="post" action="?page=<?php echo $chld_thm_cfg->menuName; ?>&amp;tab=file_options">
418
- <?php wp_nonce_field( 'ctc_update' ); ?>
419
- <div class="ctc-input-cell"> <strong>
420
- <?php _e('Secure Child Theme', 'chld_thm_cfg'); ?>
421
- </strong>
422
- <p class="howto">
423
- <?php _e('Attempt to reset child theme permissions to user ownership and read-only access.', 'chld_thm_cfg'); ?>
424
- </p>
425
- </div>
426
- <div class="ctc-input-cell-wide">
427
- <input class="ctc_submit button button-primary" id="ctc_reset_permission"
428
- name="ctc_reset_permission" type="submit"
429
- value="<?php _e('Make read-only', 'chld_thm_cfg'); ?>" />
430
- </div>
431
- </form>
432
- </div><?php endif; ?>
433
- </div>
434
- <?php endif; ?>
435
- <?php do_action('chld_thm_cfg_panels', $chld_thm_cfg, $active_tab, $hidechild); ?>
436
- </div><?php
437
- endif;
438
- ?></div>
439
- <style type="text/css">
440
- .ctc-status-icon.success {
441
- display: block;
442
- float:right;
443
- position: relative;
444
- height: 16px;
445
- width: 16px;
446
- margin:4px;
447
- background:url(<?php echo admin_url( 'images/yes.png' ); ?>) no-repeat;
448
- }
449
- .ctc-status-icon.failure {
450
- display: block;
451
- float:right;
452
- position: relative;
453
- height: 16px;
454
- width: 16px;
455
- margin:4px;
456
- background:url(<?php echo admin_url( 'images/no.png') ; ?>) no-repeat;
457
- }
458
- </style>
459
- <?php
460
  }
461
-
462
- function load_imports() {
463
- // allows fonts and other externals to be previewed
464
- // loads early not to conflict with admin stylesheets
465
- global $chld_thm_cfg;
466
- $regex = "/\@import *(url)? *\( *['\"]?((https?:\/\/)?(.+?))['\"]? *\).*$/";
467
- if ($imports = $chld_thm_cfg->css->get_prop('imports')):
468
- foreach ($imports as $import):
469
- preg_match($regex, $import, $matches);
470
- if (empty($matches[3]) && !empty($matches[4])): // relative filepath
471
- $url = get_stylesheet_directory_uri();
472
- preg_replace("#\.\./#", '', $matches[4], -1, $count);
473
- for($i = 0; $i < $count; $i++):
474
- $url = dirname($url);
475
- endfor;
476
- $import = preg_replace($regex, '@import url(' . trailingslashit($url) . $matches[4] . ')', $import);
477
- endif;
478
- echo preg_replace($regex, "<link rel='stylesheet' href=\"$2\" type='text/css' />", $import) . "\n";
479
- endforeach;
480
- endif;
481
  }
482
-
483
  function render_file_form($template = 'parnt') {
484
- global $chld_thm_cfg, $wp_filesystem;
485
- if ($theme = $chld_thm_cfg->css->get_prop($template)):
486
- $themeroot = get_theme_root() . '/' . $theme;
487
- $files = $chld_thm_cfg->css->recurse_directory(trailingslashit(get_theme_root()) . $theme, 'php');
488
- $counter = 0;
489
  sort($files);
490
  ob_start();
491
  foreach ($files as $file):
492
- $templatefile = preg_replace('%\.php$%', '', $chld_thm_cfg->theme_basename($theme, $file));
493
- if ('parnt' == $template && (preg_match('%^(inc|core|lang|css|js)%',$templatefile) || 'functions' == basename($templatefile))) continue; ?>
494
- <label class="ctc-input-cell smaller<?php echo 'child' == $template && !$chld_thm_cfg->fs && is_writable($file) ? ' writable' : ''; ?>">
495
- <input class="ctc_checkbox" id="ctc_file_<?php echo $template . '_' . ++$counter; ?>"
496
- name="ctc_file_<?php echo $template; ?>[]" type="checkbox"
497
- value="<?php echo $templatefile; ?>" />
498
- <?php echo $templatefile; ?></label>
499
- <?php
500
  endforeach;
501
- $linktext = __('Click here to edit template files using the Theme Editor', 'chld_thm_cfg');
502
- $editorlink = '<a href="' . admin_url('theme-editor.php?file=functions.php&theme=' . $chld_thm_cfg->css->get_prop('child')) . '" title="' . $linktext . '">';
503
- $editorlinkend = '</a>';
504
- if (defined('DISALLOW_FILE_EDIT') && DISALLOW_FILE_EDIT):
505
- $linktext = __('The Theme editor has been disabled. Template files must be edited offline.', 'chld_thm_cfg');
506
- $editorlink = '';
507
- $editorlinkend = '';
508
  endif;
509
  $inputs = ob_get_contents();
510
  ob_end_clean();
511
- if ($counter): ?>
512
- <div class="ctc-input-row clearfix" id="input_row_<?php echo $template; ?>_templates">
513
- <form id="ctc_<?php echo $template; ?>_templates_form" method="post" action="?page=<?php echo $chld_thm_cfg->menuName; ?>&amp;tab=file_options">
514
- <?php wp_nonce_field( 'ctc_update' ); ?>
515
- <div class="ctc-input-cell"> <strong>
516
- <?php _e(('parnt' == $template ? 'Parent' : 'Child') . ' Templates', 'chld_thm_cfg'); ?>
517
- </strong>
518
- <p class="howto">
519
- <?php if ('parnt' == $template):
520
- _e('Copy PHP template files from the parent theme by selecting them here.', 'chld_thm_cfg');?>
521
- </p>
522
- <p><strong>
523
- <?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.', 'chld_thm_cfg');?>
524
- </strong></p>
525
- <p class="howto"> <?php echo sprintf(__('The %s file is generated separately and cannot be copied here.', 'chld_thm_cfg'),
526
- $editorlink . '<code>functions.php</code>' . $editorlinkend
527
- );
528
- else:
529
- echo $editorlink . $linktext . $editorlinkend; ?></p>
530
- <p class="howto">
531
- <?php if ($chld_thm_cfg->fs):
532
- _e('Delete child theme templates by selecting them here.', 'chld_thm_cfg');
533
- else:
534
- _e('Delete child theme templates or make them writable by selecting them here. Writable files are displayed in <span style="color:red">red</span>.', 'chld_thm_cfg');
535
- endif;
536
- endif; ?>
537
- </p>
538
- </div>
539
- <div class="ctc-input-cell-wide"> <?php echo $inputs; ?> </div>
540
- <div class="ctc-input-cell"> <strong>&nbsp;</strong> </div>
541
- <div class="ctc-input-cell-wide" style="margin-top:10px;margin-bottom:10px">
542
- <?php if ('child' == $template && !$chld_thm_cfg->fs): ?>
543
- <input class="ctc_submit button button-primary" id="ctc_templates_writable_submit"
544
- name="ctc_templates_writable_submit" type="submit"
545
- value="<?php _e('Make Selected Writable', 'chld_thm_cfg'); ?>" />&nbsp; &nbsp;
546
- <?php endif; ?>
547
- <input class="ctc_submit button button-primary" id="ctc_<?php echo $template; ?>_templates_submit"
548
- name="ctc_<?php echo $template; ?>_templates_submit" type="submit"
549
- value="<?php echo ('parnt' == $template ? __('Copy Selected to Child Theme', 'chld_thm_cfg') : __('Delete Selected', 'chld_thm_cfg')); ?>" />
550
- </div>
551
- </form>
552
- </div>
553
- <?php
554
  endif;
555
  endif;
556
  }
557
 
558
  function render_image_form() {
559
- global $chld_thm_cfg;
560
- if ($theme = $chld_thm_cfg->css->get_prop('child')):
561
- $imgdir = trailingslashit($theme) . 'images';
562
- $themeuri = trailingslashit(get_theme_root_uri()) . trailingslashit($imgdir);
563
- $files = $chld_thm_cfg->css->recurse_directory(trailingslashit(get_theme_root()) . $imgdir, 'img');
564
 
565
  $counter = 0;
566
  sort($files);
567
  ob_start();
568
- foreach ($files as $file):
569
- $templatefile = $chld_thm_cfg->theme_basename($imgdir, $file); ?>
570
- <div class="ctc-input-cell" style="height:100px">
571
- <label class="smaller">
572
- <input class="ctc_checkbox" id="ctc_img_<?php echo ++$counter; ?>"
573
- name="ctc_img[]" type="checkbox"
574
- value="<?php echo $templatefile; ?>" />
575
- <?php echo $templatefile; ?></label>
576
- <br/>
577
- <a href="<?php echo $themeuri . $templatefile . '?' . time(); ?>" class="thickbox"><img src="<?php echo $themeuri . $templatefile . '?' . time(); ?>" height="72" width="72" style="max-height:72px;max-width:100%;width:auto;height:auto" /></a></div>
578
- <?php
579
  endforeach;
580
  $inputs = ob_get_contents();
581
  ob_end_clean();
582
- if ($counter): ?>
583
- <div class="ctc-input-row clearfix" id="input_row_images">
584
- <form id="ctc_image_form" method="post" action="?page=<?php echo $chld_thm_cfg->menuName; ?>&amp;tab=file_options">
585
- <?php wp_nonce_field( 'ctc_update' ); ?>
586
- <div class="ctc-input-cell"> <strong>
587
- <?php _e('Child Theme Images', 'chld_thm_cfg'); ?>
588
- </strong>
589
- <p class="howto">
590
- <?php _e('Remove child theme images by selecting them here.', 'chld_thm_cfg');?>
591
- </p>
592
- </div>
593
- <div class="ctc-input-cell-wide"> <?php echo $inputs; ?> </div>
594
- <div class="ctc-input-cell"> <strong>&nbsp;</strong> </div>
595
- <div class="ctc-input-cell-wide" style="margin-top:10px;margin-bottom:10px">
596
- <input class="ctc_submit button button-primary" id="ctc_image_submit"
597
- name="ctc_image_submit" type="submit"
598
- value="<?php _e('Remove Selected', 'chld_thm_cfg'); ?>" disabled />
599
- </div>
600
- </form>
601
- </div>
602
- <?php
603
- endif;
604
  endif;
605
  }
606
 
607
  function get_theme_screenshot() {
608
- global $chld_thm_cfg;
609
- foreach (array_keys($chld_thm_cfg->imgmimes) as $extreg): foreach (explode('|', $extreg) as $ext):
610
- if ($screenshot = $chld_thm_cfg->css->is_file_ok($chld_thm_cfg->css->get_child_target('screenshot.' . $ext))):
611
- $screenshot = trailingslashit(get_theme_root_uri()) . $chld_thm_cfg->theme_basename('', $screenshot);
612
- return $screenshot . '?' . time();
613
- endif;
614
- endforeach; endforeach;
 
 
615
  return FALSE;
616
  }
617
 
618
  function settings_errors() {
619
- global $chld_thm_cfg;
620
- if (count($chld_thm_cfg->errors)):
621
  echo '<div class="error"><ul>' . LF;
622
- foreach ($chld_thm_cfg->errors as $err):
623
  echo '<li>' . $err . '</li>' . LF;
624
  endforeach;
625
  echo '</ul></div>' . LF;
@@ -630,229 +127,53 @@ class Child_Theme_Configurator_UI {
630
  else:
631
  echo '<p>' . apply_filters('chld_thm_cfg_update_msg', sprintf(__('Child Theme <strong>%s</strong> has been generated successfully.
632
  ', 'chld_thm_cfg'),
633
- $chld_thm_cfg->css->get_prop('child_name')), $chld_thm_cfg) . LF
634
- //. (1 == $_GET['updated'] && 'direct' != $chld_thm_cfg->fs_method ? '<br/>' . __( 'To enable Child Theme Configurator for editing, the stylesheet has been made writable. You can change this back when you are finished editing for security by clicking "Make read-only" under the "Files" tab.', 'chld_thm_cfg') : '')
635
- . '<strong>IMPORTANT: <a href="http://www.lilaeamedia.com/plugins/child-theme-configurator/#preview_activate">Test your child theme</a> before activating.</strong></p>';
636
  endif;
637
- if ( 9 == $_GET['updated']) echo '<p>' . __('Please verify the imports below and remove any imports that are not needed by the front end, such as admin or configuration stylesheets.', 'chld_thm_cfg') . '</p>' . LF;
638
  echo '</div>' . LF;
639
  endif;
640
  }
641
 
642
- function render_help_tabs() {
643
- global $wp_version, $chld_thm_cfg;
644
  if ( version_compare( $wp_version, '3.3') >= 0 ) {
645
 
646
  $screen = get_current_screen();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
647
 
648
- if ( $screen->id != $chld_thm_cfg->hook )
649
- return;
650
  // Add help tabs
 
 
 
 
 
 
 
 
 
 
 
 
 
 
651
 
652
- $screen->add_help_tab( array(
653
- 'id' => 'ctc_tutorial',
654
- 'title' => __( 'Tutorial Video', 'chld_thm_cfg' ),
655
- 'content' => __('<iframe width="480" height="270" src="//www.youtube.com/embed/xL2HkWQxgOA?rel=0&modestbranding=1" frameborder="0" allowfullscreen></iframe>', 'chld_thm_cfg'),
656
- ) );
657
-
658
-
659
- $screen->add_help_tab( array(
660
- 'id' => 'ctc_getting_started',
661
- 'title' => __( 'Start Here', 'chld_thm_cfg' ),
662
- 'content' => __( '
663
- <p>The first step is to create a child theme and import your parent theme styles into the configurator.</p>
664
- <ol><li>Select an existing parent theme from the menu.</li>
665
- <li>Select "New" or "Existing" child theme.
666
- <ul><li>If creating a new theme, enter a "slug" (lower case, no spaces). This is used to name the theme directory and identify the theme to WordPress.</li>
667
- <li>If using an existing theme, select a child theme from the menu.</li></ul></li>
668
- <li>Enter a Name for the child theme.</li>
669
- <li>Enter an author for the child theme.</li>
670
- <li>Enter the child theme version number.</li>
671
- <li>Check "Copy Parent Theme Menus, Widgets and other Options", to copy parent theme modifications to the child theme. Depending on the theme, some options may need to be applied using separate theme option controls. <strong>IMPORTANT: This will overwrite existing child theme options.</strong></li>
672
- <li>Check "Backup Stylesheet", to create a backup of the child theme stylesheet in the child theme directory.</li>
673
- <li>If your theme uses additional stylesheets they will appear as checkbox options when you open the toggle arrow. Select only the stylesheets you wish to customize to reduce overhead. Remember to select them again if you reload your configuration.</li>
674
- <li>Click "Generate Child Theme."</li>
675
- <li><strong>ALWAYS <a target="_blank" href="http://www.lilaeamedia.com/plugins/child-theme-configurator/#preview_activate" title="Test your child theme before activating!">TEST YOUR CHILD THEME</a> BEFORE ACTIVATING!</strong></li></ol>
676
- ', 'chld_thm_cfg'
677
- ),
678
- ) );
679
-
680
- $screen->add_help_tab( array(
681
- 'id' => 'ctc_query_selector',
682
- 'title' => __( 'Query/Selector', 'chld_thm_cfg' ),
683
- 'content' => __( '
684
- <p>There are two ways to identify and override parent styles. The Child Theme Configurator lets you search styles by <strong>selector</strong> and by <strong>rule</strong>. If you wish to change a specific selector (e.g., h1), use the "Query/Selector" tab. If you have a specific value you wish to change site-wide (e.g., the color of the type), use the "Rule/Value" tab.</p>
685
- <p>The Query/Selector tab lets you find specific selectors and edit them. First, find the query that contains the selector you wish to edit by typing in the <strong>Query</strong> autoselect box. Select by clicking with the mouse or by pressing the "Enter" or "Tab" keys. Selectors are in the <strong>base</strong> query by default.</p>
686
- <p>Next, find the selector by typing in the <strong>Selector</strong> autoselect box. Select by clicking with the mouse or by pressing the "Enter" or "Tab" keys.</p>
687
- <p>This will load all of the rules for that selector with the Parent values on the left and the Child values inputs on the right. Any existing child values will be automatically populated. There is also a Sample preview that displays the combination of Parent and Child overrides. Note that the <strong>border</strong> and <strong>background-image</strong> get special treatment.</p>
688
- <p>The "Order" field contains the original sequence of the selector in the parent theme stylesheet. You can change the selector order sequence by entering a lower or higher number in the "Order" field. You can also force style overrides (so called "!important" flag) by checking the "!" box next to each input. Please use judiciously.</p>
689
- <p>Click "Save" to update the child stylesheet and save your changes to the WordPress admin.</p>
690
- ', 'chld_thm_cfg'
691
- ),
692
- ) );
693
-
694
- $screen->add_help_tab( array(
695
- 'id' => 'ctc_rule_value',
696
- 'title' => __( 'Rule/Value', 'chld_thm_cfg' ),
697
- 'content' => __( '
698
- <p>There are two ways to identify and override parent styles. The Child Theme Configurator lets you search styles by <strong>selector</strong> and by <strong>rule</strong>. If you wish to change a specific selector (e.g., h1), use the "Query/Selector" tab. If you have a specific value you wish to change site-wide (e.g., the color of the type), use the "Rule/Value" tab.</p>
699
- <p>The Rule/Value tab lets you find specific values for a given rule and then edit that value for individual selectors that use that rule/value combination. First, find the rule you wish to override by typing in the <strong>Rule</strong> autoselect box. Select by clicking with the mouse or by pressing the "Enter" or "Tab" keys.</p>
700
- <p>This will load all of the unique values that exist for that rule in the parent stylesheet with a Sample preview for that value. If there are values that exist in the child stylesheet that do not exist in the parent stylesheet, they will be displayed as well.</p>
701
- <p>For each unique value, click the "Selectors" link to view a list of selectors that use that rule/value combination, grouped by query with a Sample preview of the value and inputs for the child value. Any existing child values will be automatically populated.</p>
702
- <p>Click "Save" to update the child stylesheet and save your changes to the WordPress admin.</p>
703
- ', 'chld_thm_cfg'
704
- ),
705
- ) );
706
-
707
- $screen->add_help_tab( array(
708
- 'id' => 'ctc_new_styles',
709
- 'title' => __( 'Add New Styles', 'chld_thm_cfg' ),
710
- 'content' => __( '
711
- <p>If you wish to add additional rules to a given selector, first load the selector using the Query/Selector tab. Then find the rule you wish to override by typing in the <strong>New Rule</strong> autoselect box. Select by clicking with the mouse or by pressing the "Enter" or "Tab" keys. This will add a new input row to the selector inputs.</p>
712
- <p>If you wish to add completely new selectors, or even new @media queries, you can enter free-form CSS in the "New Selector" textarea. Be aware that your syntax must be correct (i.e., balanced curly braces, etc.) for the parser to load the new styles. You will know it is invalid because a red "X" will appear next to the save button.</p>
713
- <p>If you prefer to use shorthand syntax for rules and values instead of the inputs provided by the Child Theme Configurator, you can enter them here as well. The parser will convert your input into normalized CSS code automatically.</p>
714
- ', 'chld_thm_cfg'
715
- ),
716
- ) );
717
-
718
- $screen->add_help_tab( array(
719
- 'id' => 'ctc_imports',
720
- 'title' => __( '@imports and Web Fonts', 'chld_thm_cfg' ),
721
- 'content' => __( '
722
- <p>You can add additional stylesheets and web fonts by typing @import rules into the textarea on the @import tab. <strong>Important: The Child Theme Configurator adds the @import rule that loads the Parent Theme\'s stylesheet automatically. Do not need to add it here.</strong></p>
723
- <p>Below is an example that loads a local custom stylesheet (you would have to add the "fonts" directory and stylesheet) as well as the web font "Open Sans" from Google Web Fonts:</p>
724
- <blockquote><pre><code>
725
- @import url(fonts/stylesheet.css);
726
- @import url(http://fonts.googleapis.com/css?family=Open+Sans:400,400italic,700,700italic);
727
- </code></pre></blockquote>
728
- ', 'chld_thm_cfg'
729
- ),
730
- ) );
731
-
732
- $screen->add_help_tab( array(
733
- 'id' => 'ctc_files',
734
- 'title' => __( 'Files', 'chld_thm_cfg' ),
735
- 'content' => __( '
736
- <h5>Parent Templates</h5><p>Copy PHP template files from the parent theme by checking the boxes and clicking "Copy Selected to Child Theme" and the templates will be added to the child theme directory.</p>
737
- <p><strong>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.</strong></p>
738
- <p>The <code>functions.php</code> file is generated separately and cannot be copied here.</p>
739
- <h5>Child Templates</h5><p>Templates copied from the parent are listed here. These can be edited using the Theme Editor in the Appearance Menu.</p>
740
- <p>Remove child theme images by checking the boxes and clicking "Remove Selected from Child Theme."</p>
741
- <h5>Child Theme Images</h5><p>Theme images reside under the <code>images</code> directory in your child theme and are meant for stylesheet use only. Use the media gallery for content images.</p>
742
- <p>You can upload new images using the image upload form.</p>
743
- <h5>Child Theme Screenshot</h5><p>You can upload a custom screenshot for the child theme here.</p>
744
- <p>The theme screenshot should be a 4:3 ratio (eg., 880px x 660px) JPG, PNG or GIF. It will be renamed <code>screenshot</code>.</p>
745
- ', 'chld_thm_cfg'
746
- ),
747
- ) );
748
-
749
- $screen->add_help_tab( array(
750
- 'id' => 'ctc_preview',
751
- 'title' => __( 'Preview and Activate', 'chld_thm_cfg' ),
752
- 'content' => __( '<p><strong>IMPORTANT: <a target="_blank" href="http://www.lilaeamedia.com/plugins/child-theme-configurator/#preview_activate" title="Test your child theme before activating!">Test your child theme before activating!</a></strong> Some themes (particularly commercial themes) do not adhere to the Theme Development guidelines set forth by WordPress.org, and do not correctly load parent template files or automatically load child theme stylesheets or php files. <strong>In the worst cases they will break your website when you activate the child theme.</strong></p>
753
- <ol><li>Navigate to Appearance > Themes in the WordPress Admin. You will now see the new Child Theme as one of the installed Themes.</li>
754
- <li>Click "Live Preview" below the new Child Theme to see it in action.</li>
755
- <li>When you are ready to take the Child Theme live, click "Activate."</li></ol>
756
- <p>You can also click the Child or Parent CSS tab to reference the stylesheet code.</p>
757
- ', 'chld_thm_cfg'
758
- ),
759
- ) );
760
-
761
- $screen->add_help_tab( array(
762
- 'id' => 'ctc_permissions',
763
- 'title' => __( 'File Permissions', 'chld_thm_cfg' ),
764
- 'content' => __( '
765
- <p>WordPress was designed to work on a number of server configurations. Child Theme Configurator uses the WordPress Filesystem API to allow changes to sites that require user permission to edit files.</p><p>However, because most of the functionality occurs via AJAX (background) requests, the child theme stylesheet must be writable by the web server.</p><p>The plugin will automatically detect your configuration and provide a number of options to resolve this requirement. Use the links provided to find out more about the options available, including:</p>
766
- <ol><li>Temporarily making the stylesheet writable through the plugin.</li>
767
- <li>Adding your FTP/SSH credentials to the WordPress config file.</li>
768
- <li>Setting the stylesheet write permissions on the server manually</li>
769
- <li>Configuring your web server to allow write access in certain situations.</li>
770
- </ol>
771
- ', 'chld_thm_cfg'
772
- ),
773
- ) );
774
-
775
- $screen->add_help_tab( array(
776
- 'id' => 'ctc_faq',
777
- 'title' => __( 'FAQs', 'chld_thm_cfg' ),
778
- 'content' => __( '
779
- <h5>Does it work with Plugins?</h5>
780
- <p>We offer a premium extension to let you easily modify styles for any WordPress Plugin installed on your website. The Child Theme Configurator Plugin Extension scans your plugins and allows you to create custom stylesheets in your Child Theme. <a href="http://www.lilaeamedia.com/plugins/child-theme-plugin-styles" title="Child Theme Configurator Extension">Learn more</a></p>
781
- <h5 id="doesnt_work">Why doesn’t this work with my (insert theme vendor here) theme?</h5>
782
- <p>Some themes (particularly commercial themes) do not adhere to the Theme Development guidelines set forth by WordPress.org, and do not correctly load parent template files or automatically load child theme stylesheets or php files.</p>
783
- <p>This is unfortunate, because in the best case they effectively prohibit the webmaster from adding any customizations (other than those made through the admin theme options) that will survive past an upgrade. <strong>In the worst case they will break your website when you activate the child theme.</strong></p>
784
- <p>Contact the vendor directly to ask for this core functionality. It is our opinion that ALL themes (especially commercial ones) must pass the Theme Unit Tests outlined by WordPress.org.</p>
785
- <h5>Can I edit the Child Theme stylesheet manually offline or by using the Editor or do I have to use the Configurator?</h5>
786
- <p>You can make any manual changes you wish to the stylesheet. Just make sure you import the revised stylesheet using the Parent/Child panel or the Configurator will overwrite your changes the next time you use it. Just follow the steps as usual but select the "Use Existing Child Theme" radio button as the "Child Theme" option. The Configurator will automatically update its internal data from the new stylesheet.</p>
787
- <h5>Why doesn\'t the Parent Theme have any styles when I "View Parent CSS"?</h5>
788
- <p>Your Parent theme is probably using a separate location for the stylesheets. Select individual stylesheets from the "Parse Additional Stylesheets" section of the Parent/Child tab and click "Generate Child Theme Files" again.</p>
789
- <h5 id="menus-broken">Why are my menus displaying incorrectly when I activate the new child theme?</h5>
790
- <p>The child theme creates a new instance in the WordPress options data and the menus have to be assigned. Go to Appearance &gt; Menus and assign locations to each of the menus for the new Child Theme.</p>
791
- <h5 "preview-not-loading">Why do the preview tabs return "Stylesheet could not be displayed"?</h5>
792
- <p>You have to configure at least one child theme from the Parent/Child tab for the preview to display.</p>
793
- <h5 id="specific_color">How do I change a specific color/font style/background?</h5>
794
- <p>You can override a specific value globally using the Rule/Value tab. See Rule/Value, above.</p>
795
- <h5 id="add_styles">How do I add styles that aren\'t in the Parent Theme?</h5>
796
- <p>You can add queries and selectors using the "New Selector(s)" textarea on the Query/Selector tab. See Query/Selector, above.</p>
797
- <h5 id="add_styles">How do I remove a style from the Parent Theme?</h5>
798
- <p>You shouldn\'t really "remove" a style from the Parent. You can, however, set the rule to "inherit," "none," or zero (depending on the rule). This will negate the Parent value. Some experimentation may be necessary.</p>
799
- <h5 id="remove_styles">How do I remove a style from the Child Theme?</h5>
800
- <p>Delete the value from the input for the rule you wish to remove. The Child Theme Configurator only adds overrides for rules that contain values.</p>
801
- <h5 id="important_flag">How do I set the !important flag?</h5>
802
- <p>We always recommend relying on good cascading design over global overrides. To that end, you have ability to change the load order of child theme styles by entering a value in the "Order" field. And yes, you can now set rules as important by checking the "!" box next to each input. Please use judiciously.</p>
803
- <h5 id="gradients">How do I create cross-browser gradients?</h5>
804
- <p>The Child Theme Configurator automatically generates the vendor prefixes and filters to display gradients across most browsers. It uses a normalized syntax and only supports two colors without intermediate stops. The inputs consist of origin (e.g., top, left, 135deg, etc.), start color and end color. The browser-specific syntax is generated automatically when you save these values. <strong>Note:</strong> For Internet Explorer, a filter rule approximates the gradient but can only be horizontal (origin top) or vertical (origin left). The legacy webkit-gradient syntax is not supported.</p>
805
- <h5 id="responsive">How do I make my Theme responsive?</h5>
806
- <p>The short answer is to use a responsive Parent Theme. Some common characteristics of responsive design are:</p>
807
- <ul><li>Avoiding fixed width and height values. Using max- and min-height values and percentages are ways to make your designs respond to the viewer\'s browser size.</li>
808
- <li>Combining floats and clears with inline and relative positions allow the elements to adjust gracefully to their container\'s width.</li>
809
- <li>Showing and hiding content with Javascript.</li></ul>
810
- <iframe width="480" height="270" src="//www.youtube.com/embed/iBiiAgsK4G4?rel=0&modestbranding=1" frameborder="0" allowfullscreen></iframe>
811
- <h5 id="web_fonts">How do I add Web Fonts?</h5>
812
- <p>The easiest method is to paste the @import code provided by Google, Font Squirrel or any other Web Font site into the @import tab. The fonts will then be available to use as a value of the <strong>font-family</strong> rule. Be sure you understand the license for any embedded fonts.</p>
813
- <p>You can also create a secondary stylesheet that contains @font-face rules and import it using the @import tab. <strong>Note:</strong> Currently the Child Theme Configurator does not generate previews of imported web fonts, but will in a later release.</p>
814
- <h5 id="functions_file">Where are the PHP files?</h5>
815
- <p>The configurator automatically adds a blank functions.php file to the child theme directory. Other parent theme files can be copied using the "Files" tab. Theme images and a custom screenshot can be uploaded there as well.</p>
816
- ', 'chld_thm_cfg'
817
- ),
818
- ) );
819
-
820
- $screen->add_help_tab( array(
821
- 'id' => 'ctc_glossary',
822
- 'title' => __( 'Glossary', 'chld_thm_cfg' ),
823
- 'content' => __( '
824
- <h3 id="terms">Glossary</h3>
825
- <ul><li id="parent_theme"><strong>Parent Theme</strong> The WordPress Theme you wish to edit. WordPress first loads the Child Theme, then loads the Parent Theme. If a style exists in the Child Theme, it overrides the Parent Theme.</li>
826
- <li id="child_theme"><strong>Child Theme</strong> New Theme based on Parent Theme. You can create any number of Child Themes from a single Parent Theme.</li>
827
- <li id="class"><strong>Class</strong> A term used to organize objects. For example, a &lt;div&gt; might be assigned the "blue-text" class. The stylesheet might then assign the "color: blue;" rule to members of the "blue-text" class. Thus, the &lt;div&gt; would display text as blue in the browser.</li>
828
- <li id="selector"><strong>Selector</strong> One or more html elements, classes, ids or other terms used to identify groups of objects.</li>
829
- <li id="rule"><strong>Rule</strong> One of many standardized attributes used to tell the browser how to display objects matching a given selector. Examples are <strong>color</strong>, <strong>background-image</strong> and <strong>font-size</strong>.</li>
830
- <li id="at-rule"><strong>At-rule</strong> CSS browser instruction to extend default functionality. The Child Theme Configurator supports two At-rules:
831
- <ul> <li id="import"><strong>@import</strong> Instructs the browser to load additional CSS information from an external source.</li>
832
- <li id="query"><strong>@media (Media Query)</strong> Identifies blocks of styles that are used only when certain browser characteristics are true. Examples are max-width, screen and print.</li>
833
- </ul></li>
834
- <li id="override"><strong>Override</strong> When a selector exists in both the Child Theme and the Parent Theme, the Child Theme takes priority over the Parent theme. This is where the Child Theme Configurator stands out: it helps you create <strong>exact overrides</strong> of selectors from the Parent Theme, eliminating hours of trial and error.</li>
835
- </ul>
836
- ', 'chld_thm_cfg'
837
- ),
838
- ) );
839
-
840
- // Set help sidebar
841
- $screen->set_help_sidebar(
842
- '
843
- <h4>Now it works with plugins, too!</h4>
844
- <p style="font-size:smaller">Easily modify styles for any WordPress Plugin installed on your website. The Child Theme Configurator Plugin Extension scans your plugins and allows you to create custom stylesheets in your Child Theme. <a href="http://www.lilaeamedia.com/plugins/child-theme-plugin-styles" title="Child Theme Configurator Extension">Learn more</a></p>
845
- <ul>
846
- <li><a href="http://www.lilaeamedia.com/about/contact/">' . __( 'Contact us', 'chld_thm_cfg' ) . '</a></li>
847
- <li><a href="http://www.lilaeamedia.com/plugins/child-theme-configurator">' . __( 'Plugin Website', 'chld_thm_cfg' ) . '</a></li>
848
- <li><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8QE5YJ8WE96AJ">' . __( 'Donate', 'chld_thm_cfg' ) . '</a></li>
849
- <li><a href="http://wordpress.org/support/view/plugin-reviews/child-theme-configurator?rate=5#postform">' . __( 'Give Us 5 Stars', 'chld_thm_cfg' ) . '</a></li>
850
- <li><a href="http://codex.wordpress.org/Child_Themes">' . __( 'WordPress Codex', 'chld_thm_cfg' ) . '</a></li>
851
- <li><a href="http://wordpress.stackexchange.com/">' . __( 'WordPress Answers', 'chld_thm_cfg' ) . '</a></li>
852
- </ul>
853
- '
854
- );
855
  }
856
  }
 
 
 
857
  }
858
  ?>
5
  Class: Child_Theme_Configurator_UI
6
  Plugin URI: http://www.lilaeamedia.com/plugins/child-theme-configurator/
7
  Description: Handles the plugin User Interface
8
+ Version: 1.6.0
9
  Author: Lilaea Media
10
  Author URI: http://www.lilaeamedia.com/
11
  Text Domain: chld_thm_cfg
13
  License: GPLv2
14
  Copyright (C) 2014 Lilaea Media
15
  */
16
+ class ChildThemeConfiguratorUI {
 
 
 
17
 
18
+ function ctc() {
 
 
 
 
 
19
  global $chld_thm_cfg;
20
+ return $chld_thm_cfg;
21
+ }
22
+
23
+ function render() {
24
+ $css = $this->ctc()->css;
25
+ $themes = $this->ctc()->themes;
26
  $parent = isset($_GET['ctc_parent']) ? sanitize_text_field($_GET['ctc_parent']) : $css->get_prop('parnt');
27
  $child = $css->get_prop('child');
28
+ if (!$configtype = $css->get_prop('configtype')) $configtype = 'theme';
29
  $hidechild = (count($themes['child']) ? '' : 'style="display:none"');
30
+ $enqueueset = 'theme' != $configtype || isset($css->enqueue);
31
  $imports = $css->get_prop('imports');
32
  $id = 0;
33
+ $this->ctc()->fs_method = get_filesystem_method();
34
+ add_thickbox();
35
+ add_action('chld_thm_cfg_related_links', array($this, 'lilaea_plug'));
36
+ include ($this->ctc()->pluginPath .'/includes/forms/main.php');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  }
38
+
39
+ function render_theme_menu($template = 'child', $selected = NULL) {
40
+ ?>
41
+ <select class="ctc-select" id="ctc_theme_<?php echo $template; ?>" name="ctc_theme_<?php echo $template; ?>" style="visibility:hidden"><?php
42
+ foreach ($this->ctc()->themes[$template] as $slug => $theme)
43
+ echo '<option value="' . $slug . '"' . ($slug == $selected ? ' selected' : '') . '>'
44
+ . esc_attr($theme['Name']) . '</option>' . LF; ?>
45
+ </select>
46
+ <div style="display:none">
47
+ <?php
48
+ foreach ($this->ctc()->themes[$template] as $slug => $theme)
49
+ include ($this->ctc()->pluginPath . 'includes/forms/themepreview.php'); ?>
50
+ </div>
51
+ <?php
 
 
 
 
 
 
52
  }
53
+
54
  function render_file_form($template = 'parnt') {
55
+ global $wp_filesystem;
56
+ if ($theme = $this->ctc()->css->get_prop($template)):
57
+ $themeroot = trailingslashit(get_theme_root()) . trailingslashit($theme);
58
+ $files = $this->ctc()->get_files($theme);
59
+ $counter = 0;
60
  sort($files);
61
  ob_start();
62
  foreach ($files as $file):
63
+ $templatefile = preg_replace('%\.php$%', '', $file);
64
+ $excludes = implode("|", (array) apply_filters('chld_thm_cfg_template_excludes', $this->ctc()->excludes));
65
+ if ('parnt' == $template && (preg_match('%^(' . $excludes . ')\w*\/%',$templatefile)
66
+ || 'functions' == basename($templatefile))) continue;
67
+ include ( $this->ctc()->pluginPath . 'includes/forms/file.php' );
 
 
 
68
  endforeach;
69
+ if ('child' == $template && ($backups = $this->ctc()->get_files($theme, 'backup'))):
70
+ foreach ( $backups as $backup => $label):
71
+ $templatefile = preg_replace('%\.css$%', '', $backup);
72
+ include ( $this->ctc()->pluginPath . 'includes/forms/backup.php' );
73
+ endforeach;
 
 
74
  endif;
75
  $inputs = ob_get_contents();
76
  ob_end_clean();
77
+ if ($counter):
78
+ include ( $this->ctc()->pluginPath . 'includes/forms/fileform.php' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  endif;
80
  endif;
81
  }
82
 
83
  function render_image_form() {
84
+
85
+ if ($theme = $this->ctc()->css->get_prop('child')):
86
+ $themeuri = trailingslashit(get_theme_root_uri()) . trailingslashit($theme);
87
+ $files = $this->ctc()->get_files($theme, 'img');
 
88
 
89
  $counter = 0;
90
  sort($files);
91
  ob_start();
92
+ foreach ($files as $file):
93
+ $templatefile = preg_replace('/^images\//', '', $file);
94
+ include( $this->ctc()->pluginPath . 'includes/forms/image.php' );
 
 
 
 
 
 
 
 
95
  endforeach;
96
  $inputs = ob_get_contents();
97
  ob_end_clean();
98
+ if ($counter) include( $this->ctc()->pluginPath . 'includes/forms/images.php' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
  endif;
100
  }
101
 
102
  function get_theme_screenshot() {
103
+
104
+ foreach (array_keys($this->ctc()->imgmimes) as $extreg):
105
+ foreach (explode('|', $extreg) as $ext):
106
+ if ($screenshot = $this->ctc()->css->is_file_ok($this->ctc()->css->get_child_target('screenshot.' . $ext))):
107
+ $screenshot = trailingslashit(get_theme_root_uri()) . $this->ctc()->theme_basename('', $screenshot);
108
+ return $screenshot . '?' . time();
109
+ endif;
110
+ endforeach;
111
+ endforeach;
112
  return FALSE;
113
  }
114
 
115
  function settings_errors() {
116
+
117
+ if (count($this->ctc()->errors)):
118
  echo '<div class="error"><ul>' . LF;
119
+ foreach ($this->ctc()->errors as $err):
120
  echo '<li>' . $err . '</li>' . LF;
121
  endforeach;
122
  echo '</ul></div>' . LF;
127
  else:
128
  echo '<p>' . apply_filters('chld_thm_cfg_update_msg', sprintf(__('Child Theme <strong>%s</strong> has been generated successfully.
129
  ', 'chld_thm_cfg'),
130
+ $this->ctc()->css->get_prop('child_name')), $this->ctc()) . LF
131
+ . '<strong>' . __('IMPORTANT:', 'chld_thm_cfg') . ' <a href="' . admin_url('/customize.php?theme=' . $this->ctc()->css->get_prop('child')) . '" title="' . __('Live Preview', 'chld_thm_cfg') . '" class="ctc-live-preview">' . __('Test your child theme', 'chld_thm_cfg') . '</a> ' . __('before activating.', 'chld_thm_cfg') . '</strong></p>';
 
132
  endif;
 
133
  echo '</div>' . LF;
134
  endif;
135
  }
136
 
137
+ function render_help_content() {
138
+ global $wp_version;
139
  if ( version_compare( $wp_version, '3.3') >= 0 ) {
140
 
141
  $screen = get_current_screen();
142
+
143
+ // load help content via output buffer so we can use plain html for updates
144
+ // then use regex to parse for help tab parameter values
145
+
146
+ $regex_sidebar = '/' . preg_quote('<!-- BEGIN sidebar -->') . '(.*?)' . preg_quote('<!-- END sidebar -->') . '/s';
147
+ $regex_tab = '/' . preg_quote('<!-- BEGIN tab -->') . '\s*<h\d id="(.*?)">(.*?)<\/h\d>(.*?)' . preg_quote('<!-- END tab -->') . '/s';
148
+ ob_start();
149
+ // stub for multiple languages future release
150
+ include($this->ctc()->pluginPath . 'includes/help/help_en_US.php');
151
+ $help_raw = ob_get_contents();
152
+ ob_end_clean();
153
+ // parse raw html for tokens
154
+ preg_match($regex_sidebar, $help_raw, $sidebar);
155
+ preg_match_all($regex_tab, $help_raw, $tabs);
156
 
 
 
157
  // Add help tabs
158
+ if (isset($tabs[1])):
159
+ while(count($tabs[1])):
160
+ $id = array_shift($tabs[1]);
161
+ $title = array_shift($tabs[2]);
162
+ $content = array_shift($tabs[3]);
163
+ $screen->add_help_tab( array(
164
+ 'id' => $id,
165
+ 'title' => $title,
166
+ 'content' => $content,
167
+ ) );
168
+ endwhile;
169
+ endif;
170
+ if (isset($sidebar[1]))
171
+ $screen->set_help_sidebar($sidebar[1]);
172
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
173
  }
174
  }
175
+ function lilaea_plug() {
176
+ include ($this->ctc()->pluginPath . 'includes/forms/related.php');
177
+ }
178
  }
179
  ?>
includes/class-ctc.php CHANGED
@@ -6,7 +6,7 @@ if ( !defined('ABSPATH')) exit;
6
  Class: Child_Theme_Configurator
7
  Plugin URI: http://www.lilaeamedia.com/plugins/child-theme-configurator/
8
  Description: Main Controller Class
9
- Version: 1.5.4
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
@@ -14,15 +14,12 @@ if ( !defined('ABSPATH')) exit;
14
  License: GPLv2
15
  Copyright (C) 2014 Lilaea Media
16
  */
17
- require_once('class-ctc-ui.php');
18
- require_once('class-ctc-css.php');
19
- class Child_Theme_Configurator {
20
 
21
  var $css;
 
 
22
  var $menuName;
23
- var $langName;
24
- var $pluginName;
25
- var $shortName;
26
  var $ns;
27
  var $ui;
28
  var $themes;
@@ -30,135 +27,183 @@ class Child_Theme_Configurator {
30
  var $hook;
31
  var $is_ajax;
32
  var $updated;
33
- var $cache_updates;
34
  var $uploadsubdir;
 
35
  var $fs;
36
  var $fs_prompt;
37
  var $fs_method;
38
- var $postarrays;
39
- var $imgmimes;
40
- var $updates;
41
-
42
- function __construct($file) {
43
- $this->dir = dirname( $file );
44
- $this->menuName = 'chld_thm_cfg_menu';
45
- $lang_dir = $this->dir . '/lang';
46
- load_plugin_textdomain('chld_thm_cfg', FALSE, $lang_dir, $lang_dir);
47
-
48
- $this->pluginName = __('Child Theme Configurator', 'chld_thm_cfg');
49
- $this->shortName = __('Child Themes', 'chld_thm_cfg');
50
- $this->pluginPath = $this->dir . '/';
51
- $this->pluginURL = plugin_dir_url($file);
52
- $this->imgmimes = array(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  'jpg|jpeg|jpe' => 'image/jpeg',
54
  'gif' => 'image/gif',
55
  'png' => 'image/png',
56
  );
57
- $this->postarrays = array(
58
- 'ctc_img',
59
- 'ctc_file_parnt',
60
- 'ctc_file_child',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  );
62
- $this->updates = array();
63
- $this->cache_updates = TRUE;
64
- // setup plugin hooks
65
- add_action('admin_menu', array(&$this, 'admin_menu'));
66
- add_action('admin_enqueue_scripts', array(&$this, 'enqueue_scripts'));
67
- add_action('wp_ajax_ctc_update', array(&$this, 'ajax_save_postdata' ));
68
- add_action('wp_ajax_ctc_query', array(&$this, 'ajax_query_css' ));
69
- //add_action('update_option_' . CHLD_THM_CFG_OPTIONS, array(&$this, 'update_redirect'), 10);
70
  }
71
-
72
- function admin_menu() {
73
- $this->hook = add_management_page($this->pluginName, $this->shortName, 'edit_theme_options', $this->menuName, array(&$this, 'options_panel') );
74
- // only load plugin-specific data
75
- // when ctc page is loaded
76
- add_action( 'load-' . $this->hook, array(&$this, 'ctc_page_init') );
77
- }
78
-
79
- function enqueue_scripts($hook) {
80
- if ($this->hook == $hook):
81
- wp_enqueue_style('chld-thm-cfg-admin', $this->pluginURL . 'css/chld-thm-cfg.css');
82
- wp_enqueue_script('iris');
83
- // wp_enqueue_script('thickbox');
84
- wp_enqueue_script('ctc-thm-cfg-ctcgrad', $this->pluginURL . 'js/ctcgrad.min.js', array('iris'), '1.0');
85
- wp_enqueue_script('chld-thm-cfg-admin', $this->pluginURL . 'js/chld-thm-cfg.min.js',
86
- array('jquery-ui-autocomplete'), '1.0', TRUE);
87
- wp_localize_script( 'chld-thm-cfg-admin', 'ctcAjax',
88
- apply_filters('chld_thm_cfg_localize_script', array(
89
- 'ssl' => is_ssl(),
90
- 'homeurl' => get_home_url(),
91
- 'ajaxurl' => admin_url( 'admin-ajax.php' ),
92
- 'theme_uri' => get_theme_root_uri(),
93
- 'themes' => $this->themes,
94
- 'source' => apply_filters('chld_thm_cfg_source_uri', get_theme_root_uri() . '/'
95
- . $this->css->get_prop('parnt') . '/style.css', $this->css),
96
- 'target' => apply_filters('chld_thm_cfg_target_uri', get_theme_root_uri() . '/'
97
- . $this->css->get_prop('child') . '/style.css', $this->css),
98
- 'parnt' => $this->css->get_prop('parnt'),
99
- 'child' => $this->css->get_prop('child'),
100
- 'addl_css' => $this->css->get_prop('parntss'),
101
- 'imports' => $this->css->get_prop('imports'),
102
- 'rule' => $this->css->get_prop('rule'),
103
- 'sel_ndx' => $this->css->get_prop('sel_ndx'),
104
- 'val_qry' => array(),
105
- 'rule_val' => array(),
106
- 'sel_val' => array(),
107
- 'field_labels' => array(
108
- '_background_url' => __('URL/None', 'chld_thm_cfg'),
109
- '_background_origin' => __('Origin', 'chld_thm_cfg'),
110
- '_background_color1' => __('Color 1', 'chld_thm_cfg'),
111
- '_background_color2' => __('Color 2', 'chld_thm_cfg'),
112
- '_border_width' => __('Width', 'chld_thm_cfg'),
113
- '_border_style' => __('Style', 'chld_thm_cfg'),
114
- '_border_color' => __('Color', 'chld_thm_cfg'),
115
- ),
116
- 'load_txt' => __('Are you sure? This will replace your current settings.', 'chld_thm_cfg'),
117
- 'swatch_txt' => $this->ui->swatch_text,
118
- 'swatch_label' => __('Sample', 'chld_thm_cfg'),
119
- 'important_label' => __('<span style="font-size:10px">!</span>', 'chld_thm_cfg'),
120
- 'selector_txt' => __('Selectors', 'chld_thm_cfg'),
121
- 'close_txt' => __('Close', 'chld_thm_cfg'),
122
- 'edit_txt' => __('Edit', 'chld_thm_cfg'),
123
- 'cancel_txt' => __('Cancel', 'chld_thm_cfg'),
124
- 'rename_txt' => __('Rename', 'chld_thm_cfg'),
125
- 'css_fail_txt' => __('The stylesheet cannot be displayed.', 'chld_thm_cfg'),
126
- 'child_only_txt' => __('(Child Only)', 'chld_thm_cfg'),
127
- 'inval_theme_txt' => __('Please enter a valid Child Theme', 'chld_thm_cfg'),
128
- 'inval_name_txt' => __('Please enter a valid Child Theme name', 'chld_thm_cfg'),
129
- 'theme_exists_txt' => __('<strong>%s</strong> exists. Please enter a different Child Theme', 'chld_thm_cfg'),
130
- )));
131
  endif;
132
  }
133
-
134
- function options_panel() {
135
- $this->ui->render_options();
136
- }
137
 
138
  function ctc_page_init () {
139
  $this->get_themes();
140
  $this->load_config();
141
- do_action('chld_thm_cfg_forms', $this); // hook for custom forms
142
  $this->write_config();
143
- $this->ui = new Child_Theme_Configurator_UI();
144
- $this->ui->render_help_tabs();
 
 
 
 
145
  }
146
 
147
  function get_themes() {
 
148
  $this->themes = array('child' => array(), 'parnt' => array());
149
  foreach (wp_get_themes() as $theme):
150
- $parent = $theme->parent();
151
- if (empty($parent)):
152
- $slug = $theme->get_template();
153
- $this->themes['parnt'][$slug] = array('Name' => $theme->get('Name'));
154
- else:
155
- $slug = $theme->get_stylesheet();
156
- $this->themes['child'][$slug] = array('Name' => $theme->get('Name'), 'Author' => $theme->get('Author'), 'Version' => $theme->get('Version'));
157
- endif;
158
  endforeach;
159
  }
160
 
161
  function validate_post($action = 'ctc_update', $noncefield = '_wpnonce') {
 
162
  return ('POST' == $_SERVER['REQUEST_METHOD']
163
  && current_user_can('edit_theme_options')
164
  && ($this->is_ajax ? check_ajax_referer( $action, $noncefield, FALSE ) : check_admin_referer($action, $noncefield, FALSE )));
@@ -204,204 +249,297 @@ class Child_Theme_Configurator {
204
  }
205
 
206
  function load_config() {
207
- $this->css = new Child_Theme_Configurator_CSS();
208
- if ( FALSE === $this->css->read_config() )
209
- $this->css = get_option(CHLD_THM_CFG_OPTIONS); // backward compatibility with < 1.5.4
210
- if (! is_object($this->css)
211
  || ! $this->check_theme_exists($this->css->get_prop('child'))
212
  || ! $this->check_theme_exists($this->css->get_prop('parnt')) ):
213
- $this->css = new Child_Theme_Configurator_CSS();
214
  $parent = get_template();
215
  $this->css->set_prop('parnt', $parent);
216
  endif;
217
- if ('POST' != $_SERVER['REQUEST_METHOD']):
218
  if ($this->css->get_prop('child')):
 
219
  $this->verify_creds();
220
  $stylesheet = $this->css->get_child_target('style.css');
 
221
  if (!is_writable($stylesheet) && !$this->fs):
222
  add_action('admin_notices', array($this, 'writable_notice'));
223
  endif;
 
 
 
224
  endif;
 
225
  if (fileowner($this->css->get_child_target('')) != fileowner(ABSPATH)):
226
  add_action('admin_notices', array($this, 'owner_notice'));
227
  endif;
228
  endif;
229
  }
230
 
 
 
 
 
 
231
  function write_config() {
232
- if (!isset($_POST['ctc_load_styles'])
233
- && !isset($_POST['ctc_parnt_templates_submit'])
234
- && !isset($_POST['ctc_child_templates_submit'])
235
- && !isset($_POST['ctc_image_submit'])
236
- && !isset($_POST['ctc_theme_image_submit'])
237
- && !isset($_POST['ctc_theme_screenshot_submit'])
238
- && !isset($_POST['ctc_export_child_zip'])
239
- && !isset($_POST['ctc_reset_permission'])
240
- && !isset($_POST['ctc_templates_writable_submit'])
241
- && !isset($_POST['ctc_set_writable'])) return FALSE;
242
- $this->errors = array();
243
- if ($this->validate_post()):
244
- if (isset($_POST['ctc_export_child_zip'])):
245
- $this->export_zip();
246
- $this->errors[] = __('Zip file creation failed.', 'chld_thm_cfg');
247
- else:
248
- if (isset($_POST['ctc_theme_image_submit']) && isset($_FILES['ctc_theme_image'])):
249
- $this->handle_file_upload('ctc_theme_image', $this->imgmimes);
250
- elseif (isset($_POST['ctc_theme_screenshot_submit']) && isset($_FILES['ctc_theme_screenshot'])):
251
- $this->handle_file_upload('ctc_theme_screenshot', $this->imgmimes);
252
  endif;
253
- $args = preg_grep("/nonce/", array_keys($_POST), PREG_GREP_INVERT);
254
- $this->verify_creds($args);
255
-
256
- if ($this->fs):
257
- if (isset($_POST['ctc_load_styles'])):
258
- foreach (array(
259
- 'ctc_theme_parnt',
260
- 'ctc_child_type',
261
- 'ctc_theme_child',
262
- 'ctc_child_name',
263
- 'ctc_configtype',
264
- 'ctc_child_template',
265
- 'ctc_child_author',
266
- 'ctc_child_version') as $postfield):
267
- $varparts = explode('_', $postfield);
268
- $varname = end($varparts);
269
- ${$varname} = empty($_POST[$postfield])?'':sanitize_text_field($_POST[$postfield]);
270
- endforeach;
271
- if ($parnt):
272
- if (! $this->check_theme_exists($parnt)):
273
- $this->errors[] = sprintf(__('%s does not exist. Please select a valid Parent Theme', 'chld_thm_cfg'), $parnt);
274
- endif;
275
- else:
276
- $this->errors[] = __('Please select a valid Parent Theme', 'chld_thm_cfg');
277
- endif;
278
- if ('new' == $type):
279
- if (empty($template) && empty($name)):
280
- $this->errors[] = __('Please enter a valid Child Theme template name', 'chld_thm_cfg');
281
- else:
282
- $configtype = 'theme'; // no custom stylesheets until style.css exists!
283
- add_action('chld_thm_cfg_addl_files', array(&$this, 'add_base_files'), 10, 2);
284
- add_action('chld_thm_cfg_addl_files', array(&$this, 'copy_screenshot'), 10, 2);
285
- $child = strtolower(preg_replace("%[^\w\-]%", '', empty($template) ? $name : $template));
286
- if ($this->check_theme_exists($child)):
287
- $this->errors[] = sprintf(__('<strong>%s</strong> exists. Please enter a different Child Theme template name', 'chld_thm_cfg'), $child);
 
 
 
288
  endif;
289
- endif;
290
- elseif (empty($configtype) || 'theme' == $configtype):
291
- add_action('chld_thm_cfg_addl_files', array(&$this, 'add_base_files'), 10, 2);
292
- add_action('chld_thm_cfg_addl_files', array(&$this, 'copy_screenshot'), 10, 2);
293
- elseif(has_action('chld_thm_cfg_addl_files')):
294
- remove_all_actions('chld_thm_cfg_addl_files');
295
- // back compat for plugins extension
296
- add_action('chld_thm_cfg_addl_files', array(&$this, 'write_addl_files'), 10, 2);
297
- endif;
298
- if (empty($name)):
299
- $name = ucfirst($child);
300
- endif;
301
- if (empty($child)):
302
- $this->errors[] = __('Please enter a valid Child Theme name', 'chld_thm_cfg');
303
- endif;
304
- if (FALSE === $this->verify_child_dir($child)):
305
- $this->errors[] = __('Your theme directories are not writable.', 'chld_thm_cfg');
306
- add_action('admin_notices', array($this, 'writable_notice'));
307
- endif;
308
- if (empty($this->errors)):
309
- $this->css = new Child_Theme_Configurator_CSS();
310
- $this->css->set_prop('parnt', $parnt);
311
- $this->css->set_prop('child', $child);
312
- $this->css->set_prop('child_name', $name);
313
- $this->css->set_prop('child_author', $author);
314
- $this->css->set_prop('child_version', strlen($version) ? $version : '1.0');
315
- $this->css->set_prop('configtype', $configtype);
316
- do_action('chld_thm_cfg_addl_files', $this); // hook for add'l plugin files and subdirectories
317
- $this->css->parse_css_file('parnt');
318
- $this->css->parse_css_file('child');
319
- if (isset($_POST['ctc_additional_css']) && is_array($_POST['ctc_additional_css'])):
320
- $this->css->parentss = array();
321
- foreach ($_POST['ctc_additional_css'] as $file):
322
- $this->css->parse_css_file('parnt', $file);
323
- $this->css->parntss[] = $file;
324
- endforeach;
325
- endif;
326
- if (FALSE === $this->css->write_css(isset($_POST['ctc_backup']))):
327
- $this->errors[] = __('Your stylesheet is not writable.', 'chld_thm_cfg');
328
- add_action('admin_notices', array($this, 'writable_notice'));
329
- return FALSE;
330
- endif;
331
 
332
- // copy parent theme mods
333
- if (isset($_POST['ctc_parent_mods']) && ($parent_mods = get_option('theme_mods_' . $parnt))):
334
- update_option('theme_mods_' . $child, $parent_mods);
335
- endif;
336
- $this->css->save_config();
337
- do_action('chld_thm_cfg_addl_options', $this); // hook for add'l plugin options
338
- $msg = 1; //isset($_POST['ctc_scan_subdirs']) ? '9&tab=import_options' : 1;
339
- endif;
340
- elseif (isset($_POST['ctc_parnt_templates_submit']) && isset($_POST['ctc_file_parnt'])):
341
- foreach ($_POST['ctc_file_parnt'] as $file):
342
- $this->copy_parent_file(sanitize_text_field($file));
343
- endforeach;
344
- $msg = '8&tab=file_options';
345
- elseif (isset($_POST['ctc_child_templates_submit']) && isset($_POST['ctc_file_child'])):
346
- foreach ($_POST['ctc_file_child'] as $file):
347
- $this->delete_child_file(sanitize_text_field($file));
348
- endforeach;
349
- $msg = '8&tab=file_options';
350
- elseif (isset($_POST['ctc_image_submit']) && isset($_POST['ctc_img'])):
351
- foreach ($_POST['ctc_img'] as $file):
352
- $this->delete_child_file('images/' . sanitize_text_field($file), 'img');
353
- endforeach;
354
- $msg = '8&tab=file_options';
355
- elseif (isset($_POST['ctc_templates_writable_submit']) && isset($_POST['ctc_file_child'])):
356
- foreach ($_POST['ctc_file_child'] as $file):
357
- $this->set_writable(sanitize_text_field($file));
358
- endforeach;
359
- $msg = '8&tab=file_options';
360
- elseif (isset($_POST['ctc_set_writable'])):
361
- $this->set_writable();
362
- $msg = '8&tab=file_options';
363
- elseif (isset($_POST['ctc_reset_permission'])):
364
- $this->unset_writable();
365
- $msg = '8&tab=file_options';
366
- elseif (isset($_POST['ctc_theme_image_submit']) && isset($_POST['movefile'])):
367
- $this->move_file_upload('images');
368
- $msg = '8&tab=file_options';
369
- elseif (isset($_POST['ctc_theme_screenshot_submit']) && isset($_POST['movefile'])):
370
- // remove old screenshot
371
- foreach(array_keys($this->imgmimes) as $extreg):
372
- foreach (explode('|', $extreg) as $ext):
373
- $this->delete_child_file('screenshot', $ext);
374
- endforeach;
375
- endforeach;
376
- $this->move_file_upload('');
377
- $msg = '8&tab=file_options';
378
- else:
379
- $msg = '8&tab=file_options';
380
- endif;
381
- endif;
382
- endif;
383
- if (empty($this->errors) && empty($this->fs_prompt)):
384
- $this->update_redirect($msg);
385
- endif;
386
- return FALSE;
387
- endif;
388
- $this->errors[] = __('You do not have permission to configure child themes.', 'chld_thm_cfg');
389
  return FALSE;
390
  }
391
 
392
- function render_menu($template = 'child', $selected = null) {
393
- $menu = '<option value="">Select</option>' . LF;
394
- foreach ($this->themes[$template] as $slug => $theme):
395
- $menu .= '<option value="' . $slug . '"' . ($slug == $selected ? ' selected' : '') . '>'
396
- . $slug . ' - "' . $theme['Name'] . '"' . '</option>' . LF;
397
- endforeach;
398
- return $menu;
399
- }
400
-
401
  function check_theme_exists($theme) {
402
  return in_array($theme, array_keys(wp_get_themes()));
403
  }
404
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
405
  /*
406
  * TODO: this is a stub for future use
407
  */
@@ -411,7 +549,7 @@ class Child_Theme_Configurator {
411
 
412
  function update_redirect($msg = 1) {
413
  if (empty($this->is_ajax)):
414
- wp_safe_redirect(admin_url('tools.php?page=' . $this->menuName . '&updated=' . $msg));
415
  die();
416
  endif;
417
  }
@@ -438,20 +576,88 @@ class Child_Theme_Configurator {
438
  }
439
 
440
  function add_base_files($obj){
441
- if (!$this->fs) return FALSE; // return if no filesystem access
442
- global $wp_filesystem;
443
  // add functions.php file
444
- $contents = "<?php\n// Exit if accessed directly\nif ( !defined('ABSPATH')) exit;\n\n/* Add custom functions below */";
 
 
 
445
  if (FALSE === $this->write_child_file('functions.php', $contents)
446
  || FALSE === $this->write_child_file('style.css', $this->css->get_css_header())) return FALSE;
447
  }
448
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
449
  function write_child_file($file, $contents) {
450
  if (!$this->fs) return FALSE; // return if no filesystem access
451
  global $wp_filesystem;
452
  $file = $this->fspath($this->css->is_file_ok($this->css->get_child_target($file), 'write'));
453
  if ($file && !$wp_filesystem->exists($file)):
454
- if (FALSE === $wp_filesystem->put_contents($file, $contents)) return FALSE;
455
  endif;
456
  }
457
 
@@ -500,15 +706,28 @@ class Child_Theme_Configurator {
500
  endif;
501
  }
502
 
503
- function get_additional_css($parnt) {
504
- $files = array();
505
- foreach ($this->css->recurse_directory(trailingslashit(get_theme_root()) . $parnt) as $file):
506
- $file = $this->theme_basename($parnt, $file);
507
- if ('style.css' != $file) $files[] = $file;
508
- endforeach;
509
- return $files;
 
 
 
 
 
 
 
 
 
 
 
 
 
510
  }
511
-
512
  function theme_basename($theme, $file) {
513
  // if no theme passed, returns theme + file
514
  $themedir = trailingslashit(get_theme_root()) . ('' == $theme ? '' : trailingslashit($theme));
@@ -643,7 +862,9 @@ class Child_Theme_Configurator {
643
  if (!$this->fs) return FALSE; // return if no filesystem access
644
  global $wp_filesystem;
645
  $source_file = sanitize_text_field($_POST['movefile']);
646
- $target_file = ('' == $subdir ? preg_replace("%^.+(\.\w+)$%", "screenshot$1", basename($source_file)) : trailingslashit($subdir) . basename($source_file));
 
 
647
  if (FALSE !== $this->verify_child_dir(trailingslashit($this->css->get_prop('child')) . $subdir)):
648
  $source_path = $this->fspath($this->uploads_fullpath($source_file));
649
  if ($target_path = $this->css->is_file_ok($this->css->get_child_target($target_file), 'write')):
@@ -656,6 +877,7 @@ class Child_Theme_Configurator {
656
 
657
  $this->errors[] = __('Could not upload file.', 'chld_thm_cfg');
658
  }
 
659
  function export_zip() {
660
  if (($child = $this->css->get_prop('child'))
661
  && ($dir = $this->css->is_file_ok(dirname($this->css->get_child_target()), 'search'))
@@ -691,7 +913,7 @@ class Child_Theme_Configurator {
691
  //fs prompt does not support arrays as post data - serialize arrays
692
  $this->serialize_postarrays();
693
  // generate callback url
694
- $url = wp_nonce_url('tools.php?page=' . $this->menuName, 'ctc_update', '_wpnonce');
695
  // buffer output so we can process prior to http header
696
  ob_start();
697
  if ($creds = request_filesystem_credentials($url, '', FALSE, FALSE, $args)):
@@ -736,7 +958,7 @@ class Child_Theme_Configurator {
736
  <p><?php _e( 'Child Theme Configurator is unable to write to the stylesheet. This can be resolved using one of the following options:<ol>', 'chld_thm_cfg');
737
  if (isset($_SERVER['SERVER_SOFTWARE']) && preg_match('%unix%i',$_SERVER['SERVER_SOFTWARE'])):
738
  _e('<li>Temporarily make the stylesheet writable by clicking the button below. You should change this back when you are finished editing for security by clicking "Make read-only" under the "Files" tab.</li>', 'chld_thm_cfg');
739
- ?><form action="" method="post"><?php wp_nonce_field( 'ctc_update' ); ?>
740
  <input name="ctc_set_writable" class="button" type="submit" value="<?php _e('Temporarily make stylesheet writable', 'chld_thm_cfg'); ?>"/></form><?php endif;
741
  _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>', 'chld_thm_cfg');
742
  if (isset($_SERVER['SERVER_SOFTWARE']) && preg_match('%iis%i',$_SERVER['SERVER_SOFTWARE']))
@@ -752,11 +974,19 @@ class Child_Theme_Configurator {
752
  ?>
753
  <div class="update-nag">
754
  <p><?php _e( 'This Child Theme is not owned by your website account. It may have been created by a prior version of this plugin or by another program. Moving forward, it must be owned by your website account to make changes. Child Theme Configurator will attempt to correct this when you click the button below.', 'chld_thm_cfg') ?></p>
755
- <form action="" method="post"><?php wp_nonce_field( 'ctc_update' ); ?>
756
  <input name="ctc_reset_permission" class="button" type="submit" value="<?php _e('Correct Child Theme Permissions', 'chld_thm_cfg'); ?>"/></form> </div>
757
  <?php
758
  }
759
 
 
 
 
 
 
 
 
 
760
  // back compatibility function for plugins extension
761
  function write_addl_files($chld_thm_cfg) {
762
  global $chld_thm_cfg_plugins;
6
  Class: Child_Theme_Configurator
7
  Plugin URI: http://www.lilaeamedia.com/plugins/child-theme-configurator/
8
  Description: Main Controller Class
9
+ Version: 1.6.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 Lilaea Media
16
  */
17
+ class ChildThemeConfiguratorAdmin {
 
 
18
 
19
  var $css;
20
+ var $pluginPath;
21
+ var $pluginURL;
22
  var $menuName;
 
 
 
23
  var $ns;
24
  var $ui;
25
  var $themes;
27
  var $hook;
28
  var $is_ajax;
29
  var $updated;
 
30
  var $uploadsubdir;
31
+ var $files;
32
  var $fs;
33
  var $fs_prompt;
34
  var $fs_method;
35
+ var $postarrays = array(
36
+ 'ctc_img',
37
+ 'ctc_file_parnt',
38
+ 'ctc_file_child',
39
+ );
40
+ var $configfields = array(
41
+ 'theme_parnt',
42
+ 'child_type',
43
+ 'theme_child',
44
+ 'child_name',
45
+ 'configtype',
46
+ 'child_template',
47
+ 'child_author',
48
+ 'child_version',
49
+ 'revert'
50
+ );
51
+ var $actionfields = array(
52
+ 'load_styles',
53
+ 'parnt_templates_submit',
54
+ 'child_templates_submit',
55
+ 'image_submit',
56
+ 'theme_image_submit',
57
+ 'theme_screenshot_submit',
58
+ 'export_child_zip',
59
+ 'reset_permission',
60
+ 'templates_writable_submit',
61
+ 'set_writable'
62
+ );
63
+ var $imgmimes = array(
64
  'jpg|jpeg|jpe' => 'image/jpeg',
65
  'gif' => 'image/gif',
66
  'png' => 'image/png',
67
  );
68
+ var $excludes = array(
69
+ 'inc',
70
+ 'core',
71
+ 'lang',
72
+ 'css',
73
+ 'js',
74
+ 'lib',
75
+ 'theme',
76
+ 'options'
77
+ );
78
+ var $updates = array();
79
+ var $cache_updates = TRUE;
80
+ var $swatch_text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
81
+
82
+ function __construct($file) {
83
+ $this->pluginPath = trailingslashit( dirname( $file ) );
84
+ $this->pluginURL = plugin_dir_url($file);
85
+ $this->menuName = CHLD_THM_CFG_MENU; // backward compatability for plugins extension
86
+ }
87
+ function render() {
88
+ $this->ui->render();
89
+ }
90
+ function enqueue_scripts() {
91
+ wp_enqueue_style('chld-thm-cfg-admin', $this->pluginURL . 'css/chld-thm-cfg.css', array(), '1.6.0');
92
+
93
+ // we need to use jQuery UI from CDN until 4.1 is released because jqeury-ui-selectmenu is not included
94
+ // this will be updated in a later release to use WP Core scripts
95
+ wp_deregister_script('jquery-ui-core');
96
+ wp_enqueue_script('jquery-ui-core', '//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js', array('jquery'));
97
+ wp_enqueue_script('ctc-thm-cfg-ctcgrad', $this->pluginURL . 'js/ctcgrad.min.js', array('jquery'), FALSE, TRUE);
98
+ wp_enqueue_script('chld-thm-cfg-admin', $this->pluginURL . 'js/chld-thm-cfg.min.js',
99
+ array(
100
+ // 'jquery-ui-autocomplete', FIXME: restore after 4.1
101
+ // 'jquery-ui-selectmenu', FIXME: restore after 4.1
102
+ 'iris',
103
+ ), FALSE, TRUE );
104
+ $localize_array = apply_filters('chld_thm_cfg_localize_script', array(
105
+ 'ssl' => is_ssl(),
106
+ 'homeurl' => get_home_url(),
107
+ 'ajaxurl' => admin_url( 'admin-ajax.php' ),
108
+ 'theme_uri' => get_theme_root_uri(),
109
+ 'page' => CHLD_THM_CFG_MENU,
110
+ 'themes' => $this->themes,
111
+ 'source' => apply_filters('chld_thm_cfg_source_uri', get_theme_root_uri() . '/'
112
+ . $this->css->get_prop('parnt') . '/style.css', $this->css),
113
+ 'target' => apply_filters('chld_thm_cfg_target_uri', get_theme_root_uri() . '/'
114
+ . $this->css->get_prop('child') . '/style.css', $this->css),
115
+ 'parnt' => $this->css->get_prop('parnt'),
116
+ 'child' => $this->css->get_prop('child'),
117
+ 'addl_css' => $this->css->get_prop('parntss'),
118
+ 'imports' => $this->css->get_prop('imports'),
119
+ 'rule' => $this->css->get_prop('rule'),
120
+ 'sel_ndx' => $this->css->get_prop('sel_ndx'),
121
+ 'val_qry' => array(),
122
+ 'rule_val' => array(),
123
+ 'sel_val' => array(),
124
+ 'field_labels' => array(
125
+ '_background_url' => __('URL/None', 'chld_thm_cfg'),
126
+ '_background_origin' => __('Origin', 'chld_thm_cfg'),
127
+ '_background_color1' => __('Color 1', 'chld_thm_cfg'),
128
+ '_background_color2' => __('Color 2', 'chld_thm_cfg'),
129
+ '_border_width' => __('Width', 'chld_thm_cfg'),
130
+ '_border_style' => __('Style', 'chld_thm_cfg'),
131
+ '_border_color' => __('Color', 'chld_thm_cfg'),
132
+ ),
133
+ 'load_txt' => __('Are you sure? This will replace your current settings.', 'chld_thm_cfg'),
134
+ 'swatch_txt' => $this->swatch_text,
135
+ 'swatch_label' => __('Sample', 'chld_thm_cfg'),
136
+ 'important_label' => __('<span style="font-size:10px">!</span>', 'chld_thm_cfg'),
137
+ 'selector_txt' => __('Selectors', 'chld_thm_cfg'),
138
+ 'close_txt' => __('Close', 'chld_thm_cfg'),
139
+ 'edit_txt' => __('Edit', 'chld_thm_cfg'),
140
+ 'cancel_txt' => __('Cancel', 'chld_thm_cfg'),
141
+ 'rename_txt' => __('Rename', 'chld_thm_cfg'),
142
+ 'css_fail_txt' => __('The stylesheet cannot be displayed.', 'chld_thm_cfg'),
143
+ 'child_only_txt' => __('(Child Only)', 'chld_thm_cfg'),
144
+ 'inval_theme_txt' => __('Please enter a valid Child Theme', 'chld_thm_cfg'),
145
+ 'inval_name_txt' => __('Please enter a valid Child Theme name', 'chld_thm_cfg'),
146
+ 'theme_exists_txt' => __('<strong>%s</strong> exists. Please enter a different Child Theme', 'chld_thm_cfg'),
147
+ ) );
148
+ wp_localize_script(
149
+ 'chld-thm-cfg-admin',
150
+ 'ctcAjax',
151
+ $localize_array
152
  );
 
 
 
 
 
 
 
 
153
  }
154
+
155
+ function load_imports() {
156
+ // allows fonts and other externals to be previewed
157
+ // loads early not to conflict with admin stylesheets
158
+ $regex = "/\@import *(url)? *\( *['\"]?((https?:\/\/)?(.+?))['\"]? *\).*$/";
159
+ if ($imports = $this->css->get_prop('imports')):
160
+ $count = 1;
161
+ foreach ($imports as $import):
162
+ preg_match($regex, $import, $matches);
163
+ if (empty($matches[3]) && !empty($matches[4])): // relative filepath
164
+ $url = get_stylesheet_directory_uri();
165
+ preg_replace("#\.\./#", '', $matches[4], -1, $count);
166
+ for($i = 0; $i < $count; $i++):
167
+ $url = dirname($url);
168
+ endfor;
169
+ $import = preg_replace($regex, '@import url(' . trailingslashit($url) . $matches[4] . ')', $import);
170
+ endif;
171
+ wp_enqueue_style('chld-thm-cfg-admin' . ++$count, preg_replace($regex, "$2", $import));
172
+ //echo preg_replace($regex, "<link rel='stylesheet' href=\"$2\" type='text/css' />", $import) . "\n";
173
+ endforeach;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
174
  endif;
175
  }
 
 
 
 
176
 
177
  function ctc_page_init () {
178
  $this->get_themes();
179
  $this->load_config();
180
+ do_action( 'chld_thm_cfg_forms', $this ); // hook for custom forms
181
  $this->write_config();
182
+ include_once($this->pluginPath . 'includes/class-ctc-ui.php');
183
+ $this->ui = new ChildThemeConfiguratorUI();
184
+ $this->ui->render_help_content();
185
+ add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'));
186
+ // $this->enqueue_scripts();
187
+ $this->load_imports();
188
  }
189
 
190
  function get_themes() {
191
+ // create cache of theme info
192
  $this->themes = array('child' => array(), 'parnt' => array());
193
  foreach (wp_get_themes() as $theme):
194
+ $group = $theme->parent() ? 'child' : 'parnt';
195
+ $slug = $theme->get_stylesheet();
196
+ $this->themes[$group][$slug] = array(
197
+ 'Name' => $theme->get('Name'),
198
+ 'Author' => $theme->get('Author'),
199
+ 'Version' => $theme->get('Version'),
200
+ 'screenshot' => $theme->get_screenshot(),
201
+ );
202
  endforeach;
203
  }
204
 
205
  function validate_post($action = 'ctc_update', $noncefield = '_wpnonce') {
206
+ // security: request must be post, user must have permission, referrer must be local and nonce must match
207
  return ('POST' == $_SERVER['REQUEST_METHOD']
208
  && current_user_can('edit_theme_options')
209
  && ($this->is_ajax ? check_ajax_referer( $action, $noncefield, FALSE ) : check_admin_referer($action, $noncefield, FALSE )));
249
  }
250
 
251
  function load_config() {
252
+ include_once($this->pluginPath . 'includes/class-ctc-css.php');
253
+ $this->css = new ChildThemeConfiguratorCSS();
254
+ // if not new format or themes do not exist reinitialize
255
+ if ( FALSE === $this->css->read_config()
256
  || ! $this->check_theme_exists($this->css->get_prop('child'))
257
  || ! $this->check_theme_exists($this->css->get_prop('parnt')) ):
258
+ $this->css = new ChildThemeConfiguratorCSS();
259
  $parent = get_template();
260
  $this->css->set_prop('parnt', $parent);
261
  endif;
262
+ if ('GET' == strtoupper($_SERVER['REQUEST_METHOD'])):
263
  if ($this->css->get_prop('child')):
264
+ // get filesystem credentials if available
265
  $this->verify_creds();
266
  $stylesheet = $this->css->get_child_target('style.css');
267
+ // check file permissions
268
  if (!is_writable($stylesheet) && !$this->fs):
269
  add_action('admin_notices', array($this, 'writable_notice'));
270
  endif;
271
+ // check for first run, enqueue flag will be null for anyone coming from < 1.6.0
272
+ if (!isset($this->css->enqueue))
273
+ add_action('admin_notices', array($this, 'enqueue_notice'));
274
  endif;
275
+ // check if file ownership is messed up from old version or other plugin
276
  if (fileowner($this->css->get_child_target('')) != fileowner(ABSPATH)):
277
  add_action('admin_notices', array($this, 'owner_notice'));
278
  endif;
279
  endif;
280
  }
281
 
282
+ /***
283
+ * Handles processing for all form submissions.
284
+ * Older versions ( < 1.6.0 ) had grown too spaghetti-like so we moved conditions
285
+ * to switch statement with the main setup logic in a separate function.
286
+ */
287
  function write_config() {
288
+ // make sure this is a post
289
+ if ('POST' == strtoupper($_SERVER['REQUEST_METHOD'])):
290
+ // see if a valid action was passed
291
+ foreach ($this->actionfields as $action):
292
+ if ( in_array( 'ctc_' . $action, array_keys( $_POST ) ) ):
293
+ $actionfield = $action;
294
+ break;
 
 
 
 
 
 
 
 
 
 
 
 
 
295
  endif;
296
+ endforeach;
297
+ if (empty($actionfield)) return FALSE;
298
+
299
+ // make sure post passes security checkpoint
300
+ $this->errors = array();
301
+ if ($this->validate_post()):
302
+ // zip export does not require filesystem access so check that first
303
+ if ( 'export_child_zip' == $actionfield ):
304
+ $this->export_zip();
305
+ // if we get here the zip failed
306
+ $this->errors[] = __('Zip file creation failed.', 'chld_thm_cfg');
307
+ // all other actions require filesystem access
308
+ else:
309
+ // handle uploaded file before checking filesystem
310
+ if ( 'theme_image_submit' == $actionfield && isset($_FILES['ctc_theme_image'])):
311
+ $this->handle_file_upload('ctc_theme_image', $this->imgmimes);
312
+ elseif ( 'theme_screenshot_submit' == $actionfield && isset($_FILES['ctc_theme_screenshot'])):
313
+ $this->handle_file_upload('ctc_theme_screenshot', $this->imgmimes);
314
+ endif;
315
+ // now we need to check filesystem access
316
+ $args = preg_grep("/nonce/", array_keys($_POST), PREG_GREP_INVERT);
317
+ $this->verify_creds($args);
318
+ if ($this->fs):
319
+ $msg = FALSE;
320
+ // we have filesystem access so proceed with specific actions
321
+ switch( $actionfield ):
322
+ case 'load_styles':
323
+ // main child theme setup function
324
+ $msg = $this->setup_child_theme();
325
+ break;
326
+
327
+ case 'parnt_templates_submit':
328
+ // copy parent templates to child
329
+ if ( isset( $_POST['ctc_file_parnt'] ) ):
330
+ foreach ($_POST['ctc_file_parnt'] as $file):
331
+ $this->copy_parent_file(sanitize_text_field($file));
332
+ endforeach;
333
+ $msg = '8&tab=file_options';
334
  endif;
335
+ break;
336
+
337
+ case 'child_templates_submit':
338
+ // delete child theme files
339
+ if ( isset( $_POST['ctc_file_child'] ) ):
340
+ if (in_array('functions', $_POST['ctc_file_child'])):
341
+ $this->errors[] = __('The Functions file is required and cannot be deleted.', 'chld_thm_cfg');
342
+ else:
343
+ foreach ($_POST['ctc_file_child'] as $file):
344
+ $this->delete_child_file(sanitize_text_field($file),
345
+ (0 === strpos($file, 'style') ? 'css' : 'php'));
346
+ endforeach;
347
+ $msg = '8&tab=file_options';
348
+ endif;
349
+ endif;
350
+ break;
351
+
352
+ case 'image_submit':
353
+ // delete child theme images
354
+ if ( isset( $_POST['ctc_img'] ) ):
355
+ foreach ($_POST['ctc_img'] as $file):
356
+ $this->delete_child_file('images/' . sanitize_text_field($file), 'img');
357
+ endforeach;
358
+ $msg = '8&tab=file_options';
359
+ endif;
360
+ break;
361
+
362
+ case 'templates_writable_submit':
363
+ // make specific files writable ( systems not running suExec )
364
+ if ( isset($_POST['ctc_file_child'] ) ):
365
+ foreach ($_POST['ctc_file_child'] as $file):
366
+ $this->set_writable(sanitize_text_field($file), (0 === strpos($file, 'style') ? 'css' : 'php'));
367
+ endforeach;
368
+ $msg = '8&tab=file_options';
369
+ endif;
370
+ break;
371
+
372
+ case 'set_writable':
373
+ // make child theme writable ( systems not running suExec )
374
+ $this->set_writable();
375
+ $msg = '8&tab=file_options';
376
+ break;
377
 
378
+ case 'reset_permission':
379
+ // make child theme read-only ( systems not running suExec )
380
+ $this->unset_writable();
381
+ $msg = '8&tab=file_options';
382
+ break;
383
+
384
+ case 'theme_image_submit':
385
+ // move uploaded child theme images (now we have filesystem access)
386
+ if ( isset($_POST['movefile'] ) ):
387
+ $this->move_file_upload('images');
388
+ $msg = '8&tab=file_options';
389
+ endif;
390
+ break;
391
+
392
+ case 'theme_screenshot_submit':
393
+ // move uploaded child theme screenshot (now we have filesystem access)
394
+ if ( isset($_POST['movefile'] ) ):
395
+ // remove old screenshot
396
+ foreach(array_keys($this->imgmimes) as $extreg):
397
+ foreach (explode('|', $extreg) as $ext):
398
+ $this->delete_child_file('screenshot', $ext);
399
+ endforeach;
400
+ endforeach;
401
+ $this->move_file_upload('');
402
+ $msg = '8&tab=file_options';
403
+ endif;
404
+ break;
405
+
406
+ default:
407
+ // assume we are on the files tab so just redirect there
408
+ $msg = '8&tab=file_options';
409
+ endswitch;
410
+ endif; // end filesystem condition
411
+ endif; // end zip export condition
412
+ if (empty($this->errors) && empty($this->fs_prompt))
413
+ // no errors so we redirect with confirmation message
414
+ $this->update_redirect($msg);
415
+ // otherwise fail gracefully
416
+ $msg = NULL;
417
+ return FALSE;
418
+ endif; // end post validation condition
419
+ // if you end up here you are not welcome
420
+ $msg = NULL;
421
+ $this->errors[] = __('You do not have permission to configure child themes.', 'chld_thm_cfg');
422
+ endif; // end request method condition
 
 
 
 
 
 
 
 
 
 
 
 
423
  return FALSE;
424
  }
425
 
 
 
 
 
 
 
 
 
 
426
  function check_theme_exists($theme) {
427
  return in_array($theme, array_keys(wp_get_themes()));
428
  }
429
 
430
+ /***
431
+ * Handle the creation or update of a child theme
432
+ */
433
+ function setup_child_theme() {
434
+
435
+ // sanitize and extract config fields into local vars
436
+ foreach ($this->configfields as $configfield):
437
+ $varparts = explode('_', $configfield);
438
+ $varname = end($varparts);
439
+ ${$varname} = empty($_POST['ctc_' . $configfield]) ? '' : sanitize_text_field($_POST['ctc_' . $configfield]);
440
+ endforeach;
441
+
442
+ // check that all requirements are met
443
+ if ($parnt):
444
+ if (! $this->check_theme_exists($parnt)):
445
+ $this->errors[] = sprintf(__('%s does not exist. Please select a valid Parent Theme', 'chld_thm_cfg'), $parnt);
446
+ endif;
447
+ else:
448
+ $this->errors[] = __('Please select a valid Parent Theme', 'chld_thm_cfg');
449
+ endif;
450
+ // if this is a shiny brand new child theme certain rules apply
451
+ if ('new' == $type):
452
+ if (empty($template) && empty($name)):
453
+ $this->errors[] = __('Please enter a valid Child Theme template name', 'chld_thm_cfg');
454
+ else:
455
+ $configtype = 'theme'; // no custom stylesheets until style.css exists!
456
+ $child = strtolower(preg_replace("%[^\w\-]%", '', empty($template) ? $name : $template));
457
+ if ($this->check_theme_exists($child)):
458
+ $this->errors[] = sprintf(__('<strong>%s</strong> exists. Please enter a different Child Theme template name', 'chld_thm_cfg'), $child);
459
+ else:
460
+ add_action( 'chld_thm_cfg_addl_files', array( &$this, 'add_base_files' ), 10, 2);
461
+ add_action( 'chld_thm_cfg_addl_files', array( &$this, 'copy_screenshot' ), 10, 2);
462
+ add_action( 'chld_thm_cfg_addl_files', array( &$this, 'enqueue_parent_css' ), 15, 2);
463
+ endif;
464
+ endif;
465
+ // check if we have additional files from a plugin extension. if so, we have to override
466
+ // function to support wp_filesystem requirements
467
+ elseif (empty($configtype) || 'theme' == $configtype):
468
+ // no configtype means this is either from this plugin or a plugin after 1.5.0
469
+ add_action( 'chld_thm_cfg_addl_files', array( &$this, 'add_base_files' ), 10, 2);
470
+ add_action( 'chld_thm_cfg_addl_files', array( &$this, 'copy_screenshot' ), 10, 2);
471
+ add_action( 'chld_thm_cfg_addl_files', array( &$this, 'enqueue_parent_css' ), 15, 2);
472
+ elseif(has_action( 'chld_thm_cfg_addl_files' )):
473
+ // action exists so we have to hijack it to use new filesystem checks
474
+ remove_all_actions( 'chld_thm_cfg_addl_files' );
475
+ // back compat for plugins extension
476
+ add_action('chld_thm_cfg_addl_files', array( &$this, 'write_addl_files' ), 10, 2);
477
+ endif;
478
+
479
+ if (empty($name)):
480
+ $name = ucfirst($child);
481
+ endif;
482
+
483
+ if (empty($child)):
484
+ $this->errors[] = __('Please enter a valid Child Theme directory', 'chld_thm_cfg');
485
+ endif;
486
+
487
+ if (FALSE === $this->verify_child_dir($child)):
488
+ $this->errors[] = __('Your theme directories are not writable.', 'chld_thm_cfg');
489
+ add_action('admin_notices', array($this, 'writable_notice'));
490
+ endif;
491
+
492
+ // if no errors so far, we are good to create child theme
493
+ if (empty($this->errors)):
494
+ $this->css = new ChildThemeConfiguratorCSS();
495
+ $this->css->set_prop('parnt', $parnt);
496
+ $this->css->set_prop('child', $child);
497
+ $this->css->set_prop('child_name', $name);
498
+ $this->css->set_prop('child_author', $author);
499
+ $this->css->set_prop('child_version', strlen($version) ? $version : '1.0');
500
+ $this->css->set_prop('configtype', $configtype);
501
+
502
+ // hook for add'l plugin files and subdirectories
503
+ do_action('chld_thm_cfg_addl_files', $this);
504
+
505
+ // always parse parent stylesheet
506
+ $this->css->parse_css_file('parnt');
507
+
508
+ // parse child stylesheet, backup or skip (to reset)
509
+ $this->css->parse_css_file('child', $revert);
510
+
511
+ // parse additional stylesheets
512
+ if (isset($_POST['ctc_additional_css']) && is_array($_POST['ctc_additional_css'])):
513
+ $this->css->parentss = array();
514
+ foreach ($_POST['ctc_additional_css'] as $file):
515
+ $this->css->parse_css_file('parnt', $file);
516
+ $this->css->parntss[] = $file;
517
+ endforeach;
518
+ endif;
519
+
520
+ // try to write new stylsheet. If it fails send alert.
521
+ if (FALSE === $this->css->write_css(isset($_POST['ctc_backup']))):
522
+ $this->errors[] = __('Your stylesheet is not writable.', 'chld_thm_cfg');
523
+ add_action('admin_notices', array($this, 'writable_notice'));
524
+ return FALSE;
525
+ endif;
526
+
527
+ // copy parent theme mods
528
+ if (isset($_POST['ctc_parent_mods']) && ($parent_mods = get_option('theme_mods_' . $parnt))):
529
+ update_option('theme_mods_' . $child, $parent_mods);
530
+ endif;
531
+
532
+ // save new object to WP options table
533
+ $this->css->save_config();
534
+
535
+ // hoock for add'l plugin options
536
+ do_action('chld_thm_cfg_addl_options', $this); // hook for add'l plugin options
537
+
538
+ // return message id 1, which says new child theme created successfull;
539
+ return 1; //isset($_POST['ctc_scan_subdirs']) ? '9&tab=import_options' : 1;
540
+ endif;
541
+ return FALSE;
542
+ }
543
  /*
544
  * TODO: this is a stub for future use
545
  */
549
 
550
  function update_redirect($msg = 1) {
551
  if (empty($this->is_ajax)):
552
+ wp_safe_redirect(admin_url('tools.php?page=' . CHLD_THM_CFG_MENU . '&updated=' . $msg));
553
  die();
554
  endif;
555
  }
576
  }
577
 
578
  function add_base_files($obj){
 
 
579
  // add functions.php file
580
+ $contents = "<?php
581
+ // Exit if accessed directly
582
+ if ( !defined('ABSPATH')) exit;
583
+ ";
584
  if (FALSE === $this->write_child_file('functions.php', $contents)
585
  || FALSE === $this->write_child_file('style.css', $this->css->get_css_header())) return FALSE;
586
  }
587
 
588
+ function enqueue_parent_code(){
589
+ return explode("\n", apply_filters('chld_thm_cfg_enqueue_parent', "
590
+ if (!function_exists('chld_thm_cfg_parent_css')):
591
+ function chld_thm_cfg_parent_css() {
592
+ wp_enqueue_style('chld_thm_cfg_parent', get_template_directory_uri() . '/style.css');
593
+ }
594
+ endif;
595
+ add_action('wp_enqueue_scripts', 'chld_thm_cfg_parent_css');
596
+ "));
597
+ }
598
+
599
+ function enqueue_parent_css($obj) {
600
+ if (isset($_POST['ctc_parent_enqueue']))
601
+ $this->css->enqueue = sanitize_text_field($_POST['ctc_parent_enqueue']);
602
+ $marker = 'ENQUEUE PARENT ACTION';
603
+ $insertion = 'enqueue' == $this->css->enqueue ? $this->enqueue_parent_code() : array();
604
+ if ($filename = $this->css->is_file_ok($this->css->get_child_target('functions.php'), 'write')):
605
+ $this->insert_with_markers( $filename, $marker, $insertion );
606
+ endif;
607
+ }
608
+
609
+ /**
610
+ * we would have used WP's insert_with_markers function,
611
+ * but it does not use wp_filesystem API!!!???
612
+ */
613
+ function insert_with_markers( $filename, $marker, $insertion ) {
614
+ if (!$this->fs) return FALSE; // return if no filesystem access
615
+ global $wp_filesystem;
616
+ if(!$wp_filesystem->exists($this->fspath($filename))):
617
+ $markerdata = FALSE;
618
+ else:
619
+ // get_contents_array returns extra linefeeds so just split it ourself
620
+ $markerdata = explode("\n", $wp_filesystem->get_contents( $this->fspath( $filename ) ) );
621
+ endif;
622
+ $newfile = '';
623
+ $foundit = false;
624
+ if ( $markerdata ) {
625
+ $state = true;
626
+ foreach ( $markerdata as $n => $markerline ) {
627
+ if (strpos($markerline, '// BEGIN ' . $marker) !== false)
628
+ $state = false;
629
+ if ( $state ):
630
+ if ( $n + 1 < count( $markerdata ) )
631
+ $newfile .= "{$markerline}\n";
632
+ else
633
+ $newfile .= "{$markerline}";
634
+ endif;
635
+ if (strpos($markerline, '// END ' . $marker) !== false):
636
+ $newfile .= "// BEGIN {$marker}\n";
637
+ if ( is_array( $insertion ))
638
+ foreach ( $insertion as $insertline )
639
+ $newfile .= "{$insertline}\n";
640
+ $newfile .= "// END {$marker}\n";
641
+ $state = true;
642
+ $foundit = true;
643
+ endif;
644
+ }
645
+ }
646
+ if (!$foundit) {
647
+ $newfile .= "\n// BEGIN {$marker}\n";
648
+ foreach ( $insertion as $insertline )
649
+ $newfile .= "{$insertline}\n";
650
+ $newfile .= "// END {$marker}\n";
651
+ }
652
+ if (FALSE === $wp_filesystem->put_contents($this->fspath($filename), $newfile)) return FALSE;
653
+ }
654
+
655
  function write_child_file($file, $contents) {
656
  if (!$this->fs) return FALSE; // return if no filesystem access
657
  global $wp_filesystem;
658
  $file = $this->fspath($this->css->is_file_ok($this->css->get_child_target($file), 'write'));
659
  if ($file && !$wp_filesystem->exists($file)):
660
+ if (FALSE === $wp_filesystem->put_contents($file, $contents)) return FALSE;
661
  endif;
662
  }
663
 
706
  endif;
707
  }
708
 
709
+ function get_files($theme, $type = 'template') {
710
+ if (!isset($this->files[$theme])):
711
+ $this->files[$theme] = array();
712
+ $imgext = '(' . implode('|', array_keys($this->imgmimes)) . ')';
713
+ foreach ($this->css->recurse_directory(
714
+ trailingslashit(get_theme_root()) . $theme, '', TRUE) as $file):
715
+ $file = $this->theme_basename($theme, $file);
716
+ if (preg_match("/^style\-(\d+)\.css$/", $file, $matches)):
717
+ $date = date_i18n('D, j M Y g:i A', strtotime($matches[1]));
718
+ $this->files[$theme]['backup'][$file] = $date;
719
+ elseif (preg_match("/\.php$/", $file)):
720
+ $this->files[$theme]['template'][] = $file;
721
+ elseif (preg_match("/\.css$/", $file) && 'style.css' != $file):
722
+ $this->files[$theme]['stylesheet'][] = $file;
723
+ elseif (preg_match("/^images\/.+?\." . $imgext . "$/", $file)):
724
+ $this->files[$theme]['img'][] = $file;
725
+ endif;
726
+ endforeach;
727
+ endif;
728
+ return isset($this->files[$theme][$type]) ? $this->files[$theme][$type] : array();
729
  }
730
+
731
  function theme_basename($theme, $file) {
732
  // if no theme passed, returns theme + file
733
  $themedir = trailingslashit(get_theme_root()) . ('' == $theme ? '' : trailingslashit($theme));
862
  if (!$this->fs) return FALSE; // return if no filesystem access
863
  global $wp_filesystem;
864
  $source_file = sanitize_text_field($_POST['movefile']);
865
+ $target_file = ('' == $subdir ?
866
+ preg_replace("%^.+(\.\w+)$%", "screenshot$1", basename($source_file)) :
867
+ trailingslashit($subdir) . basename($source_file));
868
  if (FALSE !== $this->verify_child_dir(trailingslashit($this->css->get_prop('child')) . $subdir)):
869
  $source_path = $this->fspath($this->uploads_fullpath($source_file));
870
  if ($target_path = $this->css->is_file_ok($this->css->get_child_target($target_file), 'write')):
877
 
878
  $this->errors[] = __('Could not upload file.', 'chld_thm_cfg');
879
  }
880
+
881
  function export_zip() {
882
  if (($child = $this->css->get_prop('child'))
883
  && ($dir = $this->css->is_file_ok(dirname($this->css->get_child_target()), 'search'))
913
  //fs prompt does not support arrays as post data - serialize arrays
914
  $this->serialize_postarrays();
915
  // generate callback url
916
+ $url = wp_nonce_url('tools.php?page=' . CHLD_THM_CFG_MENU, 'ctc_update', '_wpnonce');
917
  // buffer output so we can process prior to http header
918
  ob_start();
919
  if ($creds = request_filesystem_credentials($url, '', FALSE, FALSE, $args)):
958
  <p><?php _e( 'Child Theme Configurator is unable to write to the stylesheet. This can be resolved using one of the following options:<ol>', 'chld_thm_cfg');
959
  if (isset($_SERVER['SERVER_SOFTWARE']) && preg_match('%unix%i',$_SERVER['SERVER_SOFTWARE'])):
960
  _e('<li>Temporarily make the stylesheet writable by clicking the button below. You should change this back when you are finished editing for security by clicking "Make read-only" under the "Files" tab.</li>', 'chld_thm_cfg');
961
+ ?><form action="?page=<?php echo CHLD_THM_CFG_MENU; ?>" method="post"><?php wp_nonce_field( 'ctc_update' ); ?>
962
  <input name="ctc_set_writable" class="button" type="submit" value="<?php _e('Temporarily make stylesheet writable', 'chld_thm_cfg'); ?>"/></form><?php endif;
963
  _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>', 'chld_thm_cfg');
964
  if (isset($_SERVER['SERVER_SOFTWARE']) && preg_match('%iis%i',$_SERVER['SERVER_SOFTWARE']))
974
  ?>
975
  <div class="update-nag">
976
  <p><?php _e( 'This Child Theme is not owned by your website account. It may have been created by a prior version of this plugin or by another program. Moving forward, it must be owned by your website account to make changes. Child Theme Configurator will attempt to correct this when you click the button below.', 'chld_thm_cfg') ?></p>
977
+ <form action="?page=<?php echo CHLD_THM_CFG_MENU; ?>" method="post"><?php wp_nonce_field( 'ctc_update' ); ?>
978
  <input name="ctc_reset_permission" class="button" type="submit" value="<?php _e('Correct Child Theme Permissions', 'chld_thm_cfg'); ?>"/></form> </div>
979
  <?php
980
  }
981
 
982
+ function enqueue_notice() {
983
+ ?>
984
+ <div class="update-nag">
985
+ <p><?php _e( 'Child Theme Configurator has changed the way it handles the parent stylesheet. Please set your preferences below and click "Generate Child Theme Files" to update your configuration.', 'chld_thm_cfg') ?></p>
986
+ </div>
987
+ <?php
988
+ }
989
+
990
  // back compatibility function for plugins extension
991
  function write_addl_files($chld_thm_cfg) {
992
  global $chld_thm_cfg_plugins;
includes/forms/at-import.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (!defined('ABSPATH')) exit;
3
+ // @imports Panel
4
+ ?>
5
+
6
+ <div id="import_options_panel"
7
+ class="ctc-option-panel<?php echo 'import_options' == $active_tab ? ' ctc-option-panel-active' : ''; ?>" <?php echo $hidechild; ?>>
8
+ <form id="ctc_import_form" method="post" action="?page=<?php echo CHLD_THM_CFG_MENU; ?>">
9
+ <?php wp_nonce_field( 'ctc_update' ); ?>
10
+ <div class="ctc-input-row clearfix" id="ctc_child_imports_row">
11
+ <div class="ctc-input-cell"> <strong>
12
+ <?php _e('@import Statements', 'chld_thm_cfg'); ?>
13
+ </strong>
14
+ <div class="ctc-textarea-button-cell" id="ctc_save_imports_cell">
15
+ <input type="button" class="button ctc-save-input" id="ctc_save_imports"
16
+ name="ctc_save_imports" value="<?php _e('Save', 'chld_thm_cfg'); ?>" disabled />
17
+ </div>
18
+ </div>
19
+ <div class="ctc-input-cell-wide">
20
+ <textarea id="ctc_child_imports" name="ctc_child_imports" wrap="off"><?php
21
+ if (!empty($imports)):
22
+ foreach ($imports as $import):
23
+ echo esc_textarea($import . ';' . LF);
24
+ endforeach;
25
+ endif; ?>
26
+ </textarea>
27
+ </div>
28
+ </div>
29
+ </form>
30
+ </div>
includes/forms/backup.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (!defined('ABSPATH')) exit;
3
+ // Backup Input Cell
4
+ ?>
5
+ <label class="ctc-input-cell smaller<?php echo 'child' == $template && !$this->ctc()->fs && is_writable($themeroot . $backup) ? ' writable' : ''; ?>">
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; ?>" /><?php echo __('Backup', 'chld_thm_cfg') . ' ' . $label; ?></label>
includes/forms/file.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (!defined('ABSPATH')) exit;
3
+ // File Input Cell
4
+ ?>
5
+ <label class="ctc-input-cell smaller<?php echo 'child' == $template && !$this->ctc()->fs && is_writable($themeroot . $file) ? ' writable' : ''; ?>">
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>
includes/forms/fileform.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
6
+ if (defined('DISALLOW_FILE_EDIT') && DISALLOW_FILE_EDIT):
7
+ $linktext = __('The Theme editor has been disabled. Template files must be edited offline.', 'chld_thm_cfg');
8
+ $editorlink = '';
9
+ $editorlinkend = '';
10
+ else:
11
+ $linktext = __('Click here to edit template files using the Theme Editor', 'chld_thm_cfg');
12
+ $editorlink = '<a href="' . admin_url('theme-editor.php?theme=' . $this->ctc()->css->get_prop('child'))
13
+ . ('parnt' == $template ? '&file=functions.php' : '') . '" title="' . $linktext . '">';
14
+ $editorlinkend = '</a>';
15
+ endif;
16
+ ?>
17
+ <div class="ctc-input-row clearfix" id="input_row_<?php echo $template; ?>_templates">
18
+ <form id="ctc_<?php echo $template; ?>_templates_form" method="post" action="?page=<?php echo CHLD_THM_CFG_MENU; ?>&amp;tab=file_options">
19
+ <?php wp_nonce_field( 'ctc_update' ); ?>
20
+ <div class="ctc-input-cell"> <strong>
21
+ <?php echo 'parnt' == $template ? __('Parent Templates', 'chld_thm_cfg') : __('Child Theme Files', 'chld_thm_cfg'); ?>
22
+ </strong>
23
+ <?php
24
+ if ('parnt' == $template): ?>
25
+ <p class="howto">
26
+ <?php _e('Copy PHP template files from the parent theme by selecting them here.', 'chld_thm_cfg'); ?>
27
+ </p>
28
+ <p><strong>
29
+ <?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.', 'chld_thm_cfg');?>
30
+ </strong></p>
31
+ <p class="howto"> <?php echo sprintf(__('The %s file is generated separately and cannot be copied here.', 'chld_thm_cfg'),
32
+ $editorlink . '<code>functions.php</code>' . $editorlinkend
33
+ );
34
+ else: ?>
35
+ <p class="howto">
36
+ <?php echo $editorlink . $linktext . $editorlinkend; ?>
37
+ </p>
38
+ <p class="howto">
39
+ <?php
40
+ echo ($this->ctc()->fs ?
41
+ __( 'Delete child theme templates by selecting them here.', 'chld_thm_cfg') :
42
+ __( 'Delete child theme templates or make them writable by selecting them here. Writable files are displayed in <span style="color:red">red</span>.', 'chld_thm_cfg' )
43
+ ); ?>
44
+ </p>
45
+ <?php
46
+ endif;
47
+ ?>
48
+ </div>
49
+ <div class="ctc-input-cell-wide"> <?php echo $inputs; ?></div>
50
+ <div class="ctc-input-cell"> <strong>&nbsp;</strong> </div>
51
+ <div class="ctc-input-cell-wide" style="margin-top:10px;margin-bottom:10px">
52
+ <?php if ('child' == $template && !$this->ctc()->fs): ?>
53
+ <input class="ctc_submit button button-primary" id="ctc_templates_writable_submit"
54
+ name="ctc_templates_writable_submit" type="submit"
55
+ value="<?php _e('Make Selected Writable', 'chld_thm_cfg'); ?>" />&nbsp; &nbsp;
56
+ <?php endif; ?>
57
+ <input class="ctc_submit button button-primary" id="ctc_<?php echo $template; ?>_templates_submit"
58
+ name="ctc_<?php echo $template; ?>_templates_submit" type="submit"
59
+ value="<?php echo ('parnt' == $template ? __('Copy Selected to Child Theme', 'chld_thm_cfg') : __('Delete Selected', 'chld_thm_cfg')); ?>" />
60
+ </div>
61
+ </form>
62
+ </div>
includes/forms/files.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (!defined('ABSPATH')) exit;
3
+ // Files Panel
4
+ ?>
5
+
6
+ <div id="file_options_panel"
7
+ class="ctc-option-panel<?php echo 'file_options' == $active_tab ? ' ctc-option-panel-active' : ''; ?>" <?php echo $hidechild; ?>>
8
+ <?php $this->render_file_form('parnt'); ?>
9
+ <?php $this->render_file_form('child'); ?>
10
+ <?php $this->render_image_form(); ?>
11
+ <div class="ctc-input-row clearfix" id="input_row_theme_image">
12
+ <form id="ctc_theme_image_form" method="post" action="?page=<?php echo CHLD_THM_CFG_MENU; ?>" enctype="multipart/form-data">
13
+ <?php wp_nonce_field( 'ctc_update' ); ?>
14
+ <div class="ctc-input-cell"> <strong>
15
+ <?php _e('Upload New Child Theme Image', 'chld_thm_cfg'); ?>
16
+ </strong>
17
+ <p class="howto">
18
+ <?php _e('Theme images reside under the <code>images</code> directory in your child theme and are meant for stylesheet use only. Use the Media Library for content images.', 'chld_thm_cfg'); ?>
19
+ </p>
20
+ </div>
21
+ <div class="ctc-input-cell-wide">
22
+ <input type="file" id="ctc_theme_image" name="ctc_theme_image" value="" />
23
+ <input class="ctc_submit button button-primary" id="ctc_theme_image_submit"
24
+ name="ctc_theme_image_submit" type="submit"
25
+ value="<?php _e('Upload', 'chld_thm_cfg'); ?>" />
26
+ </div>
27
+ </form>
28
+ </div>
29
+ <?php if ($screenshot = $this->get_theme_screenshot()): ?>
30
+ <div class="ctc-input-row clearfix" id="input_row_screenshot_view">
31
+ <div class="ctc-input-cell"> <strong>
32
+ <?php _e('Child Theme Screenshot', 'chld_thm_cfg'); ?>
33
+ </strong> </div>
34
+ <div class="ctc-input-cell-wide"> <a href="<?php echo $screenshot; ?>" class="thickbox"><img src="<?php echo $screenshot; ?>" height="150" width="200" style="max-height:150px;max-width:200px;width:auto;height:auto" /></a> </div>
35
+ </div>
36
+ <?php endif; ?>
37
+ <div class="ctc-input-row clearfix" id="input_row_screenshot">
38
+ <form id="ctc_screenshot_form" method="post" action="?page=<?php echo CHLD_THM_CFG_MENU; ?>" enctype="multipart/form-data">
39
+ <?php wp_nonce_field( 'ctc_update' ); ?>
40
+ <div class="ctc-input-cell"> <strong>
41
+ <?php _e('Upload New Screenshot', 'chld_thm_cfg'); ?>
42
+ </strong>
43
+ <p class="howto">
44
+ <?php _e('The theme screenshot should be a 4:3 ratio (e.g., 880px x 660px) JPG, PNG or GIF. It will be renamed <code>screenshot</code>.', 'chld_thm_cfg'); ?>
45
+ </p>
46
+ </div>
47
+ <div class="ctc-input-cell-wide">
48
+ <input type="file" id="ctc_theme_screenshot" name="ctc_theme_screenshot" value="" />
49
+ <input class="ctc_submit button button-primary" id="ctc_theme_screenshot_submit"
50
+ name="ctc_theme_screenshot_submit" type="submit"
51
+ value="<?php _e('Upload', 'chld_thm_cfg'); ?>" />
52
+ </div>
53
+ </form>
54
+ </div>
55
+ <div class="ctc-input-row clearfix" id="input_row_screenshot">
56
+ <form id="ctc_export_form" method="post" action="?page=<?php echo CHLD_THM_CFG_MENU; ?>">
57
+ <?php wp_nonce_field( 'ctc_update' ); ?>
58
+ <div class="ctc-input-cell"> <strong>
59
+ <?php _e('Export Child Theme as Zip Archive', 'chld_thm_cfg'); ?>
60
+ </strong> </div>
61
+ <div class="ctc-input-cell-wide">
62
+ <input class="ctc_submit button button-primary" id="ctc_export_child_zip"
63
+ name="ctc_export_child_zip" type="submit"
64
+ value="<?php _e('Export', 'chld_thm_cfg'); ?>" />
65
+ </div>
66
+ </form>
67
+ </div>
68
+ <?php if ('direct' != $this->ctc()->fs_method): ?>
69
+ <div class="ctc-input-row clearfix" id="input_row_permissions">
70
+ <form id="ctc_permission_form" method="post" action="?page=<?php echo CHLD_THM_CFG_MENU; ?>">
71
+ <?php wp_nonce_field( 'ctc_update' ); ?>
72
+ <div class="ctc-input-cell"> <strong>
73
+ <?php _e('Secure Child Theme', 'chld_thm_cfg'); ?>
74
+ </strong>
75
+ <p class="howto">
76
+ <?php _e('Attempt to reset child theme permissions to user ownership and read-only access.', 'chld_thm_cfg'); ?>
77
+ </p>
78
+ </div>
79
+ <div class="ctc-input-cell-wide">
80
+ <input class="ctc_submit button button-primary" id="ctc_reset_permission"
81
+ name="ctc_reset_permission" type="submit"
82
+ value="<?php _e('Make read-only', 'chld_thm_cfg'); ?>" />
83
+ </div>
84
+ </form>
85
+ </div>
86
+ <?php endif; ?>
87
+ </div>
includes/forms/image.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (!defined('ABSPATH')) exit;
3
+ // Image Input Cell
4
+ ?>
5
+ <div class="ctc-input-cell" style="height:100px">
6
+ <label class="smaller">
7
+ <input class="ctc_checkbox" id="ctc_img_<?php echo ++$counter; ?>"
8
+ name="ctc_img[]" type="checkbox"
9
+ value="<?php echo $templatefile; ?>" />
10
+ <?php echo $templatefile; ?></label>
11
+ <br/>
12
+ <a href="<?php echo $themeuri . $file; ?>" class="thickbox"><img src="<?php echo $themeuri . $file . '?' . time(); ?>" height="72" width="72" style="max-height:72px;max-width:100%;width:auto;height:auto" /></a></div>
includes/forms/images.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (!defined('ABSPATH')) exit;
3
+ // Images Section
4
+ ?>
5
+ <div class="ctc-input-row clearfix" id="input_row_images">
6
+ <form id="ctc_image_form" method="post" action="?page=<?php echo CHLD_THM_CFG_MENU; ?>">
7
+ <?php wp_nonce_field( 'ctc_update' ); ?>
8
+ <div class="ctc-input-cell"> <strong>
9
+ <?php _e('Child Theme Images', 'chld_thm_cfg'); ?>
10
+ </strong>
11
+ <p class="howto">
12
+ <?php _e('Delete child theme images by selecting them here.', 'chld_thm_cfg');?>
13
+ </p>
14
+ </div>
15
+ <div class="ctc-input-cell-wide"> <?php echo $inputs; ?> </div>
16
+ <div class="ctc-input-cell"> <strong>&nbsp;</strong> </div>
17
+ <div class="ctc-input-cell-wide" style="margin-top:10px;margin-bottom:10px">
18
+ <input class="ctc_submit button button-primary" id="ctc_image_submit"
19
+ name="ctc_image_submit" type="submit"
20
+ value="<?php _e('Delete Selected', 'chld_thm_cfg'); ?>" disabled />
21
+ </div>
22
+ </form>
23
+ </div>
includes/forms/main.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (!defined('ABSPATH')) exit;
3
+ // main CTC Page
4
+ ?>
5
+ <style type="text/css">
6
+ .ctc-status-icon.success {
7
+ background:url(<?php echo admin_url( 'images/yes.png' );
8
+ ?>) no-repeat;
9
+ }
10
+
11
+ .ctc-status-icon.failure {
12
+ background:url(<?php echo admin_url( 'images/no.png');
13
+ ?>) no-repeat;
14
+ }
15
+
16
+ .ctc-exit {
17
+ background:#f9f9f9 url(<?php echo includes_url('images/xit-2x.gif');
18
+ ?>) left top no-repeat;
19
+ }
20
+ </style>
21
+ <div class="wrap">
22
+ <?php do_action('chld_thm_cfg_related_links'); ?>
23
+ <h2><?php echo __('Child Theme Configurator', 'chld_thm_cfg') . ' ' . __('version', 'chld_thm_cfg') . ' ' . CHLD_THM_CFG_VERSION; ?></h2>
24
+ <?php
25
+ if ('POST' == $_SERVER['REQUEST_METHOD'] && !$this->ctc()->fs):
26
+ echo $this->ctc()->fs_prompt;
27
+ else: ?>
28
+ <div id="ctc_error_notice">
29
+ <?php $this->settings_errors(); ?>
30
+ </div>
31
+ <?php
32
+ include ( $this->ctc()->pluginPath . 'includes/forms/tabs.php' );
33
+ ?>
34
+ <i id="ctc_status_preview"></i>
35
+ </h2>
36
+ <div class="ctc-option-panel-container">
37
+ <?php
38
+ include ( $this->ctc()->pluginPath . 'includes/forms/parent-child.php' );
39
+ if ($enqueueset):
40
+ include ( $this->ctc()->pluginPath . 'includes/forms/rule-value.php' );
41
+ include ( $this->ctc()->pluginPath . 'includes/forms/query-selector.php' );
42
+ include ( $this->ctc()->pluginPath . 'includes/forms/at-import.php' ); ?>
43
+ <div id="view_child_options_panel"
44
+ class="ctc-option-panel<?php echo 'view_child_options' == $active_tab ? ' ctc-option-panel-active' : ''; ?>" <?php echo $hidechild; ?>> </div>
45
+ <div id="view_parnt_options_panel"
46
+ class="ctc-option-panel<?php echo 'view_parnt_options' == $active_tab ? ' ctc-option-panel-active' : ''; ?>" <?php echo $hidechild; ?>> </div>
47
+ <?php
48
+ if ('' == $hidechild):
49
+ include ( $this->ctc()->pluginPath . 'includes/forms/files.php' );
50
+ endif;
51
+ do_action('chld_thm_cfg_panels', $this->ctc(), $active_tab, $hidechild);
52
+ endif; ?>
53
+ </div>
54
+ <?php
55
+ endif;
56
+ ?>
57
+ </div>
includes/forms/parent-child.php ADDED
@@ -0,0 +1,207 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (!defined('ABSPATH')) exit;
3
+ // Parent/Child Panel
4
+ ?>
5
+
6
+ <div id="parent_child_options_panel" class="ctc-option-panel<?php echo 'parent_child_options' == $active_tab ? ' ctc-option-panel-active' : ''; ?>">
7
+ <form id="ctc_load_form" method="post" action="?page=<?php echo CHLD_THM_CFG_MENU; ?>">
8
+ <?php
9
+ wp_nonce_field( 'ctc_update' );
10
+ if (has_action('chld_thm_cfg_controls')):
11
+ if ('' == $hidechild) do_action('chld_thm_cfg_controls', $this->ctc());
12
+ $themeonly = 'style="display:none"';
13
+ else:
14
+ $themeonly = '';
15
+ endif;
16
+ ?>
17
+ <div class="ctc-theme-only" <?php echo 'theme' != $configtype ? $themeonly : ''; ?>>
18
+ <div class="ctc-input-row clearfix" id="input_row_parnt">
19
+ <div class="ctc-input-cell"> <strong>
20
+ <?php _e('Parent Theme', 'chld_thm_cfg'); ?>
21
+ </strong> </div>
22
+ <div class="ctc-input-cell">
23
+ <?php $this->render_theme_menu('parnt', $parent); ?>
24
+ </div>
25
+ </div>
26
+ <div class="ctc-input-row clearfix" id="input_row_child">
27
+ <div class="ctc-input-cell"> <strong>
28
+ <?php _e('Child Theme', 'chld_thm_cfg'); ?>
29
+ </strong> </div>
30
+ <div class="ctc-input-cell">
31
+ <input class="ctc-radio" id="ctc_child_type_new" name="ctc_child_type" type="radio" value="new"
32
+ <?php echo (!empty($hidechild) ? 'checked' : ''); ?>
33
+ <?php echo $hidechild;?> />
34
+ <label for="ctc_child_type_new">
35
+ <?php _e('Create New Child Theme', 'chld_thm_cfg'); ?>
36
+ </label>
37
+ </div>
38
+ <div class="ctc-input-cell">
39
+ <input class="ctc-radio" id="ctc_child_type_existing" name="ctc_child_type" type="radio" value="existing"
40
+ <?php echo (empty($hidechild) ? 'checked' : ''); ?>
41
+ <?php echo $hidechild; ?>/>
42
+ &nbsp;
43
+ <label for="ctc_child_type_existing" <?php echo $hidechild;?>>
44
+ <?php _e('Use Existing Child Theme', 'chld_thm_cfg'); ?>
45
+ </label>
46
+ </div>
47
+ <div class="ctc-input-cell" style="clear:both"> <strong>&nbsp;</strong> </div>
48
+ <div class="ctc-input-cell" >
49
+ <input class="ctc_text" id="ctc_child_template" name="ctc_child_template" type="text" placeholder="<?php _e('Theme Slug', 'chld_thm_cfg'); ?>" autocomplete="off"/>
50
+ </div>
51
+ <?php if ('' == $hidechild): ?>
52
+ <div class="ctc-input-cell">
53
+ <?php $this->render_theme_menu('child', $child); ?>
54
+ </div>
55
+ <?php endif; ?>
56
+ </div>
57
+ <div class="ctc-input-row clearfix" id="input_row_child_name">
58
+ <div class="ctc-input-cell"> <strong>
59
+ <?php _e('Child Theme Name', 'chld_thm_cfg'); ?>
60
+ </strong> </div>
61
+ <div class="ctc-input-cell">
62
+ <input class="ctc_text" id="ctc_child_name" name="ctc_child_name" type="text"
63
+ value="<?php echo esc_attr($css->get_prop('child_name')); ?>" placeholder="<?php _e('Theme Name', 'chld_thm_cfg'); ?>" autocomplete="off" />
64
+ </div>
65
+ </div>
66
+ </div>
67
+ <div class="ctc-input-row clearfix">
68
+ <div class="ctc-input-cell"> <strong>
69
+ <?php _e('Author', 'chld_thm_cfg'); ?>
70
+ </strong> </div>
71
+ <div class="ctc-input-cell">
72
+ <input class="ctc_text" id="ctc_child_author" name="ctc_child_author" type="text"
73
+ value="<?php echo esc_attr($css->get_prop('author')); ?>" placeholder="<?php _e('Author', 'chld_thm_cfg'); ?>" autocomplete="off" />
74
+ </div>
75
+ </div>
76
+ <div class="ctc-input-row clearfix">
77
+ <div class="ctc-input-cell"> <strong>
78
+ <?php _e('Version', 'chld_thm_cfg'); ?>
79
+ </strong> </div>
80
+ <div class="ctc-input-cell">
81
+ <input class="ctc_text" id="ctc_child_version" name="ctc_child_version" type="text"
82
+ value="<?php echo esc_attr($css->get_prop('version')); ?>" placeholder="<?php _e('Version', 'chld_thm_cfg'); ?>" autocomplete="off" />
83
+ </div>
84
+ </div>
85
+ <div class="ctc-theme-only" <?php echo 'theme' != $configtype ? $themeonly : ''; ?>>
86
+ <div class="ctc-input-row clearfix">
87
+ <div class="ctc-input-cell"> <strong>
88
+ <?php _e('Copy Parent Theme Menus, Widgets and other Options', 'chld_thm_cfg'); ?>
89
+ </strong> </div>
90
+ <div class="ctc-input-cell">
91
+ <input class="ctc_checkbox" id="ctc_parent_mods" name="ctc_parent_mods" type="checkbox"
92
+ value="1" />
93
+ </div>
94
+ <div class="ctc-input-cell"> <strong>
95
+ <?php _e('NOTE:', 'chld_thm_cfg'); ?>
96
+ </strong>
97
+ <?php _e( 'This will overwrite child theme options you may have already set.', 'chld_thm_cfg'); ?>
98
+ </div>
99
+ </div>
100
+ <?php if ('' == $hidechild): ?>
101
+ <div class="ctc-input-row clearfix">
102
+ <div class="ctc-input-cell"> <strong>
103
+ <?php _e('Backup current stylesheet', 'chld_thm_cfg'); ?>
104
+ </strong> </div>
105
+ <div class="ctc-input-cell">
106
+ <input class="ctc_checkbox" id="ctc_backup" name="ctc_backup" type="checkbox"
107
+ value="1" />
108
+ </div>
109
+ <div class="ctc-input-cell"> <strong>
110
+ <?php _e('NOTE:', 'chld_thm_cfg'); ?>
111
+ </strong>
112
+ <?php _e( 'This creates a copy of the current stylesheet before applying changes. You can remove old backup files using the Files tab.', 'chld_thm_cfg'); ?>
113
+ </div>
114
+ </div>
115
+ <?php endif; ?>
116
+ <div class="ctc-input-row clearfix">
117
+ <div class="ctc-input-cell"> <strong>
118
+ <?php _e('Parent stylesheet handling:', 'chld_thm_cfg'); ?>
119
+ </strong> </div>
120
+ <div class="ctc-input-cell">
121
+ <label>
122
+ <input class="ctc_radio" id="ctc_parent_enqueue_enqueue" name="ctc_parent_enqueue" type="radio"
123
+ value="enqueue" <?php echo ( empty($css->enqueue) || 'enqueue' == $css->enqueue ? 'checked' : '' ); ?>/>
124
+ <?php _e('&lt;link&gt; (default)', 'chld_thm_cfg'); ?>
125
+ </label>
126
+ <br/>
127
+ <label>
128
+ <input class="ctc_radio" id="ctc_parent_enqueue_import" name="ctc_parent_enqueue" type="radio"
129
+ value="import" <?php echo ( isset($css->enqueue) && 'import' == $css->enqueue ? 'checked' : '' ); ?>/>
130
+ <?php _e('@import', 'chld_thm_cfg'); ?>
131
+ </label>
132
+ <br/>
133
+ <label>
134
+ <input class="ctc_radio" id="ctc_parent_enqueue_none" name="ctc_parent_enqueue" type="radio"
135
+ value="none" <?php echo ( isset($css->enqueue) && 'none' == $css->enqueue ? 'checked' : '' ); ?>/>
136
+ <?php _e('none (handled by theme)', 'chld_thm_cfg'); ?>
137
+ </label>
138
+ </div>
139
+ <div class="ctc-input-cell"> <strong>
140
+ <?php _e('NOTE:', 'chld_thm_cfg'); ?>
141
+ </strong>
142
+ <?php _e( "Only select @import for older themes that do not enqueue the stylesheet. Select 'none' if core styles are automatically loaded for child themes. Select '&lt;link&gt;' if unsure.", 'chld_thm_cfg'); ?>
143
+ </div>
144
+ </div>
145
+ <?php if ('' == $hidechild): ?>
146
+ <div class="ctc-input-row clearfix">
147
+ <div class="ctc-input-cell ctc-section-toggle" id="ctc_revert_css"> <strong>
148
+ <?php _e('Reset/Restore from backup:', 'chld_thm_cfg'); ?>
149
+ </strong> </div>
150
+ <div class="ctc-input-cell-wide ctc-section-toggle-content" id="ctc_revert_css_content">
151
+ <label>
152
+ <input class="ctc_checkbox" id="ctc_revert_none" name="ctc_revert" type="radio"
153
+ value="" checked="" />
154
+ <?php _e('Leave unchanged', 'chld_thm_cfg');?>
155
+ </label>
156
+ <br/>
157
+ <label>
158
+ <input class="ctc_checkbox" id="ctc_revert_all" name="ctc_revert" type="radio"
159
+ value="all" />
160
+ <?php _e('Reset all', 'chld_thm_cfg');?>
161
+ </label>
162
+ <br/>
163
+ <?php
164
+ foreach ($this->ctc()->get_files($child, 'backup') as $backup => $label): ?>
165
+ <label>
166
+ <input class="ctc_checkbox" id="ctc_revert_<?php echo $backup; ?>" name="ctc_revert" type="radio"
167
+ value="<?php echo $backup; ?>" />
168
+ <?php echo __('Restore backup from', 'chld_thm_cfg') . ' ' . $label; ?></label>
169
+ <br/>
170
+ <?php
171
+ endforeach;
172
+ ?>
173
+ </div>
174
+ </div>
175
+ <?php endif;
176
+ $stylesheets = $this->ctc()->get_files($parent, 'stylesheet');
177
+ if (count($stylesheets)):?>
178
+ <div class="ctc-input-row clearfix">
179
+ <div class="ctc-input-cell ctc-section-toggle" id="ctc_additional_css_files"> <strong>
180
+ <?php _e('Parse additional stylesheets:', 'chld_thm_cfg'); ?>
181
+ </strong> </div>
182
+ <div class="ctc-input-cell-wide ctc-section-toggle-content" id="ctc_additional_css_files_content">
183
+ <p style="margin-top:0">
184
+ <?php _e('Stylesheets that are currently being loaded by the parent theme are automatically selected below (except for Bootstrap stylesheets which add a large amount data to the configuration). To further reduce overhead, select only the additional stylesheets you wish to customize.', 'chld_thm_cfg'); ?>
185
+ </p>
186
+ <?php
187
+ foreach ($stylesheets as $stylesheet): ?>
188
+ <div class="ctc-input-cell">
189
+ <label>
190
+ <input class="ctc_checkbox" name="ctc_additional_css[]" type="checkbox"
191
+ value="<?php echo $stylesheet; ?>" />
192
+ <?php echo $stylesheet; ?></label>
193
+ </div>
194
+ <?php endforeach; ?>
195
+ </div>
196
+ </div>
197
+ <?php endif; ?>
198
+ </div>
199
+ <div class="ctc-input-row clearfix">
200
+ <div class="ctc-input-cell"> <strong>&nbsp;</strong> </div>
201
+ <div class="ctc-input-cell">
202
+ <input class="ctc_submit button button-primary" id="ctc_load_styles" name="ctc_load_styles" type="submit"
203
+ value="<?php _e('Generate/Rebuild Child Theme Files', 'chld_thm_cfg'); ?>" disabled />
204
+ </div>
205
+ </div>
206
+ </form>
207
+ </div>
includes/forms/query-selector.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (!defined('ABSPATH')) exit;
3
+ // Query/Selector Panel
4
+ ?>
5
+
6
+ <div id="query_selector_options_panel"
7
+ class="ctc-option-panel<?php echo 'query_selector_options' == $active_tab ? ' ctc-option-panel-active' : ''; ?>" <?php echo $hidechild; ?>>
8
+ <form id="ctc_query_selector_form" method="post" action="?page=<?php echo CHLD_THM_CFG_MENU; ?>">
9
+ <div class="ctc-input-row clearfix" id="input_row_query">
10
+ <div class="ctc-input-cell"> <strong>
11
+ <?php _e('Query', 'chld_thm_cfg'); ?>
12
+ </strong> </div>
13
+ <div class="ctc-input-cell" id="ctc_sel_ovrd_query_selected">&nbsp;</div>
14
+ <div class="ctc-input-cell">
15
+ <div class="ui-widget">
16
+ <input id="ctc_sel_ovrd_query" />
17
+ </div>
18
+ </div>
19
+ </div>
20
+ <div class="ctc-input-row clearfix" id="input_row_selector">
21
+ <div class="ctc-input-cell"> <strong>
22
+ <?php _e('Selector', 'chld_thm_cfg'); ?>
23
+ </strong> <a href="#" class="ctc-rewrite-toggle"></a></div>
24
+ <div class="ctc-input-cell" id="ctc_sel_ovrd_selector_selected">&nbsp;</div>
25
+ <div class="ctc-input-cell">
26
+ <div class="ui-widget">
27
+ <input id="ctc_sel_ovrd_selector" />
28
+ <div id="ctc_status_sel_ndx"></div>
29
+ </div>
30
+ </div>
31
+ </div>
32
+ <div class="ctc-selector-row clearfix" id="ctc_sel_ovrd_rule_inputs_container" style="display:none">
33
+ <div class="ctc-input-row clearfix">
34
+ <div class="ctc-input-cell"><strong>
35
+ <?php _e('Sample', 'chld_thm_cfg'); ?>
36
+ </strong></div>
37
+ <div class="ctc-input-cell clearfix" style="max-height:150px;overflow:hidden">
38
+ <div class="ctc-swatch" id="ctc_child_all_0_swatch"><?php echo $this->ctc()->swatch_text; ?></div>
39
+ </div>
40
+ <div id="ctc_status_sel_val"></div>
41
+ <div class="ctc-input-cell ctc-button-cell" id="ctc_save_query_selector_cell">
42
+ <input type="button" class="button button-primary ctc-save-input" id="ctc_save_query_selector"
43
+ name="ctc_save_query_selector" value="<?php _e('Save', 'chld_thm_cfg'); ?>" disabled />
44
+ <input type="hidden" id="ctc_sel_ovrd_qsid"
45
+ name="ctc_sel_ovrd_qsid" value="" />
46
+ </div>
47
+ </div>
48
+ <div class="ctc-input-row clearfix" id="ctc_sel_ovrd_rule_header" style="display:none">
49
+ <div class="ctc-input-cell"> <strong>
50
+ <?php _e('Rule', 'chld_thm_cfg'); ?>
51
+ </strong> </div>
52
+ <div class="ctc-input-cell"> <strong>
53
+ <?php _e('Parent Value', 'chld_thm_cfg'); ?>
54
+ </strong> </div>
55
+ <div class="ctc-input-cell"> <strong>
56
+ <?php _e('Child Value', 'chld_thm_cfg'); ?>
57
+ </strong> </div>
58
+ </div>
59
+ <div id="ctc_sel_ovrd_rule_inputs" style="display:none"> </div>
60
+ <div class="ctc-input-row clearfix" id="ctc_sel_ovrd_new_rule" style="display:none">
61
+ <div class="ctc-input-cell"> <strong>
62
+ <?php _e('New Rule', 'chld_thm_cfg'); ?>
63
+ </strong> </div>
64
+ <div class="ctc-input-cell">
65
+ <div class="ui-widget">
66
+ <input id="ctc_new_rule_menu" />
67
+ </div>
68
+ </div>
69
+ </div>
70
+ <div class="ctc-input-row clearfix" id="input_row_selector">
71
+ <div class="ctc-input-cell"> <strong>
72
+ <?php _e('Order', 'chld_thm_cfg'); ?>
73
+ </strong> </div>
74
+ <div class="ctc-input-cell" id="ctc_child_load_order_container">&nbsp;</div>
75
+ </div>
76
+ </div>
77
+ <div class="ctc-selector-row clearfix" id="ctc_new_selector_row">
78
+ <div class="ctc-input-cell"> <strong>
79
+ <?php _e('Raw CSS', 'chld_thm_cfg'); ?>
80
+ </strong>
81
+ <div class="ctc-textarea-button-cell" id="ctc_save_query_selector_cell">
82
+ <input type="button" class="button ctc-save-input" id="ctc_save_new_selectors"
83
+ name="ctc_save_new_selectors" value="<?php _e('Save', 'chld_thm_cfg'); ?>" disabled />
84
+ </div>
85
+ </div>
86
+ <div class="ctc-input-cell-wide">
87
+ <textarea id="ctc_new_selectors" name="ctc_new_selectors" wrap="off"></textarea>
88
+ </div>
89
+ </div>
90
+ </form>
91
+ </div>
includes/forms/related.php ADDED
@@ -0,0 +1 @@
 
1
+ <span style="float:right;margin-left:2em;margin-top:-6px;text-shadow:1px 2px 0 #fff"><strong><?php _e('New user?','chld_thm_cfg'); ?> <span style="color:#F1823B"><?php _e('Click help', 'chld_thm_cfg'); ?></span></strong> <i class="dashicons dashicons-arrow-right-alt" style="color:#F1823B"></i></span><a href="http://www.lilaeamedia.com/plugins/child-theme-plugin-styles/" target="_blank" title="<?php _e('Get CTC for Plugins and other tools', 'chld_thm_cfg'); ?>" style="float:right"><img src="<?php echo $this->ctc()->pluginURL; ?>/css/lilaea-logo.png" height="36" width="145" alt="<?php _e('Lilaea Media - Responsive Tools for a Mobile World', 'chld_thm_cfg'); ?>" /></a>
includes/forms/rule-value.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (!defined('ABSPATH')) exit;
3
+ // Rule/Value Panel
4
+ ?>
5
+
6
+ <div id="rule_value_options_panel"
7
+ class="ctc-option-panel<?php echo 'rule_value_options' == $active_tab ? ' ctc-option-panel-active' : ''; ?>" <?php echo $hidechild; ?>>
8
+ <form id="ctc_rule_value_form" method="post" action="?page=<?php echo CHLD_THM_CFG_MENU; ?>">
9
+ <?php wp_nonce_field( 'ctc_update' ); ?>
10
+ <div class="ctc-input-row clearfix" id="ctc_input_row_rule_menu">
11
+ <div class="ctc-input-cell"> <strong>
12
+ <?php _e('Rule', 'chld_thm_cfg'); ?>
13
+ </strong> </div>
14
+ <div class="ctc-input-cell" id="ctc_rule_menu_selected">&nbsp;</div>
15
+ <div id="ctc_status_rule_val"></div>
16
+ <div class="ctc-input-cell">
17
+ <div class="ui-widget">
18
+ <input id="ctc_rule_menu"/>
19
+ <div id="ctc_status_rule"></div>
20
+ </div>
21
+ </div>
22
+ </div>
23
+ <div class="ctc-input-row clearfix" id="ctc_input_row_rule_header" style="display:none">
24
+ <div class="ctc-input-cell"> <strong>
25
+ <?php _e('Value', 'chld_thm_cfg'); ?>
26
+ </strong> </div>
27
+ <div class="ctc-input-cell"> <strong>
28
+ <?php _e('Sample', 'chld_thm_cfg'); ?>
29
+ </strong> </div>
30
+ <div class="ctc-input-cell"> <strong>
31
+ <?php _e('Selectors', 'chld_thm_cfg'); ?>
32
+ </strong> </div>
33
+ </div>
34
+ <div class="ctc-rule-value-input-container clearfix" id="ctc_rule_value_inputs" style="display:none"> </div>
35
+ </form>
36
+ </div>
includes/forms/tabs.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (!defined('ABSPATH')) exit;
3
+ // Tabs Bar
4
+
5
+ $active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : 'parent_child_options';
6
+ ?>
7
+
8
+ <h2 class="nav-tab-wrapper">
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', 'chld_thm_cfg'); ?>
12
+ </a>
13
+ <?php if ($enqueueset): ?>
14
+ <!----><a id="query_selector_options" href=""
15
+ class="nav-tab<?php echo 'query_selector_options' == $active_tab ? ' nav-tab-active' : ''; ?>" <?php echo $hidechild; ?>>
16
+ <?php _e('Query/Selector', 'chld_thm_cfg'); ?>
17
+ </a><!----><a id="rule_value_options" href=""
18
+ class="nav-tab<?php echo 'rule_value_options' == $active_tab ? ' nav-tab-active' : ''; ?>" <?php echo $hidechild; ?>>
19
+ <?php _e('Rule/Value', 'chld_thm_cfg'); ?>
20
+ </a><!----><a id="import_options" href=""
21
+ class="nav-tab<?php echo 'import_options' == $active_tab ? ' nav-tab-active' : ''; ?>" <?php echo $hidechild; ?>>
22
+ <?php _e('@import', 'chld_thm_cfg'); ?>
23
+ </a><!----><a id="view_child_options" href=""
24
+ class="nav-tab<?php echo 'view_child_options' == $active_tab ? ' nav-tab-active' : ''; ?>" <?php echo $hidechild; ?>>
25
+ <?php _e('Child CSS', 'chld_thm_cfg'); ?>
26
+ </a><!----><a id="view_parnt_options" href=""
27
+ class="nav-tab<?php echo 'view_parnt_options' == $active_tab ? ' nav-tab-active' : ''; ?>" <?php echo $hidechild; ?>>
28
+ <?php _e('Parent CSS', 'chld_thm_cfg'); ?>
29
+ </a>
30
+ <?php
31
+ if ('' == $hidechild):
32
+ ?>
33
+ <a id="file_options" href=""
34
+ class="nav-tab<?php echo 'file_options' == $active_tab ? ' nav-tab-active' : ''; ?>" <?php echo $hidechild; ?>>
35
+ <?php _e('Files', 'chld_thm_cfg'); ?>
36
+ </a>
37
+ <?php
38
+ endif;
39
+ endif;
40
+ do_action('chld_thm_cfg_tabs', $this->ctc(), $active_tab, $hidechild); ?>
includes/forms/themepreview.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (!defined('ABSPATH')) exit;
3
+ // Theme Preview
4
+ // Renders localized version of theme preview that is merged into
5
+ // jQuery selectmenu object for parent and child theme options
6
+ ?>
7
+
8
+ <div id="ctc_theme_option_<?php echo $slug; ?>" class="clearfix ctc-theme-option">
9
+ <div class="ctc-theme-option-left"><img src="<?php echo $theme['screenshot']; ?>" class="ctc-theme-option-image"/></div>
10
+ <div class="ctc-theme-option-right">
11
+ <h3 class="theme-name"><?php echo $theme['Name']; ?></h3>
12
+ <?php _e('Version: ', 'chld_thm_cfg'); echo esc_attr($theme['Version']);?>
13
+ <br/>
14
+ <?php _e('By: ', 'chld_thm_cfg'); echo esc_attr($theme['Author']);?>
15
+ <br/>
16
+ <a href="<?php echo admin_url('/customize.php?theme=' . $slug);?>" title="<?php _e('Live Preview', 'chld_thm_cfg'); ?>" class="ctc-live-preview">
17
+ <?php _e('Live Preview', 'chld_thm_cfg');?>
18
+ </a></div>
19
+ </div>
includes/help/help_en_US.php ADDED
@@ -0,0 +1,231 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (!defined('ABSPATH')) exit;
3
+ // Help Content
4
+ ?>
5
+ <!-- BEGIN tab -->
6
+ <h3 id="ctc_getting_started">Start Here</h3>
7
+ <p><strong style="font-size:large">10 Easy Steps to Create a Child Theme:</strong></p>
8
+ <ol>
9
+ <li><strong>Select the theme</strong> you want to configure from the &quot;Parent Theme&quot; menu.</li>
10
+ <li><strong>Select &quot;new&quot; or &quot;existing&quot;.</strong>
11
+ <ul>
12
+ <li>If there are currently no child themes available, the &quot;Child Theme&quot; and &quot;Child Theme Names&quot; will be entered for you automatically based on the parent theme selected. You may edit these if you like, but they cannot be the same as an existing theme.</li>
13
+ <li>If there are existing child themes available, there will be an additional menu labeled &quot;Use Existing Child Theme&quot; from which you can select, or enter a new value in the input box to create a new one.</li>
14
+ </ul>
15
+ </li>
16
+ <li><strong>Enter a Name, Author and Version</strong> for the child theme. They each must contain a value, but what you enter is up to you. If using an existing child theme, they will be entered automatically based on the child theme selected.</li>
17
+ <li><strong>Use Parent Options (optional)</strong> If you want to maintain the same theme options as the parent theme, check "Copy Parent Theme Menus, Widgets and other Options". Depending on the theme, some options may need to be applied using separate theme option controls. <strong>NOTE: This will overwrite any child theme options you may have already set.</strong></li>
18
+ <li><strong>Save Backup (optional)</strong> If using an existing child theme, you can check "Backup Stylesheet", to create a backup of the child theme stylesheet in the child theme directory.</li>
19
+ <li><strong>Choose how WordPress should handle the parent theme stylesheet (new in version 1.6.0):</strong>
20
+ <ul>
21
+ <li>Select &lt;link&gt; if the parent theme uses the main 'style.css' stylesheet and correctly enqueues it for child themes (default).</li>
22
+ <li>Select &#64;import for older themes that do not enqueue the stylesheet. If the parent styles do not appear when you activate the child theme, you probably need to use this option. <strong>NOTE:</strong> this was the only method used in previous versions of Child Theme Configurator.</li>
23
+ <li>Select &quot;None&quot; if the parent theme does not use the main 'style.css' for its core styles but enqueues it for child themes. This is a common practice with more recent themes.
24
+ </ul>
25
+ <strong>If you do not know which option to use, select &lt;link&gt;.</strong></li>
26
+ <li><strong>Restore from backup (optional - new in version 1.6.0):</strong> If using an existing child theme, you can choose whether to reload the current child theme stylesheet (leave unchanged), reset all values, or restore it from a backup. If there are backup files available, they will appear as radio button options.</li>
27
+ <li><strong>Choose additional stylesheets</strong> If your theme uses additional stylesheets, you can open the &quot;Parse Additional Stylesheets&quot; toggle and they will appear as checkbox options. Stylesheets that are being used by the parent theme should be automatically selected for you. Only select additional stylesheets you wish to customize to reduce overhead. <strong>NOTE: If the parent theme uses Bootstrap stylesheets, they will not be automatically selected.</strong> You can select Bootstrap stylesheets manually if you need to customize them, but in most cases they add unecessary overhead to the configuration data.</li>
28
+ <li><strong>Click "Generate/Rebuild Child Theme Files."</strong></li>
29
+ <li><strong>IMPORTANT: <a target="_blank" href="http://www.lilaeamedia.com/plugins/child-theme-configurator/#preview_activate" title="Test your child theme before activating!">Always test your child theme with Live Preview before activating!</a></strong></li>
30
+ </ol>
31
+ <!-- END tab -->
32
+ <!-- BEGIN tab -->
33
+ <h3 id="ctc_tutorial">Tutorial Video</h3>
34
+ <iframe width="480" height="270" src="//www.youtube.com/embed/53M7RVxDYEY?rel=0&modestbranding=1" frameborder="0" allowfullscreen></iframe>
35
+ <!-- END tab -->
36
+ <!-- BEGIN tab -->
37
+ <h3 id="ctc_query_selector">Query/Selector Tab</h3>
38
+ <p>There are two ways to identify and override parent styles. The Child Theme Configurator lets you search styles by <strong>selector</strong> and by <strong>rule</strong>. If you wish to change a specific selector (e.g., h1), use the "Query/Selector" tab. If you have a specific value you wish to change site-wide (e.g., the color of the type), use the "Rule/Value" tab.</p>
39
+ <p>The Query/Selector tab lets you find specific selectors and edit them. First, find the query that contains the selector you wish to edit by typing in the <strong>Query</strong> autoselect box. Select by clicking with the mouse or by pressing the "Enter" or "Tab" keys. Selectors are in the <strong>base</strong> query by default.</p>
40
+ <p>Next, find the selector by typing in the <strong>Selector</strong> autoselect box. Select by clicking with the mouse or by pressing the "Enter" or "Tab" keys.</p>
41
+ <p>This will load all of the rules for that selector with the Parent values on the left and the Child values inputs on the right. Any existing child values will be automatically populated. There is also a Sample preview that displays the combination of Parent and Child overrides. Note that the <strong>border</strong> and <strong>background-image</strong> get special treatment.</p>
42
+ <p>The "Order" field contains the original sequence of the selector in the parent theme stylesheet. You can change the selector order sequence by entering a lower or higher number in the "Order" field. You can also force style overrides (so called "!important" flag) by checking the "!" box next to each input. Please use judiciously.</p>
43
+ <p>Click "Save" to update the child stylesheet and save your changes to the WordPress admin.</p>
44
+ <!-- END tab -->
45
+ <!-- BEGIN tab -->
46
+ <h3 id="ctc_new_styles">Adding New Styles</h3>
47
+ <p>If you wish to add additional rules to a given selector, first load the selector using the Query/Selector tab. Then find the rule you wish to override by typing in the <strong>New Rule</strong> autoselect box. Select by clicking with the mouse or by pressing the "Enter" or "Tab" keys. This will add a new input row to the selector inputs.</p>
48
+ <p>If you wish to add completely new selectors, or even new @media queries, you can enter free-form CSS in the "Raw CSS" textarea. Be aware that your syntax must be correct (i.e., balanced curly braces, etc.) for the parser to load the new styles. You will know it is invalid because a red "X" will appear next to the save button.</p>
49
+ <p>If you prefer to use shorthand syntax for rules and values instead of the inputs provided by the Child Theme Configurator, you can enter them here as well. The parser will convert your input into normalized CSS code automatically.</p>
50
+ <!-- END tab -->
51
+ <!-- BEGIN tab -->
52
+ <h3 id="ctc_rule_value">Rule/Value Tab</h3>
53
+ <p>There are two ways to identify and override parent styles. The Child Theme Configurator lets you search styles by <strong>selector</strong> and by <strong>rule</strong>. If you wish to change a specific selector (e.g., h1), use the "Query/Selector" tab. If you have a specific value you wish to change site-wide (e.g., the color of the type), use the "Rule/Value" tab.</p>
54
+ <p>The Rule/Value tab lets you find specific values for a given rule and then edit that value for individual selectors that use that rule/value combination. First, find the rule you wish to override by typing in the <strong>Rule</strong> autoselect box. Select by clicking with the mouse or by pressing the "Enter" or "Tab" keys.</p>
55
+ <p>This will load all of the unique values that exist for that rule in the parent stylesheet with a Sample preview for that value. If there are values that exist in the child stylesheet that do not exist in the parent stylesheet, they will be displayed as well.</p>
56
+ <p>For each unique value, click the "Selectors" link to view a list of selectors that use that rule/value combination, grouped by query with a Sample preview of the value and inputs for the child value. Any existing child values will be automatically populated.</p>
57
+ <p>Click "Save" to update the child stylesheet and save your changes to the WordPress admin.</p>
58
+ <!-- END tab -->
59
+ <!-- BEGIN tab -->
60
+ <h3 id="ctc_imports">@import Tab and Web Fonts</h3>
61
+ <p>You can add additional stylesheets and web fonts by typing @import rules into the textarea on the @import tab. <strong>Important: do not import the parent theme stylesheet here. Use the &quot;Parent stylesheet handling&quot; option from the Parent/Child tab.</strong></p>
62
+ <p>Below is an example that loads a local custom stylesheet (you would have to add the "fonts" directory and stylesheet) as well as the web font "Open Sans" from Google Web Fonts:</p>
63
+ <blockquote>
64
+ <pre><code>
65
+ @import url(fonts/stylesheet.css);
66
+ @import url(http://fonts.googleapis.com/css?family=Open+Sans:400,400italic,700,700italic);
67
+ </code></pre>
68
+ </blockquote>
69
+ <!-- END tab -->
70
+ <!-- BEGIN tab -->
71
+ <h3 id="ctc_files">Files Tab</h3>
72
+ <h5>Parent Templates</h5>
73
+ <p>Copy PHP template files from the parent theme by checking the boxes and clicking "Copy Selected to Child Theme" and the templates will be added to the child theme directory.</p>
74
+ <p><strong>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.</strong></p>
75
+ <p>The <code>functions.php</code> file is generated separately and cannot be copied here.</p>
76
+ <h5>Child Theme Files</h5>
77
+ <p>Templates copied from the parent and any stylesheet backups are listed here. Templates can be edited using the Theme Editor in the Appearance Menu.</p>
78
+ <p>Remove child theme files by checking the boxes and clicking "Delete Selected".</p>
79
+ <h5>Child Theme Images</h5>
80
+ <p>Theme images reside under the <code>images</code> directory in your child theme and are meant for stylesheet use only. Use the media gallery for content images.</p>
81
+ <p>You can upload new images using the image upload form. Remove child theme images by checking the boxes and clicking "Delete Selected".</p>
82
+ <h5>Child Theme Screenshot</h5>
83
+ <p>You can upload a custom screenshot for the child theme here.</p>
84
+ <p>The theme screenshot should be a 4:3 ratio (eg., 880px x 660px) JPG, PNG or GIF. It will be renamed <code>screenshot</code>.</p>
85
+ <h5>Export Child Theme as Zip Archive </h5>
86
+ <p>You can download your child theme for use on another WordPress site by clicking "Export".</p>
87
+ <!-- END tab -->
88
+ <!-- BEGIN tab -->
89
+ <h3 id="ctc_preview">Preview and Activate</h3>
90
+ <p><strong>IMPORTANT: <a target="_blank" href="http://www.lilaeamedia.com/plugins/child-theme-configurator/#preview_activate" title="Test your child theme before activating!">Test your child theme before activating!</a></strong> Some themes (particularly commercial themes) do not correctly load parent template files or automatically load child theme stylesheets or php files. <strong>In the worst cases they will break your website when you activate the child theme.</strong></p>
91
+ <ol>
92
+ <li>Navigate to Appearance > Themes in the WordPress Admin. You will now see the new Child Theme as one of the installed Themes.</li>
93
+ <li>Click "Live Preview" below the new Child Theme to see it in action.</li>
94
+ <li>When you are ready to take the Child Theme live, click "Activate."</li>
95
+ </ol>
96
+ <p>You can also click the Child or Parent CSS tab to reference the stylesheet code.</p>
97
+ <!-- END tab -->
98
+ <!-- BEGIN tab -->
99
+ <h3 id="ctc_permissions">File Permissions</h3>
100
+ <p>WordPress was designed to work on a number of server configurations. Child Theme Configurator uses the WordPress Filesystem API to allow changes to sites that require user permission to edit files.</p>
101
+ <p>However, because most of the functionality occurs via AJAX (background) requests, the child theme stylesheet must be writable by the web server.</p>
102
+ <p>The plugin will automatically detect your configuration and provide a number of options to resolve this requirement. Use the links provided to find out more about the options available, including:</p>
103
+ <ol>
104
+ <li>Temporarily making the stylesheet writable through the plugin.</li>
105
+ <li>Adding your FTP/SSH credentials to the WordPress config file.</li>
106
+ <li>Setting the stylesheet write permissions on the server manually</li>
107
+ <li>Configuring your web server to allow write access in certain situations.</li>
108
+ </ol>
109
+ <!-- END tab -->
110
+ <!-- BEGIN tab -->
111
+ <h3 id="ctc_faq">FAQs</h3>
112
+ <h5 id="broken_theme">HELP! I changed a file and now I am unable to access my website or login to wp-admin to fix it!</h5>
113
+ <p>To back out of a broken theme you have to manually rename the offending theme directory name (via FTP, SSH or your web host control panel file manager) so that WordPress can't find it. WordPress will then throw an error and revert back to the default theme (currently twenty-fourteen).</p>
114
+
115
+ <p>The child theme is in your themes folder, usually</p>
116
+
117
+ <code>[path/to/wordpress]/wp-content/themes/[child-theme]</code>
118
+
119
+ <p>To prevent this in the future, always test your child themes with Live Preview before activating them.</p>
120
+
121
+ <h5 id="menus_broken">Why are my menus displaying incorrectly when I activate the new child theme?</h5>...or...
122
+ <h5 id="header_broken">Why is my custom header missing when I activate the new child theme?</h5>...or...
123
+ <h5 id="background_broken">Why does my custom background go back to the default when I activate the new child theme?</h5>...or...
124
+ <h5 id="options_broken">Why do my theme options disappear when I activate the new child theme?</h5>
125
+ <p>These options are specific to each theme and are saved separately in the database. When you create a new child theme, its options are blank.</p>
126
+
127
+ <p><strong>Many of these options can be copied over to the child theme by checking "Copy Parent Theme Menus, Widgets and other Options" when you generate the child theme files on the Parent/Child tab.</strong></p>
128
+
129
+ <p>If you want to set different options you can either apply them after you activate the child theme, or by using the "Live Preview" under Appearance > Themes.</p>
130
+ <ul class="instructions">
131
+ <li><strong>Menus: </strong> Go to Appearance > Menus and click the "Locations" tab. By default, the primary menu will generate the links automatically from the existing pages. Select your customized Menu from the dropdown and click "Use New Menu." This will replace the default menu and you will see the correct links.</li>
132
+
133
+ <li><strong>Header: </strong> Go to Appearance > Header. Some themes will show the "Title" and "Tagline" from your "General Settings" by default. Click "Choose Image" and find the header from the Media Library or upload a new image. This will replace default with your custom image.</li>
134
+
135
+ <li><strong>Background: </strong> Go to Appearance > Background and choose a new background color or image.</li>
136
+
137
+ <li><strong>Options: </strong> Every theme handles options in its own way. Most often, they will create a set of options and store them in the WordPress database. Some options are specific to the active theme (or child theme), and some are specific to the parent theme only (meaning the child theme CANNOT override them). You will have to find out from the theme author which are which.</li>
138
+ </ul>
139
+ </p>
140
+ <h5 id="existing_parent">How do I move changes I have already made to a Child Theme?</h5>
141
+ <p>Follow <a href="http://www.lilaeamedia.com/plugins/child-theme-configurator#child_from_modified_parent" class="scroll-to">these steps</a>. </p>
142
+ <h5 id="web_fonts">How do I add Web Fonts?</h5>
143
+ <p>The easiest method is to paste the @import code provided by <a href="http://www.google.com/fonts" title="Google Fonts">Google</a>, <a href="http://www.fontsquirrel.com/" title="Font Squirrel">Font Squirrel</a> or any other Web Font site into the @import tab. The fonts will then be available to use as a value of the <strong>font-family</strong> rule. Be sure you understand the license for any embedded fonts. </p>
144
+ <p>You can also create a secondary stylesheet that contains @font-face rules and import it using the @import tab. </p>
145
+ <h5 id="multisite">Does it work with Multi site?</h5>
146
+ <strong>NOTE: Only users with "edit_theme_options" capability will have access to the Child Theme Configurator.</strong> Using with WordPress Network sites requires additional steps:
147
+ <ol class="instructions"><li>Install as Network Admin and Network Enable the Plugin.</li>
148
+ <li>Go to the site you want to customize.</li>
149
+ <li>Go to Tools > Child Themes and configure a child theme for the parent theme you want to use
150
+ <li>Go back to Network Admin and Network Enable the new Child theme.</li>
151
+ <li>Go back the site and activate the child theme.</li></ol>
152
+ Now you can edit your child theme from Tools > Child Themes. </p>
153
+
154
+ <h5 id="plugin">Does it work with plugins?</h5>
155
+ <p>We offer a premium extension to let you easily modify styles for any WordPress Plugin installed on your website. The Child Theme Configurator Plugin Extension scans your plugins and allows you to create custom stylesheets in your Child Theme. <a href="http://www.lilaeamedia.com/plugins/child-theme-plugin-styles/" title="Take Control of your Plugin Styles with Child Theme Configurator Plugin Extension for WordPress">Learn more <i class="genericon genericon-next"></i></a>
156
+ <h5 id="doesnt_work">Why doesn't this work with my (insert theme vendor here) theme?</h5>
157
+ <p>Some themes (particularly commercial themes) do not correctly load parent template files or automatically load child theme stylesheets or php files.</p><p>This is unfortunate, because in the best case they effectively prohibit the webmaster from adding any customizations (other than those made through the admin theme options) that will survive past an upgrade. <strong>In the worst case they will break your website when you activate the child theme.</strong> </p>
158
+ <p>Contact the vendor directly to ask for this core functionality. It is our opinion that ALL themes (especially commercial ones) must pass the Theme Unit Tests outlined by WordPress.org. </p>
159
+ <h5 id="missing_parent">Why doesn't the Parent Theme have any styles when I "View Parent CSS"?</h5>
160
+ <p>Your Parent theme is probably using a separate location for the stylesheets. Select individual stylesheets from the "Parse Additional Stylesheets" section of the Parent/Child tab and click "Generate Child Theme Files" again. </p>
161
+ <h5 id="where_is_it">Where is it in the Admin?</h5>
162
+ <p><strong>NOTE: Only users with "edit_theme_options" capability will have access to the Child Theme Configurator.</strong> The Child Theme Configurator can be found under the "Tools" menu in the WordPress Admin. Click "Child Themes" to get started.</p>
163
+ <p>Click the "Help" tab at the top right for a quick reference. </p>
164
+ <h5 id="performance">Will this slow down my site?</h5>
165
+ Once the child theme stylesheet is created, CTC adds very little overhead to the front-end since all of the functionality is in the admin.
166
+
167
+ The plugin only loads the bulk of the code in the admin when you are using the tool. The biggest performance hit occurs when you generate the Child Theme files from the Parent/Child tab. </p>
168
+ <h5 id="where_are_styles">Where are the styles? The configurator doesn't show anything!</h5>
169
+ <p>All of the styles are loaded dynamically. You must start typing in the text boxes to select styles to edit.</p>
170
+ <p>"Base" is the query group that contains styles that are not associated with any particular "At-rule."</p>
171
+ <p>Start by clicking the "Query/Selector" tab and typing "base" in the first box. You can then start typing in the second box to retrieve the style selectors to edit. </p>
172
+ <h5 id="preview-not-loading">Why do the preview tabs return "Stylesheet could not be displayed"?</h5>
173
+ <p>You have to load a child theme from the Parent/Child tab for the preview to display. This can also happen when your WP_CONTENT_URL is different than $bloginfo('site_url'). Ajax cannot make cross-domain requests by default. Check that your Settings > General > "WordPress Address (URL)" value is correct. (Often caused by missing "www" in the domain.) </p>
174
+ <h5 id="edit_manually">Can I edit the Child Theme stylesheet manually offline or by using the Editor or do I have to use the Configurator?</h5>
175
+ <p>You can make any manual changes you wish to the stylesheet. Just make sure you import the revised stylesheet using the Parent/Child panel or the Configurator will overwrite your changes the next time you use it. Just follow the steps as usual but select the "Use Existing Child Theme" radio button as the "Child Theme" option. The Configurator will automatically update its internal data from the new stylesheet. </p>
176
+ <h5 id="update_child">If the parent theme changes (e.g., upgrade), do I have to update the child theme?</h5>
177
+ <p>No. This is the point of using child themes. Changes to the parent theme are automatically inherited by the child theme.</p>
178
+ <p>A child theme is not a "copy" of the parent theme. It is a special feature of WordPress that let's you override specific styles and functions leaving the rest of the theme intact. The only time you need to make changes after an upgrade is if the parent removes or changes style or function names. Quality themes should identify any deprecated functions or styles in the upgrade notes so that child theme users can make adjustments accordingly. </p>
179
+ <h5 id="functions">Where are the .php files?</h5>
180
+ <p>The configurator automatically adds a blank functions.php file to the child theme directory. You can copy parent theme template files using the Files tab. If you want to create new templates and directories you will have to create/upload them manually via FTP or SSH. Remember that a child theme will automatically inherit the parent theme's templates unless they also exist in the child theme directory. Only copy templates that you intend to customize.</p>
181
+ <h5 id="specific_color">How do I change a specific color/font style/background?</h5>
182
+ <p>You can override a specific value globally using the Rule/Value tab. See Rule/Value, above.</p>
183
+ <h5 id="add_styles">How do I add styles that aren't in the Parent Theme?</h5>
184
+ <p>You can add queries and selectors using the "Raw CSS" textarea on the Query/Selector tab. See Query/Selector, above. </p>
185
+ <h5 id="add_styles">How do I remove a style from the Parent Theme?</h5>
186
+ <p>You shouldn't really "remove" a style from the Parent. You can, however, set the rule to "inherit," "none," or zero (depending on the rule). This will negate the Parent value. Some experimentation may be necessary.</p>
187
+ <h5 id="remove_styles">How do I remove a style from the Child Theme?</h5>
188
+ <p>Delete the value from the input for the rule you wish to remove. The Child Theme Configurator only adds overrides for rules that contain values. </p>
189
+ <h5 id="important_flag">How do I set the !important flag?</h5>
190
+ <p>We always recommend relying on good cascading design over global overrides. To that end, you have ability to change the load order of child theme styles by entering a value in the "Order" field. And yes, you can now set rules as important by checking the "!" box next to each input. Please use judiciously. </p>
191
+ <h5 id="gradients">How do I create cross-browser gradients?</h5>
192
+ <p>The Child Theme Configurator uses a standardized syntax for gradients and only supports two-color gradients without intermediate stops. The inputs consist of origin (e.g., top, left, 135deg, etc.), start color and end color. The browser-specific syntax is generated automatically when you save these values. See Caveats, below, for more information. </p>
193
+ <h5 id="responsive">How do I make my Theme responsive?</h5>
194
+ <p>The short answer is to use a responsive Parent Theme. Some common methods for responsive design are:
195
+ <ul class="instructions"><li>Avoiding fixed width and height values. Using max- and min-height values and percentages are ways to make your designs respond to the viewer's browser size.</li>
196
+ <li>Combining floats and clears with inline and relative positions allow the elements to adjust gracefully to their container's width.</li>
197
+ <li>Showing and hiding content with Javascript.</li></ul>
198
+ <p>We've put together a video tutorial that shows how to use Child Theme Configurator to make a fixed-width theme responsive.</p>
199
+ <iframe width="560" height="315" src="//www.youtube.com/embed/iBiiAgsK4G4?rel=0&modestbranding=1" frameborder="0" allowfullscreen></iframe>
200
+ <!-- END tab -->
201
+ <!-- BEGIN tab -->
202
+ <h3 id="ctc_glossary">Glossary</h3>
203
+ <ul>
204
+ <li id="parent_theme"><strong>Parent Theme</strong> The WordPress Theme you wish to edit. WordPress first loads the Child Theme, then loads the Parent Theme. If a style exists in the Child Theme, it overrides the Parent Theme.</li>
205
+ <li id="child_theme"><strong>Child Theme</strong> New Theme based on Parent Theme. You can create any number of Child Themes from a single Parent Theme.</li>
206
+ <li id="class"><strong>Class</strong> A term used to organize objects. For example, a &lt;div&gt; might be assigned the "blue-text" class. The stylesheet might then assign the "color: blue;" rule to members of the "blue-text" class. Thus, the &lt;div&gt; would display text as blue in the browser.</li>
207
+ <li id="selector"><strong>Selector</strong> One or more html elements, classes, ids or other terms used to identify groups of objects.</li>
208
+ <li id="rule"><strong>Rule</strong> One of many standardized attributes used to tell the browser how to display objects matching a given selector. Examples are <strong>color</strong>, <strong>background-image</strong> and <strong>font-size</strong>.</li>
209
+ <li id="at-rule"><strong>At-rule</strong> CSS browser instruction to extend default functionality. The Child Theme Configurator supports two At-rules:
210
+ <ul>
211
+ <li id="import"><strong>@import</strong> Instructs the browser to load additional CSS information from an external source.</li>
212
+ <li id="query"><strong>@media (Media Query)</strong> Identifies blocks of styles that are used only when certain browser characteristics are true. Examples are max-width, screen and print.</li>
213
+ </ul>
214
+ </li>
215
+ <li id="override"><strong>Override</strong> When a selector exists in both the Child Theme and the Parent Theme, the Child Theme takes priority over the Parent theme. This is where the Child Theme Configurator stands out: it helps you create <strong>exact overrides</strong> of selectors from the Parent Theme, eliminating hours of trial and error.</li>
216
+ </ul>
217
+ <!-- END tab -->
218
+ <h3 id="ctc_help_sidebar">Links</h3>
219
+ <!-- BEGIN sidebar -->
220
+ <h4>We HATE when plugins nag and shame us into donations...</h4>
221
+ <span style="font-size:smaller">...but we LOVE referrals.</span><br/><a href="http://wordpress.org/support/view/plugin-reviews/child-theme-configurator?rate=5#postform">Give Us 5 Stars</a>
222
+ <h4>Not just for themes ... but plugins, too!</h4>
223
+ <p style="font-size:smaller">Easily modify styles for any WordPress Plugin installed on your website. The Child Theme Configurator Plugin Extension scans your plugins and allows you to create custom stylesheets in your Child Theme. <a href="http://www.lilaeamedia.com/plugins/child-theme-plugin-styles" title="Child Theme Configurator Extension">Learn more</a></p>
224
+ <ul>
225
+ <li><a href="http://www.lilaeamedia.com/about/contact/">Contact us</a></li>
226
+ <li><a href="http://www.lilaeamedia.com/plugins/child-theme-configurator">Plugin Website</a></li>
227
+ <li><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8QE5YJ8WE96AJ">Donate</a></li>
228
+ <li><a href="http://codex.wordpress.org/Child_Themes">WordPress Codex</a></li>
229
+ <li><a href="http://wordpress.stackexchange.com/">WordPress Answers</a></li>
230
+ </ul>
231
+ <!-- END sidebar -->
js/chld-thm-cfg.js CHANGED
@@ -2,7 +2,7 @@
2
  * Script: chld-thm-cfg.js
3
  * Plugin URI: http://www.lilaeamedia.com/plugins/child-theme-configurator/
4
  * Description: Handles jQuery, AJAX and other UI
5
- * Version: 1.5.4
6
  * Author: Lilaea Media
7
  * Author URI: http://www.lilaeamedia.com/
8
  * License: GPLv2
@@ -10,34 +10,32 @@
10
  */
11
  jQuery(document).ready(function($){
12
 
13
- var lf = "\n",
14
- currentQuery = 'base',
15
- currentSel,
16
- saveEvents = {},
17
- rewrite_id,
18
- rewrite_sel,
19
- quot_regex = new RegExp('"', 'g'),
20
  // initialize functions
21
- esc_quot = function(str){
22
  return ctc_is_empty(str) ? str : str.toString().replace(quot_regex, '&quot;');
23
- },
24
- ctc_setup_iris = function(obj) {
 
25
  $(obj).iris({
26
- change: function() {
 
 
 
 
27
  ctc_coalesce_inputs(obj);
28
- }
29
  });
30
- },
31
- from_ascii = function(str) {
32
  var ascii = parseInt(str),
33
  chr = String.fromCharCode(ascii)
34
  return chr;
35
- },
36
- to_ascii = function(str) {
37
  var ascii = str.charCodeAt(0);
38
  return ascii;
39
- },
40
- ctc_coalesce_inputs = function(obj) {
41
  var regex = /^(ctc_(ovrd|\d+)_(parent|child)_([0-9a-z\-]+)_(\d+))(_\w+)?$/,
42
  $container = $(obj).parents('.ctc-selector-row, .ctc-parent-row').first(),
43
  $swatch = $container.find('.ctc-swatch').first(),
@@ -65,9 +63,14 @@ jQuery(document).ready(function($){
65
  inputrule = ('undefined' == typeof inputparts[4] ? '' : inputparts[4]),
66
  qsid = inputparts[5],
67
  rulepart = ('undefined' == typeof inputparts[6] ? '' : inputparts[6]),
68
- value = ('parent' == inputtheme ? $(this).text() : $(this).val()),
69
  important = 'ctc_' + inputseq + '_child_' + inputrule + '_i_' + qsid,
70
  parts, subparts;
 
 
 
 
 
71
  if ('child' == inputtheme) {
72
  postdata[inputid] = value;
73
  postdata[important] = ($('#' + important).is(':checked')) ? 1 : 0;
@@ -77,79 +80,81 @@ jQuery(document).ready(function($){
77
  return;
78
  }*/
79
  if ('' != value) {
80
- // handle specific inputs
81
- if (false === ctc_is_empty(rulepart)) {
82
- switch(rulepart) {
83
- case '_border_width':
84
- cssrules[inputtheme][inputrule + '-width'] = value;
85
- break;
86
- case '_border_style':
87
- cssrules[inputtheme][inputrule + '-style'] = value;
88
- break;
89
- case '_border_color':
90
- cssrules[inputtheme][inputrule + '-color'] = value;
91
- break;
92
- case '_background_url':
93
- cssrules[inputtheme]['background-image'] = ctc_image_url(inputtheme, value);
94
- break;
95
- case '_background_color':
96
- cssrules[inputtheme]['background-color'] = obj.value;
97
- break;
98
- case '_background_color1':
99
- gradient[inputtheme].start = value;
100
- has_gradient[inputtheme] = true;
101
- break;
102
- case '_background_color2':
103
- gradient[inputtheme].end = value;
104
- has_gradient[inputtheme] = true;
105
- break;
106
- case '_background_origin':
107
- gradient[inputtheme].origin = value;
108
- has_gradient[inputtheme] = true;
109
- break;
110
- }
111
- } else {
112
- // handle borders
113
- if (parts = inputrule.toString().match(/^border(\-(top|right|bottom|left))?$/) && !value.match(/none/)) {
114
- subparts = value.toString().split(/ +/);
115
- cssrules[inputtheme][inputrule + '-width'] = 'undefined' == typeof subparts[0] ? '' : subparts[0];
116
- cssrules[inputtheme][inputrule + '-style'] = 'undefined' == typeof subparts[1] ? '' : subparts[1];
117
- cssrules[inputtheme][inputrule + '-color'] = 'undefined' == typeof subparts[2] ? '' : subparts[2];
118
- // handle background images
119
- } else if ( 'background-image' == inputrule ) {
120
- if (value.toString().match(/url\(/)) {
121
- cssrules[inputtheme]['background-image'] = ctc_image_url(inputtheme, value);
122
- } else {
123
- subparts = value.toString().split(/ +/);
124
- if (subparts.length > 2) {
125
- gradient[inputtheme].origin = 'undefined' == typeof subparts[0] ? 'top' : subparts[0];
126
- gradient[inputtheme].start = 'undefined' == typeof subparts[1] ? 'transparent' : subparts[1];
127
- gradient[inputtheme].end = 'undefined' == typeof subparts[2] ? 'transparent' : subparts[2];
128
  has_gradient[inputtheme] = true;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
  } else {
130
- cssrules[inputtheme]['background-image'] = value;
 
 
 
 
 
 
 
 
131
  }
 
 
132
  }
133
- } else {
134
- cssrules[inputtheme][inputrule] = value;
135
  }
136
  }
137
- }
138
  });
139
  // update swatch
140
  if ('undefined' != typeof $swatch && false === ctc_is_empty($swatch.attr('id'))) {
141
- $($swatch).removeAttr('style');
142
- if (has_gradient.parent) { $($swatch).ctcgrad(gradient.parent.origin, [gradient.parent.start, gradient.parent.end]); }
143
- $($swatch).css(cssrules.parent);
 
144
  if (!($swatch.attr('id').toString().match(/parent/))){
145
- if (has_gradient.child) { $($swatch).ctcgrad(gradient.child.origin, [gradient.child.start, gradient.child.end]); }
146
- $($swatch).css(cssrules.child);
 
147
  }
148
- $($swatch).css({'z-index':-1});
149
  }
150
  return postdata;
151
- },
152
- ctc_update_cache = function(response) {
153
  var currQuery, currSelId, currRuleId;
154
  $(response).each(function(){
155
  switch (this.obj) {
@@ -194,8 +199,8 @@ jQuery(document).ready(function($){
194
  break;
195
  }
196
  });
197
- },
198
- ctc_image_url = function(theme, value) {
199
  var parts = value.toString().match(/url\(['" ]*(.+?)['" ]*\)/),
200
  path = ctc_is_empty(parts) ? null : parts[1],
201
  url = ctcAjax.theme_uri + '/' + ('parent' == theme ? ctcAjax.parnt : ctcAjax.child) + '/',
@@ -208,9 +213,8 @@ jQuery(document).ready(function($){
208
  image_url = 'url(' + url + path + ')';
209
  }
210
  return image_url;
211
- },
212
-
213
- ctc_is_empty = function(obj) {
214
  // first bail when definitely empty or undefined (true) NOTE: zero is not empty
215
  if ('undefined' == typeof obj || false === obj || null === obj || '' === obj) { return true; }
216
  // then, if this is bool, string or number it must not be empty (false)
@@ -234,9 +238,8 @@ jQuery(document).ready(function($){
234
  // this must be an unsupported datatype, so return not empty
235
  return false;
236
 
237
- },
238
-
239
- ctc_load_queries = function() {
240
  var arr = [];
241
  if (1 === loading.sel_ndx) return arr;
242
  if (0 === loading.sel_ndx) { // {
@@ -252,9 +255,8 @@ jQuery(document).ready(function($){
252
  });
253
  }
254
  return arr;
255
- },
256
-
257
- ctc_load_selectors = function(query) {
258
  var arr = [];
259
  if (1 === loading.sel_ndx) {
260
  return arr;
@@ -272,9 +274,9 @@ jQuery(document).ready(function($){
272
  });
273
  }
274
  return arr;
275
- },
276
 
277
- ctc_load_rules = function() {
278
  var arr = [];
279
  if (1 === loading.rule) return arr;
280
  if (0 === loading.rule) {
@@ -295,9 +297,8 @@ jQuery(document).ready(function($){
295
  return -1;
296
  return 0;
297
  });
298
- },
299
-
300
- ctc_render_child_rule_input = function(qsid, rule, seq) {
301
  var html = '',
302
  value = (ctc_is_empty(ctcAjax.sel_val[qsid])
303
  || ctc_is_empty(ctcAjax.sel_val[qsid].value)
@@ -348,8 +349,8 @@ jQuery(document).ready(function($){
348
  html += '</div><!-- end input row -->' + lf;
349
  }
350
  return html;
351
- },
352
- ctc_render_selector_inputs = function(qsid) {
353
  if (1 === loading.sel_val) {
354
  return false;
355
  }
@@ -383,8 +384,8 @@ jQuery(document).ready(function($){
383
  ctc_coalesce_inputs('#ctc_child_all_0_swatch');
384
  }
385
  }
386
- },
387
- ctc_render_css_preview = function(theme) {
388
  if (1 === loading.preview) {
389
  return false;
390
  }
@@ -402,8 +403,8 @@ jQuery(document).ready(function($){
402
  $('#view_'+theme+'_options_panel').text(ctcAjax.previewResponse);
403
  loading.preview = 0;
404
  }
405
- },
406
- ctc_render_rule_value_inputs = function(ruleid) {
407
  if (1 === loading.rule_val) return false;
408
 
409
  if (0 == loading.rule_val) {
@@ -424,20 +425,21 @@ jQuery(document).ready(function($){
424
  + ctcAjax.swatch_txt + '</div></div>' + lf;
425
  html += '<div class="ctc-input-cell"><a href="#" class="ctc-selector-handle" id="ctc_selector_' + rule + '_' + valid + '">'
426
  + ctcAjax.selector_txt + '</a></div>' + lf;
427
- html += '<div id="ctc_selector_' + rule + '_' + valid + '_container" class="ctc-selector-container clearfix">' + lf;
428
- html += '<a href="#" id="ctc_selector_' + rule + '_' + valid + '_close" class="ctc-selector-handle" style="float:right">'
429
- + ctcAjax.close_txt + '</a><div id="ctc_status_val_qry_' + valid + '"></div>' + lf;
 
 
430
  html += '<div id="ctc_selector_' + rule + '_' + valid + '_rows"></div>' + lf;
431
- html += '</div></div>' + lf;
432
  });
433
  html += '</div>' + lf;
434
  }
435
  $('#ctc_rule_value_inputs').html(html).find('.ctc-swatch').each(function() {
436
  ctc_coalesce_inputs(this);
437
  });
438
- },
439
-
440
- ctc_render_selector_value_inputs = function(valid) {
441
  if (1 == loading.val_qry) return false;
442
  var params,
443
  page_ruleid,
@@ -472,8 +474,8 @@ jQuery(document).ready(function($){
472
  ctc_coalesce_inputs(this);
473
  });
474
 
475
- },
476
- ctc_query_css = function(obj, key, callback, params) {
477
  var postdata = { 'ctc_query_obj' : obj, 'ctc_query_key': key },
478
  status_sel = '#ctc_status_' + obj + ('val_qry' == obj ? '_' + key : '');
479
 
@@ -496,7 +498,7 @@ jQuery(document).ready(function($){
496
  postdata,
497
  //on success function
498
  function(response){
499
- // console.log(response);
500
  // hide spinner
501
  loading[obj] = 2;
502
  $('.ctc-status-icon').removeClass('spinner');
@@ -536,8 +538,8 @@ jQuery(document).ready(function($){
536
 
537
  });
538
  return false;
539
- },
540
- ctc_save = function(obj) {
541
  var postdata = {},
542
  $selector, $query, $imports, $rule,
543
  id = $(obj).attr('id'), newsel;
@@ -616,8 +618,8 @@ jQuery(document).ready(function($){
616
  $('.ctc-status-icon').addClass('failure');
617
  });
618
  return false;
619
- },
620
- ctc_decode_value = function(rule, value) {
621
  value = ('undefined' == typeof value ? '' : value);
622
  var obj = { 'orig': value };
623
  if (rule.toString().match(/^border(\-(top|right|bottom|left))?$/)) {
@@ -654,9 +656,8 @@ jQuery(document).ready(function($){
654
  obj['values'] = [ value ];
655
  }
656
  return obj;
657
- },
658
-
659
- ctc_set_query = function(value) {
660
  currentQuery = value;
661
  $('#ctc_sel_ovrd_query').val('');
662
  $('#ctc_sel_ovrd_query_selected').text(value);
@@ -666,9 +667,8 @@ jQuery(document).ready(function($){
666
  ctc_setup_selector_menu(value);
667
  ctc_coalesce_inputs('#ctc_child_all_0_swatch');
668
  $('#ctc_new_selector_row').show();
669
- },
670
-
671
- ctc_set_selector = function(value,label) {
672
  $('#ctc_sel_ovrd_selector').val('');
673
  $('#ctc_sel_ovrd_selector_selected').text(label);
674
  $('#ctc_sel_ovrd_qsid').val(value);
@@ -677,17 +677,16 @@ jQuery(document).ready(function($){
677
  ctc_render_selector_inputs(value);
678
  $('.ctc-rewrite-toggle').text(ctcAjax.rename_txt);
679
  $('#ctc_sel_ovrd_new_rule, #ctc_sel_ovrd_rule_header,#ctc_sel_ovrd_rule_inputs_container,#ctc_sel_ovrd_rule_inputs,.ctc-rewrite-toggle').show();
680
- },
681
-
682
- ctc_set_rule = function(value,label) {
683
  $('#ctc_rule_menu').val('');
684
  $('#ctc_rule_menu_selected').text(label);
685
  if (1 != loading.rule_val) loading.rule_val = 0;
686
  ctc_render_rule_value_inputs(value);
687
  $('.ctc-rewrite-toggle').text(ctcAjax.rename_txt);
688
  $('#ctc_rule_value_inputs,#ctc_input_row_rule_header').show();
689
- },
690
- ctc_setup_query_menu = function() {
691
  ctc_queries = ctc_load_queries();
692
  $('#ctc_sel_ovrd_query').autocomplete({
693
  source: ctc_queries,
@@ -702,8 +701,8 @@ jQuery(document).ready(function($){
702
  e.preventDefault();
703
  }
704
  });
705
- },
706
- ctc_setup_selector_menu = function(query) {
707
  ctc_selectors = ctc_load_selectors(query);
708
  $('#ctc_sel_ovrd_selector').autocomplete({
709
  source: ctc_selectors,
@@ -715,8 +714,8 @@ jQuery(document).ready(function($){
715
  },
716
  focus: function(e) { e.preventDefault(); }
717
  });
718
- },
719
- ctc_setup_rule_menu = function() {
720
  ctc_rules = ctc_load_rules();
721
  $('#ctc_rule_menu').autocomplete({
722
  source: ctc_rules,
@@ -729,8 +728,8 @@ jQuery(document).ready(function($){
729
  },
730
  focus: function(e) { e.preventDefault(); }
731
  });
732
- },
733
- ctc_filtered_rules = function(request, response) {
734
  var arr = [],
735
  noval = (ctc_is_empty(ctcAjax.sel_val[currentSel])) || (ctc_is_empty(ctcAjax.sel_val[currentSel].value));
736
  if (ctc_is_empty(ctc_rules)) {
@@ -757,8 +756,8 @@ jQuery(document).ready(function($){
757
  }
758
  });
759
  response(arr);
760
- },
761
- ctc_setup_new_rule_menu = function() {
762
  $('#ctc_new_rule_menu').autocomplete({
763
  source: ctc_filtered_rules,
764
  //minLength: 0,
@@ -782,14 +781,14 @@ jQuery(document).ready(function($){
782
  },
783
  focus: function(e) { e.preventDefault(); }
784
  });
785
- },
786
- ctc_setup_menus = function() {
787
  ctc_setup_query_menu();
788
  ctc_setup_selector_menu(currentQuery);
789
  ctc_setup_rule_menu();
790
  ctc_setup_new_rule_menu();
791
- },
792
- ctc_theme_exists = function(testslug, testtype) {
793
  var exists = false;
794
  $.each(ctcAjax.themes, function(type, theme){
795
  $.each(theme, function(slug, data){
@@ -801,9 +800,23 @@ jQuery(document).ready(function($){
801
  if (exists) return false;
802
  });
803
  return exists;
804
- },
805
-
806
- ctc_set_notice = function(noticearr) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
807
  var errorHtml = '';
808
  if (false === ctc_is_empty(noticearr)) {
809
  $.each(noticearr, function(type, list){
@@ -815,8 +828,8 @@ jQuery(document).ready(function($){
815
  });
816
  }
817
  $('#ctc_error_notice').html(errorHtml);
818
- },
819
- ctc_validate = function() {
820
  var regex = /[^\w\-]/,
821
  newslug = $('#ctc_child_template').val().toString().replace(regex).toLowerCase(),
822
  slug = $('#ctc_theme_child').val().toString().replace(regex).toLowerCase(),
@@ -837,20 +850,23 @@ jQuery(document).ready(function($){
837
  return false;
838
  }
839
  return true;
840
- },
841
- ctc_set_theme_menu = function(e) {
842
- var slug = $('#ctc_theme_child').val();
843
- if (false === ctc_is_empty(ctcAjax.themes.child[slug])) {
844
- $('#ctc_child_name').val(ctcAjax.themes.child[slug].Name);
845
- $('#ctc_child_author').val(ctcAjax.themes.child[slug].Author);
846
- $('#ctc_child_version').val(ctcAjax.themes.child[slug].Version);
847
- }
848
- },
849
- fade_update_notice = function() {
 
 
 
 
850
  $('.updated, .error').slideUp('slow', function(){ $('.updated').remove(); });
851
- },
852
-
853
- ctc_set_addl_css = function () {
854
  var template = $('#ctc_theme_parnt').val(),
855
  theme_uri = ctcAjax.theme_uri.replace(/^https?:\/\//, ''),
856
  homeurl = ctcAjax.homeurl.replace(/^https?/, ctcAjax.ssl ? 'https' : 'http'),
@@ -868,8 +884,8 @@ jQuery(document).ready(function($){
868
  });
869
  }
870
  });
871
- },
872
- ctc_focus_panel = function (id) {
873
  var panelid = id + '_panel';
874
  $('.nav-tab').removeClass('nav-tab-active');
875
  $('.ctc-option-panel').removeClass('ctc-option-panel-active');
@@ -877,8 +893,8 @@ jQuery(document).ready(function($){
877
  $(id).addClass('nav-tab-active');
878
  $('.ctc-option-panel-container').scrollTop(0);
879
  $(panelid).addClass('ctc-option-panel-active');
880
- },
881
- ctc_selector_edit = function(obj) {
882
  var qsid = $(obj).attr('id').match(/_(\d+)$/)[1],
883
  q = ctcAjax.sel_val[qsid].query,
884
  s = ctcAjax.sel_val[qsid].selector,
@@ -886,8 +902,8 @@ jQuery(document).ready(function($){
886
  ctc_set_query(q);
887
  ctc_set_selector(qsid, s);
888
  ctc_focus_panel(id);
889
- },
890
- ctc_selector_input_toggle = function(obj) {
891
  var origval;
892
  if ($('#ctc_rewrite_selector').length) {
893
  origval = $('#ctc_rewrite_selector_orig').val();
@@ -902,38 +918,67 @@ jQuery(document).ready(function($){
902
  }
903
  }
904
  // initialize vars
905
- // ajax semaphores: 0 = reload, 1 = loading, 2 = loaded
906
- loading = {
907
- 'rule': 2,
908
- 'sel_ndx': 2,
909
- 'val_qry': 0,
910
- 'rule_val': 0,
911
- 'sel_val': 0,
912
- 'preview': 0
913
- },
914
-
915
- ctc_selectors = [],
916
- ctc_queries = [],
917
- ctc_rules = [];
 
 
 
 
 
 
 
 
918
  // -- end var definitions
919
 
920
- // initialize Iris color picker
921
- $('.color-picker').each(function() {
922
- ctc_setup_iris(this);
 
 
 
 
 
923
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
924
  // bind event handlers
 
925
  $('.ctc-option-panel-container').on('focus', '.color-picker', function(){
926
  ctc_set_notice('')
 
927
  $(this).iris('toggle');
928
  $('.iris-picker').css({'position':'absolute', 'z-index':10});
929
  });
930
- $('.ctc-option-panel-container').on('focus', 'input', function() {
931
- ctc_set_notice('')
932
- $('.color-picker').not(this).iris('hide');
933
- });
934
  $('.ctc-option-panel-container').on('change', '.ctc-child-value, input[type=checkbox]', function() {
935
  ctc_coalesce_inputs(this);
936
  });
 
937
  $('.ctc-option-panel-container').on('click', '.ctc-selector-handle', function(e) {
938
  e.preventDefault();
939
  ctc_set_notice('')
@@ -958,7 +1003,6 @@ jQuery(document).ready(function($){
958
  $('#ctc_load_form').on('submit', function() {
959
  return (ctc_validate() && confirm(ctcAjax.load_txt) ) ;
960
  });
961
- $('#parent_child_options_panel').on('change', '#ctc_theme_child', ctc_set_theme_menu );
962
  $(document).on('click', '.ctc-save-input', function(e) {
963
  ctc_save(this);
964
  });
@@ -968,20 +1012,42 @@ jQuery(document).ready(function($){
968
  $(document).on('click', '.ctc-rewrite-toggle', function(e) {
969
  e.preventDefault();
970
  ctc_selector_input_toggle(this);
971
- });//ctc_rewrite_toggle
972
- $(document).on('change', '#ctc_theme_parnt', function(e) {
973
- $(this).parents('.ctc-input-row').first().append('<span class="ctc-status-icon spinner"></span>');
974
- $('.spinner').show();
975
- document.location='?page=chld_thm_cfg_menu&ctc_parent=' + $(this).val();
976
  });
977
- $(document).on('click', '#ctc_additional_css_label', function(e){
978
  $(this).toggleClass('open');
979
- $('#ctc_additional_css_files').slideToggle('fast');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
980
  });
981
  // initialize menus
982
  ctc_setup_menus();
983
  ctc_set_query(currentQuery);
984
  ctc_set_addl_css();
 
985
  $('input[type=submit],input[type=button]').prop('disabled', false);
986
  setTimeout(fade_update_notice, 6000);
987
  });
2
  * Script: chld-thm-cfg.js
3
  * Plugin URI: http://www.lilaeamedia.com/plugins/child-theme-configurator/
4
  * Description: Handles jQuery, AJAX and other UI
5
+ * Version: 1.6.0
6
  * Author: Lilaea Media
7
  * Author URI: http://www.lilaeamedia.com/
8
  * License: GPLv2
10
  */
11
  jQuery(document).ready(function($){
12
 
 
 
 
 
 
 
 
13
  // initialize functions
14
+ function esc_quot(str){
15
  return ctc_is_empty(str) ? str : str.toString().replace(quot_regex, '&quot;');
16
+ }
17
+ function ctc_setup_iris(obj) {
18
+ //console.log('setting up iris ' + ('undefined' != typeof $(obj).attr('id') ? $(obj).attr('id') : ''));
19
  $(obj).iris({
20
+ change: function(e,ui) {
21
+ //console.log('change event '
22
+ //+ ('undefined' != typeof $(this).attr('id') ? $(this).attr('id') : '')
23
+ //+ ' ' + ui.color.toString());
24
+ $(obj).data('color', ui.color.toString());
25
  ctc_coalesce_inputs(obj);
26
+ }
27
  });
28
+ }
29
+ function from_ascii(str) {
30
  var ascii = parseInt(str),
31
  chr = String.fromCharCode(ascii)
32
  return chr;
33
+ }
34
+ function to_ascii(str) {
35
  var ascii = str.charCodeAt(0);
36
  return ascii;
37
+ }
38
+ function ctc_coalesce_inputs(obj) {
39
  var regex = /^(ctc_(ovrd|\d+)_(parent|child)_([0-9a-z\-]+)_(\d+))(_\w+)?$/,
40
  $container = $(obj).parents('.ctc-selector-row, .ctc-parent-row').first(),
41
  $swatch = $container.find('.ctc-swatch').first(),
63
  inputrule = ('undefined' == typeof inputparts[4] ? '' : inputparts[4]),
64
  qsid = inputparts[5],
65
  rulepart = ('undefined' == typeof inputparts[6] ? '' : inputparts[6]),
66
+ value = ('parent' == inputtheme ? $(this).text().replace(/!$/,'') : $(this).val()),
67
  important = 'ctc_' + inputseq + '_child_' + inputrule + '_i_' + qsid,
68
  parts, subparts;
69
+ if (false === ctc_is_empty($(this).data('color'))) {
70
+ value = $(this).data('color');
71
+ $(this).data('color', null);
72
+ }
73
+ //console.log('id: ' + inputid + ' value: ' + value);
74
  if ('child' == inputtheme) {
75
  postdata[inputid] = value;
76
  postdata[important] = ($('#' + important).is(':checked')) ? 1 : 0;
80
  return;
81
  }*/
82
  if ('' != value) {
83
+ // handle specific inputs
84
+ if (false === ctc_is_empty(rulepart)) {
85
+ switch(rulepart) {
86
+ case '_border_width':
87
+ cssrules[inputtheme][inputrule + '-width'] = value;
88
+ break;
89
+ case '_border_style':
90
+ cssrules[inputtheme][inputrule + '-style'] = value;
91
+ break;
92
+ case '_border_color':
93
+ cssrules[inputtheme][inputrule + '-color'] = value;
94
+ break;
95
+ case '_background_url':
96
+ cssrules[inputtheme]['background-image'] = ctc_image_url(inputtheme, value);
97
+ break;
98
+ case '_background_color':
99
+ cssrules[inputtheme]['background-color'] = obj.value;
100
+ break;
101
+ case '_background_color1':
102
+ gradient[inputtheme].start = value;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  has_gradient[inputtheme] = true;
104
+ break;
105
+ case '_background_color2':
106
+ gradient[inputtheme].end = value;
107
+ has_gradient[inputtheme] = true;
108
+ break;
109
+ case '_background_origin':
110
+ gradient[inputtheme].origin = value;
111
+ has_gradient[inputtheme] = true;
112
+ break;
113
+ }
114
+ } else {
115
+ // handle borders
116
+ if (parts = inputrule.toString().match(/^border(\-(top|right|bottom|left))?$/) && !value.match(/none/)) {
117
+ subparts = value.toString().split(/ +/);
118
+ cssrules[inputtheme][inputrule + '-width'] = 'undefined' == typeof subparts[0] ? '' : subparts[0];
119
+ cssrules[inputtheme][inputrule + '-style'] = 'undefined' == typeof subparts[1] ? '' : subparts[1];
120
+ cssrules[inputtheme][inputrule + '-color'] = 'undefined' == typeof subparts[2] ? '' : subparts[2];
121
+ // handle background images
122
+ } else if ( 'background-image' == inputrule ) {
123
+ if (value.toString().match(/url\(/)) {
124
+ cssrules[inputtheme]['background-image'] = ctc_image_url(inputtheme, value);
125
  } else {
126
+ subparts = value.toString().split(/ +/);
127
+ if (subparts.length > 2) {
128
+ gradient[inputtheme].origin = 'undefined' == typeof subparts[0] ? 'top' : subparts[0];
129
+ gradient[inputtheme].start = 'undefined' == typeof subparts[1] ? 'transparent' : subparts[1];
130
+ gradient[inputtheme].end = 'undefined' == typeof subparts[2] ? 'transparent' : subparts[2];
131
+ has_gradient[inputtheme] = true;
132
+ } else {
133
+ cssrules[inputtheme]['background-image'] = value;
134
+ }
135
  }
136
+ } else if ('seq' != inputrule) {
137
+ cssrules[inputtheme][inputrule] = value;
138
  }
 
 
139
  }
140
  }
 
141
  });
142
  // update swatch
143
  if ('undefined' != typeof $swatch && false === ctc_is_empty($swatch.attr('id'))) {
144
+ $swatch.removeAttr('style');
145
+ if (has_gradient.parent) { $swatch.ctcgrad(gradient.parent.origin, [gradient.parent.start, gradient.parent.end]); }
146
+ //console.log(cssrules.parent);
147
+ $swatch.css(cssrules.parent);
148
  if (!($swatch.attr('id').toString().match(/parent/))){
149
+ if (has_gradient.child) { $swatch.ctcgrad(gradient.child.origin, [gradient.child.start, gradient.child.end]); }
150
+ //console.log(cssrules.child);
151
+ $swatch.css(cssrules.child);
152
  }
153
+ $swatch.css({'z-index':-1});
154
  }
155
  return postdata;
156
+ }
157
+ function ctc_update_cache(response) {
158
  var currQuery, currSelId, currRuleId;
159
  $(response).each(function(){
160
  switch (this.obj) {
199
  break;
200
  }
201
  });
202
+ }
203
+ function ctc_image_url(theme, value) {
204
  var parts = value.toString().match(/url\(['" ]*(.+?)['" ]*\)/),
205
  path = ctc_is_empty(parts) ? null : parts[1],
206
  url = ctcAjax.theme_uri + '/' + ('parent' == theme ? ctcAjax.parnt : ctcAjax.child) + '/',
213
  image_url = 'url(' + url + path + ')';
214
  }
215
  return image_url;
216
+ }
217
+ function ctc_is_empty(obj) {
 
218
  // first bail when definitely empty or undefined (true) NOTE: zero is not empty
219
  if ('undefined' == typeof obj || false === obj || null === obj || '' === obj) { return true; }
220
  // then, if this is bool, string or number it must not be empty (false)
238
  // this must be an unsupported datatype, so return not empty
239
  return false;
240
 
241
+ }
242
+ function ctc_load_queries() {
 
243
  var arr = [];
244
  if (1 === loading.sel_ndx) return arr;
245
  if (0 === loading.sel_ndx) { // {
255
  });
256
  }
257
  return arr;
258
+ }
259
+ function ctc_load_selectors(query) {
 
260
  var arr = [];
261
  if (1 === loading.sel_ndx) {
262
  return arr;
274
  });
275
  }
276
  return arr;
277
+ }
278
 
279
+ function ctc_load_rules() {
280
  var arr = [];
281
  if (1 === loading.rule) return arr;
282
  if (0 === loading.rule) {
297
  return -1;
298
  return 0;
299
  });
300
+ }
301
+ function ctc_render_child_rule_input(qsid, rule, seq) {
 
302
  var html = '',
303
  value = (ctc_is_empty(ctcAjax.sel_val[qsid])
304
  || ctc_is_empty(ctcAjax.sel_val[qsid].value)
349
  html += '</div><!-- end input row -->' + lf;
350
  }
351
  return html;
352
+ }
353
+ function ctc_render_selector_inputs(qsid) {
354
  if (1 === loading.sel_val) {
355
  return false;
356
  }
384
  ctc_coalesce_inputs('#ctc_child_all_0_swatch');
385
  }
386
  }
387
+ }
388
+ function ctc_render_css_preview(theme) {
389
  if (1 === loading.preview) {
390
  return false;
391
  }
403
  $('#view_'+theme+'_options_panel').text(ctcAjax.previewResponse);
404
  loading.preview = 0;
405
  }
406
+ }
407
+ function ctc_render_rule_value_inputs(ruleid) {
408
  if (1 === loading.rule_val) return false;
409
 
410
  if (0 == loading.rule_val) {
425
  + ctcAjax.swatch_txt + '</div></div>' + lf;
426
  html += '<div class="ctc-input-cell"><a href="#" class="ctc-selector-handle" id="ctc_selector_' + rule + '_' + valid + '">'
427
  + ctcAjax.selector_txt + '</a></div>' + lf;
428
+ html += '<div id="ctc_selector_' + rule + '_' + valid + '_container" class="ctc-selector-container">' + lf;
429
+ html += '<a href="#" id="ctc_selector_' + rule + '_' + valid + '_close" class="ctc-selector-handle ctc-exit" title="'
430
+ + ctcAjax.close_txt + '"></a>';
431
+ html += '<div id="ctc_selector_' + rule + '_' + valid + '_inner_container" class="ctc-selector-inner-container clearfix">' + lf;
432
+ html += '<div id="ctc_status_val_qry_' + valid + '"></div>' + lf;
433
  html += '<div id="ctc_selector_' + rule + '_' + valid + '_rows"></div>' + lf;
434
+ html += '</div></div></div>' + lf;
435
  });
436
  html += '</div>' + lf;
437
  }
438
  $('#ctc_rule_value_inputs').html(html).find('.ctc-swatch').each(function() {
439
  ctc_coalesce_inputs(this);
440
  });
441
+ }
442
+ function ctc_render_selector_value_inputs(valid) {
 
443
  if (1 == loading.val_qry) return false;
444
  var params,
445
  page_ruleid,
474
  ctc_coalesce_inputs(this);
475
  });
476
 
477
+ }
478
+ function ctc_query_css(obj, key, callback, params) {
479
  var postdata = { 'ctc_query_obj' : obj, 'ctc_query_key': key },
480
  status_sel = '#ctc_status_' + obj + ('val_qry' == obj ? '_' + key : '');
481
 
498
  postdata,
499
  //on success function
500
  function(response){
501
+ //console.log(response);
502
  // hide spinner
503
  loading[obj] = 2;
504
  $('.ctc-status-icon').removeClass('spinner');
538
 
539
  });
540
  return false;
541
+ }
542
+ function ctc_save(obj) {
543
  var postdata = {},
544
  $selector, $query, $imports, $rule,
545
  id = $(obj).attr('id'), newsel;
618
  $('.ctc-status-icon').addClass('failure');
619
  });
620
  return false;
621
+ }
622
+ function ctc_decode_value(rule, value) {
623
  value = ('undefined' == typeof value ? '' : value);
624
  var obj = { 'orig': value };
625
  if (rule.toString().match(/^border(\-(top|right|bottom|left))?$/)) {
656
  obj['values'] = [ value ];
657
  }
658
  return obj;
659
+ }
660
+ function ctc_set_query(value) {
 
661
  currentQuery = value;
662
  $('#ctc_sel_ovrd_query').val('');
663
  $('#ctc_sel_ovrd_query_selected').text(value);
667
  ctc_setup_selector_menu(value);
668
  ctc_coalesce_inputs('#ctc_child_all_0_swatch');
669
  $('#ctc_new_selector_row').show();
670
+ }
671
+ function ctc_set_selector(value,label) {
 
672
  $('#ctc_sel_ovrd_selector').val('');
673
  $('#ctc_sel_ovrd_selector_selected').text(label);
674
  $('#ctc_sel_ovrd_qsid').val(value);
677
  ctc_render_selector_inputs(value);
678
  $('.ctc-rewrite-toggle').text(ctcAjax.rename_txt);
679
  $('#ctc_sel_ovrd_new_rule, #ctc_sel_ovrd_rule_header,#ctc_sel_ovrd_rule_inputs_container,#ctc_sel_ovrd_rule_inputs,.ctc-rewrite-toggle').show();
680
+ }
681
+ function ctc_set_rule(value,label) {
 
682
  $('#ctc_rule_menu').val('');
683
  $('#ctc_rule_menu_selected').text(label);
684
  if (1 != loading.rule_val) loading.rule_val = 0;
685
  ctc_render_rule_value_inputs(value);
686
  $('.ctc-rewrite-toggle').text(ctcAjax.rename_txt);
687
  $('#ctc_rule_value_inputs,#ctc_input_row_rule_header').show();
688
+ }
689
+ function ctc_setup_query_menu() {
690
  ctc_queries = ctc_load_queries();
691
  $('#ctc_sel_ovrd_query').autocomplete({
692
  source: ctc_queries,
701
  e.preventDefault();
702
  }
703
  });
704
+ }
705
+ function ctc_setup_selector_menu(query) {
706
  ctc_selectors = ctc_load_selectors(query);
707
  $('#ctc_sel_ovrd_selector').autocomplete({
708
  source: ctc_selectors,
714
  },
715
  focus: function(e) { e.preventDefault(); }
716
  });
717
+ }
718
+ function ctc_setup_rule_menu() {
719
  ctc_rules = ctc_load_rules();
720
  $('#ctc_rule_menu').autocomplete({
721
  source: ctc_rules,
728
  },
729
  focus: function(e) { e.preventDefault(); }
730
  });
731
+ }
732
+ function ctc_filtered_rules(request, response) {
733
  var arr = [],
734
  noval = (ctc_is_empty(ctcAjax.sel_val[currentSel])) || (ctc_is_empty(ctcAjax.sel_val[currentSel].value));
735
  if (ctc_is_empty(ctc_rules)) {
756
  }
757
  });
758
  response(arr);
759
+ }
760
+ function ctc_setup_new_rule_menu() {
761
  $('#ctc_new_rule_menu').autocomplete({
762
  source: ctc_filtered_rules,
763
  //minLength: 0,
781
  },
782
  focus: function(e) { e.preventDefault(); }
783
  });
784
+ }
785
+ function ctc_setup_menus() {
786
  ctc_setup_query_menu();
787
  ctc_setup_selector_menu(currentQuery);
788
  ctc_setup_rule_menu();
789
  ctc_setup_new_rule_menu();
790
+ }
791
+ function ctc_theme_exists(testslug, testtype) {
792
  var exists = false;
793
  $.each(ctcAjax.themes, function(type, theme){
794
  $.each(theme, function(slug, data){
800
  if (exists) return false;
801
  });
802
  return exists;
803
+ }
804
+ function autogen_slugs() {
805
+ var parent = $('#ctc_theme_parnt').val(),
806
+ slug = slugbase = parent + '-child',
807
+ name = ctcAjax.themes.parnt[parent].Name + ' Child',
808
+ suffix = '',
809
+ padded = '',
810
+ pad = '00';
811
+ while (ctc_theme_exists(slug, 'new')) {
812
+ suffix = ('' == suffix ? 2 : suffix + 1);
813
+ padded = pad.substring(0, pad.length - suffix.toString().length) + suffix.toString();
814
+ slug = slugbase + padded;
815
+ }
816
+ testslug = slug;
817
+ testname = name + (padded.length ? ' ' + padded : '');
818
+ }
819
+ function ctc_set_notice(noticearr) {
820
  var errorHtml = '';
821
  if (false === ctc_is_empty(noticearr)) {
822
  $.each(noticearr, function(type, list){
828
  });
829
  }
830
  $('#ctc_error_notice').html(errorHtml);
831
+ }
832
+ function ctc_validate() {
833
  var regex = /[^\w\-]/,
834
  newslug = $('#ctc_child_template').val().toString().replace(regex).toLowerCase(),
835
  slug = $('#ctc_theme_child').val().toString().replace(regex).toLowerCase(),
850
  return false;
851
  }
852
  return true;
853
+ }
854
+ function ctc_set_parent_menu(obj) {
855
+ $('#ctc_theme_parent').parents('.ctc-input-row').first().append('<span class="ctc-status-icon spinner"></span>');
856
+ $('.spinner').show();
857
+ document.location='?page=' + ctcAjax.page + '&ctc_parent=' + obj.value;
858
+ }
859
+ function ctc_set_child_menu(obj) {
860
+ if (false === ctc_is_empty(ctcAjax.themes.child[obj.value])) {
861
+ $('#ctc_child_name').val(ctcAjax.themes.child[obj.value].Name);
862
+ $('#ctc_child_author').val(ctcAjax.themes.child[obj.value].Author);
863
+ $('#ctc_child_version').val(ctcAjax.themes.child[obj.value].Version);
864
+ }
865
+ }
866
+ function fade_update_notice() {
867
  $('.updated, .error').slideUp('slow', function(){ $('.updated').remove(); });
868
+ }
869
+ function ctc_set_addl_css() {
 
870
  var template = $('#ctc_theme_parnt').val(),
871
  theme_uri = ctcAjax.theme_uri.replace(/^https?:\/\//, ''),
872
  homeurl = ctcAjax.homeurl.replace(/^https?/, ctcAjax.ssl ? 'https' : 'http'),
884
  });
885
  }
886
  });
887
+ }
888
+ function ctc_focus_panel(id) {
889
  var panelid = id + '_panel';
890
  $('.nav-tab').removeClass('nav-tab-active');
891
  $('.ctc-option-panel').removeClass('ctc-option-panel-active');
893
  $(id).addClass('nav-tab-active');
894
  $('.ctc-option-panel-container').scrollTop(0);
895
  $(panelid).addClass('ctc-option-panel-active');
896
+ }
897
+ function ctc_selector_edit(obj) {
898
  var qsid = $(obj).attr('id').match(/_(\d+)$/)[1],
899
  q = ctcAjax.sel_val[qsid].query,
900
  s = ctcAjax.sel_val[qsid].selector,
902
  ctc_set_query(q);
903
  ctc_set_selector(qsid, s);
904
  ctc_focus_panel(id);
905
+ }
906
+ function ctc_selector_input_toggle(obj) {
907
  var origval;
908
  if ($('#ctc_rewrite_selector').length) {
909
  origval = $('#ctc_rewrite_selector_orig').val();
918
  }
919
  }
920
  // initialize vars
921
+ var lf = "\n",
922
+ currentQuery = 'base',
923
+ currentSel,
924
+ saveEvents = {},
925
+ rewrite_id,
926
+ rewrite_sel,
927
+ quot_regex = new RegExp('"', 'g'),
928
+ testslug = '',
929
+ testname = '',
930
+ // ajax semaphores: 0 = reload, 1 = loading, 2 = loaded
931
+ loading = {
932
+ 'rule': 2,
933
+ 'sel_ndx': 2,
934
+ 'val_qry': 0,
935
+ 'rule_val': 0,
936
+ 'sel_val': 0,
937
+ 'preview': 0
938
+ },
939
+ ctc_selectors = [],
940
+ ctc_queries = [],
941
+ ctc_rules = [];
942
  // -- end var definitions
943
 
944
+ // initialize theme menus
945
+ autogen_slugs();
946
+ $.widget('ctc.themeMenu', $.ui.selectmenu, {
947
+ _renderItem: function( ul, item ) {
948
+ var li = $( "<li>" );
949
+ $('#ctc_theme_option_' + item.value).detach().appendTo(li);
950
+ return li.appendTo( ul );
951
+ }
952
  });
953
+ $('#ctc_theme_parnt').themeMenu({
954
+ select: function( event, ui ) {
955
+ ctc_set_parent_menu(ui.item);
956
+ }
957
+ });
958
+ if ( ctc_is_empty( ctcAjax.themes.child ) ) {
959
+ $('#ctc_child_name').val(testname);
960
+ $('#ctc_child_template').val(testslug);
961
+ } else {
962
+ $('#ctc_theme_child').themeMenu({
963
+ select: function( event, ui ) {
964
+ ctc_set_child_menu(ui.item);
965
+ }
966
+ });
967
+ }
968
+
969
  // bind event handlers
970
+
971
  $('.ctc-option-panel-container').on('focus', '.color-picker', function(){
972
  ctc_set_notice('')
973
+ $('.color-picker').not(this).iris('hide');
974
  $(this).iris('toggle');
975
  $('.iris-picker').css({'position':'absolute', 'z-index':10});
976
  });
977
+
 
 
 
978
  $('.ctc-option-panel-container').on('change', '.ctc-child-value, input[type=checkbox]', function() {
979
  ctc_coalesce_inputs(this);
980
  });
981
+
982
  $('.ctc-option-panel-container').on('click', '.ctc-selector-handle', function(e) {
983
  e.preventDefault();
984
  ctc_set_notice('')
1003
  $('#ctc_load_form').on('submit', function() {
1004
  return (ctc_validate() && confirm(ctcAjax.load_txt) ) ;
1005
  });
 
1006
  $(document).on('click', '.ctc-save-input', function(e) {
1007
  ctc_save(this);
1008
  });
1012
  $(document).on('click', '.ctc-rewrite-toggle', function(e) {
1013
  e.preventDefault();
1014
  ctc_selector_input_toggle(this);
 
 
 
 
 
1015
  });
1016
+ $(document).on('click', '.ctc-section-toggle', function(e){
1017
  $(this).toggleClass('open');
1018
+ var id = $(this).attr('id') + '_content';
1019
+ $('#' + id).slideToggle('fast');
1020
+ });
1021
+ $(document).on('click', '.ctc-live-preview', function(e) {
1022
+ e.stopImmediatePropagation();
1023
+ e.preventDefault();
1024
+ document.location = $(this).prop('href');
1025
+ return false;
1026
+ });
1027
+ $(document).on('change', '#ctc_configtype', function(e) {
1028
+ var val = $(this).val();
1029
+ if (ctc_is_empty(val) || 'theme' == val) {
1030
+ $('.ctc-theme-only').stop().slideDown('fast');
1031
+ } else {
1032
+ $('.ctc-theme-only').stop().slideUp('fast');
1033
+ }
1034
+ });
1035
+ $('#ctc_theme_child,#ctc_theme_child-button,#ctc_child_type_existing').on('focus click', function(){
1036
+ $('#ctc_child_type_existing').prop('checked', true);
1037
+ $('#ctc_child_type_new').prop('checked', false);
1038
+ $('#ctc_child_template').val('');
1039
+ });
1040
+ $('#ctc_child_type_new,#ctc_child_template').on('focus click', function(){
1041
+ $('#ctc_child_type_existing').prop('checked', false);
1042
+ $('#ctc_child_type_new').prop('checked', true);
1043
+ $('#ctc_child_name').val(testname);
1044
+ $('#ctc_child_template').val(testslug);
1045
  });
1046
  // initialize menus
1047
  ctc_setup_menus();
1048
  ctc_set_query(currentQuery);
1049
  ctc_set_addl_css();
1050
+ // turn on submit buttons
1051
  $('input[type=submit],input[type=button]').prop('disabled', false);
1052
  setTimeout(fade_update_notice, 6000);
1053
  });
js/chld-thm-cfg.min.js CHANGED
@@ -1 +1 @@
1
- ;jQuery(document).ready(function(C){var G="\n",p="base",y,F={},P,s,r=new RegExp('"',"g"),E=function(T){return z(T)?T:T.toString().replace(r,"&quot;")},O=function(T){C(T).iris({change:function(){H(T)}})},A=function(V){var T=parseInt(V),U=String.fromCharCode(T);return U},f=function(U){var T=U.charCodeAt(0);return T},H=function(Z){var V=/^(ctc_(ovrd|\d+)_(parent|child)_([0-9a-z\-]+)_(\d+))(_\w+)?$/,aa=C(Z).parents(".ctc-selector-row, .ctc-parent-row").first(),Y=aa.find(".ctc-swatch").first(),X={parent:{},child:{}},W={parent:{origin:"",start:"",end:""},child:{origin:"",start:"",end:""}},U={child:false,parent:false},T={};aa.find(".ctc-parent-value, .ctc-child-value").each(function(){var ai=C(this).attr("id"),ab=ai.toString().match(V),aj=ab[2],ac=ab[3],al=("undefined"==typeof ab[4]?"":ab[4]),ah=ab[5],ag=("undefined"==typeof ab[6]?"":ab[6]),ak=("parent"==ac?C(this).text():C(this).val()),ad="ctc_"+aj+"_child_"+al+"_i_"+ah,af,ae;if("child"==ac){T[ai]=ak;T[ad]=(C("#"+ad).is(":checked"))?1:0}if(""!=ak){if(false===z(ag)){switch(ag){case"_border_width":X[ac][al+"-width"]=ak;break;case"_border_style":X[ac][al+"-style"]=ak;break;case"_border_color":X[ac][al+"-color"]=ak;break;case"_background_url":X[ac]["background-image"]=S(ac,ak);break;case"_background_color":X[ac]["background-color"]=Z.value;break;case"_background_color1":W[ac].start=ak;U[ac]=true;break;case"_background_color2":W[ac].end=ak;U[ac]=true;break;case"_background_origin":W[ac].origin=ak;U[ac]=true;break}}else{if(af=al.toString().match(/^border(\-(top|right|bottom|left))?$/)&&!ak.match(/none/)){ae=ak.toString().split(/ +/);X[ac][al+"-width"]="undefined"==typeof ae[0]?"":ae[0];X[ac][al+"-style"]="undefined"==typeof ae[1]?"":ae[1];X[ac][al+"-color"]="undefined"==typeof ae[2]?"":ae[2]}else{if("background-image"==al){if(ak.toString().match(/url\(/)){X[ac]["background-image"]=S(ac,ak)}else{ae=ak.toString().split(/ +/);if(ae.length>2){W[ac].origin="undefined"==typeof ae[0]?"top":ae[0];W[ac].start="undefined"==typeof ae[1]?"transparent":ae[1];W[ac].end="undefined"==typeof ae[2]?"transparent":ae[2];U[ac]=true}else{X[ac]["background-image"]=ak}}}else{X[ac][al]=ak}}}}});if("undefined"!=typeof Y&&false===z(Y.attr("id"))){C(Y).removeAttr("style");if(U.parent){C(Y).ctcgrad(W.parent.origin,[W.parent.start,W.parent.end])}C(Y).css(X.parent);if(!(Y.attr("id").toString().match(/parent/))){if(U.child){C(Y).ctcgrad(W.child.origin,[W.child.start,W.child.end])}C(Y).css(X.child)}C(Y).css({"z-index":-1})}return T},x=function(U){var T,V,W;C(U).each(function(){switch(this.obj){case"imports":ctcAjax.imports=this.data;break;case"rule_val":ctcAjax.rule_val[this.key]=this.data;W=this.key;break;case"val_qry":ctcAjax.val_qry[this.key]=this.data;break;case"rule":ctcAjax.rule=this.data;break;case"sel_ndx":if(z(this.key)){ctcAjax.sel_ndx=this.data}else{if("qsid"==this.key){if(z(ctcAjax.sel_ndx[this.data.query])){ctcAjax.sel_ndx[this.data.query]={}}ctcAjax.sel_ndx[this.data.query][this.data.selector]=this.data.qsid}else{ctcAjax.sel_ndx[this.key]=this.data;T=this.key}}break;case"sel_val":ctcAjax.sel_val[this.key]=this.data;V=this.key;break;case"rewrite":P=this.key;s=this.data;break}})},S=function(X,U){var W=U.toString().match(/url\(['" ]*(.+?)['" ]*\)/),V=z(W)?null:W[1],T=ctcAjax.theme_uri+"/"+("parent"==X?ctcAjax.parnt:ctcAjax.child)+"/",Y;if(!V){return false}else{if(V.toString().match(/^(https?:|\/)/)){Y=U}else{Y="url("+T+V+")"}}return Y},z=function(U){if("undefined"==typeof U||false===U||null===U||""===U){return true}if(true===U||"string"===typeof U||"number"===typeof U){return false}if("object"===typeof U){for(var T in U){if(U.hasOwnProperty(T)){return false}}return true}return false},g=function(){var T=[];if(1===loading.sel_ndx){return T}if(0===loading.sel_ndx){loading.sel_ndx=1;Q("sel_ndx",null,K);return T}if(false===z(ctcAjax.sel_ndx)){C.each(ctcAjax.sel_ndx,function(U,V){var W={label:U,value:U};T.push(W)})}return T},N=function(U){var T=[];if(1===loading.sel_ndx){return T}if(0===loading.sel_ndx){loading.sel_ndx=1;Q("sel_ndx",U,R);return T}if(false===z(ctcAjax.sel_ndx[U])){C.each(ctcAjax.sel_ndx[U],function(V,W){var X={label:V,value:W};T.push(X)})}return T},d=function(){var T=[];if(1===loading.rule){return T}if(0===loading.rule){loading.rule=1;Q("rule",null,j);return T}if(false===z(ctcAjax.rule)){C.each(ctcAjax.rule,function(U,V){var W={label:V.replace(/\d+/g,A),value:U};T.push(W)})}return T.sort(function(V,U){if(V.label>U.label){return 1}if(V.label<U.label){return -1}return 0})},M=function(X,Z,ac){var V="",aa=(z(ctcAjax.sel_val[X])||z(ctcAjax.sel_val[X].value)||z(ctcAjax.sel_val[X].value[Z])?"":ctcAjax.sel_val[X].value[Z]),U=B(Z,("undefined"==typeof aa?"":aa.parnt)),Y=(false===z(aa.i_parnt)&&aa.i_parnt)?ctcAjax.important_label:"",W=B(Z,("undefined"==typeof aa?"":aa.child)),T=(false===z(aa.i_child)&&aa.i_child)?1:0,ab="ctc_"+ac+"_child_"+Z+"_i_"+X;if(false===z(ctcAjax.sel_val[X])){V+='<div class="ctc-'+("ovrd"==ac?"input":"selector")+'-row clearfix">'+G;V+='<div class="ctc-input-cell">'+("ovrd"==ac?Z.replace(/\d+/g,A):ctcAjax.sel_val[X].selector+'<br/><a href="#" class="ctc-selector-edit" id="ctc_selector_edit_'+X+'" >'+ctcAjax.edit_txt+"</a> "+(z(U.orig)?ctcAjax.child_only_txt:""))+"</div>"+G;if("ovrd"==ac){V+='<div class="ctc-parent-value ctc-input-cell" id="ctc_'+ac+"_parent_"+Z+"_"+X+'">'+(z(U.orig)?"[no value]":U.orig+Y)+"</div>"+G}V+='<div class="ctc-input-cell">'+G;if(false===z(U.names)){C.each(U.names,function(ad,ae){ae=(z(ae)?"":ae);V+='<div class="ctc-child-input-cell">'+G;var ag="ctc_"+ac+"_child_"+Z+"_"+X+ae,af;if(false===(af=W.values.shift())){af=""}V+=(z(ae)?"":ctcAjax.field_labels[ae]+":<br/>")+'<input type="text" id="'+ag+'" name="'+ag+'" class="ctc-child-value'+((ae+Z).toString().match(/color/)?" color-picker":"")+((ae).toString().match(/url/)?" ctc-input-wide":"")+'" value="'+E(af)+'" />'+G;V+="</div>"+G});V+='<label for="'+ab+'"><input type="checkbox" id="'+ab+'" name="'+ab+'" value="1" '+(1===T?"checked":"")+" />"+ctcAjax.important_label+"</label>"+G}V+="</div>"+G;V+=("ovrd"==ac?"":'<div class="ctc-swatch ctc-specific" id="ctc_child_'+Z+"_"+X+'_swatch">'+ctcAjax.swatch_txt+"</div>"+G+'<div class="ctc-child-input-cell ctc-button-cell" id="ctc_save_'+Z+"_"+X+'_cell">'+G+'<input type="button" class="button ctc-save-input" id="ctc_save_'+Z+"_"+X+'" name="ctc_save_'+Z+"_"+X+'" value="Save" /></div>'+G);V+="</div><!-- end input row -->"+G}return V},L=function(T){if(1===loading.sel_val){return false}if(0==loading.sel_val){loading.sel_val=1;Q("sel_val",T,L);return false}var W,U,V;if(z(ctcAjax.sel_val[T])){C("#ctc_sel_ovrd_rule_inputs").html("")}else{if(z(ctcAjax.sel_val[T].seq)){C("#ctc_child_load_order_container").html("")}else{W="ctc_ovrd_child_seq_"+T;V=parseInt(ctcAjax.sel_val[T].seq);U='<input type="text" id="'+W+'" name="'+W+'" class="ctc-child-value" value="'+V+'" />';C("#ctc_child_load_order_container").html(U)}if(z(ctcAjax.sel_val[T].value)){C("#ctc_sel_ovrd_rule_inputs").html("")}else{U="";C.each(ctcAjax.sel_val[T].value,function(Y,X){U+=M(T,Y,"ovrd")});C("#ctc_sel_ovrd_rule_inputs").html(U).find(".color-picker").each(function(){O(this)});H("#ctc_child_all_0_swatch")}}},n=function(T){if(1===loading.preview){return false}if(0==loading.preview){loading.preview=1;var T;if(!(T=C(this).attr("id").toString().match(/(child|parnt)/)[1])){T="child"}b("");Q("preview",T,n);return false}if(2==loading.preview){C("#view_"+T+"_options_panel").text(ctcAjax.previewResponse);loading.preview=0}},v=function(U){if(1===loading.rule_val){return false}if(0==loading.rule_val){loading.rule_val=1;Q("rule_val",U,v);return false}var V=ctcAjax.rule[U],T='<div class="ctc-input-row clearfix" id="ctc_rule_row_'+V+'">'+G;if(false===z(ctcAjax.rule_val[U])){C.each(ctcAjax.rule_val[U],function(X,Y){var W=B(V,Y);T+='<div class="ctc-parent-row clearfix" id="ctc_rule_row_'+V+"_"+X+'">'+G;T+='<div class="ctc-input-cell ctc-parent-value" id="ctc_'+X+"_parent_"+V+"_"+X+'">'+W.orig+"</div>"+G;T+='<div class="ctc-input-cell">'+G;T+='<div class="ctc-swatch ctc-specific" id="ctc_'+X+"_parent_"+V+"_"+X+'_swatch">'+ctcAjax.swatch_txt+"</div></div>"+G;T+='<div class="ctc-input-cell"><a href="#" class="ctc-selector-handle" id="ctc_selector_'+V+"_"+X+'">'+ctcAjax.selector_txt+"</a></div>"+G;T+='<div id="ctc_selector_'+V+"_"+X+'_container" class="ctc-selector-container clearfix">'+G;T+='<a href="#" id="ctc_selector_'+V+"_"+X+'_close" class="ctc-selector-handle" style="float:right">'+ctcAjax.close_txt+'</a><div id="ctc_status_val_qry_'+X+'"></div>'+G;T+='<div id="ctc_selector_'+V+"_"+X+'_rows"></div>'+G;T+="</div></div>"+G});T+="</div>"+G}C("#ctc_rule_value_inputs").html(T).find(".ctc-swatch").each(function(){H(this)})},t=function(W){if(1==loading.val_qry){return false}var Y,U,X=C("#ctc_rule_menu_selected").text().replace(/[^\w\-]/g,f),T,V="";if(0===loading.val_qry){loading.val_qry=1;Y={rule:X};Q("val_qry",W,t,Y);return false}if(false===z(ctcAjax.val_qry[W])){C.each(ctcAjax.val_qry[W],function(aa,Z){page_rule=aa;C.each(Z,function(ac,ab){V+='<h4 class="ctc-query-heading">'+ac+"</h4>"+G;if(false===z(ab)){C.each(ab,function(ad,ae){ctcAjax.sel_val[ad]=ae;V+=M(ad,aa,W)})}})})}T="#ctc_selector_"+X+"_"+W+"_rows";C(T).html(V).find(".color-picker").each(function(){O(this)});C(T).find(".ctc-swatch").each(function(){H(this)})},Q=function(V,U,Y,W){var T={ctc_query_obj:V,ctc_query_key:U},X="#ctc_status_"+V+("val_qry"==V?"_"+U:"");if("object"===typeof W){C.each(W,function(Z,aa){T["ctc_query_"+Z]=aa})}C(".ctc-status-icon").remove();C(X).append('<span class="ctc-status-icon spinner"></span>');C(".spinner").show();T.action="ctc_query";T._wpnonce=C("#_wpnonce").val();C.post(ctcAjax.ajaxurl,T,function(Z){loading[V]=2;C(".ctc-status-icon").removeClass("spinner");if(z(Z)){C(".ctc-status-icon").addClass("failure");if("preview"==V){ctcAjax.previewResponse=ctcAjax.css_fail_txt;Y(U)}}else{C(".ctc-status-icon").addClass("success");if("preview"==V){ctcAjax.previewResponse=Z.shift().data}else{x(Z)}if("function"===typeof Y){Y(U)}return false}},"json").fail(function(){C(".ctc-status-icon").removeClass("spinner");C(".ctc-status-icon").addClass("failure");if("preview"==V){ctcAjax.previewResponse=ctcAjax.css_fail_txt;loading[V]=2;Y(U)}else{loading[V]=0}});return false},w=function(Y){var W={},Z,V,T,U,aa=C(Y).attr("id"),X;if(z(F[aa])){F[aa]=0}F[aa]++;C(Y).prop("disabled",true);C(".ctc-status-icon").remove();C(Y).parent(".ctc-textarea-button-cell, .ctc-button-cell").append('<span class="ctc-status-icon spinner"></span>');C(".spinner").show();if((Z=C("#ctc_new_selectors"))&&"ctc_save_new_selectors"==C(Y).attr("id")){W.ctc_new_selectors=Z.val();if(V=C("#ctc_sel_ovrd_query_selected")){W.ctc_sel_ovrd_query=V.text()}}else{if((T=C("#ctc_child_imports"))&&"ctc_save_imports"==C(Y).attr("id")){W.ctc_child_imports=T.val()}else{W=H(Y)}}C("#ctc_sel_ovrd_selector_selected").find("#ctc_rewrite_selector").each(function(){X=C("#ctc_rewrite_selector").val(),origsel=C("#ctc_rewrite_selector_orig").val();if(z(X)||!X.toString().match(/\w/)){X=origsel}else{W.ctc_rewrite_selector=X}C(".ctc-rewrite-toggle").text(ctcAjax.rename_txt);C("#ctc_sel_ovrd_selector_selected").html(X)});W.action="ctc_update";W._wpnonce=C("#_wpnonce").val();C.post(ctcAjax.ajaxurl,W,function(ab){C(Y).prop("disabled",false);C(".ctc-status-icon").removeClass("spinner");if(z(ab)){C(".ctc-status-icon").addClass("failure")}else{C(".ctc-status-icon").addClass("success");C("#ctc_new_selectors").val("");x(ab);k();if(false===z(P)){D(P,s);P=s=null}}return false},"json").fail(function(){C(Y).prop("disabled",false);C(".ctc-status-icon").removeClass("spinner");C(".ctc-status-icon").addClass("failure")});return false},B=function(V,T){T=("undefined"==typeof T?"":T);var U={orig:T};if(V.toString().match(/^border(\-(top|right|bottom|left))?$/)){var W=T.toString().split(/ +/);U.names=["_border_width","_border_style","_border_color"];U.values=[("undefined"==typeof W[0]?"":W[0]),("undefined"==typeof W[1]?"":W[1]),("undefined"==typeof W[2]?"":W[2])]}else{if(V.toString().match(/^background\-image/)){U.names=["_background_url","_background_origin","_background_color1","_background_color2"];U.values=["","","",""];if(false===(z(T))&&!(T.toString().match(/url/))){var W=T.toString().split(/:/);U.values[1]=("undefined"==typeof W[0]?"":W[0]);U.values[2]=("undefined"==typeof W[1]?"":W[1]);U.values[3]=("undefined"==typeof W[3]?"":W[3]);U.orig=[U.values[1],U.values[2],U.values[3]].join(" ")}else{U.values[0]=T}}else{U.names=[""];U.values=[T]}}return U},a=function(T){p=T;C("#ctc_sel_ovrd_query").val("");C("#ctc_sel_ovrd_query_selected").text(T);C("#ctc_sel_ovrd_selector").val("");C("#ctc_sel_ovrd_selector_selected").html("&nbsp;");C("#ctc_sel_ovrd_rule_inputs").html("");R(T);H("#ctc_child_all_0_swatch");C("#ctc_new_selector_row").show()},D=function(U,T){C("#ctc_sel_ovrd_selector").val("");C("#ctc_sel_ovrd_selector_selected").text(T);C("#ctc_sel_ovrd_qsid").val(U);y=U;if(1!=loading.sel_val){loading.sel_val=0}L(U);C(".ctc-rewrite-toggle").text(ctcAjax.rename_txt);C("#ctc_sel_ovrd_new_rule, #ctc_sel_ovrd_rule_header,#ctc_sel_ovrd_rule_inputs_container,#ctc_sel_ovrd_rule_inputs,.ctc-rewrite-toggle").show()},c=function(U,T){C("#ctc_rule_menu").val("");C("#ctc_rule_menu_selected").text(T);if(1!=loading.rule_val){loading.rule_val=0}v(U);C(".ctc-rewrite-toggle").text(ctcAjax.rename_txt);C("#ctc_rule_value_inputs,#ctc_input_row_rule_header").show()},K=function(){ctc_queries=g();C("#ctc_sel_ovrd_query").autocomplete({source:ctc_queries,minLength:0,selectFirst:true,autoFocus:true,select:function(U,T){a(T.item.value);return false},focus:function(T){T.preventDefault()}})},R=function(T){ctc_selectors=N(T);C("#ctc_sel_ovrd_selector").autocomplete({source:ctc_selectors,selectFirst:true,autoFocus:true,select:function(V,U){D(U.item.value,U.item.label);return false},focus:function(U){U.preventDefault()}})},j=function(){ctc_rules=d();C("#ctc_rule_menu").autocomplete({source:ctc_rules,selectFirst:true,autoFocus:true,select:function(U,T){c(T.item.value,T.item.label);return false},focus:function(T){T.preventDefault()}})},J=function(W,U){var T=[],V=(z(ctcAjax.sel_val[y]))||(z(ctcAjax.sel_val[y].value));if(z(ctc_rules)){ctc_rules=d()}C.each(ctc_rules,function(X,aa){var Y=false,Z=new RegExp(C.ui.autocomplete.escapeRegex(W.term),"i");if(Z.test(aa.label)){if(false===V){C.each(ctcAjax.sel_val[y].value,function(ac,ab){if(aa.label==ac.replace(/\d+/g,A)){Y=true;return false}});if(Y){return}}T.push(aa)}});U(T)},I=function(){C("#ctc_new_rule_menu").autocomplete({source:J,selectFirst:true,autoFocus:true,select:function(U,T){U.preventDefault();var V=C(M(y,T.item.label.replace(/[^\w\-]/g,f),"ovrd"));C("#ctc_sel_ovrd_rule_inputs").append(V);C("#ctc_new_rule_menu").val("");if(z(ctcAjax.sel_val[y].value)){ctcAjax.sel_val[y]["value"]={}}ctcAjax.sel_val[y].value[T.item.label]={child:""};V.find('input[type="text"]').each(function(W,X){if(C(X).hasClass("color-picker")){O(X)}C(X).focus()});return false},focus:function(T){T.preventDefault()}})},k=function(){K();R(p);j();I()},o=function(T,U){var V=false;C.each(ctcAjax.themes,function(W,X){C.each(X,function(Y,Z){if(Y==T&&("parnt"==W||"new"==U)){V=true;return false}});if(V){return false}});return V},b=function(T){var U="";if(false===z(T)){C.each(T,function(V,W){U+='<div class="'+V+'"><ul>'+G;C(W).each(function(X,Y){U+="<li>"+Y.toString()+"</li>"+G});U+="</ul></div>"})}C("#ctc_error_notice").html(U)},q=function(){var W=/[^\w\-]/,U=C("#ctc_child_template").val().toString().replace(W).toLowerCase(),T=C("#ctc_theme_child").val().toString().replace(W).toLowerCase(),V=C("input[name=ctc_child_type]:checked").val(),X=[];if("new"==V){T=U}if(o(T,V)){X.push(ctcAjax.theme_exists_txt.toString().replace(/%s/,T))}if(""===T){X.push(ctcAjax.inval_theme_txt)}if(""===C("#ctc_child_name").val()){X.push(ctcAjax.inval_name_txt)}if(X.length){b({error:X});return false}return true},m=function(U){var T=C("#ctc_theme_child").val();if(false===z(ctcAjax.themes.child[T])){C("#ctc_child_name").val(ctcAjax.themes.child[T].Name);C("#ctc_child_author").val(ctcAjax.themes.child[T].Author);C("#ctc_child_version").val(ctcAjax.themes.child[T].Version)}},u=function(){C(".updated, .error").slideUp("slow",function(){C(".updated").remove()})},e=function(){var X=C("#ctc_theme_parnt").val(),W=ctcAjax.theme_uri.replace(/^https?:\/\//,""),U=ctcAjax.homeurl.replace(/^https?/,ctcAjax.ssl?"https":"http"),V=U+"?preview=1&p=x&template="+X+"&stylesheet="+X,Y=new RegExp("<link rel=[\"']stylesheet[\"'][^>]+?"+W+"/"+X+"/(.+?\\.css)[^>]+?>","g"),T;if(z(X)){return}C.get(V,function(Z){while(T=Y.exec(Z)){if("style.css"==T[1]){break}if(T[1].match(/bootstrap/)){continue}ctcAjax.addl_css.push(T[1]);C(".ctc_checkbox").each(function(aa,ab){if(C(this).val()==T[1]){C(this).prop("checked",true)}})}})},l=function(U){var T=U+"_panel";C(".nav-tab").removeClass("nav-tab-active");C(".ctc-option-panel").removeClass("ctc-option-panel-active");C(".ctc-selector-container").hide();C(U).addClass("nav-tab-active");C(".ctc-option-panel-container").scrollTop(0);C(T).addClass("ctc-option-panel-active")},i=function(W){var T=C(W).attr("id").match(/_(\d+)$/)[1],V=ctcAjax.sel_val[T].query,U=ctcAjax.sel_val[T].selector,X="#query_selector_options";a(V);D(T,U);l(X)},h=function(U){var T;if(C("#ctc_rewrite_selector").length){T=C("#ctc_rewrite_selector_orig").val();C("#ctc_sel_ovrd_selector_selected").text(T);C(U).text(ctcAjax.rename_txt)}else{T=C("#ctc_sel_ovrd_selector_selected").text();C("#ctc_sel_ovrd_selector_selected").html('<input id="ctc_rewrite_selector" name="ctc_rewrite_selector" type="text" value="'+E(T)+'" autocomplete="off" /><input id="ctc_rewrite_selector_orig" name="ctc_rewrite_selector_orig" type="hidden" value="'+E(T)+'"/>');C(U).text(ctcAjax.cancel_txt)}};loading={rule:2,sel_ndx:2,val_qry:0,rule_val:0,sel_val:0,preview:0},ctc_selectors=[],ctc_queries=[],ctc_rules=[];C(".color-picker").each(function(){O(this)});C(".ctc-option-panel-container").on("focus",".color-picker",function(){b("");C(this).iris("toggle");C(".iris-picker").css({position:"absolute","z-index":10})});C(".ctc-option-panel-container").on("focus","input",function(){b("");C(".color-picker").not(this).iris("hide")});C(".ctc-option-panel-container").on("change",".ctc-child-value, input[type=checkbox]",function(){H(this)});C(".ctc-option-panel-container").on("click",".ctc-selector-handle",function(U){U.preventDefault();b("");var V=C(this).attr("id").toString().replace("_close",""),T=V.toString().match(/_(\d+)$/)[1];if(C("#"+V+"_container").is(":hidden")){if(1!=loading.val_qry){loading.val_qry=0}t(T)}C("#"+V+"_container").fadeToggle("fast");C(".ctc-selector-container").not("#"+V+"_container").fadeOut("fast")});C(".nav-tab").on("click",function(T){T.preventDefault();b("");C(".ctc-status-icon").remove();var U="#"+C(this).attr("id");l(U)});C("#view_child_options,#view_parnt_options").on("click",n);C("#ctc_load_form").on("submit",function(){return(q()&&confirm(ctcAjax.load_txt))});C("#parent_child_options_panel").on("change","#ctc_theme_child",m);C(document).on("click",".ctc-save-input",function(T){w(this)});C(document).on("click",".ctc-selector-edit",function(T){i(this)});C(document).on("click",".ctc-rewrite-toggle",function(T){T.preventDefault();h(this)});C(document).on("change","#ctc_theme_parnt",function(T){C(this).parents(".ctc-input-row").first().append('<span class="ctc-status-icon spinner"></span>');C(".spinner").show();document.location="?page=chld_thm_cfg_menu&ctc_parent="+C(this).val()});C(document).on("click","#ctc_additional_css_label",function(T){C(this).toggleClass("open");C("#ctc_additional_css_files").slideToggle("fast")});k();a(p);e();C("input[type=submit],input[type=button]").prop("disabled",false);setTimeout(u,6000)});
1
+ ;jQuery(document).ready(function(I){function L(ab){return E(ab)?ab:ab.toString().replace(w,"&quot;")}function V(ab){I(ab).iris({change:function(ad,ac){I(ab).data("color",ac.color.toString());O(ab)}})}function F(ad){var ab=parseInt(ad),ac=String.fromCharCode(ab);return ac}function f(ac){var ab=ac.charCodeAt(0);return ab}function O(ah){var ad=/^(ctc_(ovrd|\d+)_(parent|child)_([0-9a-z\-]+)_(\d+))(_\w+)?$/,ai=I(ah).parents(".ctc-selector-row, .ctc-parent-row").first(),ag=ai.find(".ctc-swatch").first(),af={parent:{},child:{}},ae={parent:{origin:"",start:"",end:""},child:{origin:"",start:"",end:""}},ac={child:false,parent:false},ab={};ai.find(".ctc-parent-value, .ctc-child-value").each(function(){var aq=I(this).attr("id"),aj=aq.toString().match(ad),ar=aj[2],ak=aj[3],au=("undefined"==typeof aj[4]?"":aj[4]),ap=aj[5],ao=("undefined"==typeof aj[6]?"":aj[6]),at=("parent"==ak?I(this).text().replace(/!$/,""):I(this).val()),al="ctc_"+ar+"_child_"+au+"_i_"+ap,an,am;if(false===E(I(this).data("color"))){at=I(this).data("color");I(this).data("color",null)}if("child"==ak){ab[aq]=at;ab[al]=(I("#"+al).is(":checked"))?1:0}if(""!=at){if(false===E(ao)){switch(ao){case"_border_width":af[ak][au+"-width"]=at;break;case"_border_style":af[ak][au+"-style"]=at;break;case"_border_color":af[ak][au+"-color"]=at;break;case"_background_url":af[ak]["background-image"]=aa(ak,at);break;case"_background_color":af[ak]["background-color"]=ah.value;break;case"_background_color1":ae[ak].start=at;ac[ak]=true;break;case"_background_color2":ae[ak].end=at;ac[ak]=true;break;case"_background_origin":ae[ak].origin=at;ac[ak]=true;break}}else{if(an=au.toString().match(/^border(\-(top|right|bottom|left))?$/)&&!at.match(/none/)){am=at.toString().split(/ +/);af[ak][au+"-width"]="undefined"==typeof am[0]?"":am[0];af[ak][au+"-style"]="undefined"==typeof am[1]?"":am[1];af[ak][au+"-color"]="undefined"==typeof am[2]?"":am[2]}else{if("background-image"==au){if(at.toString().match(/url\(/)){af[ak]["background-image"]=aa(ak,at)}else{am=at.toString().split(/ +/);if(am.length>2){ae[ak].origin="undefined"==typeof am[0]?"top":am[0];ae[ak].start="undefined"==typeof am[1]?"transparent":am[1];ae[ak].end="undefined"==typeof am[2]?"transparent":am[2];ac[ak]=true}else{af[ak]["background-image"]=at}}}else{if("seq"!=au){af[ak][au]=at}}}}}});if("undefined"!=typeof ag&&false===E(ag.attr("id"))){ag.removeAttr("style");if(ac.parent){ag.ctcgrad(ae.parent.origin,[ae.parent.start,ae.parent.end])}ag.css(af.parent);if(!(ag.attr("id").toString().match(/parent/))){if(ac.child){ag.ctcgrad(ae.child.origin,[ae.child.start,ae.child.end])}ag.css(af.child)}ag.css({"z-index":-1})}return ab}function D(ac){var ab,ad,ae;I(ac).each(function(){switch(this.obj){case"imports":ctcAjax.imports=this.data;break;case"rule_val":ctcAjax.rule_val[this.key]=this.data;ae=this.key;break;case"val_qry":ctcAjax.val_qry[this.key]=this.data;break;case"rule":ctcAjax.rule=this.data;break;case"sel_ndx":if(E(this.key)){ctcAjax.sel_ndx=this.data}else{if("qsid"==this.key){if(E(ctcAjax.sel_ndx[this.data.query])){ctcAjax.sel_ndx[this.data.query]={}}ctcAjax.sel_ndx[this.data.query][this.data.selector]=this.data.qsid}else{ctcAjax.sel_ndx[this.key]=this.data;ab=this.key}}break;case"sel_val":ctcAjax.sel_val[this.key]=this.data;ad=this.key;break;case"rewrite":W=this.key;x=this.data;break}})}function aa(af,ac){var ae=ac.toString().match(/url\(['" ]*(.+?)['" ]*\)/),ad=E(ae)?null:ae[1],ab=ctcAjax.theme_uri+"/"+("parent"==af?ctcAjax.parnt:ctcAjax.child)+"/",ag;if(!ad){return false}else{if(ad.toString().match(/^(https?:|\/)/)){ag=ac}else{ag="url("+ab+ad+")"}}return ag}function E(ac){if("undefined"==typeof ac||false===ac||null===ac||""===ac){return true}if(true===ac||"string"===typeof ac||"number"===typeof ac){return false}if("object"===typeof ac){for(var ab in ac){if(ac.hasOwnProperty(ab)){return false}}return true}return false}function g(){var ab=[];if(1===X.sel_ndx){return ab}if(0===X.sel_ndx){X.sel_ndx=1;Y("sel_ndx",null,R);return ab}if(false===E(ctcAjax.sel_ndx)){I.each(ctcAjax.sel_ndx,function(ac,ad){var ae={label:ac,value:ac};ab.push(ae)})}return ab}function U(ac){var ab=[];if(1===X.sel_ndx){return ab}if(0===X.sel_ndx){X.sel_ndx=1;Y("sel_ndx",ac,Z);return ab}if(false===E(ctcAjax.sel_ndx[ac])){I.each(ctcAjax.sel_ndx[ac],function(ad,ae){var af={label:ad,value:ae};ab.push(af)})}return ab}function d(){var ab=[];if(1===X.rule){return ab}if(0===X.rule){X.rule=1;Y("rule",null,k);return ab}if(false===E(ctcAjax.rule)){I.each(ctcAjax.rule,function(ac,ad){var ae={label:ad.replace(/\d+/g,F),value:ac};ab.push(ae)})}return ab.sort(function(ad,ac){if(ad.label>ac.label){return 1}if(ad.label<ac.label){return -1}return 0})}function T(af,ah,ak){var ad="",ai=(E(ctcAjax.sel_val[af])||E(ctcAjax.sel_val[af].value)||E(ctcAjax.sel_val[af].value[ah])?"":ctcAjax.sel_val[af].value[ah]),ac=G(ah,("undefined"==typeof ai?"":ai.parnt)),ag=(false===E(ai.i_parnt)&&ai.i_parnt)?ctcAjax.important_label:"",ae=G(ah,("undefined"==typeof ai?"":ai.child)),ab=(false===E(ai.i_child)&&ai.i_child)?1:0,aj="ctc_"+ak+"_child_"+ah+"_i_"+af;if(false===E(ctcAjax.sel_val[af])){ad+='<div class="ctc-'+("ovrd"==ak?"input":"selector")+'-row clearfix">'+M;ad+='<div class="ctc-input-cell">'+("ovrd"==ak?ah.replace(/\d+/g,F):ctcAjax.sel_val[af].selector+'<br/><a href="#" class="ctc-selector-edit" id="ctc_selector_edit_'+af+'" >'+ctcAjax.edit_txt+"</a> "+(E(ac.orig)?ctcAjax.child_only_txt:""))+"</div>"+M;if("ovrd"==ak){ad+='<div class="ctc-parent-value ctc-input-cell" id="ctc_'+ak+"_parent_"+ah+"_"+af+'">'+(E(ac.orig)?"[no value]":ac.orig+ag)+"</div>"+M}ad+='<div class="ctc-input-cell">'+M;if(false===E(ac.names)){I.each(ac.names,function(al,am){am=(E(am)?"":am);ad+='<div class="ctc-child-input-cell">'+M;var ao="ctc_"+ak+"_child_"+ah+"_"+af+am,an;if(false===(an=ae.values.shift())){an=""}ad+=(E(am)?"":ctcAjax.field_labels[am]+":<br/>")+'<input type="text" id="'+ao+'" name="'+ao+'" class="ctc-child-value'+((am+ah).toString().match(/color/)?" color-picker":"")+((am).toString().match(/url/)?" ctc-input-wide":"")+'" value="'+L(an)+'" />'+M;ad+="</div>"+M});ad+='<label for="'+aj+'"><input type="checkbox" id="'+aj+'" name="'+aj+'" value="1" '+(1===ab?"checked":"")+" />"+ctcAjax.important_label+"</label>"+M}ad+="</div>"+M;ad+=("ovrd"==ak?"":'<div class="ctc-swatch ctc-specific" id="ctc_child_'+ah+"_"+af+'_swatch">'+ctcAjax.swatch_txt+"</div>"+M+'<div class="ctc-child-input-cell ctc-button-cell" id="ctc_save_'+ah+"_"+af+'_cell">'+M+'<input type="button" class="button ctc-save-input" id="ctc_save_'+ah+"_"+af+'" name="ctc_save_'+ah+"_"+af+'" value="Save" /></div>'+M);ad+="</div><!-- end input row -->"+M}return ad}function S(ab){if(1===X.sel_val){return false}if(0==X.sel_val){X.sel_val=1;Y("sel_val",ab,S);return false}var ae,ac,ad;if(E(ctcAjax.sel_val[ab])){I("#ctc_sel_ovrd_rule_inputs").html("")}else{if(E(ctcAjax.sel_val[ab].seq)){I("#ctc_child_load_order_container").html("")}else{ae="ctc_ovrd_child_seq_"+ab;ad=parseInt(ctcAjax.sel_val[ab].seq);ac='<input type="text" id="'+ae+'" name="'+ae+'" class="ctc-child-value" value="'+ad+'" />';I("#ctc_child_load_order_container").html(ac)}if(E(ctcAjax.sel_val[ab].value)){I("#ctc_sel_ovrd_rule_inputs").html("")}else{ac="";I.each(ctcAjax.sel_val[ab].value,function(ag,af){ac+=T(ab,ag,"ovrd")});I("#ctc_sel_ovrd_rule_inputs").html(ac).find(".color-picker").each(function(){V(this)});O("#ctc_child_all_0_swatch")}}}function o(ab){if(1===X.preview){return false}if(0==X.preview){X.preview=1;var ab;if(!(ab=I(this).attr("id").toString().match(/(child|parnt)/)[1])){ab="child"}b("");Y("preview",ab,o);return false}if(2==X.preview){I("#view_"+ab+"_options_panel").text(ctcAjax.previewResponse);X.preview=0}}function A(ac){if(1===X.rule_val){return false}if(0==X.rule_val){X.rule_val=1;Y("rule_val",ac,A);return false}var ad=ctcAjax.rule[ac],ab='<div class="ctc-input-row clearfix" id="ctc_rule_row_'+ad+'">'+M;if(false===E(ctcAjax.rule_val[ac])){I.each(ctcAjax.rule_val[ac],function(af,ag){var ae=G(ad,ag);ab+='<div class="ctc-parent-row clearfix" id="ctc_rule_row_'+ad+"_"+af+'">'+M;ab+='<div class="ctc-input-cell ctc-parent-value" id="ctc_'+af+"_parent_"+ad+"_"+af+'">'+ae.orig+"</div>"+M;ab+='<div class="ctc-input-cell">'+M;ab+='<div class="ctc-swatch ctc-specific" id="ctc_'+af+"_parent_"+ad+"_"+af+'_swatch">'+ctcAjax.swatch_txt+"</div></div>"+M;ab+='<div class="ctc-input-cell"><a href="#" class="ctc-selector-handle" id="ctc_selector_'+ad+"_"+af+'">'+ctcAjax.selector_txt+"</a></div>"+M;ab+='<div id="ctc_selector_'+ad+"_"+af+'_container" class="ctc-selector-container">'+M;ab+='<a href="#" id="ctc_selector_'+ad+"_"+af+'_close" class="ctc-selector-handle ctc-exit" title="'+ctcAjax.close_txt+'"></a>';ab+='<div id="ctc_selector_'+ad+"_"+af+'_inner_container" class="ctc-selector-inner-container clearfix">'+M;ab+='<div id="ctc_status_val_qry_'+af+'"></div>'+M;ab+='<div id="ctc_selector_'+ad+"_"+af+'_rows"></div>'+M;ab+="</div></div></div>"+M});ab+="</div>"+M}I("#ctc_rule_value_inputs").html(ab).find(".ctc-swatch").each(function(){O(this)})}function y(ae){if(1==X.val_qry){return false}var ag,ac,af=I("#ctc_rule_menu_selected").text().replace(/[^\w\-]/g,f),ab,ad="";if(0===X.val_qry){X.val_qry=1;ag={rule:af};Y("val_qry",ae,y,ag);return false}if(false===E(ctcAjax.val_qry[ae])){I.each(ctcAjax.val_qry[ae],function(ai,ah){page_rule=ai;I.each(ah,function(ak,aj){ad+='<h4 class="ctc-query-heading">'+ak+"</h4>"+M;if(false===E(aj)){I.each(aj,function(al,am){ctcAjax.sel_val[al]=am;ad+=T(al,ai,ae)})}})})}ab="#ctc_selector_"+af+"_"+ae+"_rows";I(ab).html(ad).find(".color-picker").each(function(){V(this)});I(ab).find(".ctc-swatch").each(function(){O(this)})}function Y(ad,ac,ag,ae){var ab={ctc_query_obj:ad,ctc_query_key:ac},af="#ctc_status_"+ad+("val_qry"==ad?"_"+ac:"");if("object"===typeof ae){I.each(ae,function(ah,ai){ab["ctc_query_"+ah]=ai})}I(".ctc-status-icon").remove();I(af).append('<span class="ctc-status-icon spinner"></span>');I(".spinner").show();ab.action="ctc_query";ab._wpnonce=I("#_wpnonce").val();I.post(ctcAjax.ajaxurl,ab,function(ah){X[ad]=2;I(".ctc-status-icon").removeClass("spinner");if(E(ah)){I(".ctc-status-icon").addClass("failure");if("preview"==ad){ctcAjax.previewResponse=ctcAjax.css_fail_txt;ag(ac)}}else{I(".ctc-status-icon").addClass("success");if("preview"==ad){ctcAjax.previewResponse=ah.shift().data}else{D(ah)}if("function"===typeof ag){ag(ac)}return false}},"json").fail(function(){I(".ctc-status-icon").removeClass("spinner");I(".ctc-status-icon").addClass("failure");if("preview"==ad){ctcAjax.previewResponse=ctcAjax.css_fail_txt;X[ad]=2;ag(ac)}else{X[ad]=0}});return false}function B(ag){var ae={},ah,ad,ab,ac,ai=I(ag).attr("id"),af;if(E(K[ai])){K[ai]=0}K[ai]++;I(ag).prop("disabled",true);I(".ctc-status-icon").remove();I(ag).parent(".ctc-textarea-button-cell, .ctc-button-cell").append('<span class="ctc-status-icon spinner"></span>');I(".spinner").show();if((ah=I("#ctc_new_selectors"))&&"ctc_save_new_selectors"==I(ag).attr("id")){ae.ctc_new_selectors=ah.val();if(ad=I("#ctc_sel_ovrd_query_selected")){ae.ctc_sel_ovrd_query=ad.text()}}else{if((ab=I("#ctc_child_imports"))&&"ctc_save_imports"==I(ag).attr("id")){ae.ctc_child_imports=ab.val()}else{ae=O(ag)}}I("#ctc_sel_ovrd_selector_selected").find("#ctc_rewrite_selector").each(function(){af=I("#ctc_rewrite_selector").val(),origsel=I("#ctc_rewrite_selector_orig").val();if(E(af)||!af.toString().match(/\w/)){af=origsel}else{ae.ctc_rewrite_selector=af}I(".ctc-rewrite-toggle").text(ctcAjax.rename_txt);I("#ctc_sel_ovrd_selector_selected").html(af)});ae.action="ctc_update";ae._wpnonce=I("#_wpnonce").val();I.post(ctcAjax.ajaxurl,ae,function(aj){I(ag).prop("disabled",false);I(".ctc-status-icon").removeClass("spinner");if(E(aj)){I(".ctc-status-icon").addClass("failure")}else{I(".ctc-status-icon").addClass("success");I("#ctc_new_selectors").val("");D(aj);m();if(false===E(W)){J(W,x);W=x=null}}return false},"json").fail(function(){I(ag).prop("disabled",false);I(".ctc-status-icon").removeClass("spinner");I(".ctc-status-icon").addClass("failure")});return false}function G(ad,ab){ab=("undefined"==typeof ab?"":ab);var ac={orig:ab};if(ad.toString().match(/^border(\-(top|right|bottom|left))?$/)){var ae=ab.toString().split(/ +/);ac.names=["_border_width","_border_style","_border_color"];ac.values=[("undefined"==typeof ae[0]?"":ae[0]),("undefined"==typeof ae[1]?"":ae[1]),("undefined"==typeof ae[2]?"":ae[2])]}else{if(ad.toString().match(/^background\-image/)){ac.names=["_background_url","_background_origin","_background_color1","_background_color2"];ac.values=["","","",""];if(false===(E(ab))&&!(ab.toString().match(/url/))){var ae=ab.toString().split(/:/);ac.values[1]=("undefined"==typeof ae[0]?"":ae[0]);ac.values[2]=("undefined"==typeof ae[1]?"":ae[1]);ac.values[3]=("undefined"==typeof ae[3]?"":ae[3]);ac.orig=[ac.values[1],ac.values[2],ac.values[3]].join(" ")}else{ac.values[0]=ab}}else{ac.names=[""];ac.values=[ab]}}return ac}function a(ab){s=ab;I("#ctc_sel_ovrd_query").val("");I("#ctc_sel_ovrd_query_selected").text(ab);I("#ctc_sel_ovrd_selector").val("");I("#ctc_sel_ovrd_selector_selected").html("&nbsp;");I("#ctc_sel_ovrd_rule_inputs").html("");Z(ab);O("#ctc_child_all_0_swatch");I("#ctc_new_selector_row").show()}function J(ac,ab){I("#ctc_sel_ovrd_selector").val("");I("#ctc_sel_ovrd_selector_selected").text(ab);I("#ctc_sel_ovrd_qsid").val(ac);C=ac;if(1!=X.sel_val){X.sel_val=0}S(ac);I(".ctc-rewrite-toggle").text(ctcAjax.rename_txt);I("#ctc_sel_ovrd_new_rule, #ctc_sel_ovrd_rule_header,#ctc_sel_ovrd_rule_inputs_container,#ctc_sel_ovrd_rule_inputs,.ctc-rewrite-toggle").show()}function c(ac,ab){I("#ctc_rule_menu").val("");I("#ctc_rule_menu_selected").text(ab);if(1!=X.rule_val){X.rule_val=0}A(ac);I(".ctc-rewrite-toggle").text(ctcAjax.rename_txt);I("#ctc_rule_value_inputs,#ctc_input_row_rule_header").show()}function R(){v=g();I("#ctc_sel_ovrd_query").autocomplete({source:v,minLength:0,selectFirst:true,autoFocus:true,select:function(ac,ab){a(ab.item.value);return false},focus:function(ab){ab.preventDefault()}})}function Z(ab){t=U(ab);I("#ctc_sel_ovrd_selector").autocomplete({source:t,selectFirst:true,autoFocus:true,select:function(ad,ac){J(ac.item.value,ac.item.label);return false},focus:function(ac){ac.preventDefault()}})}function k(){N=d();I("#ctc_rule_menu").autocomplete({source:N,selectFirst:true,autoFocus:true,select:function(ac,ab){c(ab.item.value,ab.item.label);return false},focus:function(ab){ab.preventDefault()}})}function Q(ae,ac){var ab=[],ad=(E(ctcAjax.sel_val[C]))||(E(ctcAjax.sel_val[C].value));if(E(N)){N=d()}I.each(N,function(af,ai){var ag=false,ah=new RegExp(I.ui.autocomplete.escapeRegex(ae.term),"i");if(ah.test(ai.label)){if(false===ad){I.each(ctcAjax.sel_val[C].value,function(ak,aj){if(ai.label==ak.replace(/\d+/g,F)){ag=true;return false}});if(ag){return}}ab.push(ai)}});ac(ab)}function P(){I("#ctc_new_rule_menu").autocomplete({source:Q,selectFirst:true,autoFocus:true,select:function(ac,ab){ac.preventDefault();var ad=I(T(C,ab.item.label.replace(/[^\w\-]/g,f),"ovrd"));I("#ctc_sel_ovrd_rule_inputs").append(ad);I("#ctc_new_rule_menu").val("");if(E(ctcAjax.sel_val[C].value)){ctcAjax.sel_val[C]["value"]={}}ctcAjax.sel_val[C].value[ab.item.label]={child:""};ad.find('input[type="text"]').each(function(ae,af){if(I(af).hasClass("color-picker")){V(af)}I(af).focus()});return false},focus:function(ab){ab.preventDefault()}})}function m(){R();Z(s);k();P()}function q(ab,ac){var ad=false;I.each(ctcAjax.themes,function(ae,af){I.each(af,function(ag,ah){if(ag==ab&&("parnt"==ae||"new"==ac)){ad=true;return false}});if(ad){return false}});return ad}function l(){var ae=I("#ctc_theme_parnt").val(),ab=slugbase=ae+"-child",ac=ctcAjax.themes.parnt[ae].Name+" Child",ag="",ad="",af="00";while(q(ab,"new")){ag=(""==ag?2:ag+1);ad=af.substring(0,af.length-ag.toString().length)+ag.toString();ab=slugbase+ad}r=ab;h=ac+(ad.length?" "+ad:"")}function b(ab){var ac="";if(false===E(ab)){I.each(ab,function(ad,ae){ac+='<div class="'+ad+'"><ul>'+M;I(ae).each(function(af,ag){ac+="<li>"+ag.toString()+"</li>"+M});ac+="</ul></div>"})}I("#ctc_error_notice").html(ac)}function u(){var ae=/[^\w\-]/,ac=I("#ctc_child_template").val().toString().replace(ae).toLowerCase(),ab=I("#ctc_theme_child").val().toString().replace(ae).toLowerCase(),ad=I("input[name=ctc_child_type]:checked").val(),af=[];if("new"==ad){ab=ac}if(q(ab,ad)){af.push(ctcAjax.theme_exists_txt.toString().replace(/%s/,ab))}if(""===ab){af.push(ctcAjax.inval_theme_txt)}if(""===I("#ctc_child_name").val()){af.push(ctcAjax.inval_name_txt)}if(af.length){b({error:af});return false}return true}function p(ab){I("#ctc_theme_parent").parents(".ctc-input-row").first().append('<span class="ctc-status-icon spinner"></span>');I(".spinner").show();document.location="?page="+ctcAjax.page+"&ctc_parent="+ab.value}function H(ab){if(false===E(ctcAjax.themes.child[ab.value])){I("#ctc_child_name").val(ctcAjax.themes.child[ab.value].Name);I("#ctc_child_author").val(ctcAjax.themes.child[ab.value].Author);I("#ctc_child_version").val(ctcAjax.themes.child[ab.value].Version)}}function z(){I(".updated, .error").slideUp("slow",function(){I(".updated").remove()})}function e(){var af=I("#ctc_theme_parnt").val(),ae=ctcAjax.theme_uri.replace(/^https?:\/\//,""),ac=ctcAjax.homeurl.replace(/^https?/,ctcAjax.ssl?"https":"http"),ad=ac+"?preview=1&p=x&template="+af+"&stylesheet="+af,ag=new RegExp("<link rel=[\"']stylesheet[\"'][^>]+?"+ae+"/"+af+"/(.+?\\.css)[^>]+?>","g"),ab;if(E(af)){return}I.get(ad,function(ah){while(ab=ag.exec(ah)){if("style.css"==ab[1]){break}if(ab[1].match(/bootstrap/)){continue}ctcAjax.addl_css.push(ab[1]);I(".ctc_checkbox").each(function(ai,aj){if(I(this).val()==ab[1]){I(this).prop("checked",true)}})}})}function n(ac){var ab=ac+"_panel";I(".nav-tab").removeClass("nav-tab-active");I(".ctc-option-panel").removeClass("ctc-option-panel-active");I(".ctc-selector-container").hide();I(ac).addClass("nav-tab-active");I(".ctc-option-panel-container").scrollTop(0);I(ab).addClass("ctc-option-panel-active")}function j(ae){var ab=I(ae).attr("id").match(/_(\d+)$/)[1],ad=ctcAjax.sel_val[ab].query,ac=ctcAjax.sel_val[ab].selector,af="#query_selector_options";a(ad);J(ab,ac);n(af)}function i(ac){var ab;if(I("#ctc_rewrite_selector").length){ab=I("#ctc_rewrite_selector_orig").val();I("#ctc_sel_ovrd_selector_selected").text(ab);I(ac).text(ctcAjax.rename_txt)}else{ab=I("#ctc_sel_ovrd_selector_selected").text();I("#ctc_sel_ovrd_selector_selected").html('<input id="ctc_rewrite_selector" name="ctc_rewrite_selector" type="text" value="'+L(ab)+'" autocomplete="off" /><input id="ctc_rewrite_selector_orig" name="ctc_rewrite_selector_orig" type="hidden" value="'+L(ab)+'"/>');I(ac).text(ctcAjax.cancel_txt)}}var M="\n",s="base",C,K={},W,x,w=new RegExp('"',"g"),r="",h="",X={rule:2,sel_ndx:2,val_qry:0,rule_val:0,sel_val:0,preview:0},t=[],v=[],N=[];l();I.widget("ctc.themeMenu",I.ui.selectmenu,{_renderItem:function(ac,ad){var ab=I("<li>");I("#ctc_theme_option_"+ad.value).detach().appendTo(ab);return ab.appendTo(ac)}});I("#ctc_theme_parnt").themeMenu({select:function(ab,ac){p(ac.item)}});if(E(ctcAjax.themes.child)){I("#ctc_child_name").val(h);I("#ctc_child_template").val(r)}else{I("#ctc_theme_child").themeMenu({select:function(ab,ac){H(ac.item)}})}I(".ctc-option-panel-container").on("focus",".color-picker",function(){b("");I(".color-picker").not(this).iris("hide");I(this).iris("toggle");I(".iris-picker").css({position:"absolute","z-index":10})});I(".ctc-option-panel-container").on("change",".ctc-child-value, input[type=checkbox]",function(){O(this)});I(".ctc-option-panel-container").on("click",".ctc-selector-handle",function(ac){ac.preventDefault();b("");var ad=I(this).attr("id").toString().replace("_close",""),ab=ad.toString().match(/_(\d+)$/)[1];if(I("#"+ad+"_container").is(":hidden")){if(1!=X.val_qry){X.val_qry=0}y(ab)}I("#"+ad+"_container").fadeToggle("fast");I(".ctc-selector-container").not("#"+ad+"_container").fadeOut("fast")});I(".nav-tab").on("click",function(ab){ab.preventDefault();b("");I(".ctc-status-icon").remove();var ac="#"+I(this).attr("id");n(ac)});I("#view_child_options,#view_parnt_options").on("click",o);I("#ctc_load_form").on("submit",function(){return(u()&&confirm(ctcAjax.load_txt))});I(document).on("click",".ctc-save-input",function(ab){B(this)});I(document).on("click",".ctc-selector-edit",function(ab){j(this)});I(document).on("click",".ctc-rewrite-toggle",function(ab){ab.preventDefault();i(this)});I(document).on("click",".ctc-section-toggle",function(ab){I(this).toggleClass("open");var ac=I(this).attr("id")+"_content";I("#"+ac).slideToggle("fast")});I(document).on("click",".ctc-live-preview",function(ab){ab.stopImmediatePropagation();ab.preventDefault();document.location=I(this).prop("href");return false});I(document).on("change","#ctc_configtype",function(ab){var ac=I(this).val();if(E(ac)||"theme"==ac){I(".ctc-theme-only").stop().slideDown("fast")}else{I(".ctc-theme-only").stop().slideUp("fast")}});I("#ctc_theme_child,#ctc_theme_child-button,#ctc_child_type_existing").on("focus click",function(){I("#ctc_child_type_existing").prop("checked",true);I("#ctc_child_type_new").prop("checked",false);I("#ctc_child_template").val("")});I("#ctc_child_type_new,#ctc_child_template").on("focus click",function(){I("#ctc_child_type_existing").prop("checked",false);I("#ctc_child_type_new").prop("checked",true);I("#ctc_child_name").val(h);I("#ctc_child_template").val(r)});m();a(s);e();I("input[type=submit],input[type=button]").prop("disabled",false);setTimeout(z,6000)});
lang/chld_thm_cfg.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the same license as the Child Theme Configurator package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Child Theme Configurator 1.5.2.2\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/child-theme-configurator\n"
7
- "POT-Creation-Date: 2014-10-16 05:00:29+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,882 +12,571 @@ msgstr ""
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
15
- #: includes/class-ctc-ui.php:39
16
- msgid "Get CTC for Plugins and other tools"
 
 
17
  msgstr ""
18
 
19
- #: includes/class-ctc-ui.php:39
20
- msgid "Lilaea Media - Responsive Tools for a Mobile World"
21
  msgstr ""
22
 
23
- #: includes/class-ctc-ui.php:52
24
- msgid "Parent/Child"
25
  msgstr ""
26
 
27
- #: includes/class-ctc-ui.php:55 includes/class-ctc-ui.php:660
28
- msgid "Query/Selector"
 
 
29
  msgstr ""
30
 
31
- #: includes/class-ctc-ui.php:58 includes/class-ctc-ui.php:674
32
- msgid "Rule/Value"
33
  msgstr ""
34
 
35
- #: includes/class-ctc-ui.php:61
36
- msgid "@import"
 
37
  msgstr ""
38
 
39
- #: includes/class-ctc-ui.php:64
40
- msgid "Child CSS"
41
  msgstr ""
42
 
43
- #: includes/class-ctc-ui.php:67
44
- msgid "Parent CSS"
45
  msgstr ""
46
 
47
- #: includes/class-ctc-ui.php:74 includes/class-ctc-ui.php:712
48
- msgid "Files"
49
  msgstr ""
50
 
51
- #: includes/class-ctc-ui.php:87
52
- msgid "Parent Theme"
53
  msgstr ""
54
 
55
- #: includes/class-ctc-ui.php:97
56
- msgid "Child Theme"
57
  msgstr ""
58
 
59
- #: includes/class-ctc-ui.php:104
60
- msgid "Create New Child Theme"
61
  msgstr ""
62
 
63
- #: includes/class-ctc-ui.php:113
64
- msgid "Use Existing Child Theme"
65
  msgstr ""
66
 
67
- #: includes/class-ctc-ui.php:118
68
- msgid "Theme Slug"
69
  msgstr ""
70
 
71
- #: includes/class-ctc-ui.php:128
72
- msgid "Child Theme Name"
73
  msgstr ""
74
 
75
- #: includes/class-ctc-ui.php:132
76
- msgid "Theme Name"
77
  msgstr ""
78
 
79
- #: includes/class-ctc-ui.php:138 includes/class-ctc-ui.php:142
80
- msgid "Author"
 
81
  msgstr ""
82
 
83
- #: includes/class-ctc-ui.php:147 includes/class-ctc-ui.php:151
84
- msgid "Version"
85
  msgstr ""
86
 
87
- #: includes/class-ctc-ui.php:156
88
- msgid "Copy Parent Theme Menus, Widgets and other Options"
89
  msgstr ""
90
 
91
- #: includes/class-ctc-ui.php:158
92
- msgid "NOTE: This will overwrite existing child theme options."
93
  msgstr ""
94
 
95
- #: includes/class-ctc-ui.php:167
96
- msgid "Backup Child Stylesheet"
97
  msgstr ""
98
 
99
- #: includes/class-ctc-ui.php:178
100
- msgid "Parse additional stylesheets:"
101
  msgstr ""
102
 
103
- #: includes/class-ctc-ui.php:179
104
- msgid "(click to toggle)"
105
  msgstr ""
106
 
107
- #: includes/class-ctc-ui.php:183
108
- msgid "Select only the stylesheets you wish to customize to reduce overhead."
109
  msgstr ""
110
 
111
- #: includes/class-ctc-ui.php:200
112
- msgid "Generate Child Theme Files"
113
  msgstr ""
114
 
115
- #: includes/class-ctc-ui.php:211 includes/class-ctc-ui.php:280
116
- msgid "Rule"
117
  msgstr ""
118
 
119
- #: includes/class-ctc-ui.php:224
120
- msgid "Value"
121
  msgstr ""
122
 
123
- #: includes/class-ctc-ui.php:227 includes/class-ctc-ui.php:265
124
- #: includes/class-ctc.php:120
125
- msgid "Sample"
126
  msgstr ""
127
 
128
- #: includes/class-ctc-ui.php:230 includes/class-ctc.php:122
129
- msgid "Selectors"
130
  msgstr ""
131
 
132
- #: includes/class-ctc-ui.php:241
133
- msgid "Query"
134
  msgstr ""
135
 
136
- #: includes/class-ctc-ui.php:252
137
- msgid "Selector"
138
  msgstr ""
139
 
140
- #: includes/class-ctc-ui.php:273 includes/class-ctc-ui.php:313
141
- #: includes/class-ctc-ui.php:332
142
- msgid "Save"
143
  msgstr ""
144
 
145
- #: includes/class-ctc-ui.php:283
146
- msgid "Parent Value"
147
  msgstr ""
148
 
149
- #: includes/class-ctc-ui.php:286
150
- msgid "Child Value"
151
  msgstr ""
152
 
153
- #: includes/class-ctc-ui.php:292
154
- msgid "New Rule"
 
 
155
  msgstr ""
156
 
157
- #: includes/class-ctc-ui.php:302
158
- msgid "Order"
159
  msgstr ""
160
 
161
- #: includes/class-ctc-ui.php:309
162
- msgid "Raw CSS"
163
  msgstr ""
164
 
165
- #: includes/class-ctc-ui.php:328
166
- msgid "@import Statements"
167
  msgstr ""
168
 
169
- #: includes/class-ctc-ui.php:360
170
- msgid "Upload New Child Theme Image"
171
  msgstr ""
172
 
173
- #: includes/class-ctc-ui.php:363
 
 
 
 
 
 
 
 
 
 
 
 
174
  msgid ""
175
- "Theme images reside under the <code>images</code> directory in your child "
176
- "theme and are meant for stylesheet use only. Use the Media Library for "
177
- "content images."
178
  msgstr ""
179
 
180
- #: includes/class-ctc-ui.php:370 includes/class-ctc-ui.php:396
181
- msgid "Upload"
 
 
 
182
  msgstr ""
183
 
184
- #: includes/class-ctc-ui.php:377
185
- msgid "Child Theme Screenshot"
186
  msgstr ""
187
 
188
- #: includes/class-ctc-ui.php:386
189
- msgid "Upload New Screenshot"
 
 
 
190
  msgstr ""
191
 
192
- #: includes/class-ctc-ui.php:389
193
  msgid ""
194
- "The theme screenshot should be a 4:3 ratio (e.g., 880px x 660px) JPG, PNG or "
195
- "GIF. It will be renamed <code>screenshot</code>."
 
 
196
  msgstr ""
197
 
198
- #: includes/class-ctc-ui.php:404
199
- msgid "Export Child Theme as Zip Archive"
 
 
 
 
200
  msgstr ""
201
 
202
- #: includes/class-ctc-ui.php:410
203
- msgid "Export"
204
  msgstr ""
205
 
206
- #: includes/class-ctc-ui.php:419
207
- msgid "Secure Child Theme"
 
 
 
 
 
208
  msgstr ""
209
 
210
- #: includes/class-ctc-ui.php:422
 
 
 
 
211
  msgid ""
212
- "Attempt to reset child theme permissions to user ownership and read-only "
213
- "access."
 
214
  msgstr ""
215
 
216
- #: includes/class-ctc-ui.php:428
217
- msgid "Make read-only"
218
  msgstr ""
219
 
220
- #: includes/class-ctc-ui.php:479
221
- msgid "Click here to edit template files using the Theme Editor"
 
222
  msgstr ""
223
 
224
- #: includes/class-ctc-ui.php:483
 
 
 
 
225
  msgid ""
226
  "The Theme editor has been disabled. Template files must be edited offline."
227
  msgstr ""
228
 
229
- #: includes/class-ctc-ui.php:498
 
 
 
 
 
 
 
 
 
 
 
 
230
  msgid "Copy PHP template files from the parent theme by selecting them here."
231
  msgstr ""
232
 
233
- #: includes/class-ctc-ui.php:501
234
  msgid ""
235
  "CAUTION: If your child theme is active, the child theme version of the file "
236
  "will be used instead of the parent immediately after it is copied."
237
  msgstr ""
238
 
239
- #: includes/class-ctc-ui.php:503
240
  msgid "The %s file is generated separately and cannot be copied here."
241
  msgstr ""
242
 
243
- #: includes/class-ctc-ui.php:510
244
  msgid "Delete child theme templates by selecting them here."
245
  msgstr ""
246
 
247
- #: includes/class-ctc-ui.php:512
248
  msgid ""
249
  "Delete child theme templates or make them writable by selecting them here. "
250
  "Writable files are displayed in <span style=\"color:red\">red</span>."
251
  msgstr ""
252
 
253
- #: includes/class-ctc-ui.php:523
254
  msgid "Make Selected Writable"
255
  msgstr ""
256
 
257
- #: includes/class-ctc-ui.php:527
258
  msgid "Copy Selected to Child Theme"
259
  msgstr ""
260
 
261
- #: includes/class-ctc-ui.php:527
262
  msgid "Delete Selected"
263
  msgstr ""
264
 
265
- #: includes/class-ctc-ui.php:565
266
- msgid "Child Theme Images"
 
 
 
 
 
 
 
267
  msgstr ""
268
 
269
- #: includes/class-ctc-ui.php:568
270
- msgid "Remove child theme images by selecting them here."
271
  msgstr ""
272
 
273
- #: includes/class-ctc-ui.php:576
274
- msgid "Remove Selected"
275
  msgstr ""
276
 
277
- #: includes/class-ctc-ui.php:607
278
- msgid "Child Theme files modified successfully."
279
  msgstr ""
280
 
281
- #: includes/class-ctc-ui.php:609
282
  msgid ""
283
- "Child Theme <strong>%s</strong> has been generated successfully.\n"
284
- " "
285
  msgstr ""
286
 
287
- #: includes/class-ctc-ui.php:615
288
- msgid ""
289
- "Please verify the imports below and remove any imports that are not needed "
290
- "by the front end, such as admin or configuration stylesheets."
291
  msgstr ""
292
 
293
- #: includes/class-ctc-ui.php:632
294
- msgid "Tutorial Video"
295
  msgstr ""
296
 
297
- #: includes/class-ctc-ui.php:633
 
 
 
 
298
  msgid ""
299
- "<iframe width=\"480\" height=\"270\" src=\"//www.youtube.com/embed/"
300
- "xL2HkWQxgOA?rel=0&modestbranding=1\" frameborder=\"0\" allowfullscreen></"
301
- "iframe>"
302
  msgstr ""
303
 
304
- #: includes/class-ctc-ui.php:639
305
- msgid "Start Here"
306
  msgstr ""
307
 
308
- #: includes/class-ctc-ui.php:640
309
- msgid ""
310
- "\n"
311
- "<p>The first step is to create a child theme and import your parent theme "
312
- "styles into the configurator.</p>\n"
313
- "<ol><li>Select an existing parent theme from the menu.</li>\n"
314
- "<li>Select \"New\" or \"Existing\" child theme.\n"
315
- "<ul><li>If creating a new theme, enter a \"slug\" (lower case, no spaces). "
316
- "This is used to name the theme directory and identify the theme to WordPress."
317
- "</li>\n"
318
- "<li>If using an existing theme, select a child theme from the menu.</li></"
319
- "ul></li>\n"
320
- "<li>Enter a Name for the child theme.</li>\n"
321
- "<li>Enter an author for the child theme.</li>\n"
322
- "<li>Enter the child theme version number.</li>\n"
323
- "<li>Check \"Copy Parent Theme Menus, Widgets and other Options\", to copy "
324
- "parent theme modifications to the child theme. Depending on the theme, some "
325
- "options may need to be applied using separate theme option controls. "
326
- "<strong>IMPORTANT: This will overwrite existing child theme options.</"
327
- "strong></li>\n"
328
- "<li>Check \"Backup Stylesheet\", to create a backup of the child theme "
329
- "stylesheet in the child theme directory.</li>\n"
330
- "<li>If your theme uses additional stylesheets they will appear as checkbox "
331
- "options when you open the toggle arrow. Select only the stylesheets you wish "
332
- "to customize to reduce overhead. Remember to select them again if you reload "
333
- "your configuration.</li>\n"
334
- "<li>Click \"Generate Child Theme.\"</li>\n"
335
- "<li><strong>ALWAYS <a target=\"_blank\" href=\"http://www.lilaeamedia.com/"
336
- "plugins/child-theme-configurator/#preview_activate\" title=\"Test your child "
337
- "theme before activating!\">TEST YOUR CHILD THEME</a> BEFORE ACTIVATING!</"
338
- "strong></li></ol>\n"
339
- "\t\t\t\t "
340
- msgstr ""
341
-
342
- #: includes/class-ctc-ui.php:661
343
- msgid ""
344
- "\n"
345
- "<p>There are two ways to identify and override parent styles. The Child "
346
- "Theme Configurator lets you search styles by <strong>selector</strong> and "
347
- "by <strong>rule</strong>. If you wish to change a specific selector (e.g., "
348
- "h1), use the \"Query/Selector\" tab. If you have a specific value you wish "
349
- "to change site-wide (e.g., the color of the type), use the \"Rule/Value\" "
350
- "tab.</p>\n"
351
- "<p>The Query/Selector tab lets you find specific selectors and edit them. "
352
- "First, find the query that contains the selector you wish to edit by typing "
353
- "in the <strong>Query</strong> autoselect box. Select by clicking with the "
354
- "mouse or by pressing the \"Enter\" or \"Tab\" keys. Selectors are in the "
355
- "<strong>base</strong> query by default.</p>\n"
356
- "<p>Next, find the selector by typing in the <strong>Selector</strong> "
357
- "autoselect box. Select by clicking with the mouse or by pressing the \"Enter"
358
- "\" or \"Tab\" keys.</p>\n"
359
- "<p>This will load all of the rules for that selector with the Parent values "
360
- "on the left and the Child values inputs on the right. Any existing child "
361
- "values will be automatically populated. There is also a Sample preview that "
362
- "displays the combination of Parent and Child overrides. Note that the "
363
- "<strong>border</strong> and <strong>background-image</strong> get special "
364
- "treatment.</p>\n"
365
- "<p>The \"Order\" field contains the original sequence of the selector in the "
366
- "parent theme stylesheet. You can change the selector order sequence by "
367
- "entering a lower or higher number in the \"Order\" field. You can also force "
368
- "style overrides (so called \"!important\" flag) by checking the \"!\" box "
369
- "next to each input. Please use judiciously.</p>\n"
370
- "<p>Click \"Save\" to update the child stylesheet and save your changes to "
371
- "the WordPress admin.</p>\n"
372
- "\t\t\t\t "
373
- msgstr ""
374
-
375
- #: includes/class-ctc-ui.php:675
376
- msgid ""
377
- "\n"
378
- "<p>There are two ways to identify and override parent styles. The Child "
379
- "Theme Configurator lets you search styles by <strong>selector</strong> and "
380
- "by <strong>rule</strong>. If you wish to change a specific selector (e.g., "
381
- "h1), use the \"Query/Selector\" tab. If you have a specific value you wish "
382
- "to change site-wide (e.g., the color of the type), use the \"Rule/Value\" "
383
- "tab.</p>\n"
384
- "<p>The Rule/Value tab lets you find specific values for a given rule and "
385
- "then edit that value for individual selectors that use that rule/value "
386
- "combination. First, find the rule you wish to override by typing in the "
387
- "<strong>Rule</strong> autoselect box. Select by clicking with the mouse or "
388
- "by pressing the \"Enter\" or \"Tab\" keys.</p>\n"
389
- "<p>This will load all of the unique values that exist for that rule in the "
390
- "parent stylesheet with a Sample preview for that value. If there are values "
391
- "that exist in the child stylesheet that do not exist in the parent "
392
- "stylesheet, they will be displayed as well.</p>\n"
393
- "<p>For each unique value, click the \"Selectors\" link to view a list of "
394
- "selectors that use that rule/value combination, grouped by query with a "
395
- "Sample preview of the value and inputs for the child value. Any existing "
396
- "child values will be automatically populated.</p>\n"
397
- "<p>Click \"Save\" to update the child stylesheet and save your changes to "
398
- "the WordPress admin.</p>\n"
399
- "\t\t\t\t "
400
- msgstr ""
401
-
402
- #: includes/class-ctc-ui.php:687
403
- msgid "Add New Styles"
404
- msgstr ""
405
-
406
- #: includes/class-ctc-ui.php:688
407
- msgid ""
408
- "\n"
409
- "<p>If you wish to add additional rules to a given selector, first load the "
410
- "selector using the Query/Selector tab. Then find the rule you wish to "
411
- "override by typing in the <strong>New Rule</strong> autoselect box. Select "
412
- "by clicking with the mouse or by pressing the \"Enter\" or \"Tab\" keys. "
413
- "This will add a new input row to the selector inputs.</p>\n"
414
- "<p>If you wish to add completely new selectors, or even new @media queries, "
415
- "you can enter free-form CSS in the \"New Selector\" textarea. Be aware that "
416
- "your syntax must be correct (i.e., balanced curly braces, etc.) for the "
417
- "parser to load the new styles. You will know it is invalid because a red \"X"
418
- "\" will appear next to the save button.</p>\n"
419
- "<p>If you prefer to use shorthand syntax for rules and values instead of the "
420
- "inputs provided by the Child Theme Configurator, you can enter them here as "
421
- "well. The parser will convert your input into normalized CSS code "
422
- "automatically.</p>\n"
423
- "\t\t\t\t "
424
- msgstr ""
425
-
426
- #: includes/class-ctc-ui.php:698
427
- msgid "@imports and Web Fonts"
428
- msgstr ""
429
-
430
- #: includes/class-ctc-ui.php:699
431
- msgid ""
432
- "\n"
433
- "<p>You can add additional stylesheets and web fonts by typing @import rules "
434
- "into the textarea on the @import tab. <strong>Important: The Child Theme "
435
- "Configurator adds the @import rule that loads the Parent Theme's stylesheet "
436
- "automatically. Do not need to add it here.</strong></p>\n"
437
- "<p>Below is an example that loads a local custom stylesheet (you would have "
438
- "to add the \"fonts\" directory and stylesheet) as well as the web font "
439
- "\"Open Sans\" from Google Web Fonts:</p>\n"
440
- "<blockquote><pre><code>\n"
441
- "@import url(fonts/stylesheet.css);\n"
442
- "@import url(http://fonts.googleapis.com/css?family=Open"
443
- "+Sans:400,400italic,700,700italic);\n"
444
- "</code></pre></blockquote>\n"
445
- "\t\t\t\t "
446
- msgstr ""
447
-
448
- #: includes/class-ctc-ui.php:713
449
- msgid ""
450
- "\n"
451
- "<h5>Parent Templates</h5><p>Copy PHP template files from the parent theme by "
452
- "checking the boxes and clicking \"Copy Selected to Child Theme\" and the "
453
- "templates will be added to the child theme directory.</p>\n"
454
- "<p><strong>CAUTION: If your child theme is active, the child theme version "
455
- "of the file will be used instead of the parent immediately after it is "
456
- "copied.</strong></p>\n"
457
- "<p>The <code>functions.php</code> file is generated separately and cannot be "
458
- "copied here.</p>\n"
459
- "<h5>Child Templates</h5><p>Templates copied from the parent are listed here. "
460
- "These can be edited using the Theme Editor in the Appearance Menu.</p>\n"
461
- "<p>Remove child theme images by checking the boxes and clicking \"Remove "
462
- "Selected from Child Theme.\"</p>\n"
463
- "<h5>Child Theme Images</h5><p>Theme images reside under the <code>images</"
464
- "code> directory in your child theme and are meant for stylesheet use only. "
465
- "Use the media gallery for content images.</p>\n"
466
- "<p>You can upload new images using the image upload form.</p>\n"
467
- "<h5>Child Theme Screenshot</h5><p>You can upload a custom screenshot for the "
468
- "child theme here.</p>\n"
469
- "<p>The theme screenshot should be a 4:3 ratio (eg., 880px x 660px) JPG, PNG "
470
- "or GIF. It will be renamed <code>screenshot</code>.</p>\n"
471
- "\t\t\t\t "
472
- msgstr ""
473
-
474
- #: includes/class-ctc-ui.php:729
475
- msgid "Preview and Activate"
476
- msgstr ""
477
-
478
- #: includes/class-ctc-ui.php:730
479
- msgid ""
480
- "<p><strong>IMPORTANT: <a target=\"_blank\" href=\"http://www.lilaeamedia.com/"
481
- "plugins/child-theme-configurator/#preview_activate\" title=\"Test your child "
482
- "theme before activating!\">Test your child theme before activating!</a></"
483
- "strong> Some themes (particularly commercial themes) do not adhere to the "
484
- "Theme Development guidelines set forth by WordPress.org, and do not "
485
- "correctly load parent template files or automatically load child theme "
486
- "stylesheets or php files. <strong>In the worst cases they will break your "
487
- "website when you activate the child theme.</strong></p>\n"
488
- "<ol><li>Navigate to Appearance > Themes in the WordPress Admin. You will now "
489
- "see the new Child Theme as one of the installed Themes.</li>\n"
490
- "<li>Click \"Live Preview\" below the new Child Theme to see it in action.</"
491
- "li>\n"
492
- "<li>When you are ready to take the Child Theme live, click \"Activate.\"</"
493
- "li></ol>\n"
494
- "<p>You can also click the Child or Parent CSS tab to reference the "
495
- "stylesheet code.</p>\n"
496
- "\t\t\t\t "
497
- msgstr ""
498
-
499
- #: includes/class-ctc-ui.php:741
500
- msgid "File Permissions"
501
- msgstr ""
502
-
503
- #: includes/class-ctc-ui.php:742
504
- msgid ""
505
- "\n"
506
- "<p>WordPress was designed to work on a number of server configurations. "
507
- "Child Theme Configurator uses the WordPress Filesystem API to allow changes "
508
- "to sites that require user permission to edit files.</p><p>However, because "
509
- "most of the functionality occurs via AJAX (background) requests, the child "
510
- "theme stylesheet must be writable by the web server.</p><p>The plugin will "
511
- "automatically detect your configuration and provide a number of options to "
512
- "resolve this requirement. Use the links provided to find out more about the "
513
- "options available, including:</p>\n"
514
- "<ol><li>Temporarily making the stylesheet writable through the plugin.</li>\n"
515
- "<li>Adding your FTP/SSH credentials to the WordPress config file.</li>\n"
516
- "<li>Setting the stylesheet write permissions on the server manually</li>\n"
517
- "<li>Configuring your web server to allow write access in certain situations."
518
- "</li>\n"
519
- "</ol>\n"
520
- "\t\t\t\t "
521
- msgstr ""
522
-
523
- #: includes/class-ctc-ui.php:755
524
- msgid "FAQs"
525
- msgstr ""
526
-
527
- #: includes/class-ctc-ui.php:756
528
- msgid ""
529
- "\n"
530
- "<h5>Does it work with Plugins?</h5>\n"
531
- "<p>We offer a premium extension to let you easily modify styles for any "
532
- "WordPress Plugin installed on your website. The Child Theme Configurator "
533
- "Plugin Extension scans your plugins and allows you to create custom "
534
- "stylesheets in your Child Theme. <a href=\"http://www.lilaeamedia.com/"
535
- "plugins/child-theme-plugin-styles\" title=\"Child Theme Configurator "
536
- "Extension\">Learn more</a></p>\n"
537
- "<h5 id=\"doesnt_work\">Why doesn’t this work with my (insert theme vendor "
538
- "here) theme?</h5>\n"
539
- "<p>Some themes (particularly commercial themes) do not adhere to the Theme "
540
- "Development guidelines set forth by WordPress.org, and do not correctly load "
541
- "parent template files or automatically load child theme stylesheets or php "
542
- "files.</p>\n"
543
- "<p>This is unfortunate, because in the best case they effectively prohibit "
544
- "the webmaster from adding any customizations (other than those made through "
545
- "the admin theme options) that will survive past an upgrade. <strong>In the "
546
- "worst case they will break your website when you activate the child theme.</"
547
- "strong></p>\n"
548
- "<p>Contact the vendor directly to ask for this core functionality. It is our "
549
- "opinion that ALL themes (especially commercial ones) must pass the Theme "
550
- "Unit Tests outlined by WordPress.org.</p>\n"
551
- "<h5>Can I edit the Child Theme stylesheet manually offline or by using the "
552
- "Editor or do I have to use the Configurator?</h5>\n"
553
- "<p>You can make any manual changes you wish to the stylesheet. Just make "
554
- "sure you import the revised stylesheet using the Parent/Child panel or the "
555
- "Configurator will overwrite your changes the next time you use it. Just "
556
- "follow the steps as usual but select the \"Use Existing Child Theme\" radio "
557
- "button as the \"Child Theme\" option. The Configurator will automatically "
558
- "update its internal data from the new stylesheet.</p>\n"
559
- "<h5>Why doesn't the Parent Theme have any styles when I \"View Parent CSS\"?"
560
- "</h5>\n"
561
- "<p>Your Parent theme is probably using a separate location for the "
562
- "stylesheets. Select individual stylesheets from the \"Parse Additional "
563
- "Stylesheets\" section of the Parent/Child tab and click \"Generate Child "
564
- "Theme Files\" again.</p>\n"
565
- "<h5 id=\"menus-broken\">Why are my menus displaying incorrectly when I "
566
- "activate the new child theme?</h5>\n"
567
- "<p>The child theme creates a new instance in the WordPress options data and "
568
- "the menus have to be assigned. Go to Appearance &gt; Menus and assign "
569
- "locations to each of the menus for the new Child Theme.</p>\n"
570
- "<h5 \"preview-not-loading\">Why do the preview tabs return \"Stylesheet "
571
- "could not be displayed\"?</h5>\n"
572
- "<p>You have to configure at least one child theme from the Parent/Child tab "
573
- "for the preview to display.</p>\n"
574
- "<h5 id=\"specific_color\">How do I change a specific color/font style/"
575
- "background?</h5>\n"
576
- "<p>You can override a specific value globally using the Rule/Value tab. See "
577
- "Rule/Value, above.</p>\n"
578
- "<h5 id=\"add_styles\">How do I add styles that aren't in the Parent Theme?</"
579
- "h5>\n"
580
- "<p>You can add queries and selectors using the \"New Selector(s)\" textarea "
581
- "on the Query/Selector tab. See Query/Selector, above.</p>\n"
582
- "<h5 id=\"add_styles\">How do I remove a style from the Parent Theme?</h5>\n"
583
- "<p>You shouldn't really \"remove\" a style from the Parent. You can, "
584
- "however, set the rule to \"inherit,\" \"none,\" or zero (depending on the "
585
- "rule). This will negate the Parent value. Some experimentation may be "
586
- "necessary.</p>\n"
587
- "<h5 id=\"remove_styles\">How do I remove a style from the Child Theme?</h5>\n"
588
- "<p>Delete the value from the input for the rule you wish to remove. The "
589
- "Child Theme Configurator only adds overrides for rules that contain values.</"
590
- "p>\n"
591
- "<h5 id=\"important_flag\">How do I set the !important flag?</h5>\n"
592
- "<p>We always recommend relying on good cascading design over global "
593
- "overrides. To that end, you have ability to change the load order of child "
594
- "theme styles by entering a value in the \"Order\" field. And yes, you can "
595
- "now set rules as important by checking the \"!\" box next to each input. "
596
- "Please use judiciously.</p>\n"
597
- "<h5 id=\"gradients\">How do I create cross-browser gradients?</h5>\n"
598
- "<p>The Child Theme Configurator automatically generates the vendor prefixes "
599
- "and filters to display gradients across most browsers. It uses a normalized "
600
- "syntax and only supports two colors without intermediate stops. The inputs "
601
- "consist of origin (e.g., top, left, 135deg, etc.), start color and end "
602
- "color. The browser-specific syntax is generated automatically when you save "
603
- "these values. <strong>Note:</strong> For Internet Explorer, a filter rule "
604
- "approximates the gradient but can only be horizontal (origin top) or "
605
- "vertical (origin left). The legacy webkit-gradient syntax is not supported.</"
606
- "p>\n"
607
- "<h5 id=\"responsive\">How do I make my Theme responsive?</h5>\n"
608
- "<p>The short answer is to use a responsive Parent Theme. Some common "
609
- "characteristics of responsive design are:</p>\n"
610
- "<ul><li>Avoiding fixed width and height values. Using max- and min-height "
611
- "values and percentages are ways to make your designs respond to the viewer's "
612
- "browser size.</li>\n"
613
- "<li>Combining floats and clears with inline and relative positions allow the "
614
- "elements to adjust gracefully to their container's width.</li>\n"
615
- "<li>Showing and hiding content with Javascript.</li></ul>\n"
616
- "<iframe width=\"480\" height=\"270\" src=\"//www.youtube.com/embed/"
617
- "iBiiAgsK4G4?rel=0&modestbranding=1\" frameborder=\"0\" allowfullscreen></"
618
- "iframe> \n"
619
- "<h5 id=\"web_fonts\">How do I add Web Fonts?</h5>\n"
620
- "<p>The easiest method is to paste the @import code provided by Google, Font "
621
- "Squirrel or any other Web Font site into the @import tab. The fonts will "
622
- "then be available to use as a value of the <strong>font-family</strong> "
623
- "rule. Be sure you understand the license for any embedded fonts.</p>\n"
624
- "<p>You can also create a secondary stylesheet that contains @font-face rules "
625
- "and import it using the @import tab. <strong>Note:</strong> Currently the "
626
- "Child Theme Configurator does not generate previews of imported web fonts, "
627
- "but will in a later release.</p>\n"
628
- "<h5 id=\"functions_file\">Where are the PHP files?</h5>\n"
629
- "<p>The configurator automatically adds a blank functions.php file to the "
630
- "child theme directory. Other parent theme files can be copied using the "
631
- "\"Files\" tab. Theme images and a custom screenshot can be uploaded there as "
632
- "well.</p>\n"
633
- " "
634
- msgstr ""
635
-
636
- #: includes/class-ctc-ui.php:800
637
- msgid "Glossary"
638
- msgstr ""
639
-
640
- #: includes/class-ctc-ui.php:801
641
- msgid ""
642
- "\n"
643
- "<h3 id=\"terms\">Glossary</h3>\n"
644
- "<ul><li id=\"parent_theme\"><strong>Parent Theme</strong> The WordPress "
645
- "Theme you wish to edit. WordPress first loads the Child Theme, then loads "
646
- "the Parent Theme. If a style exists in the Child Theme, it overrides the "
647
- "Parent Theme.</li>\n"
648
- " <li id=\"child_theme\"><strong>Child Theme</strong> New Theme based on "
649
- "Parent Theme. You can create any number of Child Themes from a single Parent "
650
- "Theme.</li>\n"
651
- " <li id=\"class\"><strong>Class</strong> A term used to organize objects. "
652
- "For example, a &lt;div&gt; might be assigned the \"blue-text\" class. The "
653
- "stylesheet might then assign the \"color: blue;\" rule to members of the "
654
- "\"blue-text\" class. Thus, the &lt;div&gt; would display text as blue in the "
655
- "browser.</li>\n"
656
- " <li id=\"selector\"><strong>Selector</strong> One or more html elements, "
657
- "classes, ids or other terms used to identify groups of objects.</li>\n"
658
- " <li id=\"rule\"><strong>Rule</strong> One of many standardized attributes "
659
- "used to tell the browser how to display objects matching a given selector. "
660
- "Examples are <strong>color</strong>, <strong>background-image</strong> and "
661
- "<strong>font-size</strong>.</li>\n"
662
- "<li id=\"at-rule\"><strong>At-rule</strong> CSS browser instruction to "
663
- "extend default functionality. The Child Theme Configurator supports two At-"
664
- "rules:\n"
665
- "<ul> <li id=\"import\"><strong>@import</strong> Instructs the browser to "
666
- "load additional CSS information from an external source.</li>\n"
667
- " <li id=\"query\"><strong>@media (Media Query)</strong> Identifies blocks of "
668
- "styles that are used only when certain browser characteristics are true. "
669
- "Examples are max-width, screen and print.</li>\n"
670
- "</ul></li>\n"
671
- " <li id=\"override\"><strong>Override</strong> When a selector exists in "
672
- "both the Child Theme and the Parent Theme, the Child Theme takes priority "
673
- "over the Parent theme. This is where the Child Theme Configurator stands "
674
- "out: it helps you create <strong>exact overrides</strong> of selectors from "
675
- "the Parent Theme, eliminating hours of trial and error.</li>\n"
676
- " </ul> \n"
677
- "\t\t\t\t "
678
- msgstr ""
679
-
680
- #: includes/class-ctc-ui.php:824
681
- msgid "Contact us"
682
- msgstr ""
683
-
684
- #: includes/class-ctc-ui.php:825
685
- msgid "Plugin Website"
686
- msgstr ""
687
-
688
- #: includes/class-ctc-ui.php:826
689
- msgid "Donate"
690
- msgstr ""
691
-
692
- #: includes/class-ctc-ui.php:827
693
- msgid "Give Us 5 Stars"
694
- msgstr ""
695
-
696
- #: includes/class-ctc-ui.php:828
697
- msgid "WordPress Codex"
698
- msgstr ""
699
-
700
- #: includes/class-ctc-ui.php:829
701
- msgid "WordPress Answers"
702
- msgstr ""
703
-
704
- #. #-#-#-#-# chld_thm_cfg.pot (Child Theme Configurator 1.5.2.2) #-#-#-#-#
705
- #. Plugin Name of the plugin/theme
706
- #: includes/class-ctc.php:50
707
- msgid "Child Theme Configurator"
708
  msgstr ""
709
 
710
- #: includes/class-ctc.php:51
711
- msgid "Child Themes"
712
  msgstr ""
713
 
714
- #: includes/class-ctc.php:110
715
- msgid "URL/None"
716
  msgstr ""
717
 
718
- #: includes/class-ctc.php:111
719
- msgid "Origin"
720
  msgstr ""
721
 
722
- #: includes/class-ctc.php:112
723
- msgid "Color 1"
724
  msgstr ""
725
 
726
- #: includes/class-ctc.php:113
727
- msgid "Color 2"
728
  msgstr ""
729
 
730
- #: includes/class-ctc.php:114
731
- msgid "Width"
732
  msgstr ""
733
 
734
- #: includes/class-ctc.php:115
735
- msgid "Style"
736
  msgstr ""
737
 
738
- #: includes/class-ctc.php:116
739
- msgid "Color"
740
  msgstr ""
741
 
742
- #: includes/class-ctc.php:118
743
- msgid "Are you sure? This will replace your current settings."
744
  msgstr ""
745
 
746
- #: includes/class-ctc.php:121
747
- msgid "<span style=\"font-size:10px\">!</span>"
748
  msgstr ""
749
 
750
- #: includes/class-ctc.php:123
751
- msgid "Close"
752
  msgstr ""
753
 
754
- #: includes/class-ctc.php:124
755
- msgid "Edit"
756
  msgstr ""
757
 
758
- #: includes/class-ctc.php:125
759
- msgid "Cancel"
 
760
  msgstr ""
761
 
762
- #: includes/class-ctc.php:126
763
- msgid "Rename"
764
  msgstr ""
765
 
766
- #: includes/class-ctc.php:127
767
- msgid "The stylesheet cannot be displayed."
768
  msgstr ""
769
 
770
- #: includes/class-ctc.php:128
771
- msgid "(Child Only)"
 
 
772
  msgstr ""
773
 
774
- #: includes/class-ctc.php:129
775
- msgid "Please enter a valid Child Theme"
776
  msgstr ""
777
 
778
- #: includes/class-ctc.php:130 includes/class-ctc.php:303
779
- msgid "Please enter a valid Child Theme name"
780
  msgstr ""
781
 
782
- #: includes/class-ctc.php:131
783
- msgid "<strong>%s</strong> exists. Please enter a different Child Theme"
784
  msgstr ""
785
 
786
- #: includes/class-ctc.php:247
787
- msgid "Zip file creation failed."
788
  msgstr ""
789
 
790
- #: includes/class-ctc.php:274
791
- msgid "%s does not exist. Please select a valid Parent Theme"
 
 
 
792
  msgstr ""
793
 
794
- #: includes/class-ctc.php:277
795
- msgid "Please select a valid Parent Theme"
796
  msgstr ""
797
 
798
- #: includes/class-ctc.php:281
799
- msgid "Please enter a valid Child Theme template name"
800
  msgstr ""
801
 
802
- #: includes/class-ctc.php:288
 
 
 
 
 
 
 
 
 
 
 
 
803
  msgid ""
804
- "<strong>%s</strong> exists. Please enter a different Child Theme template "
805
- "name"
 
 
806
  msgstr ""
807
 
808
- #: includes/class-ctc.php:306 includes/class-ctc.php:775
809
- msgid "Your theme directories are not writable."
810
  msgstr ""
811
 
812
- #: includes/class-ctc.php:328 includes/class-ctc.php:784
813
- msgid "Your stylesheet is not writable."
814
  msgstr ""
815
 
816
- #: includes/class-ctc.php:389
817
- msgid "You do not have permission to configure child themes."
818
  msgstr ""
819
 
820
- #: includes/class-ctc.php:489
821
- msgid "Could not copy file."
822
  msgstr ""
823
 
824
- #: includes/class-ctc.php:551
825
- msgid "Could not set write permissions."
826
  msgstr ""
827
 
828
- #: includes/class-ctc.php:622
829
- msgid "There were errors while resetting permissions."
830
  msgstr ""
831
 
832
- #: includes/class-ctc.php:657
833
- msgid "Could not upload file."
834
  msgstr ""
835
 
836
- #: includes/class-ctc.php:736
837
- msgid ""
838
- "Child Theme Configurator is unable to write to the stylesheet. This can be "
839
- "resolved using one of the following options:<ol>"
840
  msgstr ""
841
 
842
- #: includes/class-ctc.php:738
843
- msgid ""
844
- "<li>Temporarily make the stylesheet writable by clicking the button below. "
845
- "You should change this back when you are finished editing for security by "
846
- "clicking \"Make read-only\" under the \"Files\" tab.</li>"
847
  msgstr ""
848
 
849
- #: includes/class-ctc.php:740
850
- msgid "Temporarily make stylesheet writable"
851
  msgstr ""
852
 
853
- #: includes/class-ctc.php:741
854
- msgid ""
855
- "<li><a target=\"_blank\" href=\"http://codex.wordpress.org/Editing_wp-"
856
- "config.php#WordPress_Upgrade_Constants\" title=\"Editin wp-config.php\">Add "
857
- "your FTP/SSH credentials to the WordPress config file</a>.</li>"
858
  msgstr ""
859
 
860
- #: includes/class-ctc.php:743
861
- msgid ""
862
- "<li><a target=\"_blank\" href=\"http://technet.microsoft.com/en-us/library/"
863
- "cc771170\" title=\"Setting Application Pool Identity\">Assign WordPress to "
864
- "an application pool that has write permissions</a> (Windows IIS systems).</"
865
- "li>"
866
  msgstr ""
867
 
868
- #: includes/class-ctc.php:744
869
- msgid ""
870
- "<li><a target=\"_blank\" href=\"http://codex.wordpress.org/"
871
- "Changing_File_Permissions\" title=\"Changing File Permissions\">Set the "
872
- "stylesheet write permissions on the server manually</a> (not recommended).</"
873
- "li>"
874
  msgstr ""
875
 
876
- #: includes/class-ctc.php:746
877
- msgid "<li>Run PHP under Apache with suEXEC (contact your web host).</li>"
878
  msgstr ""
879
 
880
- #: includes/class-ctc.php:754
881
- msgid ""
882
- "This Child Theme is not owned by your website account. It may have been "
883
- "created by a prior version of this plugin or by another program. Moving "
884
- "forward, it must be owned by your website account to make changes. Child "
885
- "Theme Configurator will attempt to correct this when you click the button "
886
- "below."
887
  msgstr ""
888
 
889
- #: includes/class-ctc.php:756
890
- msgid "Correct Child Theme Permissions"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
891
  msgstr ""
892
 
893
  #. Plugin URI of the plugin/theme
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 1.6.0\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/child-theme-configurator\n"
7
+ "POT-Creation-Date: 2014-12-01 02:23:29+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
+ #. #-#-#-#-# chld_thm_cfg.pot (Child Theme Configurator 1.6.0) #-#-#-#-#
16
+ #. Plugin Name of the plugin/theme
17
+ #: child-theme-configurator.php:54 includes/forms/main.php:23
18
+ msgid "Child Theme Configurator"
19
  msgstr ""
20
 
21
+ #: child-theme-configurator.php:55
22
+ msgid "Child Themes"
23
  msgstr ""
24
 
25
+ #: includes/class-ctc-ui.php:126
26
+ msgid "Child Theme files modified successfully."
27
  msgstr ""
28
 
29
+ #: includes/class-ctc-ui.php:128
30
+ msgid ""
31
+ "Child Theme <strong>%s</strong> has been generated successfully.\n"
32
+ " "
33
  msgstr ""
34
 
35
+ #: includes/class-ctc-ui.php:131
36
+ msgid "IMPORTANT:"
37
  msgstr ""
38
 
39
+ #: includes/class-ctc-ui.php:131 includes/forms/themepreview.php:16
40
+ #: includes/forms/themepreview.php:17
41
+ msgid "Live Preview"
42
  msgstr ""
43
 
44
+ #: includes/class-ctc-ui.php:131
45
+ msgid "Test your child theme"
46
  msgstr ""
47
 
48
+ #: includes/class-ctc-ui.php:131
49
+ msgid "before activating."
50
  msgstr ""
51
 
52
+ #: includes/class-ctc.php:122
53
+ msgid "URL/None"
54
  msgstr ""
55
 
56
+ #: includes/class-ctc.php:123
57
+ msgid "Origin"
58
  msgstr ""
59
 
60
+ #: includes/class-ctc.php:124
61
+ msgid "Color 1"
62
  msgstr ""
63
 
64
+ #: includes/class-ctc.php:125
65
+ msgid "Color 2"
66
  msgstr ""
67
 
68
+ #: includes/class-ctc.php:126
69
+ msgid "Width"
70
  msgstr ""
71
 
72
+ #: includes/class-ctc.php:127
73
+ msgid "Style"
74
  msgstr ""
75
 
76
+ #: includes/class-ctc.php:128
77
+ msgid "Color"
78
  msgstr ""
79
 
80
+ #: includes/class-ctc.php:130
81
+ msgid "Are you sure? This will replace your current settings."
82
  msgstr ""
83
 
84
+ #: includes/class-ctc.php:132 includes/forms/query-selector.php:35
85
+ #: includes/forms/rule-value.php:28
86
+ msgid "Sample"
87
  msgstr ""
88
 
89
+ #: includes/class-ctc.php:133
90
+ msgid "<span style=\"font-size:10px\">!</span>"
91
  msgstr ""
92
 
93
+ #: includes/class-ctc.php:134 includes/forms/rule-value.php:31
94
+ msgid "Selectors"
95
  msgstr ""
96
 
97
+ #: includes/class-ctc.php:135
98
+ msgid "Close"
99
  msgstr ""
100
 
101
+ #: includes/class-ctc.php:136
102
+ msgid "Edit"
103
  msgstr ""
104
 
105
+ #: includes/class-ctc.php:137
106
+ msgid "Cancel"
107
  msgstr ""
108
 
109
+ #: includes/class-ctc.php:138
110
+ msgid "Rename"
111
  msgstr ""
112
 
113
+ #: includes/class-ctc.php:139
114
+ msgid "The stylesheet cannot be displayed."
115
  msgstr ""
116
 
117
+ #: includes/class-ctc.php:140
118
+ msgid "(Child Only)"
119
  msgstr ""
120
 
121
+ #: includes/class-ctc.php:141
122
+ msgid "Please enter a valid Child Theme"
123
  msgstr ""
124
 
125
+ #: includes/class-ctc.php:142
126
+ msgid "Please enter a valid Child Theme name"
127
  msgstr ""
128
 
129
+ #: includes/class-ctc.php:143
130
+ msgid "<strong>%s</strong> exists. Please enter a different Child Theme"
 
131
  msgstr ""
132
 
133
+ #: includes/class-ctc.php:298
134
+ msgid "Zip file creation failed."
135
  msgstr ""
136
 
137
+ #: includes/class-ctc.php:333
138
+ msgid "The Functions file is required and cannot be deleted."
139
  msgstr ""
140
 
141
+ #: includes/class-ctc.php:413
142
+ msgid "You do not have permission to configure child themes."
143
  msgstr ""
144
 
145
+ #: includes/class-ctc.php:437
146
+ msgid "%s does not exist. Please select a valid Parent Theme"
 
147
  msgstr ""
148
 
149
+ #: includes/class-ctc.php:440
150
+ msgid "Please select a valid Parent Theme"
151
  msgstr ""
152
 
153
+ #: includes/class-ctc.php:445
154
+ msgid "Please enter a valid Child Theme template name"
155
  msgstr ""
156
 
157
+ #: includes/class-ctc.php:450
158
+ msgid ""
159
+ "<strong>%s</strong> exists. Please enter a different Child Theme template "
160
+ "name"
161
  msgstr ""
162
 
163
+ #: includes/class-ctc.php:476
164
+ msgid "Please enter a valid Child Theme directory"
165
  msgstr ""
166
 
167
+ #: includes/class-ctc.php:480 includes/class-ctc.php:997
168
+ msgid "Your theme directories are not writable."
169
  msgstr ""
170
 
171
+ #: includes/class-ctc.php:514 includes/class-ctc.php:1006
172
+ msgid "Your stylesheet is not writable."
173
  msgstr ""
174
 
175
+ #: includes/class-ctc.php:687
176
+ msgid "Could not copy file."
177
  msgstr ""
178
 
179
+ #: includes/class-ctc.php:762
180
+ msgid "Could not set write permissions."
181
+ msgstr ""
182
+
183
+ #: includes/class-ctc.php:833
184
+ msgid "There were errors while resetting permissions."
185
+ msgstr ""
186
+
187
+ #: includes/class-ctc.php:870
188
+ msgid "Could not upload file."
189
+ msgstr ""
190
+
191
+ #: includes/class-ctc.php:950
192
  msgid ""
193
+ "Child Theme Configurator is unable to write to the stylesheet. This can be "
194
+ "resolved using one of the following options:<ol>"
 
195
  msgstr ""
196
 
197
+ #: includes/class-ctc.php:952
198
+ msgid ""
199
+ "<li>Temporarily make the stylesheet writable by clicking the button below. "
200
+ "You should change this back when you are finished editing for security by "
201
+ "clicking \"Make read-only\" under the \"Files\" tab.</li>"
202
  msgstr ""
203
 
204
+ #: includes/class-ctc.php:954
205
+ msgid "Temporarily make stylesheet writable"
206
  msgstr ""
207
 
208
+ #: includes/class-ctc.php:955
209
+ msgid ""
210
+ "<li><a target=\"_blank\" href=\"http://codex.wordpress.org/Editing_wp-"
211
+ "config.php#WordPress_Upgrade_Constants\" title=\"Editin wp-config.php\">Add "
212
+ "your FTP/SSH credentials to the WordPress config file</a>.</li>"
213
  msgstr ""
214
 
215
+ #: includes/class-ctc.php:957
216
  msgid ""
217
+ "<li><a target=\"_blank\" href=\"http://technet.microsoft.com/en-us/library/"
218
+ "cc771170\" title=\"Setting Application Pool Identity\">Assign WordPress to "
219
+ "an application pool that has write permissions</a> (Windows IIS systems).</"
220
+ "li>"
221
  msgstr ""
222
 
223
+ #: includes/class-ctc.php:958
224
+ msgid ""
225
+ "<li><a target=\"_blank\" href=\"http://codex.wordpress.org/"
226
+ "Changing_File_Permissions\" title=\"Changing File Permissions\">Set the "
227
+ "stylesheet write permissions on the server manually</a> (not recommended).</"
228
+ "li>"
229
  msgstr ""
230
 
231
+ #: includes/class-ctc.php:960
232
+ msgid "<li>Run PHP under Apache with suEXEC (contact your web host).</li>"
233
  msgstr ""
234
 
235
+ #: includes/class-ctc.php:968
236
+ msgid ""
237
+ "This Child Theme is not owned by your website account. It may have been "
238
+ "created by a prior version of this plugin or by another program. Moving "
239
+ "forward, it must be owned by your website account to make changes. Child "
240
+ "Theme Configurator will attempt to correct this when you click the button "
241
+ "below."
242
  msgstr ""
243
 
244
+ #: includes/class-ctc.php:970
245
+ msgid "Correct Child Theme Permissions"
246
+ msgstr ""
247
+
248
+ #: includes/class-ctc.php:977
249
  msgid ""
250
+ "Child Theme Configurator has changed the way it handles the parent "
251
+ "stylesheet. Please set your preferences below and click \"Generate Child "
252
+ "Theme Files\" to update your configuration."
253
  msgstr ""
254
 
255
+ #: includes/forms/at-import.php:12
256
+ msgid "@import Statements"
257
  msgstr ""
258
 
259
+ #: includes/forms/at-import.php:16 includes/forms/query-selector.php:43
260
+ #: includes/forms/query-selector.php:83
261
+ msgid "Save"
262
  msgstr ""
263
 
264
+ #: includes/forms/backup.php:8
265
+ msgid "Backup"
266
+ msgstr ""
267
+
268
+ #: includes/forms/fileform.php:7
269
  msgid ""
270
  "The Theme editor has been disabled. Template files must be edited offline."
271
  msgstr ""
272
 
273
+ #: includes/forms/fileform.php:11
274
+ msgid "Click here to edit template files using the Theme Editor"
275
+ msgstr ""
276
+
277
+ #: includes/forms/fileform.php:21
278
+ msgid "Parent Templates"
279
+ msgstr ""
280
+
281
+ #: includes/forms/fileform.php:21
282
+ msgid "Child Theme Files"
283
+ msgstr ""
284
+
285
+ #: includes/forms/fileform.php:26
286
  msgid "Copy PHP template files from the parent theme by selecting them here."
287
  msgstr ""
288
 
289
+ #: includes/forms/fileform.php:29
290
  msgid ""
291
  "CAUTION: If your child theme is active, the child theme version of the file "
292
  "will be used instead of the parent immediately after it is copied."
293
  msgstr ""
294
 
295
+ #: includes/forms/fileform.php:31
296
  msgid "The %s file is generated separately and cannot be copied here."
297
  msgstr ""
298
 
299
+ #: includes/forms/fileform.php:41
300
  msgid "Delete child theme templates by selecting them here."
301
  msgstr ""
302
 
303
+ #: includes/forms/fileform.php:42
304
  msgid ""
305
  "Delete child theme templates or make them writable by selecting them here. "
306
  "Writable files are displayed in <span style=\"color:red\">red</span>."
307
  msgstr ""
308
 
309
+ #: includes/forms/fileform.php:55
310
  msgid "Make Selected Writable"
311
  msgstr ""
312
 
313
+ #: includes/forms/fileform.php:59
314
  msgid "Copy Selected to Child Theme"
315
  msgstr ""
316
 
317
+ #: includes/forms/fileform.php:59 includes/forms/images.php:20
318
  msgid "Delete Selected"
319
  msgstr ""
320
 
321
+ #: includes/forms/files.php:15
322
+ msgid "Upload New Child Theme Image"
323
+ msgstr ""
324
+
325
+ #: includes/forms/files.php:18
326
+ msgid ""
327
+ "Theme images reside under the <code>images</code> directory in your child "
328
+ "theme and are meant for stylesheet use only. Use the Media Library for "
329
+ "content images."
330
  msgstr ""
331
 
332
+ #: includes/forms/files.php:25 includes/forms/files.php:51
333
+ msgid "Upload"
334
  msgstr ""
335
 
336
+ #: includes/forms/files.php:32
337
+ msgid "Child Theme Screenshot"
338
  msgstr ""
339
 
340
+ #: includes/forms/files.php:41
341
+ msgid "Upload New Screenshot"
342
  msgstr ""
343
 
344
+ #: includes/forms/files.php:44
345
  msgid ""
346
+ "The theme screenshot should be a 4:3 ratio (e.g., 880px x 660px) JPG, PNG or "
347
+ "GIF. It will be renamed <code>screenshot</code>."
348
  msgstr ""
349
 
350
+ #: includes/forms/files.php:59
351
+ msgid "Export Child Theme as Zip Archive"
 
 
352
  msgstr ""
353
 
354
+ #: includes/forms/files.php:64
355
+ msgid "Export"
356
  msgstr ""
357
 
358
+ #: includes/forms/files.php:73
359
+ msgid "Secure Child Theme"
360
+ msgstr ""
361
+
362
+ #: includes/forms/files.php:76
363
  msgid ""
364
+ "Attempt to reset child theme permissions to user ownership and read-only "
365
+ "access."
 
366
  msgstr ""
367
 
368
+ #: includes/forms/files.php:82
369
+ msgid "Make read-only"
370
  msgstr ""
371
 
372
+ #: includes/forms/images.php:9
373
+ msgid "Child Theme Images"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
374
  msgstr ""
375
 
376
+ #: includes/forms/images.php:12
377
+ msgid "Delete child theme images by selecting them here."
378
  msgstr ""
379
 
380
+ #: includes/forms/main.php:23
381
+ msgid "version"
382
  msgstr ""
383
 
384
+ #: includes/forms/parent-child.php:20
385
+ msgid "Parent Theme"
386
  msgstr ""
387
 
388
+ #: includes/forms/parent-child.php:28
389
+ msgid "Child Theme"
390
  msgstr ""
391
 
392
+ #: includes/forms/parent-child.php:35
393
+ msgid "Create New Child Theme"
394
  msgstr ""
395
 
396
+ #: includes/forms/parent-child.php:44
397
+ msgid "Use Existing Child Theme"
398
  msgstr ""
399
 
400
+ #: includes/forms/parent-child.php:49
401
+ msgid "Theme Slug"
402
  msgstr ""
403
 
404
+ #: includes/forms/parent-child.php:59
405
+ msgid "Child Theme Name"
406
  msgstr ""
407
 
408
+ #: includes/forms/parent-child.php:63
409
+ msgid "Theme Name"
410
  msgstr ""
411
 
412
+ #: includes/forms/parent-child.php:69 includes/forms/parent-child.php:73
413
+ msgid "Author"
414
  msgstr ""
415
 
416
+ #: includes/forms/parent-child.php:78 includes/forms/parent-child.php:82
417
+ msgid "Version"
418
  msgstr ""
419
 
420
+ #: includes/forms/parent-child.php:88
421
+ msgid "Copy Parent Theme Menus, Widgets and other Options"
422
  msgstr ""
423
 
424
+ #: includes/forms/parent-child.php:95 includes/forms/parent-child.php:110
425
+ #: includes/forms/parent-child.php:140
426
+ msgid "NOTE:"
427
  msgstr ""
428
 
429
+ #: includes/forms/parent-child.php:97
430
+ msgid "This will overwrite child theme options you may have already set."
431
  msgstr ""
432
 
433
+ #: includes/forms/parent-child.php:103
434
+ msgid "Backup current stylesheet"
435
  msgstr ""
436
 
437
+ #: includes/forms/parent-child.php:112
438
+ msgid ""
439
+ "This creates a copy of the current stylesheet before applying changes. You "
440
+ "can remove old backup files using the Files tab."
441
  msgstr ""
442
 
443
+ #: includes/forms/parent-child.php:118
444
+ msgid "Parent stylesheet handling:"
445
  msgstr ""
446
 
447
+ #: includes/forms/parent-child.php:124
448
+ msgid "&lt;link&gt; (default)"
449
  msgstr ""
450
 
451
+ #: includes/forms/parent-child.php:130 includes/forms/tabs.php:22
452
+ msgid "@import"
453
  msgstr ""
454
 
455
+ #: includes/forms/parent-child.php:136
456
+ msgid "none (handled by theme)"
457
  msgstr ""
458
 
459
+ #: includes/forms/parent-child.php:142
460
+ msgid ""
461
+ "Only select @import for older themes that do not enqueue the stylesheet. "
462
+ "Select 'none' if core styles are automatically loaded for child themes. "
463
+ "Select '&lt;link&gt;' if unsure."
464
  msgstr ""
465
 
466
+ #: includes/forms/parent-child.php:148
467
+ msgid "Reset/Restore from backup:"
468
  msgstr ""
469
 
470
+ #: includes/forms/parent-child.php:154
471
+ msgid "Leave unchanged"
472
  msgstr ""
473
 
474
+ #: includes/forms/parent-child.php:160
475
+ msgid "Reset all"
476
+ msgstr ""
477
+
478
+ #: includes/forms/parent-child.php:168
479
+ msgid "Restore backup from"
480
+ msgstr ""
481
+
482
+ #: includes/forms/parent-child.php:180
483
+ msgid "Parse additional stylesheets:"
484
+ msgstr ""
485
+
486
+ #: includes/forms/parent-child.php:184
487
  msgid ""
488
+ "Stylesheets that are currently being loaded by the parent theme are "
489
+ "automatically selected below (except for Bootstrap stylesheets which add a "
490
+ "large amount data to the configuration). To further reduce overhead, select "
491
+ "only the additional stylesheets you wish to customize."
492
  msgstr ""
493
 
494
+ #: includes/forms/parent-child.php:203
495
+ msgid "Generate/Rebuild Child Theme Files"
496
  msgstr ""
497
 
498
+ #: includes/forms/query-selector.php:11
499
+ msgid "Query"
500
  msgstr ""
501
 
502
+ #: includes/forms/query-selector.php:22
503
+ msgid "Selector"
504
  msgstr ""
505
 
506
+ #: includes/forms/query-selector.php:50 includes/forms/rule-value.php:12
507
+ msgid "Rule"
508
  msgstr ""
509
 
510
+ #: includes/forms/query-selector.php:53
511
+ msgid "Parent Value"
512
  msgstr ""
513
 
514
+ #: includes/forms/query-selector.php:56
515
+ msgid "Child Value"
516
  msgstr ""
517
 
518
+ #: includes/forms/query-selector.php:62
519
+ msgid "New Rule"
520
  msgstr ""
521
 
522
+ #: includes/forms/query-selector.php:72
523
+ msgid "Order"
 
 
524
  msgstr ""
525
 
526
+ #: includes/forms/query-selector.php:79
527
+ msgid "Raw CSS"
 
 
 
528
  msgstr ""
529
 
530
+ #: includes/forms/related.php:1
531
+ msgid "New user?"
532
  msgstr ""
533
 
534
+ #: includes/forms/related.php:1
535
+ msgid "Click help"
 
 
 
536
  msgstr ""
537
 
538
+ #: includes/forms/related.php:1
539
+ msgid "Get CTC for Plugins and other tools"
 
 
 
 
540
  msgstr ""
541
 
542
+ #: includes/forms/related.php:1
543
+ msgid "Lilaea Media - Responsive Tools for a Mobile World"
 
 
 
 
544
  msgstr ""
545
 
546
+ #: includes/forms/rule-value.php:25
547
+ msgid "Value"
548
  msgstr ""
549
 
550
+ #: includes/forms/tabs.php:11
551
+ msgid "Parent/Child"
 
 
 
 
 
552
  msgstr ""
553
 
554
+ #: includes/forms/tabs.php:16
555
+ msgid "Query/Selector"
556
+ msgstr ""
557
+
558
+ #: includes/forms/tabs.php:19
559
+ msgid "Rule/Value"
560
+ msgstr ""
561
+
562
+ #: includes/forms/tabs.php:25
563
+ msgid "Child CSS"
564
+ msgstr ""
565
+
566
+ #: includes/forms/tabs.php:28
567
+ msgid "Parent CSS"
568
+ msgstr ""
569
+
570
+ #: includes/forms/tabs.php:35
571
+ msgid "Files"
572
+ msgstr ""
573
+
574
+ #: includes/forms/themepreview.php:12
575
+ msgid "Version: "
576
+ msgstr ""
577
+
578
+ #: includes/forms/themepreview.php:14
579
+ msgid "By: "
580
  msgstr ""
581
 
582
  #. Plugin URI of the plugin/theme
readme.txt CHANGED
@@ -1,24 +1,24 @@
1
  === Child Theme Configurator ===
2
  Contributors: lilaeamedia
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8QE5YJ8WE96AJ
4
- Tags: child theme, custom theme, CSS, responsive design, CSS editor, theme generator
5
  Requires at least: 3.7
6
- Tested up to: 4.0.1
7
- Stable tag: 1.5.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
- Create a Child Theme from any installed Theme. Each CSS selector, rule and value can then be searched, previewed and modified.
12
 
13
  == Description ==
14
 
15
- Created by Lilaea Media, the team that brought you IntelliWidget, the Child Theme Configurator provides a new approach to WordPress stylesheets. The Child Theme Configurator lets you identify and override only the Parent Theme style attributes you want to change. It gives you unlimited control over your WordPress look and feel while leaving your Parent Theme untouched.
16
 
17
  = Take Control of Your Child Themes =
18
 
19
- https://www.youtube.com/watch?v=xL2HkWQxgOA
20
 
21
- The Child Theme Configurator parses and indexes a Theme's stylesheet so that every media query, selector, rule and value are at your fingertips. Second, it shows you how each change you make will look before you commit it to the Child Theme. Finally, it saves your work so that you can fine-tune your Child Theme without the risk of losing your edits.
22
 
23
  You can create any number of Child Themes from any existing Parent Theme. The Child Theme Configurator lets you choose from your installed themes (even existing Child Themes) and save the results in your Themes directory.
24
 
@@ -26,23 +26,25 @@ When you are ready, just activate the Child Theme and your WordPress site takes
26
 
27
  = Why create Child Themes using the Child Theme Configurator? =
28
 
29
- * Apply changes in a Child Theme without touching the Parent Theme
30
- * Identify and override exact selectors from the Parent Theme
31
- * Change colors, backgrounds, font styles globally without changing other rules.
32
- * Tweak individual style selectors
 
 
 
 
 
33
  * Automatically create and preview CSS3 gradients
34
  * Automatically generate cross-browser and vendor-prefixed rules
35
- * View style changes before commiting to them
36
  * Add and modify individual @media queries
37
- * Import web fonts and use them in place of Theme fonts
38
- * Copy theme templates and edit them using Theme Editor
39
- * Upload theme images for use with stylesheets
40
- * Upload custom screenshot for your child theme
41
- * Save hours of development time
42
 
43
- = Now it works with plugins! =
44
 
45
- We offer a premium extension to let you easily modify styles for any WordPress Plugin installed on your website. The Child Theme Configurator Plugin Extension scans your plugins and allows you to create custom stylesheets in your Child Theme.
46
 
47
  https://www.youtube.com/watch?v=mJ3i6gsuL1E
48
 
@@ -79,19 +81,43 @@ Learn more at http://www.lilaeamedia.com/plugins/intelliwidget-responsive-menu
79
 
80
  3. In the WordPress Admin, go to "Plugins > Installed Plugins." Locate "Child Theme Configurator" in the list and click "Activate."
81
 
82
- 4. ALWAYS TEST YOUR CHILD THEME BEFORE ACTIVATING (See "Preview and Activate").
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
 
84
  == Frequently Asked Questions ==
85
 
86
  = HELP! I changed a file and now I am unable to access my website or login to wp-admin to fix it! =
87
 
88
- To back out of a broken theme you have to manually rename the offending theme directory name (via FTP, SSH or your web host control panel file manager) so that WordPress can’t find it. WordPress will then throw an error and revert back to the default theme (currently twenty-fourteen).
89
 
90
  The child theme is in your themes folder, usually
91
 
92
  [wordpress]/wp-content/themes/[child-theme]
93
 
94
- To prevent this in the future, always test your child themes with Live Preview before activating them.
95
 
96
  = Why are my menus displaying incorrectly when I activate the new child theme? =
97
  ...or...
@@ -132,13 +158,11 @@ Now you can edit your child theme from Tools > Child Themes. NOTE: Only users wi
132
 
133
  = Does it work with plugins? =
134
 
135
- We offer a premium extension to let you easily modify styles for any WordPress Plugin installed on your website. The Child Theme Configurator Plugin Extension scans your plugins and allows you to create custom stylesheets in your Child Theme. Learn more at http://www.lilaeamedia.com/plugins/child-theme-plugin-styles
136
 
137
  = Is there a tutorial? =
138
 
139
- https://www.youtube.com/watch?v=xL2HkWQxgOA
140
-
141
- https://www.youtube.com/watch?v=DSfx2RbZobo
142
 
143
  = Why doesn't this work with my (insert theme vendor here) theme? =
144
 
@@ -191,7 +215,7 @@ The Child Theme Configurator automatically adds a blank functions.php file to th
191
 
192
  = How do I change a specific color/font style/background? =
193
 
194
- You can override a specific value globally using the Rule/Value tab. See Rule/Value, above.
195
 
196
  = How do I add styles that aren't in the Parent Theme? =
197
 
@@ -236,6 +260,16 @@ https://www.youtube.com/watch?v=iBiiAgsK4G4
236
 
237
  == Changelog ==
238
 
 
 
 
 
 
 
 
 
 
 
239
  = 1.5.4 =
240
  * New Feature: Load imported stylesheets into the CTC admin so web fonts can be previewed.
241
  * Set preview swatch to z-index -1 to prevent it from covering up the controls
@@ -244,7 +278,7 @@ https://www.youtube.com/watch?v=iBiiAgsK4G4
244
  * Add jQuery UI styles that are no longer being loaded by default in the WP admin (autoselect menus).
245
 
246
  = 1.5.3 =
247
- * Fixed a bug in the way zero values are handled that was breaking css output in certian situations
248
  * Added regex filter for non-printable (e.g., null) characters in input strings
249
 
250
  = 1.5.2.2 =
@@ -398,63 +432,48 @@ https://www.youtube.com/watch?v=iBiiAgsK4G4
398
 
399
  == Upgrade Notice ==
400
 
401
- v.1.5.4 Finally adds web font previews and fixes some bugs. See changelog for details.
402
-
403
- == Create Your Child Theme ==
404
-
405
- The first step is to create a child theme and import your parent theme styles into the configurator.
406
-
407
- 1. Select an existing parent theme from the menu.
408
- 2. Select "New" or "Existing" child theme.
409
- * If creating a new theme, enter a "slug" (lower case, no spaces). This is used to name the theme directory and identify the theme to WordPress.
410
- * If using an existing theme, select a child theme from the menu.
411
- 3. Enter a Name for the child theme.
412
- 4. Enter an author for the child theme.
413
- 5. Enter the child theme version number.
414
- 6. Check "Copy Parent Theme Menus, Widgets and other Options", to copy parent theme modifications to the child theme. Depending on the theme, some options may need to be applied using separate theme option controls. **IMPORTANT: This will overwrite existing child theme options.**
415
- 7. Check "Backup Stylesheet", to create a backup of the child theme stylesheet in the child theme directory.
416
- 8. If your theme uses additional stylesheets they will appear as checkbox options. Select only the stylesheets you wish to customize to reduce overhead.
417
- 9. Click "Generate Child Theme Files."
418
- 10. ALWAYS TEST YOUR CHILD THEME BEFORE ACTIVATING!
419
 
420
  == Override Parent Styles ==
421
 
422
- There are two ways to identify and override parent styles. The Child Theme Configurator lets you search styles by selector and by rule. If you wish to change a specific selector (e.g., h1), use the "Query/Selector" tab. If you have a specific value you wish to change site-wide (e.g., the color of the type), use the "Rule/Value" tab.
423
 
424
- = Query/Selector =
425
 
426
- The Query/Selector tab lets you find specific selectors and edit them. First, find the query that contains the selector you wish to edit by typing in the Query autoselect box. Select by clicking with the mouse or by pressing the "Enter" or "Tab" keys. Selectors are in the base query by default.
427
- Next, find the selector by typing in the Selector autoselect box. Select by clicking with the mouse or by pressing the "Enter" or "Tab" keys.
428
 
429
- This will load all of the rules for that selector with the Parent values on the left and the Child values inputs on the right. Any existing child values will be automatically populated. There is also a Sample preview that displays the combination of Parent and Child overrides. Note that the border and background-image get special treatment.
430
 
431
- The "Order" field contains the original sequence of the selector in the parent theme stylesheet. You can change the selector order sequence by entering a lower or higher number in the "Order" field. You can also force style overrides (so called "!important" flag) by checking the "!" box next to each input. Please use judiciously.
432
 
433
  Click "Save" to update the child stylesheet and save your changes to the WordPress admin.
434
 
435
- = Rule/Value =
436
 
437
- The Rule/Value tab lets you find specific values for a given rule and then edit that value for individual selectors that use that rule/value combination. First, find the rule you wish to override by typing in the Rule autoselect box. Select by clicking with the mouse or by pressing the "Enter" or "Tab" keys.
438
 
439
- This will load all of the unique values that exist for that rule in the parent stylesheet with a Sample preview for that value. If there are values that exist in the child stylesheet that do not exist in the parent stylesheet, they will be displayed as well.
440
 
441
- For each unique value, click the "Selectors" link to view a list of selectors that use that rule/value combination, grouped by query with a Sample preview of the value and inputs for the child value. Any existing child values will be automatically populated.
442
 
443
- Click "Save" to update the child stylesheet and save your changes to the WordPress admin.
 
 
444
 
445
- == Add New Styles ==
446
 
447
- If you wish to add additional rules to a given selector, first load the selector using the Query/Selector tab. Then find the rule you wish to override by typing in the New Rule autoselect box. Select by clicking with the mouse or by pressing the "Enter" or "Tab" keys. This will add a new input row to the selector inputs.
448
 
449
- If you wish to add completely new selectors, or even new @media queries, you can enter free-form CSS in the "New Selector" textarea. Be aware that your syntax must be correct (i.e., balanced curly braces, etc.) for the parser to load the new styles. You will know it is invalid because a red "X" will appear next to the save button.
450
 
451
- If you prefer to use shorthand syntax for rules and values instead of the inputs provided by the Child Theme Configurator, you can enter them here as well. The parser will convert your input into normalized CSS code automatically.
452
 
453
- == Add Imports ==
454
 
455
- You can add additional stylesheets and web fonts by typing @import rules into the textarea on the @import tab. Important: The Child Theme Configurator adds the @import rule that loads the Parent Theme's stylesheet automatically. Do not need to add it here.
456
 
457
- == Files ==
458
 
459
  = Parent Templates =
460
 
@@ -462,9 +481,9 @@ You can copy PHP template files from the parent theme by checking the boxes. Cli
462
 
463
  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. The functions.php file is generated separately and cannot be copied here.
464
 
465
- = Child Templates =
466
 
467
- Templates copied from the parent are listed here. These can be edited using the Theme Editor in the Appearance Menu. Remove child theme images by checking the boxes and clicking "Remove Selected from Child Theme."</p>
468
 
469
  = Child Theme Images =
470
 
@@ -474,11 +493,15 @@ Theme images reside under the <code>images</code> directory in your child theme
474
 
475
  You can upload a custom screenshot for the child theme here. The theme screenshot should be a 4:3 ratio (eg., 880px x 660px) JPG, PNG or GIF. It will be renamed "screenshot".
476
 
 
 
 
 
477
  == Preview and Activate ==
478
 
479
  **IMPORTANT: Test your child theme before activating!**
480
 
481
- Some themes (particularly commercial themes) do not adhere to the Theme Development guidelines set forth by WordPress.org, and do not correctly load parent template files or automatically load child theme stylesheets or php files.
482
 
483
  **In the worst cases they will break your website when you activate the child theme.**
484
 
@@ -486,15 +509,13 @@ Some themes (particularly commercial themes) do not adhere to the Theme Developm
486
  2. Click "Live Preview" below the new Child Theme to see it in action.
487
  3. When you are ready to take the Child Theme live, click "Activate."
488
 
489
- You can also click the Preview CSS tab to see your new masterpiece as CSS code.
490
-
491
  == Caveats ==
492
 
493
- * ALWAYS TEST YOUR CHILD THEME BEFORE ACTIVATING (See "Preview and Activate," above).
494
  * No legacy webkit-gradient. The Child Theme Configurator plugin does not support the legacy webkit gradient. If there is a demand, we will add it in a future release, but most Chrome and Safari users should have upgraded by now.
495
  * Only two-color gradients. The Child Theme Configurator plugin is powerful, but we have simplified the gradient interface. You can use any gradient you want as long as it has two colors and no intermediate stops.
496
  * No @font-face rules. The Child Theme Configurator plugin only supports @media and @import. If you need other @rules, put them in a separate stylesheet and import them into the Child Theme stylesheet.
497
- * The Child Theme Configurator plugin loads the rules that exist in the Parent stylesheet. To add new rules, use the Raw CSS input option.
 
498
 
499
  == Documentation ==
500
 
1
  === Child Theme Configurator ===
2
  Contributors: lilaeamedia
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8QE5YJ8WE96AJ
4
+ Tags: child theme, customize, CSS, responsive, css editor, theme generator, stylesheet, customizer
5
  Requires at least: 3.7
6
+ Tested up to: 4.1
7
+ Stable tag: 1.6.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
+ Create a Child Theme from any installed theme. Search, preview and customize any selector, rule or value using this fast CSS editor.
12
 
13
  == Description ==
14
 
15
+ Child Theme Configurator is a fast and easy to use CSS editor that allows you to create Child Themes and customize them well beyond the Theme Customizer. The Child Theme Configurator lets you identify and override only the Parent Theme CSS attributes you want to change. It gives you unlimited control over your WordPress look and feel while leaving your Parent Theme untouched.
16
 
17
  = Take Control of Your Child Themes =
18
 
19
+ https://www.youtube.com/watch?v=53M7RVxDYEY
20
 
21
+ The Child Theme Configurator parses and indexes a Theme's stylesheets so that every CSS media query, selector, rule and value are at your fingertips. Second, it shows you how each change you make will look before you commit it to the Child Theme. Finally, it saves your work so that you can fine-tune your Child Theme without the risk of losing your edits.
22
 
23
  You can create any number of Child Themes from any existing Parent Theme. The Child Theme Configurator lets you choose from your installed themes (even existing Child Themes) and save the results in your Themes directory.
24
 
26
 
27
  = Why create Child Themes using the Child Theme Configurator? =
28
 
29
+ * Update themes without losing customizations
30
+ * Save hours of development time
31
+ * Make modifications above and beyond the theme Customizer
32
+ * Load parent theme stylesheet with <link> instead of @import
33
+ * Export Child Theme as Zip Archive
34
+ * Import web fonts and use them in place of theme fonts
35
+ * Apply changes in a child theme without touching the parent theme
36
+ * Identify and override exact selectors from the parent theme
37
+ * Change specific colors, backgrounds, font styles, etc., without changing other elements
38
  * Automatically create and preview CSS3 gradients
39
  * Automatically generate cross-browser and vendor-prefixed rules
40
+ * Preview style changes before committing to them
41
  * Add and modify individual @media queries
42
+ * Uses WP Filesystem API will not create files you cannot remove
43
+ * Nag-free, no-strings-attached user experience
 
 
 
44
 
45
+ = Not just for themes but plugins too! =
46
 
47
+ We offer a premium extension that brings the CSS editing power of Child Theme Configurator to any WordPress Plugin installed on your website. The Child Theme Configurator Plugin Extension scans your plugins and creates custom CSS in your Child Theme.
48
 
49
  https://www.youtube.com/watch?v=mJ3i6gsuL1E
50
 
81
 
82
  3. In the WordPress Admin, go to "Plugins > Installed Plugins." Locate "Child Theme Configurator" in the list and click "Activate."
83
 
84
+ = 10 Easy Steps to Create a Child Theme =
85
+
86
+ 1. Select the theme you want to configure from the "Parent Theme" menu.
87
+
88
+ 2. Select "new" or "existing".
89
+
90
+ 3. Enter a Name, Author and Version for the child theme.
91
+
92
+ 4. Copy Parent Theme Menus, Widgets and other Options (optional)
93
+
94
+ 5. Save Backup (optional)
95
+
96
+ 6. Choose parent stylesheet handling
97
+ * Select <link> if the parent theme uses the main 'style.css' stylesheet and correctly enqueues it for child themes (default).
98
+ * Select @import for older themes that do not enqueue the stylesheet. If the parent styles do not appear when you activate the child theme, you probably need to use this option. NOTE: this was the only method used in previous versions of Child Theme Configurator.
99
+ * Select "None" if the parent theme does not use the main 'style.css' for its core styles but enqueues it for child themes. This is a common practice with more recent themes.
100
+ * If you do not know which option to use, select <link>.
101
+
102
+ 7. Restore from backup (optional).
103
+
104
+ 8. Choose additional stylesheets (optional).
105
+
106
+ 9. Click "Generate/Rebuild Child Theme Files."
107
+
108
+ 10. IMPORTANT: Always test your child theme with Live Preview before activating!
109
 
110
  == Frequently Asked Questions ==
111
 
112
  = HELP! I changed a file and now I am unable to access my website or login to wp-admin to fix it! =
113
 
114
+ To back out of a broken child theme you have to manually rename the offending theme directory name (via FTP, SSH or your web host control panel file manager) so that WordPress can’t find it. WordPress will then throw an error and revert back to the default theme (currently twenty-fourteen).
115
 
116
  The child theme is in your themes folder, usually
117
 
118
  [wordpress]/wp-content/themes/[child-theme]
119
 
120
+ To prevent this in the future, always test your child theme with Live Preview before activating.
121
 
122
  = Why are my menus displaying incorrectly when I activate the new child theme? =
123
  ...or...
158
 
159
  = Does it work with plugins? =
160
 
161
+ We offer a premium extension that brings the CSS editing power of Child Theme Configurator to any WordPress Plugin installed on your website. The Child Theme Configurator Plugin Extension scans your plugins and creates custom CSS in your Child Theme. Learn more at http://www.lilaeamedia.com/plugins/child-theme-plugin-styles
162
 
163
  = Is there a tutorial? =
164
 
165
+ https://www.youtube.com/watch?v=53M7RVxDYEY
 
 
166
 
167
  = Why doesn't this work with my (insert theme vendor here) theme? =
168
 
215
 
216
  = How do I change a specific color/font style/background? =
217
 
218
+ You can override a specific CSS value globally using the Rule/Value tab. See Rule/Value, above.
219
 
220
  = How do I add styles that aren't in the Parent Theme? =
221
 
260
 
261
  == Changelog ==
262
 
263
+ = 1.6.0 =
264
+ * New Feature: option to load parent stylesheet using wp_enqueue_style (link), @import or none. Thanks to cmwwebfx and Shapeshifter3 for pushing me on this
265
+ * New Feature: automatically-generated child theme slug and name
266
+ * New Feature: restore from backup and reset options
267
+ * New Feature: backup files to "Child Theme Files" on Files Tab so they can be deleted
268
+ * New Feature: Added new theme chooser select menu with screenshot, theme info and link to live preview.
269
+ * Fix: Admin scripts now only load when CTC page is being viewed.
270
+ * Fix: parent CSS preview to correctly display all parsed parent stylesheets in sequence
271
+ * Fix: Refactored throughout for maintainability
272
+
273
  = 1.5.4 =
274
  * New Feature: Load imported stylesheets into the CTC admin so web fonts can be previewed.
275
  * Set preview swatch to z-index -1 to prevent it from covering up the controls
278
  * Add jQuery UI styles that are no longer being loaded by default in the WP admin (autoselect menus).
279
 
280
  = 1.5.3 =
281
+ * Fixed a bug in the way zero values are handled that was breaking css output in certain situations
282
  * Added regex filter for non-printable (e.g., null) characters in input strings
283
 
284
  = 1.5.2.2 =
432
 
433
  == Upgrade Notice ==
434
 
435
+ v.1.6.0 You can now choose to externally link the parent stylesheet instead of using @import, or skip the parent stylesheet entirely. Make sure you update your configuration after upgrading (there is a notice). We have also redesigned the theme menus to display a preview of each theme and fixed a few bugs.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
436
 
437
  == Override Parent Styles ==
438
 
439
+ There are two ways to identify and override parent styles. The Child Theme Configurator lets you search styles by CSS selector and by rule. If you wish to change a specific CSS selector (e.g., h1), use the "Query/Selector" tab. If you have a specific CSS value you wish to change site-wide (e.g., the color of the type), use the "Rule/Value" tab.
440
 
441
+ = Query/Selector Tab =
442
 
443
+ The Query/Selector tab lets you find specific CSS selectors and edit them. First, find the query that contains the CSS selector you wish to edit by typing in the Query autoselect box. Select by clicking with the mouse or by pressing the "Enter" or "Tab" keys. CSS selectors are in the base query by default.
444
+ Next, find the CSS selector by typing in the "Selector" autoselect box. Select by clicking with the mouse or by pressing the "Enter" or "Tab" keys.
445
 
446
+ This will load all of the rules for that CSS selector with the Parent values on the left and the Child values inputs on the right. Any existing child values will be automatically populated. There is also a Sample preview that displays the combination of Parent and Child overrides. Note that the border and background-image get special treatment.
447
 
448
+ The "Order" field contains the original sequence of the CSS selector in the parent theme stylesheet. You can change the CSS selector order sequence by entering a lower or higher number in the "Order" field. You can also force style overrides (so called "!important" flag) by checking the "!" box next to each input. Please use judiciously.
449
 
450
  Click "Save" to update the child stylesheet and save your changes to the WordPress admin.
451
 
452
+ == Adding New Styles ==
453
 
454
+ If you wish to add additional rules to a given CSS selector, first load the selector using the Query/Selector tab. Then find the rule you wish to override by typing in the New Rule autoselect box. Select by clicking with the mouse or by pressing the "Enter" or "Tab" keys. This will add a new input row to the selector inputs.
455
 
456
+ If you wish to add completely new CSS selectors, or even new @media queries, you can enter free-form CSS in the "Raw CSS" textarea. Be aware that your syntax must be correct (i.e., balanced curly braces, etc.) for the parser to load the new styles. You will know it is invalid because a red "X" will appear next to the save button.
457
 
458
+ If you prefer to use shorthand syntax for rules and values instead of the inputs provided by the Child Theme Configurator, you can enter them here as well. The parser will convert your input into normalized CSS code automatically.
459
 
460
+ = Rule/Value Tab =
461
+
462
+ The Rule/Value tab lets you find specific values for a given rule and then edit that value for individual CSS selectors that use that rule/value combination. First, find the rule you wish to override by typing in the Rule autoselect box. Select by clicking with the mouse or by pressing the "Enter" or "Tab" keys.
463
 
464
+ This will load all of the unique values that exist for that rule in the parent stylesheet with a Sample preview for that value. If there are values that exist in the child stylesheet that do not exist in the parent stylesheet, they will be displayed as well.
465
 
466
+ For each unique value, click the "Selectors" link to view a list of CSS selectors that use that rule/value combination, grouped by query with a Sample preview of the value and inputs for the child value. Any existing child values will be automatically populated.
467
 
468
+ Click "Save" to update the child stylesheet and save your changes to the WordPress admin.
469
 
470
+ If you want to edit all of the rules for the CSS selector you can click the “Edit” link and the CSS selector will automatically load in the Query/Selector Tab.
471
 
472
+ == @import Tab and Web Fonts ==
473
 
474
+ You can add additional stylesheets and web fonts by typing @import rules into the textarea on the @import tab. **Important: do not import the parent theme stylesheet here.** Use the &quot;Parent stylesheet handling&quot; option from the Parent/Child tab.
475
 
476
+ == Files Tab ==
477
 
478
  = Parent Templates =
479
 
481
 
482
  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. The functions.php file is generated separately and cannot be copied here.
483
 
484
+ = Child Theme Files =
485
 
486
+ Templates copied from the parent are listed here. These can be edited using the Theme Editor in the Appearance Menu. Remove child theme images by checking the boxes and clicking "Delete Selected."</p>
487
 
488
  = Child Theme Images =
489
 
493
 
494
  You can upload a custom screenshot for the child theme here. The theme screenshot should be a 4:3 ratio (eg., 880px x 660px) JPG, PNG or GIF. It will be renamed "screenshot".
495
 
496
+ = Export Child Theme as Zip Archive =
497
+
498
+ You can download your child theme for use on another WordPress site by clicking "Export".
499
+
500
  == Preview and Activate ==
501
 
502
  **IMPORTANT: Test your child theme before activating!**
503
 
504
+ Some themes (particularly commercial themes) do not correctly load parent template files or automatically load child theme stylesheets or php files.
505
 
506
  **In the worst cases they will break your website when you activate the child theme.**
507
 
509
  2. Click "Live Preview" below the new Child Theme to see it in action.
510
  3. When you are ready to take the Child Theme live, click "Activate."
511
 
 
 
512
  == Caveats ==
513
 
 
514
  * No legacy webkit-gradient. The Child Theme Configurator plugin does not support the legacy webkit gradient. If there is a demand, we will add it in a future release, but most Chrome and Safari users should have upgraded by now.
515
  * Only two-color gradients. The Child Theme Configurator plugin is powerful, but we have simplified the gradient interface. You can use any gradient you want as long as it has two colors and no intermediate stops.
516
  * No @font-face rules. The Child Theme Configurator plugin only supports @media and @import. If you need other @rules, put them in a separate stylesheet and import them into the Child Theme stylesheet.
517
+ * Not all CSS rules are supported. The Child Theme Configurator plugin works with the vast majority of CSS rules, however we’ve left out some of the more obscure options.
518
+ * Multiple versions of the same rule in a single selector are not supported, with a few exceptions. The Child Theme Configurator plugin will automatically generate vendor-prefix variations for background-image, border-radius, transform, transition, and others.
519
 
520
  == Documentation ==
521