Version Description
- New Feature: Enqueue child theme stylesheet option for themes that do not load it.
- New Feature: Child Theme and Author website, description and tag fields.
- Fix: Redesigned UI Javascript using jQuery objects for better browser memory management.
- Fix: Child Theme Stylesheet version is timestamped to force browser reload after changes.
Download this release
Release Info
Developer | lilaeamedia |
Plugin | Child Theme Configurator |
Version | 1.7.0 |
Comparing to | |
See all releases |
Code changes from version 1.6.5.2 to 1.7.0
- child-theme-configurator.php +12 -5
- css/chld-thm-cfg.css +28 -15
- includes/class-ctc-css.php +111 -90
- includes/class-ctc-ui.php +2 -2
- includes/class-ctc.php +106 -68
- includes/forms/addl_panels.php +4 -2
- includes/forms/addl_tabs.php +1 -1
- includes/forms/parent-child.php +86 -39
- includes/forms/query-selector.php +3 -3
- includes/forms/rule-value.php +1 -1
- includes/help/help_en_US.php +9 -10
- js/chld-thm-cfg.js +1236 -1354
- js/chld-thm-cfg.min.js +1 -1
- lang/chld_thm_cfg.pot +249 -160
- readme.txt +67 -49
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 and customize the stylesheet and templates. Fast CSS editor lets you search, preview and modify by selector, rule or value.
|
9 |
-
Version: 1.
|
10 |
Author: Lilaea Media
|
11 |
Author URI: http://www.lilaeamedia.com/
|
12 |
Text Domain: chld_thm_cfg
|
@@ -20,7 +20,7 @@ if ( !defined( 'ABSPATH' ) ) exit;
|
|
20 |
define( 'LILAEAMEDIA_URL', "http://www.lilaeamedia.com" );
|
21 |
defined( 'CHLD_THM_CFG_OPTIONS' ) or
|
22 |
define( 'CHLD_THM_CFG_OPTIONS', 'chld_thm_cfg_options' );
|
23 |
-
define( 'CHLD_THM_CFG_VERSION', '1.
|
24 |
define( 'CHLD_THM_CFG_MIN_WP_VERSION', '3.7' );
|
25 |
defined( 'CHLD_THM_CFG_BPSEL' ) or
|
26 |
define( 'CHLD_THM_CFG_BPSEL', '2500' );
|
@@ -111,12 +111,13 @@ if ( !defined( 'ABSPATH' ) ) exit;
|
|
111 |
echo '<div class="update-nag"><p>' .
|
112 |
sprintf( __( 'Child Theme Configurator requires WordPress version %s or later.', 'chld_thm_cfg' ),
|
113 |
CHLD_THM_CFG_MIN_WP_VERSION ) . '</p></div>' . LF;
|
114 |
-
}
|
115 |
}
|
116 |
|
117 |
if ( is_admin() )
|
118 |
add_action( 'plugins_loaded', 'ChildThemeConfigurator::init' );
|
119 |
-
|
|
|
120 |
register_uninstall_hook( __FILE__, 'chld_thm_cfg_uninstall' );
|
121 |
|
122 |
function chld_thm_cfg_uninstall() {
|
@@ -131,4 +132,10 @@ if ( !defined( 'ABSPATH' ) ) exit;
|
|
131 |
delete_option( CHLD_THM_CFG_OPTIONS . '_sel_ndx' );
|
132 |
delete_option( CHLD_THM_CFG_OPTIONS . '_val_ndx' );
|
133 |
}
|
134 |
-
|
|
|
|
|
|
|
|
|
|
|
|
6 |
Plugin Name: Child Theme Configurator
|
7 |
Plugin URI: http://www.lilaeamedia.com/plugins/child-theme-configurator/
|
8 |
Description: Create a Child Theme and customize the stylesheet and templates. Fast CSS editor lets you search, preview and modify by selector, rule or value.
|
9 |
+
Version: 1.7.0
|
10 |
Author: Lilaea Media
|
11 |
Author URI: http://www.lilaeamedia.com/
|
12 |
Text Domain: chld_thm_cfg
|
20 |
define( 'LILAEAMEDIA_URL', "http://www.lilaeamedia.com" );
|
21 |
defined( 'CHLD_THM_CFG_OPTIONS' ) or
|
22 |
define( 'CHLD_THM_CFG_OPTIONS', 'chld_thm_cfg_options' );
|
23 |
+
define( 'CHLD_THM_CFG_VERSION', '1.7.0' );
|
24 |
define( 'CHLD_THM_CFG_MIN_WP_VERSION', '3.7' );
|
25 |
defined( 'CHLD_THM_CFG_BPSEL' ) or
|
26 |
define( 'CHLD_THM_CFG_BPSEL', '2500' );
|
111 |
echo '<div class="update-nag"><p>' .
|
112 |
sprintf( __( 'Child Theme Configurator requires WordPress version %s or later.', 'chld_thm_cfg' ),
|
113 |
CHLD_THM_CFG_MIN_WP_VERSION ) . '</p></div>' . LF;
|
114 |
+
}
|
115 |
}
|
116 |
|
117 |
if ( is_admin() )
|
118 |
add_action( 'plugins_loaded', 'ChildThemeConfigurator::init' );
|
119 |
+
|
120 |
+
|
121 |
register_uninstall_hook( __FILE__, 'chld_thm_cfg_uninstall' );
|
122 |
|
123 |
function chld_thm_cfg_uninstall() {
|
132 |
delete_option( CHLD_THM_CFG_OPTIONS . '_sel_ndx' );
|
133 |
delete_option( CHLD_THM_CFG_OPTIONS . '_val_ndx' );
|
134 |
}
|
135 |
+
|
136 |
+
add_filter( 'style_loader_src', 'chld_thm_cfg_plugins_version', 10, 2 );
|
137 |
+
function chld_thm_cfg_plugins_version( $src, $handle ) {
|
138 |
+
if ( strstr( $src, get_stylesheet() ) )
|
139 |
+
$src = preg_replace( "/ver=(.*?)(\&|$)/", 'ver=' . wp_get_theme()->Version . "$2", $src );
|
140 |
+
return $src;
|
141 |
+
}
|
css/chld-thm-cfg.css
CHANGED
@@ -1,3 +1,6 @@
|
|
|
|
|
|
|
|
1 |
a.nav-tab, a.nav-tab:focus, a.nav-tab:active {
|
2 |
outline: none;
|
3 |
-moz-box-shadow: none;
|
@@ -10,17 +13,19 @@ a.nav-tab, a.nav-tab:focus, a.nav-tab:active {
|
|
10 |
line-height:1;
|
11 |
height:2em;*/
|
12 |
}
|
13 |
-
h2 .nav-tab {
|
14 |
font-size: 13px;
|
15 |
padding: 6px 8px;
|
|
|
|
|
16 |
}
|
17 |
.ctc-option-panel-container {
|
18 |
position: relative;
|
19 |
min-height: 1100px;
|
20 |
width:100%;
|
21 |
overflow: auto;
|
22 |
-
|
23 |
-
|
24 |
-moz-columns:3;
|
25 |
-moz-column-gap:3em;
|
26 |
-webkit-columns:3;
|
@@ -59,10 +64,10 @@ h2 .nav-tab {
|
|
59 |
visibility: hidden;
|
60 |
position: absolute;
|
61 |
/* overflow:auto; */
|
62 |
-
width:
|
63 |
top: 0;
|
64 |
left: 0;
|
65 |
-
padding: 10px
|
66 |
/* transition: width 1s ease;
|
67 |
-moz-transition: width 1s ease;
|
68 |
-webkit-transition: width 1s ease;
|
@@ -83,26 +88,25 @@ h2 .nav-tab {
|
|
83 |
#ctc_recent_selectors {
|
84 |
padding: 0 8px;
|
85 |
}
|
|
|
|
|
|
|
|
|
86 |
a.ctc-recent-tab {
|
87 |
float:right;
|
88 |
border:1px solid #ccc;
|
|
|
89 |
background-color: #E4E4E4;
|
90 |
color: #555;
|
91 |
display: inline-block;
|
92 |
text-decoration: none;
|
93 |
-
/*margin:0;*/
|
94 |
margin: -1px 0 0 0;
|
|
|
95 |
box-shadow: none;
|
96 |
-moz-box-shadow:none;
|
97 |
-webkit-box-shadow: none;
|
98 |
outline:none;
|
99 |
}
|
100 |
-
h2 .ctc-recent-tab {
|
101 |
-
padding: 6px 8px;
|
102 |
-
font-weight: 700;
|
103 |
-
font-size: 13px;
|
104 |
-
line-height: 24px;
|
105 |
-
}
|
106 |
.ctc-recent-tab h3 {
|
107 |
}
|
108 |
|
@@ -148,7 +152,6 @@ h2 .ctc-recent-tab {
|
|
148 |
margin-right: 2%;
|
149 |
word-wrap: break-word;
|
150 |
}
|
151 |
-
|
152 |
.ctc-input-cell-wide {
|
153 |
display: block;
|
154 |
float: left;
|
@@ -156,12 +159,16 @@ h2 .ctc-recent-tab {
|
|
156 |
margin-right: 2%;
|
157 |
}
|
158 |
|
|
|
|
|
|
|
|
|
159 |
.ctc-input-cell-wide textarea {
|
160 |
width: 100%;
|
161 |
height: 200px;
|
162 |
white-space: pre;
|
163 |
overflow: auto;
|
164 |
-
font-family:
|
165 |
word-wrap: normal;
|
166 |
}
|
167 |
|
@@ -277,7 +284,11 @@ h2 .ctc-recent-tab {
|
|
277 |
|
278 |
.ctc-selector-value {
|
279 |
}
|
280 |
-
|
|
|
|
|
|
|
|
|
281 |
.ctc-selector-cell {
|
282 |
float: left;
|
283 |
width: 30%;
|
@@ -389,6 +400,8 @@ h2 .ctc-recent-tab {
|
|
389 |
.ctc-section-toggle-content {
|
390 |
display: none;
|
391 |
position: relative;
|
|
|
|
|
392 |
}
|
393 |
|
394 |
/*** Added in 1.6.0 for new Theme chooser ***/
|
1 |
+
p {
|
2 |
+
line-height:1.4;
|
3 |
+
}
|
4 |
a.nav-tab, a.nav-tab:focus, a.nav-tab:active {
|
5 |
outline: none;
|
6 |
-moz-box-shadow: none;
|
13 |
line-height:1;
|
14 |
height:2em;*/
|
15 |
}
|
16 |
+
h2 .nav-tab, h2 .ctc-recent-tab {
|
17 |
font-size: 13px;
|
18 |
padding: 6px 8px;
|
19 |
+
font-weight: 700;
|
20 |
+
line-height: 24px;
|
21 |
}
|
22 |
.ctc-option-panel-container {
|
23 |
position: relative;
|
24 |
min-height: 1100px;
|
25 |
width:100%;
|
26 |
overflow: auto;
|
27 |
+
}
|
28 |
+
.ctc-three-col {
|
29 |
-moz-columns:3;
|
30 |
-moz-column-gap:3em;
|
31 |
-webkit-columns:3;
|
64 |
visibility: hidden;
|
65 |
position: absolute;
|
66 |
/* overflow:auto; */
|
67 |
+
width: 100%;
|
68 |
top: 0;
|
69 |
left: 0;
|
70 |
+
padding: 10px 0 0;
|
71 |
/* transition: width 1s ease;
|
72 |
-moz-transition: width 1s ease;
|
73 |
-webkit-transition: width 1s ease;
|
88 |
#ctc_recent_selectors {
|
89 |
padding: 0 8px;
|
90 |
}
|
91 |
+
#live_preview_panel iframe {
|
92 |
+
width: 100%;
|
93 |
+
min-height: 1100px;
|
94 |
+
}
|
95 |
a.ctc-recent-tab {
|
96 |
float:right;
|
97 |
border:1px solid #ccc;
|
98 |
+
border-bottom: none;
|
99 |
background-color: #E4E4E4;
|
100 |
color: #555;
|
101 |
display: inline-block;
|
102 |
text-decoration: none;
|
|
|
103 |
margin: -1px 0 0 0;
|
104 |
+
/* margin: 1px 0 -1px; */
|
105 |
box-shadow: none;
|
106 |
-moz-box-shadow:none;
|
107 |
-webkit-box-shadow: none;
|
108 |
outline:none;
|
109 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
.ctc-recent-tab h3 {
|
111 |
}
|
112 |
|
152 |
margin-right: 2%;
|
153 |
word-wrap: break-word;
|
154 |
}
|
|
|
155 |
.ctc-input-cell-wide {
|
156 |
display: block;
|
157 |
float: left;
|
159 |
margin-right: 2%;
|
160 |
}
|
161 |
|
162 |
+
.ctc-input-cell-wide input[type="text"] {
|
163 |
+
width: 100%;
|
164 |
+
}
|
165 |
+
|
166 |
.ctc-input-cell-wide textarea {
|
167 |
width: 100%;
|
168 |
height: 200px;
|
169 |
white-space: pre;
|
170 |
overflow: auto;
|
171 |
+
font-family: inherit;
|
172 |
word-wrap: normal;
|
173 |
}
|
174 |
|
284 |
|
285 |
.ctc-selector-value {
|
286 |
}
|
287 |
+
.howto.sep {
|
288 |
+
border-bottom: 1px solid #fff;
|
289 |
+
margin-bottom: .5em;
|
290 |
+
padding-bottom: .5em;
|
291 |
+
}
|
292 |
.ctc-selector-cell {
|
293 |
float: left;
|
294 |
width: 30%;
|
400 |
.ctc-section-toggle-content {
|
401 |
display: none;
|
402 |
position: relative;
|
403 |
+
margin:0;
|
404 |
+
padding:1px 0;
|
405 |
}
|
406 |
|
407 |
/*** Added in 1.6.0 for new Theme chooser ***/
|
includes/class-ctc-css.php
CHANGED
@@ -6,7 +6,7 @@ if ( !defined( 'ABSPATH' ) ) exit;
|
|
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.
|
10 |
Author: Lilaea Media
|
11 |
Author URI: http://www.lilaeamedia.com/
|
12 |
Text Domain: chld_thm_cfg
|
@@ -42,6 +42,10 @@ class ChildThemeConfiguratorCSS {
|
|
42 |
var $enqueue; // load parent css method (enqueue, import, none)
|
43 |
var $child_name; // child theme name
|
44 |
var $child_author; // stylesheet author
|
|
|
|
|
|
|
|
|
45 |
var $child_version; // stylesheet version
|
46 |
var $max_sel;
|
47 |
var $vendorrule = array(
|
@@ -65,6 +69,10 @@ class ChildThemeConfiguratorCSS {
|
|
65 |
'child_version',
|
66 |
'child_author',
|
67 |
'child_name',
|
|
|
|
|
|
|
|
|
68 |
'parnt',
|
69 |
'child',
|
70 |
'configtype', // legacy support
|
@@ -98,6 +106,10 @@ class ChildThemeConfiguratorCSS {
|
|
98 |
$this->configtype = 'theme'; // legacy support
|
99 |
$this->child_name = '';
|
100 |
$this->child_author = 'Child Theme Configurator';
|
|
|
|
|
|
|
|
|
101 |
$this->child_version = '1.0';
|
102 |
$this->max_sel = 0;
|
103 |
|
@@ -126,6 +138,7 @@ class ChildThemeConfiguratorCSS {
|
|
126 |
foreach ( $this->configvars as $configkey )
|
127 |
if ( isset( $configarray[ $configkey ] ) )
|
128 |
$this->{$configkey} = $configarray[ $configkey ];
|
|
|
129 |
foreach ( $this->dicts as $configkey ):
|
130 |
if ( $configarray = get_option( $option . '_' . $configkey ) )
|
131 |
$this->{$configkey} = $configarray;
|
@@ -144,11 +157,12 @@ class ChildThemeConfiguratorCSS {
|
|
144 |
foreach ( $this->configvars as $configkey )
|
145 |
$configarray[ $configkey ] = $this->{$configkey};
|
146 |
update_option( $option . '_configvars', $configarray );
|
|
|
147 |
foreach ( $this->dicts as $configkey )
|
148 |
update_option( $option . '_' . $configkey, $this->{$configkey} );
|
149 |
}
|
150 |
|
151 |
-
|
152 |
* get_prop
|
153 |
* Getter interface (data sliced different ways depending on objname )
|
154 |
*/
|
@@ -160,8 +174,11 @@ class ChildThemeConfiguratorCSS {
|
|
160 |
array_keys( $this->imports[ 'child' ] ) :
|
161 |
array_keys( array_flip( $this->imports[ 'child' ] ) ) ) :
|
162 |
array() );
|
163 |
-
case '
|
164 |
-
return $this->obj_to_utf8( $this->denorm_sel_ndx(
|
|
|
|
|
|
|
165 |
case 'rule_val':
|
166 |
return empty( $params[ 'key' ] ) ? array() : $this->denorm_rule_val( $params[ 'key' ] );
|
167 |
case 'val_qry':
|
@@ -169,11 +186,12 @@ class ChildThemeConfiguratorCSS {
|
|
169 |
return empty( $params[ 'key' ] ) ?
|
170 |
array() : $this->denorm_val_query( $params[ 'key' ], $params[ 'rule' ] );
|
171 |
endif;
|
172 |
-
case '
|
173 |
return empty( $params[ 'key' ] ) ?
|
174 |
-
array() : $this->denorm_sel_val( $params[ 'key' ] );
|
175 |
-
case '
|
176 |
-
|
|
|
177 |
case 'child':
|
178 |
return $this->child;
|
179 |
case 'parnt':
|
@@ -186,6 +204,14 @@ class ChildThemeConfiguratorCSS {
|
|
186 |
return $this->child_name;
|
187 |
case 'author':
|
188 |
return $this->child_author;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
case 'version':
|
190 |
return $this->child_version;
|
191 |
case 'preview':
|
@@ -215,7 +241,7 @@ class ChildThemeConfiguratorCSS {
|
|
215 |
return FALSE;
|
216 |
}
|
217 |
|
218 |
-
|
219 |
* set_prop
|
220 |
* Setter interface (scalar values only)
|
221 |
*/
|
@@ -238,12 +264,15 @@ class ChildThemeConfiguratorCSS {
|
|
238 |
$parnt = $this->get_prop( 'parnt' );
|
239 |
return '/*' . LF
|
240 |
. 'Theme Name: ' . $this->get_prop( 'child_name' ) . LF
|
|
|
241 |
. 'Template: ' . $parnt . LF
|
242 |
-
. 'Author: ' . $this->get_prop( 'author' ). LF
|
243 |
-
.
|
|
|
|
|
|
|
244 |
. 'Updated: ' . current_time( 'mysql' ) . LF
|
245 |
-
. '*/' . LF . LF
|
246 |
-
. '@charset "UTF-8";' . LF . LF
|
247 |
. ( 'import' == $this->enqueue ? '@import url(\'../' . $parnt . '/style.css\');' . LF : '' );
|
248 |
}
|
249 |
// formats file path for child theme file
|
@@ -255,17 +284,16 @@ class ChildThemeConfiguratorCSS {
|
|
255 |
return trailingslashit( get_theme_root() ) . trailingslashit( $this->get_prop( 'parnt' ) ) . $file;
|
256 |
}
|
257 |
|
258 |
-
|
259 |
* update_arrays
|
260 |
* accepts CSS properties as raw strings and normilizes into
|
261 |
* CTC object arrays, creating update cache in the process.
|
262 |
* Update cache is returned to UI via AJAX to refresh page.
|
263 |
*/
|
264 |
-
function update_arrays( $template, $query, $sel, $rule = NULL, $value = NULL, $important = 0
|
265 |
if ( $this->max_sel ) return;
|
266 |
// normalize selector styling
|
267 |
$sel = implode( ', ', preg_split( '#\s*,\s*#s', trim( $sel ) ) );
|
268 |
-
//echo "$template $query $sel $rule $value $important" . LF;
|
269 |
// add selector and query to index
|
270 |
if ( !isset( $this->dict_query[ $query ] ) ) $this->dict_query[ $query ] = ++$this->querykey;
|
271 |
if ( !isset( $this->dict_sel[ $sel ] ) ) $this->dict_sel[ $sel ] = ++$this->selkey;
|
@@ -281,19 +309,8 @@ class ChildThemeConfiguratorCSS {
|
|
281 |
|
282 |
$this->dict_qs[ $this->qskey ][ 's' ] = $this->dict_sel[ $sel ];
|
283 |
$this->dict_qs[ $this->qskey ][ 'q' ] = $this->dict_query[ $query ];
|
284 |
-
// tell the UI to update a single cached query/selector lookup by passing 'qsid' as the key
|
285 |
-
// (normally the entire array is replaced):
|
286 |
-
if ( $this->ctc()->cache_updates )
|
287 |
-
$this->ctc()->updates[] = array(
|
288 |
-
'obj' => 'sel_ndx',
|
289 |
-
'key' => 'qsid',
|
290 |
-
'data' => array(
|
291 |
-
'query' => $query,
|
292 |
-
'selector' => $sel,
|
293 |
-
'qsid' => $this->qskey,
|
294 |
-
),
|
295 |
-
);
|
296 |
endif;
|
|
|
297 |
// update sequence for this selector if this is a later instance to keep cascade priority
|
298 |
if ( !isset( $this->dict_seq[ $this->qskey ] ) )
|
299 |
$this->dict_seq[ $this->qskey ] = $this->qskey;
|
@@ -301,14 +318,6 @@ class ChildThemeConfiguratorCSS {
|
|
301 |
if ( $rule ):
|
302 |
if ( !isset( $this->dict_rule[ $rule ] ) ):
|
303 |
$this->dict_rule[ $rule ] = ++$this->rulekey;
|
304 |
-
// tell the UI to update a single cached rule:
|
305 |
-
if ( $this->ctc()->cache_updates ):
|
306 |
-
$this->ctc()->updates[] = array(
|
307 |
-
'obj' => 'rule',
|
308 |
-
'key' => $this->rulekey,
|
309 |
-
'data' => $rule,
|
310 |
-
);
|
311 |
-
endif;
|
312 |
endif;
|
313 |
$qsid = $this->sel_ndx[ $this->dict_query[ $query ] ][ $this->dict_sel[ $sel ] ];
|
314 |
$ruleid = $this->dict_rule[ $rule ];
|
@@ -316,29 +325,12 @@ class ChildThemeConfiguratorCSS {
|
|
316 |
$this->dict_val[ $value ] = ++$this->valkey;
|
317 |
endif;
|
318 |
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
//
|
323 |
-
if ( $this->ctc()->cache_updates ):
|
324 |
-
$updatearr = array(
|
325 |
-
'obj' => 'sel_val',
|
326 |
-
'key' => $qsid,
|
327 |
-
'data' => $this->denorm_sel_val( $qsid ),
|
328 |
-
);
|
329 |
-
$this->ctc()->updates[] = $updatearr;
|
330 |
-
endif;
|
331 |
-
if ( isset( $seq ) ): // this is a renamed selector
|
332 |
-
$this->dict_seq[ $qsid ] = $seq;
|
333 |
-
if ( $this->ctc()->cache_updates ):
|
334 |
-
$this->ctc()->updates[] = array(
|
335 |
-
'obj' => 'rewrite',
|
336 |
-
'key' => $qsid,
|
337 |
-
'data' => $sel,
|
338 |
-
);
|
339 |
-
endif;
|
340 |
-
endif;
|
341 |
$this->prune_if_empty( $qsid );
|
|
|
342 |
endif;
|
343 |
}
|
344 |
|
@@ -394,23 +386,6 @@ class ChildThemeConfiguratorCSS {
|
|
394 |
endwhile;
|
395 |
return $files;
|
396 |
}
|
397 |
-
// allows images to be used between parent and child themes
|
398 |
-
function convert_parent_rel_url_to_abs_url( $url ) {
|
399 |
-
$source = $this->get_prop( 'parnt' );
|
400 |
-
$spliton = '%[/\\\\]%';
|
401 |
-
$dirname = dirname( $url );
|
402 |
-
$dirs = preg_split( $spliton, $dirname );
|
403 |
-
$dds = '';
|
404 |
-
$themeuri = get_theme_root_uri();
|
405 |
-
while ( count( $dirs ) ):
|
406 |
-
$thisdir = array_pop( $dirs );
|
407 |
-
$upone = implode( '/', $dirs );
|
408 |
-
$dds .= '\.\.\/';
|
409 |
-
$regex = '%url\([\'" ]*' . $dds . '(.+?)[\'" ]*\)%';
|
410 |
-
$fullurl = $themeuri . '/' . $source . '/' . $upone . ( '' == $upone ? '' : '/' );
|
411 |
-
$this->styles = preg_replace( $regex, "url(" . $fullurl . "$1)", $this->styles );
|
412 |
-
endwhile;
|
413 |
-
}
|
414 |
/*
|
415 |
* parse_post_data
|
416 |
* Parse user form input into separate properties and pass to update_arrays
|
@@ -446,6 +421,7 @@ class ChildThemeConfiguratorCSS {
|
|
446 |
else:
|
447 |
$newselector = isset( $_POST[ 'ctc_rewrite_selector' ] ) ?
|
448 |
$this->sanitize( $this->parse_css_input( $_POST[ 'ctc_rewrite_selector' ] ) ) : NULL;
|
|
|
449 |
// set the custom sequence value
|
450 |
foreach ( preg_grep( '#^ctc_ovrd_child_seq_#', array_keys( $_POST ) ) as $post_key ):
|
451 |
if ( preg_match( '#^ctc_ovrd_child_seq_(\d+)$#', $post_key, $matches ) ):
|
@@ -474,16 +450,12 @@ class ChildThemeConfiguratorCSS {
|
|
474 |
else:
|
475 |
if ( $newselector && $newselector != $selarr[ 'selector' ] ):
|
476 |
// If this is a renamed selector, add new selector to array
|
477 |
-
|
478 |
-
|
479 |
-
//
|
480 |
-
// 2. tells the update_arrays function to flag this as a
|
481 |
-
// renamed selector to pass back in result array.
|
482 |
-
$this->update_arrays( 'child', $selarr[ 'query' ], $newselector,
|
483 |
-
$rule, trim( $value ), $important, $this->dict_seq[ $qsid ] );
|
484 |
$this->update_arrays( 'child', $selarr[ 'query' ], $selarr[ 'selector' ], $rule, '' );
|
485 |
else:
|
486 |
-
//
|
487 |
$this->update_arrays( 'child', $selarr[ 'query' ], $selarr[ 'selector' ],
|
488 |
$rule, trim( $value ), $important );
|
489 |
endif;
|
@@ -518,15 +490,33 @@ class ChildThemeConfiguratorCSS {
|
|
518 |
$value = '';
|
519 |
endif;
|
520 |
if ( $newselector && $newselector != $rule_part[ 'selector' ] ):
|
521 |
-
|
522 |
-
|
|
|
|
|
523 |
$this->update_arrays( 'child', $rule_part[ 'query' ], $rule_part[ 'selector' ], $rule, '' );
|
524 |
else:
|
|
|
525 |
$this->update_arrays( 'child', $rule_part[ 'query' ], $rule_part[ 'selector' ],
|
526 |
$rule, trim( $value ), $rule_part[ 'important' ] );
|
527 |
endif;
|
528 |
endforeach;
|
529 |
endforeach;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
530 |
endif;
|
531 |
}
|
532 |
|
@@ -571,7 +561,7 @@ class ChildThemeConfiguratorCSS {
|
|
571 |
preg_match( $regex, $this->styles, $matches );
|
572 |
$child_name = $this->get_prop( 'child_name' );
|
573 |
if ( !empty( $matches[ 1 ] ) && 'child' == $template && empty( $child_name ) ) $this->set_prop( 'child_name', $matches[ 1 ] );
|
574 |
-
$this->parse_css( $template );
|
575 |
}
|
576 |
|
577 |
// loads raw css file into local memory
|
@@ -608,7 +598,7 @@ class ChildThemeConfiguratorCSS {
|
|
608 |
* parse_css
|
609 |
* Accepts raw CSS as text and parses into individual properties.
|
610 |
*/
|
611 |
-
function parse_css( $template, $basequery = NULL, $parse_imports = TRUE ) {
|
612 |
if ( FALSE === strpos( $basequery, '@' ) ):
|
613 |
$basequery = 'base';
|
614 |
endif;
|
@@ -644,6 +634,7 @@ class ChildThemeConfiguratorCSS {
|
|
644 |
$this->styles = preg_replace( $regex, '', $this->styles );
|
645 |
endforeach;
|
646 |
$ruleset[ $basequery ] = $this->styles;
|
|
|
647 |
foreach ( $ruleset as $query => $segment ):
|
648 |
// make sure there is a newline before the first selector
|
649 |
$segment = LF . $segment;
|
@@ -702,11 +693,40 @@ class ChildThemeConfiguratorCSS {
|
|
702 |
endif;
|
703 |
// normalize common vendor prefixes
|
704 |
$rule = preg_replace( '#(\-(o|ms|moz|webkit)\-)?(' . implode( '|', $this->vendorrule ) . ')#', "$3", $rule );
|
705 |
-
|
|
|
|
|
706 |
endforeach;
|
707 |
endforeach;
|
708 |
endforeach;
|
709 |
endforeach;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
710 |
}
|
711 |
|
712 |
/*
|
@@ -1108,7 +1128,8 @@ class ChildThemeConfiguratorCSS {
|
|
1108 |
foreach ( $this->val_ndx as $selid => $rules ):
|
1109 |
if ( !isset( $rules[ $ruleid ] ) ) continue;
|
1110 |
foreach ( $rules[ $ruleid ] as $theme => $val ):
|
1111 |
-
|
|
|
1112 |
$rule_sel_arr[ $val ] = $val_arr[ $val ];
|
1113 |
endforeach;
|
1114 |
endforeach;
|
@@ -1192,7 +1213,7 @@ class ChildThemeConfiguratorCSS {
|
|
1192 |
$sel_ndx_norm[ $queryarr[ $queryid ] ][ $selarr[ $selid ] ] = $qsid;
|
1193 |
endforeach;
|
1194 |
endforeach;
|
1195 |
-
return empty( $query ) ? $sel_ndx_norm : $sel_ndx_norm[ $query ];
|
1196 |
}
|
1197 |
|
1198 |
/*
|
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.7.0
|
10 |
Author: Lilaea Media
|
11 |
Author URI: http://www.lilaeamedia.com/
|
12 |
Text Domain: chld_thm_cfg
|
42 |
var $enqueue; // load parent css method (enqueue, import, none)
|
43 |
var $child_name; // child theme name
|
44 |
var $child_author; // stylesheet author
|
45 |
+
var $child_authoruri; // stylesheet author
|
46 |
+
var $child_themeuri; // stylesheet author
|
47 |
+
var $child_descr; // stylesheet author
|
48 |
+
var $child_tags; // stylesheet author
|
49 |
var $child_version; // stylesheet version
|
50 |
var $max_sel;
|
51 |
var $vendorrule = array(
|
69 |
'child_version',
|
70 |
'child_author',
|
71 |
'child_name',
|
72 |
+
'child_themeuri',
|
73 |
+
'child_authoruri',
|
74 |
+
'child_descr',
|
75 |
+
'child_tags',
|
76 |
'parnt',
|
77 |
'child',
|
78 |
'configtype', // legacy support
|
106 |
$this->configtype = 'theme'; // legacy support
|
107 |
$this->child_name = '';
|
108 |
$this->child_author = 'Child Theme Configurator';
|
109 |
+
$this->child_themeuri = '';
|
110 |
+
$this->child_authoruri = '';
|
111 |
+
$this->child_descr = '';
|
112 |
+
$this->child_tags = '';
|
113 |
$this->child_version = '1.0';
|
114 |
$this->max_sel = 0;
|
115 |
|
138 |
foreach ( $this->configvars as $configkey )
|
139 |
if ( isset( $configarray[ $configkey ] ) )
|
140 |
$this->{$configkey} = $configarray[ $configkey ];
|
141 |
+
$this->ctc()->debug( 'configvars: ' . print_r( $configarray, TRUE ), __FUNCTION__ );
|
142 |
foreach ( $this->dicts as $configkey ):
|
143 |
if ( $configarray = get_option( $option . '_' . $configkey ) )
|
144 |
$this->{$configkey} = $configarray;
|
157 |
foreach ( $this->configvars as $configkey )
|
158 |
$configarray[ $configkey ] = $this->{$configkey};
|
159 |
update_option( $option . '_configvars', $configarray );
|
160 |
+
$this->ctc()->debug( 'configvars: ' . print_r( $configarray, TRUE ), __FUNCTION__ );
|
161 |
foreach ( $this->dicts as $configkey )
|
162 |
update_option( $option . '_' . $configkey, $this->{$configkey} );
|
163 |
}
|
164 |
|
165 |
+
/**
|
166 |
* get_prop
|
167 |
* Getter interface (data sliced different ways depending on objname )
|
168 |
*/
|
174 |
array_keys( $this->imports[ 'child' ] ) :
|
175 |
array_keys( array_flip( $this->imports[ 'child' ] ) ) ) :
|
176 |
array() );
|
177 |
+
case 'queries':
|
178 |
+
return $this->obj_to_utf8( $this->denorm_sel_ndx() );
|
179 |
+
case 'selectors':
|
180 |
+
return empty( $params[ 'key' ] ) ?
|
181 |
+
array() : $this->obj_to_utf8( $this->denorm_sel_ndx( $params[ 'key' ] ) );
|
182 |
case 'rule_val':
|
183 |
return empty( $params[ 'key' ] ) ? array() : $this->denorm_rule_val( $params[ 'key' ] );
|
184 |
case 'val_qry':
|
186 |
return empty( $params[ 'key' ] ) ?
|
187 |
array() : $this->denorm_val_query( $params[ 'key' ], $params[ 'rule' ] );
|
188 |
endif;
|
189 |
+
case 'qsid':
|
190 |
return empty( $params[ 'key' ] ) ?
|
191 |
+
array() : $this->obj_to_utf8( $this->denorm_sel_val( $params[ 'key' ] ) );
|
192 |
+
case 'rules':
|
193 |
+
ksort( $this->dict_rule );
|
194 |
+
return $this->obj_to_utf8( $this->dict_rule );;
|
195 |
case 'child':
|
196 |
return $this->child;
|
197 |
case 'parnt':
|
204 |
return $this->child_name;
|
205 |
case 'author':
|
206 |
return $this->child_author;
|
207 |
+
case 'themeuri':
|
208 |
+
return isset( $this->child_themeuri ) ? $this->child_themeuri : FALSE;
|
209 |
+
case 'authoruri':
|
210 |
+
return isset( $this->child_authoruri ) ? $this->child_authoruri : FALSE;
|
211 |
+
case 'descr':
|
212 |
+
return isset( $this->child_descr ) ? $this->child_descr : FALSE;
|
213 |
+
case 'tags':
|
214 |
+
return isset( $this->child_tags ) ? $this->child_tags : FALSE;
|
215 |
case 'version':
|
216 |
return $this->child_version;
|
217 |
case 'preview':
|
241 |
return FALSE;
|
242 |
}
|
243 |
|
244 |
+
/**
|
245 |
* set_prop
|
246 |
* Setter interface (scalar values only)
|
247 |
*/
|
264 |
$parnt = $this->get_prop( 'parnt' );
|
265 |
return '/*' . LF
|
266 |
. 'Theme Name: ' . $this->get_prop( 'child_name' ) . LF
|
267 |
+
. ( ( $attr = $this->get_prop( 'themeuri' ) ) ? 'Theme URI: ' . $attr . LF : '' )
|
268 |
. 'Template: ' . $parnt . LF
|
269 |
+
. 'Author: ' . $this->get_prop( 'author' ) . LF
|
270 |
+
. ( ( $attr = $this->get_prop( 'authoruri' ) ) ? 'Author URI: ' . $attr . LF : '' )
|
271 |
+
. ( ( $attr = $this->get_prop( 'descr' ) ) ? 'Description: ' . $attr . LF : '' )
|
272 |
+
. ( ( $attr = $this->get_prop( 'tags' ) ) ? 'Tags: ' . $attr . LF : '' )
|
273 |
+
. 'Version: ' . $this->get_prop( 'version' ) . '.' . time() . LF
|
274 |
. 'Updated: ' . current_time( 'mysql' ) . LF
|
275 |
+
. '*/' . LF . LF . '@charset "UTF-8";' . LF . LF
|
|
|
276 |
. ( 'import' == $this->enqueue ? '@import url(\'../' . $parnt . '/style.css\');' . LF : '' );
|
277 |
}
|
278 |
// formats file path for child theme file
|
284 |
return trailingslashit( get_theme_root() ) . trailingslashit( $this->get_prop( 'parnt' ) ) . $file;
|
285 |
}
|
286 |
|
287 |
+
/**
|
288 |
* update_arrays
|
289 |
* accepts CSS properties as raw strings and normilizes into
|
290 |
* CTC object arrays, creating update cache in the process.
|
291 |
* Update cache is returned to UI via AJAX to refresh page.
|
292 |
*/
|
293 |
+
function update_arrays( $template, $query, $sel, $rule = NULL, $value = NULL, $important = 0 ) {
|
294 |
if ( $this->max_sel ) return;
|
295 |
// normalize selector styling
|
296 |
$sel = implode( ', ', preg_split( '#\s*,\s*#s', trim( $sel ) ) );
|
|
|
297 |
// add selector and query to index
|
298 |
if ( !isset( $this->dict_query[ $query ] ) ) $this->dict_query[ $query ] = ++$this->querykey;
|
299 |
if ( !isset( $this->dict_sel[ $sel ] ) ) $this->dict_sel[ $sel ] = ++$this->selkey;
|
309 |
|
310 |
$this->dict_qs[ $this->qskey ][ 's' ] = $this->dict_sel[ $sel ];
|
311 |
$this->dict_qs[ $this->qskey ][ 'q' ] = $this->dict_query[ $query ];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
312 |
endif;
|
313 |
+
|
314 |
// update sequence for this selector if this is a later instance to keep cascade priority
|
315 |
if ( !isset( $this->dict_seq[ $this->qskey ] ) )
|
316 |
$this->dict_seq[ $this->qskey ] = $this->qskey;
|
318 |
if ( $rule ):
|
319 |
if ( !isset( $this->dict_rule[ $rule ] ) ):
|
320 |
$this->dict_rule[ $rule ] = ++$this->rulekey;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
321 |
endif;
|
322 |
$qsid = $this->sel_ndx[ $this->dict_query[ $query ] ][ $this->dict_sel[ $sel ] ];
|
323 |
$ruleid = $this->dict_rule[ $rule ];
|
325 |
$this->dict_val[ $value ] = ++$this->valkey;
|
326 |
endif;
|
327 |
|
328 |
+
$this->val_ndx[ $qsid ][ $ruleid ][ $template ] = $this->dict_val[ $value ];
|
329 |
+
// set the important flag for this value
|
330 |
+
$this->val_ndx[ $qsid ][ $ruleid ][ 'i_' . $template ] = $important;
|
331 |
+
// remove if all child values have been cleared
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
332 |
$this->prune_if_empty( $qsid );
|
333 |
+
return $qsid;
|
334 |
endif;
|
335 |
}
|
336 |
|
386 |
endwhile;
|
387 |
return $files;
|
388 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
389 |
/*
|
390 |
* parse_post_data
|
391 |
* Parse user form input into separate properties and pass to update_arrays
|
421 |
else:
|
422 |
$newselector = isset( $_POST[ 'ctc_rewrite_selector' ] ) ?
|
423 |
$this->sanitize( $this->parse_css_input( $_POST[ 'ctc_rewrite_selector' ] ) ) : NULL;
|
424 |
+
$newqsid = NULL;
|
425 |
// set the custom sequence value
|
426 |
foreach ( preg_grep( '#^ctc_ovrd_child_seq_#', array_keys( $_POST ) ) as $post_key ):
|
427 |
if ( preg_match( '#^ctc_ovrd_child_seq_(\d+)$#', $post_key, $matches ) ):
|
450 |
else:
|
451 |
if ( $newselector && $newselector != $selarr[ 'selector' ] ):
|
452 |
// If this is a renamed selector, add new selector to array
|
453 |
+
$newqsid = $this->update_arrays( 'child', $selarr[ 'query' ], $newselector,
|
454 |
+
$rule, trim( $value ), $important );
|
455 |
+
// clear the original selector's child value:
|
|
|
|
|
|
|
|
|
456 |
$this->update_arrays( 'child', $selarr[ 'query' ], $selarr[ 'selector' ], $rule, '' );
|
457 |
else:
|
458 |
+
// otherwise, just update with the new values:
|
459 |
$this->update_arrays( 'child', $selarr[ 'query' ], $selarr[ 'selector' ],
|
460 |
$rule, trim( $value ), $important );
|
461 |
endif;
|
490 |
$value = '';
|
491 |
endif;
|
492 |
if ( $newselector && $newselector != $rule_part[ 'selector' ] ):
|
493 |
+
// If this is a renamed selector, add new selector to array
|
494 |
+
$newqsid = $this->update_arrays( 'child', $rule_part[ 'query' ], $newselector,
|
495 |
+
$rule, trim( $value ), $rule_part[ 'important' ] );
|
496 |
+
// clear the original selector's child value:
|
497 |
$this->update_arrays( 'child', $rule_part[ 'query' ], $rule_part[ 'selector' ], $rule, '' );
|
498 |
else:
|
499 |
+
// otherwise, just update with the new values:
|
500 |
$this->update_arrays( 'child', $rule_part[ 'query' ], $rule_part[ 'selector' ],
|
501 |
$rule, trim( $value ), $rule_part[ 'important' ] );
|
502 |
endif;
|
503 |
endforeach;
|
504 |
endforeach;
|
505 |
+
// if this is a renamed selector, update sequence dict
|
506 |
+
if ( $newqsid ):
|
507 |
+
if ( !isset( $this->dict_seq[ $newqsid ] ) )
|
508 |
+
$this->dict_seq[ $newqsid ] = $this->dict_seq[ $qsid ];
|
509 |
+
// pass this back to browser
|
510 |
+
$qsid = $newqsid;
|
511 |
+
endif;
|
512 |
+
// return updated qsid to browser to update form
|
513 |
+
if ( $this->ctc()->cache_updates ):
|
514 |
+
$this->ctc()->updates[] = array(
|
515 |
+
'obj' => 'qsid',
|
516 |
+
'key' => $qsid,
|
517 |
+
'data' => $this->obj_to_utf8( $this->denorm_sel_val( $qsid ) ),
|
518 |
+
);
|
519 |
+
endif;
|
520 |
endif;
|
521 |
}
|
522 |
|
561 |
preg_match( $regex, $this->styles, $matches );
|
562 |
$child_name = $this->get_prop( 'child_name' );
|
563 |
if ( !empty( $matches[ 1 ] ) && 'child' == $template && empty( $child_name ) ) $this->set_prop( 'child_name', $matches[ 1 ] );
|
564 |
+
$this->parse_css( $template, NULL, NULL, $this->ctc()->normalize_path( dirname( $file ) ) );
|
565 |
}
|
566 |
|
567 |
// loads raw css file into local memory
|
598 |
* parse_css
|
599 |
* Accepts raw CSS as text and parses into individual properties.
|
600 |
*/
|
601 |
+
function parse_css( $template, $basequery = NULL, $parse_imports = TRUE, $relpath = '' ) {
|
602 |
if ( FALSE === strpos( $basequery, '@' ) ):
|
603 |
$basequery = 'base';
|
604 |
endif;
|
634 |
$this->styles = preg_replace( $regex, '', $this->styles );
|
635 |
endforeach;
|
636 |
$ruleset[ $basequery ] = $this->styles;
|
637 |
+
$qsid = NULL;
|
638 |
foreach ( $ruleset as $query => $segment ):
|
639 |
// make sure there is a newline before the first selector
|
640 |
$segment = LF . $segment;
|
693 |
endif;
|
694 |
// normalize common vendor prefixes
|
695 |
$rule = preg_replace( '#(\-(o|ms|moz|webkit)\-)?(' . implode( '|', $this->vendorrule ) . ')#', "$3", $rule );
|
696 |
+
if ( 'parnt' == $template && 'background-image' == $rule && strstr( $value, 'url(' ) )
|
697 |
+
$value = $this->convert_rel_url( $value, $relpath );
|
698 |
+
$qsid = $this->update_arrays( $template, $query, $sel, $rule, $value, $important );
|
699 |
endforeach;
|
700 |
endforeach;
|
701 |
endforeach;
|
702 |
endforeach;
|
703 |
+
// if this is a raw css update pass the last selector back to the browser to update the form
|
704 |
+
if ( $this->ctc()->cache_updates && $qsid ):
|
705 |
+
$this->ctc()->updates[] = array(
|
706 |
+
'obj' => 'qsid',
|
707 |
+
'key' => $qsid,
|
708 |
+
'data' => $this->obj_to_utf8( $this->denorm_sel_val( $qsid ) ),
|
709 |
+
);
|
710 |
+
endif;
|
711 |
+
}
|
712 |
+
// converts relative path to absolute path for preview
|
713 |
+
function convert_rel_url( $value, $relpath ) {
|
714 |
+
$source = $this->get_prop( 'parnt' );
|
715 |
+
$path = preg_replace( '%url\([\'" ]*(.+?)[\'" ]*\)%', "$1", $value );
|
716 |
+
if ( preg_match( '%https?://%', $path ) ) return $value;
|
717 |
+
$pathparts = explode( '/', $path );
|
718 |
+
$fileparts = explode( '/', $relpath );
|
719 |
+
$newparts = array();
|
720 |
+
$themeuri = get_theme_root_uri();
|
721 |
+
while ( $pathpart = array_shift( $pathparts ) ):
|
722 |
+
if ( '..' == $pathpart )
|
723 |
+
array_pop( $fileparts );
|
724 |
+
else array_push( $newparts, $pathpart );
|
725 |
+
endwhile;
|
726 |
+
$newvalue = 'url(' . //trailingslashit( $themeuri ) . trailingslashit( $source ) .
|
727 |
+
( $fileparts ? trailingslashit( implode( '/', $fileparts ) ) : '' ) . implode( '/', $newparts ) . ')';
|
728 |
+
$this->ctc()->debug( 'converted ' . $value . ' to ' . $newvalue . ' with ' . $relpath, __FUNCTION__ );
|
729 |
+
return $newvalue;
|
730 |
}
|
731 |
|
732 |
/*
|
1128 |
foreach ( $this->val_ndx as $selid => $rules ):
|
1129 |
if ( !isset( $rules[ $ruleid ] ) ) continue;
|
1130 |
foreach ( $rules[ $ruleid ] as $theme => $val ):
|
1131 |
+
// skip important flag and invalid values
|
1132 |
+
if ( strstr( $theme, 'i_' ) || !isset( $val_arr[ $val ] ) || '' === $val_arr[ $val ] ) continue;
|
1133 |
$rule_sel_arr[ $val ] = $val_arr[ $val ];
|
1134 |
endforeach;
|
1135 |
endforeach;
|
1213 |
$sel_ndx_norm[ $queryarr[ $queryid ] ][ $selarr[ $selid ] ] = $qsid;
|
1214 |
endforeach;
|
1215 |
endforeach;
|
1216 |
+
return empty( $query ) ? array_keys( $sel_ndx_norm ) : $sel_ndx_norm[ $query ];
|
1217 |
}
|
1218 |
|
1219 |
/*
|
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.
|
9 |
Author: Lilaea Media
|
10 |
Author URI: http://www.lilaeamedia.com/
|
11 |
Text Domain: chld_thm_cfg
|
@@ -25,7 +25,7 @@ class ChildThemeConfiguratorUI {
|
|
25 |
$themes = $this->ctc()->themes;
|
26 |
$child = $css->get_prop( 'child' );
|
27 |
$hidechild = ( count( $themes[ 'child' ] ) ? '' : 'style="display:none"' );
|
28 |
-
$enqueueset = isset( $css->enqueue );
|
29 |
$mustimport = $this->parent_stylesheet_check();
|
30 |
$imports = $css->get_prop( 'imports' );
|
31 |
$id = 0;
|
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.7.0
|
9 |
Author: Lilaea Media
|
10 |
Author URI: http://www.lilaeamedia.com/
|
11 |
Text Domain: chld_thm_cfg
|
25 |
$themes = $this->ctc()->themes;
|
26 |
$child = $css->get_prop( 'child' );
|
27 |
$hidechild = ( count( $themes[ 'child' ] ) ? '' : 'style="display:none"' );
|
28 |
+
$enqueueset = ( isset( $css->enqueue ) && $child );
|
29 |
$mustimport = $this->parent_stylesheet_check();
|
30 |
$imports = $css->get_prop( 'imports' );
|
31 |
$id = 0;
|
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.
|
10 |
Author: Lilaea Media
|
11 |
Author URI: http://www.lilaeamedia.com/
|
12 |
Text Domain: chld_thm_cfg
|
@@ -53,9 +53,13 @@ class ChildThemeConfiguratorAdmin {
|
|
53 |
'theme_parnt',
|
54 |
'child_type',
|
55 |
'theme_child',
|
56 |
-
'child_name',
|
57 |
'child_template',
|
|
|
|
|
58 |
'child_author',
|
|
|
|
|
|
|
59 |
'child_version',
|
60 |
'configtype', // backward compatability
|
61 |
'revert',
|
@@ -98,13 +102,13 @@ class ChildThemeConfiguratorAdmin {
|
|
98 |
$bytes_free = $this->get_free_memory();
|
99 |
$this->sel_limit = ( int ) ( $bytes_free / CHLD_THM_CFG_BPSEL );
|
100 |
$this->debug( 'Free memory: ' . $bytes_free . ' max selectors: ' . $this->sel_limit, __FUNCTION__ );
|
101 |
-
|
102 |
}
|
103 |
function render() {
|
104 |
$this->ui->render();
|
105 |
}
|
106 |
function enqueue_scripts() {
|
107 |
-
wp_enqueue_style( 'chld-thm-cfg-admin', CHLD_THM_CFG_URL . 'css/chld-thm-cfg.css', array(), '1.
|
108 |
|
109 |
// we need to use local jQuery UI Widget/Menu/Selectmenu 1.11.2 because selectmenu is not included in < 1.11.2
|
110 |
// this will be updated in a later release to use WP Core scripts when it is widely adopted
|
@@ -118,6 +122,7 @@ class ChildThemeConfiguratorAdmin {
|
|
118 |
'jquery-ui-autocomplete',
|
119 |
'jquery-ui-selectmenu',
|
120 |
'wp-color-picker',
|
|
|
121 |
), FALSE, TRUE );
|
122 |
$localize_array = apply_filters( 'chld_thm_cfg_localize_script', array(
|
123 |
'ssl' => is_ssl(),
|
@@ -135,26 +140,16 @@ class ChildThemeConfiguratorAdmin {
|
|
135 |
'addl_css' => $this->css->get_prop( 'addl_css' ),
|
136 |
'imports' => $this->css->get_prop( 'imports' ),
|
137 |
'is_debug' => $this->is_debug,
|
138 |
-
|
139 |
-
'
|
140 |
-
'
|
141 |
-
'
|
142 |
-
'
|
143 |
-
'
|
144 |
-
'
|
145 |
-
'field_labels' => array(
|
146 |
-
'_background_url' => __( 'URL/None', 'chld_thm_cfg' ),
|
147 |
-
'_background_origin' => __( 'Origin', 'chld_thm_cfg' ),
|
148 |
-
'_background_color1' => __( 'Color 1', 'chld_thm_cfg' ),
|
149 |
-
'_background_color2' => __( 'Color 2', 'chld_thm_cfg' ),
|
150 |
-
'_border_width' => __( 'Width/None', 'chld_thm_cfg' ),
|
151 |
-
'_border_style' => __( 'Style', 'chld_thm_cfg' ),
|
152 |
-
'_border_color' => __( 'Color', 'chld_thm_cfg' ),
|
153 |
-
),
|
154 |
'swatch_txt' => $this->swatch_text,
|
155 |
'load_txt' => __( 'Are you sure? This will replace your current settings.', 'chld_thm_cfg' ),
|
156 |
-
'
|
157 |
-
'important_label' => __( '<span style="font-size:10px">!</span>', 'chld_thm_cfg' ),
|
158 |
'selector_txt' => __( 'Selectors', 'chld_thm_cfg' ),
|
159 |
'close_txt' => __( 'Close', 'chld_thm_cfg' ),
|
160 |
'edit_txt' => __( 'Edit', 'chld_thm_cfg' ),
|
@@ -212,17 +207,25 @@ class ChildThemeConfiguratorAdmin {
|
|
212 |
$this->themes = array( 'child' => array(), 'parnt' => array() );
|
213 |
foreach ( wp_get_themes() as $theme ):
|
214 |
// organize into parent and child themes
|
215 |
-
$group
|
216 |
// get the theme slug
|
217 |
-
$slug
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
226 |
endforeach;
|
227 |
}
|
228 |
|
@@ -268,14 +271,23 @@ class ChildThemeConfiguratorAdmin {
|
|
268 |
$this->debug( 'Max selectors exceeded.', __FUNCTION__ );
|
269 |
//$this->errors[] = __( 'Maximum number of styles exceeded.', 'chld_thm_cfg' );
|
270 |
add_filter( 'chld_thm_cfg_update_msg', array( $this, 'max_styles_notice' ), 20 );
|
271 |
-
// check if file ownership is messed up from old version or other plugin
|
272 |
endif;
|
273 |
-
if
|
|
|
|
|
274 |
add_action( 'admin_notices', array( $this, 'owner_notice' ) );
|
275 |
endif;
|
276 |
endif;
|
|
|
277 |
}
|
278 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
279 |
/**
|
280 |
* ajax callback for saving form data
|
281 |
*/
|
@@ -285,28 +297,31 @@ class ChildThemeConfiguratorAdmin {
|
|
285 |
if ( $this->validate_post( $action ) ):
|
286 |
if ( 'ctc_plugin' == $action ) do_action( 'chld_thm_cfg_pluginmode' );
|
287 |
$this->verify_creds(); // initialize filesystem access
|
288 |
-
|
289 |
-
$this->load_config()
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
306 |
endif;
|
307 |
-
|
308 |
-
// update config data in options API
|
309 |
-
$this->css->save_config();
|
310 |
endif;
|
311 |
$result = $this->css->obj_to_utf8( $this->updates );
|
312 |
// send all updates back to browser to update cache
|
@@ -331,12 +346,12 @@ class ChildThemeConfiguratorAdmin {
|
|
331 |
endforeach;
|
332 |
if ( !empty( $param[ 'obj' ] ) ):
|
333 |
// add any additional updates to pass back to browser
|
334 |
-
do_action( 'chld_thm_cfg_cache_updates' );
|
335 |
$this->updates[] = array(
|
336 |
'key' => isset( $param[ 'key' ] ) ? $param[ 'key' ] : '',
|
337 |
'obj' => $param[ 'obj' ],
|
338 |
'data' => $this->css->get_prop( $param[ 'obj' ], $param ),
|
339 |
);
|
|
|
340 |
die( json_encode( $this->updates ) );
|
341 |
endif;
|
342 |
endif;
|
@@ -493,10 +508,7 @@ class ChildThemeConfiguratorAdmin {
|
|
493 |
$debug = '';
|
494 |
if ( $_POST[ 'ctc_is_debug' ] ):
|
495 |
$this->is_debug = 1;
|
496 |
-
|
497 |
-
$this->print_debug();
|
498 |
-
$debug = ob_get_contents();
|
499 |
-
ob_end_clean();
|
500 |
else:
|
501 |
$this->is_debug = 0;
|
502 |
endif;
|
@@ -518,7 +530,7 @@ class ChildThemeConfiguratorAdmin {
|
|
518 |
$varparts = explode( '_', $configfield );
|
519 |
$varname = end( $varparts );
|
520 |
${$varname} = empty( $_POST[ 'ctc_' . $configfield ] ) ? '' :
|
521 |
-
sanitize_text_field( $_POST[ 'ctc_' . $configfield ] );
|
522 |
$this->debug( 'Extracting var ' . $varname . ' from ctc_' . $configfield . ' value: ' . ${$varname} , __FUNCTION__ );
|
523 |
endforeach;
|
524 |
|
@@ -587,6 +599,10 @@ class ChildThemeConfiguratorAdmin {
|
|
587 |
$this->css->set_prop( 'child', $child );
|
588 |
$this->css->set_prop( 'child_name', $name );
|
589 |
$this->css->set_prop( 'child_author', $author );
|
|
|
|
|
|
|
|
|
590 |
$this->css->set_prop( 'child_version', strlen( $version ) ? $version : '1.0' );
|
591 |
|
592 |
if ( isset( $_POST[ 'ctc_parent_enqueue' ] ) )
|
@@ -747,7 +763,11 @@ if ( !defined( 'ABSPATH' ) ) exit;
|
|
747 |
}
|
748 |
|
749 |
function enqueue_parent_code(){
|
750 |
-
|
|
|
|
|
|
|
|
|
751 |
|
752 |
if ( !function_exists( 'chld_thm_cfg_parent_css' ) ):
|
753 |
function chld_thm_cfg_parent_css() {
|
@@ -755,12 +775,23 @@ if ( !function_exists( 'chld_thm_cfg_parent_css' ) ):
|
|
755 |
}
|
756 |
endif;
|
757 |
add_action( 'wp_enqueue_scripts', 'chld_thm_cfg_parent_css' );
|
758 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
759 |
}
|
760 |
|
761 |
function enqueue_parent_css( $obj ) {
|
762 |
$marker = 'ENQUEUE PARENT ACTION';
|
763 |
-
$insertion =
|
764 |
if ( $filename = $this->css->is_file_ok( $this->css->get_child_target( 'functions.php' ), 'write' ) ):
|
765 |
$this->insert_with_markers( $filename, $marker, $insertion );
|
766 |
endif;
|
@@ -843,7 +874,7 @@ add_action( 'wp_enqueue_scripts', 'chld_thm_cfg_parent_css' );
|
|
843 |
// verify there is no PHP close tag at end of file
|
844 |
if ( ! $phpopen ):
|
845 |
$this->debug( 'PHP not open', __FUNCTION__ );
|
846 |
-
$this->errors[] = 'A closing PHP tag was detected in Child theme functions file so "Parent Stylesheet Handling" option was not configured. Closing PHP at the end of the file is discouraged as it can cause premature HTTP headers. Please edit <code>functions.php</code>
|
847 |
return FALSE;
|
848 |
//$newfile .= '<?php' . LF;
|
849 |
endif;
|
@@ -915,7 +946,7 @@ add_action( 'wp_enqueue_scripts', 'chld_thm_cfg_parent_css' );
|
|
915 |
&& $child_file // sanity check
|
916 |
&& $this->verify_child_dir( $child_dir ) //create child subdir if necessary
|
917 |
&& $wp_filesystem->copy( $parent_file, $this->fspath( $child_file ), FS_CHMOD_FILE ) ) return TRUE;
|
918 |
-
$this->errors[] = __( 'Could not copy file.
|
919 |
}
|
920 |
|
921 |
function delete_child_file( $file, $ext = 'php' ) {
|
@@ -1084,9 +1115,11 @@ add_action( 'wp_enqueue_scripts', 'chld_thm_cfg_parent_css' );
|
|
1084 |
add_action( 'admin_notices', array( $this, 'writable_notice' ) );
|
1085 |
endif;
|
1086 |
}
|
|
|
1087 |
function set_skip_form() {
|
1088 |
$this->skip_form = TRUE;
|
1089 |
}
|
|
|
1090 |
function handle_file_upload( $field, $childdir = NULL, $mimes = NULL ){
|
1091 |
$uploadedfile = $_FILES[ $field ];
|
1092 |
$upload_overrides = array(
|
@@ -1220,6 +1253,7 @@ add_action( 'wp_enqueue_scripts', 'chld_thm_cfg_parent_css' );
|
|
1220 |
</div>
|
1221 |
<?php
|
1222 |
}
|
|
|
1223 |
function owner_notice() {
|
1224 |
$ctcpage = apply_filters( 'chld_thm_cfg_admin_page', CHLD_THM_CFG_MENU );
|
1225 |
?>
|
@@ -1284,6 +1318,7 @@ add_action( 'wp_enqueue_scripts', 'chld_thm_cfg_parent_css' );
|
|
1284 |
endif;
|
1285 |
endif;
|
1286 |
}
|
|
|
1287 |
// backwards compatability < WP 3.9
|
1288 |
function normalize_path( $path ) {
|
1289 |
$path = str_replace( '\\', '/', $path );
|
@@ -1339,6 +1374,7 @@ add_action( 'wp_enqueue_scripts', 'chld_thm_cfg_parent_css' );
|
|
1339 |
function debug( $msg = NULL, $fn = NULL) {
|
1340 |
$this->debug .= ( isset( $fn ) ? $fn . ': ' : '' ) . ( isset( $msg ) ? $msg . LF : '' );
|
1341 |
}
|
|
|
1342 |
function set_benchmark( $step, $key, $label ) {
|
1343 |
$this->memory[ $key ][ $label ][ $step ][ 'memory' ] = memory_get_usage();
|
1344 |
$this->memory[ $key ][ $label ][ $step ][ 'peak' ] = memory_get_peak_usage();
|
@@ -1372,8 +1408,10 @@ add_action( 'wp_enqueue_scripts', 'chld_thm_cfg_parent_css' );
|
|
1372 |
return $limit - $used;
|
1373 |
}
|
1374 |
|
1375 |
-
function print_debug() {
|
1376 |
-
|
|
|
|
|
1377 |
}
|
1378 |
|
1379 |
}
|
6 |
Class: Child_Theme_Configurator
|
7 |
Plugin URI: http://www.lilaeamedia.com/plugins/child-theme-configurator/
|
8 |
Description: Main Controller Class
|
9 |
+
Version: 1.7.0
|
10 |
Author: Lilaea Media
|
11 |
Author URI: http://www.lilaeamedia.com/
|
12 |
Text Domain: chld_thm_cfg
|
53 |
'theme_parnt',
|
54 |
'child_type',
|
55 |
'theme_child',
|
|
|
56 |
'child_template',
|
57 |
+
'child_name',
|
58 |
+
'child_themeuri',
|
59 |
'child_author',
|
60 |
+
'child_authoruri',
|
61 |
+
'child_descr',
|
62 |
+
'child_tags',
|
63 |
'child_version',
|
64 |
'configtype', // backward compatability
|
65 |
'revert',
|
102 |
$bytes_free = $this->get_free_memory();
|
103 |
$this->sel_limit = ( int ) ( $bytes_free / CHLD_THM_CFG_BPSEL );
|
104 |
$this->debug( 'Free memory: ' . $bytes_free . ' max selectors: ' . $this->sel_limit, __FUNCTION__ );
|
105 |
+
//$this->set_benchmark( 'before', 'execute', 'program' );
|
106 |
}
|
107 |
function render() {
|
108 |
$this->ui->render();
|
109 |
}
|
110 |
function enqueue_scripts() {
|
111 |
+
wp_enqueue_style( 'chld-thm-cfg-admin', CHLD_THM_CFG_URL . 'css/chld-thm-cfg.css', array(), '1.7.0' );
|
112 |
|
113 |
// we need to use local jQuery UI Widget/Menu/Selectmenu 1.11.2 because selectmenu is not included in < 1.11.2
|
114 |
// this will be updated in a later release to use WP Core scripts when it is widely adopted
|
122 |
'jquery-ui-autocomplete',
|
123 |
'jquery-ui-selectmenu',
|
124 |
'wp-color-picker',
|
125 |
+
'ctc-thm-cfg-ctcgrad'
|
126 |
), FALSE, TRUE );
|
127 |
$localize_array = apply_filters( 'chld_thm_cfg_localize_script', array(
|
128 |
'ssl' => is_ssl(),
|
140 |
'addl_css' => $this->css->get_prop( 'addl_css' ),
|
141 |
'imports' => $this->css->get_prop( 'imports' ),
|
142 |
'is_debug' => $this->is_debug,
|
143 |
+
'_background_url_txt' => __( 'URL/None', 'chld_thm_cfg' ),
|
144 |
+
'_background_origin_txt' => __( 'Origin', 'chld_thm_cfg' ),
|
145 |
+
'_background_color1_txt' => __( 'Color 1', 'chld_thm_cfg' ),
|
146 |
+
'_background_color2_txt' => __( 'Color 2', 'chld_thm_cfg' ),
|
147 |
+
'_border_width_txt' => __( 'Width/None', 'chld_thm_cfg' ),
|
148 |
+
'_border_style_txt' => __( 'Style', 'chld_thm_cfg' ),
|
149 |
+
'_border_color_txt' => __( 'Color', 'chld_thm_cfg' ),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
'swatch_txt' => $this->swatch_text,
|
151 |
'load_txt' => __( 'Are you sure? This will replace your current settings.', 'chld_thm_cfg' ),
|
152 |
+
'important_txt' => __( '<span style="font-size:10px">!</span>', 'chld_thm_cfg' ),
|
|
|
153 |
'selector_txt' => __( 'Selectors', 'chld_thm_cfg' ),
|
154 |
'close_txt' => __( 'Close', 'chld_thm_cfg' ),
|
155 |
'edit_txt' => __( 'Edit', 'chld_thm_cfg' ),
|
207 |
$this->themes = array( 'child' => array(), 'parnt' => array() );
|
208 |
foreach ( wp_get_themes() as $theme ):
|
209 |
// organize into parent and child themes
|
210 |
+
$group = $theme->parent() ? 'child' : 'parnt';
|
211 |
// get the theme slug
|
212 |
+
$slug = $theme->get_stylesheet();
|
213 |
+
// get the theme slug
|
214 |
+
$version = $theme->get( 'Version' );
|
215 |
+
// strip auto-generated timestamp from CTC child theme version
|
216 |
+
if ( 'child' == $group ) $version = preg_replace("/\.\d{6}\d+$/", '', $version );
|
217 |
+
// add theme to themes array
|
218 |
+
$this->themes[ $group ][ $slug ] = array(
|
219 |
+
'Name' => $theme->get( 'Name' ),
|
220 |
+
'ThemeURI' => $theme->get( 'ThemeURI' ),
|
221 |
+
'Author' => $theme->get( 'Author' ),
|
222 |
+
'AuthorURI' => $theme->get( 'AuthorURI' ),
|
223 |
+
'Descr' => $theme->get( 'Description' ),
|
224 |
+
'Tags' => $theme->get( 'Tags' ),
|
225 |
+
'Version' => $version,
|
226 |
+
'screenshot' => $theme->get_screenshot(),
|
227 |
+
'allowed' => $theme->is_allowed(),
|
228 |
+
);
|
229 |
endforeach;
|
230 |
}
|
231 |
|
271 |
$this->debug( 'Max selectors exceeded.', __FUNCTION__ );
|
272 |
//$this->errors[] = __( 'Maximum number of styles exceeded.', 'chld_thm_cfg' );
|
273 |
add_filter( 'chld_thm_cfg_update_msg', array( $this, 'max_styles_notice' ), 20 );
|
|
|
274 |
endif;
|
275 |
+
// check if file ownership is messed up from old version or other plugin
|
276 |
+
// by comparing owner of plugin to owner of child theme:
|
277 |
+
if ( fileowner( $this->css->get_child_target( '' ) ) != fileowner( CHLD_THM_CFG_DIR ) ):
|
278 |
add_action( 'admin_notices', array( $this, 'owner_notice' ) );
|
279 |
endif;
|
280 |
endif;
|
281 |
+
return $is_rebuild;
|
282 |
}
|
283 |
|
284 |
+
function cache_debug() {
|
285 |
+
$this->updates[] = array(
|
286 |
+
'obj' => 'debug',
|
287 |
+
'key' => '',
|
288 |
+
'data' => $this->print_debug( TRUE ),
|
289 |
+
);
|
290 |
+
}
|
291 |
/**
|
292 |
* ajax callback for saving form data
|
293 |
*/
|
297 |
if ( $this->validate_post( $action ) ):
|
298 |
if ( 'ctc_plugin' == $action ) do_action( 'chld_thm_cfg_pluginmode' );
|
299 |
$this->verify_creds(); // initialize filesystem access
|
300 |
+
// get configuration data from options API
|
301 |
+
if ( FALSE !== $this->load_config() ): // sanity check: only update if config data exists
|
302 |
+
if ( isset( $_POST[ 'ctc_is_debug' ] ) ):
|
303 |
+
// toggle debug
|
304 |
+
$this->toggle_debug();
|
305 |
+
else:
|
306 |
+
$this->css->parse_post_data(); // parse any passed values
|
307 |
+
// if child theme config has been set up, save new data
|
308 |
+
// return recent edits and selected stylesheets as cache updates
|
309 |
+
if ( $this->css->get_prop( 'child' ) ):
|
310 |
+
$this->css->write_css();
|
311 |
+
// add any additional updates to pass back to browser
|
312 |
+
do_action( 'chld_thm_cfg_cache_updates' );
|
313 |
+
/*
|
314 |
+
$this->updates[] = array(
|
315 |
+
'obj' => 'addl_css',
|
316 |
+
'key' => '',
|
317 |
+
'data' => $this->css->get_prop( 'addl_css' ),
|
318 |
+
);
|
319 |
+
*/
|
320 |
+
endif;
|
321 |
+
|
322 |
+
// update config data in options API
|
323 |
+
$this->css->save_config();
|
324 |
endif;
|
|
|
|
|
|
|
325 |
endif;
|
326 |
$result = $this->css->obj_to_utf8( $this->updates );
|
327 |
// send all updates back to browser to update cache
|
346 |
endforeach;
|
347 |
if ( !empty( $param[ 'obj' ] ) ):
|
348 |
// add any additional updates to pass back to browser
|
|
|
349 |
$this->updates[] = array(
|
350 |
'key' => isset( $param[ 'key' ] ) ? $param[ 'key' ] : '',
|
351 |
'obj' => $param[ 'obj' ],
|
352 |
'data' => $this->css->get_prop( $param[ 'obj' ], $param ),
|
353 |
);
|
354 |
+
do_action( 'chld_thm_cfg_cache_updates' );
|
355 |
die( json_encode( $this->updates ) );
|
356 |
endif;
|
357 |
endif;
|
508 |
$debug = '';
|
509 |
if ( $_POST[ 'ctc_is_debug' ] ):
|
510 |
$this->is_debug = 1;
|
511 |
+
$debug = $this->print_debug( TRUE );
|
|
|
|
|
|
|
512 |
else:
|
513 |
$this->is_debug = 0;
|
514 |
endif;
|
530 |
$varparts = explode( '_', $configfield );
|
531 |
$varname = end( $varparts );
|
532 |
${$varname} = empty( $_POST[ 'ctc_' . $configfield ] ) ? '' :
|
533 |
+
preg_replace( "/\s+/s", ' ', sanitize_text_field( $_POST[ 'ctc_' . $configfield ] ) );
|
534 |
$this->debug( 'Extracting var ' . $varname . ' from ctc_' . $configfield . ' value: ' . ${$varname} , __FUNCTION__ );
|
535 |
endforeach;
|
536 |
|
599 |
$this->css->set_prop( 'child', $child );
|
600 |
$this->css->set_prop( 'child_name', $name );
|
601 |
$this->css->set_prop( 'child_author', $author );
|
602 |
+
$this->css->set_prop( 'child_themeuri', $themeuri );
|
603 |
+
$this->css->set_prop( 'child_authoruri', $authoruri );
|
604 |
+
$this->css->set_prop( 'child_descr', $descr );
|
605 |
+
$this->css->set_prop( 'child_tags', $tags );
|
606 |
$this->css->set_prop( 'child_version', strlen( $version ) ? $version : '1.0' );
|
607 |
|
608 |
if ( isset( $_POST[ 'ctc_parent_enqueue' ] ) )
|
763 |
}
|
764 |
|
765 |
function enqueue_parent_code(){
|
766 |
+
if ( 'none' == $this->css->enqueue || 'import' == $this->css->enqueue ) return array();
|
767 |
+
$code = "// AUTO GENERATED - Do not modify or remove comment markers above or below:
|
768 |
+
";
|
769 |
+
if ( 'enqueue' == $this->css->enqueue ):
|
770 |
+
$code .= "
|
771 |
|
772 |
if ( !function_exists( 'chld_thm_cfg_parent_css' ) ):
|
773 |
function chld_thm_cfg_parent_css() {
|
775 |
}
|
776 |
endif;
|
777 |
add_action( 'wp_enqueue_scripts', 'chld_thm_cfg_parent_css' );
|
778 |
+
";
|
779 |
+
elseif ( 'child' == $this->css->enqueue ):
|
780 |
+
$code .= "
|
781 |
+
if ( !function_exists( 'chld_thm_cfg_child_css' ) ):
|
782 |
+
function chld_thm_cfg_child_css() {
|
783 |
+
wp_enqueue_style( 'chld_thm_cfg_child', get_stylesheet_uri() );
|
784 |
+
}
|
785 |
+
endif;
|
786 |
+
add_action( 'wp_enqueue_scripts', 'chld_thm_cfg_child_css', 999 );
|
787 |
+
";
|
788 |
+
endif;
|
789 |
+
return explode( "\n", $code );
|
790 |
}
|
791 |
|
792 |
function enqueue_parent_css( $obj ) {
|
793 |
$marker = 'ENQUEUE PARENT ACTION';
|
794 |
+
$insertion = $this->enqueue_parent_code();
|
795 |
if ( $filename = $this->css->is_file_ok( $this->css->get_child_target( 'functions.php' ), 'write' ) ):
|
796 |
$this->insert_with_markers( $filename, $marker, $insertion );
|
797 |
endif;
|
874 |
// verify there is no PHP close tag at end of file
|
875 |
if ( ! $phpopen ):
|
876 |
$this->debug( 'PHP not open', __FUNCTION__ );
|
877 |
+
$this->errors[] = __( 'A closing PHP tag was detected in Child theme functions file so "Parent Stylesheet Handling" option was not configured. Closing PHP at the end of the file is discouraged as it can cause premature HTTP headers. Please edit <code>functions.php</code> to remove the final <code>?></code> tag and click "Generate/Rebuild Child Theme Files" again.', 'chld_thm_cfg' );
|
878 |
return FALSE;
|
879 |
//$newfile .= '<?php' . LF;
|
880 |
endif;
|
946 |
&& $child_file // sanity check
|
947 |
&& $this->verify_child_dir( $child_dir ) //create child subdir if necessary
|
948 |
&& $wp_filesystem->copy( $parent_file, $this->fspath( $child_file ), FS_CHMOD_FILE ) ) return TRUE;
|
949 |
+
$this->errors[] = __( 'Could not copy file:' . $parent_file, 'chld_thm_cfg' );
|
950 |
}
|
951 |
|
952 |
function delete_child_file( $file, $ext = 'php' ) {
|
1115 |
add_action( 'admin_notices', array( $this, 'writable_notice' ) );
|
1116 |
endif;
|
1117 |
}
|
1118 |
+
|
1119 |
function set_skip_form() {
|
1120 |
$this->skip_form = TRUE;
|
1121 |
}
|
1122 |
+
|
1123 |
function handle_file_upload( $field, $childdir = NULL, $mimes = NULL ){
|
1124 |
$uploadedfile = $_FILES[ $field ];
|
1125 |
$upload_overrides = array(
|
1253 |
</div>
|
1254 |
<?php
|
1255 |
}
|
1256 |
+
|
1257 |
function owner_notice() {
|
1258 |
$ctcpage = apply_filters( 'chld_thm_cfg_admin_page', CHLD_THM_CFG_MENU );
|
1259 |
?>
|
1318 |
endif;
|
1319 |
endif;
|
1320 |
}
|
1321 |
+
|
1322 |
// backwards compatability < WP 3.9
|
1323 |
function normalize_path( $path ) {
|
1324 |
$path = str_replace( '\\', '/', $path );
|
1374 |
function debug( $msg = NULL, $fn = NULL) {
|
1375 |
$this->debug .= ( isset( $fn ) ? $fn . ': ' : '' ) . ( isset( $msg ) ? $msg . LF : '' );
|
1376 |
}
|
1377 |
+
|
1378 |
function set_benchmark( $step, $key, $label ) {
|
1379 |
$this->memory[ $key ][ $label ][ $step ][ 'memory' ] = memory_get_usage();
|
1380 |
$this->memory[ $key ][ $label ][ $step ][ 'peak' ] = memory_get_peak_usage();
|
1408 |
return $limit - $used;
|
1409 |
}
|
1410 |
|
1411 |
+
function print_debug( $noecho = FALSE ) {
|
1412 |
+
$debug = '<textarea style="width:100%;height:200px">' . LF . $this->debug . LF . '</textarea>' . LF;
|
1413 |
+
if ( $noecho ) return $debug;
|
1414 |
+
echo $debug;
|
1415 |
}
|
1416 |
|
1417 |
}
|
includes/forms/addl_panels.php
CHANGED
@@ -21,7 +21,9 @@ if ( !defined( 'CHLD_THM_CFG_PLUGINS_VERSION' ) ):
|
|
21 |
<ul>
|
22 |
<li><h3><?php _e( 'Customize Plugin Stylesheets', 'chld_thm_cfg' ); ?></h3>
|
23 |
<p><?php _e( 'Apply the power of CTC\'s top-rated interface to your site\'s plugin styles. All new design makes it much easier to get the results you want.', 'chld_thm_cfg' ); ?></p></li>
|
24 |
-
<li><h3><?php _e( '
|
|
|
|
|
25 |
<li><h3><?php _e( 'Most recent edits', 'chld_thm_cfg' ); ?></h3><p><?php _e( 'Return to recently edited selectors from a toggleable sidebar.', 'chld_thm_cfg' ); ?></p></li>
|
26 |
<li><h3><?php _e( 'Free Upgrades', 'chld_thm_cfg' ); ?></h3>
|
27 |
<p><?php _e( 'Your Update Key gives you access to new Pro features as soon as they are released.', 'chld_thm_cfg' ); ?></p></li>
|
@@ -30,6 +32,6 @@ if ( !defined( 'CHLD_THM_CFG_PLUGINS_VERSION' ) ):
|
|
30 |
<li><h3><?php _e( 'Tutorial Videos', 'chld_thm_cfg' ); ?></h3></li>
|
31 |
</ul>
|
32 |
<p><?php _e( 'For a limited time save over 15% off Child Theme Configurator Pro.', 'chld_thm_cfg' ); ?></p>
|
33 |
-
<h3><a target="_blank" href="<?php echo LILAEAMEDIA_URL; ?>/cart/?add-to-cart=1710" title="<?php _e( 'Upgrade Now', 'chld_thm_cfg' ); ?>"><?php _e( 'Buy Now - Only $
|
34 |
</div></div><?php
|
35 |
endif;
|
21 |
<ul>
|
22 |
<li><h3><?php _e( 'Customize Plugin Stylesheets', 'chld_thm_cfg' ); ?></h3>
|
23 |
<p><?php _e( 'Apply the power of CTC\'s top-rated interface to your site\'s plugin styles. All new design makes it much easier to get the results you want.', 'chld_thm_cfg' ); ?></p></li>
|
24 |
+
<li><h3><?php _e( 'Quick Preview', 'chld_thm_cfg' ); ?></h3><p><?php _e( 'Test your child theme with a single click.', 'chld_thm_cfg' ); ?></p></li>
|
25 |
+
<li><h3><?php _e( 'Find related styles', 'chld_thm_cfg' ); ?></h3><p><?php _e( 'Use the "All Styles" panel to edit groups of selectors from a single combined list.', 'chld_thm_cfg' ); ?></p></li>
|
26 |
+
<li><h3><?php _e( 'Find styles by Nav Menu', 'chld_thm_cfg' ); ?></h3><p><?php _e( 'Tweak menus quickly and easily.', 'chld_thm_cfg' ); ?></p></li>
|
27 |
<li><h3><?php _e( 'Most recent edits', 'chld_thm_cfg' ); ?></h3><p><?php _e( 'Return to recently edited selectors from a toggleable sidebar.', 'chld_thm_cfg' ); ?></p></li>
|
28 |
<li><h3><?php _e( 'Free Upgrades', 'chld_thm_cfg' ); ?></h3>
|
29 |
<p><?php _e( 'Your Update Key gives you access to new Pro features as soon as they are released.', 'chld_thm_cfg' ); ?></p></li>
|
32 |
<li><h3><?php _e( 'Tutorial Videos', 'chld_thm_cfg' ); ?></h3></li>
|
33 |
</ul>
|
34 |
<p><?php _e( 'For a limited time save over 15% off Child Theme Configurator Pro.', 'chld_thm_cfg' ); ?></p>
|
35 |
+
<h3><a target="_blank" href="<?php echo LILAEAMEDIA_URL; ?>/cart/?add-to-cart=1710" title="<?php _e( 'Upgrade Now', 'chld_thm_cfg' ); ?>"><?php _e( 'Buy Now - Only $14.95 USD*', 'chld_thm_cfg' ); ?></a></h3><small><?php _e( '*Prices subject to change.', 'chld_thm_cfg' ); ?></small></div>
|
36 |
</div></div><?php
|
37 |
endif;
|
includes/forms/addl_tabs.php
CHANGED
@@ -5,7 +5,7 @@ if ( !defined( 'CHLD_THM_CFG_PLUGINS_VERSION' ) ):
|
|
5 |
?>
|
6 |
<a id="get_pro" href="?page=<?php echo CHLD_THM_CFG_MENU; ?>&tab=get_pro"
|
7 |
class="nav-tab<?php echo 'get_pro' == $active_tab ? ' nav-tab-active' : ''; ?>" <?php echo $hidechild; ?>>
|
8 |
-
<?php _e( '
|
9 |
</a>
|
10 |
<?php
|
11 |
endif;
|
5 |
?>
|
6 |
<a id="get_pro" href="?page=<?php echo CHLD_THM_CFG_MENU; ?>&tab=get_pro"
|
7 |
class="nav-tab<?php echo 'get_pro' == $active_tab ? ' nav-tab-active' : ''; ?>" <?php echo $hidechild; ?>>
|
8 |
+
<?php _e( 'Upgrade Now', 'chld_thm_cfg_plugins' ); ?>
|
9 |
</a>
|
10 |
<?php
|
11 |
endif;
|
includes/forms/parent-child.php
CHANGED
@@ -21,9 +21,11 @@ if ( !defined( 'ABSPATH' ) ) exit;
|
|
21 |
</div>
|
22 |
</div>
|
23 |
<div class="ctc-input-row clearfix ctc-themeonly-container<?php echo $disabledclass; ?>" id="input_row_child">
|
24 |
-
<div class="ctc-input-cell"> <strong>
|
25 |
<?php _e( 'Child Theme', 'chld_thm_cfg' ); ?>
|
26 |
-
</strong>
|
|
|
|
|
27 |
<div class="ctc-input-cell">
|
28 |
<input class="ctc-radio ctc-themeonly" id="ctc_child_type_new" name="ctc_child_type" type="radio" value="new"
|
29 |
<?php echo ( !empty( $hidechild ) ? 'checked' : '' ); ?>
|
@@ -51,25 +53,49 @@ if ( !defined( 'ABSPATH' ) ) exit;
|
|
51 |
</div>
|
52 |
<?php endif; ?>
|
53 |
</div>
|
|
|
54 |
<div class="ctc-input-row clearfix ctc-themeonly-container<?php echo $disabledclass; ?>" id="input_row_child_name">
|
55 |
<div class="ctc-input-cell"> <strong>
|
56 |
<?php _e( 'Child Theme Name', 'chld_thm_cfg' ); ?>
|
57 |
</strong> </div>
|
58 |
-
|
59 |
<input class="ctc_text ctc-themeonly" id="ctc_child_name" name="ctc_child_name" type="text"
|
60 |
-
value="<?php echo esc_attr( $css->get_prop( 'child_name' ) ); ?>" placeholder="<?php _e( 'Theme Name', 'chld_thm_cfg' ); ?>" autocomplete="off" <?php echo $disabled; ?> />
|
61 |
-
|
62 |
-
|
63 |
-
|
|
|
|
|
|
|
|
|
|
|
64 |
<div class="ctc-input-cell"> <strong>
|
65 |
<?php _e( 'Author', 'chld_thm_cfg' ); ?>
|
66 |
</strong> </div>
|
67 |
-
<div class="ctc-input-cell">
|
68 |
<input class="ctc_text" id="ctc_child_author" name="ctc_child_author" type="text"
|
69 |
value="<?php echo esc_attr( $css->get_prop( 'author' ) ); ?>" placeholder="<?php _e( 'Author', 'chld_thm_cfg' ); ?>" autocomplete="off" />
|
70 |
-
</div>
|
71 |
-
|
72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
<div class="ctc-input-cell"> <strong>
|
74 |
<?php _e( 'Version', 'chld_thm_cfg' ); ?>
|
75 |
</strong> </div>
|
@@ -77,50 +103,71 @@ if ( !defined( 'ABSPATH' ) ) exit;
|
|
77 |
<input class="ctc_text" id="ctc_child_version" name="ctc_child_version" type="text"
|
78 |
value="<?php echo esc_attr( $css->get_prop( 'version' ) ); ?>" placeholder="<?php _e( 'Version', 'chld_thm_cfg' ); ?>" autocomplete="off" />
|
79 |
</div>
|
80 |
-
</div>
|
|
|
81 |
<div class="ctc-input-row clearfix ctc-themeonly-container<?php echo $disabledclass; ?>">
|
82 |
-
<div class="ctc-
|
83 |
-
<?php _e( '
|
84 |
-
|
85 |
-
<div class="ctc-input-cell">
|
86 |
-
<input class="ctc_checkbox ctc-themeonly" id="ctc_parent_mods" name="ctc_parent_mods" type="checkbox"
|
87 |
-
value="1" <?php echo $disabled; ?> />
|
88 |
-
</div>
|
89 |
-
<div class="ctc-input-cell"> <strong>
|
90 |
-
<?php _e( 'NOTE:', 'chld_thm_cfg' ); ?>
|
91 |
</strong>
|
92 |
-
<?php _e( '
|
93 |
</div>
|
94 |
-
|
95 |
-
|
96 |
-
<div class="ctc-input-row clearfix ctc-themeonly-container<?php echo $disabledclass; ?>">
|
97 |
-
<div class="ctc-input-cell"> <strong>
|
98 |
-
<?php _e( 'Parent stylesheet handling:', 'chld_thm_cfg' ); ?>
|
99 |
-
</strong> </div>
|
100 |
<div class="ctc-input-cell">
|
101 |
<label>
|
102 |
<input class="ctc_radio ctc-themeonly" id="ctc_parent_enqueue_enqueue" name="ctc_parent_enqueue" type="radio"
|
103 |
value="enqueue" <?php checked( 'enqueue', $parent_handling ); ?> <?php echo $disabled; ?> />
|
104 |
-
<?php _e( '
|
105 |
</label>
|
106 |
-
|
|
|
|
|
|
|
|
|
|
|
107 |
<label>
|
108 |
<input class="ctc_radio ctc-themeonly" id="ctc_parent_enqueue_import" name="ctc_parent_enqueue" type="radio"
|
109 |
value="import" <?php checked( 'import', $parent_handling ); ?> <?php echo $disabled; ?> />
|
110 |
-
<?php _e( '
|
111 |
</label>
|
112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
<label>
|
114 |
<input class="ctc_radio ctc-themeonly" id="ctc_parent_enqueue_none" name="ctc_parent_enqueue" type="radio"
|
115 |
value="none" <?php checked( 'none', $parent_handling ); ?> <?php echo $disabled; ?> />
|
116 |
-
<?php _e( '
|
117 |
</label>
|
118 |
</div>
|
|
|
|
|
|
|
|
|
|
|
119 |
<div class="ctc-input-cell"> <strong>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
<?php _e( 'NOTE:', 'chld_thm_cfg' ); ?>
|
121 |
-
<?php if ( $mustimport ) _e( 'This theme does not currently enqueue the stylesheet and must use the @import option to render correctly.', 'chld_thm_cfg' ); ?>
|
122 |
</strong>
|
123 |
-
<?php _e(
|
124 |
</div>
|
125 |
</div>
|
126 |
<?php if ( '' == $hidechild ): ?>
|
@@ -132,7 +179,7 @@ if ( !defined( 'ABSPATH' ) ) exit;
|
|
132 |
<input class="ctc_checkbox" id="ctc_backup" name="ctc_backup" type="checkbox"
|
133 |
value="1" />
|
134 |
</div>
|
135 |
-
<div class="ctc-input-cell"> <strong>
|
136 |
<?php _e( 'NOTE:', 'chld_thm_cfg' ); ?>
|
137 |
</strong>
|
138 |
<?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' ); ?>
|
@@ -140,7 +187,7 @@ if ( !defined( 'ABSPATH' ) ) exit;
|
|
140 |
</div>
|
141 |
<div class="ctc-input-row clearfix">
|
142 |
<div class="ctc-input-cell ctc-section-toggle" id="ctc_revert_css"> <strong>
|
143 |
-
<?php _e( 'Reset/Restore from backup
|
144 |
</strong> </div>
|
145 |
<div class="ctc-input-cell-wide ctc-section-toggle-content" id="ctc_revert_css_content">
|
146 |
<label>
|
@@ -172,10 +219,10 @@ if ( !defined( 'ABSPATH' ) ) exit;
|
|
172 |
$stylesheets = $this->ctc()->get_files( $this->ctc()->get_current_parent(), 'stylesheet' );
|
173 |
if ( count( $stylesheets ) ):?>
|
174 |
<div class="ctc-input-cell ctc-section-toggle" id="ctc_additional_css_files"> <strong>
|
175 |
-
<?php _e( 'Parse additional stylesheets
|
176 |
</strong> </div>
|
177 |
<div class="ctc-input-cell-wide ctc-section-toggle-content" id="ctc_additional_css_files_content">
|
178 |
-
<p style="margin-top:0">
|
179 |
<?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' ); ?>
|
180 |
</p>
|
181 |
<ul>
|
21 |
</div>
|
22 |
</div>
|
23 |
<div class="ctc-input-row clearfix ctc-themeonly-container<?php echo $disabledclass; ?>" id="input_row_child">
|
24 |
+
<div class="ctc-input-cell ctc-section-toggle" id="ctc_theme_attributes"> <strong>
|
25 |
<?php _e( 'Child Theme', 'chld_thm_cfg' ); ?>
|
26 |
+
</strong>
|
27 |
+
<?php _e( '(click to edit additional fields)', 'chld_thm_cfg' ); ?>
|
28 |
+
</div>
|
29 |
<div class="ctc-input-cell">
|
30 |
<input class="ctc-radio ctc-themeonly" id="ctc_child_type_new" name="ctc_child_type" type="radio" value="new"
|
31 |
<?php echo ( !empty( $hidechild ) ? 'checked' : '' ); ?>
|
53 |
</div>
|
54 |
<?php endif; ?>
|
55 |
</div>
|
56 |
+
<div class="ctc-section-toggle-content" id="ctc_theme_attributes_content">
|
57 |
<div class="ctc-input-row clearfix ctc-themeonly-container<?php echo $disabledclass; ?>" 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-wide">
|
62 |
<input class="ctc_text ctc-themeonly" 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" <?php echo $disabled; ?> /> </div></div>
|
64 |
+
<div class="ctc-input-row clearfix ctc-themeonly-container<?php echo $disabledclass; ?>" id="input_row_child_website">
|
65 |
+
<div class="ctc-input-cell"> <strong>
|
66 |
+
<?php _e( 'Theme Website', 'chld_thm_cfg' ); ?>
|
67 |
+
</strong> </div>
|
68 |
+
<div class="ctc-input-cell-wide">
|
69 |
+
<input class="ctc_text ctc-themeonly" id="ctc_child_themeuri" name="ctc_child_themeuri" type="text"
|
70 |
+
value="<?php echo esc_attr( $css->get_prop( 'themeuri' ) ); ?>" placeholder="<?php _e( 'Theme Website', 'chld_thm_cfg' ); ?>" autocomplete="off" <?php echo $disabled; ?> /> </div></div>
|
71 |
+
<div class="ctc-input-row clearfix ctc-themeonly-container<?php echo $disabledclass; ?>" id="input_row_child_author">
|
72 |
<div class="ctc-input-cell"> <strong>
|
73 |
<?php _e( 'Author', 'chld_thm_cfg' ); ?>
|
74 |
</strong> </div>
|
75 |
+
<div class="ctc-input-cell-wide">
|
76 |
<input class="ctc_text" id="ctc_child_author" name="ctc_child_author" type="text"
|
77 |
value="<?php echo esc_attr( $css->get_prop( 'author' ) ); ?>" placeholder="<?php _e( 'Author', 'chld_thm_cfg' ); ?>" autocomplete="off" />
|
78 |
+
</div></div>
|
79 |
+
<div class="ctc-input-row clearfix ctc-themeonly-container<?php echo $disabledclass; ?>" id="input_row_child_authorurl">
|
80 |
+
<div class="ctc-input-cell"> <strong>
|
81 |
+
<?php _e( 'Author Website', 'chld_thm_cfg' ); ?>
|
82 |
+
</strong> </div>
|
83 |
+
<div class="ctc-input-cell-wide">
|
84 |
+
<input class="ctc_text ctc-themeonly" id="ctc_child_authoruri" name="ctc_child_authoruri" type="text"
|
85 |
+
value="<?php echo esc_attr( $css->get_prop( 'authoruri' ) ); ?>" placeholder="<?php _e( 'Author Website', 'chld_thm_cfg' ); ?>" autocomplete="off" <?php echo $disabled; ?> /> </div></div>
|
86 |
+
<div class="ctc-input-row clearfix ctc-themeonly-container<?php echo $disabledclass; ?>" id="input_row_child_descr">
|
87 |
+
<div class="ctc-input-cell"> <strong>
|
88 |
+
<?php _e( 'Theme Description', 'chld_thm_cfg' ); ?>
|
89 |
+
</strong> </div>
|
90 |
+
<div class="ctc-input-cell-wide">
|
91 |
+
<textarea class="ctc_text ctc-themeonly" id="ctc_child_descr" name="ctc_child_descr" placeholder="<?php _e( 'Description', 'chld_thm_cfg' ); ?>" autocomplete="off" <?php echo $disabled; ?> ><?php echo esc_textarea( $css->get_prop( 'descr' ) ); ?></textarea> </div></div>
|
92 |
+
<div class="ctc-input-row clearfix ctc-themeonly-container<?php echo $disabledclass; ?>" id="input_row_child_tags">
|
93 |
+
<div class="ctc-input-cell"> <strong>
|
94 |
+
<?php _e( 'Theme Tags', 'chld_thm_cfg' ); ?>
|
95 |
+
</strong> </div>
|
96 |
+
<div class="ctc-input-cell-wide">
|
97 |
+
<textarea class="ctc_text ctc-themeonly" id="ctc_child_tags" name="ctc_child_tags" placeholder="<?php _e( 'Tags', 'chld_thm_cfg' ); ?>" autocomplete="off" <?php echo $disabled; ?> ><?php echo esc_textarea( $css->get_prop( 'tags' ) ); ?></textarea></div></div>
|
98 |
+
<div class="ctc-input-row clearfix ctc-themeonly-container<?php echo $disabledclass; ?>" id="input_row_child_version">
|
99 |
<div class="ctc-input-cell"> <strong>
|
100 |
<?php _e( 'Version', 'chld_thm_cfg' ); ?>
|
101 |
</strong> </div>
|
103 |
<input class="ctc_text" id="ctc_child_version" name="ctc_child_version" type="text"
|
104 |
value="<?php echo esc_attr( $css->get_prop( 'version' ) ); ?>" placeholder="<?php _e( 'Version', 'chld_thm_cfg' ); ?>" autocomplete="off" />
|
105 |
</div>
|
106 |
+
</div></div>
|
107 |
+
<?php $parent_handling = ( isset( $css->enqueue ) ? $css->enqueue : ( $mustimport ? 'import' : 'enqueue' ) ); ?>
|
108 |
<div class="ctc-input-row clearfix ctc-themeonly-container<?php echo $disabledclass; ?>">
|
109 |
+
<div class="ctc-section-toggle" id="ctc_stylesheet_handling"> <strong>
|
110 |
+
<?php _e( 'Stylesheet handling', 'chld_thm_cfg' );
|
111 |
+
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
</strong>
|
113 |
+
<?php _e( '(click to view options)', 'chld_thm_cfg' ); ?>
|
114 |
</div>
|
115 |
+
<div class="ctc-section-toggle-content" id="ctc_stylesheet_handling_content">
|
116 |
+
<div class="ctc-input-cell clear"> </div>
|
|
|
|
|
|
|
|
|
117 |
<div class="ctc-input-cell">
|
118 |
<label>
|
119 |
<input class="ctc_radio ctc-themeonly" id="ctc_parent_enqueue_enqueue" name="ctc_parent_enqueue" type="radio"
|
120 |
value="enqueue" <?php checked( 'enqueue', $parent_handling ); ?> <?php echo $disabled; ?> />
|
121 |
+
<?php _e( 'Enqueue parent stylesheet (default)', 'chld_thm_cfg' ); ?>
|
122 |
</label>
|
123 |
+
</strong> </div>
|
124 |
+
<div class="ctc-input-cell howto sep"><?php _e( "Select this option if the parent theme enqueues the stylesheet but has no special handling for child themes. Start with this option if unsure.", 'chld_thm_cfg' ); ?>
|
125 |
+
</div>
|
126 |
+
<div class="ctc-input-cell clear"><?php if ( $mustimport )
|
127 |
+
_e( '<strong>NOTE: This theme links the stylesheet in the header template and should use the @import option to render correctly.</strong>', 'chld_thm_cfg' ); ?> </div>
|
128 |
+
<div class="ctc-input-cell">
|
129 |
<label>
|
130 |
<input class="ctc_radio ctc-themeonly" id="ctc_parent_enqueue_import" name="ctc_parent_enqueue" type="radio"
|
131 |
value="import" <?php checked( 'import', $parent_handling ); ?> <?php echo $disabled; ?> />
|
132 |
+
<?php _e( '<code>@import</code> parent stylesheet', 'chld_thm_cfg' ); ?>
|
133 |
</label>
|
134 |
+
</strong> </div>
|
135 |
+
<div class="ctc-input-cell howto sep"><?php _e( "Select this option if the parent theme links the stylesheet in the header template. Using <code>@import</code> is discouraged but necessary in this case unless you modify the header template.", 'chld_thm_cfg' ); ?>
|
136 |
+
</div>
|
137 |
+
<div class="ctc-input-cell clear"> </div>
|
138 |
+
<div class="ctc-input-cell">
|
139 |
+
<label>
|
140 |
+
<input class="ctc_radio ctc-themeonly" id="ctc_parent_enqueue_both" name="ctc_parent_enqueue" type="radio"
|
141 |
+
value="both" <?php checked( 'child', $parent_handling ); ?> <?php echo $disabled; ?> />
|
142 |
+
<?php _e( 'Enqueue child stylesheet', 'chld_thm_cfg' ); ?>
|
143 |
+
</label>
|
144 |
+
</strong> </div>
|
145 |
+
<div class="ctc-input-cell howto sep"><?php _e( 'Select this option if the parent theme incorrectly loads the "template" stylesheet or does not load the "style.css" file at all. This is unusual but occurs in some themes.', 'chld_thm_cfg' ); ?>
|
146 |
+
</div>
|
147 |
+
<div class="ctc-input-cell clear"> </div>
|
148 |
+
<div class="ctc-input-cell">
|
149 |
<label>
|
150 |
<input class="ctc_radio ctc-themeonly" id="ctc_parent_enqueue_none" name="ctc_parent_enqueue" type="radio"
|
151 |
value="none" <?php checked( 'none', $parent_handling ); ?> <?php echo $disabled; ?> />
|
152 |
+
<?php _e( 'None (handled by theme)', 'chld_thm_cfg' ); ?>
|
153 |
</label>
|
154 |
</div>
|
155 |
+
<div class="ctc-input-cell howto">
|
156 |
+
<?php _e( 'Select this option if all stylesheets are automatically loaded for child themes (e.g., "Responsive" by CyberChimps).', 'chld_thm_cfg' ); ?>
|
157 |
+
</div>
|
158 |
+
</div></div>
|
159 |
+
<div class="ctc-input-row clearfix ctc-themeonly-container<?php echo $disabledclass; ?>">
|
160 |
<div class="ctc-input-cell"> <strong>
|
161 |
+
<?php _e( 'Copy Parent Theme Menus, Widgets and other Options', 'chld_thm_cfg' ); ?>
|
162 |
+
</strong> </div>
|
163 |
+
<div class="ctc-input-cell">
|
164 |
+
<input class="ctc_checkbox ctc-themeonly" id="ctc_parent_mods" name="ctc_parent_mods" type="checkbox"
|
165 |
+
value="1" <?php echo $disabled; ?> />
|
166 |
+
</div>
|
167 |
+
<div class="ctc-input-cell howto"> <strong>
|
168 |
<?php _e( 'NOTE:', 'chld_thm_cfg' ); ?>
|
|
|
169 |
</strong>
|
170 |
+
<?php _e( 'This will overwrite child theme options you may have already set.', 'chld_thm_cfg' ); ?>
|
171 |
</div>
|
172 |
</div>
|
173 |
<?php if ( '' == $hidechild ): ?>
|
179 |
<input class="ctc_checkbox" id="ctc_backup" name="ctc_backup" type="checkbox"
|
180 |
value="1" />
|
181 |
</div>
|
182 |
+
<div class="ctc-input-cell howto"> <strong>
|
183 |
<?php _e( 'NOTE:', 'chld_thm_cfg' ); ?>
|
184 |
</strong>
|
185 |
<?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' ); ?>
|
187 |
</div>
|
188 |
<div class="ctc-input-row clearfix">
|
189 |
<div class="ctc-input-cell ctc-section-toggle" id="ctc_revert_css"> <strong>
|
190 |
+
<?php _e( 'Reset/Restore from backup', 'chld_thm_cfg' ); ?>
|
191 |
</strong> </div>
|
192 |
<div class="ctc-input-cell-wide ctc-section-toggle-content" id="ctc_revert_css_content">
|
193 |
<label>
|
219 |
$stylesheets = $this->ctc()->get_files( $this->ctc()->get_current_parent(), 'stylesheet' );
|
220 |
if ( count( $stylesheets ) ):?>
|
221 |
<div class="ctc-input-cell ctc-section-toggle" id="ctc_additional_css_files"> <strong>
|
222 |
+
<?php _e( 'Parse additional stylesheets', 'chld_thm_cfg' ); ?>
|
223 |
</strong> </div>
|
224 |
<div class="ctc-input-cell-wide ctc-section-toggle-content" id="ctc_additional_css_files_content">
|
225 |
+
<p style="margin-top:0" class="howto">
|
226 |
<?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' ); ?>
|
227 |
</p>
|
228 |
<ul>
|
includes/forms/query-selector.php
CHANGED
@@ -27,7 +27,7 @@ if ( !defined( 'ABSPATH' ) ) exit;
|
|
27 |
<div class="ctc-input-cell">
|
28 |
<div class="ui-widget">
|
29 |
<input id="ctc_sel_ovrd_selector" />
|
30 |
-
<div id="
|
31 |
</div>
|
32 |
</div>
|
33 |
</div>
|
@@ -41,7 +41,7 @@ if ( !defined( 'ABSPATH' ) ) exit;
|
|
41 |
</div>
|
42 |
<div id="ctc_status_sel_val"></div>
|
43 |
<div class="ctc-input-cell ctc-button-cell" id="ctc_save_query_selector_cell">
|
44 |
-
<input type="
|
45 |
name="ctc_save_query_selector" value="<?php _e( 'Save Child Values', 'chld_thm_cfg' ); ?>" disabled />
|
46 |
<input type="hidden" id="ctc_sel_ovrd_qsid"
|
47 |
name="ctc_sel_ovrd_qsid" value="" />
|
@@ -87,7 +87,7 @@ if ( !defined( 'ABSPATH' ) ) exit;
|
|
87 |
<strong>
|
88 |
<?php _e( 'Raw CSS', 'chld_thm_cfg' ); ?>
|
89 |
</strong>
|
90 |
-
<p><?php _e( 'Use to enter shorthand CSS or new @media queries and selectors.', 'chld_thm_cfg' );?></p><p><?php _e( 'Values entered here are merged into existing child styles or added to the child stylesheet if they do not exist in the parent.', 'chld_thm_cfg' ); ?></p>
|
91 |
</div>
|
92 |
<div class="ctc-input-cell-wide">
|
93 |
<textarea id="ctc_new_selectors" name="ctc_new_selectors" wrap="off"></textarea>
|
27 |
<div class="ctc-input-cell">
|
28 |
<div class="ui-widget">
|
29 |
<input id="ctc_sel_ovrd_selector" />
|
30 |
+
<div id="ctc_status_qsid" style="float:right"></div>
|
31 |
</div>
|
32 |
</div>
|
33 |
</div>
|
41 |
</div>
|
42 |
<div id="ctc_status_sel_val"></div>
|
43 |
<div class="ctc-input-cell ctc-button-cell" id="ctc_save_query_selector_cell">
|
44 |
+
<input type="submit" class="button button-primary ctc-save-input" id="ctc_save_query_selector"
|
45 |
name="ctc_save_query_selector" value="<?php _e( 'Save Child Values', 'chld_thm_cfg' ); ?>" disabled />
|
46 |
<input type="hidden" id="ctc_sel_ovrd_qsid"
|
47 |
name="ctc_sel_ovrd_qsid" value="" />
|
87 |
<strong>
|
88 |
<?php _e( 'Raw CSS', 'chld_thm_cfg' ); ?>
|
89 |
</strong>
|
90 |
+
<p class="howto"><?php _e( 'Use to enter shorthand CSS or new @media queries and selectors.', 'chld_thm_cfg' );?></p><p class="howto"><?php _e( 'Values entered here are merged into existing child styles or added to the child stylesheet if they do not exist in the parent.', 'chld_thm_cfg' ); ?></p>
|
91 |
</div>
|
92 |
<div class="ctc-input-cell-wide">
|
93 |
<textarea id="ctc_new_selectors" name="ctc_new_selectors" wrap="off"></textarea>
|
includes/forms/rule-value.php
CHANGED
@@ -17,7 +17,7 @@ if ( !defined( 'ABSPATH' ) ) exit;
|
|
17 |
<div class="ctc-input-cell">
|
18 |
<div class="ui-widget">
|
19 |
<input id="ctc_rule_menu"/>
|
20 |
-
<div id="
|
21 |
</div>
|
22 |
</div>
|
23 |
</div>
|
17 |
<div class="ctc-input-cell">
|
18 |
<div class="ui-widget">
|
19 |
<input id="ctc_rule_menu"/>
|
20 |
+
<div id="ctc_status_rules" style="float:right"></div>
|
21 |
</div>
|
22 |
</div>
|
23 |
</div>
|
includes/help/help_en_US.php
CHANGED
@@ -13,16 +13,16 @@ if ( !defined( 'ABSPATH' ) ) exit;
|
|
13 |
<li>If there are existing child themes available, there will be an additional menu labeled "Use Existing Child Theme" 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 <link> if the parent theme uses the main 'style.css' stylesheet and correctly enqueues it for child themes (default).</li>
|
22 |
-
<li>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. <strong>NOTE:</strong> this was the only method used in previous versions of Child Theme Configurator.</li>
|
23 |
-
<li>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.
|
24 |
-
</ul>
|
25 |
-
<strong>If you do not know which option to use, select <link>.</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 "Parse Additional Stylesheets" 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>
|
@@ -31,8 +31,7 @@ if ( !defined( 'ABSPATH' ) ) exit;
|
|
31 |
<!-- END tab -->
|
32 |
<!-- BEGIN tab -->
|
33 |
<h3 id="ctc_tutorial">Tutorial Video</h3>
|
34 |
-
<iframe width="
|
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>
|
13 |
<li>If there are existing child themes available, there will be an additional menu labeled "Use Existing Child Theme" 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>Optional: Enter a Theme Name, Theme Website, Author, Author Website, Descriptiont, Tags and Version</strong> for the child theme. If using an existing child theme, they will be entered automatically based on the child theme selected.</li>
|
17 |
+
<li><strong>Choose how WordPress should handle the parent theme stylesheet:</strong>
|
18 |
+
<ul>
|
19 |
+
<li><strong>Enqueue parent stylesheet (default):</strong> Select this option if the parent theme enqueues the stylesheet but has no special handling for child themes. Start with this option if unsure.</li>
|
20 |
+
<li><strong>@import parent stylesheet:</strong> Select this option if the parent theme links the stylesheet in the header template. Using @import is discouraged but necessary in this case unless you modify the header template.</li>
|
21 |
+
<li><strong>Enqueue child stylesheet:</strong> Select this option if the parent theme incorrectly loads the "template" stylesheet or does not load the "style.css" file at all. This is unusual but occurs in some themes.</li>
|
22 |
+
<li><strong>None (handled by theme):</strong> Select this option if all stylesheets are automatically loaded for child themes (e.g., "Responsive" by CyberChimps).</li>
|
23 |
+
</ul></li>
|
24 |
<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>
|
25 |
<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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 "Parse Additional Stylesheets" 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>
|
31 |
<!-- END tab -->
|
32 |
<!-- BEGIN tab -->
|
33 |
<h3 id="ctc_tutorial">Tutorial Video</h3>
|
34 |
+
<iframe src="//fast.wistia.net/embed/iframe/c0fbu8jhtj" allowtransparency="true" frameborder="0" scrolling="no" class="wistia_embed" name="wistia_embed" allowfullscreen mozallowfullscreen webkitallowfullscreen oallowfullscreen msallowfullscreen width="640" height="360"></iframe><script src="//fast.wistia.net/assets/external/E-v1.js" async></script><!-- END tab -->
|
|
|
35 |
<!-- BEGIN tab -->
|
36 |
<h3 id="ctc_query_selector">Query/Selector Tab</h3>
|
37 |
<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>
|
js/chld-thm-cfg.js
CHANGED
@@ -2,1440 +2,1322 @@
|
|
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 |
* Author: Lilaea Media
|
7 |
* Author URI: http://www.lilaeamedia.com/
|
8 |
* License: GPLv2
|
9 |
* Copyright (C) 2014-2015 Lilaea Media
|
10 |
*/
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
} );
|
38 |
-
|
39 |
-
}
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
if ( '' === slug ) {
|
54 |
-
errors.push( ctcAjax.inval_theme_txt );
|
55 |
-
}
|
56 |
-
if ( '' === $( '#ctc_child_name' ).val() ) {
|
57 |
-
errors.push( ctcAjax.inval_name_txt );
|
58 |
-
}
|
59 |
-
if ( errors.length ) {
|
60 |
-
set_notice( { 'error': errors } );
|
61 |
-
return false;
|
62 |
-
}
|
63 |
-
return true;
|
64 |
-
}
|
65 |
-
|
66 |
-
function autogen_slugs() {
|
67 |
-
if ( $( '#ctc_theme_parnt' ).length ) {
|
68 |
-
var parent = $( '#ctc_theme_parnt' ).val(),
|
69 |
-
slug = slugbase = parent + '-child',
|
70 |
-
name = ctcAjax.themes.parnt[parent].Name + ' Child',
|
71 |
-
suffix = '',
|
72 |
-
padded = '',
|
73 |
-
pad = '00';
|
74 |
-
while ( theme_exists( slug, 'new' ) ) {
|
75 |
-
suffix = ( '' == suffix ? 2 : suffix + 1 );
|
76 |
-
padded = pad.substring( 0, pad.length - suffix.toString().length ) + suffix.toString();
|
77 |
-
slug = slugbase + padded;
|
78 |
}
|
79 |
-
|
80 |
-
|
81 |
-
}
|
82 |
-
}
|
83 |
-
|
84 |
-
function focus_panel( id ) {
|
85 |
-
var panelid = id + '_panel';
|
86 |
-
$( '.nav-tab' ).removeClass( 'nav-tab-active' );
|
87 |
-
$( '.ctc-option-panel' ).removeClass( 'ctc-option-panel-active' );
|
88 |
-
$( '.ctc-selector-container' ).hide();
|
89 |
-
$( id ).addClass( 'nav-tab-active' );
|
90 |
-
$( '.ctc-option-panel-container' ).scrollTop( 0 );
|
91 |
-
$( panelid ).addClass( 'ctc-option-panel-active' );
|
92 |
-
}
|
93 |
-
|
94 |
-
function selector_input_toggle( obj ) {
|
95 |
-
var origval;
|
96 |
-
if ( $( '#ctc_rewrite_selector' ).length ) {
|
97 |
-
origval = $( '#ctc_rewrite_selector_orig' ).val();
|
98 |
-
$( '#ctc_sel_ovrd_selector_selected' ).text( origval );
|
99 |
-
$( obj ).text( ctcAjax.rename_txt );
|
100 |
-
} else {
|
101 |
-
origval = $( '#ctc_sel_ovrd_selector_selected' ).text();
|
102 |
-
$( '#ctc_sel_ovrd_selector_selected' ).html( '<textarea id="ctc_rewrite_selector" name="ctc_rewrite_selector" autocomplete="off"></textarea><input id="ctc_rewrite_selector_orig" name="ctc_rewrite_selector_orig" type="hidden" value="'
|
103 |
-
+ esc_quot( origval ) + '"/>' );
|
104 |
-
$( '#ctc_rewrite_selector' ).val( origval );
|
105 |
-
$( obj ).text( ctcAjax.cancel_txt );
|
106 |
-
}
|
107 |
-
}
|
108 |
-
|
109 |
-
function fade_update_notice() {
|
110 |
-
$( '.updated, .error' ).slideUp( 'slow', function() { $( '.updated' ).remove(); } );
|
111 |
-
}
|
112 |
-
|
113 |
-
function coalesce_inputs( obj ) {
|
114 |
-
var regex = /^(ctc_(ovrd|\d+)_(parent|child)_([0-9a-z\-]+)_(\d+))(_\w+)?$/,
|
115 |
-
container = $( obj ).parents( '.ctc-selector-row, .ctc-parent-row' ).first(),
|
116 |
-
swatch = container.find( '.ctc-swatch' ).first(),
|
117 |
-
cssrules = { 'parent': {}, 'child': {} },
|
118 |
-
gradient = {
|
119 |
-
'parent': {
|
120 |
-
'origin': '',
|
121 |
-
'start': '',
|
122 |
-
'end': ''
|
123 |
-
},
|
124 |
-
'child': {
|
125 |
-
'origin': '',
|
126 |
-
'start': '',
|
127 |
-
'end': ''
|
128 |
-
}
|
129 |
-
},
|
130 |
-
has_gradient = { 'child': false, 'parent': false },
|
131 |
-
postdata = {};
|
132 |
-
// set up objects for all neighboring inputs
|
133 |
-
container.find( '.ctc-parent-value, .ctc-child-value' ).each( function() {
|
134 |
-
var inputid = $( this ).attr( 'id' ),
|
135 |
-
inputparts = inputid.toString().match( regex ),
|
136 |
-
inputseq = inputparts[2],
|
137 |
-
inputtheme = inputparts[3],
|
138 |
-
inputrule = ( 'undefined' == typeof inputparts[4] ? '' : inputparts[4] ),
|
139 |
-
qsid = inputparts[5],
|
140 |
-
rulepart = ( 'undefined' == typeof inputparts[6] ? '' : inputparts[6] ),
|
141 |
-
value = ( 'parent' == inputtheme ? $( this ).text().replace( /!$/, '' ) : $( this ).val() ),
|
142 |
-
important = 'ctc_' + inputseq + '_child_' + inputrule + '_i_' + qsid,
|
143 |
-
parts, subparts;
|
144 |
-
if ( false === is_empty( $( this ).data( 'color' ) ) ) {
|
145 |
-
value = $( this ).data( 'color' );
|
146 |
-
$( this ).data( 'color', null );
|
147 |
}
|
148 |
-
|
149 |
-
|
150 |
-
postdata[inputid] = value;
|
151 |
-
postdata[important] = ( $( '#' + important ).is( ':checked' ) ) ? 1 : 0;
|
152 |
}
|
153 |
-
|
154 |
-
|
155 |
-
return;
|
156 |
-
}
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
202 |
subparts = value.toString().split( / +/ );
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
|
|
|
|
208 |
} else {
|
209 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
210 |
}
|
|
|
|
|
211 |
}
|
212 |
-
} else if ( 'seq' != inputrule ) {
|
213 |
-
cssrules[inputtheme][inputrule] = value;
|
214 |
}
|
215 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
216 |
}
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
(
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
obj['values'][1] = ( 'undefined' == typeof params[0] ? '' : params[0] );
|
258 |
-
obj['values'][2] = ( 'undefined' == typeof params[1] ? '' : params[1] );
|
259 |
-
obj['values'][3] = ( 'undefined' == typeof params[3] ? '' : params[3] );
|
260 |
-
obj['orig'] = [ obj['values'][1], obj['values'][2], obj['values'][3] ].join( ' ' ); // display "origin color1 color2"
|
261 |
} else {
|
262 |
-
obj['
|
|
|
263 |
}
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
image_url = value;
|
280 |
-
} else {
|
281 |
-
image_url = 'url(' + url + path + ')';
|
282 |
-
}
|
283 |
-
return image_url;
|
284 |
-
}
|
285 |
-
|
286 |
-
function is_empty( obj ) {
|
287 |
-
// first bail when definitely empty or undefined ( true ) NOTE: numeric zero returns false !
|
288 |
-
if ( 'undefined' == typeof obj || false === obj || null === obj || '' === obj ) { return true; }
|
289 |
-
// then, if this is bool, string or number it must not be empty ( false )
|
290 |
-
if ( true === obj || "string" === typeof obj || "number" === typeof obj ) { return false; }
|
291 |
-
// check for object type to be safe
|
292 |
-
if ( "object" === typeof obj ) {
|
293 |
-
// Use a standard for in loop
|
294 |
-
for ( var x in obj ) {
|
295 |
-
// A for in will iterate over members on the prototype
|
296 |
-
// chain as well, but Object.getOwnPropertyNames returns
|
297 |
-
// only those directly on the object, so use hasOwnProperty.
|
298 |
-
if ( obj.hasOwnProperty( x ) ) {
|
299 |
-
// any value means not empty ( false )
|
300 |
-
return false;
|
301 |
-
}
|
302 |
}
|
303 |
-
|
304 |
-
|
305 |
-
}
|
306 |
-
// this must be an unsupported datatype, so return not empty
|
307 |
-
return false;
|
308 |
-
|
309 |
-
}
|
310 |
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
321 |
}
|
322 |
-
}
|
323 |
-
}
|
324 |
-
delete ctcAjax.sel_val[qsid];
|
325 |
-
return false;
|
326 |
-
}
|
327 |
-
|
328 |
-
function load_menus() {
|
329 |
-
semaphore.rld_rule = 1;
|
330 |
-
semaphore.rld_sel = 1;
|
331 |
-
load_queries();
|
332 |
-
load_rules();
|
333 |
-
}
|
334 |
-
|
335 |
-
function load_queries() {
|
336 |
-
//console.log( 'load queries' );
|
337 |
-
//console.log( semaphore );
|
338 |
-
if ( 1 === semaphore.sel_ndx ) return;
|
339 |
-
if ( 0 === semaphore.sel_ndx || 1 == semaphore.rld_sel ) { // {
|
340 |
-
// retrieve from server
|
341 |
-
//console.log( ' loading queries...' );
|
342 |
-
semaphore.sel_ndx = 1;
|
343 |
-
semaphore.rld_sel = 0;
|
344 |
-
query_css( 'sel_ndx', null, load_queries );
|
345 |
-
return;
|
346 |
-
}
|
347 |
-
//console.log( 'queries loaded. building menu source ...' );
|
348 |
-
cache_queries = [];
|
349 |
-
if ( false === is_empty( ctcAjax.sel_ndx ) ) {
|
350 |
-
$.each( ctcAjax.sel_ndx, function( key, value ) {
|
351 |
-
var obj = { label: key, value: key };
|
352 |
-
cache_queries.push( obj );
|
353 |
} );
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
query_css( 'sel_ndx', current_query, load_selectors );
|
368 |
-
return;
|
369 |
-
}
|
370 |
-
//console.log( 'selectors loaded. building menu source ...' );
|
371 |
-
cache_selectors = [];
|
372 |
-
if ( false === is_empty( ctcAjax.sel_ndx ) ) {
|
373 |
-
$.each( ctcAjax.sel_ndx[current_query], function( key, value ) {
|
374 |
-
var obj = { label: key, value: value };
|
375 |
-
cache_selectors.push( obj );
|
376 |
-
} );
|
377 |
-
}
|
378 |
-
setup_selector_menu();
|
379 |
-
if ( semaphore.set_sel ) {
|
380 |
-
// selector semaphore set, set selector menu value
|
381 |
-
// this also triggers selector value refresh
|
382 |
-
semaphore.set_sel = 0;
|
383 |
-
set_selector( current_qsid, null );
|
384 |
-
}
|
385 |
-
}
|
386 |
-
|
387 |
-
function load_rules() {
|
388 |
-
//console.log( 'load rules' );
|
389 |
-
//console.log( semaphore );
|
390 |
-
if ( 1 === semaphore.rule ) return;
|
391 |
-
if ( 0 === semaphore.rule || 1 == semaphore.rld_rule ) {
|
392 |
-
//console.log( ' loading rules...' );
|
393 |
-
semaphore.rule = 1;
|
394 |
-
semaphore.rld_rule = 0;
|
395 |
-
query_css( 'rule', null, load_rules );
|
396 |
-
return;
|
397 |
-
}
|
398 |
-
//console.log( 'rules loaded. building menu source ...' );
|
399 |
-
cache_rules = [];
|
400 |
-
if ( false === is_empty( ctcAjax.rule ) ) {
|
401 |
-
$.each( ctcAjax.rule, function( key, value ) {
|
402 |
-
var obj = { label: value.replace( /\d+/g, from_ascii ), value: key };
|
403 |
-
cache_rules.push( obj );
|
404 |
} );
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
return 0;
|
412 |
-
} );
|
413 |
-
setup_rule_menu();
|
414 |
-
setup_new_rule_menu();
|
415 |
-
}
|
416 |
-
|
417 |
-
function load_selector_values( qsid ) {
|
418 |
-
//console.log( 'load_selector_values' );
|
419 |
-
//console.log( semaphore );
|
420 |
-
if ( 1 === semaphore.sel_val ) return false;
|
421 |
-
if ( is_empty( ctcAjax.sel_val[ qsid ] ) ) {
|
422 |
-
if ( 0 == semaphore.sel_val ) {
|
423 |
-
semaphore.sel_val = 1;
|
424 |
-
query_css( 'sel_val', qsid, load_selector_values );
|
425 |
-
}
|
426 |
-
// if semaphore is 2 and sel_val[qsid] does not exist, this selector if invalid
|
427 |
-
return false;
|
428 |
-
}
|
429 |
-
current_qsid = qsid;
|
430 |
-
if ( 1 == semaphore.set_qry ) {
|
431 |
-
// query semaphore set, set query menu value
|
432 |
-
semaphore.set_qry = 0;
|
433 |
-
set_query( ctcAjax.sel_val[qsid].query );
|
434 |
-
} else if ( 1 == semaphore.new_sel ) {
|
435 |
-
// qsid semaphore set, render selector inputs
|
436 |
-
semaphore.new_sel = 0;
|
437 |
-
render_selector_inputs( qsid );
|
438 |
-
}
|
439 |
-
}
|
440 |
-
|
441 |
-
function load_filtered_rules( request, response ) {
|
442 |
-
var arr = [],
|
443 |
-
noval = ( is_empty( ctcAjax.sel_val[current_qsid] ) ) || ( is_empty( ctcAjax.sel_val[current_qsid].value ) );
|
444 |
-
if ( is_empty( cache_rules ) ) {
|
445 |
-
load_rules();
|
446 |
-
}
|
447 |
-
$.each( cache_rules, function( key, val ) {
|
448 |
-
var skip = false,
|
449 |
matcher = new RegExp( $.ui.autocomplete.escapeRegex( request.term ), "i" );
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
457 |
}
|
458 |
-
} );
|
459 |
-
if ( skip ) {
|
460 |
-
return;
|
461 |
}
|
|
|
462 |
}
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
+ '<input type="button" class="button ctc-save-input" id="ctc_save_' + rule + '_' + qsid
|
520 |
-
+ '" name="ctc_save_' + rule + '_' + qsid + '" value="Save" /></div>' + lf );
|
521 |
-
html += '</div><!-- end input row -->' + lf;
|
522 |
-
}
|
523 |
-
return html;
|
524 |
-
}
|
525 |
-
|
526 |
-
function render_selector_inputs( qsid ) {
|
527 |
-
//console.log( 'render_selector_inputs' );
|
528 |
-
//console.log( semaphore );
|
529 |
-
var id, html, val, selector;
|
530 |
-
if ( qsid = prune_if_empty( qsid ) ) {
|
531 |
-
$( '#ctc_sel_ovrd_qsid' ).val( qsid );
|
532 |
-
current_qsid = qsid;
|
533 |
-
if ( is_empty( ctcAjax.sel_val[qsid].seq ) ) {
|
534 |
-
$( '#ctc_child_load_order_container' ).html( '' );
|
535 |
-
} else {
|
536 |
-
id = 'ctc_ovrd_child_seq_' + qsid;
|
537 |
-
val = parseInt( ctcAjax.sel_val[qsid].seq );
|
538 |
-
html = '<input type="text" id="' + id + '" name="' + id + '" class="ctc-child-value" value="' + val + '" />';
|
539 |
-
$( '#ctc_child_load_order_container' ).html( html );
|
540 |
-
}
|
541 |
-
if ( is_empty( ctcAjax.sel_val[qsid].value ) ) {
|
542 |
-
$( '#ctc_sel_ovrd_rule_inputs' ).slideUp( function(){ $( '#ctc_sel_ovrd_rule_inputs' ).html( '' ); } );
|
543 |
-
} else {
|
544 |
-
html = '';
|
545 |
-
$.each( ctcAjax.sel_val[qsid].value, function( rule, value ) {
|
546 |
-
html += render_child_rule_input( qsid, rule, 'ovrd' );
|
547 |
-
} );
|
548 |
-
$( '#ctc_sel_ovrd_rule_inputs' ).html( html ).find( '.color-picker' ).each( function() {
|
549 |
-
setup_iris( this );
|
550 |
-
} );
|
551 |
-
coalesce_inputs( '#ctc_child_all_0_swatch' );
|
552 |
-
if ( jquery_err.length ) {
|
553 |
-
jquery_notice();
|
554 |
-
} else {
|
555 |
-
$( '#ctc_sel_ovrd_selector_selected' ).text( ctcAjax.sel_val[qsid].selector );
|
556 |
-
$( '.ctc-rewrite-toggle' ).text( ctcAjax.rename_txt );
|
557 |
-
$( '#ctc_sel_ovrd_new_rule, #ctc_sel_ovrd_rule_header, #ctc_sel_ovrd_rule_inputs_container, #ctc_sel_ovrd_rule_inputs, .ctc-rewrite-toggle' ).slideDown();
|
558 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
559 |
}
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
$(
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
return false;
|
573 |
-
}
|
574 |
-
if ( 0 == semaphore.preview ) {
|
575 |
-
semaphore.preview = 1;
|
576 |
-
var theme;
|
577 |
-
if ( !( theme = theme.match( /(child|parnt)/ )[1] ) ) {
|
578 |
theme = 'child';
|
579 |
}
|
580 |
-
//
|
581 |
-
query_css( 'preview', theme
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
if ( 0 == semaphore.rule_val ) {
|
594 |
-
semaphore.rule_val = 1;
|
595 |
-
query_css( 'rule_val', ruleid, render_rule_value_inputs );
|
596 |
-
return false;
|
597 |
-
}
|
598 |
-
var rule = ctcAjax.rule[ruleid],
|
599 |
-
html = '<div class="ctc-input-row clearfix" id="ctc_rule_row_' + rule + '">' + lf;
|
600 |
-
if ( false === is_empty( ctcAjax.rule_val[ruleid] ) ) {
|
601 |
-
$.each( ctcAjax.rule_val[ruleid], function( valid, value ) {
|
602 |
-
var oldRuleObj = decode_value( rule, value );
|
603 |
-
html += '<div class="ctc-parent-row clearfix" id="ctc_rule_row_' + rule + '_' + valid + '">' + lf;
|
604 |
-
html += '<div class="ctc-input-cell ctc-parent-value" id="ctc_' + valid + '_parent_' + rule + '_' + valid + '">'
|
605 |
-
+ oldRuleObj.orig + '</div>' + lf;
|
606 |
-
html += '<div class="ctc-input-cell">' + lf;
|
607 |
-
html += '<div class="ctc-swatch ctc-specific" id="ctc_' + valid + '_parent_' + rule + '_' + valid + '_swatch">'
|
608 |
-
+ ctcAjax.swatch_txt + '</div></div>' + lf;
|
609 |
-
html += '<div class="ctc-input-cell"><a href="#" class="ctc-selector-handle" id="ctc_selector_' + rule + '_' + valid + '">'
|
610 |
-
+ ctcAjax.selector_txt + '</a></div>' + lf;
|
611 |
-
html += '<div id="ctc_selector_' + rule + '_' + valid + '_container" class="ctc-selector-container">' + lf;
|
612 |
-
html += '<a href="#" id="ctc_selector_' + rule + '_' + valid + '_close" class="ctc-selector-handle ctc-exit" title="'
|
613 |
-
+ ctcAjax.close_txt + '"></a>';
|
614 |
-
html += '<div id="ctc_selector_' + rule + '_' + valid + '_inner_container" class="ctc-selector-inner-container clearfix">' + lf;
|
615 |
-
html += '<div id="ctc_status_val_qry_' + valid + '"></div>' + lf;
|
616 |
-
html += '<div id="ctc_selector_' + rule + '_' + valid + '_rows"></div>' + lf;
|
617 |
-
html += '</div></div></div>' + lf;
|
618 |
-
} );
|
619 |
-
html += '</div>' + lf;
|
620 |
-
}
|
621 |
-
$( '#ctc_rule_value_inputs' ).html( html ).find( '.ctc-swatch' ).each( function() {
|
622 |
-
coalesce_inputs( this );
|
623 |
-
} );
|
624 |
-
html = null; // send to the garbage
|
625 |
-
}
|
626 |
-
|
627 |
-
function render_recent() {
|
628 |
-
var html = '';
|
629 |
-
if ( is_empty( ctcAjax.recent ) && false === is_empty( ctcAjax.recent_txt ) ) {
|
630 |
-
html += ctcAjax.recent_txt;
|
631 |
-
} else if ( is_empty( ctcAjax.recent ) ) {
|
632 |
-
return;
|
633 |
-
} else {
|
634 |
-
//console.log(ctcAjax.recent);
|
635 |
-
html += '<ul>' + "\n";
|
636 |
-
$.each( ctcAjax.recent, function( ndx, el ) {
|
637 |
-
$.each( el, function ( key, value ) {
|
638 |
-
html += '<li><a href="#" class="ctc-selector-edit" id="ctc_selector_edit_' + key + '" >'
|
639 |
-
+ value + '</a></li>' + "\n";
|
640 |
-
} );
|
641 |
-
} );
|
642 |
-
html += '</ul>' + "\n";
|
643 |
-
}
|
644 |
-
$( '#ctc_recent_selectors' ).html( html );
|
645 |
-
html = null; // send to the garbage
|
646 |
-
}
|
647 |
|
648 |
-
|
649 |
-
|
650 |
-
var params,
|
651 |
-
page_ruleid,
|
652 |
-
rule = $( '#ctc_rule_menu_selected' ).text().replace( /[^\w\-]/g, to_ascii ),
|
653 |
-
selector,
|
654 |
-
html = '';
|
655 |
-
if ( 0 === semaphore.val_qry ) {
|
656 |
-
semaphore.val_qry = 1;
|
657 |
-
params = { 'rule': rule };
|
658 |
-
query_css( 'val_qry', valid, render_selector_value_inputs, params );
|
659 |
-
return false;
|
660 |
-
}
|
661 |
-
if ( false === is_empty( ctcAjax.val_qry[valid] ) ) {
|
662 |
-
$.each( ctcAjax.val_qry[valid], function( rule, queries ) {
|
663 |
-
page_rule = rule;
|
664 |
-
$.each( queries, function( query, selectors ) {
|
665 |
-
html += '<h4 class="ctc-query-heading">' + query + '</h4>' + lf;
|
666 |
-
if ( false === is_empty( selectors ) ) {
|
667 |
-
$.each( selectors, function( qsid, data ) {
|
668 |
-
ctcAjax.sel_val[qsid] = data;
|
669 |
-
html += render_child_rule_input( qsid, rule, valid );
|
670 |
-
} );
|
671 |
}
|
672 |
} );
|
673 |
-
} )
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
712 |
selectFirst: true,
|
713 |
autoFocus: true,
|
714 |
select: function( e, ui ) {
|
715 |
-
|
716 |
return false;
|
717 |
},
|
718 |
focus: function( e ) {
|
719 |
e.preventDefault();
|
720 |
}
|
721 |
-
} );
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
selectFirst: true,
|
734 |
autoFocus: true,
|
735 |
select: function( e, ui ) {
|
736 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
737 |
return false;
|
738 |
},
|
739 |
-
focus: function( e ) {
|
740 |
-
|
741 |
-
} catch ( exn ) {
|
742 |
-
jquery_exception( exn, 'Selector Menu' );
|
743 |
-
}
|
744 |
-
}
|
745 |
-
|
746 |
-
function setup_rule_menu() {
|
747 |
-
//console.log( 'setup rule menu' );
|
748 |
-
//console.log( semaphore );
|
749 |
-
try {
|
750 |
-
$( '#ctc_rule_menu' ).autocomplete( {
|
751 |
-
source: cache_rules,
|
752 |
-
//minLength: 0,
|
753 |
-
selectFirst: true,
|
754 |
-
autoFocus: true,
|
755 |
-
select: function( e, ui ) {
|
756 |
-
set_rule( ui.item.value, ui.item.label );
|
757 |
-
return false;
|
758 |
-
},
|
759 |
-
focus: function( e ) { e.preventDefault(); }
|
760 |
-
} );
|
761 |
-
} catch ( exn ) {
|
762 |
-
jquery_exception( exn, 'Rule Menu' );
|
763 |
-
}
|
764 |
-
}
|
765 |
-
|
766 |
-
function setup_new_rule_menu() {
|
767 |
-
try {
|
768 |
-
$( '#ctc_new_rule_menu' ).autocomplete( {
|
769 |
-
source: load_filtered_rules,
|
770 |
-
//minLength: 0,
|
771 |
-
selectFirst: true,
|
772 |
-
autoFocus: true,
|
773 |
-
select: function( e, ui ) {
|
774 |
-
e.preventDefault();
|
775 |
-
var n = $( render_child_rule_input( current_qsid, ui.item.label.replace( /[^\w\-]/g, to_ascii ), 'ovrd' ) );
|
776 |
-
$( '#ctc_sel_ovrd_rule_inputs' ).append( n );
|
777 |
-
$( '#ctc_new_rule_menu' ).val( '' );
|
778 |
-
if ( is_empty( ctcAjax.sel_val[current_qsid].value ) ) {
|
779 |
-
ctcAjax.sel_val[current_qsid]['value'] = {};
|
780 |
}
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
setup_iris( el );
|
785 |
-
$( el ).focus();
|
786 |
-
} );
|
787 |
-
if ( jquery_err.length ) jquery_notice();
|
788 |
-
return false;
|
789 |
-
},
|
790 |
-
focus: function( e ) { e.preventDefault(); }
|
791 |
-
} );
|
792 |
-
} catch ( exn ) {
|
793 |
-
jquery_exception( exn, 'New Rule Menu' );
|
794 |
-
}
|
795 |
-
}
|
796 |
-
/**
|
797 |
-
* The "set" functions apply values to inputs
|
798 |
-
*/
|
799 |
-
function set_existing() {
|
800 |
-
if ( $( '#ctc_theme_child' ).length && $( '#ctc_child_type_existing' ).is( ':checked' ) ) {
|
801 |
-
var child = $( '#ctc_theme_child' ).val();
|
802 |
-
if ( false === is_empty( child ) ) {
|
803 |
-
$( '#ctc_child_name' ).val( ctcAjax.themes['child'][child].Name );
|
804 |
-
$( '#ctc_child_author' ).val( ctcAjax.themes['child'][child].Author );
|
805 |
-
$( '#ctc_child_version' ).val( ctcAjax.themes['child'][child].Version );
|
806 |
}
|
807 |
-
}
|
808 |
-
}
|
809 |
-
|
810 |
-
function set_notice( noticearr ) {
|
811 |
-
var errorHtml = '';
|
812 |
-
if ( false === is_empty( noticearr ) ) {
|
813 |
-
$.each( noticearr, function( type, list ) {
|
814 |
-
errorHtml += '<div class="' + type + '"><ul>' + lf;
|
815 |
-
$( list ).each( function( ndx, el ) {
|
816 |
-
errorHtml += '<li>' + el.toString() + '</li>' + lf;
|
817 |
-
} );
|
818 |
-
errorHtml += '</ul></div>';
|
819 |
-
} );
|
820 |
-
}
|
821 |
-
$( '#ctc_error_notice' ).html( errorHtml );
|
822 |
-
$('html, body').animate({ scrollTop: 0 }, 'slow');
|
823 |
-
}
|
824 |
-
|
825 |
-
function set_parent_menu( obj ) {
|
826 |
-
$( '#ctc_theme_parent' ).parents( '.ctc-input-row' ).first().append( '<span class="ctc-status-icon spinner"></span>' );
|
827 |
-
$( '.spinner' ).show();
|
828 |
-
document.location='?page=' + ctcAjax.page + '&ctc_parent=' + obj.value;
|
829 |
-
}
|
830 |
-
|
831 |
-
function set_child_menu( obj ) {
|
832 |
-
if ( false === is_empty( ctcAjax.themes.child[obj.value] ) ) {
|
833 |
-
$( '#ctc_child_name' ).val( ctcAjax.themes.child[obj.value].Name );
|
834 |
-
$( '#ctc_child_author' ).val( ctcAjax.themes.child[obj.value].Author );
|
835 |
-
$( '#ctc_child_version' ).val( ctcAjax.themes.child[obj.value].Version );
|
836 |
-
}
|
837 |
-
}
|
838 |
-
|
839 |
-
function set_query( value ) {
|
840 |
-
current_query = value;
|
841 |
-
$( '#ctc_sel_ovrd_query' ).val( '' );
|
842 |
-
$( '#ctc_sel_ovrd_query_selected' ).text( value );
|
843 |
-
$( '#ctc_sel_ovrd_selector' ).val( '' );
|
844 |
-
$( '#ctc_sel_ovrd_selector_selected' ).html( ' ' );
|
845 |
-
$( '#ctc_sel_ovrd_rule_inputs' ).html( '' );
|
846 |
-
load_selectors();
|
847 |
-
}
|
848 |
-
|
849 |
-
function set_selector( value, label ) {
|
850 |
-
$( '#ctc_sel_ovrd_selector' ).val( '' );
|
851 |
-
if ( 1 != semaphore.sel_val ) semaphore.sel_val = 0;
|
852 |
-
current_qsid = value;
|
853 |
-
// set flag to render inputs after qsid values load
|
854 |
-
semaphore.new_sel = 1;
|
855 |
-
load_selector_values( value );
|
856 |
-
}
|
857 |
-
|
858 |
-
function set_rule( value, label ) {
|
859 |
-
$( '#ctc_rule_menu' ).val( '' );
|
860 |
-
$( '#ctc_rule_menu_selected' ).text( label );
|
861 |
-
if ( 1 != semaphore.rule_val ) semaphore.rule_val = 0;
|
862 |
-
render_rule_value_inputs( value );
|
863 |
-
$( '.ctc-rewrite-toggle' ).text( ctcAjax.rename_txt );
|
864 |
-
$( '#ctc_rule_value_inputs, #ctc_input_row_rule_header' ).show();
|
865 |
-
}
|
866 |
-
|
867 |
-
function set_qsid( obj ) {
|
868 |
-
//console.log( 'set_qsid' );
|
869 |
-
//console.log( semaphore );
|
870 |
-
var qsid = $( obj ).attr( 'id' ).match( /_(\d+)$/ )[1];
|
871 |
-
focus_panel( '#query_selector_options' );
|
872 |
-
// set flag to load selector (qsid) values if empty
|
873 |
-
semaphore.sel_val = 0;
|
874 |
-
// set flags to set menu values after qsid values load
|
875 |
-
semaphore.set_sel = semaphore.set_qry = 1;
|
876 |
-
current_qsid = qsid;
|
877 |
-
load_selector_values( qsid );
|
878 |
-
}
|
879 |
-
|
880 |
-
/**
|
881 |
-
* slurp website home page and parse header for linked stylesheets
|
882 |
-
* set these to be parsed as "default" stylesheets
|
883 |
-
*/
|
884 |
-
function set_addl_css() {
|
885 |
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
if ( additional[1].match( /bootstrap/ ) ) continue; // don't autoselect Bootstrap stylesheets
|
899 |
-
$( '.ctc_checkbox' ).each( function( ndx, el ) {
|
900 |
-
if ( $( this ).val() == additional[1] ) $( this ).prop( 'checked', true );
|
901 |
-
} );
|
902 |
}
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
|
|
|
|
|
|
|
|
|
|
911 |
} );
|
912 |
-
}
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
/**
|
917 |
-
* Retrieve data from server and execute callback on completion
|
918 |
-
* Previously set semaphores control the callback behavior
|
919 |
-
*/
|
920 |
-
function query_css( obj, key, callback, params ) {
|
921 |
-
var postdata = { 'ctc_query_obj' : obj, 'ctc_query_key': key },
|
922 |
-
status_sel = '#ctc_status_' + obj + ( 'val_qry' == obj ? '_' + key : '' );
|
923 |
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
'
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
942 |
-
//
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
974 |
}
|
975 |
-
|
976 |
-
|
977 |
-
).fail( function() {
|
978 |
-
// hide spinner
|
979 |
-
$( '.query-icon' ).removeClass( 'spinner' );
|
980 |
-
// show check mark
|
981 |
-
$( '.query-icon' ).addClass( 'failure' );
|
982 |
-
if ( 'preview' == obj ) {
|
983 |
-
ctcAjax.previewResponse = ctcAjax.css_fail_txt;
|
984 |
-
semaphore[obj] = 2;
|
985 |
-
callback( key );
|
986 |
} else {
|
987 |
-
|
|
|
|
|
|
|
|
|
|
|
988 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
989 |
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
* Post data to server for saving and execute callback on completion
|
995 |
-
* Previously set semaphores control the callback behavior
|
996 |
-
*/
|
997 |
-
function save( obj, callback ) {
|
998 |
-
var postdata = {},
|
999 |
-
$selector, $query, $imports, $rule,
|
1000 |
-
id = $( obj ).attr( 'id' ), newsel;
|
1001 |
-
|
1002 |
-
// disable the button until ajax returns
|
1003 |
-
$( obj ).prop( 'disabled', true );
|
1004 |
-
// clear previous success/fail icons
|
1005 |
-
$( '.save-icon' ).remove();
|
1006 |
-
// show spinner
|
1007 |
-
$( obj ).parent( '.ctc-textarea-button-cell, .ctc-button-cell' ).append( '<span class="ctc-status-icon spinner save-icon"></span>' );
|
1008 |
-
if ( id.match( /ctc_configtype/ ) ) {
|
1009 |
-
$( obj ).parents( '.ctc-input-row' ).first().append( '<span class="ctc-status-icon spinner save-icon"></span>' );
|
1010 |
-
postdata[ 'ctc_configtype' ] = $( obj ).val();
|
1011 |
-
} else if ( ( $selector = $( '#ctc_new_selectors' ) ) && 'ctc_save_new_selectors' == $( obj ).attr( 'id' ) ) {
|
1012 |
-
postdata['ctc_new_selectors'] = $selector.val();
|
1013 |
-
if ( $query = $( '#ctc_sel_ovrd_query_selected' ) ) {
|
1014 |
-
postdata['ctc_sel_ovrd_query'] = $query.text();
|
1015 |
}
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
//
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1031 |
} else {
|
1032 |
-
|
|
|
1033 |
}
|
1034 |
-
$( '.
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
postdata['_wpnonce'] = $( '#_wpnonce' ).val();
|
1043 |
-
// console.log( postdata );
|
1044 |
-
// ajax post input data
|
1045 |
-
$.post(
|
1046 |
-
// get ajax url from localized object
|
1047 |
-
ctcAjax.ajaxurl,
|
1048 |
-
//Data
|
1049 |
-
postdata,
|
1050 |
-
//on success function
|
1051 |
-
function( response ) {
|
1052 |
-
// console.log( response );
|
1053 |
-
// release button
|
1054 |
-
$( obj ).prop( 'disabled', false );
|
1055 |
-
// hide spinner
|
1056 |
-
$( '.save-icon' ).removeClass( 'spinner' );
|
1057 |
-
// show check mark
|
1058 |
-
if ( is_empty( response ) ) {
|
1059 |
-
$( '.save-icon' ).addClass( 'failure' );
|
1060 |
} else {
|
1061 |
-
|
1062 |
-
|
1063 |
-
//console.log( 'cache reset flag set. resetting caches...');
|
1064 |
-
semaphore.refresh = 0;
|
1065 |
-
// configuration has changed, wipe out the cache arrays
|
1066 |
-
reset_caches();
|
1067 |
-
}
|
1068 |
-
//console.log( 'updating cache from ' + id + ' save');
|
1069 |
-
// update data objects
|
1070 |
-
update_cache( response );
|
1071 |
-
response = null;
|
1072 |
-
if ( is_empty( rewrite_id ) ) {
|
1073 |
-
if ( current_qsid ) {
|
1074 |
-
render_selector_inputs( current_qsid );
|
1075 |
-
render_recent();
|
1076 |
-
}
|
1077 |
-
} else {
|
1078 |
-
set_selector( rewrite_id, rewrite_sel );
|
1079 |
-
rewrite_id = rewrite_sel = null;
|
1080 |
-
}
|
1081 |
-
$( '.save-icon' ).addClass( 'success' );
|
1082 |
-
if ( 'function' === typeof callback ) {
|
1083 |
-
callback();
|
1084 |
-
}
|
1085 |
}
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
//
|
1090 |
-
$(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1091 |
// hide spinner
|
1092 |
-
$( '.save-icon' ).removeClass( 'spinner' );
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
1108 |
-
|
1109 |
-
|
1110 |
-
|
1111 |
-
break;
|
1112 |
-
|
1113 |
-
case 'val_qry':
|
1114 |
-
ctcAjax.val_qry[this.key] = this.data;
|
1115 |
-
break;
|
1116 |
-
|
1117 |
-
case 'rule':
|
1118 |
-
ctcAjax.rule = this.data;
|
1119 |
-
break;
|
1120 |
-
|
1121 |
-
case 'sel_ndx':
|
1122 |
-
if ( is_empty( this.key ) ) {
|
1123 |
-
ctcAjax.sel_ndx = this.data;
|
1124 |
-
} else if ( 'qsid' == this.key ) {
|
1125 |
-
if ( is_empty( ctcAjax.sel_ndx[this.data.query] ) ) {
|
1126 |
-
ctcAjax.sel_ndx[this.data.query] = {}
|
1127 |
-
}
|
1128 |
-
ctcAjax.sel_ndx[this.data.query][this.data.selector] = this.data.qsid;
|
1129 |
-
} else {
|
1130 |
-
ctcAjax.sel_ndx[this.key] = this.data;
|
1131 |
-
current_query = this.key;
|
1132 |
}
|
1133 |
-
|
1134 |
-
|
1135 |
-
case 'sel_val':
|
1136 |
-
ctcAjax.sel_val[this.key] = this.data;
|
1137 |
-
current_qsid = this.key;
|
1138 |
-
break;
|
1139 |
-
|
1140 |
-
case 'rewrite':
|
1141 |
-
current_qsid = this.key;
|
1142 |
-
rewrite_id = this.key;
|
1143 |
-
rewrite_sel = this.data;
|
1144 |
-
break;
|
1145 |
-
|
1146 |
-
case 'recent':
|
1147 |
-
ctcAjax.recent = this.data;
|
1148 |
-
break;
|
1149 |
-
|
1150 |
-
case 'stylesheets':
|
1151 |
-
$( '#ctc_stylesheet_files' ).html( this.data );
|
1152 |
-
break;
|
1153 |
-
|
1154 |
-
case 'backups':
|
1155 |
-
$( '#ctc_backup_files' ).html( this.data );
|
1156 |
-
break;
|
1157 |
-
|
1158 |
-
case 'addl_css':
|
1159 |
-
ctcAjax.addl_css = this.data;
|
1160 |
-
//console.log( 'addl_css' );
|
1161 |
-
//console.log( this.data );
|
1162 |
-
break;
|
1163 |
-
case 'debug':
|
1164 |
-
$( '#ctc_debug_container' ).html( this.data );
|
1165 |
-
break;
|
1166 |
-
case 'preview':
|
1167 |
-
case 'all_styles':
|
1168 |
-
// refresh preview
|
1169 |
-
ctcAjax.previewResponse = this.data;
|
1170 |
}
|
1171 |
-
}
|
1172 |
-
response = null; // send to garbage
|
1173 |
-
}
|
1174 |
-
|
1175 |
-
function reset_caches() {
|
1176 |
-
//console.log( 'resetting caches...');
|
1177 |
-
current_query = 'base';
|
1178 |
-
current_qsid = null;
|
1179 |
-
cache_selectors = [];
|
1180 |
-
cache_queries = [];
|
1181 |
-
cache_rules = [];
|
1182 |
-
|
1183 |
-
semaphore[ 'rld_rule' ] = 1; // force rule reload
|
1184 |
-
semaphore[ 'rld_sel' ] = 1; // force sel_ndx reload
|
1185 |
-
semaphore[ 'set_qry' ] = 1; // set query on qsid load
|
1186 |
-
|
1187 |
-
ctcAjax.imports = [];
|
1188 |
-
ctcAjax.recent = {};
|
1189 |
-
ctcAjax.rule = {};
|
1190 |
-
ctcAjax.sel_ndx = {};
|
1191 |
-
ctcAjax.val_qry = {};
|
1192 |
-
ctcAjax.rule_val = {};
|
1193 |
-
ctcAjax.sel_val = {};
|
1194 |
-
//console.log( 'caches reset. loading menus...');
|
1195 |
-
load_menus();
|
1196 |
-
}
|
1197 |
-
function jquery_exception( exn, type ) {
|
1198 |
-
var ln = is_empty( exn.lineNumber ) ? '' : ' line: ' + exn.lineNumber,
|
1199 |
-
fn = is_empty( exn.fileName ) ? '' : ' ' + exn.fileName.split( /\?/ )[0];
|
1200 |
-
jquery_err.push( '<code><small>' + type + ': ' + exn.message + fn + ln + '</small></code>' );
|
1201 |
-
}
|
1202 |
-
function jquery_notice() {
|
1203 |
|
1204 |
-
|
1205 |
-
|
1206 |
-
|
1207 |
-
|
1208 |
-
|
1209 |
-
var url = $( this ).prop( 'src' );
|
1210 |
-
if ( false === is_empty( url ) && url.match( /jquery(\.min|\.js|\-?ui)/i ) && ! url.match( /load\-scripts.php/ ) ) {
|
1211 |
-
culprits.push( '<code><small>' + url.split( /\?/ )[0] + '</small></code>' );
|
1212 |
-
}
|
1213 |
-
} );
|
1214 |
-
errors.push( '<strong>' + ctcAjax.js_txt + '</strong>' );
|
1215 |
-
if ( 1 == ctcAjax.is_debug ) {
|
1216 |
-
errors.push( jquery_err.join( '<br/>' ) );
|
1217 |
-
}
|
1218 |
-
if ( culprits.length ) {
|
1219 |
-
errors.push( ctcAjax.jquery_txt + '<br/>' + culprits.join( '<br/>' ) );
|
1220 |
-
}
|
1221 |
-
errors.push( ctcAjax.plugin_txt + ' ' + ctcAjax.contact_txt );
|
1222 |
-
set_notice( { 'error': errors } );
|
1223 |
-
}
|
1224 |
-
// initialize vars
|
1225 |
-
var lf = "\n",
|
1226 |
-
quot_regex = new RegExp( '"', 'g' ),
|
1227 |
-
rewrite_id,
|
1228 |
-
rewrite_sel,
|
1229 |
-
testslug = '',
|
1230 |
-
testname = '',
|
1231 |
-
current_query = 'base',
|
1232 |
-
current_qsid,
|
1233 |
-
semaphore = {
|
1234 |
-
// status flags: 0 = load, 1 = loading, 2 = loaded
|
1235 |
-
'rule': 0, // rules
|
1236 |
-
'sel_ndx': 0, // index of queries/selectors
|
1237 |
-
'val_qry': 0, // values by qsid
|
1238 |
-
'rule_val': 0, // values by rule
|
1239 |
-
'sel_val': 0, // qsids (query/selector ids) by value
|
1240 |
-
'preview': 0, // stylesheet preview
|
1241 |
-
'recent': 0, // recent edits
|
1242 |
-
// these control behavior of ajax callbacks
|
1243 |
-
'rld_rule': 0, // force rule reload
|
1244 |
-
'rld_sel': 0, // force sel_ndx reload
|
1245 |
-
'set_qry': 0, // set query on qsid load
|
1246 |
-
'set_sel': 0, // set selector on sel load
|
1247 |
-
'new_sel': 0, // render new inputs on qsid load
|
1248 |
-
'refresh': 0 // reset caches on load
|
1249 |
},
|
1250 |
-
|
1251 |
-
|
1252 |
-
|
1253 |
-
|
1254 |
-
|
1255 |
-
|
1256 |
-
|
1257 |
-
|
1258 |
-
|
1259 |
-
|
1260 |
-
|
1261 |
-
|
1262 |
-
|
1263 |
-
$.widget( 'ctc.themeMenu', $.ui.selectmenu, {
|
1264 |
-
_renderItem: function( ul, item ) {
|
1265 |
-
var li = $( "<li>" );
|
1266 |
-
$( '#ctc_theme_option_' + item.value ).detach().appendTo( li );
|
1267 |
-
return li.appendTo( ul );
|
1268 |
-
}
|
1269 |
-
} );
|
1270 |
-
} catch( exn ) {
|
1271 |
-
jquery_exception( exn, 'Theme Menu' );
|
1272 |
-
}
|
1273 |
-
try {
|
1274 |
-
$( '#ctc_theme_parnt' ).themeMenu( {
|
1275 |
-
select: function( event, ui ) {
|
1276 |
-
set_parent_menu( ui.item );
|
1277 |
}
|
1278 |
} );
|
1279 |
-
|
1280 |
-
if (
|
1281 |
-
|
1282 |
-
else $( '#ctc_theme_parnt-button' ).remove();
|
1283 |
-
jquery_exception( exn, 'Parent Theme Menu' );
|
1284 |
-
}
|
1285 |
-
if ( is_empty( ctcAjax.themes.child ) ) {
|
1286 |
-
if ( $( '#ctc_child_name' ).length ) {
|
1287 |
-
$( '#ctc_child_name' ).val( testname );
|
1288 |
-
$( '#ctc_child_template' ).val( testslug );
|
1289 |
}
|
1290 |
-
|
1291 |
-
|
1292 |
-
|
1293 |
-
|
1294 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1295 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1296 |
} );
|
1297 |
-
}
|
1298 |
-
|
1299 |
-
|
1300 |
-
|
1301 |
-
|
1302 |
-
|
1303 |
-
|
1304 |
-
|
1305 |
-
|
1306 |
-
|
1307 |
-
|
1308 |
-
|
1309 |
-
|
1310 |
-
|
1311 |
-
|
1312 |
-
|
1313 |
-
|
1314 |
-
|
1315 |
-
|
1316 |
-
|
1317 |
-
|
1318 |
-
|
1319 |
-
$( '.
|
1320 |
-
|
1321 |
-
|
1322 |
-
|
1323 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1324 |
}
|
1325 |
-
|
1326 |
-
|
1327 |
-
$( '#ctc_main' ).on( 'change', '.ctc-child-value, input[type=checkbox]', function() { //'.ctc-option-panel-container',
|
1328 |
-
coalesce_inputs( this );
|
1329 |
-
} );
|
1330 |
|
1331 |
-
|
1332 |
-
|
1333 |
-
|
1334 |
-
|
1335 |
-
|
1336 |
-
|
1337 |
-
|
1338 |
-
|
1339 |
-
}
|
1340 |
-
$( '#' + id + '_container' ).fadeToggle( 'fast' );
|
1341 |
-
$( '.ctc-selector-container' ).not( '#' + id + '_container' ).fadeOut( 'fast' );
|
1342 |
-
} );
|
1343 |
-
$( '#ctc_main' ).on( 'click', '.ctc-save-input', function( e ) {
|
1344 |
-
save( this , load_menus ); // refresh menus after updating data
|
1345 |
-
} );
|
1346 |
-
$( '#ctc_main' ).on( 'click', '.ctc-selector-edit', function( e ) {
|
1347 |
-
set_qsid( this );
|
1348 |
-
} );
|
1349 |
-
$( '#ctc_main' ).on( 'click', '.ctc-rewrite-toggle', function( e ) {
|
1350 |
-
e.preventDefault();
|
1351 |
-
selector_input_toggle( this );
|
1352 |
-
} );
|
1353 |
-
$( '#ctc_main' ).on( 'click', '.ctc-section-toggle', function( e ) {
|
1354 |
-
$( this ).toggleClass( 'open' );
|
1355 |
-
var id = $( this ).attr( 'id' ) + '_content';
|
1356 |
-
$( '#' + id ).slideToggle( 'fast' );
|
1357 |
-
} );
|
1358 |
-
$( '#ctc_main' ).on( 'click', '#ctc_copy_selector', function( e ) {
|
1359 |
-
var txt = $( '#ctc_sel_ovrd_selector_selected' ).text().trim();
|
1360 |
-
if ( false === is_empty( txt ) )
|
1361 |
-
$( '#ctc_new_selectors' ).val( $( '#ctc_new_selectors' ).val() + "\n" + txt + " {\n\n}" );
|
1362 |
-
} );
|
1363 |
-
$( '#ctc_configtype' ).on( 'change', function( e ) {
|
1364 |
-
var val = $( this ).val();
|
1365 |
-
if ( is_empty( val ) || 'theme' == val ) {
|
1366 |
-
$( '.ctc-theme-only, .ctc-themeonly-container' ).removeClass( 'ctc-disabled' );
|
1367 |
-
$( '.ctc-theme-only, .ctc-themeonly-container input' ).prop( 'disabled', false );
|
1368 |
try {
|
1369 |
-
|
1370 |
-
|
1371 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1372 |
}
|
1373 |
-
} else {
|
1374 |
-
$( '.ctc-theme-only, .ctc-themeonly-container' ).addClass( 'ctc-disabled' );
|
1375 |
-
$( '.ctc-theme-only, .ctc-themeonly-container input' ).prop( 'disabled', true );
|
1376 |
try {
|
1377 |
-
$( '#ctc_theme_parnt
|
1378 |
-
|
1379 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1380 |
}
|
1381 |
}
|
1382 |
-
|
1383 |
-
|
1384 |
-
|
1385 |
-
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
1389 |
-
|
1390 |
-
|
1391 |
-
|
1392 |
-
|
1393 |
-
|
1394 |
-
|
1395 |
-
|
1396 |
-
|
1397 |
-
|
1398 |
-
|
1399 |
-
|
1400 |
-
|
1401 |
-
|
1402 |
-
|
1403 |
-
|
1404 |
-
|
1405 |
-
|
1406 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1407 |
} else {
|
1408 |
-
|
1409 |
-
|
1410 |
-
$( '.ctc-recent-container' ).addClass( 'moved' ).detach().appendTo('#ctc_option_panel_wrapper');
|
1411 |
-
}
|
1412 |
-
$( '.ctc-recent-container' ).stop().slideDown();
|
1413 |
-
$( '.ctc-option-panel' ).css( { 'width': '80%' } );
|
1414 |
}
|
1415 |
-
|
1416 |
-
|
1417 |
-
|
1418 |
-
|
1419 |
-
|
1420 |
-
|
1421 |
-
|
1422 |
-
|
1423 |
-
|
1424 |
-
|
1425 |
-
|
1426 |
-
|
1427 |
-
|
1428 |
-
|
1429 |
-
|
1430 |
-
|
1431 |
-
// show last 25 selectors edited
|
1432 |
-
render_recent();
|
1433 |
-
// turn on submit buttons (disabled until everything is loaded to prevent errors)
|
1434 |
-
$( 'input[type=submit], input[type=button]' ).prop( 'disabled', false );
|
1435 |
-
// disappear any notices after 15 seconds
|
1436 |
-
setTimeout( fade_update_notice, 15000 );
|
1437 |
-
} else {
|
1438 |
-
//$( '.ctc-select' ).css( { 'visibility': 'visible' } ).show();
|
1439 |
-
jquery_notice();
|
1440 |
-
}
|
1441 |
-
} );
|
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.7.0
|
6 |
* Author: Lilaea Media
|
7 |
* Author URI: http://www.lilaeamedia.com/
|
8 |
* License: GPLv2
|
9 |
* Copyright (C) 2014-2015 Lilaea Media
|
10 |
*/
|
11 |
+
;
|
12 |
+
// jQuery plugin template for plugin that does not work on element
|
13 |
+
( function( $ ) {
|
14 |
+
$.chldthmcfg = {
|
15 |
+
//console.log( 'executing main function' );
|
16 |
+
esc_quot: function( str ) {
|
17 |
+
var self = this;
|
18 |
+
return self.is_empty( str ) ? str : str.toString().replace( /"/g, '"' );
|
19 |
+
},
|
20 |
+
|
21 |
+
getxt: function( key ){
|
22 |
+
return ( text = ctcAjax[ key + '_txt' ] ) ? text : '';
|
23 |
+
},
|
24 |
+
|
25 |
+
from_ascii: function( str ) {
|
26 |
+
var ascii = parseInt( str ),
|
27 |
+
chr = String.fromCharCode( ascii )
|
28 |
+
return chr;
|
29 |
+
},
|
30 |
+
|
31 |
+
to_ascii: function( str ) {
|
32 |
+
var ascii = str.charCodeAt( 0 );
|
33 |
+
return ascii;
|
34 |
+
},
|
35 |
|
36 |
+
is_empty: function( obj ) {
|
37 |
+
// first bail when definitely empty or undefined ( true ) NOTE: numeric zero returns false !
|
38 |
+
if ( 'undefined' == typeof obj || false === obj || null === obj || '' === obj ) { return true; }
|
39 |
+
// then, if this is bool, string or number it must not be empty ( false )
|
40 |
+
if ( true === obj || "string" === typeof obj || "number" === typeof obj ) { return false; }
|
41 |
+
// check for object type to be safe
|
42 |
+
if ( "object" === typeof obj ) {
|
43 |
+
// Use a standard for in loop
|
44 |
+
for ( var x in obj ) {
|
45 |
+
// A for in will iterate over members on the prototype
|
46 |
+
// chain as well, but Object.getOwnPropertyNames returns
|
47 |
+
// only those directly on the object, so use hasOwnProperty.
|
48 |
+
if ( obj.hasOwnProperty( x ) ) {
|
49 |
+
// any value means not empty ( false )
|
50 |
+
return false;
|
51 |
+
}
|
52 |
}
|
53 |
+
// no properties, so return empty ( true )
|
54 |
+
return true;
|
55 |
+
}
|
56 |
+
// this must be an unsupported datatype, so return not empty
|
57 |
+
return false;
|
58 |
+
},
|
59 |
+
// initialize functions
|
60 |
+
theme_exists: function( testslug, testtype ) {
|
61 |
+
var exists = false;
|
62 |
+
$.each( ctcAjax.themes, function( type, theme ) {
|
63 |
+
$.each( theme, function( slug, data ) {
|
64 |
+
if ( slug == testslug && ( 'parnt' == type || 'new' == testtype ) ) {
|
65 |
+
exists = true;
|
66 |
+
return false;
|
67 |
+
}
|
68 |
+
} );
|
69 |
+
if ( exists ) return false;
|
70 |
} );
|
71 |
+
return exists;
|
72 |
+
},
|
73 |
+
|
74 |
+
validate: function() {
|
75 |
+
var self = this,
|
76 |
+
regex = /[^\w\-]/,
|
77 |
+
newslug = $( '#ctc_child_template' ).length ? $( '#ctc_child_template' )
|
78 |
+
.val().toString().replace( regex ).toLowerCase() : '',
|
79 |
+
slug = $( '#ctc_theme_child' ).length ? $( '#ctc_theme_child' )
|
80 |
+
.val().toString().replace( regex ).toLowerCase() : newslug,
|
81 |
+
type = $( 'input[name=ctc_child_type]:checked' ).val(),
|
82 |
+
errors = [];
|
83 |
+
if ( 'new' == type ) slug = newslug;
|
84 |
+
if ( self.theme_exists( slug, type ) ) {
|
85 |
+
errors.push( self.getxt( 'theme_exists' ).toString().replace( /%s/, slug ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
}
|
87 |
+
if ( '' === slug ) {
|
88 |
+
errors.push( self.getxt( 'inval_theme' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
}
|
90 |
+
if ( '' === $( '#ctc_child_name' ).val() ) {
|
91 |
+
errors.push( self.getxt( 'inval_name' ) );
|
|
|
|
|
92 |
}
|
93 |
+
if ( errors.length ) {
|
94 |
+
self.set_notice( { 'error': errors } );
|
95 |
+
return false;
|
96 |
+
}
|
97 |
+
return true;
|
98 |
+
},
|
99 |
+
|
100 |
+
autogen_slugs: function() {
|
101 |
+
if ( $( '#ctc_theme_parnt' ).length ) {
|
102 |
+
var self = this,
|
103 |
+
parent = $( '#ctc_theme_parnt' ).val(),
|
104 |
+
slug = slugbase = parent + '-child',
|
105 |
+
name = ctcAjax.themes.parnt[ parent ].Name + ' Child',
|
106 |
+
suffix = '',
|
107 |
+
padded = '',
|
108 |
+
pad = '00';
|
109 |
+
while ( self.theme_exists( slug, 'new' ) ) {
|
110 |
+
suffix = ( '' == suffix ? 2 : suffix + 1 );
|
111 |
+
padded = pad.substring( 0, pad.length - suffix.toString().length ) + suffix.toString();
|
112 |
+
slug = slugbase + padded;
|
113 |
+
}
|
114 |
+
self.testslug = slug;
|
115 |
+
self.testname = name + ( padded.length ? ' ' + padded : '' );
|
116 |
+
}
|
117 |
+
},
|
118 |
+
|
119 |
+
focus_panel: function( id ) {
|
120 |
+
var panelid = id + '_panel';
|
121 |
+
$( '.nav-tab' ).removeClass( 'nav-tab-active' );
|
122 |
+
$( '.ctc-option-panel' ).removeClass( 'ctc-option-panel-active' );
|
123 |
+
$( '.ctc-selector-container' ).hide();
|
124 |
+
$( id ).addClass( 'nav-tab-active' );
|
125 |
+
$( '.ctc-option-panel-container' ).scrollTop( 0 );
|
126 |
+
$( panelid ).addClass( 'ctc-option-panel-active' );
|
127 |
+
},
|
128 |
+
|
129 |
+
selector_input_toggle: function( obj ) {
|
130 |
+
//console.log( 'selector_input_toggle: ' + obj );
|
131 |
+
var self = this,
|
132 |
+
origval;
|
133 |
+
if ( $( '#ctc_rewrite_selector' ).length ) {
|
134 |
+
origval = $( '#ctc_rewrite_selector_orig' ).val();
|
135 |
+
$( '#ctc_sel_ovrd_selector_selected' ).text( origval );
|
136 |
+
$( obj ).text( self.getxt( 'rename' ) );
|
137 |
+
} else {
|
138 |
+
origval = $( '#ctc_sel_ovrd_selector_selected' ).text();
|
139 |
+
$( '#ctc_sel_ovrd_selector_selected' ).html(
|
140 |
+
'<textarea id="ctc_rewrite_selector"'
|
141 |
+
+ ' name="ctc_rewrite_selector" autocomplete="off"></textarea>'
|
142 |
+
+ '<input id="ctc_rewrite_selector_orig" name="ctc_rewrite_selector_orig"'
|
143 |
+
+ ' type="hidden" value="' + self.esc_quot( origval ) + '"/>' );
|
144 |
+
$( '#ctc_rewrite_selector' ).val( origval );
|
145 |
+
$( obj ).text( self.getxt( 'cancel' ) );
|
146 |
+
}
|
147 |
+
},
|
148 |
+
|
149 |
+
fade_update_notice: function() {
|
150 |
+
$( '.updated, .error' ).slideUp( 'slow', function() { $( '.updated' ).remove(); } );
|
151 |
+
},
|
152 |
+
|
153 |
+
coalesce_inputs: function( obj ) {
|
154 |
+
//console.log( 'coalesce_inputs ' + $( obj ).attr( 'id' ) );
|
155 |
+
var self = this,
|
156 |
+
regex = /^(ctc_(ovrd|\d+)_(parent|child)_([0-9a-z\-]+)_(\d+))(_\w+)?$/,
|
157 |
+
container = $( obj ).parents( '.ctc-selector-row, .ctc-parent-row' ).first(),
|
158 |
+
swatch = container.find( '.ctc-swatch' ).first(),
|
159 |
+
cssrules = { 'parent': {}, 'child': {} },
|
160 |
+
gradient = {
|
161 |
+
'parent': {
|
162 |
+
'origin': '',
|
163 |
+
'start': '',
|
164 |
+
'end': ''
|
165 |
+
},
|
166 |
+
'child': {
|
167 |
+
'origin': '',
|
168 |
+
'start': '',
|
169 |
+
'end': ''
|
170 |
+
}
|
171 |
+
},
|
172 |
+
has_gradient = { 'child': false, 'parent': false },
|
173 |
+
postdata = {};
|
174 |
+
// set up objects for all neighboring inputs
|
175 |
+
container.find( '.ctc-parent-value, .ctc-child-value' ).each( function() {
|
176 |
+
var inputid = $( this ).attr( 'id' ),
|
177 |
+
inputparts = inputid.toString().match( regex ),
|
178 |
+
inputseq = inputparts[ 2 ],
|
179 |
+
inputtheme = inputparts[ 3 ],
|
180 |
+
inputrule = ( 'undefined' == typeof inputparts[ 4 ] ? '' : inputparts[ 4 ] ),
|
181 |
+
qsid = inputparts[ 5 ],
|
182 |
+
rulepart = ( 'undefined' == typeof inputparts[ 6 ] ? '' : inputparts[ 6 ] ),
|
183 |
+
value = ( 'parent' == inputtheme ? $( this ).text().replace( /!$/, '' ) : $( this ).val() ),
|
184 |
+
important = 'ctc_' + inputseq + '_child_' + inputrule + '_i_' + qsid,
|
185 |
+
parts, subparts;
|
186 |
+
if ( !self.is_empty( $( this ).data( 'color' ) ) ) {
|
187 |
+
value = $( this ).data( 'color' );
|
188 |
+
$( this ).data( 'color', null );
|
189 |
+
}
|
190 |
+
//console.log( 'id: ' + inputid + ' value: ' + value );
|
191 |
+
if ( 'child' == inputtheme ) {
|
192 |
+
postdata[ inputid ] = value;
|
193 |
+
postdata[ important ] = ( $( '#' + important ).is( ':checked' ) ) ? 1 : 0;
|
194 |
+
}
|
195 |
+
if ( '' != value ) {
|
196 |
+
// handle specific inputs
|
197 |
+
if ( !self.is_empty( rulepart ) ) {
|
198 |
+
//console.log( 'rulepart: ' + rulepart + ' value: ' + value );
|
199 |
+
switch( rulepart ) {
|
200 |
+
case '_border_width':
|
201 |
+
cssrules[ inputtheme ][ inputrule + '-width' ] = ( 'none' == value ? 0 : value );
|
202 |
+
break;
|
203 |
+
case '_border_style':
|
204 |
+
cssrules[ inputtheme ][ inputrule + '-style' ] = value;
|
205 |
+
break;
|
206 |
+
case '_border_color':
|
207 |
+
cssrules[ inputtheme ][ inputrule + '-color' ] = value;
|
208 |
+
break;
|
209 |
+
case '_background_url':
|
210 |
+
cssrules[ inputtheme ][ 'background-image' ] = self.image_url( inputtheme, value );
|
211 |
+
break;
|
212 |
+
case '_background_color':
|
213 |
+
cssrules[ inputtheme ][ 'background-color' ] = obj.value;
|
214 |
+
break;
|
215 |
+
case '_background_color1':
|
216 |
+
gradient[ inputtheme ].start = value;
|
217 |
+
has_gradient[ inputtheme ] = true;
|
218 |
+
break;
|
219 |
+
case '_background_color2':
|
220 |
+
gradient[ inputtheme ].end = value;
|
221 |
+
has_gradient[ inputtheme ] = true;
|
222 |
+
break;
|
223 |
+
case '_background_origin':
|
224 |
+
gradient[ inputtheme ].origin = value;
|
225 |
+
has_gradient[ inputtheme ] = true;
|
226 |
+
break;
|
227 |
+
}
|
228 |
+
} else {
|
229 |
+
// handle borders
|
230 |
+
if ( parts = inputrule.toString().match( /^border(\-(top|right|bottom|left))?$/ ) && !value.match( /none/ ) ) {
|
231 |
subparts = value.toString().split( / +/ );
|
232 |
+
cssrules[ inputtheme ][ inputrule + '-width' ] = 'undefined' == typeof subparts[ 0 ] ? '' : subparts[ 0 ];
|
233 |
+
cssrules[ inputtheme ][ inputrule + '-style' ] = 'undefined' == typeof subparts[ 1 ] ? '' : subparts[ 1 ];
|
234 |
+
cssrules[ inputtheme ][ inputrule + '-color' ] = 'undefined' == typeof subparts[ 2 ] ? '' : subparts[ 2 ];
|
235 |
+
// handle background images
|
236 |
+
} else if ( 'background-image' == inputrule && !value.match( /none/ ) ) {
|
237 |
+
if ( value.toString().match( /url\(/ ) ) {
|
238 |
+
cssrules[ inputtheme ][ 'background-image' ] = self.image_url( inputtheme, value );
|
239 |
} else {
|
240 |
+
subparts = value.toString().split( / +/ );
|
241 |
+
if ( subparts.length > 2 ) {
|
242 |
+
gradient[ inputtheme ].origin = 'undefined' == typeof subparts[ 0 ] ? 'top' : subparts[ 0 ];
|
243 |
+
gradient[ inputtheme ].start = 'undefined' == typeof subparts[ 1 ] ? 'transparent' : subparts[ 1 ];
|
244 |
+
gradient[ inputtheme ].end = 'undefined' == typeof subparts[ 2 ] ? 'transparent' : subparts[ 2 ];
|
245 |
+
has_gradient[ inputtheme ] = true;
|
246 |
+
} else {
|
247 |
+
cssrules[ inputtheme ][ 'background-image' ] = value;
|
248 |
+
}
|
249 |
}
|
250 |
+
} else if ( 'seq' != inputrule ) {
|
251 |
+
cssrules[ inputtheme ][ inputrule ] = value;
|
252 |
}
|
|
|
|
|
253 |
}
|
254 |
}
|
255 |
+
} );
|
256 |
+
// update swatch
|
257 |
+
if ( 'undefined' != typeof swatch && !self.is_empty( swatch.attr( 'id' ) ) ) {
|
258 |
+
swatch.removeAttr( 'style' );
|
259 |
+
if ( has_gradient.parent ) {
|
260 |
+
swatch.ctcgrad( gradient.parent.origin, [ gradient.parent.start, gradient.parent.end ] );
|
261 |
+
}
|
262 |
+
swatch.css( cssrules.parent );
|
263 |
+
if ( !( swatch.attr( 'id' ).toString().match( /parent/ ) ) ) {
|
264 |
+
if ( has_gradient.child ) {
|
265 |
+
swatch.ctcgrad( gradient.child.origin, [ gradient.child.start, gradient.child.end ] );
|
266 |
+
}
|
267 |
+
swatch.css( cssrules.child );
|
268 |
+
}
|
269 |
+
swatch.css( {'z-index':-1} );
|
270 |
}
|
271 |
+
return postdata;
|
272 |
+
},
|
273 |
+
|
274 |
+
decode_value: function( rule, value ) {
|
275 |
+
value = ( 'undefined' == typeof value ? '' : value );
|
276 |
+
var self = this,
|
277 |
+
obj = { 'orig': value };
|
278 |
+
if ( rule.toString().match( /^border(\-(top|right|bottom|left))?$/ ) ) {
|
279 |
+
var params = value.toString().split( / +/ );
|
280 |
+
obj[ 'names' ] = [
|
281 |
+
'_border_width',
|
282 |
+
'_border_style',
|
283 |
+
'_border_color',
|
284 |
+
];
|
285 |
+
obj[ 'values' ] = [
|
286 |
+
( 'undefined' == typeof params[ 0 ] ? '' : params[ 0 ] ),
|
287 |
+
( 'undefined' == typeof params[ 1 ] ? '' : params[ 1 ] ),
|
288 |
+
( 'undefined' == typeof params[ 2 ] ? '' : params[ 2 ] )
|
289 |
+
];
|
290 |
+
} else if ( rule.toString().match( /^background\-image/ ) ) {
|
291 |
+
obj[ 'names' ] = [
|
292 |
+
'_background_url',
|
293 |
+
'_background_origin',
|
294 |
+
'_background_color1',
|
295 |
+
'_background_color2'
|
296 |
+
];
|
297 |
+
obj[ 'values' ] = [ '', '', '', '' ];
|
298 |
+
if ( false === ( self.is_empty( value ) ) && !( value.toString().match( /(url|none)/ ) ) ) {
|
299 |
+
var params = value.toString().split( /:/ );
|
300 |
+
obj[ 'values' ][ 1 ] = ( 'undefined' == typeof params[ 0 ] ? '' : params[ 0 ] );
|
301 |
+
obj[ 'values' ][ 2 ] = ( 'undefined' == typeof params[ 1 ] ? '' : params[ 1 ] );
|
302 |
+
obj[ 'values' ][ 3 ] = ( 'undefined' == typeof params[ 3 ] ? '' : params[ 3 ] );
|
303 |
+
obj[ 'orig' ] = [
|
304 |
+
obj[ 'values' ][ 1 ],
|
305 |
+
obj[ 'values' ][ 2 ],
|
306 |
+
obj[ 'values' ][ 3 ]
|
307 |
+
].join( ' ' );
|
308 |
+
} else {
|
309 |
+
obj[ 'values' ][ 0 ] = value;
|
310 |
+
}
|
|
|
|
|
|
|
|
|
311 |
} else {
|
312 |
+
obj[ 'names' ] = [ '' ];
|
313 |
+
obj[ 'values' ] = [ value ];
|
314 |
}
|
315 |
+
return obj;
|
316 |
+
},
|
317 |
+
|
318 |
+
image_url: function( theme, value ) {
|
319 |
+
var self = this,
|
320 |
+
parts = value.toString().match( /url\(['" ]*(.+?)['" ]*\)/ ),
|
321 |
+
path = self.is_empty( parts ) ? null : parts[ 1 ],
|
322 |
+
url = ctcAjax.theme_uri + '/' + ( 'parent' == theme ? ctcAjax.parnt : ctcAjax.child ) + '/',
|
323 |
+
image_url;
|
324 |
+
if ( !path ) {
|
325 |
+
return false;
|
326 |
+
} else if ( path.toString().match( /^(data:|https?:|\/)/ ) ) {
|
327 |
+
image_url = value;
|
328 |
+
} else {
|
329 |
+
image_url = 'url(' + url + path + ')';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
330 |
}
|
331 |
+
return image_url;
|
332 |
+
},
|
|
|
|
|
|
|
|
|
|
|
333 |
|
334 |
+
setup_menus: function() {
|
335 |
+
var self = this;
|
336 |
+
//console.log( 'setup_menus' );
|
337 |
+
self.setup_query_menu();
|
338 |
+
self.setup_selector_menu();
|
339 |
+
self.setup_rule_menu();
|
340 |
+
self.setup_new_rule_menu();
|
341 |
+
self.load_queries();
|
342 |
+
self.load_rules();
|
343 |
+
// selectors will be loaded after query selected
|
344 |
+
self.set_query( self.current_query );
|
345 |
+
},
|
346 |
+
|
347 |
+
load_queries: function() {
|
348 |
+
var self = this;
|
349 |
+
//console.log( 'load_queries' );
|
350 |
+
// retrieve unique media queries
|
351 |
+
self.query_css( 'queries', null );
|
352 |
+
},
|
353 |
+
|
354 |
+
load_selectors: function() {
|
355 |
+
var self = this;
|
356 |
+
//console.log( 'load_selectors' );
|
357 |
+
// retrieve unique selectors from query value
|
358 |
+
self.query_css( 'selectors', self.current_query );
|
359 |
+
},
|
360 |
+
|
361 |
+
load_rules: function() {
|
362 |
+
var self = this;
|
363 |
+
//console.log( 'load_rules' );
|
364 |
+
// retrieve all unique rules
|
365 |
+
self.query_css( 'rules', null );
|
366 |
+
},
|
367 |
+
|
368 |
+
load_selector_values: function() {
|
369 |
+
var self = this;
|
370 |
+
//console.log( 'load_selector_values: ' + self.current_qsid );
|
371 |
+
// retrieve individual values from qsid
|
372 |
+
self.query_css( 'qsid', self.current_qsid );
|
373 |
+
},
|
374 |
+
|
375 |
+
get_queries: function( request, response ) {
|
376 |
+
//console.log( 'get_queries' );
|
377 |
+
//console.log( this );
|
378 |
+
var arr = [],
|
379 |
+
matcher = new RegExp( $.ui.autocomplete.escapeRegex( request.term ), "i" );
|
380 |
+
|
381 |
+
// note: key = ndx, value = query name
|
382 |
+
$.each( this.element.data( 'menu' ), function( key, val ) {
|
383 |
+
if ( matcher.test( val ) ) {
|
384 |
+
arr.push( { 'label': val, 'value': val } );
|
385 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
386 |
} );
|
387 |
+
|
388 |
+
response( arr );
|
389 |
+
},
|
390 |
+
|
391 |
+
get_selectors: function( request, response ) {
|
392 |
+
//console.log( 'get_selectors' );
|
393 |
+
var arr = [],
|
394 |
+
matcher = new RegExp( $.ui.autocomplete.escapeRegex( request.term ), "i" );
|
395 |
+
// note: key = selector name, value = qsid
|
396 |
+
$.each( this.element.data( 'menu' ), function( key, val ) {
|
397 |
+
if ( matcher.test( key ) ) {
|
398 |
+
arr.push( { 'label': key, 'value': val } );
|
399 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
400 |
} );
|
401 |
+
response( arr );
|
402 |
+
},
|
403 |
+
|
404 |
+
get_rules: function( request, response ) {
|
405 |
+
//console.log( 'get_rules' );
|
406 |
+
var arr = [],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
407 |
matcher = new RegExp( $.ui.autocomplete.escapeRegex( request.term ), "i" );
|
408 |
+
// note: key = ruleid, value = rule name
|
409 |
+
$.each( this.element.data( 'menu' ), function( key, val ) {
|
410 |
+
if ( matcher.test( key ) ) {
|
411 |
+
arr.push( { 'label': key, 'value': val } );
|
412 |
+
}
|
413 |
+
} );
|
414 |
+
response( arr );
|
415 |
+
},
|
416 |
+
|
417 |
+
get_filtered_rules: function( request, response ) {
|
418 |
+
//console.log( 'get_filtered_rules' );
|
419 |
+
var arr = [],
|
420 |
+
matcher = new RegExp( $.ui.autocomplete.escapeRegex( request.term ), "i" ),
|
421 |
+
data = $.chldthmcfg.current_qsdata,
|
422 |
+
noval = ( $.chldthmcfg.is_empty( data ) ) || ( $.chldthmcfg.is_empty( data.value ) );
|
423 |
+
$.each( $( '#ctc_rule_menu' ).data( 'menu' ), function( key, val ) {
|
424 |
+
var skip = false;
|
425 |
+
if ( matcher.test( key ) ) {
|
426 |
+
if ( !noval ) {
|
427 |
+
// skip rule if in current selector array
|
428 |
+
$.each( data.value, function( rule, value ) {
|
429 |
+
if ( key == rule.replace( /\d+/g, self.from_ascii ) ) {
|
430 |
+
skip = true;
|
431 |
+
return false;
|
432 |
+
}
|
433 |
+
} );
|
434 |
+
if ( skip ) {
|
435 |
+
return;
|
436 |
}
|
|
|
|
|
|
|
437 |
}
|
438 |
+
arr.push( { 'label': key, 'value': val } );
|
439 |
}
|
440 |
+
} );
|
441 |
+
response( arr );
|
442 |
+
},
|
443 |
+
|
444 |
+
/**
|
445 |
+
* render individual row of inputs for a given selector/rule combination
|
446 |
+
*/
|
447 |
+
input_row: function( qsid, rule, seq, data ) {
|
448 |
+
//console.log( 'input_row: ' + qsid + ' rule: ' + rule + ' seq: ' + seq );
|
449 |
+
var self = this,
|
450 |
+
html = '',
|
451 |
+
value = ( self.is_empty( data ) || self.is_empty( data.value ) || self.is_empty( data.value[ rule ] ) ?
|
452 |
+
'' : data.value[ rule ] ),
|
453 |
+
parentObj = self.decode_value( rule, ( self.is_empty( value ) ?
|
454 |
+
'' : value.parnt ) ),
|
455 |
+
parentImp = ( !self.is_empty( value ) && !self.is_empty( value.i_parnt ) && 1 == value.i_parnt ) ?
|
456 |
+
self.getxt( 'important' ) : '',
|
457 |
+
childObj = self.decode_value( rule, ( self.is_empty( value ) ?
|
458 |
+
'' : value[ 'child' ] ) ),
|
459 |
+
childImp = ( !self.is_empty( value ) && !self.is_empty( value.i_child ) && 1 == value.i_child ) ? 1 : 0,
|
460 |
+
impid = 'ctc_' + seq + '_child_' + rule + '_i_' + qsid;
|
461 |
+
if ( !self.is_empty( data ) ) {
|
462 |
+
html += '<div class="ctc-' + ( 'ovrd' == seq ? 'input' : 'selector' )
|
463 |
+
+ '-row clearfix">' + "\n" + '<div class="ctc-input-cell">'
|
464 |
+
+ ( 'ovrd' == seq ? rule.replace( /\d+/g, self.from_ascii ) :
|
465 |
+
data.selector + '<br/><a href="#" class="ctc-selector-edit"'
|
466 |
+
+ ' id="ctc_selector_edit_' + qsid + '" >' + self.getxt( 'edit' ) + '</a> '
|
467 |
+
+ ( self.is_empty( parentObj.orig ) ? self.getxt( 'child_only' ) : '' ) )
|
468 |
+
+ '</div>' + "\n";
|
469 |
+
if ( 'ovrd' == seq ) {
|
470 |
+
html += '<div class="ctc-parent-value ctc-input-cell"'
|
471 |
+
+ ' id="ctc_' + seq + '_parent_' + rule + '_' + qsid + '">'
|
472 |
+
+ ( self.is_empty( parentObj.orig ) ? '[no value]' : parentObj.orig + parentImp )
|
473 |
+
+ '</div>' + "\n";
|
474 |
+
}
|
475 |
+
html += '<div class="ctc-input-cell">' + "\n";
|
476 |
+
if ( !self.is_empty( parentObj.names ) ) {
|
477 |
+
$.each( parentObj.names, function( ndx, newname ) {
|
478 |
+
newname = ( self.is_empty( newname ) ? '' : newname );
|
479 |
+
html += '<div class="ctc-child-input-cell">' + "\n";
|
480 |
+
var id = 'ctc_' + seq + '_child_' + rule + '_' + qsid + newname,
|
481 |
+
newval;
|
482 |
+
if ( false === ( newval = childObj.values.shift() ) ) {
|
483 |
+
newval = '';
|
484 |
+
}
|
485 |
+
|
486 |
+
html += ( self.is_empty( newname ) ? '' : self.getxt( newname ) + ':<br/>' )
|
487 |
+
+ '<input type="text" id="' + id + '" name="' + id + '" class="ctc-child-value'
|
488 |
+
+ ( ( newname + rule ).toString().match( /color/ ) ? ' color-picker' : '' )
|
489 |
+
+ ( ( newname ).toString().match( /url/ ) ? ' ctc-input-wide' : '' )
|
490 |
+
+ '" value="' + self.esc_quot( newval ) + '" />' + "\n" + '</div>' + "\n";
|
491 |
+
} );
|
492 |
+
html += '<label for="' + impid + '"><input type="checkbox"'
|
493 |
+
+ ' id="' + impid + '" name="' + impid + '" value="1" '
|
494 |
+
+ ( 1 === childImp ? 'checked' : '' ) + ' />'
|
495 |
+
+ self.getxt( 'important' ) + '</label>' + "\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
496 |
}
|
497 |
+
html += '</div>' + "\n" + ( 'ovrd' == seq ? '' :
|
498 |
+
'<div class="ctc-swatch ctc-specific"'
|
499 |
+
+ ' id="ctc_child_' + rule + '_' + qsid + '_swatch">'
|
500 |
+
+ self.getxt( 'swatch' ) + '</div>' + "\n"
|
501 |
+
+ '<div class="ctc-child-input-cell ctc-button-cell"'
|
502 |
+
+ ' id="ctc_save_' + rule + '_' + qsid + '_cell">' + "\n"
|
503 |
+
+ '<input type="button" class="button ctc-save-input"'
|
504 |
+
+ ' id="ctc_save_' + rule + '_' + qsid + '"'
|
505 |
+
+ ' name="ctc_save_' + rule + '_' + qsid + '"'
|
506 |
+
+ ' value="Save" /></div>' + "\n" )
|
507 |
+
+ '</div><!-- end input row -->' + "\n";
|
508 |
+
//console.log( html );
|
509 |
+
} else {
|
510 |
+
//console.log( 'sel_val ' + qsid + ' is empty' );
|
511 |
}
|
512 |
+
return html;
|
513 |
+
},
|
514 |
+
|
515 |
+
scrolltop: function() {
|
516 |
+
$('html, body, .ctc-option-panel-container').animate( { scrollTop: 0 } );
|
517 |
+
},
|
518 |
+
|
519 |
+
css_preview: function( theme ) {
|
520 |
+
var self = this,
|
521 |
+
theme;
|
522 |
+
//console.log( 'css_preview: ' + theme );
|
523 |
+
if ( !( theme = theme.match( /(child|parnt)/ )[ 1 ] ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
524 |
theme = 'child';
|
525 |
}
|
526 |
+
// retrieve raw stylesheet ( parent or child )
|
527 |
+
self.query_css( 'preview', theme );
|
528 |
+
},
|
529 |
+
|
530 |
+
/**
|
531 |
+
* The "setup" functions initialize jQuery UI widgets
|
532 |
+
*/
|
533 |
+
setup_iris: function( obj ) {
|
534 |
+
var self = this;
|
535 |
+
try {
|
536 |
+
$( obj ).iris( {
|
537 |
+
change: function( e, ui ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
538 |
|
539 |
+
$( obj ).data( 'color', ui.color.toString() );
|
540 |
+
self.coalesce_inputs( obj );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
541 |
}
|
542 |
} );
|
543 |
+
} catch ( exn ) {
|
544 |
+
self.jquery_exception( exn, 'Iris Color Picker' );
|
545 |
+
}
|
546 |
+
},
|
547 |
+
|
548 |
+
setup_query_menu: function() {
|
549 |
+
var self = this;
|
550 |
+
//console.log( 'setup_query_menu' );
|
551 |
+
try {
|
552 |
+
$( '#ctc_sel_ovrd_query' ).autocomplete( {
|
553 |
+
source: self.get_queries,
|
554 |
+
minLength: 0,
|
555 |
+
selectFirst: true,
|
556 |
+
autoFocus: true,
|
557 |
+
select: function( e, ui ) {
|
558 |
+
self.set_query( ui.item.value );
|
559 |
+
return false;
|
560 |
+
},
|
561 |
+
focus: function( e ) {
|
562 |
+
e.preventDefault();
|
563 |
+
}
|
564 |
+
} ).data( 'menu' , {} );
|
565 |
+
} catch ( exn ) {
|
566 |
+
self.jquery_exception( exn, 'Query Menu' );
|
567 |
+
}
|
568 |
+
},
|
569 |
+
|
570 |
+
setup_selector_menu: function() {
|
571 |
+
var self = this;
|
572 |
+
//console.log( 'setup_selector_menu' );
|
573 |
+
try {
|
574 |
+
$( '#ctc_sel_ovrd_selector' ).autocomplete( {
|
575 |
+
source: self.get_selectors,
|
576 |
+
selectFirst: true,
|
577 |
+
autoFocus: true,
|
578 |
+
select: function( e, ui ) {
|
579 |
+
self.set_selector( ui.item.value, ui.item.label );
|
580 |
+
return false;
|
581 |
+
},
|
582 |
+
focus: function( e ) {
|
583 |
+
e.preventDefault();
|
584 |
+
}
|
585 |
+
} ).data( 'menu' , {} );
|
586 |
+
} catch ( exn ) {
|
587 |
+
self.jquery_exception( exn, 'Selector Menu' );
|
588 |
+
}
|
589 |
+
},
|
590 |
+
|
591 |
+
setup_rule_menu: function() {
|
592 |
+
var self = this;
|
593 |
+
//console.log( 'setup_rule_menu' );
|
594 |
+
try {
|
595 |
+
$( '#ctc_rule_menu' ).autocomplete( {
|
596 |
+
source: self.get_rules,
|
597 |
+
//minLength: 0,
|
598 |
selectFirst: true,
|
599 |
autoFocus: true,
|
600 |
select: function( e, ui ) {
|
601 |
+
self.set_rule( ui.item.value, ui.item.label );
|
602 |
return false;
|
603 |
},
|
604 |
focus: function( e ) {
|
605 |
e.preventDefault();
|
606 |
}
|
607 |
+
} ).data( 'menu' , {} );
|
608 |
+
} catch ( exn ) {
|
609 |
+
self.jquery_exception( exn, 'Rule Menu' );
|
610 |
+
}
|
611 |
+
},
|
612 |
+
|
613 |
+
setup_new_rule_menu: function() {
|
614 |
+
var self = this;
|
615 |
+
try {
|
616 |
+
$( '#ctc_new_rule_menu' ).autocomplete( {
|
617 |
+
source: self.get_filtered_rules,
|
618 |
+
//minLength: 0,
|
619 |
selectFirst: true,
|
620 |
autoFocus: true,
|
621 |
select: function( e, ui ) {
|
622 |
+
e.preventDefault();
|
623 |
+
if ( self.is_empty( self.current_qsdata.value ) ) {
|
624 |
+
self.current_qsdata[ 'value' ] = {};
|
625 |
+
}
|
626 |
+
self.current_qsdata.value[ ui.item.label ] = { 'child': '' };
|
627 |
+
var newrule = ui.item.label.replace( /[^\w\-]/g, self.to_ascii ),
|
628 |
+
n = $( self.input_row( self.current_qsid, newrule, 'ovrd', self.current_qsdata ) );
|
629 |
+
$( '#ctc_sel_ovrd_rule_inputs' ).append( n );
|
630 |
+
$( '#ctc_new_rule_menu' ).val( '' );
|
631 |
+
|
632 |
+
n.find( 'input[type="text"]' ).each( function( ndx, el ) {
|
633 |
+
if ( $( el ).hasClass( 'color-picker' ) )
|
634 |
+
self.setup_iris( el );
|
635 |
+
$( el ).focus();
|
636 |
+
} );
|
637 |
+
if ( self.jquery_err.length ) self.jquery_notice();
|
638 |
return false;
|
639 |
},
|
640 |
+
focus: function( e ) {
|
641 |
+
e.preventDefault();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
642 |
}
|
643 |
+
} ).data( 'menu' , {} );
|
644 |
+
} catch ( exn ) {
|
645 |
+
self.jquery_exception( exn, 'New Rule Menu' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
646 |
}
|
647 |
+
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
648 |
|
649 |
+
set_existing: function() {
|
650 |
+
var self = this;
|
651 |
+
if ( $( '#ctc_theme_child' ).length && $( '#ctc_child_type_existing' ).is( ':checked' ) ) {
|
652 |
+
var child = $( '#ctc_theme_child' ).val();
|
653 |
+
if ( !self.is_empty( child ) ) {
|
654 |
+
$( '#ctc_child_name' ).val( ctcAjax.themes[ 'child' ][ child ].Name );
|
655 |
+
$( '#ctc_child_author' ).val( ctcAjax.themes[ 'child' ][ child ].Author );
|
656 |
+
$( '#ctc_child_version' ).val( ctcAjax.themes[ 'child' ][ child ].Version );
|
657 |
+
$( '#ctc_child_authoruri' ).val( ctcAjax.themes[ 'child' ][ child ].AuthorURI );
|
658 |
+
$( '#ctc_child_themeuri' ).val( ctcAjax.themes[ 'child' ][ child ].ThemeURI );
|
659 |
+
$( '#ctc_child_descr' ).val( ctcAjax.themes[ 'child' ][ child ].Descr );
|
660 |
+
$( '#ctc_child_tags' ).val( ctcAjax.themes[ 'child' ][ child ].Tags );
|
|
|
|
|
|
|
|
|
661 |
}
|
662 |
+
}
|
663 |
+
},
|
664 |
+
|
665 |
+
set_notice: function( noticearr ) {
|
666 |
+
var self = this,
|
667 |
+
errorHtml = '';
|
668 |
+
if ( !self.is_empty( noticearr ) ) {
|
669 |
+
$.each( noticearr, function( type, list ) {
|
670 |
+
errorHtml += '<div class="' + type + '"><ul>' + "\n";
|
671 |
+
$( list ).each( function( ndx, el ) {
|
672 |
+
errorHtml += '<li>' + el.toString() + '</li>' + "\n";
|
673 |
+
} );
|
674 |
+
errorHtml += '</ul></div>';
|
675 |
} );
|
676 |
+
}
|
677 |
+
$( '#ctc_error_notice' ).html( errorHtml );
|
678 |
+
$('html, body').animate({ scrollTop: 0 }, 'slow');
|
679 |
+
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
680 |
|
681 |
+
set_parent_menu: function( obj ) {
|
682 |
+
$( '#ctc_theme_parent' ).parents( '.ctc-input-row' ).first()
|
683 |
+
.append( '<span class="ctc-status-icon spinner"></span>' );
|
684 |
+
$( '.spinner' ).show();
|
685 |
+
document.location='?page=' + ctcAjax.page + '&ctc_parent=' + obj.value;
|
686 |
+
},
|
687 |
+
|
688 |
+
set_child_menu: function( obj ) {
|
689 |
+
var self = this;
|
690 |
+
if ( !self.is_empty( ctcAjax.themes.child[ obj.value ] ) ) {
|
691 |
+
$( '#ctc_child_name' ).val( ctcAjax.themes.child[ obj.value ].Name );
|
692 |
+
$( '#ctc_child_author' ).val( ctcAjax.themes.child[ obj.value ].Author );
|
693 |
+
$( '#ctc_child_version' ).val( ctcAjax.themes.child[ obj.value ].Version );
|
694 |
+
}
|
695 |
+
},
|
696 |
+
|
697 |
+
set_query: function( value ) {
|
698 |
+
var self = this;
|
699 |
+
//console.log( 'set_query: ' + value );
|
700 |
+
self.current_query = value;
|
701 |
+
$( '#ctc_sel_ovrd_query' ).val( '' );
|
702 |
+
$( '#ctc_sel_ovrd_query_selected' ).text( value );
|
703 |
+
$( '#ctc_sel_ovrd_selector' ).val( '' );
|
704 |
+
$( '#ctc_sel_ovrd_selector_selected' ).html( ' ' );
|
705 |
+
//$( '#ctc_sel_ovrd_rule_inputs' ).html( '' );
|
706 |
+
self.load_selectors();
|
707 |
+
},
|
708 |
+
|
709 |
+
set_selector: function( value, label ) {
|
710 |
+
var self = this;
|
711 |
+
//console.log( 'set_selector: ' + value + ' label: ' + label );
|
712 |
+
$( '#ctc_sel_ovrd_selector' ).val( '' );
|
713 |
+
self.current_qsid = value;
|
714 |
+
self.reload_menus = false;
|
715 |
+
self.load_selector_values();
|
716 |
+
},
|
717 |
+
|
718 |
+
set_rule: function( value, label ) {
|
719 |
+
//console.log( 'set_rule: ' + value + ' label: ' + label );
|
720 |
+
var self = this;
|
721 |
+
$( '#ctc_rule_menu' ).val( '' );
|
722 |
+
$( '#ctc_rule_menu_selected' ).text( label );
|
723 |
+
$( '.ctc-rewrite-toggle' ).text( self.getxt( 'rename' ) );
|
724 |
+
$( '#ctc_rule_value_inputs, #ctc_input_row_rule_header' ).show();
|
725 |
+
// retrieve unique values by rule
|
726 |
+
self.query_css( 'rule_val', value );
|
727 |
+
},
|
728 |
+
|
729 |
+
set_qsid: function( obj ) {
|
730 |
+
var self = this;
|
731 |
+
//console.log( 'set_qsid: ' + $( obj ).attr( 'id' ) );
|
732 |
+
self.current_qsid = $( obj ).attr( 'id' ).match( /_(\d+)$/ )[ 1 ];
|
733 |
+
self.focus_panel( '#query_selector_options' );
|
734 |
+
self.reload_menus = true;
|
735 |
+
self.load_selector_values();
|
736 |
+
},
|
737 |
+
|
738 |
+
/**
|
739 |
+
* slurp website home page and parse header for linked stylesheets
|
740 |
+
* set these to be parsed as "default" stylesheets
|
741 |
+
*/
|
742 |
+
set_addl_css: function() {
|
743 |
+
//console.log( 'set_addl_css' );
|
744 |
+
var self = this,
|
745 |
+
template = $( '#ctc_theme_parnt' ).val(),
|
746 |
+
theme_uri = ctcAjax.theme_uri.replace( /^https?:\/\//, '' ),
|
747 |
+
homeurl = ctcAjax.homeurl.replace( /^https?/, ctcAjax.ssl ? 'https' : 'http' ),
|
748 |
+
url = homeurl + '?preview=1&p=x&template=' + template + '&stylesheet=' + template,
|
749 |
+
regex = new RegExp( "<link rel=[\"']stylesheet[\"'][^>]+?"
|
750 |
+
+ theme_uri + '/' + template + '/(.+?\\.css)[^>]+?>', 'g' ),
|
751 |
+
additional;
|
752 |
+
if ( self.is_empty( template ) ) return;
|
753 |
+
//console.log( template );
|
754 |
+
if ( template != ctcAjax.parnt ) {
|
755 |
+
$.get( url, function( data ) {
|
756 |
+
//console.log( data );
|
757 |
+
while ( additional = regex.exec( data ) ) {
|
758 |
+
//console.log( additional );
|
759 |
+
if ( 'style.css' == additional[ 1 ] ) break; // bail after main stylesheet
|
760 |
+
if ( additional[ 1 ].match( /bootstrap/ ) ) continue; // don't autoselect Bootstrap stylesheets
|
761 |
+
$( '.ctc_checkbox' ).each( function( ndx, el ) {
|
762 |
+
if ( $( this ).val() == additional[ 1 ] ) $( this ).prop( 'checked', true );
|
763 |
+
} );
|
764 |
}
|
765 |
+
data = null; // send page to garbage
|
766 |
+
} );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
767 |
} else {
|
768 |
+
//console.log('existing... using addl_css array');
|
769 |
+
$( ctcAjax.addl_css ).each( function( ndx, el ) {
|
770 |
+
$( '#ctc_stylesheet_files .ctc_checkbox' ).each( function( index, elem ) {
|
771 |
+
if ( $( this ).val() == el ) $( this ).prop( 'checked', true );
|
772 |
+
} );
|
773 |
+
} );
|
774 |
}
|
775 |
+
},
|
776 |
+
|
777 |
+
/**
|
778 |
+
* Retrieve data from server and execute callback on completion
|
779 |
+
*/
|
780 |
+
query_css: function( obj, key, params ) {
|
781 |
+
//console.log( 'query_css: ' + obj + ' key: ' + key );
|
782 |
+
var self = this,
|
783 |
+
postdata = { 'ctc_query_obj' : obj, 'ctc_query_key': key },
|
784 |
+
status_sel = '#ctc_status_' + obj + ( 'val_qry' == obj ? '_' + key : '' );
|
785 |
|
786 |
+
if ( 'object' === typeof params ) {
|
787 |
+
$.each( params, function( key, val ) {
|
788 |
+
postdata[ 'ctc_query_' + key ] = val;
|
789 |
+
} );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
790 |
}
|
791 |
+
$( '.query-icon' ).remove();
|
792 |
+
//console.log( status_sel + ' ' + $( status_sel ).length );
|
793 |
+
$( status_sel + ' .ctc-status-icon' ).remove();
|
794 |
+
$( status_sel ).append( '<span class="ctc-status-icon spinner query-icon"></span>' );
|
795 |
+
$( '.spinner' ).show();
|
796 |
+
// add wp ajax action to array
|
797 |
+
//console.log( $( '#ctc_action' ).val() );
|
798 |
+
postdata[ 'action' ] = ( !self.is_empty( $( '#ctc_action' ).val() )
|
799 |
+
&& 'plugin' == $( '#ctc_action' ).val() ) ?
|
800 |
+
'ctc_plgqry' : 'ctc_query';
|
801 |
+
postdata[ '_wpnonce' ] = $( '#_wpnonce' ).val();
|
802 |
+
// ajax post input data
|
803 |
+
//console.log( 'query_css postdata:' );
|
804 |
+
//console.log( postdata );
|
805 |
+
self.ajax_post( obj, postdata );
|
806 |
+
},
|
807 |
+
/**
|
808 |
+
* Post data to server for saving and execute callback on completion
|
809 |
+
*/
|
810 |
+
save: function( obj ) {
|
811 |
+
//console.log( 'save: ' + $( obj ).attr( 'id' ) );
|
812 |
+
var self = this,
|
813 |
+
url = ctcAjax.ajaxurl, // get ajax url from localized object
|
814 |
+
postdata = {},
|
815 |
+
$selector, $query, $imports, $rule,
|
816 |
+
id = $( obj ).attr( 'id' ), newsel, origsel;
|
817 |
+
|
818 |
+
// disable the button until ajax returns
|
819 |
+
$( obj ).prop( 'disabled', true );
|
820 |
+
// clear previous success/fail icons
|
821 |
+
$( '.ctc-status-icon' ).remove();
|
822 |
+
// show spinner
|
823 |
+
$( obj ).parent( '.ctc-textarea-button-cell, .ctc-button-cell' )
|
824 |
+
.append( '<span class="ctc-status-icon spinner save-icon"></span>' );
|
825 |
+
if ( id.match( /ctc_configtype/ ) ) {
|
826 |
+
$( obj ).parents( '.ctc-input-row' ).first()
|
827 |
+
.append( '<span class="ctc-status-icon spinner save-icon"></span>' );
|
828 |
+
postdata[ 'ctc_configtype' ] = $( obj ).val();
|
829 |
+
} else if ( ( $selector = $( '#ctc_new_selectors' ) )
|
830 |
+
&& 'ctc_save_new_selectors' == $( obj ).attr( 'id' ) ) {
|
831 |
+
postdata[ 'ctc_new_selectors' ] = $selector.val();
|
832 |
+
if ( $query = $( '#ctc_sel_ovrd_query_selected' ) ) {
|
833 |
+
postdata[ 'ctc_sel_ovrd_query' ] = $query.text();
|
834 |
+
}
|
835 |
+
self.reload_menus = true;
|
836 |
+
} else if ( ( $imports = $( '#ctc_child_imports' ) )
|
837 |
+
&& 'ctc_save_imports' == $( obj ).attr( 'id' ) ) {
|
838 |
+
postdata[ 'ctc_child_imports' ] = $imports.val();
|
839 |
+
} else if ( 'ctc_is_debug' == $( obj ).attr( 'id' ) ) {
|
840 |
+
postdata[ 'ctc_is_debug' ] = $( '#ctc_is_debug' ).is( ':checked' ) ? 1 : 0;
|
841 |
} else {
|
842 |
+
// coalesce inputs
|
843 |
+
postdata = self.coalesce_inputs( obj );
|
844 |
}
|
845 |
+
$( '.save-icon' ).show();
|
846 |
+
// add rename selector value if it exists
|
847 |
+
$( '#ctc_sel_ovrd_selector_selected' )
|
848 |
+
.find( '#ctc_rewrite_selector' ).each( function() {
|
849 |
+
newsel = $( '#ctc_rewrite_selector' ).val();
|
850 |
+
origsel = $( '#ctc_rewrite_selector_orig' ).val();
|
851 |
+
if ( self.is_empty( newsel ) || !newsel.toString().match( /\w/ ) ) {
|
852 |
+
newsel = origsel;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
853 |
} else {
|
854 |
+
postdata[ 'ctc_rewrite_selector' ] = newsel;
|
855 |
+
self.reload_menus = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
856 |
}
|
857 |
+
$( '.ctc-rewrite-toggle' ).text( self.getxt( 'rename' ) );
|
858 |
+
$( '#ctc_sel_ovrd_selector_selected' ).html( newsel );
|
859 |
+
} );
|
860 |
+
// add wp ajax action to array
|
861 |
+
//console.log( $( '#ctc_action' ).val() );
|
862 |
+
postdata[ 'action' ] = ( !self.is_empty( $( '#ctc_action' ).val() )
|
863 |
+
&& 'plugin' == $( '#ctc_action' ).val() ) ?
|
864 |
+
'ctc_plugin' : 'ctc_update';
|
865 |
+
postdata[ '_wpnonce' ] = $( '#_wpnonce' ).val();
|
866 |
+
//console.log( postdata );
|
867 |
+
// ajax post input data
|
868 |
+
self.ajax_post( 'qsid', postdata );
|
869 |
+
},
|
870 |
+
|
871 |
+
ajax_post: function( obj, data, datatype ) {
|
872 |
+
var self = this,
|
873 |
+
url = ctcAjax.ajaxurl;
|
874 |
+
//console.log( 'ajax_post: ' + obj );
|
875 |
+
//console.log( data );
|
876 |
+
// get ajax url from localized object
|
877 |
+
$.ajax( {
|
878 |
+
url: url,
|
879 |
+
data: data,
|
880 |
+
dataType: self.is_empty( datatype ) ? 'json' : datatype,
|
881 |
+
type: 'POST'
|
882 |
+
} ).done( function( response ) {
|
883 |
+
self.handle_success( obj, response );
|
884 |
+
} ).fail( function() {
|
885 |
+
self.handle_failure( obj );
|
886 |
+
} );
|
887 |
+
},
|
888 |
+
|
889 |
+
handle_failure: function( obj ) {
|
890 |
+
var self = this;
|
891 |
+
//console.log( 'handle_failure: ' + obj );
|
892 |
+
$( '.query-icon, .save-icon' ).removeClass( 'spinner' ).addClass( 'failure' );
|
893 |
+
$( 'input[type=submit], input[type=button]' ).prop( 'disabled', false );
|
894 |
+
$( '.ajax-pending' ).removeClass( 'ajax-pending' );
|
895 |
+
//FIXME: return fail text in ajax response
|
896 |
+
if ( 'preview' == obj )
|
897 |
+
$( '#view_parnt_options_panel,#view_child_options_panel' )
|
898 |
+
.text( self.getxt( 'css_fail' ) );
|
899 |
+
},
|
900 |
+
|
901 |
+
handle_success: function( obj, response ) {
|
902 |
+
var self = this;
|
903 |
+
// query response
|
904 |
+
//console.log( 'handle_success: ' + obj );
|
905 |
+
//console.log( response );
|
906 |
// hide spinner
|
907 |
+
$( '.query-icon, .save-icon' ).removeClass( 'spinner' );
|
908 |
+
$( '.ajax-pending' ).removeClass( 'ajax-pending' );
|
909 |
+
// hide spinner
|
910 |
+
if ( self.is_empty( response ) ) {
|
911 |
+
self.handle_failure( obj );
|
912 |
+
} else {
|
913 |
+
$( '#ctc_new_selectors' ).val( '' );
|
914 |
+
// update data objects
|
915 |
+
// show check mark
|
916 |
+
// FIXME: distinction between save and query, update specific status icon
|
917 |
+
$( '.query-icon, .save-icon' ).addClass( 'success' );
|
918 |
+
$( 'input[type=submit], input[type=button]' ).prop( 'disabled', false );
|
919 |
+
// update ui from each response object
|
920 |
+
$( response ).each( function() {
|
921 |
+
if ( 'function' == typeof self.update[ this.obj ] ) {
|
922 |
+
//console.log( 'executing method update.' + this.obj );
|
923 |
+
self.update[ this.obj ].call( self, this );
|
924 |
+
} else {
|
925 |
+
//console.log( 'Fail: no method update.' + this.obj );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
926 |
}
|
927 |
+
} );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
928 |
}
|
929 |
+
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
930 |
|
931 |
+
jquery_exception: function( exn, type ) {
|
932 |
+
var self = this,
|
933 |
+
ln = self.is_empty( exn.lineNumber ) ? '' : ' line: ' + exn.lineNumber,
|
934 |
+
fn = self.is_empty( exn.fileName ) ? '' : ' ' + exn.fileName.split( /\?/ )[ 0 ];
|
935 |
+
jquery_err.push( '<code><small>' + type + ': ' + exn.message + fn + ln + '</small></code>' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
936 |
},
|
937 |
+
|
938 |
+
jquery_notice: function() {
|
939 |
+
|
940 |
+
var self = this,
|
941 |
+
culprits = [],
|
942 |
+
errors = [];
|
943 |
+
// disable form submits
|
944 |
+
$( 'input[type=submit], input[type=button]' ).prop( 'disabled', true );
|
945 |
+
$( 'script' ).each( function( ndx,el ){
|
946 |
+
var url = $( this ).prop( 'src' );
|
947 |
+
if ( !self.is_empty( url ) && url.match( /jquery(\.min|\.js|\-?ui)/i )
|
948 |
+
&& ! url.match( /load\-scripts.php/ ) ) {
|
949 |
+
culprits.push( '<code><small>' + url.split( /\?/ )[ 0 ] + '</small></code>' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
950 |
}
|
951 |
} );
|
952 |
+
errors.push( '<strong>' + self.getxt( 'js' ) + '</strong>' );
|
953 |
+
if ( 1 == ctcAjax.is_debug ) {
|
954 |
+
errors.push( jquery_err.join( '<br/>' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
955 |
}
|
956 |
+
if ( culprits.length ) {
|
957 |
+
errors.push( self.getxt( 'jquery' ) + '<br/>' + culprits.join( '<br/>' ) );
|
958 |
+
}
|
959 |
+
errors.push( self.getxt( 'plugin' ) + ' ' + self.getxt( 'contact' ) );
|
960 |
+
self.set_notice( { 'error': errors } );
|
961 |
+
},
|
962 |
+
|
963 |
+
update: {
|
964 |
+
// render individual selector inputs on Query/Selector tab
|
965 |
+
qsid: function( res ) {
|
966 |
+
var self = this,
|
967 |
+
id, html, val, selector;
|
968 |
+
self.current_qsid = res.key;
|
969 |
+
self.current_qsdata = res.data;
|
970 |
+
//console.log( 'update.qsid: ' + self.current_qsid );
|
971 |
+
$( '#ctc_sel_ovrd_qsid' ).val( self.current_qsid );
|
972 |
+
if ( self.is_empty( self.current_qsdata.seq ) ) {
|
973 |
+
$( '#ctc_child_load_order_container' ).empty();
|
974 |
+
} else {
|
975 |
+
id = 'ctc_ovrd_child_seq_' + self.current_qsid;
|
976 |
+
val = parseInt( self.current_qsdata.seq );
|
977 |
+
html = '<input type="text" id="' + id + '" name="' + id + '"'
|
978 |
+
+ ' class="ctc-child-value" value="' + val + '" />';
|
979 |
+
$( '#ctc_child_load_order_container' ).html( html );
|
980 |
+
}
|
981 |
+
if ( self.is_empty( self.current_qsdata.value ) ) {
|
982 |
+
$( '#ctc_sel_ovrd_selector_selected' ).empty();
|
983 |
+
$( '.ctc-rewrite-toggle' ).empty();
|
984 |
+
$( '#ctc_sel_ovrd_new_rule,'
|
985 |
+
+ '#ctc_sel_ovrd_rule_header,'
|
986 |
+
+ '#ctc_sel_ovrd_rule_inputs_container,'
|
987 |
+
+ '#ctc_sel_ovrd_rule_inputs,'
|
988 |
+
+ '.ctc-rewrite-toggle' ).hide();
|
989 |
+
$( '#ctc_sel_ovrd_rule_inputs' ).empty();
|
990 |
+
} else {
|
991 |
+
html = '';
|
992 |
+
$.each( self.current_qsdata.value, function( rule, value ) {
|
993 |
+
html += self.input_row( self.current_qsid, rule, 'ovrd', self.current_qsdata );
|
994 |
+
} );
|
995 |
+
$( '#ctc_sel_ovrd_rule_inputs' ).html( html ).find( '.color-picker' ).each( function() {
|
996 |
+
self.setup_iris( this );
|
997 |
+
} );
|
998 |
+
self.coalesce_inputs( '#ctc_child_all_0_swatch' );
|
999 |
+
if ( self.jquery_err.length ) {
|
1000 |
+
self.jquery_notice();
|
1001 |
+
} else {
|
1002 |
+
//console.log( 'reload menus: ' + ( self.reload_menus ? 'true' : 'false' ) );
|
1003 |
+
if ( self.reload_menus ) {
|
1004 |
+
self.set_query( self.current_qsdata.query );
|
1005 |
+
self.load_rules();
|
1006 |
+
}
|
1007 |
+
$( '#ctc_sel_ovrd_selector_selected' ).text( self.current_qsdata.selector );
|
1008 |
+
$( '.ctc-rewrite-toggle' ).text( self.getxt( 'rename' ) );
|
1009 |
+
$( '#ctc_sel_ovrd_new_rule,'
|
1010 |
+
+ '#ctc_sel_ovrd_rule_header,'
|
1011 |
+
+ '#ctc_sel_ovrd_rule_inputs_container,'
|
1012 |
+
+ '#ctc_sel_ovrd_rule_inputs,'
|
1013 |
+
+ '.ctc-rewrite-toggle' ).show();
|
1014 |
+
self.scrolltop();
|
1015 |
}
|
1016 |
+
}
|
1017 |
+
},
|
1018 |
+
// render list of unique values for given rule on Rule/Value tab
|
1019 |
+
rule_val: function( res ) {
|
1020 |
+
//console.log( 'update.rule_val: ' + res.key );
|
1021 |
+
//console.log( res.data );
|
1022 |
+
var self = this,
|
1023 |
+
rule = $( '#ctc_rule_menu_selected' ).text(),
|
1024 |
+
html = '<div class="ctc-input-row clearfix" id="ctc_rule_row_' + rule + '">' + "\n";
|
1025 |
+
//console.log( 'rule: ' + rule );
|
1026 |
+
if ( !self.is_empty( res.data ) ) {
|
1027 |
+
$.each( res.data, function( valid, value ) {
|
1028 |
+
var parentObj = self.decode_value( rule, value );
|
1029 |
+
html += '<div class="ctc-parent-row clearfix"'
|
1030 |
+
+ ' id="ctc_rule_row_' + rule + '_' + valid + '">' + "\n"
|
1031 |
+
+ '<div class="ctc-input-cell ctc-parent-value"'
|
1032 |
+
+ ' id="ctc_' + valid + '_parent_' + rule + '_' + valid + '">'
|
1033 |
+
+ parentObj.orig + '</div>' + "\n"
|
1034 |
+
+ '<div class="ctc-input-cell">' + "\n"
|
1035 |
+
+ '<div class="ctc-swatch ctc-specific"'
|
1036 |
+
+ ' id="ctc_' + valid + '_parent_' + rule + '_' + valid + '_swatch">'
|
1037 |
+
+ self.getxt( 'swatch' ) + '</div></div>' + "\n"
|
1038 |
+
+ '<div class="ctc-input-cell">'
|
1039 |
+
+ '<a href="#" class="ctc-selector-handle"'
|
1040 |
+
+ ' id="ctc_selector_' + rule + '_' + valid + '">'
|
1041 |
+
+ self.getxt( 'selector' ) + '</a></div>' + "\n"
|
1042 |
+
+ '<div id="ctc_selector_' + rule + '_' + valid + '_container"'
|
1043 |
+
+ ' class="ctc-selector-container">' + "\n"
|
1044 |
+
+ '<a href="#" id="ctc_selector_' + rule + '_' + valid + '_close"'
|
1045 |
+
+ ' class="ctc-selector-handle ctc-exit" title="'
|
1046 |
+
+ self.getxt( 'close' ) + '"></a>'
|
1047 |
+
+ '<div id="ctc_selector_' + rule + '_' + valid + '_inner_container"'
|
1048 |
+
+ ' class="ctc-selector-inner-container clearfix">' + "\n"
|
1049 |
+
+ '<div id="ctc_status_val_qry_' + valid + '"></div>' + "\n"
|
1050 |
+
+ '<div id="ctc_selector_' + rule + '_' + valid + '_rows"></div>' + "\n"
|
1051 |
+
+ '</div></div></div>' + "\n";
|
1052 |
+
} );
|
1053 |
+
html += '</div>' + "\n";
|
1054 |
+
}
|
1055 |
+
$( '#ctc_rule_value_inputs' ).html( html ).find( '.ctc-swatch' ).each( function() {
|
1056 |
+
self.coalesce_inputs( this );
|
1057 |
} );
|
1058 |
+
},
|
1059 |
+
// render list of selectors grouped by query for given value on Rule/Value Tab
|
1060 |
+
val_qry: function( res ) {
|
1061 |
+
var self = this,
|
1062 |
+
html = '';
|
1063 |
+
if ( !self.is_empty( res.data ) ) {
|
1064 |
+
$.each( res.data, function( rule, queries ) {
|
1065 |
+
page_rule = rule;
|
1066 |
+
$.each( queries, function( query, selectors ) {
|
1067 |
+
html += '<h4 class="ctc-query-heading">' + query + '</h4>' + "\n";
|
1068 |
+
if ( !self.is_empty( selectors ) ) {
|
1069 |
+
$.each( selectors, function( qsid, qsdata ) {
|
1070 |
+
html += self.input_row( qsid, rule, res.key, qsdata );
|
1071 |
+
} );
|
1072 |
+
}
|
1073 |
+
} );
|
1074 |
+
} );
|
1075 |
+
}
|
1076 |
+
selector = '#ctc_selector_' + rule + '_' + res.key + '_rows';
|
1077 |
+
$( selector ).html( html ).find( '.color-picker' ).each( function() {
|
1078 |
+
self.setup_iris( this );
|
1079 |
+
} );
|
1080 |
+
$( selector ).find( '.ctc-swatch' ).each( function() {
|
1081 |
+
self.coalesce_inputs( this );
|
1082 |
+
} );
|
1083 |
+
if ( self.jquery_err.length ) self.jquery_notice();
|
1084 |
+
},
|
1085 |
+
// populate list of queries and attach to query input element
|
1086 |
+
queries: function( res ) {
|
1087 |
+
$( '#ctc_sel_ovrd_query' ).data( 'menu', res.data );
|
1088 |
+
},
|
1089 |
+
// populate list of selectors and attach to selector input element
|
1090 |
+
selectors: function( res ) {
|
1091 |
+
$( '#ctc_sel_ovrd_selector' ).data( 'menu', res.data );
|
1092 |
+
},
|
1093 |
+
// populate list of rules and attach to rule input element
|
1094 |
+
rules: function( res ) {
|
1095 |
+
$( '#ctc_rule_menu' ).data( 'menu', res.data );
|
1096 |
+
},
|
1097 |
+
// render debug output
|
1098 |
+
debug: function( res ) {
|
1099 |
+
$( '#ctc_debug_container' ).html( res.data );
|
1100 |
+
//console.log( 'debug:' );
|
1101 |
+
//console.log( res.data );
|
1102 |
+
},
|
1103 |
+
// render stylesheet preview on child or parent css tab
|
1104 |
+
preview: function( res ) {
|
1105 |
+
$( '#view_' + res.key + '_options_panel' ).text( res.data );
|
1106 |
}
|
1107 |
+
|
1108 |
+
},
|
|
|
|
|
|
|
1109 |
|
1110 |
+
// initialize object vars, bind event listeners to elements, load menus and start plugin
|
1111 |
+
init: function() {
|
1112 |
+
var self = this;
|
1113 |
+
// auto populate parent/child tab values
|
1114 |
+
self.autogen_slugs();
|
1115 |
+
self.set_existing();
|
1116 |
+
// initialize theme menus
|
1117 |
+
if ( !$( '#ctc_theme_parnt' ).is( 'input' ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1118 |
try {
|
1119 |
+
$.widget( 'ctc.themeMenu', $.ui.selectmenu, {
|
1120 |
+
_renderItem: function( ul, item ) {
|
1121 |
+
var li = $( "<li>" );
|
1122 |
+
$( '#ctc_theme_option_' + item.value )
|
1123 |
+
.detach().appendTo( li );
|
1124 |
+
return li.appendTo( ul );
|
1125 |
+
}
|
1126 |
+
} );
|
1127 |
+
} catch( exn ) {
|
1128 |
+
self.jquery_exception( exn, 'Theme Menu' );
|
1129 |
}
|
|
|
|
|
|
|
1130 |
try {
|
1131 |
+
$( '#ctc_theme_parnt' ).themeMenu( {
|
1132 |
+
select: function( event, ui ) {
|
1133 |
+
self.set_parent_menu( ui.item );
|
1134 |
+
}
|
1135 |
+
} );
|
1136 |
+
} catch( exn ) {
|
1137 |
+
if ( 'function' == typeof themeMenu )
|
1138 |
+
$( '#ctc_theme_parnt' ).themeMenu( 'destroy' );
|
1139 |
+
else $( '#ctc_theme_parnt-button' ).remove();
|
1140 |
+
self.jquery_exception( exn, 'Parent Theme Menu' );
|
1141 |
+
}
|
1142 |
+
if ( self.is_empty( ctcAjax.themes.child ) ) {
|
1143 |
+
if ( $( '#ctc_child_name' ).length ) {
|
1144 |
+
$( '#ctc_child_name' ).val( self.testname );
|
1145 |
+
$( '#ctc_child_template' ).val( self.testslug );
|
1146 |
+
}
|
1147 |
+
} else {
|
1148 |
+
try {
|
1149 |
+
$( '#ctc_theme_child' ).themeMenu( {
|
1150 |
+
select: function( event, ui ) {
|
1151 |
+
self.set_child_menu( ui.item );
|
1152 |
+
}
|
1153 |
+
} );
|
1154 |
+
} catch( exn ) {
|
1155 |
+
if ( 'function' == typeof themeMenu )
|
1156 |
+
$( '#ctc_theme_child' ).themeMenu( 'destroy' );
|
1157 |
+
else $( '#ctc_theme_child-button' ).remove();
|
1158 |
+
self.jquery_exception( exn, 'Child Theme Menu' );
|
1159 |
+
}
|
1160 |
}
|
1161 |
}
|
1162 |
+
if ( self.is_empty( self.jquery_err ) ){
|
1163 |
+
// bind event handlers
|
1164 |
+
// these elements get replaced so use delegated events
|
1165 |
+
$( '#ctc_main' ).on( 'focus', '.color-picker', function() { //'.ctc-option-panel-container'
|
1166 |
+
//set_notice( '' )
|
1167 |
+
try {
|
1168 |
+
$( '.color-picker' ).not( this ).iris( 'hide' );
|
1169 |
+
$( this ).iris( 'toggle' );
|
1170 |
+
$( '.iris-picker' ).css( {'position':'absolute', 'z-index':10} );
|
1171 |
+
} catch ( exn ) {
|
1172 |
+
self.jquery_exception( exn, 'Iris Color Picker' );
|
1173 |
+
}
|
1174 |
+
} );
|
1175 |
+
|
1176 |
+
$( '#ctc_main' ).on( 'change', '.ctc-child-value, input[type=checkbox]', function() {
|
1177 |
+
self.coalesce_inputs( this );
|
1178 |
+
} );
|
1179 |
+
|
1180 |
+
$( '#ctc_main' ).on( 'click', '.ctc-selector-handle', function( e ) {
|
1181 |
+
//'.ctc-option-panel-container'
|
1182 |
+
e.preventDefault();
|
1183 |
+
if ( $( this ).hasClass( 'ajax-pending' ) ) return false;
|
1184 |
+
$( this ).addClass( 'ajax-pending' );
|
1185 |
+
//set_notice( '' );
|
1186 |
+
var id = $( this ).attr( 'id' ).toString().replace( '_close', '' ),
|
1187 |
+
parts = id.toString().match( /_([^_]+)_(\d+)$/ );
|
1188 |
+
if ( $( '#' + id + '_container' ).is( ':hidden' ) ) {
|
1189 |
+
if ( !self.is_empty( parts[ 1 ] ) && !self.is_empty( parts[ 2 ] ) ) {
|
1190 |
+
rule = parts[ 1 ];
|
1191 |
+
valid = parts[ 2 ];
|
1192 |
+
// retrieve selectors / values for individual value
|
1193 |
+
self.query_css( 'val_qry', valid, { 'rule': rule } );
|
1194 |
+
}
|
1195 |
+
}
|
1196 |
+
$( '#' + id + '_container' ).fadeToggle( 'fast' );
|
1197 |
+
$( '.ctc-selector-container' ).not( '#' + id + '_container' ).fadeOut( 'fast' );
|
1198 |
+
} );
|
1199 |
+
$( '#ctc_main' ).on( 'click', '.ctc-save-input[type=button]', function( e ) {
|
1200 |
+
if ( $( this ).hasClass( 'ajax-pending' ) ) return false;
|
1201 |
+
$( this ).addClass( 'ajax-pending' );
|
1202 |
+
self.save( this ); // refresh menus after updating data
|
1203 |
+
} );
|
1204 |
+
$( '#ctc_main' ).on( 'click', '.ctc-selector-edit', function( e ) {
|
1205 |
+
e.preventDefault();
|
1206 |
+
if ( $( this ).hasClass( 'ajax-pending' ) ) return false;
|
1207 |
+
$( this ).addClass( 'ajax-pending' );
|
1208 |
+
self.set_qsid( this );
|
1209 |
+
} );
|
1210 |
+
$( '#ctc_main' ).on( 'click', '.ctc-rewrite-toggle', function( e ) {
|
1211 |
+
e.preventDefault();
|
1212 |
+
self.selector_input_toggle( this );
|
1213 |
+
} );
|
1214 |
+
$( '#ctc_main' ).on( 'click', '#ctc_copy_selector', function( e ) {
|
1215 |
+
var txt = $( '#ctc_sel_ovrd_selector_selected' ).text().trim();
|
1216 |
+
if ( !self.is_empty( txt ) )
|
1217 |
+
$( '#ctc_new_selectors' ).val( $( '#ctc_new_selectors' ).val() + "\n" + txt + " {\n\n}" );
|
1218 |
+
} );
|
1219 |
+
$( '#ctc_configtype' ).on( 'change', function( e ) {
|
1220 |
+
var val = $( this ).val();
|
1221 |
+
if ( self.is_empty( val ) || 'theme' == val ) {
|
1222 |
+
$( '.ctc-theme-only, .ctc-themeonly-container' ).removeClass( 'ctc-disabled' );
|
1223 |
+
$( '.ctc-theme-only, .ctc-themeonly-container input' ).prop( 'disabled', false );
|
1224 |
+
try {
|
1225 |
+
$( '#ctc_theme_parnt, #ctc_theme_child' ).themeMenu( 'enable' );
|
1226 |
+
} catch ( exn ) {
|
1227 |
+
self.jquery_exception( exn, 'Theme Menu' );
|
1228 |
+
}
|
1229 |
+
} else {
|
1230 |
+
$( '.ctc-theme-only, .ctc-themeonly-container' ).addClass( 'ctc-disabled' );
|
1231 |
+
$( '.ctc-theme-only, .ctc-themeonly-container input' ).prop( 'disabled', true );
|
1232 |
+
try {
|
1233 |
+
$( '#ctc_theme_parnt, #ctc_theme_child' ).themeMenu( 'disable' );
|
1234 |
+
} catch ( exn ) {
|
1235 |
+
self.jquery_exception( exn, 'Theme Menu' );
|
1236 |
+
}
|
1237 |
+
}
|
1238 |
+
} );
|
1239 |
+
// these elements are not replaced so use direct selector events
|
1240 |
+
$( '.nav-tab' ).on( 'click', function( e ) {
|
1241 |
+
e.preventDefault();
|
1242 |
+
// clear the notice box
|
1243 |
+
//set_notice( '' );
|
1244 |
+
$( '.ctc-status-icon' ).remove();
|
1245 |
+
var id = '#' + $( this ).attr( 'id' );
|
1246 |
+
self.focus_panel( id );
|
1247 |
+
} );
|
1248 |
+
$( '.ctc-section-toggle' ).on( 'click', function( e ) {
|
1249 |
+
$( this ).toggleClass( 'open' );
|
1250 |
+
var id = $( this ).attr( 'id' ) + '_content';
|
1251 |
+
$( '#' + id ).slideToggle( 'fast' );
|
1252 |
+
} );
|
1253 |
+
$( '#view_child_options, #view_parnt_options' ).on( 'click', function( e ){
|
1254 |
+
if ( $( this ).hasClass( 'ajax-pending' ) ) return false;
|
1255 |
+
$( this ).addClass( 'ajax-pending' );
|
1256 |
+
self.css_preview( $( this ).attr( 'id' ) );
|
1257 |
+
} );
|
1258 |
+
$( '#ctc_load_form' ).on( 'submit', function() {
|
1259 |
+
return ( self.validate() ); //&& confirm( self.getxt( 'load' ) ) ) ;
|
1260 |
+
} );
|
1261 |
+
$( '#ctc_query_selector_form').on( 'submit', function( e ) {
|
1262 |
+
e.preventDefault();
|
1263 |
+
$this = $( '#ctc_save_query_selector' );
|
1264 |
+
if ( $this.hasClass( 'ajax-pending' ) ) return false;
|
1265 |
+
$this.addClass( 'ajax-pending' );
|
1266 |
+
self.save( $this ); // refresh menus after updating data
|
1267 |
+
return false;
|
1268 |
+
} );
|
1269 |
+
$( '#ctc_theme_child, #ctc_theme_child-button, #ctc_child_type_existing' )
|
1270 |
+
.on( 'focus click', function() {
|
1271 |
+
// change the inputs to use existing child theme
|
1272 |
+
$( '#ctc_child_type_existing' ).prop( 'checked', true );
|
1273 |
+
$( '#ctc_child_type_new' ).prop( 'checked', false );
|
1274 |
+
$( '#ctc_child_template' ).val( '' );
|
1275 |
+
self.set_existing();
|
1276 |
+
} );
|
1277 |
+
$( '#ctc_child_type_new, #ctc_child_template' ).on( 'focus click', function() {
|
1278 |
+
// change the inputs to use new child theme
|
1279 |
+
$( '#ctc_child_type_existing' ).prop( 'checked', false );
|
1280 |
+
$( '#ctc_child_type_new' ).prop( 'checked', true );
|
1281 |
+
$( '#ctc_child_name' ).val( self.testname );
|
1282 |
+
$( '#ctc_child_template' ).val( self.testslug );
|
1283 |
+
} );
|
1284 |
+
$( '#ctc_is_debug' ).on( 'change', function( e ) {
|
1285 |
+
self.save( this );
|
1286 |
+
} );
|
1287 |
+
$( '.ctc-live-preview' ).on( 'click', function( e ) {
|
1288 |
+
e.stopImmediatePropagation();
|
1289 |
+
e.preventDefault();
|
1290 |
+
document.location = $( this ).prop( 'href' );
|
1291 |
+
return false;
|
1292 |
+
} );
|
1293 |
+
// initialize autoselect menus
|
1294 |
+
self.setup_menus();
|
1295 |
+
// mark additional linked stylesheets for parsing
|
1296 |
+
self.set_addl_css();
|
1297 |
+
// show last 25 selectors edited
|
1298 |
+
// render_recent();
|
1299 |
+
// turn on submit buttons (disabled until everything is loaded to prevent errors)
|
1300 |
+
$( 'input[type=submit], input[type=button]' ).prop( 'disabled', false );
|
1301 |
+
self.scrolltop();
|
1302 |
+
// disappear any notices after 20 seconds
|
1303 |
+
setTimeout( self.fade_update_notice, 20000 );
|
1304 |
} else {
|
1305 |
+
//$( '.ctc-select' ).css( { 'visibility': 'visible' } ).show();
|
1306 |
+
self.jquery_notice();
|
|
|
|
|
|
|
|
|
1307 |
}
|
1308 |
+
},
|
1309 |
+
// object properties
|
1310 |
+
testslug: '',
|
1311 |
+
testname: '',
|
1312 |
+
reload_menus: false,
|
1313 |
+
current_query: 'base',
|
1314 |
+
current_qsid: null,
|
1315 |
+
current_qsdata: {},
|
1316 |
+
jquery_err: []
|
1317 |
+
};
|
1318 |
+
} ( jQuery ) );
|
1319 |
+
|
1320 |
+
jQuery( document ).ready( function( $ ) {
|
1321 |
+
//console.log( 'creating new chldthmcfg object ...' );
|
1322 |
+
$.chldthmcfg.init();
|
1323 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/chld-thm-cfg.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(document).ready(function(e){function t(e){return h(e)?e:e.toString().replace(X,""")}function c(e){var t=parseInt(e),c=String.fromCharCode(t);return c}function a(e){var t=e.charCodeAt(0);return t}function n(t,c){var a=!1;return e.each(ctcAjax.themes,function(n,l){return e.each(l,function(e){return e!=t||"parnt"!=n&&"new"!=c?void 0:(a=!0,!1)}),a?!1:void 0}),a}function l(){var t=/[^\w\-]/,c=e("#ctc_child_template").length?e("#ctc_child_template").val().toString().replace(t).toLowerCase():"",a=e("#ctc_theme_child").length?e("#ctc_theme_child").val().toString().replace(t).toLowerCase():c,l=e("input[name=ctc_child_type]:checked").val(),r=[];return"new"==l&&(a=c),n(a,l)&&r.push(ctcAjax.theme_exists_txt.toString().replace(/%s/,a)),""===a&&r.push(ctcAjax.inval_theme_txt),""===e("#ctc_child_name").val()&&r.push(ctcAjax.inval_name_txt),r.length?(F({error:r}),!1):!0}function r(){if(e("#ctc_theme_parnt").length){for(var t=e("#ctc_theme_parnt").val(),c=slugbase=t+"-child",a=ctcAjax.themes.parnt[t].Name+" Child",l="",r="",i="00";n(c,"new");)l=""==l?2:l+1,r=i.substring(0,i.length-l.toString().length)+l.toString(),c=slugbase+r;Y=c,Z=a+(r.length?" "+r:"")}}function i(t){var c=t+"_panel";e(".nav-tab").removeClass("nav-tab-active"),e(".ctc-option-panel").removeClass("ctc-option-panel-active"),e(".ctc-selector-container").hide(),e(t).addClass("nav-tab-active"),e(".ctc-option-panel-container").scrollTop(0),e(c).addClass("ctc-option-panel-active")}function s(c){var a;e("#ctc_rewrite_selector").length?(a=e("#ctc_rewrite_selector_orig").val(),e("#ctc_sel_ovrd_selector_selected").text(a),e(c).text(ctcAjax.rename_txt)):(a=e("#ctc_sel_ovrd_selector_selected").text(),e("#ctc_sel_ovrd_selector_selected").html('<textarea id="ctc_rewrite_selector" name="ctc_rewrite_selector" autocomplete="off"></textarea><input id="ctc_rewrite_selector_orig" name="ctc_rewrite_selector_orig" type="hidden" value="'+t(a)+'"/>'),e("#ctc_rewrite_selector").val(a),e(c).text(ctcAjax.cancel_txt))}function o(){e(".updated, .error").slideUp("slow",function(){e(".updated").remove()})}function _(t){var c=/^(ctc_(ovrd|\d+)_(parent|child)_([0-9a-z\-]+)_(\d+))(_\w+)?$/,a=e(t).parents(".ctc-selector-row, .ctc-parent-row").first(),n=a.find(".ctc-swatch").first(),l={parent:{},child:{}},r={parent:{origin:"",start:"",end:""},child:{origin:"",start:"",end:""}},i={child:!1,parent:!1},s={};return a.find(".ctc-parent-value, .ctc-child-value").each(function(){var a,n,o=e(this).attr("id"),_=o.toString().match(c),u=_[2],p=_[3],v="undefined"==typeof _[4]?"":_[4],f=_[5],m="undefined"==typeof _[6]?"":_[6],x="parent"==p?e(this).text().replace(/!$/,""):e(this).val(),g="ctc_"+u+"_child_"+v+"_i_"+f;if(!1===h(e(this).data("color"))&&(x=e(this).data("color"),e(this).data("color",null)),"child"==p&&(s[o]=x,s[g]=e("#"+g).is(":checked")?1:0),""!=x)if(!1===h(m))switch(m){case"_border_width":l[p][v+"-width"]="none"==x?0:x;break;case"_border_style":l[p][v+"-style"]=x;break;case"_border_color":l[p][v+"-color"]=x;break;case"_background_url":l[p]["background-image"]=d(p,x);break;case"_background_color":l[p]["background-color"]=t.value;break;case"_background_color1":r[p].start=x,i[p]=!0;break;case"_background_color2":r[p].end=x,i[p]=!0;break;case"_background_origin":r[p].origin=x,i[p]=!0}else(a=v.toString().match(/^border(\-(top|right|bottom|left))?$/)&&!x.match(/none/))?(n=x.toString().split(/ +/),l[p][v+"-width"]="undefined"==typeof n[0]?"":n[0],l[p][v+"-style"]="undefined"==typeof n[1]?"":n[1],l[p][v+"-color"]="undefined"==typeof n[2]?"":n[2]):"background-image"!=v||x.match(/none/)?"seq"!=v&&(l[p][v]=x):x.toString().match(/url\(/)?l[p]["background-image"]=d(p,x):(n=x.toString().split(/ +/),n.length>2?(r[p].origin="undefined"==typeof n[0]?"top":n[0],r[p].start="undefined"==typeof n[1]?"transparent":n[1],r[p].end="undefined"==typeof n[2]?"transparent":n[2],i[p]=!0):l[p]["background-image"]=x)}),"undefined"!=typeof n&&!1===h(n.attr("id"))&&(n.removeAttr("style"),i.parent&&n.ctcgrad(r.parent.origin,[r.parent.start,r.parent.end]),n.css(l.parent),n.attr("id").toString().match(/parent/)||(i.child&&n.ctcgrad(r.child.origin,[r.child.start,r.child.end]),n.css(l.child)),n.css({"z-index":-1})),s}function u(e,t){t="undefined"==typeof t?"":t;var c={orig:t};if(e.toString().match(/^border(\-(top|right|bottom|left))?$/)){var a=t.toString().split(/ +/);c.names=["_border_width","_border_style","_border_color"],c.values=["undefined"==typeof a[0]?"":a[0],"undefined"==typeof a[1]?"":a[1],"undefined"==typeof a[2]?"":a[2]]}else if(e.toString().match(/^background\-image/))if(c.names=["_background_url","_background_origin","_background_color1","_background_color2"],c.values=["","","",""],!1!==h(t)||t.toString().match(/(url|none)/))c.values[0]=t;else{var a=t.toString().split(/:/);c.values[1]="undefined"==typeof a[0]?"":a[0],c.values[2]="undefined"==typeof a[1]?"":a[1],c.values[3]="undefined"==typeof a[3]?"":a[3],c.orig=[c.values[1],c.values[2],c.values[3]].join(" ")}else c.names=[""],c.values=[t];return c}function d(e,t){var c,a=t.toString().match(/url\(['" ]*(.+?)['" ]*\)/),n=h(a)?null:a[1],l=ctcAjax.theme_uri+"/"+("parent"==e?ctcAjax.parnt:ctcAjax.child)+"/";return n?c=n.toString().match(/^(data:|https?:|\/)/)?t:"url("+l+n+")":!1}function h(e){if("undefined"==typeof e||!1===e||null===e||""===e)return!0;if(!0===e||"string"==typeof e||"number"==typeof e)return!1;if("object"==typeof e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}return!1}function p(e){if("object"==typeof ctcAjax.sel_val[e]&&"object"==typeof ctcAjax.sel_val[e].value)for(var t in ctcAjax.sel_val[e].value)if(ctcAjax.sel_val[e].value.hasOwnProperty(t)&&(!1===h(ctcAjax.sel_val[e].value[t].child)||!1===h(ctcAjax.sel_val[e].value[t].parnt)))return e;return delete ctcAjax.sel_val[e],!1}function v(){tt.rld_rule=1,tt.rld_sel=1,f(),x()}function f(){if(1!==tt.sel_ndx){if(0===tt.sel_ndx||1==tt.rld_sel)return tt.sel_ndx=1,tt.rld_sel=0,void L("sel_ndx",null,f);at=[],!1===h(ctcAjax.sel_ndx)&&e.each(ctcAjax.sel_ndx,function(e){var t={label:e,value:e};at.push(t)}),C(),m()}}function m(){if(1!==tt.sel_ndx){if(0===tt.sel_ndx)return tt.sel_ndx=1,void L("sel_ndx",et,m);ct=[],!1===h(ctcAjax.sel_ndx)&&e.each(ctcAjax.sel_ndx[et],function(e,t){var c={label:e,value:t};ct.push(c)}),M(),tt.set_sel&&(tt.set_sel=0,$(K,null))}}function x(){if(1!==tt.rule){if(0===tt.rule||1==tt.rld_rule)return tt.rule=1,tt.rld_rule=0,void L("rule",null,x);nt=[],!1===h(ctcAjax.rule)&&e.each(ctcAjax.rule,function(e,t){var a={label:t.replace(/\d+/g,c),value:e};nt.push(a)}),nt=nt.sort(function(e,t){return e.label>t.label?1:e.label<t.label?-1:0}),T(),D()}}function g(e){return 1===tt.sel_val?!1:h(ctcAjax.sel_val[e])?(0==tt.sel_val&&(tt.sel_val=1,L("sel_val",e,g)),!1):(K=e,void(1==tt.set_qry?(tt.set_qry=0,P(ctcAjax.sel_val[e].query)):1==tt.new_sel&&(tt.new_sel=0,b(e))))}function y(t,a){var n=[],l=h(ctcAjax.sel_val[K])||h(ctcAjax.sel_val[K].value);h(nt)&&x(),e.each(nt,function(a,r){var i=!1,s=new RegExp(e.ui.autocomplete.escapeRegex(t.term),"i");if(s.test(r.label)){if(!1===l&&(e.each(ctcAjax.sel_val[K].value,function(e){return r.label==e.replace(/\d+/g,c)?(i=!0,!1):void 0}),i))return;n.push(r)}}),a(n)}function j(a,n,l){var r="",i=h(ctcAjax.sel_val[a])||h(ctcAjax.sel_val[a].value)||h(ctcAjax.sel_val[a].value[n])?"":ctcAjax.sel_val[a].value[n],s=u(n,"undefined"==typeof i?"":i.parnt),o=!1===h(i.i_parnt)&&1==i.i_parnt?ctcAjax.important_label:"",_=u(n,"undefined"==typeof i?"":i.child),d=!1===h(i.i_child)&&1==i.i_child?1:0,p="ctc_"+l+"_child_"+n+"_i_"+a;return!1===h(ctcAjax.sel_val[a])&&(r+='<div class="ctc-'+("ovrd"==l?"input":"selector")+'-row clearfix">'+W,r+='<div class="ctc-input-cell">'+("ovrd"==l?n.replace(/\d+/g,c):ctcAjax.sel_val[a].selector+'<br/><a href="#" class="ctc-selector-edit" id="ctc_selector_edit_'+a+'" >'+ctcAjax.edit_txt+"</a> "+(h(s.orig)?ctcAjax.child_only_txt:""))+"</div>"+W,"ovrd"==l&&(r+='<div class="ctc-parent-value ctc-input-cell" id="ctc_'+l+"_parent_"+n+"_"+a+'">'+(h(s.orig)?"[no value]":s.orig+o)+"</div>"+W),r+='<div class="ctc-input-cell">'+W,!1===h(s.names)&&(e.each(s.names,function(e,c){c=h(c)?"":c,r+='<div class="ctc-child-input-cell">'+W;var i,s="ctc_"+l+"_child_"+n+"_"+a+c;!1===(i=_.values.shift())&&(i=""),r+=(h(c)?"":ctcAjax.field_labels[c]+":<br/>")+'<input type="text" id="'+s+'" name="'+s+'" class="ctc-child-value'+((c+n).toString().match(/color/)?" color-picker":"")+(c.toString().match(/url/)?" ctc-input-wide":"")+'" value="'+t(i)+'" />'+W,r+="</div>"+W}),r+='<label for="'+p+'"><input type="checkbox" id="'+p+'" name="'+p+'" value="1" '+(1===d?"checked":"")+" />"+ctcAjax.important_label+"</label>"+W),r+="</div>"+W,r+="ovrd"==l?"":'<div class="ctc-swatch ctc-specific" id="ctc_child_'+n+"_"+a+'_swatch">'+ctcAjax.swatch_txt+"</div>"+W+'<div class="ctc-child-input-cell ctc-button-cell" id="ctc_save_'+n+"_"+a+'_cell">'+W+'<input type="button" class="button ctc-save-input" id="ctc_save_'+n+"_"+a+'" name="ctc_save_'+n+"_"+a+'" value="Save" /></div>'+W,r+="</div><!-- end input row -->"+W),r}function b(t){var c,a,n;(t=p(t))?(e("#ctc_sel_ovrd_qsid").val(t),K=t,h(ctcAjax.sel_val[t].seq)?e("#ctc_child_load_order_container").html(""):(c="ctc_ovrd_child_seq_"+t,n=parseInt(ctcAjax.sel_val[t].seq),a='<input type="text" id="'+c+'" name="'+c+'" class="ctc-child-value" value="'+n+'" />',e("#ctc_child_load_order_container").html(a)),h(ctcAjax.sel_val[t].value)?e("#ctc_sel_ovrd_rule_inputs").slideUp(function(){e("#ctc_sel_ovrd_rule_inputs").html("")}):(a="",e.each(ctcAjax.sel_val[t].value,function(e){a+=j(t,e,"ovrd")}),e("#ctc_sel_ovrd_rule_inputs").html(a).find(".color-picker").each(function(){S(this)}),_("#ctc_child_all_0_swatch"),lt.length?G():(e("#ctc_sel_ovrd_selector_selected").text(ctcAjax.sel_val[t].selector),e(".ctc-rewrite-toggle").text(ctcAjax.rename_txt),e("#ctc_sel_ovrd_new_rule, #ctc_sel_ovrd_rule_header, #ctc_sel_ovrd_rule_inputs_container, #ctc_sel_ovrd_rule_inputs, .ctc-rewrite-toggle").slideDown()))):(e("#ctc_sel_ovrd_selector_selected").html(" "),e("#ctc_sel_ovrd_new_rule, #ctc_sel_ovrd_rule_header, #ctc_sel_ovrd_rule_inputs_container, #ctc_sel_ovrd_rule_inputs, .ctc-rewrite-toggle").slideUp(function(){e("#ctc_sel_ovrd_rule_inputs").html("")})),a=null}function w(t){if(1===tt.preview)return!1;if(0==tt.preview){tt.preview=1;var t;return(t=t.match(/(child|parnt)/)[1])||(t="child"),L("preview",t,w),!1}e("#view_"+t+"_options_panel").text(ctcAjax.previewResponse),ctcAjax.previewResponse=null,tt.preview=0}function A(t){if(1===tt.rule_val)return!1;if(0==tt.rule_val)return tt.rule_val=1,L("rule_val",t,A),!1;var c=ctcAjax.rule[t],a='<div class="ctc-input-row clearfix" id="ctc_rule_row_'+c+'">'+W;!1===h(ctcAjax.rule_val[t])&&(e.each(ctcAjax.rule_val[t],function(e,t){var n=u(c,t);a+='<div class="ctc-parent-row clearfix" id="ctc_rule_row_'+c+"_"+e+'">'+W,a+='<div class="ctc-input-cell ctc-parent-value" id="ctc_'+e+"_parent_"+c+"_"+e+'">'+n.orig+"</div>"+W,a+='<div class="ctc-input-cell">'+W,a+='<div class="ctc-swatch ctc-specific" id="ctc_'+e+"_parent_"+c+"_"+e+'_swatch">'+ctcAjax.swatch_txt+"</div></div>"+W,a+='<div class="ctc-input-cell"><a href="#" class="ctc-selector-handle" id="ctc_selector_'+c+"_"+e+'">'+ctcAjax.selector_txt+"</a></div>"+W,a+='<div id="ctc_selector_'+c+"_"+e+'_container" class="ctc-selector-container">'+W,a+='<a href="#" id="ctc_selector_'+c+"_"+e+'_close" class="ctc-selector-handle ctc-exit" title="'+ctcAjax.close_txt+'"></a>',a+='<div id="ctc_selector_'+c+"_"+e+'_inner_container" class="ctc-selector-inner-container clearfix">'+W,a+='<div id="ctc_status_val_qry_'+e+'"></div>'+W,a+='<div id="ctc_selector_'+c+"_"+e+'_rows"></div>'+W,a+="</div></div></div>"+W}),a+="</div>"+W),e("#ctc_rule_value_inputs").html(a).find(".ctc-swatch").each(function(){_(this)}),a=null}function k(){var t="";if(h(ctcAjax.recent)&&!1===h(ctcAjax.recent_txt))t+=ctcAjax.recent_txt;else{if(h(ctcAjax.recent))return;t+="<ul>\n",e.each(ctcAjax.recent,function(c,a){e.each(a,function(e,c){t+='<li><a href="#" class="ctc-selector-edit" id="ctc_selector_edit_'+e+'" >'+c+"</a></li>\n"})}),t+="</ul>\n"}e("#ctc_recent_selectors").html(t),t=null}function q(t){if(1==tt.val_qry)return!1;var c,n,l=e("#ctc_rule_menu_selected").text().replace(/[^\w\-]/g,a),r="";return 0===tt.val_qry?(tt.val_qry=1,c={rule:l},L("val_qry",t,q,c),!1):(!1===h(ctcAjax.val_qry[t])&&e.each(ctcAjax.val_qry[t],function(c,a){page_rule=c,e.each(a,function(a,n){r+='<h4 class="ctc-query-heading">'+a+"</h4>"+W,!1===h(n)&&e.each(n,function(e,a){ctcAjax.sel_val[e]=a,r+=j(e,c,t)})})}),n="#ctc_selector_"+l+"_"+t+"_rows",e(n).html(r).find(".color-picker").each(function(){S(this)}),e(n).find(".ctc-swatch").each(function(){_(this)}),void(lt.length&&G()))}function S(t){try{e(t).iris({change:function(c,a){e(t).data("color",a.color.toString()),_(t)}})}catch(c){B(c,"Iris Color Picker")}}function C(){try{e("#ctc_sel_ovrd_query").autocomplete({source:at,minLength:0,selectFirst:!0,autoFocus:!0,select:function(e,t){return P(t.item.value),!1},focus:function(e){e.preventDefault()}})}catch(t){B(t,"Query Menu")}}function M(){try{e("#ctc_sel_ovrd_selector").autocomplete({source:ct,selectFirst:!0,autoFocus:!0,select:function(e,t){return $(t.item.value,t.item.label),!1},focus:function(e){e.preventDefault()}})}catch(t){B(t,"Selector Menu")}}function T(){try{e("#ctc_rule_menu").autocomplete({source:nt,selectFirst:!0,autoFocus:!0,select:function(e,t){return U(t.item.value,t.item.label),!1},focus:function(e){e.preventDefault()}})}catch(t){B(t,"Rule Menu")}}function D(){try{e("#ctc_new_rule_menu").autocomplete({source:y,selectFirst:!0,autoFocus:!0,select:function(t,c){t.preventDefault();var n=e(j(K,c.item.label.replace(/[^\w\-]/g,a),"ovrd"));return e("#ctc_sel_ovrd_rule_inputs").append(n),e("#ctc_new_rule_menu").val(""),h(ctcAjax.sel_val[K].value)&&(ctcAjax.sel_val[K].value={}),ctcAjax.sel_val[K].value[c.item.label]={child:""},n.find('input[type="text"]').each(function(t,c){e(c).hasClass("color-picker")&&S(c),e(c).focus()}),lt.length&&G(),!1},focus:function(e){e.preventDefault()}})}catch(t){B(t,"New Rule Menu")}}function R(){if(e("#ctc_theme_child").length&&e("#ctc_child_type_existing").is(":checked")){var t=e("#ctc_theme_child").val();!1===h(t)&&(e("#ctc_child_name").val(ctcAjax.themes.child[t].Name),e("#ctc_child_author").val(ctcAjax.themes.child[t].Author),e("#ctc_child_version").val(ctcAjax.themes.child[t].Version))}}function F(t){var c="";!1===h(t)&&e.each(t,function(t,a){c+='<div class="'+t+'"><ul>'+W,e(a).each(function(e,t){c+="<li>"+t.toString()+"</li>"+W}),c+="</ul></div>"}),e("#ctc_error_notice").html(c),e("html, body").animate({scrollTop:0},"slow")}function N(t){e("#ctc_theme_parent").parents(".ctc-input-row").first().append('<span class="ctc-status-icon spinner"></span>'),e(".spinner").show(),document.location="?page="+ctcAjax.page+"&ctc_parent="+t.value}function I(t){!1===h(ctcAjax.themes.child[t.value])&&(e("#ctc_child_name").val(ctcAjax.themes.child[t.value].Name),e("#ctc_child_author").val(ctcAjax.themes.child[t.value].Author),e("#ctc_child_version").val(ctcAjax.themes.child[t.value].Version))}function P(t){et=t,e("#ctc_sel_ovrd_query").val(""),e("#ctc_sel_ovrd_query_selected").text(t),e("#ctc_sel_ovrd_selector").val(""),e("#ctc_sel_ovrd_selector_selected").html(" "),e("#ctc_sel_ovrd_rule_inputs").html(""),m()}function $(t){e("#ctc_sel_ovrd_selector").val(""),1!=tt.sel_val&&(tt.sel_val=0),K=t,tt.new_sel=1,g(t)}function U(t,c){e("#ctc_rule_menu").val(""),e("#ctc_rule_menu_selected").text(c),1!=tt.rule_val&&(tt.rule_val=0),A(t),e(".ctc-rewrite-toggle").text(ctcAjax.rename_txt),e("#ctc_rule_value_inputs, #ctc_input_row_rule_header").show()}function z(t){var c=e(t).attr("id").match(/_(\d+)$/)[1];i("#query_selector_options"),tt.sel_val=0,tt.set_sel=tt.set_qry=1,K=c,g(c)}function E(){var t,c=e("#ctc_theme_parnt").val(),a=ctcAjax.theme_uri.replace(/^https?:\/\//,""),n=ctcAjax.homeurl.replace(/^https?/,ctcAjax.ssl?"https":"http"),l=n+"?preview=1&p=x&template="+c+"&stylesheet="+c,r=new RegExp("<link rel=[\"']stylesheet[\"'][^>]+?"+a+"/"+c+"/(.+?\\.css)[^>]+?>","g");h(c)||(c!=ctcAjax.parnt?e.get(l,function(c){for(;(t=r.exec(c))&&"style.css"!=t[1];)t[1].match(/bootstrap/)||e(".ctc_checkbox").each(function(){e(this).val()==t[1]&&e(this).prop("checked",!0)});c=null}):e(ctcAjax.addl_css).each(function(t,c){e("#ctc_stylesheet_files .ctc_checkbox").each(function(){e(this).val()==c&&e(this).prop("checked",!0)})}))}function L(t,c,a,n){var l={ctc_query_obj:t,ctc_query_key:c},r="#ctc_status_"+t+("val_qry"==t?"_"+c:"");return"object"==typeof n&&e.each(n,function(e,t){l["ctc_query_"+e]=t}),e(".query-icon").remove(),e(r).append('<span class="ctc-status-icon spinner query-icon"></span>'),e(".spinner").show(),l.action=!1===h(e("#ctc_action").val())&&"plugin"==e("#ctc_action").val()?"ctc_plgqry":"ctc_query",l._wpnonce=e("#_wpnonce").val(),e.post(ctcAjax.ajaxurl,l,function(n){tt[t]=2,h(n)?(e(".query-icon").addClass("failure"),"preview"==t&&(ctcAjax.previewResponse=ctcAjax.css_fail_txt,a(c))):(e(".ctc-status-icon").addClass("success"),1==tt.refresh&&(tt.refresh=0,V()),Q(n),n=null,k(),"function"==typeof a&&a(c))},"json").fail(function(){e(".query-icon").removeClass("spinner"),e(".query-icon").addClass("failure"),"preview"==t?(ctcAjax.previewResponse=ctcAjax.css_fail_txt,tt[t]=2,a(c)):tt[t]=0}),!1}function O(t,c){var a,n,l,r,i={},s=e(t).attr("id");return e(t).prop("disabled",!0),e(".save-icon").remove(),e(t).parent(".ctc-textarea-button-cell, .ctc-button-cell").append('<span class="ctc-status-icon spinner save-icon"></span>'),s.match(/ctc_configtype/)?(e(t).parents(".ctc-input-row").first().append('<span class="ctc-status-icon spinner save-icon"></span>'),i.ctc_configtype=e(t).val()):(a=e("#ctc_new_selectors"))&&"ctc_save_new_selectors"==e(t).attr("id")?(i.ctc_new_selectors=a.val(),(n=e("#ctc_sel_ovrd_query_selected"))&&(i.ctc_sel_ovrd_query=n.text())):(l=e("#ctc_child_imports"))&&"ctc_save_imports"==e(t).attr("id")?i.ctc_child_imports=l.val():"ctc_is_debug"==e(t).attr("id")?i.ctc_is_debug=e("#ctc_is_debug").is(":checked")?1:0:i=_(t),e(".save-icon").show(),e("#ctc_sel_ovrd_selector_selected").find("#ctc_rewrite_selector").each(function(){r=e("#ctc_rewrite_selector").val(),origsel=e("#ctc_rewrite_selector_orig").val(),h(r)||!r.toString().match(/\w/)?r=origsel:i.ctc_rewrite_selector=r,e(".ctc-rewrite-toggle").text(ctcAjax.rename_txt),e("#ctc_sel_ovrd_selector_selected").html(r)}),i.action=!1===h(e("#ctc_action").val())&&"plugin"==e("#ctc_action").val()?"ctc_plugin":"ctc_update",i._wpnonce=e("#_wpnonce").val(),e.post(ctcAjax.ajaxurl,i,function(a){return e(t).prop("disabled",!1),e(".save-icon").removeClass("spinner"),h(a)?e(".save-icon").addClass("failure"):(e("#ctc_new_selectors").val(""),1==tt.refresh&&(tt.refresh=0,V()),Q(a),a=null,h(H)?K&&(b(K),k()):($(H,J),H=J=null),e(".save-icon").addClass("success"),"function"==typeof c&&c()),!1},"json").fail(function(){e(t).prop("disabled",!1),e(".save-icon").removeClass("spinner"),e(".save-icon").addClass("failure")}),!1}function Q(t){e(t).each(function(){switch(this.obj){case"imports":ctcAjax.imports=this.data;break;case"rule_val":ctcAjax.rule_val[this.key]=this.data;break;case"val_qry":ctcAjax.val_qry[this.key]=this.data;break;case"rule":ctcAjax.rule=this.data;break;case"sel_ndx":h(this.key)?ctcAjax.sel_ndx=this.data:"qsid"==this.key?(h(ctcAjax.sel_ndx[this.data.query])&&(ctcAjax.sel_ndx[this.data.query]={}),ctcAjax.sel_ndx[this.data.query][this.data.selector]=this.data.qsid):(ctcAjax.sel_ndx[this.key]=this.data,et=this.key);break;case"sel_val":ctcAjax.sel_val[this.key]=this.data,K=this.key;break;case"rewrite":K=this.key,H=this.key,J=this.data;break;case"recent":ctcAjax.recent=this.data;break;case"stylesheets":e("#ctc_stylesheet_files").html(this.data);break;case"backups":e("#ctc_backup_files").html(this.data);break;case"addl_css":ctcAjax.addl_css=this.data;break;case"debug":e("#ctc_debug_container").html(this.data);break;case"preview":case"all_styles":ctcAjax.previewResponse=this.data}}),t=null}function V(){et="base",K=null,ct=[],at=[],nt=[],tt.rld_rule=1,tt.rld_sel=1,tt.set_qry=1,ctcAjax.imports=[],ctcAjax.recent={},ctcAjax.rule={},ctcAjax.sel_ndx={},ctcAjax.val_qry={},ctcAjax.rule_val={},ctcAjax.sel_val={},v()}function B(e,t){var c=h(e.lineNumber)?"":" line: "+e.lineNumber,a=h(e.fileName)?"":" "+e.fileName.split(/\?/)[0];lt.push("<code><small>"+t+": "+e.message+a+c+"</small></code>")}function G(){var t=[],c=[];e("input[type=submit], input[type=button]").prop("disabled",!0),e("script").each(function(){var c=e(this).prop("src");!1===h(c)&&c.match(/jquery(\.min|\.js|\-?ui)/i)&&!c.match(/load\-scripts.php/)&&t.push("<code><small>"+c.split(/\?/)[0]+"</small></code>")}),c.push("<strong>"+ctcAjax.js_txt+"</strong>"),1==ctcAjax.is_debug&&c.push(lt.join("<br/>")),t.length&&c.push(ctcAjax.jquery_txt+"<br/>"+t.join("<br/>")),c.push(ctcAjax.plugin_txt+" "+ctcAjax.contact_txt),F({error:c})}var H,J,K,W="\n",X=new RegExp('"',"g"),Y="",Z="",et="base",tt={rule:0,sel_ndx:0,val_qry:0,rule_val:0,sel_val:0,preview:0,recent:0,rld_rule:0,rld_sel:0,set_qry:0,set_sel:0,new_sel:0,refresh:0},ct=[],at=[],nt=[],lt=[];if(r(),R(),!e("#ctc_theme_parnt").is("input")){try{e.widget("ctc.themeMenu",e.ui.selectmenu,{_renderItem:function(t,c){var a=e("<li>");return e("#ctc_theme_option_"+c.value).detach().appendTo(a),a.appendTo(t)}})}catch(rt){B(rt,"Theme Menu")}try{e("#ctc_theme_parnt").themeMenu({select:function(e,t){N(t.item)}})}catch(rt){"function"==typeof themeMenu?e("#ctc_theme_parnt").themeMenu("destroy"):e("#ctc_theme_parnt-button").remove(),B(rt,"Parent Theme Menu")}if(h(ctcAjax.themes.child))e("#ctc_child_name").length&&(e("#ctc_child_name").val(Z),e("#ctc_child_template").val(Y));else try{e("#ctc_theme_child").themeMenu({select:function(e,t){I(t.item)}})}catch(rt){"function"==typeof themeMenu?e("#ctc_theme_child").themeMenu("destroy"):e("#ctc_theme_child-button").remove(),B(rt,"Child Theme Menu")}}e(".nav-tab").on("click",function(t){t.preventDefault(),e(".ctc-status-icon").remove();var c="#"+e(this).attr("id");i(c)}),h(lt)?(e("#ctc_main").on("focus",".color-picker",function(){try{e(".color-picker").not(this).iris("hide"),e(this).iris("toggle"),e(".iris-picker").css({position:"absolute","z-index":10})}catch(t){B(t,"Iris Color Picker")}}),e("#ctc_main").on("change",".ctc-child-value, input[type=checkbox]",function(){_(this)}),e("#ctc_main").on("click",".ctc-selector-handle",function(t){t.preventDefault();var c=e(this).attr("id").toString().replace("_close",""),a=c.toString().match(/_(\d+)$/)[1];e("#"+c+"_container").is(":hidden")&&(1!=tt.val_qry&&(tt.val_qry=0),q(a)),e("#"+c+"_container").fadeToggle("fast"),e(".ctc-selector-container").not("#"+c+"_container").fadeOut("fast")}),e("#ctc_main").on("click",".ctc-save-input",function(){O(this,v)}),e("#ctc_main").on("click",".ctc-selector-edit",function(){z(this)}),e("#ctc_main").on("click",".ctc-rewrite-toggle",function(e){e.preventDefault(),s(this)}),e("#ctc_main").on("click",".ctc-section-toggle",function(){e(this).toggleClass("open");var t=e(this).attr("id")+"_content";e("#"+t).slideToggle("fast")}),e("#ctc_main").on("click","#ctc_copy_selector",function(){var t=e("#ctc_sel_ovrd_selector_selected").text().trim();!1===h(t)&&e("#ctc_new_selectors").val(e("#ctc_new_selectors").val()+"\n"+t+" {\n\n}")}),e("#ctc_configtype").on("change",function(){var t=e(this).val();if(h(t)||"theme"==t){e(".ctc-theme-only, .ctc-themeonly-container").removeClass("ctc-disabled"),e(".ctc-theme-only, .ctc-themeonly-container input").prop("disabled",!1);try{e("#ctc_theme_parnt, #ctc_theme_child").themeMenu("enable")}catch(c){B(c,"Theme Menu")}}else{e(".ctc-theme-only, .ctc-themeonly-container").addClass("ctc-disabled"),e(".ctc-theme-only, .ctc-themeonly-container input").prop("disabled",!0);try{e("#ctc_theme_parnt, #ctc_theme_child").themeMenu("disable")}catch(c){B(c,"Theme Menu")}}}),e("#view_child_options, #view_parnt_options").on("click",function(){w(e(this).attr("id"))}),e("#ctc_load_form").on("submit",function(){return l()}),e("#ctc_theme_child, #ctc_theme_child-button, #ctc_child_type_existing").on("focus click",function(){e("#ctc_child_type_existing").prop("checked",!0),e("#ctc_child_type_new").prop("checked",!1),e("#ctc_child_template").val(""),R()}),e("#ctc_child_type_new, #ctc_child_template").on("focus click",function(){e("#ctc_child_type_existing").prop("checked",!1),e("#ctc_child_type_new").prop("checked",!0),e("#ctc_child_name").val(Z),e("#ctc_child_template").val(Y)}),e("#recent_edits").on("click",function(t){return t.preventDefault(),e(".ctc-recent-container").is(":visible")?(e(".ctc-recent-container").stop().slideUp(),e(".ctc-option-panel").css({width:"95%"})):(e(".ctc-recent-container").hasClass("moved")||e(".ctc-recent-container").addClass("moved").detach().appendTo("#ctc_option_panel_wrapper"),e(".ctc-recent-container").stop().slideDown(),e(".ctc-option-panel").css({width:"80%"})),!1}),e("#ctc_is_debug").on("change",function(){O(this)}),e(".ctc-live-preview").on("click",function(t){return t.stopImmediatePropagation(),t.preventDefault(),document.location=e(this).prop("href"),!1}),v(),P(et),E(),k(),e("input[type=submit], input[type=button]").prop("disabled",!1),setTimeout(o,15e3)):G()});
|
1 |
+
!function(e){e.chldthmcfg={esc_quot:function(e){var t=this;return t.is_empty(e)?e:e.toString().replace(/"/g,""")},getxt:function(e){return(text=ctcAjax[e+"_txt"])?text:""},from_ascii:function(e){var t=parseInt(e),c=String.fromCharCode(t);return c},to_ascii:function(e){var t=e.charCodeAt(0);return t},is_empty:function(e){if("undefined"==typeof e||!1===e||null===e||""===e)return!0;if(!0===e||"string"==typeof e||"number"==typeof e)return!1;if("object"==typeof e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}return!1},theme_exists:function(t,c){var n=!1;return e.each(ctcAjax.themes,function(i,r){return e.each(r,function(e){return e!=t||"parnt"!=i&&"new"!=c?void 0:(n=!0,!1)}),n?!1:void 0}),n},validate:function(){var t=this,c=/[^\w\-]/,n=e("#ctc_child_template").length?e("#ctc_child_template").val().toString().replace(c).toLowerCase():"",i=e("#ctc_theme_child").length?e("#ctc_theme_child").val().toString().replace(c).toLowerCase():n,r=e("input[name=ctc_child_type]:checked").val(),a=[];return"new"==r&&(i=n),t.theme_exists(i,r)&&a.push(t.getxt("theme_exists").toString().replace(/%s/,i)),""===i&&a.push(t.getxt("inval_theme")),""===e("#ctc_child_name").val()&&a.push(t.getxt("inval_name")),a.length?(t.set_notice({error:a}),!1):!0},autogen_slugs:function(){if(e("#ctc_theme_parnt").length){for(var t=this,c=e("#ctc_theme_parnt").val(),n=slugbase=c+"-child",i=ctcAjax.themes.parnt[c].Name+" Child",r="",a="",s="00";t.theme_exists(n,"new");)r=""==r?2:r+1,a=s.substring(0,s.length-r.toString().length)+r.toString(),n=slugbase+a;t.testslug=n,t.testname=i+(a.length?" "+a:"")}},focus_panel:function(t){var c=t+"_panel";e(".nav-tab").removeClass("nav-tab-active"),e(".ctc-option-panel").removeClass("ctc-option-panel-active"),e(".ctc-selector-container").hide(),e(t).addClass("nav-tab-active"),e(".ctc-option-panel-container").scrollTop(0),e(c).addClass("ctc-option-panel-active")},selector_input_toggle:function(t){var c,n=this;e("#ctc_rewrite_selector").length?(c=e("#ctc_rewrite_selector_orig").val(),e("#ctc_sel_ovrd_selector_selected").text(c),e(t).text(n.getxt("rename"))):(c=e("#ctc_sel_ovrd_selector_selected").text(),e("#ctc_sel_ovrd_selector_selected").html('<textarea id="ctc_rewrite_selector" name="ctc_rewrite_selector" autocomplete="off"></textarea><input id="ctc_rewrite_selector_orig" name="ctc_rewrite_selector_orig" type="hidden" value="'+n.esc_quot(c)+'"/>'),e("#ctc_rewrite_selector").val(c),e(t).text(n.getxt("cancel")))},fade_update_notice:function(){e(".updated, .error").slideUp("slow",function(){e(".updated").remove()})},coalesce_inputs:function(t){var c=this,n=/^(ctc_(ovrd|\d+)_(parent|child)_([0-9a-z\-]+)_(\d+))(_\w+)?$/,i=e(t).parents(".ctc-selector-row, .ctc-parent-row").first(),r=i.find(".ctc-swatch").first(),a={parent:{},child:{}},s={parent:{origin:"",start:"",end:""},child:{origin:"",start:"",end:""}},l={child:!1,parent:!1},o={};return i.find(".ctc-parent-value, .ctc-child-value").each(function(){var i,r,_=e(this).attr("id"),u=_.toString().match(n),d=u[2],p=u[3],h="undefined"==typeof u[4]?"":u[4],m=u[5],v="undefined"==typeof u[6]?"":u[6],f="parent"==p?e(this).text().replace(/!$/,""):e(this).val(),g="ctc_"+d+"_child_"+h+"_i_"+m;if(c.is_empty(e(this).data("color"))||(f=e(this).data("color"),e(this).data("color",null)),"child"==p&&(o[_]=f,o[g]=e("#"+g).is(":checked")?1:0),""!=f)if(c.is_empty(v))(i=h.toString().match(/^border(\-(top|right|bottom|left))?$/)&&!f.match(/none/))?(r=f.toString().split(/ +/),a[p][h+"-width"]="undefined"==typeof r[0]?"":r[0],a[p][h+"-style"]="undefined"==typeof r[1]?"":r[1],a[p][h+"-color"]="undefined"==typeof r[2]?"":r[2]):"background-image"!=h||f.match(/none/)?"seq"!=h&&(a[p][h]=f):f.toString().match(/url\(/)?a[p]["background-image"]=c.image_url(p,f):(r=f.toString().split(/ +/),r.length>2?(s[p].origin="undefined"==typeof r[0]?"top":r[0],s[p].start="undefined"==typeof r[1]?"transparent":r[1],s[p].end="undefined"==typeof r[2]?"transparent":r[2],l[p]=!0):a[p]["background-image"]=f);else switch(v){case"_border_width":a[p][h+"-width"]="none"==f?0:f;break;case"_border_style":a[p][h+"-style"]=f;break;case"_border_color":a[p][h+"-color"]=f;break;case"_background_url":a[p]["background-image"]=c.image_url(p,f);break;case"_background_color":a[p]["background-color"]=t.value;break;case"_background_color1":s[p].start=f,l[p]=!0;break;case"_background_color2":s[p].end=f,l[p]=!0;break;case"_background_origin":s[p].origin=f,l[p]=!0}}),"undefined"==typeof r||c.is_empty(r.attr("id"))||(r.removeAttr("style"),l.parent&&r.ctcgrad(s.parent.origin,[s.parent.start,s.parent.end]),r.css(a.parent),r.attr("id").toString().match(/parent/)||(l.child&&r.ctcgrad(s.child.origin,[s.child.start,s.child.end]),r.css(a.child)),r.css({"z-index":-1})),o},decode_value:function(e,t){t="undefined"==typeof t?"":t;var c=this,n={orig:t};if(e.toString().match(/^border(\-(top|right|bottom|left))?$/)){var i=t.toString().split(/ +/);n.names=["_border_width","_border_style","_border_color"],n.values=["undefined"==typeof i[0]?"":i[0],"undefined"==typeof i[1]?"":i[1],"undefined"==typeof i[2]?"":i[2]]}else if(e.toString().match(/^background\-image/))if(n.names=["_background_url","_background_origin","_background_color1","_background_color2"],n.values=["","","",""],!1!==c.is_empty(t)||t.toString().match(/(url|none)/))n.values[0]=t;else{var i=t.toString().split(/:/);n.values[1]="undefined"==typeof i[0]?"":i[0],n.values[2]="undefined"==typeof i[1]?"":i[1],n.values[3]="undefined"==typeof i[3]?"":i[3],n.orig=[n.values[1],n.values[2],n.values[3]].join(" ")}else n.names=[""],n.values=[t];return n},image_url:function(e,t){var c,n=this,i=t.toString().match(/url\(['" ]*(.+?)['" ]*\)/),r=n.is_empty(i)?null:i[1],a=ctcAjax.theme_uri+"/"+("parent"==e?ctcAjax.parnt:ctcAjax.child)+"/";return r?c=r.toString().match(/^(data:|https?:|\/)/)?t:"url("+a+r+")":!1},setup_menus:function(){var e=this;e.setup_query_menu(),e.setup_selector_menu(),e.setup_rule_menu(),e.setup_new_rule_menu(),e.load_queries(),e.load_rules(),e.set_query(e.current_query)},load_queries:function(){var e=this;e.query_css("queries",null)},load_selectors:function(){var e=this;e.query_css("selectors",e.current_query)},load_rules:function(){var e=this;e.query_css("rules",null)},load_selector_values:function(){var e=this;e.query_css("qsid",e.current_qsid)},get_queries:function(t,c){var n=[],i=new RegExp(e.ui.autocomplete.escapeRegex(t.term),"i");e.each(this.element.data("menu"),function(e,t){i.test(t)&&n.push({label:t,value:t})}),c(n)},get_selectors:function(t,c){var n=[],i=new RegExp(e.ui.autocomplete.escapeRegex(t.term),"i");e.each(this.element.data("menu"),function(e,t){i.test(e)&&n.push({label:e,value:t})}),c(n)},get_rules:function(t,c){var n=[],i=new RegExp(e.ui.autocomplete.escapeRegex(t.term),"i");e.each(this.element.data("menu"),function(e,t){i.test(e)&&n.push({label:e,value:t})}),c(n)},get_filtered_rules:function(t,c){var n=[],i=new RegExp(e.ui.autocomplete.escapeRegex(t.term),"i"),r=e.chldthmcfg.current_qsdata,a=e.chldthmcfg.is_empty(r)||e.chldthmcfg.is_empty(r.value);e.each(e("#ctc_rule_menu").data("menu"),function(t,c){var s=!1;if(i.test(t)){if(!a&&(e.each(r.value,function(e){return t==e.replace(/\d+/g,self.from_ascii)?(s=!0,!1):void 0}),s))return;n.push({label:t,value:c})}}),c(n)},input_row:function(t,c,n,i){var r=this,a="",s=r.is_empty(i)||r.is_empty(i.value)||r.is_empty(i.value[c])?"":i.value[c],l=r.decode_value(c,r.is_empty(s)?"":s.parnt),o=r.is_empty(s)||r.is_empty(s.i_parnt)||1!=s.i_parnt?"":r.getxt("important"),_=r.decode_value(c,r.is_empty(s)?"":s.child),u=r.is_empty(s)||r.is_empty(s.i_child)||1!=s.i_child?0:1,d="ctc_"+n+"_child_"+c+"_i_"+t;return r.is_empty(i)||(a+='<div class="ctc-'+("ovrd"==n?"input":"selector")+'-row clearfix">\n<div class="ctc-input-cell">'+("ovrd"==n?c.replace(/\d+/g,r.from_ascii):i.selector+'<br/><a href="#" class="ctc-selector-edit" id="ctc_selector_edit_'+t+'" >'+r.getxt("edit")+"</a> "+(r.is_empty(l.orig)?r.getxt("child_only"):""))+"</div>\n","ovrd"==n&&(a+='<div class="ctc-parent-value ctc-input-cell" id="ctc_'+n+"_parent_"+c+"_"+t+'">'+(r.is_empty(l.orig)?"[no value]":l.orig+o)+"</div>\n"),a+='<div class="ctc-input-cell">\n',r.is_empty(l.names)||(e.each(l.names,function(e,i){i=r.is_empty(i)?"":i,a+='<div class="ctc-child-input-cell">\n';var s,l="ctc_"+n+"_child_"+c+"_"+t+i;!1===(s=_.values.shift())&&(s=""),a+=(r.is_empty(i)?"":r.getxt(i)+":<br/>")+'<input type="text" id="'+l+'" name="'+l+'" class="ctc-child-value'+((i+c).toString().match(/color/)?" color-picker":"")+(i.toString().match(/url/)?" ctc-input-wide":"")+'" value="'+r.esc_quot(s)+'" />\n</div>\n'}),a+='<label for="'+d+'"><input type="checkbox" id="'+d+'" name="'+d+'" value="1" '+(1===u?"checked":"")+" />"+r.getxt("important")+"</label>\n"),a+="</div>\n"+("ovrd"==n?"":'<div class="ctc-swatch ctc-specific" id="ctc_child_'+c+"_"+t+'_swatch">'+r.getxt("swatch")+'</div>\n<div class="ctc-child-input-cell ctc-button-cell" id="ctc_save_'+c+"_"+t+'_cell">\n<input type="button" class="button ctc-save-input" id="ctc_save_'+c+"_"+t+'" name="ctc_save_'+c+"_"+t+'" value="Save" /></div>\n')+"</div><!-- end input row -->\n"),a},scrolltop:function(){e("html, body, .ctc-option-panel-container").animate({scrollTop:0})},css_preview:function(e){var e,t=this;(e=e.match(/(child|parnt)/)[1])||(e="child"),t.query_css("preview",e)},setup_iris:function(t){var c=this;try{e(t).iris({change:function(n,i){e(t).data("color",i.color.toString()),c.coalesce_inputs(t)}})}catch(n){c.jquery_exception(n,"Iris Color Picker")}},setup_query_menu:function(){var t=this;try{e("#ctc_sel_ovrd_query").autocomplete({source:t.get_queries,minLength:0,selectFirst:!0,autoFocus:!0,select:function(e,c){return t.set_query(c.item.value),!1},focus:function(e){e.preventDefault()}}).data("menu",{})}catch(c){t.jquery_exception(c,"Query Menu")}},setup_selector_menu:function(){var t=this;try{e("#ctc_sel_ovrd_selector").autocomplete({source:t.get_selectors,selectFirst:!0,autoFocus:!0,select:function(e,c){return t.set_selector(c.item.value,c.item.label),!1},focus:function(e){e.preventDefault()}}).data("menu",{})}catch(c){t.jquery_exception(c,"Selector Menu")}},setup_rule_menu:function(){var t=this;try{e("#ctc_rule_menu").autocomplete({source:t.get_rules,selectFirst:!0,autoFocus:!0,select:function(e,c){return t.set_rule(c.item.value,c.item.label),!1},focus:function(e){e.preventDefault()}}).data("menu",{})}catch(c){t.jquery_exception(c,"Rule Menu")}},setup_new_rule_menu:function(){var t=this;try{e("#ctc_new_rule_menu").autocomplete({source:t.get_filtered_rules,selectFirst:!0,autoFocus:!0,select:function(c,n){c.preventDefault(),t.is_empty(t.current_qsdata.value)&&(t.current_qsdata.value={}),t.current_qsdata.value[n.item.label]={child:""};var i=n.item.label.replace(/[^\w\-]/g,t.to_ascii),r=e(t.input_row(t.current_qsid,i,"ovrd",t.current_qsdata));return e("#ctc_sel_ovrd_rule_inputs").append(r),e("#ctc_new_rule_menu").val(""),r.find('input[type="text"]').each(function(c,n){e(n).hasClass("color-picker")&&t.setup_iris(n),e(n).focus()}),t.jquery_err.length&&t.jquery_notice(),!1},focus:function(e){e.preventDefault()}}).data("menu",{})}catch(c){t.jquery_exception(c,"New Rule Menu")}},set_existing:function(){var t=this;if(e("#ctc_theme_child").length&&e("#ctc_child_type_existing").is(":checked")){var c=e("#ctc_theme_child").val();t.is_empty(c)||(e("#ctc_child_name").val(ctcAjax.themes.child[c].Name),e("#ctc_child_author").val(ctcAjax.themes.child[c].Author),e("#ctc_child_version").val(ctcAjax.themes.child[c].Version),e("#ctc_child_authoruri").val(ctcAjax.themes.child[c].AuthorURI),e("#ctc_child_themeuri").val(ctcAjax.themes.child[c].ThemeURI),e("#ctc_child_descr").val(ctcAjax.themes.child[c].Descr),e("#ctc_child_tags").val(ctcAjax.themes.child[c].Tags))}},set_notice:function(t){var c=this,n="";c.is_empty(t)||e.each(t,function(t,c){n+='<div class="'+t+'"><ul>\n',e(c).each(function(e,t){n+="<li>"+t.toString()+"</li>\n"}),n+="</ul></div>"}),e("#ctc_error_notice").html(n),e("html, body").animate({scrollTop:0},"slow")},set_parent_menu:function(t){e("#ctc_theme_parent").parents(".ctc-input-row").first().append('<span class="ctc-status-icon spinner"></span>'),e(".spinner").show(),document.location="?page="+ctcAjax.page+"&ctc_parent="+t.value},set_child_menu:function(t){var c=this;c.is_empty(ctcAjax.themes.child[t.value])||(e("#ctc_child_name").val(ctcAjax.themes.child[t.value].Name),e("#ctc_child_author").val(ctcAjax.themes.child[t.value].Author),e("#ctc_child_version").val(ctcAjax.themes.child[t.value].Version))},set_query:function(t){var c=this;c.current_query=t,e("#ctc_sel_ovrd_query").val(""),e("#ctc_sel_ovrd_query_selected").text(t),e("#ctc_sel_ovrd_selector").val(""),e("#ctc_sel_ovrd_selector_selected").html(" "),c.load_selectors()},set_selector:function(t){var c=this;e("#ctc_sel_ovrd_selector").val(""),c.current_qsid=t,c.reload_menus=!1,c.load_selector_values()},set_rule:function(t,c){var n=this;e("#ctc_rule_menu").val(""),e("#ctc_rule_menu_selected").text(c),e(".ctc-rewrite-toggle").text(n.getxt("rename")),e("#ctc_rule_value_inputs, #ctc_input_row_rule_header").show(),n.query_css("rule_val",t)},set_qsid:function(t){var c=this;c.current_qsid=e(t).attr("id").match(/_(\d+)$/)[1],c.focus_panel("#query_selector_options"),c.reload_menus=!0,c.load_selector_values()},set_addl_css:function(){var t,c=this,n=e("#ctc_theme_parnt").val(),i=ctcAjax.theme_uri.replace(/^https?:\/\//,""),r=ctcAjax.homeurl.replace(/^https?/,ctcAjax.ssl?"https":"http"),a=r+"?preview=1&p=x&template="+n+"&stylesheet="+n,s=new RegExp("<link rel=[\"']stylesheet[\"'][^>]+?"+i+"/"+n+"/(.+?\\.css)[^>]+?>","g");c.is_empty(n)||(n!=ctcAjax.parnt?e.get(a,function(c){for(;(t=s.exec(c))&&"style.css"!=t[1];)t[1].match(/bootstrap/)||e(".ctc_checkbox").each(function(){e(this).val()==t[1]&&e(this).prop("checked",!0)});c=null}):e(ctcAjax.addl_css).each(function(t,c){e("#ctc_stylesheet_files .ctc_checkbox").each(function(){e(this).val()==c&&e(this).prop("checked",!0)})}))},query_css:function(t,c,n){var i=this,r={ctc_query_obj:t,ctc_query_key:c},a="#ctc_status_"+t+("val_qry"==t?"_"+c:"");"object"==typeof n&&e.each(n,function(e,t){r["ctc_query_"+e]=t}),e(".query-icon").remove(),e(a+" .ctc-status-icon").remove(),e(a).append('<span class="ctc-status-icon spinner query-icon"></span>'),e(".spinner").show(),r.action=i.is_empty(e("#ctc_action").val())||"plugin"!=e("#ctc_action").val()?"ctc_query":"ctc_plgqry",r._wpnonce=e("#_wpnonce").val(),i.ajax_post(t,r)},save:function(t){var c,n,i,r,a,s=this,l=(ctcAjax.ajaxurl,{}),o=e(t).attr("id");e(t).prop("disabled",!0),e(".ctc-status-icon").remove(),e(t).parent(".ctc-textarea-button-cell, .ctc-button-cell").append('<span class="ctc-status-icon spinner save-icon"></span>'),o.match(/ctc_configtype/)?(e(t).parents(".ctc-input-row").first().append('<span class="ctc-status-icon spinner save-icon"></span>'),l.ctc_configtype=e(t).val()):(c=e("#ctc_new_selectors"))&&"ctc_save_new_selectors"==e(t).attr("id")?(l.ctc_new_selectors=c.val(),(n=e("#ctc_sel_ovrd_query_selected"))&&(l.ctc_sel_ovrd_query=n.text()),s.reload_menus=!0):(i=e("#ctc_child_imports"))&&"ctc_save_imports"==e(t).attr("id")?l.ctc_child_imports=i.val():"ctc_is_debug"==e(t).attr("id")?l.ctc_is_debug=e("#ctc_is_debug").is(":checked")?1:0:l=s.coalesce_inputs(t),e(".save-icon").show(),e("#ctc_sel_ovrd_selector_selected").find("#ctc_rewrite_selector").each(function(){r=e("#ctc_rewrite_selector").val(),a=e("#ctc_rewrite_selector_orig").val(),s.is_empty(r)||!r.toString().match(/\w/)?r=a:(l.ctc_rewrite_selector=r,s.reload_menus=!0),e(".ctc-rewrite-toggle").text(s.getxt("rename")),e("#ctc_sel_ovrd_selector_selected").html(r)}),l.action=s.is_empty(e("#ctc_action").val())||"plugin"!=e("#ctc_action").val()?"ctc_update":"ctc_plugin",l._wpnonce=e("#_wpnonce").val(),s.ajax_post("qsid",l)},ajax_post:function(t,c,n){var i=this,r=ctcAjax.ajaxurl;e.ajax({url:r,data:c,dataType:i.is_empty(n)?"json":n,type:"POST"}).done(function(e){i.handle_success(t,e)}).fail(function(){i.handle_failure(t)})},handle_failure:function(t){var c=this;e(".query-icon, .save-icon").removeClass("spinner").addClass("failure"),e("input[type=submit], input[type=button]").prop("disabled",!1),e(".ajax-pending").removeClass("ajax-pending"),"preview"==t&&e("#view_parnt_options_panel,#view_child_options_panel").text(c.getxt("css_fail"))},handle_success:function(t,c){var n=this;e(".query-icon, .save-icon").removeClass("spinner"),e(".ajax-pending").removeClass("ajax-pending"),n.is_empty(c)?n.handle_failure(t):(e("#ctc_new_selectors").val(""),e(".query-icon, .save-icon").addClass("success"),e("input[type=submit], input[type=button]").prop("disabled",!1),e(c).each(function(){"function"==typeof n.update[this.obj]&&n.update[this.obj].call(n,this)}))},jquery_exception:function(e,t){var c=this,n=c.is_empty(e.lineNumber)?"":" line: "+e.lineNumber,i=c.is_empty(e.fileName)?"":" "+e.fileName.split(/\?/)[0];jquery_err.push("<code><small>"+t+": "+e.message+i+n+"</small></code>")},jquery_notice:function(){var t=this,c=[],n=[];e("input[type=submit], input[type=button]").prop("disabled",!0),e("script").each(function(){var n=e(this).prop("src");t.is_empty(n)||!n.match(/jquery(\.min|\.js|\-?ui)/i)||n.match(/load\-scripts.php/)||c.push("<code><small>"+n.split(/\?/)[0]+"</small></code>")}),n.push("<strong>"+t.getxt("js")+"</strong>"),1==ctcAjax.is_debug&&n.push(jquery_err.join("<br/>")),c.length&&n.push(t.getxt("jquery")+"<br/>"+c.join("<br/>")),n.push(t.getxt("plugin")+" "+t.getxt("contact")),t.set_notice({error:n})},update:{qsid:function(t){var c,n,i,r=this;r.current_qsid=t.key,r.current_qsdata=t.data,e("#ctc_sel_ovrd_qsid").val(r.current_qsid),r.is_empty(r.current_qsdata.seq)?e("#ctc_child_load_order_container").empty():(c="ctc_ovrd_child_seq_"+r.current_qsid,i=parseInt(r.current_qsdata.seq),n='<input type="text" id="'+c+'" name="'+c+'" class="ctc-child-value" value="'+i+'" />',e("#ctc_child_load_order_container").html(n)),r.is_empty(r.current_qsdata.value)?(e("#ctc_sel_ovrd_selector_selected").empty(),e(".ctc-rewrite-toggle").empty(),e("#ctc_sel_ovrd_new_rule,#ctc_sel_ovrd_rule_header,#ctc_sel_ovrd_rule_inputs_container,#ctc_sel_ovrd_rule_inputs,.ctc-rewrite-toggle").hide(),e("#ctc_sel_ovrd_rule_inputs").empty()):(n="",e.each(r.current_qsdata.value,function(e){n+=r.input_row(r.current_qsid,e,"ovrd",r.current_qsdata)}),e("#ctc_sel_ovrd_rule_inputs").html(n).find(".color-picker").each(function(){r.setup_iris(this)}),r.coalesce_inputs("#ctc_child_all_0_swatch"),r.jquery_err.length?r.jquery_notice():(r.reload_menus&&(r.set_query(r.current_qsdata.query),r.load_rules()),e("#ctc_sel_ovrd_selector_selected").text(r.current_qsdata.selector),e(".ctc-rewrite-toggle").text(r.getxt("rename")),e("#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(),r.scrolltop()))},rule_val:function(t){var c=this,n=e("#ctc_rule_menu_selected").text(),i='<div class="ctc-input-row clearfix" id="ctc_rule_row_'+n+'">\n';c.is_empty(t.data)||(e.each(t.data,function(e,t){var r=c.decode_value(n,t);i+='<div class="ctc-parent-row clearfix" id="ctc_rule_row_'+n+"_"+e+'">\n<div class="ctc-input-cell ctc-parent-value" id="ctc_'+e+"_parent_"+n+"_"+e+'">'+r.orig+'</div>\n<div class="ctc-input-cell">\n<div class="ctc-swatch ctc-specific" id="ctc_'+e+"_parent_"+n+"_"+e+'_swatch">'+c.getxt("swatch")+'</div></div>\n<div class="ctc-input-cell"><a href="#" class="ctc-selector-handle" id="ctc_selector_'+n+"_"+e+'">'+c.getxt("selector")+'</a></div>\n<div id="ctc_selector_'+n+"_"+e+'_container" class="ctc-selector-container">\n<a href="#" id="ctc_selector_'+n+"_"+e+'_close" class="ctc-selector-handle ctc-exit" title="'+c.getxt("close")+'"></a><div id="ctc_selector_'+n+"_"+e+'_inner_container" class="ctc-selector-inner-container clearfix">\n<div id="ctc_status_val_qry_'+e+'"></div>\n<div id="ctc_selector_'+n+"_"+e+'_rows"></div>\n</div></div></div>\n'}),i+="</div>\n"),e("#ctc_rule_value_inputs").html(i).find(".ctc-swatch").each(function(){c.coalesce_inputs(this)})},val_qry:function(t){var c=this,n="";c.is_empty(t.data)||e.each(t.data,function(i,r){page_rule=i,e.each(r,function(r,a){n+='<h4 class="ctc-query-heading">'+r+"</h4>\n",c.is_empty(a)||e.each(a,function(e,r){n+=c.input_row(e,i,t.key,r)})})}),selector="#ctc_selector_"+rule+"_"+t.key+"_rows",e(selector).html(n).find(".color-picker").each(function(){c.setup_iris(this)}),e(selector).find(".ctc-swatch").each(function(){c.coalesce_inputs(this)}),c.jquery_err.length&&c.jquery_notice()},queries:function(t){e("#ctc_sel_ovrd_query").data("menu",t.data)},selectors:function(t){e("#ctc_sel_ovrd_selector").data("menu",t.data)},rules:function(t){e("#ctc_rule_menu").data("menu",t.data)},debug:function(t){e("#ctc_debug_container").html(t.data)},preview:function(t){e("#view_"+t.key+"_options_panel").text(t.data)}},init:function(){var t=this;if(t.autogen_slugs(),t.set_existing(),!e("#ctc_theme_parnt").is("input")){try{e.widget("ctc.themeMenu",e.ui.selectmenu,{_renderItem:function(t,c){var n=e("<li>");return e("#ctc_theme_option_"+c.value).detach().appendTo(n),n.appendTo(t)}})}catch(c){t.jquery_exception(c,"Theme Menu")}try{e("#ctc_theme_parnt").themeMenu({select:function(e,c){t.set_parent_menu(c.item)}})}catch(c){"function"==typeof themeMenu?e("#ctc_theme_parnt").themeMenu("destroy"):e("#ctc_theme_parnt-button").remove(),t.jquery_exception(c,"Parent Theme Menu")}if(t.is_empty(ctcAjax.themes.child))e("#ctc_child_name").length&&(e("#ctc_child_name").val(t.testname),e("#ctc_child_template").val(t.testslug));else try{e("#ctc_theme_child").themeMenu({select:function(e,c){t.set_child_menu(c.item)}})}catch(c){"function"==typeof themeMenu?e("#ctc_theme_child").themeMenu("destroy"):e("#ctc_theme_child-button").remove(),t.jquery_exception(c,"Child Theme Menu")}}t.is_empty(t.jquery_err)?(e("#ctc_main").on("focus",".color-picker",function(){try{e(".color-picker").not(this).iris("hide"),e(this).iris("toggle"),e(".iris-picker").css({position:"absolute","z-index":10})}catch(c){t.jquery_exception(c,"Iris Color Picker")}}),e("#ctc_main").on("change",".ctc-child-value, input[type=checkbox]",function(){t.coalesce_inputs(this)}),e("#ctc_main").on("click",".ctc-selector-handle",function(c){if(c.preventDefault(),e(this).hasClass("ajax-pending"))return!1;e(this).addClass("ajax-pending");var n=e(this).attr("id").toString().replace("_close",""),i=n.toString().match(/_([^_]+)_(\d+)$/);e("#"+n+"_container").is(":hidden")&&(t.is_empty(i[1])||t.is_empty(i[2])||(rule=i[1],valid=i[2],t.query_css("val_qry",valid,{rule:rule}))),e("#"+n+"_container").fadeToggle("fast"),e(".ctc-selector-container").not("#"+n+"_container").fadeOut("fast")}),e("#ctc_main").on("click",".ctc-save-input[type=button]",function(){return e(this).hasClass("ajax-pending")?!1:(e(this).addClass("ajax-pending"),void t.save(this))}),e("#ctc_main").on("click",".ctc-selector-edit",function(c){return c.preventDefault(),e(this).hasClass("ajax-pending")?!1:(e(this).addClass("ajax-pending"),void t.set_qsid(this))}),e("#ctc_main").on("click",".ctc-rewrite-toggle",function(e){e.preventDefault(),t.selector_input_toggle(this)}),e("#ctc_main").on("click","#ctc_copy_selector",function(){var c=e("#ctc_sel_ovrd_selector_selected").text().trim();t.is_empty(c)||e("#ctc_new_selectors").val(e("#ctc_new_selectors").val()+"\n"+c+" {\n\n}")}),e("#ctc_configtype").on("change",function(){var c=e(this).val();if(t.is_empty(c)||"theme"==c){e(".ctc-theme-only, .ctc-themeonly-container").removeClass("ctc-disabled"),e(".ctc-theme-only, .ctc-themeonly-container input").prop("disabled",!1);try{e("#ctc_theme_parnt, #ctc_theme_child").themeMenu("enable")}catch(n){t.jquery_exception(n,"Theme Menu")}}else{e(".ctc-theme-only, .ctc-themeonly-container").addClass("ctc-disabled"),e(".ctc-theme-only, .ctc-themeonly-container input").prop("disabled",!0);try{e("#ctc_theme_parnt, #ctc_theme_child").themeMenu("disable")}catch(n){t.jquery_exception(n,"Theme Menu")}}}),e(".nav-tab").on("click",function(c){c.preventDefault(),e(".ctc-status-icon").remove();var n="#"+e(this).attr("id");t.focus_panel(n)}),e(".ctc-section-toggle").on("click",function(){e(this).toggleClass("open");var t=e(this).attr("id")+"_content";e("#"+t).slideToggle("fast")}),e("#view_child_options, #view_parnt_options").on("click",function(){return e(this).hasClass("ajax-pending")?!1:(e(this).addClass("ajax-pending"),void t.css_preview(e(this).attr("id")))}),e("#ctc_load_form").on("submit",function(){return t.validate()}),e("#ctc_query_selector_form").on("submit",function(c){return c.preventDefault(),$this=e("#ctc_save_query_selector"),$this.hasClass("ajax-pending")?!1:($this.addClass("ajax-pending"),t.save($this),!1)}),e("#ctc_theme_child, #ctc_theme_child-button, #ctc_child_type_existing").on("focus click",function(){e("#ctc_child_type_existing").prop("checked",!0),e("#ctc_child_type_new").prop("checked",!1),e("#ctc_child_template").val(""),t.set_existing()}),e("#ctc_child_type_new, #ctc_child_template").on("focus click",function(){e("#ctc_child_type_existing").prop("checked",!1),e("#ctc_child_type_new").prop("checked",!0),e("#ctc_child_name").val(t.testname),e("#ctc_child_template").val(t.testslug)}),e("#ctc_is_debug").on("change",function(){t.save(this)}),e(".ctc-live-preview").on("click",function(t){return t.stopImmediatePropagation(),t.preventDefault(),document.location=e(this).prop("href"),!1}),t.setup_menus(),t.set_addl_css(),e("input[type=submit], input[type=button]").prop("disabled",!1),t.scrolltop(),setTimeout(t.fade_update_notice,2e4)):t.jquery_notice()},testslug:"",testname:"",reload_menus:!1,current_query:"base",current_qsid:null,current_qsdata:{},jquery_err:[]}}(jQuery),jQuery(document).ready(function(e){e.chldthmcfg.init()});
|
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.
|
6 |
"Report-Msgid-Bugs-To: http://wordpress.org/tag/child-theme-configurator\n"
|
7 |
-
"POT-Creation-Date: 2015-
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
@@ -12,19 +12,19 @@ msgstr ""
|
|
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.
|
16 |
#. Plugin Name of the plugin/theme
|
17 |
-
#: child-theme-configurator.php:
|
18 |
#: includes/forms/main.php:23
|
19 |
msgid "Child Theme Configurator"
|
20 |
msgstr ""
|
21 |
|
22 |
-
#: child-theme-configurator.php:
|
23 |
-
#: child-theme-configurator.php:
|
24 |
msgid "Child Themes"
|
25 |
msgstr ""
|
26 |
|
27 |
-
#: child-theme-configurator.php:
|
28 |
msgid "Child Theme Configurator requires WordPress version %s or later."
|
29 |
msgstr ""
|
30 |
|
@@ -66,187 +66,191 @@ msgstr ""
|
|
66 |
msgid "before activating."
|
67 |
msgstr ""
|
68 |
|
69 |
-
#: includes/class-ctc.php:
|
70 |
msgid "URL/None"
|
71 |
msgstr ""
|
72 |
|
73 |
-
#: includes/class-ctc.php:
|
74 |
msgid "Origin"
|
75 |
msgstr ""
|
76 |
|
77 |
-
#: includes/class-ctc.php:
|
78 |
msgid "Color 1"
|
79 |
msgstr ""
|
80 |
|
81 |
-
#: includes/class-ctc.php:
|
82 |
msgid "Color 2"
|
83 |
msgstr ""
|
84 |
|
85 |
-
#: includes/class-ctc.php:
|
86 |
msgid "Width/None"
|
87 |
msgstr ""
|
88 |
|
89 |
-
#: includes/class-ctc.php:
|
90 |
msgid "Style"
|
91 |
msgstr ""
|
92 |
|
93 |
-
#: includes/class-ctc.php:
|
94 |
msgid "Color"
|
95 |
msgstr ""
|
96 |
|
97 |
-
#: includes/class-ctc.php:
|
98 |
msgid "Are you sure? This will replace your current settings."
|
99 |
msgstr ""
|
100 |
|
101 |
-
#: includes/class-ctc.php:
|
102 |
-
#: includes/forms/rule-value.php:29
|
103 |
-
msgid "Sample"
|
104 |
-
msgstr ""
|
105 |
-
|
106 |
-
#: includes/class-ctc.php:157
|
107 |
msgid "<span style=\"font-size:10px\">!</span>"
|
108 |
msgstr ""
|
109 |
|
110 |
-
#: includes/class-ctc.php:
|
111 |
msgid "Selectors"
|
112 |
msgstr ""
|
113 |
|
114 |
-
#: includes/class-ctc.php:
|
115 |
msgid "Close"
|
116 |
msgstr ""
|
117 |
|
118 |
-
#: includes/class-ctc.php:
|
119 |
msgid "Edit"
|
120 |
msgstr ""
|
121 |
|
122 |
-
#: includes/class-ctc.php:
|
123 |
msgid "Cancel"
|
124 |
msgstr ""
|
125 |
|
126 |
-
#: includes/class-ctc.php:
|
127 |
msgid "Rename"
|
128 |
msgstr ""
|
129 |
|
130 |
-
#: includes/class-ctc.php:
|
131 |
msgid "The stylesheet cannot be displayed."
|
132 |
msgstr ""
|
133 |
|
134 |
-
#: includes/class-ctc.php:
|
135 |
msgid "(Child Only)"
|
136 |
msgstr ""
|
137 |
|
138 |
-
#: includes/class-ctc.php:
|
139 |
msgid "Please enter a valid Child Theme."
|
140 |
msgstr ""
|
141 |
|
142 |
-
#: includes/class-ctc.php:
|
143 |
msgid "Please enter a valid Child Theme name."
|
144 |
msgstr ""
|
145 |
|
146 |
-
#: includes/class-ctc.php:
|
147 |
msgid "<strong>%s</strong> exists. Please enter a different Child Theme"
|
148 |
msgstr ""
|
149 |
|
150 |
-
#: includes/class-ctc.php:
|
151 |
msgid ""
|
152 |
"The page could not be loaded correctly so some controls have been disabled."
|
153 |
msgstr ""
|
154 |
|
155 |
-
#: includes/class-ctc.php:
|
156 |
msgid "Conflicting jQuery libraries were loaded by another plugin:"
|
157 |
msgstr ""
|
158 |
|
159 |
-
#: includes/class-ctc.php:
|
160 |
msgid "Deactivating other plugins may resolve this issue."
|
161 |
msgstr ""
|
162 |
|
163 |
-
#: includes/class-ctc.php:
|
164 |
msgid "%sWhy am I seeing this?%s"
|
165 |
msgstr ""
|
166 |
|
167 |
-
#: includes/class-ctc.php:
|
168 |
msgid "Zip file creation failed."
|
169 |
msgstr ""
|
170 |
|
171 |
-
#: includes/class-ctc.php:
|
172 |
msgid "The Functions file is required and cannot be deleted."
|
173 |
msgstr ""
|
174 |
|
175 |
-
#: includes/class-ctc.php:
|
176 |
msgid "You do not have permission to configure child themes."
|
177 |
msgstr ""
|
178 |
|
179 |
-
#: includes/class-ctc.php:
|
180 |
msgid "%s does not exist. Please select a valid Parent Theme."
|
181 |
msgstr ""
|
182 |
|
183 |
-
#: includes/class-ctc.php:
|
184 |
msgid "Please select a valid Parent Theme."
|
185 |
msgstr ""
|
186 |
|
187 |
-
#: includes/class-ctc.php:
|
188 |
msgid "Please enter a valid Child Theme directory."
|
189 |
msgstr ""
|
190 |
|
191 |
-
#: includes/class-ctc.php:
|
192 |
-
msgid "Your theme directories are not writable."
|
193 |
-
msgstr ""
|
194 |
-
|
195 |
-
#: includes/class-ctc.php:554
|
196 |
msgid "Please enter a valid Child Theme template name."
|
197 |
msgstr ""
|
198 |
|
199 |
-
#: includes/class-ctc.php:
|
200 |
msgid ""
|
201 |
"<strong>%s</strong> exists. Please enter a different Child Theme template "
|
202 |
"name."
|
203 |
msgstr ""
|
204 |
|
205 |
-
#: includes/class-ctc.php:
|
|
|
|
|
|
|
|
|
206 |
msgid "Your stylesheet is not writable."
|
207 |
msgstr ""
|
208 |
|
209 |
-
#: includes/class-ctc.php:
|
210 |
-
msgid "
|
|
|
|
|
|
|
|
|
|
|
211 |
msgstr ""
|
212 |
|
213 |
-
#: includes/class-ctc.php:
|
|
|
|
|
|
|
|
|
214 |
msgid "Could not set write permissions."
|
215 |
msgstr ""
|
216 |
|
217 |
-
#: includes/class-ctc.php:
|
218 |
msgid "There were errors while resetting permissions."
|
219 |
msgstr ""
|
220 |
|
221 |
-
#: includes/class-ctc.php:
|
222 |
msgid "Could not upload file."
|
223 |
msgstr ""
|
224 |
|
225 |
-
#: includes/class-ctc.php:
|
226 |
msgid ""
|
227 |
"Child Theme Configurator is unable to write to the stylesheet. This can be "
|
228 |
"resolved using one of the following options:<ol>"
|
229 |
msgstr ""
|
230 |
|
231 |
-
#: includes/class-ctc.php:
|
232 |
msgid ""
|
233 |
"<li>Temporarily make the stylesheet writable by clicking the button below. "
|
234 |
"You should change this back when you are finished editing for security by "
|
235 |
"clicking \"Make read-only\" under the \"Files\" tab.</li>"
|
236 |
msgstr ""
|
237 |
|
238 |
-
#: includes/class-ctc.php:
|
239 |
msgid "Temporarily make stylesheet writable"
|
240 |
msgstr ""
|
241 |
|
242 |
-
#: includes/class-ctc.php:
|
243 |
msgid ""
|
244 |
"<li><a target=\"_blank\" href=\"http://codex.wordpress.org/Editing_wp-"
|
245 |
"config.php#WordPress_Upgrade_Constants\" title=\"Editin wp-config.php\">Add "
|
246 |
"your FTP/SSH credentials to the WordPress config file</a>.</li>"
|
247 |
msgstr ""
|
248 |
|
249 |
-
#: includes/class-ctc.php:
|
250 |
msgid ""
|
251 |
"<li><a target=\"_blank\" href=\"http://technet.microsoft.com/en-us/library/"
|
252 |
"cc771170\" title=\"Setting Application Pool Identity\">Assign WordPress to "
|
@@ -254,7 +258,7 @@ msgid ""
|
|
254 |
"li>"
|
255 |
msgstr ""
|
256 |
|
257 |
-
#: includes/class-ctc.php:
|
258 |
msgid ""
|
259 |
"<li><a target=\"_blank\" href=\"http://codex.wordpress.org/"
|
260 |
"Changing_File_Permissions\" title=\"Changing File Permissions\">Set the "
|
@@ -262,11 +266,11 @@ msgid ""
|
|
262 |
"li>"
|
263 |
msgstr ""
|
264 |
|
265 |
-
#: includes/class-ctc.php:
|
266 |
msgid "<li>Run PHP under Apache with suEXEC (contact your web host).</li>"
|
267 |
msgstr ""
|
268 |
|
269 |
-
#: includes/class-ctc.php:
|
270 |
msgid ""
|
271 |
"This Child Theme is not owned by your website account. It may have been "
|
272 |
"created by a prior version of this plugin or by another program. Moving "
|
@@ -275,37 +279,36 @@ msgid ""
|
|
275 |
"below."
|
276 |
msgstr ""
|
277 |
|
278 |
-
#: includes/class-ctc.php:
|
279 |
msgid "Correct Child Theme Permissions"
|
280 |
msgstr ""
|
281 |
|
282 |
-
#: includes/class-ctc.php:
|
283 |
msgid ""
|
284 |
"Child Theme Configurator needs to update its interal data. Please set your "
|
285 |
"preferences below and click \"Generate Child Theme Files\" to update your "
|
286 |
"configuration."
|
287 |
msgstr ""
|
288 |
|
289 |
-
#: includes/class-ctc.php:
|
290 |
msgid ""
|
291 |
"<strong>However, some styles could not be parsed due to memory limits.</"
|
292 |
"strong> Try deselecting \"Additional Stylesheets\" below and click "
|
293 |
"\"Generate/Rebuild Child Theme Files\". %sWhy am I seeing this?%s"
|
294 |
msgstr ""
|
295 |
|
296 |
-
#: includes/class-ctc.php:
|
297 |
msgid ""
|
298 |
-
"Child Theme Configurator did not detect any configuration data
|
299 |
-
"
|
300 |
-
"
|
301 |
-
"and click \"Generate Child Theme Files\"."
|
302 |
msgstr ""
|
303 |
|
304 |
-
#: includes/forms/addl_css.php:7
|
305 |
msgid "Parse additional stylesheets:"
|
306 |
msgstr ""
|
307 |
|
308 |
-
#: includes/forms/addl_css.php:11 includes/forms/parent-child.php:
|
309 |
msgid ""
|
310 |
"Stylesheets that are currently being loaded by the parent theme are "
|
311 |
"automatically selected below (except for Bootstrap stylesheets which add a "
|
@@ -313,118 +316,138 @@ msgid ""
|
|
313 |
"only the additional stylesheets you wish to customize."
|
314 |
msgstr ""
|
315 |
|
316 |
-
#: includes/forms/addl_panels.php:8 includes/
|
317 |
-
msgid "Learn more about
|
318 |
msgstr ""
|
319 |
|
320 |
#: includes/forms/addl_panels.php:9
|
321 |
-
msgid "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
322 |
msgstr ""
|
323 |
|
324 |
-
#: includes/forms/addl_panels.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
325 |
msgid ""
|
326 |
"Thousands of users have already seen the benefits of using Child Theme "
|
327 |
"Configurator. If you spend any amount of time customizing WordPress, CTC Pro "
|
328 |
"will help maximize your productivity."
|
329 |
msgstr ""
|
330 |
|
331 |
-
#: includes/forms/addl_panels.php:
|
332 |
msgid "Designed by Developers Who Use It Every Day."
|
333 |
msgstr ""
|
334 |
|
335 |
-
#: includes/forms/addl_panels.php:
|
336 |
msgid ""
|
337 |
"We've packed in more features to make design work quicker and easier with "
|
338 |
"<strong>Child Theme Configurator Pro.</strong>"
|
339 |
msgstr ""
|
340 |
|
341 |
-
#: includes/forms/addl_panels.php:
|
342 |
-
msgid "
|
343 |
msgstr ""
|
344 |
|
345 |
-
#: includes/forms/addl_panels.php:
|
346 |
msgid ""
|
347 |
-
"Apply the power of
|
348 |
"All new design makes it much easier to get the results you want."
|
349 |
msgstr ""
|
350 |
|
351 |
-
#: includes/forms/addl_panels.php:
|
352 |
-
msgid "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
353 |
msgstr ""
|
354 |
|
355 |
-
#: includes/forms/addl_panels.php:
|
356 |
msgid ""
|
357 |
-
"Use the \"All Styles\" panel to
|
358 |
-
"
|
359 |
msgstr ""
|
360 |
|
361 |
-
#: includes/forms/addl_panels.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
362 |
msgid "Most recent edits"
|
363 |
msgstr ""
|
364 |
|
365 |
-
#: includes/forms/addl_panels.php:
|
366 |
msgid "Return to recently edited selectors from a toggleable sidebar."
|
367 |
msgstr ""
|
368 |
|
369 |
-
#: includes/forms/addl_panels.php:
|
370 |
msgid "Free Upgrades"
|
371 |
msgstr ""
|
372 |
|
373 |
-
#: includes/forms/addl_panels.php:
|
374 |
msgid ""
|
375 |
"Your Update Key gives you access to new Pro features as soon as they are "
|
376 |
"released."
|
377 |
msgstr ""
|
378 |
|
379 |
-
#: includes/forms/addl_panels.php:
|
380 |
msgid "Top-rated Online Support"
|
381 |
msgstr ""
|
382 |
|
383 |
-
#: includes/forms/addl_panels.php:
|
384 |
msgid "Online Documentation"
|
385 |
msgstr ""
|
386 |
|
387 |
-
#: includes/forms/addl_panels.php:
|
388 |
msgid "Tutorial Videos"
|
389 |
msgstr ""
|
390 |
|
391 |
-
#: includes/forms/addl_panels.php:
|
392 |
msgid "For a limited time save over 15% off Child Theme Configurator Pro."
|
393 |
msgstr ""
|
394 |
|
395 |
-
#: includes/forms/addl_panels.php:
|
396 |
-
msgid "
|
397 |
-
msgstr ""
|
398 |
-
|
399 |
-
#: includes/forms/addl_panels.php:25
|
400 |
-
msgid "Buy Now - Only $12.95 USD"
|
401 |
-
msgstr ""
|
402 |
-
|
403 |
-
#: includes/forms/addl_panels.php:27 includes/forms/addl_panels.php:28
|
404 |
-
msgid "Learn more about IntelliWidget"
|
405 |
-
msgstr ""
|
406 |
-
|
407 |
-
#: includes/forms/addl_panels.php:28
|
408 |
-
msgid ""
|
409 |
-
"IntelliWidget is a versatile WordPress plugin that does the work of multiple "
|
410 |
-
"plugins by combining custom page menus, featured posts, sliders and other "
|
411 |
-
"content into a single widget that can display on a content driven or site-"
|
412 |
-
"wide basis."
|
413 |
msgstr ""
|
414 |
|
415 |
-
#: includes/forms/addl_panels.php:
|
416 |
-
msgid "
|
417 |
-
msgstr ""
|
418 |
-
|
419 |
-
#: includes/forms/addl_panels.php:30 includes/forms/addl_panels.php:31
|
420 |
-
msgid "Learn more about IW Responsive Menu"
|
421 |
msgstr ""
|
422 |
|
423 |
-
#: includes/forms/addl_panels.php:
|
424 |
-
msgid ""
|
425 |
-
"IntelliWidget Responsive Menu lets you break free from your theme’s built-in "
|
426 |
-
"responsive menu options and gives you complete control over the user "
|
427 |
-
"experience."
|
428 |
msgstr ""
|
429 |
|
430 |
#: includes/forms/addl_tabs.php:8
|
@@ -443,7 +466,7 @@ msgstr ""
|
|
443 |
msgid "Backup"
|
444 |
msgstr ""
|
445 |
|
446 |
-
#: includes/forms/backups.php:10 includes/forms/parent-child.php:
|
447 |
msgid "Restore backup from"
|
448 |
msgstr ""
|
449 |
|
@@ -579,99 +602,157 @@ msgstr ""
|
|
579 |
msgid "Child Theme"
|
580 |
msgstr ""
|
581 |
|
582 |
-
#: includes/forms/parent-child.php:
|
|
|
|
|
|
|
|
|
583 |
msgid "Create New Child Theme"
|
584 |
msgstr ""
|
585 |
|
586 |
-
#: includes/forms/parent-child.php:
|
587 |
msgid "Use Existing Child Theme"
|
588 |
msgstr ""
|
589 |
|
590 |
-
#: includes/forms/parent-child.php:
|
591 |
msgid "Theme Slug"
|
592 |
msgstr ""
|
593 |
|
594 |
-
#: includes/forms/parent-child.php:
|
595 |
msgid "Child Theme Name"
|
596 |
msgstr ""
|
597 |
|
598 |
-
#: includes/forms/parent-child.php:
|
599 |
msgid "Theme Name"
|
600 |
msgstr ""
|
601 |
|
602 |
-
#: includes/forms/parent-child.php:
|
|
|
|
|
|
|
|
|
603 |
msgid "Author"
|
604 |
msgstr ""
|
605 |
|
606 |
-
#: includes/forms/parent-child.php:
|
607 |
-
msgid "
|
608 |
msgstr ""
|
609 |
|
610 |
-
#: includes/forms/parent-child.php:
|
611 |
-
msgid "
|
612 |
msgstr ""
|
613 |
|
614 |
-
#: includes/forms/parent-child.php:
|
615 |
-
|
616 |
-
msgid "NOTE:"
|
617 |
msgstr ""
|
618 |
|
619 |
-
#: includes/forms/parent-child.php:
|
620 |
-
msgid "
|
621 |
msgstr ""
|
622 |
|
623 |
-
#: includes/forms/parent-child.php:
|
624 |
-
msgid "
|
625 |
msgstr ""
|
626 |
|
627 |
-
#: includes/forms/parent-child.php:104
|
628 |
-
msgid "
|
629 |
msgstr ""
|
630 |
|
631 |
-
#: includes/forms/parent-child.php:110
|
632 |
-
msgid "
|
633 |
msgstr ""
|
634 |
|
635 |
-
#: includes/forms/parent-child.php:
|
636 |
-
msgid "
|
637 |
msgstr ""
|
638 |
|
639 |
#: includes/forms/parent-child.php:121
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
640 |
msgid ""
|
641 |
-
"This theme
|
642 |
-
"@import option to render correctly
|
643 |
msgstr ""
|
644 |
|
645 |
-
#: includes/forms/parent-child.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
646 |
msgid ""
|
647 |
-
"Select
|
648 |
-
"
|
649 |
-
"
|
650 |
msgstr ""
|
651 |
|
652 |
-
#: includes/forms/parent-child.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
653 |
msgid "Backup current stylesheet"
|
654 |
msgstr ""
|
655 |
|
656 |
-
#: includes/forms/parent-child.php:
|
657 |
msgid ""
|
658 |
"This creates a copy of the current stylesheet before applying changes. You "
|
659 |
"can remove old backup files using the Files tab."
|
660 |
msgstr ""
|
661 |
|
662 |
-
#: includes/forms/parent-child.php:
|
663 |
-
msgid "Reset/Restore from backup
|
664 |
msgstr ""
|
665 |
|
666 |
-
#: includes/forms/parent-child.php:
|
667 |
msgid "Leave unchanged"
|
668 |
msgstr ""
|
669 |
|
670 |
-
#: includes/forms/parent-child.php:
|
671 |
msgid "Reset all"
|
672 |
msgstr ""
|
673 |
|
674 |
-
#: includes/forms/parent-child.php:
|
|
|
|
|
|
|
|
|
675 |
msgid "Generate/Rebuild Child Theme Files"
|
676 |
msgstr ""
|
677 |
|
@@ -683,6 +764,10 @@ msgstr ""
|
|
683 |
msgid "Selector"
|
684 |
msgstr ""
|
685 |
|
|
|
|
|
|
|
|
|
686 |
#: includes/forms/query-selector.php:45
|
687 |
msgid "Save Child Values"
|
688 |
msgstr ""
|
@@ -757,6 +842,10 @@ msgstr ""
|
|
757 |
msgid "Rule/Value"
|
758 |
msgstr ""
|
759 |
|
|
|
|
|
|
|
|
|
760 |
#: includes/forms/tabs.php:25
|
761 |
msgid "Child CSS"
|
762 |
msgstr ""
|
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.7.0\n"
|
6 |
"Report-Msgid-Bugs-To: http://wordpress.org/tag/child-theme-configurator\n"
|
7 |
+
"POT-Creation-Date: 2015-02-20 02:29:04+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
14 |
|
15 |
+
#. #-#-#-#-# chld_thm_cfg.pot (Child Theme Configurator 1.7.0) #-#-#-#-#
|
16 |
#. Plugin Name of the plugin/theme
|
17 |
+
#: child-theme-configurator.php:76 child-theme-configurator.php:86
|
18 |
#: includes/forms/main.php:23
|
19 |
msgid "Child Theme Configurator"
|
20 |
msgstr ""
|
21 |
|
22 |
+
#: child-theme-configurator.php:77 child-theme-configurator.php:87
|
23 |
+
#: child-theme-configurator.php:97
|
24 |
msgid "Child Themes"
|
25 |
msgstr ""
|
26 |
|
27 |
+
#: child-theme-configurator.php:112
|
28 |
msgid "Child Theme Configurator requires WordPress version %s or later."
|
29 |
msgstr ""
|
30 |
|
66 |
msgid "before activating."
|
67 |
msgstr ""
|
68 |
|
69 |
+
#: includes/class-ctc.php:143
|
70 |
msgid "URL/None"
|
71 |
msgstr ""
|
72 |
|
73 |
+
#: includes/class-ctc.php:144
|
74 |
msgid "Origin"
|
75 |
msgstr ""
|
76 |
|
77 |
+
#: includes/class-ctc.php:145
|
78 |
msgid "Color 1"
|
79 |
msgstr ""
|
80 |
|
81 |
+
#: includes/class-ctc.php:146
|
82 |
msgid "Color 2"
|
83 |
msgstr ""
|
84 |
|
85 |
+
#: includes/class-ctc.php:147
|
86 |
msgid "Width/None"
|
87 |
msgstr ""
|
88 |
|
89 |
+
#: includes/class-ctc.php:148
|
90 |
msgid "Style"
|
91 |
msgstr ""
|
92 |
|
93 |
+
#: includes/class-ctc.php:149
|
94 |
msgid "Color"
|
95 |
msgstr ""
|
96 |
|
97 |
+
#: includes/class-ctc.php:151
|
98 |
msgid "Are you sure? This will replace your current settings."
|
99 |
msgstr ""
|
100 |
|
101 |
+
#: includes/class-ctc.php:152
|
|
|
|
|
|
|
|
|
|
|
102 |
msgid "<span style=\"font-size:10px\">!</span>"
|
103 |
msgstr ""
|
104 |
|
105 |
+
#: includes/class-ctc.php:153 includes/forms/rule-value.php:32
|
106 |
msgid "Selectors"
|
107 |
msgstr ""
|
108 |
|
109 |
+
#: includes/class-ctc.php:154
|
110 |
msgid "Close"
|
111 |
msgstr ""
|
112 |
|
113 |
+
#: includes/class-ctc.php:155
|
114 |
msgid "Edit"
|
115 |
msgstr ""
|
116 |
|
117 |
+
#: includes/class-ctc.php:156
|
118 |
msgid "Cancel"
|
119 |
msgstr ""
|
120 |
|
121 |
+
#: includes/class-ctc.php:157
|
122 |
msgid "Rename"
|
123 |
msgstr ""
|
124 |
|
125 |
+
#: includes/class-ctc.php:158
|
126 |
msgid "The stylesheet cannot be displayed."
|
127 |
msgstr ""
|
128 |
|
129 |
+
#: includes/class-ctc.php:159
|
130 |
msgid "(Child Only)"
|
131 |
msgstr ""
|
132 |
|
133 |
+
#: includes/class-ctc.php:160
|
134 |
msgid "Please enter a valid Child Theme."
|
135 |
msgstr ""
|
136 |
|
137 |
+
#: includes/class-ctc.php:161
|
138 |
msgid "Please enter a valid Child Theme name."
|
139 |
msgstr ""
|
140 |
|
141 |
+
#: includes/class-ctc.php:162
|
142 |
msgid "<strong>%s</strong> exists. Please enter a different Child Theme"
|
143 |
msgstr ""
|
144 |
|
145 |
+
#: includes/class-ctc.php:163
|
146 |
msgid ""
|
147 |
"The page could not be loaded correctly so some controls have been disabled."
|
148 |
msgstr ""
|
149 |
|
150 |
+
#: includes/class-ctc.php:165
|
151 |
msgid "Conflicting jQuery libraries were loaded by another plugin:"
|
152 |
msgstr ""
|
153 |
|
154 |
+
#: includes/class-ctc.php:167
|
155 |
msgid "Deactivating other plugins may resolve this issue."
|
156 |
msgstr ""
|
157 |
|
158 |
+
#: includes/class-ctc.php:168
|
159 |
msgid "%sWhy am I seeing this?%s"
|
160 |
msgstr ""
|
161 |
|
162 |
+
#: includes/class-ctc.php:385
|
163 |
msgid "Zip file creation failed."
|
164 |
msgstr ""
|
165 |
|
166 |
+
#: includes/class-ctc.php:421
|
167 |
msgid "The Functions file is required and cannot be deleted."
|
168 |
msgstr ""
|
169 |
|
170 |
+
#: includes/class-ctc.php:502
|
171 |
msgid "You do not have permission to configure child themes."
|
172 |
msgstr ""
|
173 |
|
174 |
+
#: includes/class-ctc.php:549
|
175 |
msgid "%s does not exist. Please select a valid Parent Theme."
|
176 |
msgstr ""
|
177 |
|
178 |
+
#: includes/class-ctc.php:553
|
179 |
msgid "Please select a valid Parent Theme."
|
180 |
msgstr ""
|
181 |
|
182 |
+
#: includes/class-ctc.php:556
|
183 |
msgid "Please enter a valid Child Theme directory."
|
184 |
msgstr ""
|
185 |
|
186 |
+
#: includes/class-ctc.php:564
|
|
|
|
|
|
|
|
|
187 |
msgid "Please enter a valid Child Theme template name."
|
188 |
msgstr ""
|
189 |
|
190 |
+
#: includes/class-ctc.php:569
|
191 |
msgid ""
|
192 |
"<strong>%s</strong> exists. Please enter a different Child Theme template "
|
193 |
"name."
|
194 |
msgstr ""
|
195 |
|
196 |
+
#: includes/class-ctc.php:575
|
197 |
+
msgid "Your theme directories are not writable."
|
198 |
+
msgstr ""
|
199 |
+
|
200 |
+
#: includes/class-ctc.php:635
|
201 |
msgid "Your stylesheet is not writable."
|
202 |
msgstr ""
|
203 |
|
204 |
+
#: includes/class-ctc.php:877
|
205 |
+
msgid ""
|
206 |
+
"A closing PHP tag was detected in Child theme functions file so \"Parent "
|
207 |
+
"Stylesheet Handling\" option was not configured. Closing PHP at the end of "
|
208 |
+
"the file is discouraged as it can cause premature HTTP headers. Please edit "
|
209 |
+
"<code>functions.php</code> to remove the final <code>?></code> tag and "
|
210 |
+
"click \"Generate/Rebuild Child Theme Files\" again."
|
211 |
msgstr ""
|
212 |
|
213 |
+
#: includes/class-ctc.php:964
|
214 |
+
msgid "Could not delete file."
|
215 |
+
msgstr ""
|
216 |
+
|
217 |
+
#: includes/class-ctc.php:1040
|
218 |
msgid "Could not set write permissions."
|
219 |
msgstr ""
|
220 |
|
221 |
+
#: includes/class-ctc.php:1114
|
222 |
msgid "There were errors while resetting permissions."
|
223 |
msgstr ""
|
224 |
|
225 |
+
#: includes/class-ctc.php:1156
|
226 |
msgid "Could not upload file."
|
227 |
msgstr ""
|
228 |
|
229 |
+
#: includes/class-ctc.php:1239
|
230 |
msgid ""
|
231 |
"Child Theme Configurator is unable to write to the stylesheet. This can be "
|
232 |
"resolved using one of the following options:<ol>"
|
233 |
msgstr ""
|
234 |
|
235 |
+
#: includes/class-ctc.php:1242
|
236 |
msgid ""
|
237 |
"<li>Temporarily make the stylesheet writable by clicking the button below. "
|
238 |
"You should change this back when you are finished editing for security by "
|
239 |
"clicking \"Make read-only\" under the \"Files\" tab.</li>"
|
240 |
msgstr ""
|
241 |
|
242 |
+
#: includes/class-ctc.php:1245
|
243 |
msgid "Temporarily make stylesheet writable"
|
244 |
msgstr ""
|
245 |
|
246 |
+
#: includes/class-ctc.php:1246
|
247 |
msgid ""
|
248 |
"<li><a target=\"_blank\" href=\"http://codex.wordpress.org/Editing_wp-"
|
249 |
"config.php#WordPress_Upgrade_Constants\" title=\"Editin wp-config.php\">Add "
|
250 |
"your FTP/SSH credentials to the WordPress config file</a>.</li>"
|
251 |
msgstr ""
|
252 |
|
253 |
+
#: includes/class-ctc.php:1248
|
254 |
msgid ""
|
255 |
"<li><a target=\"_blank\" href=\"http://technet.microsoft.com/en-us/library/"
|
256 |
"cc771170\" title=\"Setting Application Pool Identity\">Assign WordPress to "
|
258 |
"li>"
|
259 |
msgstr ""
|
260 |
|
261 |
+
#: includes/class-ctc.php:1249
|
262 |
msgid ""
|
263 |
"<li><a target=\"_blank\" href=\"http://codex.wordpress.org/"
|
264 |
"Changing_File_Permissions\" title=\"Changing File Permissions\">Set the "
|
266 |
"li>"
|
267 |
msgstr ""
|
268 |
|
269 |
+
#: includes/class-ctc.php:1251
|
270 |
msgid "<li>Run PHP under Apache with suEXEC (contact your web host).</li>"
|
271 |
msgstr ""
|
272 |
|
273 |
+
#: includes/class-ctc.php:1261
|
274 |
msgid ""
|
275 |
"This Child Theme is not owned by your website account. It may have been "
|
276 |
"created by a prior version of this plugin or by another program. Moving "
|
279 |
"below."
|
280 |
msgstr ""
|
281 |
|
282 |
+
#: includes/class-ctc.php:1264
|
283 |
msgid "Correct Child Theme Permissions"
|
284 |
msgstr ""
|
285 |
|
286 |
+
#: includes/class-ctc.php:1271
|
287 |
msgid ""
|
288 |
"Child Theme Configurator needs to update its interal data. Please set your "
|
289 |
"preferences below and click \"Generate Child Theme Files\" to update your "
|
290 |
"configuration."
|
291 |
msgstr ""
|
292 |
|
293 |
+
#: includes/class-ctc.php:1277
|
294 |
msgid ""
|
295 |
"<strong>However, some styles could not be parsed due to memory limits.</"
|
296 |
"strong> Try deselecting \"Additional Stylesheets\" below and click "
|
297 |
"\"Generate/Rebuild Child Theme Files\". %sWhy am I seeing this?%s"
|
298 |
msgstr ""
|
299 |
|
300 |
+
#: includes/class-ctc.php:1286
|
301 |
msgid ""
|
302 |
+
"Child Theme Configurator did not detect any configuration data because a "
|
303 |
+
"previously configured Child Theme has been removed. Please set your "
|
304 |
+
"preferences below and click \"Generate Child Theme Files\"."
|
|
|
305 |
msgstr ""
|
306 |
|
307 |
+
#: includes/forms/addl_css.php:7
|
308 |
msgid "Parse additional stylesheets:"
|
309 |
msgstr ""
|
310 |
|
311 |
+
#: includes/forms/addl_css.php:11 includes/forms/parent-child.php:226
|
312 |
msgid ""
|
313 |
"Stylesheets that are currently being loaded by the parent theme are "
|
314 |
"automatically selected below (except for Bootstrap stylesheets which add a "
|
316 |
"only the additional stylesheets you wish to customize."
|
317 |
msgstr ""
|
318 |
|
319 |
+
#: includes/forms/addl_panels.php:8 includes/forms/addl_panels.php:9
|
320 |
+
msgid "Learn more about IntelliWidget"
|
321 |
msgstr ""
|
322 |
|
323 |
#: includes/forms/addl_panels.php:9
|
324 |
+
msgid ""
|
325 |
+
"IntelliWidget is a versatile widget manager that does the work of multiple "
|
326 |
+
"plugins by combining custom page menus, featured posts, sliders and other "
|
327 |
+
"dynamic content features into a single plugin that can display on a per-page "
|
328 |
+
"or site-wide basis."
|
329 |
+
msgstr ""
|
330 |
+
|
331 |
+
#: includes/forms/addl_panels.php:10 includes/forms/addl_panels.php:13
|
332 |
+
msgid "Learn more"
|
333 |
msgstr ""
|
334 |
|
335 |
+
#: includes/forms/addl_panels.php:11 includes/forms/addl_panels.php:12
|
336 |
+
msgid "Learn more about IW Responsive Menu"
|
337 |
+
msgstr ""
|
338 |
+
|
339 |
+
#: includes/forms/addl_panels.php:12
|
340 |
+
msgid ""
|
341 |
+
"IntelliWidget Responsive Menu lets you break free from your theme’s built-in "
|
342 |
+
"responsive menu options and gives you complete control over the user "
|
343 |
+
"experience."
|
344 |
+
msgstr ""
|
345 |
+
|
346 |
+
#: includes/forms/addl_panels.php:16 includes/help/help_en_US.php:211
|
347 |
+
msgid "Learn more about CTC Pro"
|
348 |
+
msgstr ""
|
349 |
+
|
350 |
+
#: includes/forms/addl_panels.php:17
|
351 |
+
msgid "Customizing WordPress just got even easier."
|
352 |
+
msgstr ""
|
353 |
+
|
354 |
+
#: includes/forms/addl_panels.php:18
|
355 |
msgid ""
|
356 |
"Thousands of users have already seen the benefits of using Child Theme "
|
357 |
"Configurator. If you spend any amount of time customizing WordPress, CTC Pro "
|
358 |
"will help maximize your productivity."
|
359 |
msgstr ""
|
360 |
|
361 |
+
#: includes/forms/addl_panels.php:19
|
362 |
msgid "Designed by Developers Who Use It Every Day."
|
363 |
msgstr ""
|
364 |
|
365 |
+
#: includes/forms/addl_panels.php:20
|
366 |
msgid ""
|
367 |
"We've packed in more features to make design work quicker and easier with "
|
368 |
"<strong>Child Theme Configurator Pro.</strong>"
|
369 |
msgstr ""
|
370 |
|
371 |
+
#: includes/forms/addl_panels.php:22
|
372 |
+
msgid "Customize Plugin Stylesheets"
|
373 |
msgstr ""
|
374 |
|
375 |
+
#: includes/forms/addl_panels.php:23
|
376 |
msgid ""
|
377 |
+
"Apply the power of CTC's top-rated interface to your site's plugin styles. "
|
378 |
"All new design makes it much easier to get the results you want."
|
379 |
msgstr ""
|
380 |
|
381 |
+
#: includes/forms/addl_panels.php:24
|
382 |
+
msgid "Quick Preview"
|
383 |
+
msgstr ""
|
384 |
+
|
385 |
+
#: includes/forms/addl_panels.php:24
|
386 |
+
msgid "Test your child theme with a single click."
|
387 |
+
msgstr ""
|
388 |
+
|
389 |
+
#: includes/forms/addl_panels.php:25
|
390 |
+
msgid "Find related styles"
|
391 |
msgstr ""
|
392 |
|
393 |
+
#: includes/forms/addl_panels.php:25
|
394 |
msgid ""
|
395 |
+
"Use the \"All Styles\" panel to edit groups of selectors from a single "
|
396 |
+
"combined list."
|
397 |
msgstr ""
|
398 |
|
399 |
+
#: includes/forms/addl_panels.php:26
|
400 |
+
msgid "Find styles by Nav Menu"
|
401 |
+
msgstr ""
|
402 |
+
|
403 |
+
#: includes/forms/addl_panels.php:26
|
404 |
+
msgid "Tweak menus quickly and easily."
|
405 |
+
msgstr ""
|
406 |
+
|
407 |
+
#: includes/forms/addl_panels.php:27
|
408 |
msgid "Most recent edits"
|
409 |
msgstr ""
|
410 |
|
411 |
+
#: includes/forms/addl_panels.php:27
|
412 |
msgid "Return to recently edited selectors from a toggleable sidebar."
|
413 |
msgstr ""
|
414 |
|
415 |
+
#: includes/forms/addl_panels.php:28
|
416 |
msgid "Free Upgrades"
|
417 |
msgstr ""
|
418 |
|
419 |
+
#: includes/forms/addl_panels.php:29
|
420 |
msgid ""
|
421 |
"Your Update Key gives you access to new Pro features as soon as they are "
|
422 |
"released."
|
423 |
msgstr ""
|
424 |
|
425 |
+
#: includes/forms/addl_panels.php:30
|
426 |
msgid "Top-rated Online Support"
|
427 |
msgstr ""
|
428 |
|
429 |
+
#: includes/forms/addl_panels.php:31
|
430 |
msgid "Online Documentation"
|
431 |
msgstr ""
|
432 |
|
433 |
+
#: includes/forms/addl_panels.php:32
|
434 |
msgid "Tutorial Videos"
|
435 |
msgstr ""
|
436 |
|
437 |
+
#: includes/forms/addl_panels.php:34
|
438 |
msgid "For a limited time save over 15% off Child Theme Configurator Pro."
|
439 |
msgstr ""
|
440 |
|
441 |
+
#: includes/forms/addl_panels.php:35
|
442 |
+
msgid "Upgrade Now"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
443 |
msgstr ""
|
444 |
|
445 |
+
#: includes/forms/addl_panels.php:35
|
446 |
+
msgid "Buy Now - Only $14.95 USD*"
|
|
|
|
|
|
|
|
|
447 |
msgstr ""
|
448 |
|
449 |
+
#: includes/forms/addl_panels.php:35
|
450 |
+
msgid "*Prices subject to change."
|
|
|
|
|
|
|
451 |
msgstr ""
|
452 |
|
453 |
#: includes/forms/addl_tabs.php:8
|
466 |
msgid "Backup"
|
467 |
msgstr ""
|
468 |
|
469 |
+
#: includes/forms/backups.php:10 includes/forms/parent-child.php:209
|
470 |
msgid "Restore backup from"
|
471 |
msgstr ""
|
472 |
|
602 |
msgid "Child Theme"
|
603 |
msgstr ""
|
604 |
|
605 |
+
#: includes/forms/parent-child.php:27
|
606 |
+
msgid "(click to edit additional fields)"
|
607 |
+
msgstr ""
|
608 |
+
|
609 |
+
#: includes/forms/parent-child.php:34
|
610 |
msgid "Create New Child Theme"
|
611 |
msgstr ""
|
612 |
|
613 |
+
#: includes/forms/parent-child.php:43
|
614 |
msgid "Use Existing Child Theme"
|
615 |
msgstr ""
|
616 |
|
617 |
+
#: includes/forms/parent-child.php:48
|
618 |
msgid "Theme Slug"
|
619 |
msgstr ""
|
620 |
|
621 |
+
#: includes/forms/parent-child.php:59
|
622 |
msgid "Child Theme Name"
|
623 |
msgstr ""
|
624 |
|
625 |
+
#: includes/forms/parent-child.php:63
|
626 |
msgid "Theme Name"
|
627 |
msgstr ""
|
628 |
|
629 |
+
#: includes/forms/parent-child.php:66 includes/forms/parent-child.php:70
|
630 |
+
msgid "Theme Website"
|
631 |
+
msgstr ""
|
632 |
+
|
633 |
+
#: includes/forms/parent-child.php:73 includes/forms/parent-child.php:77
|
634 |
msgid "Author"
|
635 |
msgstr ""
|
636 |
|
637 |
+
#: includes/forms/parent-child.php:81 includes/forms/parent-child.php:85
|
638 |
+
msgid "Author Website"
|
639 |
msgstr ""
|
640 |
|
641 |
+
#: includes/forms/parent-child.php:88
|
642 |
+
msgid "Theme Description"
|
643 |
msgstr ""
|
644 |
|
645 |
+
#: includes/forms/parent-child.php:91
|
646 |
+
msgid "Description"
|
|
|
647 |
msgstr ""
|
648 |
|
649 |
+
#: includes/forms/parent-child.php:94
|
650 |
+
msgid "Theme Tags"
|
651 |
msgstr ""
|
652 |
|
653 |
+
#: includes/forms/parent-child.php:97
|
654 |
+
msgid "Tags"
|
655 |
msgstr ""
|
656 |
|
657 |
+
#: includes/forms/parent-child.php:100 includes/forms/parent-child.php:104
|
658 |
+
msgid "Version"
|
659 |
msgstr ""
|
660 |
|
661 |
+
#: includes/forms/parent-child.php:110
|
662 |
+
msgid "Stylesheet handling"
|
663 |
msgstr ""
|
664 |
|
665 |
+
#: includes/forms/parent-child.php:113
|
666 |
+
msgid "(click to view options)"
|
667 |
msgstr ""
|
668 |
|
669 |
#: includes/forms/parent-child.php:121
|
670 |
+
msgid "Enqueue parent stylesheet (default)"
|
671 |
+
msgstr ""
|
672 |
+
|
673 |
+
#: includes/forms/parent-child.php:124
|
674 |
+
msgid ""
|
675 |
+
"Select this option if the parent theme enqueues the stylesheet but has no "
|
676 |
+
"special handling for child themes. Start with this option if unsure."
|
677 |
+
msgstr ""
|
678 |
+
|
679 |
+
#: includes/forms/parent-child.php:127
|
680 |
msgid ""
|
681 |
+
"<strong>NOTE: This theme links the stylesheet in the header template and "
|
682 |
+
"should use the @import option to render correctly.</strong>"
|
683 |
msgstr ""
|
684 |
|
685 |
+
#: includes/forms/parent-child.php:132
|
686 |
+
msgid "<code>@import</code> parent stylesheet"
|
687 |
+
msgstr ""
|
688 |
+
|
689 |
+
#: includes/forms/parent-child.php:135
|
690 |
+
msgid ""
|
691 |
+
"Select this option if the parent theme links the stylesheet in the header "
|
692 |
+
"template. Using <code>@import</code> is discouraged but necessary in this "
|
693 |
+
"case unless you modify the header template."
|
694 |
+
msgstr ""
|
695 |
+
|
696 |
+
#: includes/forms/parent-child.php:142
|
697 |
+
msgid "Enqueue child stylesheet"
|
698 |
+
msgstr ""
|
699 |
+
|
700 |
+
#: includes/forms/parent-child.php:145
|
701 |
msgid ""
|
702 |
+
"Select this option if the parent theme incorrectly loads the \"template\" "
|
703 |
+
"stylesheet or does not load the \"style.css\" file at all. This is unusual "
|
704 |
+
"but occurs in some themes."
|
705 |
msgstr ""
|
706 |
|
707 |
+
#: includes/forms/parent-child.php:152
|
708 |
+
msgid "None (handled by theme)"
|
709 |
+
msgstr ""
|
710 |
+
|
711 |
+
#: includes/forms/parent-child.php:156
|
712 |
+
msgid ""
|
713 |
+
"Select this option if all stylesheets are automatically loaded for child "
|
714 |
+
"themes (e.g., \"Responsive\" by CyberChimps)."
|
715 |
+
msgstr ""
|
716 |
+
|
717 |
+
#: includes/forms/parent-child.php:161
|
718 |
+
msgid "Copy Parent Theme Menus, Widgets and other Options"
|
719 |
+
msgstr ""
|
720 |
+
|
721 |
+
#: includes/forms/parent-child.php:168 includes/forms/parent-child.php:183
|
722 |
+
msgid "NOTE:"
|
723 |
+
msgstr ""
|
724 |
+
|
725 |
+
#: includes/forms/parent-child.php:170
|
726 |
+
msgid "This will overwrite child theme options you may have already set."
|
727 |
+
msgstr ""
|
728 |
+
|
729 |
+
#: includes/forms/parent-child.php:176
|
730 |
msgid "Backup current stylesheet"
|
731 |
msgstr ""
|
732 |
|
733 |
+
#: includes/forms/parent-child.php:185
|
734 |
msgid ""
|
735 |
"This creates a copy of the current stylesheet before applying changes. You "
|
736 |
"can remove old backup files using the Files tab."
|
737 |
msgstr ""
|
738 |
|
739 |
+
#: includes/forms/parent-child.php:190
|
740 |
+
msgid "Reset/Restore from backup"
|
741 |
msgstr ""
|
742 |
|
743 |
+
#: includes/forms/parent-child.php:196
|
744 |
msgid "Leave unchanged"
|
745 |
msgstr ""
|
746 |
|
747 |
+
#: includes/forms/parent-child.php:202
|
748 |
msgid "Reset all"
|
749 |
msgstr ""
|
750 |
|
751 |
+
#: includes/forms/parent-child.php:222
|
752 |
+
msgid "Parse additional stylesheets"
|
753 |
+
msgstr ""
|
754 |
+
|
755 |
+
#: includes/forms/parent-child.php:245
|
756 |
msgid "Generate/Rebuild Child Theme Files"
|
757 |
msgstr ""
|
758 |
|
764 |
msgid "Selector"
|
765 |
msgstr ""
|
766 |
|
767 |
+
#: includes/forms/query-selector.php:37 includes/forms/rule-value.php:29
|
768 |
+
msgid "Sample"
|
769 |
+
msgstr ""
|
770 |
+
|
771 |
#: includes/forms/query-selector.php:45
|
772 |
msgid "Save Child Values"
|
773 |
msgstr ""
|
842 |
msgid "Rule/Value"
|
843 |
msgstr ""
|
844 |
|
845 |
+
#: includes/forms/tabs.php:22
|
846 |
+
msgid "@import"
|
847 |
+
msgstr ""
|
848 |
+
|
849 |
#: includes/forms/tabs.php:25
|
850 |
msgid "Child CSS"
|
851 |
msgstr ""
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
|
|
4 |
Tags: child theme, customize, CSS, responsive, css editor, theme generator, stylesheet, customizer
|
5 |
Requires at least: 3.9
|
6 |
Tested up to: 4.1
|
7 |
-
Stable tag: 1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -18,7 +18,7 @@ Child Theme Configurator is a fast and easy to use CSS editor that allows you to
|
|
18 |
|
19 |
https://www.youtube.com/watch?v=53M7RVxDYEY
|
20 |
|
21 |
-
The Child Theme Configurator parses and indexes
|
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 |
|
@@ -31,7 +31,7 @@ When you are ready, just activate the Child Theme and your WordPress site takes
|
|
31 |
* Save hours of development time
|
32 |
* Multisite compatible - great for network sites
|
33 |
* Make modifications above and beyond the theme Customizer
|
34 |
-
*
|
35 |
* Export Child Theme as Zip Archive
|
36 |
* Import web fonts and use them in place of theme fonts
|
37 |
* Identify and override exact selectors from the parent theme
|
@@ -74,7 +74,7 @@ Learn more at http://www.lilaeamedia.com/plugins/intelliwidget-responsive-menu
|
|
74 |
* Locate "Child Theme Configurator" in the list and click "Install Now."
|
75 |
|
76 |
2. To install manually:
|
77 |
-
* Download the
|
78 |
* In the WordPress Admin, go to "Plugins > Add New."
|
79 |
* Click the "Upload" link at the top of the page.
|
80 |
* Browse for the zip file, select and click "Install."
|
@@ -89,21 +89,25 @@ Learn more at http://www.lilaeamedia.com/plugins/intelliwidget-responsive-menu
|
|
89 |
|
90 |
2. Select "new" or "existing".
|
91 |
|
92 |
-
3. Enter a Name, Author and Version for the child theme.
|
93 |
|
94 |
-
4. Copy Parent Theme Menus, Widgets and other Options
|
95 |
|
96 |
-
5.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
|
98 |
-
6.
|
99 |
-
* Select 'link' if the parent theme uses the main 'style.css' stylesheet and correctly enqueues it for child themes (default).
|
100 |
-
* 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.
|
101 |
-
* 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.
|
102 |
-
* If you do not know which option to use, select 'link'.
|
103 |
|
104 |
-
7. Restore from backup
|
105 |
|
106 |
-
8. Choose additional stylesheets
|
107 |
|
108 |
9. Click "Generate/Rebuild Child Theme Files."
|
109 |
|
@@ -111,23 +115,48 @@ Learn more at http://www.lilaeamedia.com/plugins/intelliwidget-responsive-menu
|
|
111 |
|
112 |
== Frequently Asked Questions ==
|
113 |
|
114 |
-
=
|
115 |
|
116 |
-
|
117 |
|
118 |
-
|
119 |
|
120 |
-
|
121 |
|
122 |
-
|
|
|
|
|
|
|
|
|
123 |
|
124 |
= Does it work with Multisite? =
|
125 |
|
126 |
Yes. Go to "Network Admin > Themes > Child Themes." Child themes must be "Network enabled" to preview and activate for Network sites.
|
127 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
= HELP! I changed a file and now I am unable to access my website or login to wp-admin to fix it! =
|
129 |
|
130 |
-
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-
|
131 |
|
132 |
The child theme is in your themes folder, usually
|
133 |
|
@@ -149,39 +178,27 @@ Many of these options can be copied over to the child theme by checking "Copy Pa
|
|
149 |
|
150 |
If you want to set different options you can either apply them after you activate the child theme using the theme customizer, or by using the "Live Preview" under Appearance > Themes.
|
151 |
|
152 |
-
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
|
153 |
|
154 |
-
=
|
155 |
-
|
156 |
-
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 font-family rule. Be sure you understand the license for any embedded fonts.
|
157 |
-
|
158 |
-
You can also create a secondary stylesheet that contains @font-face rules and import it using the @import tab.
|
159 |
-
|
160 |
-
= Does it work with plugins? =
|
161 |
-
|
162 |
-
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
|
163 |
-
|
164 |
-
= Is there a tutorial? =
|
165 |
-
|
166 |
-
https://www.youtube.com/watch?v=53M7RVxDYEY
|
167 |
|
168 |
-
|
169 |
|
170 |
-
|
171 |
|
172 |
-
|
173 |
|
174 |
-
|
175 |
|
176 |
-
=
|
177 |
|
178 |
-
The
|
179 |
|
180 |
-
|
181 |
|
182 |
= Why doesn't the Parent Theme have any styles when I "View Parent CSS"? =
|
183 |
|
184 |
-
Check the appropriate additional stylesheets under "
|
185 |
|
186 |
= Where are the styles? The configurator doesn't show anything! =
|
187 |
|
@@ -198,12 +215,6 @@ You have to load a child theme from the Parent/Child tab for the preview to disp
|
|
198 |
|
199 |
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.
|
200 |
|
201 |
-
= If the parent theme changes (e.g., upgrade), do I have to update the child theme? =
|
202 |
-
|
203 |
-
No. This is the point of using child themes. Changes to the parent theme are automatically inherited by the child theme.
|
204 |
-
|
205 |
-
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. Quality themes should identify any deprecated functions or styles in the upgrade notes so that child theme users can make adjustments accordingly.
|
206 |
-
|
207 |
= Where are the .php files? =
|
208 |
|
209 |
The Child Theme 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.
|
@@ -256,6 +267,12 @@ https://www.youtube.com/watch?v=iBiiAgsK4G4
|
|
256 |
7. Files tab
|
257 |
|
258 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
259 |
= 1.6.5.2 =
|
260 |
* Fix: Empty functions file created causing inserted markers to be output to browser.
|
261 |
* Fix: check for closed PHP tag in functions file prior to inserting markers
|
@@ -464,7 +481,7 @@ https://www.youtube.com/watch?v=iBiiAgsK4G4
|
|
464 |
* Initial release.
|
465 |
|
466 |
== Upgrade Notice ==
|
467 |
-
1.
|
468 |
|
469 |
== Override Parent Styles ==
|
470 |
|
@@ -549,6 +566,7 @@ Some themes (particularly commercial themes) do not correctly load parent templa
|
|
549 |
* 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.
|
550 |
* 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.
|
551 |
* 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.
|
|
|
552 |
* 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.
|
553 |
|
554 |
== Documentation ==
|
4 |
Tags: child theme, customize, CSS, responsive, css editor, theme generator, stylesheet, customizer
|
5 |
Requires at least: 3.9
|
6 |
Tested up to: 4.1
|
7 |
+
Stable tag: 1.7.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
18 |
|
19 |
https://www.youtube.com/watch?v=53M7RVxDYEY
|
20 |
|
21 |
+
The Child Theme Configurator parses and indexes your 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 |
|
31 |
* Save hours of development time
|
32 |
* Multisite compatible - great for network sites
|
33 |
* Make modifications above and beyond the theme Customizer
|
34 |
+
* Link (enqueue) parent theme stylesheet instead of using @import
|
35 |
* Export Child Theme as Zip Archive
|
36 |
* Import web fonts and use them in place of theme fonts
|
37 |
* Identify and override exact selectors from the parent theme
|
74 |
* Locate "Child Theme Configurator" in the list and click "Install Now."
|
75 |
|
76 |
2. To install manually:
|
77 |
+
* Download the Child Theme Configurator plugin from http://wordpress.org/plugins/child-theme-configurator
|
78 |
* In the WordPress Admin, go to "Plugins > Add New."
|
79 |
* Click the "Upload" link at the top of the page.
|
80 |
* Browse for the zip file, select and click "Install."
|
89 |
|
90 |
2. Select "new" or "existing".
|
91 |
|
92 |
+
3. Optional: Enter a Name, Theme Website, Author, Author Website, Description, Tags and Version for the child theme.
|
93 |
|
94 |
+
4. Optional: Copy Parent Theme Menus, Widgets and other Options. NOTE: This will overwrite any child theme options you may have already set.
|
95 |
|
96 |
+
5. Choose stylesheet handling:
|
97 |
+
* **Enqueue parent stylesheet (default):**
|
98 |
+
Select this option if the parent theme enqueues the stylesheet but has no special handling for child themes. Start with this option if unsure.
|
99 |
+
* **@import parent stylesheet:**
|
100 |
+
Select this option if the parent theme links the stylesheet in the header template. Using @import is discouraged but necessary in this case unless you modify the header template.
|
101 |
+
* **Enqueue child stylesheet:**
|
102 |
+
Select this option if the parent theme incorrectly loads the "template" stylesheet or does not load the "style.css" file at all. This is unusual but occurs in some themes.
|
103 |
+
* **None (handled by theme):**
|
104 |
+
Select this option if all stylesheets are automatically loaded for child themes (e.g., "Responsive" by CyberChimps).
|
105 |
|
106 |
+
6. Optional: Save Backup
|
|
|
|
|
|
|
|
|
107 |
|
108 |
+
7. Optional: Reset/Restore from backup.
|
109 |
|
110 |
+
8. Optional: Choose additional stylesheets. Stylesheets that are currently used by the parent theme are automatically selected.
|
111 |
|
112 |
9. Click "Generate/Rebuild Child Theme Files."
|
113 |
|
115 |
|
116 |
== Frequently Asked Questions ==
|
117 |
|
118 |
+
= Is there a tutorial? =
|
119 |
|
120 |
+
https://www.youtube.com/watch?v=53M7RVxDYEY
|
121 |
|
122 |
+
= If the parent theme changes (e.g., upgrade), do I have to update the child theme? =
|
123 |
|
124 |
+
No. This is the point of using child themes. Changes to the parent theme are automatically inherited by the child theme.
|
125 |
|
126 |
+
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. Quality themes should identify any deprecated functions or styles in the upgrade notes so that child theme users can make adjustments accordingly.
|
127 |
+
|
128 |
+
= If I uninstall Child Theme Configurator are child themes affected? =
|
129 |
+
|
130 |
+
No. Child Theme Configurator is designed to work independently of themes and plugins. Just remember that if you re-install, you must rebuild the configuration data using the Parent/Child tab.
|
131 |
|
132 |
= Does it work with Multisite? =
|
133 |
|
134 |
Yes. Go to "Network Admin > Themes > Child Themes." Child themes must be "Network enabled" to preview and activate for Network sites.
|
135 |
|
136 |
+
= Does it work with plugins? =
|
137 |
+
|
138 |
+
Child Theme Configurator PRO brings the CSS editing power of Child Theme Configurator to any WordPress Plugin installed on your website by scanning your plugins and creating custom CSS in your Child Theme. Learn more at http://www.lilaeamedia.com/child-theme-configurator-pro
|
139 |
+
|
140 |
+
= Why doesn't this work with my [insert vendor here] theme? =
|
141 |
+
|
142 |
+
Some themes (particularly commercial themes) do not correctly load parent template files or automatically load child theme stylesheets or php files.
|
143 |
+
|
144 |
+
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. **In the worst case they will break your website when you activate the child theme.**
|
145 |
+
|
146 |
+
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 and ALWAYS TEST YOUR CHILD THEME BEFORE ACTIVATING (See "Preview and Activate").
|
147 |
+
|
148 |
+
= Will this slow down my site? =
|
149 |
+
|
150 |
+
Child theme Configurator is designed to add the minimum amount of additional overhead possible and can actually improve performance. **For example:**
|
151 |
+
|
152 |
+
* Child Theme Configurator creates or updates files that are already being read by the system. On the front-end, there are no database calls so WordPress can run independent of the plugin. In fact, you can remove Child Theme Configurator when you are finished setting up your theme.
|
153 |
+
* Customizations are applied to a stylesheet file that can be cached by the browser and/or cached and minimized by a performance caching plugin. Because the editor creates mostly "overrides" to existing styles, the file is typically smaller than other stylesheets.
|
154 |
+
* The code that drives the editor interface only loads when the tool is being used from the WordPress Admin, including Javascript and CSS. This means that it will not get in the way of other admin pages.
|
155 |
+
* The biggest performance hit occurs when you generate the Child Theme files from the Parent/Child tab, but this is a one-time event and only occurs from the WordPress Admin.
|
156 |
+
|
157 |
= HELP! I changed a file and now I am unable to access my website or login to wp-admin to fix it! =
|
158 |
|
159 |
+
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-fifteen).
|
160 |
|
161 |
The child theme is in your themes folder, usually
|
162 |
|
178 |
|
179 |
If you want to set different options you can either apply them after you activate the child theme using the theme customizer, or by using the "Live Preview" under Appearance > Themes.
|
180 |
|
181 |
+
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 customize them). You will have to find out from the theme author which are which.
|
182 |
|
183 |
+
= Where is Child Theme Configurator in the Admin? =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
|
185 |
+
For most users the Child Theme Configurator can be found under "Tools > Child Themes."
|
186 |
|
187 |
+
WordPress Multisite (Network) users go to "Network Admin > Themes > Child Themes."
|
188 |
|
189 |
+
NOTE: Only users with "install_themes" capability will have access to the Child Theme Configurator.
|
190 |
|
191 |
+
Click the "Help" tab at the top right for a quick reference.
|
192 |
|
193 |
+
= How do I add Web Fonts? =
|
194 |
|
195 |
+
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 font-family rule. Be sure you understand the license for any embedded fonts.
|
196 |
|
197 |
+
You can also create a secondary stylesheet that contains @font-face rules and import it using the @import tab.
|
198 |
|
199 |
= Why doesn't the Parent Theme have any styles when I "View Parent CSS"? =
|
200 |
|
201 |
+
Check the appropriate additional stylesheets under "Parse additional stylesheets" on the Parent/Child tab and load the Child Theme again. CTC tries to identify these files by fetching a page from the parent theme, but you may need to set them manually.
|
202 |
|
203 |
= Where are the styles? The configurator doesn't show anything! =
|
204 |
|
215 |
|
216 |
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.
|
217 |
|
|
|
|
|
|
|
|
|
|
|
|
|
218 |
= Where are the .php files? =
|
219 |
|
220 |
The Child Theme 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.
|
267 |
7. Files tab
|
268 |
|
269 |
== Changelog ==
|
270 |
+
= 1.7.0 =
|
271 |
+
* New Feature: Enqueue child theme stylesheet option for themes that do not load it.
|
272 |
+
* New Feature: Child Theme and Author website, description and tag fields.
|
273 |
+
* Fix: Redesigned UI Javascript using jQuery objects for better browser memory management.
|
274 |
+
* Fix: Child Theme Stylesheet version is timestamped to force browser reload after changes.
|
275 |
+
|
276 |
= 1.6.5.2 =
|
277 |
* Fix: Empty functions file created causing inserted markers to be output to browser.
|
278 |
* Fix: check for closed PHP tag in functions file prior to inserting markers
|
481 |
* Initial release.
|
482 |
|
483 |
== Upgrade Notice ==
|
484 |
+
Version 1.7.0: New features including redesigned UI Javascript for better browser memory handling. See changelog for details.
|
485 |
|
486 |
== Override Parent Styles ==
|
487 |
|
566 |
* 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.
|
567 |
* 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.
|
568 |
* 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.
|
569 |
+
* CSS Rules are auto-discovered. The Child Theme Configurator plugin loads the rules that exist in the Parent stylesheet. You can always add new rules using the "Raw CSS" text area.
|
570 |
* 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.
|
571 |
|
572 |
== Documentation ==
|