Version Description
- New Feature: Load imported stylesheets into the CTC admin so web fonts can be previewed.
- Set preview swatch to z-index -1 to prevent it from covering up the controls
- Spread config data across multiple option records to prevent out of memory errors with large stylesheets.
- Do not automatically select Bootstrap CSS files as additional stylesheets to (greatly) reduce overhead.
- Add jQuery UI styles that are no longer being loaded by default in the WP admin (autoselect menus).
Download this release
Release Info
Developer | lilaeamedia |
Plugin | Child Theme Configurator |
Version | 1.5.4 |
Comparing to | |
See all releases |
Code changes from version 1.5.3 to 1.5.4
- child-theme-configurator.php +15 -6
- css/chld-thm-cfg.css +12 -0
- includes/class-ctc-css.php +69 -16
- includes/class-ctc-ui.php +23 -1
- includes/class-ctc.php +13 -13
- js/chld-thm-cfg.js +6 -2
- js/chld-thm-cfg.min.js +1 -1
- readme.txt +15 -9
child-theme-configurator.php
CHANGED
@@ -6,7 +6,7 @@ if ( !defined('ABSPATH')) exit;
|
|
6 |
Plugin Name: Child Theme Configurator
|
7 |
Plugin URI: http://www.lilaeamedia.com/plugins/child-theme-configurator/
|
8 |
Description: Create a Child Theme from any installed Theme. Each CSS selector, rule and value can then be searched, previewed and modified.
|
9 |
-
Version: 1.5.
|
10 |
Author: Lilaea Media
|
11 |
Author URI: http://www.lilaeamedia.com/
|
12 |
Text Domain: chld_thm_cfg
|
@@ -16,9 +16,10 @@ if ( !defined('ABSPATH')) exit;
|
|
16 |
*/
|
17 |
|
18 |
defined('LF') or define('LF', "\n");
|
19 |
-
define('
|
20 |
-
define('
|
21 |
-
define('
|
|
|
22 |
|
23 |
if (is_admin()):
|
24 |
include_once( 'includes/class-ctc.php' );
|
@@ -28,7 +29,15 @@ if ( !defined('ABSPATH')) exit;
|
|
28 |
|
29 |
register_uninstall_hook( __FILE__ , 'child_theme_configurator_delete_plugin');
|
30 |
function child_theme_configurator_delete_plugin() {
|
31 |
-
|
32 |
-
delete_option(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
}
|
34 |
|
6 |
Plugin Name: Child Theme Configurator
|
7 |
Plugin URI: http://www.lilaeamedia.com/plugins/child-theme-configurator/
|
8 |
Description: Create a Child Theme from any installed Theme. Each CSS selector, rule and value can then be searched, previewed and modified.
|
9 |
+
Version: 1.5.4
|
10 |
Author: Lilaea Media
|
11 |
Author URI: http://www.lilaeamedia.com/
|
12 |
Text Domain: chld_thm_cfg
|
16 |
*/
|
17 |
|
18 |
defined('LF') or define('LF', "\n");
|
19 |
+
defined('CHLD_THM_CFG_OPTIONS') or define('CHLD_THM_CFG_OPTIONS', 'chld_thm_cfg_options');
|
20 |
+
defined('CHLD_THM_CFG_VERSION') or define('CHLD_THM_CFG_VERSION', '1.5.4');
|
21 |
+
defined('CHLD_THM_CFG_MAX_SELECTORS') or define('CHLD_THM_CFG_MAX_SELECTORS', '50000');
|
22 |
+
defined('CHLD_THM_CFG_MAX_RECURSE_LOOPS') or define('CHLD_THM_CFG_MAX_RECURSE_LOOPS', '1000');
|
23 |
|
24 |
if (is_admin()):
|
25 |
include_once( 'includes/class-ctc.php' );
|
29 |
|
30 |
register_uninstall_hook( __FILE__ , 'child_theme_configurator_delete_plugin');
|
31 |
function child_theme_configurator_delete_plugin() {
|
32 |
+
delete_option(CHLD_THM_CFG_OPTIONS);
|
33 |
+
delete_option(CHLD_THM_CFG_OPTIONS . '_configvars');
|
34 |
+
delete_option(CHLD_THM_CFG_OPTIONS . '_dict_qs');
|
35 |
+
delete_option(CHLD_THM_CFG_OPTIONS . '_dict_sel');
|
36 |
+
delete_option(CHLD_THM_CFG_OPTIONS . '_dict_query');
|
37 |
+
delete_option(CHLD_THM_CFG_OPTIONS . '_dict_rule');
|
38 |
+
delete_option(CHLD_THM_CFG_OPTIONS . '_dict_val');
|
39 |
+
delete_option(CHLD_THM_CFG_OPTIONS . '_dict_seq');
|
40 |
+
delete_option(CHLD_THM_CFG_OPTIONS . '_sel_ndx');
|
41 |
+
delete_option(CHLD_THM_CFG_OPTIONS . '_val_ndx');
|
42 |
}
|
43 |
|
css/chld-thm-cfg.css
CHANGED
@@ -224,4 +224,16 @@ a.nav-tab, a.nav-tab:focus, a.nav-tab:active {
|
|
224 |
}
|
225 |
.writable {
|
226 |
color: red;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
227 |
}
|
224 |
}
|
225 |
.writable {
|
226 |
color: red;
|
227 |
+
}
|
228 |
+
/* added in 1.5.4 because it is not being loaded by the admin */
|
229 |
+
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus {
|
230 |
+
background-color: #DADADA;
|
231 |
+
color: #212121;
|
232 |
+
}
|
233 |
+
.ui-menu .ui-menu-item {
|
234 |
+
position: relative;
|
235 |
+
margin: 0px;
|
236 |
+
padding: 3px 1em 3px 0.4em;
|
237 |
+
cursor: pointer;
|
238 |
+
min-height: 0px;
|
239 |
}
|
includes/class-ctc-css.php
CHANGED
@@ -6,7 +6,7 @@ if ( !defined('ABSPATH')) exit;
|
|
6 |
Class: Child_Theme_Configurator_CSS
|
7 |
Plugin URI: http://www.lilaeamedia.com/plugins/child-theme-configurator/
|
8 |
Description: Handles all CSS output, parsing, normalization
|
9 |
-
Version: 1.5.
|
10 |
Author: Lilaea Media
|
11 |
Author URI: http://www.lilaeamedia.com/
|
12 |
Text Domain: chld_thm_cfg
|
@@ -15,7 +15,6 @@ if ( !defined('ABSPATH')) exit;
|
|
15 |
Copyright (C) 2014 Lilaea Media
|
16 |
*/
|
17 |
class Child_Theme_Configurator_CSS {
|
18 |
-
var $version;
|
19 |
// data dictionaries
|
20 |
var $dict_query; // @media queries and 'base'
|
21 |
var $dict_sel; // selectors
|
@@ -42,30 +41,52 @@ class Child_Theme_Configurator_CSS {
|
|
42 |
var $child_name; // child theme name
|
43 |
var $child_author; // stylesheet author
|
44 |
var $child_version; // stylesheet version
|
45 |
-
var $vendorrule
|
46 |
-
|
47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
// scalars
|
49 |
-
$this->version = '1.5.3';
|
50 |
$this->querykey = 0;
|
51 |
$this->selkey = 0;
|
52 |
$this->qskey = 0;
|
53 |
$this->rulekey = 0;
|
54 |
$this->valkey = 0;
|
55 |
$this->child = '';
|
56 |
-
$this->parnt =
|
57 |
$this->configtype = 'theme';
|
58 |
$this->child_name = '';
|
59 |
$this->child_author = 'Child Theme Configurator by Lilaea Media';
|
60 |
$this->child_version = '1.0';
|
61 |
-
$this->vendorrule = array(
|
62 |
-
"box-sizing",
|
63 |
-
"font-smoothing",
|
64 |
-
"border-radius",
|
65 |
-
"box-shadow",
|
66 |
-
"transition",
|
67 |
-
"transform"
|
68 |
-
);
|
69 |
// multi-dim arrays
|
70 |
$this->dict_qs = array();
|
71 |
$this->dict_sel = array();
|
@@ -79,6 +100,31 @@ class Child_Theme_Configurator_CSS {
|
|
79 |
$this->imports = array('child' => array(), 'parnt' => array());
|
80 |
}
|
81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
/*
|
83 |
* get_prop
|
84 |
* Getter interface (data sliced different ways depending on objname)
|
@@ -1092,8 +1138,15 @@ class Child_Theme_Configurator_CSS {
|
|
1092 |
if (preg_match('%^' . preg_quote(WP_PLUGIN_DIR) . '%', $stylesheet)) return $stylesheet;
|
1093 |
return FALSE;
|
1094 |
}
|
|
|
1095 |
function normalize_color($value) {
|
1096 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1097 |
}
|
1098 |
}
|
1099 |
?>
|
6 |
Class: Child_Theme_Configurator_CSS
|
7 |
Plugin URI: http://www.lilaeamedia.com/plugins/child-theme-configurator/
|
8 |
Description: Handles all CSS output, parsing, normalization
|
9 |
+
Version: 1.5.4
|
10 |
Author: Lilaea Media
|
11 |
Author URI: http://www.lilaeamedia.com/
|
12 |
Text Domain: chld_thm_cfg
|
15 |
Copyright (C) 2014 Lilaea Media
|
16 |
*/
|
17 |
class Child_Theme_Configurator_CSS {
|
|
|
18 |
// data dictionaries
|
19 |
var $dict_query; // @media queries and 'base'
|
20 |
var $dict_sel; // selectors
|
41 |
var $child_name; // child theme name
|
42 |
var $child_author; // stylesheet author
|
43 |
var $child_version; // stylesheet version
|
44 |
+
var $vendorrule = array(
|
45 |
+
'box-sizing',
|
46 |
+
'font-smoothing',
|
47 |
+
'border-radius',
|
48 |
+
'box-shadow',
|
49 |
+
'transition',
|
50 |
+
'transform'
|
51 |
+
);
|
52 |
+
var $configvars = array(
|
53 |
+
'parntss',
|
54 |
+
'imports',
|
55 |
+
'child_version',
|
56 |
+
'child_author',
|
57 |
+
'child_name',
|
58 |
+
'configtype',
|
59 |
+
'parnt',
|
60 |
+
'child',
|
61 |
+
'valkey',
|
62 |
+
'rulekey',
|
63 |
+
'qskey',
|
64 |
+
'selkey',
|
65 |
+
'querykey',
|
66 |
+
);
|
67 |
+
var $dicts = array(
|
68 |
+
'dict_qs',
|
69 |
+
'dict_sel',
|
70 |
+
'dict_query',
|
71 |
+
'dict_rule',
|
72 |
+
'dict_val',
|
73 |
+
'dict_seq',
|
74 |
+
'sel_ndx',
|
75 |
+
'val_ndx'
|
76 |
+
);
|
77 |
+
function __construct() {
|
78 |
// scalars
|
|
|
79 |
$this->querykey = 0;
|
80 |
$this->selkey = 0;
|
81 |
$this->qskey = 0;
|
82 |
$this->rulekey = 0;
|
83 |
$this->valkey = 0;
|
84 |
$this->child = '';
|
85 |
+
$this->parnt = '';
|
86 |
$this->configtype = 'theme';
|
87 |
$this->child_name = '';
|
88 |
$this->child_author = 'Child Theme Configurator by Lilaea Media';
|
89 |
$this->child_version = '1.0';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
// multi-dim arrays
|
91 |
$this->dict_qs = array();
|
92 |
$this->dict_sel = array();
|
100 |
$this->imports = array('child' => array(), 'parnt' => array());
|
101 |
}
|
102 |
|
103 |
+
function read_config() {
|
104 |
+
global $chld_thm_cfg;
|
105 |
+
if ($configarray = get_option(CHLD_THM_CFG_OPTIONS . '_configvars')):
|
106 |
+
foreach ($this->configvars as $configkey)
|
107 |
+
$this->{$configkey} = $configarray[$configkey];
|
108 |
+
foreach ($this->dicts as $configkey):
|
109 |
+
if ($configarray = get_option(CHLD_THM_CFG_OPTIONS . '_' . $configkey))
|
110 |
+
$this->{$configkey} = $configarray;
|
111 |
+
endforeach;
|
112 |
+
else:
|
113 |
+
return FALSE;
|
114 |
+
endif;
|
115 |
+
}
|
116 |
+
|
117 |
+
function save_config() {
|
118 |
+
global $chld_thm_cfg;
|
119 |
+
$configarray = array();
|
120 |
+
foreach ($this->configvars as $configkey)
|
121 |
+
$configarray[$configkey] = $this->{$configkey};
|
122 |
+
update_option(CHLD_THM_CFG_OPTIONS . '_configvars', $configarray);
|
123 |
+
foreach ($this->dicts as $configkey)
|
124 |
+
update_option(CHLD_THM_CFG_OPTIONS . '_' . $configkey, $this->{$configkey});
|
125 |
+
// remove pre 1.5.4 options
|
126 |
+
delete_option(CHLD_THM_CFG_OPTIONS);
|
127 |
+
}
|
128 |
/*
|
129 |
* get_prop
|
130 |
* Getter interface (data sliced different ways depending on objname)
|
1138 |
if (preg_match('%^' . preg_quote(WP_PLUGIN_DIR) . '%', $stylesheet)) return $stylesheet;
|
1139 |
return FALSE;
|
1140 |
}
|
1141 |
+
|
1142 |
function normalize_color($value) {
|
1143 |
+
$value = preg_replace_callback( "/#([0-9A-F]{3}([0-9A-F]{3})?)/i", array($this, 'tolower'), $value );
|
1144 |
+
$value = preg_replace( "/#([0-9A-F])\\1([0-9A-F])\\2([0-9A-F])\\3/i", "#$1$2$3", $value );
|
1145 |
+
return $value;
|
1146 |
+
}
|
1147 |
+
|
1148 |
+
function tolower($matches) {
|
1149 |
+
return '#' . strtolower($matches[1]);
|
1150 |
}
|
1151 |
}
|
1152 |
?>
|
includes/class-ctc-ui.php
CHANGED
@@ -5,7 +5,7 @@ if ( !defined('ABSPATH')) exit;
|
|
5 |
Class: Child_Theme_Configurator_UI
|
6 |
Plugin URI: http://www.lilaeamedia.com/plugins/child-theme-configurator/
|
7 |
Description: Handles the plugin User Interface
|
8 |
-
Version: 1.5.
|
9 |
Author: Lilaea Media
|
10 |
Author URI: http://www.lilaeamedia.com/
|
11 |
Text Domain: chld_thm_cfg
|
@@ -20,6 +20,7 @@ class Child_Theme_Configurator_UI {
|
|
20 |
|
21 |
function __construct() {
|
22 |
$this->swatch_text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
|
|
|
23 |
}
|
24 |
|
25 |
function render_options() {
|
@@ -458,6 +459,27 @@ class Child_Theme_Configurator_UI {
|
|
458 |
<?php
|
459 |
}
|
460 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
461 |
function render_file_form($template = 'parnt') {
|
462 |
global $chld_thm_cfg, $wp_filesystem;
|
463 |
if ($theme = $chld_thm_cfg->css->get_prop($template)):
|
5 |
Class: Child_Theme_Configurator_UI
|
6 |
Plugin URI: http://www.lilaeamedia.com/plugins/child-theme-configurator/
|
7 |
Description: Handles the plugin User Interface
|
8 |
+
Version: 1.5.4
|
9 |
Author: Lilaea Media
|
10 |
Author URI: http://www.lilaeamedia.com/
|
11 |
Text Domain: chld_thm_cfg
|
20 |
|
21 |
function __construct() {
|
22 |
$this->swatch_text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
|
23 |
+
add_action( 'admin_enqueue_scripts', array($this, 'load_imports') );
|
24 |
}
|
25 |
|
26 |
function render_options() {
|
459 |
<?php
|
460 |
}
|
461 |
|
462 |
+
function load_imports() {
|
463 |
+
// allows fonts and other externals to be previewed
|
464 |
+
// loads early not to conflict with admin stylesheets
|
465 |
+
global $chld_thm_cfg;
|
466 |
+
$regex = "/\@import *(url)? *\( *['\"]?((https?:\/\/)?(.+?))['\"]? *\).*$/";
|
467 |
+
if ($imports = $chld_thm_cfg->css->get_prop('imports')):
|
468 |
+
foreach ($imports as $import):
|
469 |
+
preg_match($regex, $import, $matches);
|
470 |
+
if (empty($matches[3]) && !empty($matches[4])): // relative filepath
|
471 |
+
$url = get_stylesheet_directory_uri();
|
472 |
+
preg_replace("#\.\./#", '', $matches[4], -1, $count);
|
473 |
+
for($i = 0; $i < $count; $i++):
|
474 |
+
$url = dirname($url);
|
475 |
+
endfor;
|
476 |
+
$import = preg_replace($regex, '@import url(' . trailingslashit($url) . $matches[4] . ')', $import);
|
477 |
+
endif;
|
478 |
+
echo preg_replace($regex, "<link rel='stylesheet' href=\"$2\" type='text/css' />", $import) . "\n";
|
479 |
+
endforeach;
|
480 |
+
endif;
|
481 |
+
}
|
482 |
+
|
483 |
function render_file_form($template = 'parnt') {
|
484 |
global $chld_thm_cfg, $wp_filesystem;
|
485 |
if ($theme = $chld_thm_cfg->css->get_prop($template)):
|
includes/class-ctc.php
CHANGED
@@ -6,7 +6,7 @@ if ( !defined('ABSPATH')) exit;
|
|
6 |
Class: Child_Theme_Configurator
|
7 |
Plugin URI: http://www.lilaeamedia.com/plugins/child-theme-configurator/
|
8 |
Description: Main Controller Class
|
9 |
-
Version: 1.5.
|
10 |
Author: Lilaea Media
|
11 |
Author URI: http://www.lilaeamedia.com/
|
12 |
Text Domain: chld_thm_cfg
|
@@ -19,7 +19,6 @@ require_once('class-ctc-css.php');
|
|
19 |
class Child_Theme_Configurator {
|
20 |
|
21 |
var $css;
|
22 |
-
var $optionsName;
|
23 |
var $menuName;
|
24 |
var $langName;
|
25 |
var $pluginName;
|
@@ -42,7 +41,6 @@ class Child_Theme_Configurator {
|
|
42 |
|
43 |
function __construct($file) {
|
44 |
$this->dir = dirname( $file );
|
45 |
-
$this->optionsName = 'chld_thm_cfg_options';
|
46 |
$this->menuName = 'chld_thm_cfg_menu';
|
47 |
$lang_dir = $this->dir . '/lang';
|
48 |
load_plugin_textdomain('chld_thm_cfg', FALSE, $lang_dir, $lang_dir);
|
@@ -68,7 +66,7 @@ class Child_Theme_Configurator {
|
|
68 |
add_action('admin_enqueue_scripts', array(&$this, 'enqueue_scripts'));
|
69 |
add_action('wp_ajax_ctc_update', array(&$this, 'ajax_save_postdata' ));
|
70 |
add_action('wp_ajax_ctc_query', array(&$this, 'ajax_query_css' ));
|
71 |
-
//add_action('update_option_' .
|
72 |
}
|
73 |
|
74 |
function admin_menu() {
|
@@ -174,7 +172,7 @@ class Child_Theme_Configurator {
|
|
174 |
$this->css->parse_post_data();
|
175 |
$this->css->write_css();
|
176 |
$result = $this->css->obj_to_utf8($this->updates);
|
177 |
-
|
178 |
// send all updates back to browser to update cache
|
179 |
die(json_encode($result));
|
180 |
else:
|
@@ -206,14 +204,15 @@ class Child_Theme_Configurator {
|
|
206 |
}
|
207 |
|
208 |
function load_config() {
|
209 |
-
|
210 |
-
|
|
|
|
|
211 |
|| ! $this->check_theme_exists($this->css->get_prop('child'))
|
212 |
-
|| ! $this->check_theme_exists($this->css->get_prop('parnt'))
|
213 |
-
|
214 |
-
):
|
215 |
$parent = get_template();
|
216 |
-
$this->css
|
217 |
endif;
|
218 |
if ('POST' != $_SERVER['REQUEST_METHOD']):
|
219 |
if ($this->css->get_prop('child')):
|
@@ -334,7 +333,7 @@ class Child_Theme_Configurator {
|
|
334 |
if (isset($_POST['ctc_parent_mods']) && ($parent_mods = get_option('theme_mods_' . $parnt))):
|
335 |
update_option('theme_mods_' . $child, $parent_mods);
|
336 |
endif;
|
337 |
-
|
338 |
do_action('chld_thm_cfg_addl_options', $this); // hook for add'l plugin options
|
339 |
$msg = 1; //isset($_POST['ctc_scan_subdirs']) ? '9&tab=import_options' : 1;
|
340 |
endif;
|
@@ -443,7 +442,8 @@ class Child_Theme_Configurator {
|
|
443 |
global $wp_filesystem;
|
444 |
// add functions.php file
|
445 |
$contents = "<?php\n// Exit if accessed directly\nif ( !defined('ABSPATH')) exit;\n\n/* Add custom functions below */";
|
446 |
-
if (FALSE === $this->write_child_file('functions.php', $contents)
|
|
|
447 |
}
|
448 |
|
449 |
function write_child_file($file, $contents) {
|
6 |
Class: Child_Theme_Configurator
|
7 |
Plugin URI: http://www.lilaeamedia.com/plugins/child-theme-configurator/
|
8 |
Description: Main Controller Class
|
9 |
+
Version: 1.5.4
|
10 |
Author: Lilaea Media
|
11 |
Author URI: http://www.lilaeamedia.com/
|
12 |
Text Domain: chld_thm_cfg
|
19 |
class Child_Theme_Configurator {
|
20 |
|
21 |
var $css;
|
|
|
22 |
var $menuName;
|
23 |
var $langName;
|
24 |
var $pluginName;
|
41 |
|
42 |
function __construct($file) {
|
43 |
$this->dir = dirname( $file );
|
|
|
44 |
$this->menuName = 'chld_thm_cfg_menu';
|
45 |
$lang_dir = $this->dir . '/lang';
|
46 |
load_plugin_textdomain('chld_thm_cfg', FALSE, $lang_dir, $lang_dir);
|
66 |
add_action('admin_enqueue_scripts', array(&$this, 'enqueue_scripts'));
|
67 |
add_action('wp_ajax_ctc_update', array(&$this, 'ajax_save_postdata' ));
|
68 |
add_action('wp_ajax_ctc_query', array(&$this, 'ajax_query_css' ));
|
69 |
+
//add_action('update_option_' . CHLD_THM_CFG_OPTIONS, array(&$this, 'update_redirect'), 10);
|
70 |
}
|
71 |
|
72 |
function admin_menu() {
|
172 |
$this->css->parse_post_data();
|
173 |
$this->css->write_css();
|
174 |
$result = $this->css->obj_to_utf8($this->updates);
|
175 |
+
$this->css->save_config();
|
176 |
// send all updates back to browser to update cache
|
177 |
die(json_encode($result));
|
178 |
else:
|
204 |
}
|
205 |
|
206 |
function load_config() {
|
207 |
+
$this->css = new Child_Theme_Configurator_CSS();
|
208 |
+
if ( FALSE === $this->css->read_config() )
|
209 |
+
$this->css = get_option(CHLD_THM_CFG_OPTIONS); // backward compatibility with < 1.5.4
|
210 |
+
if (! is_object($this->css)
|
211 |
|| ! $this->check_theme_exists($this->css->get_prop('child'))
|
212 |
+
|| ! $this->check_theme_exists($this->css->get_prop('parnt')) ):
|
213 |
+
$this->css = new Child_Theme_Configurator_CSS();
|
|
|
214 |
$parent = get_template();
|
215 |
+
$this->css->set_prop('parnt', $parent);
|
216 |
endif;
|
217 |
if ('POST' != $_SERVER['REQUEST_METHOD']):
|
218 |
if ($this->css->get_prop('child')):
|
333 |
if (isset($_POST['ctc_parent_mods']) && ($parent_mods = get_option('theme_mods_' . $parnt))):
|
334 |
update_option('theme_mods_' . $child, $parent_mods);
|
335 |
endif;
|
336 |
+
$this->css->save_config();
|
337 |
do_action('chld_thm_cfg_addl_options', $this); // hook for add'l plugin options
|
338 |
$msg = 1; //isset($_POST['ctc_scan_subdirs']) ? '9&tab=import_options' : 1;
|
339 |
endif;
|
442 |
global $wp_filesystem;
|
443 |
// add functions.php file
|
444 |
$contents = "<?php\n// Exit if accessed directly\nif ( !defined('ABSPATH')) exit;\n\n/* Add custom functions below */";
|
445 |
+
if (FALSE === $this->write_child_file('functions.php', $contents)
|
446 |
+
|| FALSE === $this->write_child_file('style.css', $this->css->get_css_header())) return FALSE;
|
447 |
}
|
448 |
|
449 |
function write_child_file($file, $contents) {
|
js/chld-thm-cfg.js
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
* Script: chld-thm-cfg.js
|
3 |
* Plugin URI: http://www.lilaeamedia.com/plugins/child-theme-configurator/
|
4 |
* Description: Handles jQuery, AJAX and other UI
|
5 |
-
* Version: 1.5.
|
6 |
* Author: Lilaea Media
|
7 |
* Author URI: http://www.lilaeamedia.com/
|
8 |
* License: GPLv2
|
@@ -145,6 +145,7 @@ jQuery(document).ready(function($){
|
|
145 |
if (has_gradient.child) { $($swatch).ctcgrad(gradient.child.origin, [gradient.child.start, gradient.child.end]); }
|
146 |
$($swatch).css(cssrules.child);
|
147 |
}
|
|
|
148 |
}
|
149 |
return postdata;
|
150 |
},
|
@@ -697,7 +698,9 @@ jQuery(document).ready(function($){
|
|
697 |
ctc_set_query(ui.item.value);
|
698 |
return false;
|
699 |
},
|
700 |
-
focus: function(e) {
|
|
|
|
|
701 |
});
|
702 |
},
|
703 |
ctc_setup_selector_menu = function(query) {
|
@@ -858,6 +861,7 @@ jQuery(document).ready(function($){
|
|
858 |
$.get(url, function(data){
|
859 |
while (additional = regex.exec(data)){
|
860 |
if ('style.css' == additional[1]) break; // bail after main stylesheet
|
|
|
861 |
ctcAjax.addl_css.push(additional[1]);
|
862 |
$('.ctc_checkbox').each(function(ndx,el){
|
863 |
if ($(this).val() == additional[1]) $(this).prop('checked', true);
|
2 |
* Script: chld-thm-cfg.js
|
3 |
* Plugin URI: http://www.lilaeamedia.com/plugins/child-theme-configurator/
|
4 |
* Description: Handles jQuery, AJAX and other UI
|
5 |
+
* Version: 1.5.4
|
6 |
* Author: Lilaea Media
|
7 |
* Author URI: http://www.lilaeamedia.com/
|
8 |
* License: GPLv2
|
145 |
if (has_gradient.child) { $($swatch).ctcgrad(gradient.child.origin, [gradient.child.start, gradient.child.end]); }
|
146 |
$($swatch).css(cssrules.child);
|
147 |
}
|
148 |
+
$($swatch).css({'z-index':-1});
|
149 |
}
|
150 |
return postdata;
|
151 |
},
|
698 |
ctc_set_query(ui.item.value);
|
699 |
return false;
|
700 |
},
|
701 |
+
focus: function(e) {
|
702 |
+
e.preventDefault();
|
703 |
+
}
|
704 |
});
|
705 |
},
|
706 |
ctc_setup_selector_menu = function(query) {
|
861 |
$.get(url, function(data){
|
862 |
while (additional = regex.exec(data)){
|
863 |
if ('style.css' == additional[1]) break; // bail after main stylesheet
|
864 |
+
if (additional[1].match(/bootstrap/)) continue; // don't autoselect Bootstrap stylesheets
|
865 |
ctcAjax.addl_css.push(additional[1]);
|
866 |
$('.ctc_checkbox').each(function(ndx,el){
|
867 |
if ($(this).val() == additional[1]) $(this).prop('checked', true);
|
js/chld-thm-cfg.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(document).ready(function(t){var e,c,a,n="\n",l="base",r={},i=new RegExp('"',"g"),o=function(t){return h(t)?t:t.toString().replace(i,""")},s=function(e){t(e).iris({change:function(){d(e)}})},_=function(t){var e=parseInt(t),c=String.fromCharCode(e);return c},u=function(t){var e=t.charCodeAt(0);return e},d=function(e){var c=/^(ctc_(ovrd|\d+)_(parent|child)_([0-9a-z\-]+)_(\d+))(_\w+)?$/,a=t(e).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},o={};return a.find(".ctc-parent-value, .ctc-child-value").each(function(){var a,n,s=t(this).attr("id"),_=s.toString().match(c),u=_[2],d=_[3],v="undefined"==typeof _[4]?"":_[4],f=_[5],x="undefined"==typeof _[6]?"":_[6],g="parent"==d?t(this).text():t(this).val(),m="ctc_"+u+"_child_"+v+"_i_"+f;if("child"==d&&(o[s]=g,o[m]=t("#"+m).is(":checked")?1:0),""!=g)if(!1===h(x))switch(x){case"_border_width":l[d][v+"-width"]=g;break;case"_border_style":l[d][v+"-style"]=g;break;case"_border_color":l[d][v+"-color"]=g;break;case"_background_url":l[d]["background-image"]=p(d,g);break;case"_background_color":l[d]["background-color"]=e.value;break;case"_background_color1":r[d].start=g,i[d]=!0;break;case"_background_color2":r[d].end=g,i[d]=!0;break;case"_background_origin":r[d].origin=g,i[d]=!0}else(a=v.toString().match(/^border(\-(top|right|bottom|left))?$/)&&!g.match(/none/))?(n=g.toString().split(/ +/),l[d][v+"-width"]="undefined"==typeof n[0]?"":n[0],l[d][v+"-style"]="undefined"==typeof n[1]?"":n[1],l[d][v+"-color"]="undefined"==typeof n[2]?"":n[2]):"background-image"==v?g.toString().match(/url\(/)?l[d]["background-image"]=p(d,g):(n=g.toString().split(/ +/),n.length>2?(r[d].origin="undefined"==typeof n[0]?"top":n[0],r[d].start="undefined"==typeof n[1]?"transparent":n[1],r[d].end="undefined"==typeof n[2]?"transparent":n[2],i[d]=!0):l[d]["background-image"]=g):l[d][v]=g}),"undefined"!=typeof n&&!1===h(n.attr("id"))&&(t(n).removeAttr("style"),i.parent&&t(n).ctcgrad(r.parent.origin,[r.parent.start,r.parent.end]),t(n).css(l.parent),n.attr("id").toString().match(/parent/)||(i.child&&t(n).ctcgrad(r.child.origin,[r.child.start,r.child.end]),t(n).css(l.child))),o},v=function(e){var n,l,r;t(e).each(function(){switch(this.obj){case"imports":ctcAjax.imports=this.data;break;case"rule_val":ctcAjax.rule_val[this.key]=this.data,r=this.key;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,n=this.key);break;case"sel_val":ctcAjax.sel_val[this.key]=this.data,l=this.key;break;case"rewrite":c=this.key,a=this.data}})},p=function(t,e){var c,a=e.toString().match(/url\(['" ]*(.+?)['" ]*\)/),n=h(a)?null:a[1],l=ctcAjax.theme_uri+"/"+("parent"==t?ctcAjax.parnt:ctcAjax.child)+"/";return n?c=n.toString().match(/^(https?:|\/)/)?e:"url("+l+n+")":!1},h=function(t){if("undefined"==typeof t||!1===t||null===t||""===t)return!0;if(!0===t||"string"==typeof t||"number"==typeof t)return!1;if("object"==typeof t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0}return!1},f=function(){var e=[];return 1===loading.sel_ndx?e:0===loading.sel_ndx?(loading.sel_ndx=1,A("sel_ndx",null,F),e):(!1===h(ctcAjax.sel_ndx)&&t.each(ctcAjax.sel_ndx,function(t){var c={label:t,value:t};e.push(c)}),e)},x=function(e){var c=[];return 1===loading.sel_ndx?c:0===loading.sel_ndx?(loading.sel_ndx=1,A("sel_ndx",e,R),c):(!1===h(ctcAjax.sel_ndx[e])&&t.each(ctcAjax.sel_ndx[e],function(t,e){var a={label:t,value:e};c.push(a)}),c)},g=function(){var e=[];return 1===loading.rule?e:0===loading.rule?(loading.rule=1,A("rule",null,$),e):(!1===h(ctcAjax.rule)&&t.each(ctcAjax.rule,function(t,c){var a={label:c.replace(/\d+/g,_),value:t};e.push(a)}),e.sort(function(t,e){return t.label>e.label?1:t.label<e.label?-1:0}))},m=function(e,c,a){var l="",r=h(ctcAjax.sel_val[e])||h(ctcAjax.sel_val[e].value)||h(ctcAjax.sel_val[e].value[c])?"":ctcAjax.sel_val[e].value[c],i=q(c,"undefined"==typeof r?"":r.parnt),s=!1===h(r.i_parnt)&&r.i_parnt?ctcAjax.important_label:"",u=q(c,"undefined"==typeof r?"":r.child),d=!1===h(r.i_child)&&r.i_child?1:0,v="ctc_"+a+"_child_"+c+"_i_"+e;return!1===h(ctcAjax.sel_val[e])&&(l+='<div class="ctc-'+("ovrd"==a?"input":"selector")+'-row clearfix">'+n,l+='<div class="ctc-input-cell">'+("ovrd"==a?c.replace(/\d+/g,_):ctcAjax.sel_val[e].selector+'<br/><a href="#" class="ctc-selector-edit" id="ctc_selector_edit_'+e+'" >'+ctcAjax.edit_txt+"</a> "+(h(i.orig)?ctcAjax.child_only_txt:""))+"</div>"+n,"ovrd"==a&&(l+='<div class="ctc-parent-value ctc-input-cell" id="ctc_'+a+"_parent_"+c+"_"+e+'">'+(h(i.orig)?"[no value]":i.orig+s)+"</div>"+n),l+='<div class="ctc-input-cell">'+n,!1===h(i.names)&&(t.each(i.names,function(t,r){r=h(r)?"":r,l+='<div class="ctc-child-input-cell">'+n;var i,s="ctc_"+a+"_child_"+c+"_"+e+r;!1===(i=u.values.shift())&&(i=""),l+=(h(r)?"":ctcAjax.field_labels[r]+":<br/>")+'<input type="text" id="'+s+'" name="'+s+'" class="ctc-child-value'+((r+c).toString().match(/color/)?" color-picker":"")+(r.toString().match(/url/)?" ctc-input-wide":"")+'" value="'+o(i)+'" />'+n,l+="</div>"+n}),l+='<label for="'+v+'"><input type="checkbox" id="'+v+'" name="'+v+'" value="1" '+(1===d?"checked":"")+" />"+ctcAjax.important_label+"</label>"+n),l+="</div>"+n,l+="ovrd"==a?"":'<div class="ctc-swatch ctc-specific" id="ctc_child_'+c+"_"+e+'_swatch">'+ctcAjax.swatch_txt+"</div>"+n+'<div class="ctc-child-input-cell ctc-button-cell" id="ctc_save_'+c+"_"+e+'_cell">'+n+'<input type="button" class="button ctc-save-input" id="ctc_save_'+c+"_"+e+'" name="ctc_save_'+c+"_"+e+'" value="Save" /></div>'+n,l+="</div><!-- end input row -->"+n),l},w=function(e){if(1===loading.sel_val)return!1;if(0==loading.sel_val)return loading.sel_val=1,A("sel_val",e,w),!1;var c,a,n;h(ctcAjax.sel_val[e])?t("#ctc_sel_ovrd_rule_inputs").html(""):(h(ctcAjax.sel_val[e].seq)?t("#ctc_child_load_order_container").html(""):(c="ctc_ovrd_child_seq_"+e,n=parseInt(ctcAjax.sel_val[e].seq),a='<input type="text" id="'+c+'" name="'+c+'" class="ctc-child-value" value="'+n+'" />',t("#ctc_child_load_order_container").html(a)),h(ctcAjax.sel_val[e].value)?t("#ctc_sel_ovrd_rule_inputs").html(""):(a="",t.each(ctcAjax.sel_val[e].value,function(t){a+=m(e,t,"ovrd")}),t("#ctc_sel_ovrd_rule_inputs").html(a).find(".color-picker").each(function(){s(this)}),d("#ctc_child_all_0_swatch")))},j=function(e){if(1===loading.preview)return!1;if(0==loading.preview){loading.preview=1;var e;return(e=t(this).attr("id").toString().match(/(child|parnt)/)[1])||(e="child"),I(""),A("preview",e,j),!1}2==loading.preview&&(t("#view_"+e+"_options_panel").text(ctcAjax.previewResponse),loading.preview=0)},y=function(e){if(1===loading.rule_val)return!1;if(0==loading.rule_val)return loading.rule_val=1,A("rule_val",e,y),!1;var c=ctcAjax.rule[e],a='<div class="ctc-input-row clearfix" id="ctc_rule_row_'+c+'">'+n;!1===h(ctcAjax.rule_val[e])&&(t.each(ctcAjax.rule_val[e],function(t,e){var l=q(c,e);a+='<div class="ctc-parent-row clearfix" id="ctc_rule_row_'+c+"_"+t+'">'+n,a+='<div class="ctc-input-cell ctc-parent-value" id="ctc_'+t+"_parent_"+c+"_"+t+'">'+l.orig+"</div>"+n,a+='<div class="ctc-input-cell">'+n,a+='<div class="ctc-swatch ctc-specific" id="ctc_'+t+"_parent_"+c+"_"+t+'_swatch">'+ctcAjax.swatch_txt+"</div></div>"+n,a+='<div class="ctc-input-cell"><a href="#" class="ctc-selector-handle" id="ctc_selector_'+c+"_"+t+'">'+ctcAjax.selector_txt+"</a></div>"+n,a+='<div id="ctc_selector_'+c+"_"+t+'_container" class="ctc-selector-container clearfix">'+n,a+='<a href="#" id="ctc_selector_'+c+"_"+t+'_close" class="ctc-selector-handle" style="float:right">'+ctcAjax.close_txt+'</a><div id="ctc_status_val_qry_'+t+'"></div>'+n,a+='<div id="ctc_selector_'+c+"_"+t+'_rows"></div>'+n,a+="</div></div>"+n}),a+="</div>"+n),t("#ctc_rule_value_inputs").html(a).find(".ctc-swatch").each(function(){d(this)})},b=function(e){if(1==loading.val_qry)return!1;var c,a,l=t("#ctc_rule_menu_selected").text().replace(/[^\w\-]/g,u),r="";return 0===loading.val_qry?(loading.val_qry=1,c={rule:l},A("val_qry",e,b,c),!1):(!1===h(ctcAjax.val_qry[e])&&t.each(ctcAjax.val_qry[e],function(c,a){page_rule=c,t.each(a,function(a,l){r+='<h4 class="ctc-query-heading">'+a+"</h4>"+n,!1===h(l)&&t.each(l,function(t,a){ctcAjax.sel_val[t]=a,r+=m(t,c,e)})})}),a="#ctc_selector_"+l+"_"+e+"_rows",t(a).html(r).find(".color-picker").each(function(){s(this)}),void t(a).find(".ctc-swatch").each(function(){d(this)}))},A=function(e,c,a,n){var l={ctc_query_obj:e,ctc_query_key:c},r="#ctc_status_"+e+("val_qry"==e?"_"+c:"");return"object"==typeof n&&t.each(n,function(t,e){l["ctc_query_"+t]=e}),t(".ctc-status-icon").remove(),t(r).append('<span class="ctc-status-icon spinner"></span>'),t(".spinner").show(),l.action="ctc_query",l._wpnonce=t("#_wpnonce").val(),t.post(ctcAjax.ajaxurl,l,function(n){return loading[e]=2,t(".ctc-status-icon").removeClass("spinner"),h(n)?(t(".ctc-status-icon").addClass("failure"),void("preview"==e&&(ctcAjax.previewResponse=ctcAjax.css_fail_txt,a(c)))):(t(".ctc-status-icon").addClass("success"),"preview"==e?ctcAjax.previewResponse=n.shift().data:v(n),"function"==typeof a&&a(c),!1)},"json").fail(function(){t(".ctc-status-icon").removeClass("spinner"),t(".ctc-status-icon").addClass("failure"),"preview"==e?(ctcAjax.previewResponse=ctcAjax.css_fail_txt,loading[e]=2,a(c)):loading[e]=0}),!1},k=function(e){var n,l,i,o,s={},_=t(e).attr("id");return h(r[_])&&(r[_]=0),r[_]++,t(e).prop("disabled",!0),t(".ctc-status-icon").remove(),t(e).parent(".ctc-textarea-button-cell, .ctc-button-cell").append('<span class="ctc-status-icon spinner"></span>'),t(".spinner").show(),(n=t("#ctc_new_selectors"))&&"ctc_save_new_selectors"==t(e).attr("id")?(s.ctc_new_selectors=n.val(),(l=t("#ctc_sel_ovrd_query_selected"))&&(s.ctc_sel_ovrd_query=l.text())):(i=t("#ctc_child_imports"))&&"ctc_save_imports"==t(e).attr("id")?s.ctc_child_imports=i.val():s=d(e),t("#ctc_sel_ovrd_selector_selected").find("#ctc_rewrite_selector").each(function(){o=t("#ctc_rewrite_selector").val(),origsel=t("#ctc_rewrite_selector_orig").val(),h(o)||!o.toString().match(/\w/)?o=origsel:s.ctc_rewrite_selector=o,t(".ctc-rewrite-toggle").text(ctcAjax.rename_txt),t("#ctc_sel_ovrd_selector_selected").html(o)}),s.action="ctc_update",s._wpnonce=t("#_wpnonce").val(),t.post(ctcAjax.ajaxurl,s,function(n){return t(e).prop("disabled",!1),t(".ctc-status-icon").removeClass("spinner"),h(n)?t(".ctc-status-icon").addClass("failure"):(t(".ctc-status-icon").addClass("success"),t("#ctc_new_selectors").val(""),v(n),L(),!1===h(c)&&(C(c,a),c=a=null)),!1},"json").fail(function(){t(e).prop("disabled",!1),t(".ctc-status-icon").removeClass("spinner"),t(".ctc-status-icon").addClass("failure")}),!1},q=function(t,e){e="undefined"==typeof e?"":e;var c={orig:e};if(t.toString().match(/^border(\-(top|right|bottom|left))?$/)){var a=e.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(t.toString().match(/^background\-image/))if(c.names=["_background_url","_background_origin","_background_color1","_background_color2"],c.values=["","","",""],!1!==h(e)||e.toString().match(/url/))c.values[0]=e;else{var a=e.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=[e];return c},S=function(e){l=e,t("#ctc_sel_ovrd_query").val(""),t("#ctc_sel_ovrd_query_selected").text(e),t("#ctc_sel_ovrd_selector").val(""),t("#ctc_sel_ovrd_selector_selected").html(" "),t("#ctc_sel_ovrd_rule_inputs").html(""),R(e),d("#ctc_child_all_0_swatch"),t("#ctc_new_selector_row").show()},C=function(c,a){t("#ctc_sel_ovrd_selector").val(""),t("#ctc_sel_ovrd_selector_selected").text(a),t("#ctc_sel_ovrd_qsid").val(c),e=c,1!=loading.sel_val&&(loading.sel_val=0),w(c),t(".ctc-rewrite-toggle").text(ctcAjax.rename_txt),t("#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()},D=function(e,c){t("#ctc_rule_menu").val(""),t("#ctc_rule_menu_selected").text(c),1!=loading.rule_val&&(loading.rule_val=0),y(e),t(".ctc-rewrite-toggle").text(ctcAjax.rename_txt),t("#ctc_rule_value_inputs,#ctc_input_row_rule_header").show()},F=function(){ctc_queries=f(),t("#ctc_sel_ovrd_query").autocomplete({source:ctc_queries,minLength:0,selectFirst:!0,autoFocus:!0,select:function(t,e){return S(e.item.value),!1},focus:function(t){t.preventDefault()}})},R=function(e){ctc_selectors=x(e),t("#ctc_sel_ovrd_selector").autocomplete({source:ctc_selectors,selectFirst:!0,autoFocus:!0,select:function(t,e){return C(e.item.value,e.item.label),!1},focus:function(t){t.preventDefault()}})},$=function(){ctc_rules=g(),t("#ctc_rule_menu").autocomplete({source:ctc_rules,selectFirst:!0,autoFocus:!0,select:function(t,e){return D(e.item.value,e.item.label),!1},focus:function(t){t.preventDefault()}})},T=function(c,a){var n=[],l=h(ctcAjax.sel_val[e])||h(ctcAjax.sel_val[e].value);h(ctc_rules)&&(ctc_rules=g()),t.each(ctc_rules,function(a,r){var i=!1,o=new RegExp(t.ui.autocomplete.escapeRegex(c.term),"i");if(o.test(r.label)){if(!1===l&&(t.each(ctcAjax.sel_val[e].value,function(t){return r.label==t.replace(/\d+/g,_)?(i=!0,!1):void 0}),i))return;n.push(r)}}),a(n)},E=function(){t("#ctc_new_rule_menu").autocomplete({source:T,selectFirst:!0,autoFocus:!0,select:function(c,a){c.preventDefault();var n=t(m(e,a.item.label.replace(/[^\w\-]/g,u),"ovrd"));return t("#ctc_sel_ovrd_rule_inputs").append(n),t("#ctc_new_rule_menu").val(""),h(ctcAjax.sel_val[e].value)&&(ctcAjax.sel_val[e].value={}),ctcAjax.sel_val[e].value[a.item.label]={child:""},n.find('input[type="text"]').each(function(e,c){t(c).hasClass("color-picker")&&s(c),t(c).focus()}),!1},focus:function(t){t.preventDefault()}})},L=function(){F(),R(l),$(),E()},z=function(e,c){var a=!1;return t.each(ctcAjax.themes,function(n,l){return t.each(l,function(t){return t!=e||"parnt"!=n&&"new"!=c?void 0:(a=!0,!1)}),a?!1:void 0}),a},I=function(e){var c="";!1===h(e)&&t.each(e,function(e,a){c+='<div class="'+e+'"><ul>'+n,t(a).each(function(t,e){c+="<li>"+e.toString()+"</li>"+n}),c+="</ul></div>"}),t("#ctc_error_notice").html(c)},O=function(){var e=/[^\w\-]/,c=t("#ctc_child_template").val().toString().replace(e).toLowerCase(),a=t("#ctc_theme_child").val().toString().replace(e).toLowerCase(),n=t("input[name=ctc_child_type]:checked").val(),l=[];return"new"==n&&(a=c),z(a,n)&&l.push(ctcAjax.theme_exists_txt.toString().replace(/%s/,a)),""===a&&l.push(ctcAjax.inval_theme_txt),""===t("#ctc_child_name").val()&&l.push(ctcAjax.inval_name_txt),l.length?(I({error:l}),!1):!0},N=function(){var e=t("#ctc_theme_child").val();!1===h(ctcAjax.themes.child[e])&&(t("#ctc_child_name").val(ctcAjax.themes.child[e].Name),t("#ctc_child_author").val(ctcAjax.themes.child[e].Author),t("#ctc_child_version").val(ctcAjax.themes.child[e].Version))},P=function(){t(".updated, .error").slideUp("slow",function(){t(".updated").remove()})},Q=function(){var e,c=t("#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)||t.get(l,function(c){for(;(e=r.exec(c))&&"style.css"!=e[1];)ctcAjax.addl_css.push(e[1]),t(".ctc_checkbox").each(function(){t(this).val()==e[1]&&t(this).prop("checked",!0)})})},U=function(e){var c=e+"_panel";t(".nav-tab").removeClass("nav-tab-active"),t(".ctc-option-panel").removeClass("ctc-option-panel-active"),t(".ctc-selector-container").hide(),t(e).addClass("nav-tab-active"),t(".ctc-option-panel-container").scrollTop(0),t(c).addClass("ctc-option-panel-active")},V=function(e){var c=t(e).attr("id").match(/_(\d+)$/)[1],a=ctcAjax.sel_val[c].query,n=ctcAjax.sel_val[c].selector,l="#query_selector_options";S(a),C(c,n),U(l)},B=function(e){var c;t("#ctc_rewrite_selector").length?(c=t("#ctc_rewrite_selector_orig").val(),t("#ctc_sel_ovrd_selector_selected").text(c),t(e).text(ctcAjax.rename_txt)):(c=t("#ctc_sel_ovrd_selector_selected").text(),t("#ctc_sel_ovrd_selector_selected").html('<input id="ctc_rewrite_selector" name="ctc_rewrite_selector" type="text" value="'+o(c)+'" autocomplete="off" /><input id="ctc_rewrite_selector_orig" name="ctc_rewrite_selector_orig" type="hidden" value="'+o(c)+'"/>'),t(e).text(ctcAjax.cancel_txt))};loading={rule:2,sel_ndx:2,val_qry:0,rule_val:0,sel_val:0,preview:0},ctc_selectors=[],ctc_queries=[],ctc_rules=[],t(".color-picker").each(function(){s(this)}),t(".ctc-option-panel-container").on("focus",".color-picker",function(){I(""),t(this).iris("toggle"),t(".iris-picker").css({position:"absolute","z-index":10})}),t(".ctc-option-panel-container").on("focus","input",function(){I(""),t(".color-picker").not(this).iris("hide")}),t(".ctc-option-panel-container").on("change",".ctc-child-value, input[type=checkbox]",function(){d(this)}),t(".ctc-option-panel-container").on("click",".ctc-selector-handle",function(e){e.preventDefault(),I("");var c=t(this).attr("id").toString().replace("_close",""),a=c.toString().match(/_(\d+)$/)[1];t("#"+c+"_container").is(":hidden")&&(1!=loading.val_qry&&(loading.val_qry=0),b(a)),t("#"+c+"_container").fadeToggle("fast"),t(".ctc-selector-container").not("#"+c+"_container").fadeOut("fast")}),t(".nav-tab").on("click",function(e){e.preventDefault(),I(""),t(".ctc-status-icon").remove();var c="#"+t(this).attr("id");U(c)}),t("#view_child_options,#view_parnt_options").on("click",j),t("#ctc_load_form").on("submit",function(){return O()&&confirm(ctcAjax.load_txt)}),t("#parent_child_options_panel").on("change","#ctc_theme_child",N),t(document).on("click",".ctc-save-input",function(){k(this)}),t(document).on("click",".ctc-selector-edit",function(){V(this)}),t(document).on("click",".ctc-rewrite-toggle",function(t){t.preventDefault(),B(this)}),t(document).on("change","#ctc_theme_parnt",function(){t(this).parents(".ctc-input-row").first().append('<span class="ctc-status-icon spinner"></span>'),t(".spinner").show(),document.location="?page=chld_thm_cfg_menu&ctc_parent="+t(this).val()}),t(document).on("click","#ctc_additional_css_label",function(){t(this).toggleClass("open"),t("#ctc_additional_css_files").slideToggle("fast")}),L(),S(l),Q(),t("input[type=submit],input[type=button]").prop("disabled",!1),setTimeout(P,6e3)});
|
1 |
+
;jQuery(document).ready(function(C){var G="\n",p="base",y,F={},P,s,r=new RegExp('"',"g"),E=function(T){return z(T)?T:T.toString().replace(r,""")},O=function(T){C(T).iris({change:function(){H(T)}})},A=function(V){var T=parseInt(V),U=String.fromCharCode(T);return U},f=function(U){var T=U.charCodeAt(0);return T},H=function(Z){var V=/^(ctc_(ovrd|\d+)_(parent|child)_([0-9a-z\-]+)_(\d+))(_\w+)?$/,aa=C(Z).parents(".ctc-selector-row, .ctc-parent-row").first(),Y=aa.find(".ctc-swatch").first(),X={parent:{},child:{}},W={parent:{origin:"",start:"",end:""},child:{origin:"",start:"",end:""}},U={child:false,parent:false},T={};aa.find(".ctc-parent-value, .ctc-child-value").each(function(){var ai=C(this).attr("id"),ab=ai.toString().match(V),aj=ab[2],ac=ab[3],al=("undefined"==typeof ab[4]?"":ab[4]),ah=ab[5],ag=("undefined"==typeof ab[6]?"":ab[6]),ak=("parent"==ac?C(this).text():C(this).val()),ad="ctc_"+aj+"_child_"+al+"_i_"+ah,af,ae;if("child"==ac){T[ai]=ak;T[ad]=(C("#"+ad).is(":checked"))?1:0}if(""!=ak){if(false===z(ag)){switch(ag){case"_border_width":X[ac][al+"-width"]=ak;break;case"_border_style":X[ac][al+"-style"]=ak;break;case"_border_color":X[ac][al+"-color"]=ak;break;case"_background_url":X[ac]["background-image"]=S(ac,ak);break;case"_background_color":X[ac]["background-color"]=Z.value;break;case"_background_color1":W[ac].start=ak;U[ac]=true;break;case"_background_color2":W[ac].end=ak;U[ac]=true;break;case"_background_origin":W[ac].origin=ak;U[ac]=true;break}}else{if(af=al.toString().match(/^border(\-(top|right|bottom|left))?$/)&&!ak.match(/none/)){ae=ak.toString().split(/ +/);X[ac][al+"-width"]="undefined"==typeof ae[0]?"":ae[0];X[ac][al+"-style"]="undefined"==typeof ae[1]?"":ae[1];X[ac][al+"-color"]="undefined"==typeof ae[2]?"":ae[2]}else{if("background-image"==al){if(ak.toString().match(/url\(/)){X[ac]["background-image"]=S(ac,ak)}else{ae=ak.toString().split(/ +/);if(ae.length>2){W[ac].origin="undefined"==typeof ae[0]?"top":ae[0];W[ac].start="undefined"==typeof ae[1]?"transparent":ae[1];W[ac].end="undefined"==typeof ae[2]?"transparent":ae[2];U[ac]=true}else{X[ac]["background-image"]=ak}}}else{X[ac][al]=ak}}}}});if("undefined"!=typeof Y&&false===z(Y.attr("id"))){C(Y).removeAttr("style");if(U.parent){C(Y).ctcgrad(W.parent.origin,[W.parent.start,W.parent.end])}C(Y).css(X.parent);if(!(Y.attr("id").toString().match(/parent/))){if(U.child){C(Y).ctcgrad(W.child.origin,[W.child.start,W.child.end])}C(Y).css(X.child)}C(Y).css({"z-index":-1})}return T},x=function(U){var T,V,W;C(U).each(function(){switch(this.obj){case"imports":ctcAjax.imports=this.data;break;case"rule_val":ctcAjax.rule_val[this.key]=this.data;W=this.key;break;case"val_qry":ctcAjax.val_qry[this.key]=this.data;break;case"rule":ctcAjax.rule=this.data;break;case"sel_ndx":if(z(this.key)){ctcAjax.sel_ndx=this.data}else{if("qsid"==this.key){if(z(ctcAjax.sel_ndx[this.data.query])){ctcAjax.sel_ndx[this.data.query]={}}ctcAjax.sel_ndx[this.data.query][this.data.selector]=this.data.qsid}else{ctcAjax.sel_ndx[this.key]=this.data;T=this.key}}break;case"sel_val":ctcAjax.sel_val[this.key]=this.data;V=this.key;break;case"rewrite":P=this.key;s=this.data;break}})},S=function(X,U){var W=U.toString().match(/url\(['" ]*(.+?)['" ]*\)/),V=z(W)?null:W[1],T=ctcAjax.theme_uri+"/"+("parent"==X?ctcAjax.parnt:ctcAjax.child)+"/",Y;if(!V){return false}else{if(V.toString().match(/^(https?:|\/)/)){Y=U}else{Y="url("+T+V+")"}}return Y},z=function(U){if("undefined"==typeof U||false===U||null===U||""===U){return true}if(true===U||"string"===typeof U||"number"===typeof U){return false}if("object"===typeof U){for(var T in U){if(U.hasOwnProperty(T)){return false}}return true}return false},g=function(){var T=[];if(1===loading.sel_ndx){return T}if(0===loading.sel_ndx){loading.sel_ndx=1;Q("sel_ndx",null,K);return T}if(false===z(ctcAjax.sel_ndx)){C.each(ctcAjax.sel_ndx,function(U,V){var W={label:U,value:U};T.push(W)})}return T},N=function(U){var T=[];if(1===loading.sel_ndx){return T}if(0===loading.sel_ndx){loading.sel_ndx=1;Q("sel_ndx",U,R);return T}if(false===z(ctcAjax.sel_ndx[U])){C.each(ctcAjax.sel_ndx[U],function(V,W){var X={label:V,value:W};T.push(X)})}return T},d=function(){var T=[];if(1===loading.rule){return T}if(0===loading.rule){loading.rule=1;Q("rule",null,j);return T}if(false===z(ctcAjax.rule)){C.each(ctcAjax.rule,function(U,V){var W={label:V.replace(/\d+/g,A),value:U};T.push(W)})}return T.sort(function(V,U){if(V.label>U.label){return 1}if(V.label<U.label){return -1}return 0})},M=function(X,Z,ac){var V="",aa=(z(ctcAjax.sel_val[X])||z(ctcAjax.sel_val[X].value)||z(ctcAjax.sel_val[X].value[Z])?"":ctcAjax.sel_val[X].value[Z]),U=B(Z,("undefined"==typeof aa?"":aa.parnt)),Y=(false===z(aa.i_parnt)&&aa.i_parnt)?ctcAjax.important_label:"",W=B(Z,("undefined"==typeof aa?"":aa.child)),T=(false===z(aa.i_child)&&aa.i_child)?1:0,ab="ctc_"+ac+"_child_"+Z+"_i_"+X;if(false===z(ctcAjax.sel_val[X])){V+='<div class="ctc-'+("ovrd"==ac?"input":"selector")+'-row clearfix">'+G;V+='<div class="ctc-input-cell">'+("ovrd"==ac?Z.replace(/\d+/g,A):ctcAjax.sel_val[X].selector+'<br/><a href="#" class="ctc-selector-edit" id="ctc_selector_edit_'+X+'" >'+ctcAjax.edit_txt+"</a> "+(z(U.orig)?ctcAjax.child_only_txt:""))+"</div>"+G;if("ovrd"==ac){V+='<div class="ctc-parent-value ctc-input-cell" id="ctc_'+ac+"_parent_"+Z+"_"+X+'">'+(z(U.orig)?"[no value]":U.orig+Y)+"</div>"+G}V+='<div class="ctc-input-cell">'+G;if(false===z(U.names)){C.each(U.names,function(ad,ae){ae=(z(ae)?"":ae);V+='<div class="ctc-child-input-cell">'+G;var ag="ctc_"+ac+"_child_"+Z+"_"+X+ae,af;if(false===(af=W.values.shift())){af=""}V+=(z(ae)?"":ctcAjax.field_labels[ae]+":<br/>")+'<input type="text" id="'+ag+'" name="'+ag+'" class="ctc-child-value'+((ae+Z).toString().match(/color/)?" color-picker":"")+((ae).toString().match(/url/)?" ctc-input-wide":"")+'" value="'+E(af)+'" />'+G;V+="</div>"+G});V+='<label for="'+ab+'"><input type="checkbox" id="'+ab+'" name="'+ab+'" value="1" '+(1===T?"checked":"")+" />"+ctcAjax.important_label+"</label>"+G}V+="</div>"+G;V+=("ovrd"==ac?"":'<div class="ctc-swatch ctc-specific" id="ctc_child_'+Z+"_"+X+'_swatch">'+ctcAjax.swatch_txt+"</div>"+G+'<div class="ctc-child-input-cell ctc-button-cell" id="ctc_save_'+Z+"_"+X+'_cell">'+G+'<input type="button" class="button ctc-save-input" id="ctc_save_'+Z+"_"+X+'" name="ctc_save_'+Z+"_"+X+'" value="Save" /></div>'+G);V+="</div><!-- end input row -->"+G}return V},L=function(T){if(1===loading.sel_val){return false}if(0==loading.sel_val){loading.sel_val=1;Q("sel_val",T,L);return false}var W,U,V;if(z(ctcAjax.sel_val[T])){C("#ctc_sel_ovrd_rule_inputs").html("")}else{if(z(ctcAjax.sel_val[T].seq)){C("#ctc_child_load_order_container").html("")}else{W="ctc_ovrd_child_seq_"+T;V=parseInt(ctcAjax.sel_val[T].seq);U='<input type="text" id="'+W+'" name="'+W+'" class="ctc-child-value" value="'+V+'" />';C("#ctc_child_load_order_container").html(U)}if(z(ctcAjax.sel_val[T].value)){C("#ctc_sel_ovrd_rule_inputs").html("")}else{U="";C.each(ctcAjax.sel_val[T].value,function(Y,X){U+=M(T,Y,"ovrd")});C("#ctc_sel_ovrd_rule_inputs").html(U).find(".color-picker").each(function(){O(this)});H("#ctc_child_all_0_swatch")}}},n=function(T){if(1===loading.preview){return false}if(0==loading.preview){loading.preview=1;var T;if(!(T=C(this).attr("id").toString().match(/(child|parnt)/)[1])){T="child"}b("");Q("preview",T,n);return false}if(2==loading.preview){C("#view_"+T+"_options_panel").text(ctcAjax.previewResponse);loading.preview=0}},v=function(U){if(1===loading.rule_val){return false}if(0==loading.rule_val){loading.rule_val=1;Q("rule_val",U,v);return false}var V=ctcAjax.rule[U],T='<div class="ctc-input-row clearfix" id="ctc_rule_row_'+V+'">'+G;if(false===z(ctcAjax.rule_val[U])){C.each(ctcAjax.rule_val[U],function(X,Y){var W=B(V,Y);T+='<div class="ctc-parent-row clearfix" id="ctc_rule_row_'+V+"_"+X+'">'+G;T+='<div class="ctc-input-cell ctc-parent-value" id="ctc_'+X+"_parent_"+V+"_"+X+'">'+W.orig+"</div>"+G;T+='<div class="ctc-input-cell">'+G;T+='<div class="ctc-swatch ctc-specific" id="ctc_'+X+"_parent_"+V+"_"+X+'_swatch">'+ctcAjax.swatch_txt+"</div></div>"+G;T+='<div class="ctc-input-cell"><a href="#" class="ctc-selector-handle" id="ctc_selector_'+V+"_"+X+'">'+ctcAjax.selector_txt+"</a></div>"+G;T+='<div id="ctc_selector_'+V+"_"+X+'_container" class="ctc-selector-container clearfix">'+G;T+='<a href="#" id="ctc_selector_'+V+"_"+X+'_close" class="ctc-selector-handle" style="float:right">'+ctcAjax.close_txt+'</a><div id="ctc_status_val_qry_'+X+'"></div>'+G;T+='<div id="ctc_selector_'+V+"_"+X+'_rows"></div>'+G;T+="</div></div>"+G});T+="</div>"+G}C("#ctc_rule_value_inputs").html(T).find(".ctc-swatch").each(function(){H(this)})},t=function(W){if(1==loading.val_qry){return false}var Y,U,X=C("#ctc_rule_menu_selected").text().replace(/[^\w\-]/g,f),T,V="";if(0===loading.val_qry){loading.val_qry=1;Y={rule:X};Q("val_qry",W,t,Y);return false}if(false===z(ctcAjax.val_qry[W])){C.each(ctcAjax.val_qry[W],function(aa,Z){page_rule=aa;C.each(Z,function(ac,ab){V+='<h4 class="ctc-query-heading">'+ac+"</h4>"+G;if(false===z(ab)){C.each(ab,function(ad,ae){ctcAjax.sel_val[ad]=ae;V+=M(ad,aa,W)})}})})}T="#ctc_selector_"+X+"_"+W+"_rows";C(T).html(V).find(".color-picker").each(function(){O(this)});C(T).find(".ctc-swatch").each(function(){H(this)})},Q=function(V,U,Y,W){var T={ctc_query_obj:V,ctc_query_key:U},X="#ctc_status_"+V+("val_qry"==V?"_"+U:"");if("object"===typeof W){C.each(W,function(Z,aa){T["ctc_query_"+Z]=aa})}C(".ctc-status-icon").remove();C(X).append('<span class="ctc-status-icon spinner"></span>');C(".spinner").show();T.action="ctc_query";T._wpnonce=C("#_wpnonce").val();C.post(ctcAjax.ajaxurl,T,function(Z){loading[V]=2;C(".ctc-status-icon").removeClass("spinner");if(z(Z)){C(".ctc-status-icon").addClass("failure");if("preview"==V){ctcAjax.previewResponse=ctcAjax.css_fail_txt;Y(U)}}else{C(".ctc-status-icon").addClass("success");if("preview"==V){ctcAjax.previewResponse=Z.shift().data}else{x(Z)}if("function"===typeof Y){Y(U)}return false}},"json").fail(function(){C(".ctc-status-icon").removeClass("spinner");C(".ctc-status-icon").addClass("failure");if("preview"==V){ctcAjax.previewResponse=ctcAjax.css_fail_txt;loading[V]=2;Y(U)}else{loading[V]=0}});return false},w=function(Y){var W={},Z,V,T,U,aa=C(Y).attr("id"),X;if(z(F[aa])){F[aa]=0}F[aa]++;C(Y).prop("disabled",true);C(".ctc-status-icon").remove();C(Y).parent(".ctc-textarea-button-cell, .ctc-button-cell").append('<span class="ctc-status-icon spinner"></span>');C(".spinner").show();if((Z=C("#ctc_new_selectors"))&&"ctc_save_new_selectors"==C(Y).attr("id")){W.ctc_new_selectors=Z.val();if(V=C("#ctc_sel_ovrd_query_selected")){W.ctc_sel_ovrd_query=V.text()}}else{if((T=C("#ctc_child_imports"))&&"ctc_save_imports"==C(Y).attr("id")){W.ctc_child_imports=T.val()}else{W=H(Y)}}C("#ctc_sel_ovrd_selector_selected").find("#ctc_rewrite_selector").each(function(){X=C("#ctc_rewrite_selector").val(),origsel=C("#ctc_rewrite_selector_orig").val();if(z(X)||!X.toString().match(/\w/)){X=origsel}else{W.ctc_rewrite_selector=X}C(".ctc-rewrite-toggle").text(ctcAjax.rename_txt);C("#ctc_sel_ovrd_selector_selected").html(X)});W.action="ctc_update";W._wpnonce=C("#_wpnonce").val();C.post(ctcAjax.ajaxurl,W,function(ab){C(Y).prop("disabled",false);C(".ctc-status-icon").removeClass("spinner");if(z(ab)){C(".ctc-status-icon").addClass("failure")}else{C(".ctc-status-icon").addClass("success");C("#ctc_new_selectors").val("");x(ab);k();if(false===z(P)){D(P,s);P=s=null}}return false},"json").fail(function(){C(Y).prop("disabled",false);C(".ctc-status-icon").removeClass("spinner");C(".ctc-status-icon").addClass("failure")});return false},B=function(V,T){T=("undefined"==typeof T?"":T);var U={orig:T};if(V.toString().match(/^border(\-(top|right|bottom|left))?$/)){var W=T.toString().split(/ +/);U.names=["_border_width","_border_style","_border_color"];U.values=[("undefined"==typeof W[0]?"":W[0]),("undefined"==typeof W[1]?"":W[1]),("undefined"==typeof W[2]?"":W[2])]}else{if(V.toString().match(/^background\-image/)){U.names=["_background_url","_background_origin","_background_color1","_background_color2"];U.values=["","","",""];if(false===(z(T))&&!(T.toString().match(/url/))){var W=T.toString().split(/:/);U.values[1]=("undefined"==typeof W[0]?"":W[0]);U.values[2]=("undefined"==typeof W[1]?"":W[1]);U.values[3]=("undefined"==typeof W[3]?"":W[3]);U.orig=[U.values[1],U.values[2],U.values[3]].join(" ")}else{U.values[0]=T}}else{U.names=[""];U.values=[T]}}return U},a=function(T){p=T;C("#ctc_sel_ovrd_query").val("");C("#ctc_sel_ovrd_query_selected").text(T);C("#ctc_sel_ovrd_selector").val("");C("#ctc_sel_ovrd_selector_selected").html(" ");C("#ctc_sel_ovrd_rule_inputs").html("");R(T);H("#ctc_child_all_0_swatch");C("#ctc_new_selector_row").show()},D=function(U,T){C("#ctc_sel_ovrd_selector").val("");C("#ctc_sel_ovrd_selector_selected").text(T);C("#ctc_sel_ovrd_qsid").val(U);y=U;if(1!=loading.sel_val){loading.sel_val=0}L(U);C(".ctc-rewrite-toggle").text(ctcAjax.rename_txt);C("#ctc_sel_ovrd_new_rule, #ctc_sel_ovrd_rule_header,#ctc_sel_ovrd_rule_inputs_container,#ctc_sel_ovrd_rule_inputs,.ctc-rewrite-toggle").show()},c=function(U,T){C("#ctc_rule_menu").val("");C("#ctc_rule_menu_selected").text(T);if(1!=loading.rule_val){loading.rule_val=0}v(U);C(".ctc-rewrite-toggle").text(ctcAjax.rename_txt);C("#ctc_rule_value_inputs,#ctc_input_row_rule_header").show()},K=function(){ctc_queries=g();C("#ctc_sel_ovrd_query").autocomplete({source:ctc_queries,minLength:0,selectFirst:true,autoFocus:true,select:function(U,T){a(T.item.value);return false},focus:function(T){T.preventDefault()}})},R=function(T){ctc_selectors=N(T);C("#ctc_sel_ovrd_selector").autocomplete({source:ctc_selectors,selectFirst:true,autoFocus:true,select:function(V,U){D(U.item.value,U.item.label);return false},focus:function(U){U.preventDefault()}})},j=function(){ctc_rules=d();C("#ctc_rule_menu").autocomplete({source:ctc_rules,selectFirst:true,autoFocus:true,select:function(U,T){c(T.item.value,T.item.label);return false},focus:function(T){T.preventDefault()}})},J=function(W,U){var T=[],V=(z(ctcAjax.sel_val[y]))||(z(ctcAjax.sel_val[y].value));if(z(ctc_rules)){ctc_rules=d()}C.each(ctc_rules,function(X,aa){var Y=false,Z=new RegExp(C.ui.autocomplete.escapeRegex(W.term),"i");if(Z.test(aa.label)){if(false===V){C.each(ctcAjax.sel_val[y].value,function(ac,ab){if(aa.label==ac.replace(/\d+/g,A)){Y=true;return false}});if(Y){return}}T.push(aa)}});U(T)},I=function(){C("#ctc_new_rule_menu").autocomplete({source:J,selectFirst:true,autoFocus:true,select:function(U,T){U.preventDefault();var V=C(M(y,T.item.label.replace(/[^\w\-]/g,f),"ovrd"));C("#ctc_sel_ovrd_rule_inputs").append(V);C("#ctc_new_rule_menu").val("");if(z(ctcAjax.sel_val[y].value)){ctcAjax.sel_val[y]["value"]={}}ctcAjax.sel_val[y].value[T.item.label]={child:""};V.find('input[type="text"]').each(function(W,X){if(C(X).hasClass("color-picker")){O(X)}C(X).focus()});return false},focus:function(T){T.preventDefault()}})},k=function(){K();R(p);j();I()},o=function(T,U){var V=false;C.each(ctcAjax.themes,function(W,X){C.each(X,function(Y,Z){if(Y==T&&("parnt"==W||"new"==U)){V=true;return false}});if(V){return false}});return V},b=function(T){var U="";if(false===z(T)){C.each(T,function(V,W){U+='<div class="'+V+'"><ul>'+G;C(W).each(function(X,Y){U+="<li>"+Y.toString()+"</li>"+G});U+="</ul></div>"})}C("#ctc_error_notice").html(U)},q=function(){var W=/[^\w\-]/,U=C("#ctc_child_template").val().toString().replace(W).toLowerCase(),T=C("#ctc_theme_child").val().toString().replace(W).toLowerCase(),V=C("input[name=ctc_child_type]:checked").val(),X=[];if("new"==V){T=U}if(o(T,V)){X.push(ctcAjax.theme_exists_txt.toString().replace(/%s/,T))}if(""===T){X.push(ctcAjax.inval_theme_txt)}if(""===C("#ctc_child_name").val()){X.push(ctcAjax.inval_name_txt)}if(X.length){b({error:X});return false}return true},m=function(U){var T=C("#ctc_theme_child").val();if(false===z(ctcAjax.themes.child[T])){C("#ctc_child_name").val(ctcAjax.themes.child[T].Name);C("#ctc_child_author").val(ctcAjax.themes.child[T].Author);C("#ctc_child_version").val(ctcAjax.themes.child[T].Version)}},u=function(){C(".updated, .error").slideUp("slow",function(){C(".updated").remove()})},e=function(){var X=C("#ctc_theme_parnt").val(),W=ctcAjax.theme_uri.replace(/^https?:\/\//,""),U=ctcAjax.homeurl.replace(/^https?/,ctcAjax.ssl?"https":"http"),V=U+"?preview=1&p=x&template="+X+"&stylesheet="+X,Y=new RegExp("<link rel=[\"']stylesheet[\"'][^>]+?"+W+"/"+X+"/(.+?\\.css)[^>]+?>","g"),T;if(z(X)){return}C.get(V,function(Z){while(T=Y.exec(Z)){if("style.css"==T[1]){break}if(T[1].match(/bootstrap/)){continue}ctcAjax.addl_css.push(T[1]);C(".ctc_checkbox").each(function(aa,ab){if(C(this).val()==T[1]){C(this).prop("checked",true)}})}})},l=function(U){var T=U+"_panel";C(".nav-tab").removeClass("nav-tab-active");C(".ctc-option-panel").removeClass("ctc-option-panel-active");C(".ctc-selector-container").hide();C(U).addClass("nav-tab-active");C(".ctc-option-panel-container").scrollTop(0);C(T).addClass("ctc-option-panel-active")},i=function(W){var T=C(W).attr("id").match(/_(\d+)$/)[1],V=ctcAjax.sel_val[T].query,U=ctcAjax.sel_val[T].selector,X="#query_selector_options";a(V);D(T,U);l(X)},h=function(U){var T;if(C("#ctc_rewrite_selector").length){T=C("#ctc_rewrite_selector_orig").val();C("#ctc_sel_ovrd_selector_selected").text(T);C(U).text(ctcAjax.rename_txt)}else{T=C("#ctc_sel_ovrd_selector_selected").text();C("#ctc_sel_ovrd_selector_selected").html('<input id="ctc_rewrite_selector" name="ctc_rewrite_selector" type="text" value="'+E(T)+'" autocomplete="off" /><input id="ctc_rewrite_selector_orig" name="ctc_rewrite_selector_orig" type="hidden" value="'+E(T)+'"/>');C(U).text(ctcAjax.cancel_txt)}};loading={rule:2,sel_ndx:2,val_qry:0,rule_val:0,sel_val:0,preview:0},ctc_selectors=[],ctc_queries=[],ctc_rules=[];C(".color-picker").each(function(){O(this)});C(".ctc-option-panel-container").on("focus",".color-picker",function(){b("");C(this).iris("toggle");C(".iris-picker").css({position:"absolute","z-index":10})});C(".ctc-option-panel-container").on("focus","input",function(){b("");C(".color-picker").not(this).iris("hide")});C(".ctc-option-panel-container").on("change",".ctc-child-value, input[type=checkbox]",function(){H(this)});C(".ctc-option-panel-container").on("click",".ctc-selector-handle",function(U){U.preventDefault();b("");var V=C(this).attr("id").toString().replace("_close",""),T=V.toString().match(/_(\d+)$/)[1];if(C("#"+V+"_container").is(":hidden")){if(1!=loading.val_qry){loading.val_qry=0}t(T)}C("#"+V+"_container").fadeToggle("fast");C(".ctc-selector-container").not("#"+V+"_container").fadeOut("fast")});C(".nav-tab").on("click",function(T){T.preventDefault();b("");C(".ctc-status-icon").remove();var U="#"+C(this).attr("id");l(U)});C("#view_child_options,#view_parnt_options").on("click",n);C("#ctc_load_form").on("submit",function(){return(q()&&confirm(ctcAjax.load_txt))});C("#parent_child_options_panel").on("change","#ctc_theme_child",m);C(document).on("click",".ctc-save-input",function(T){w(this)});C(document).on("click",".ctc-selector-edit",function(T){i(this)});C(document).on("click",".ctc-rewrite-toggle",function(T){T.preventDefault();h(this)});C(document).on("change","#ctc_theme_parnt",function(T){C(this).parents(".ctc-input-row").first().append('<span class="ctc-status-icon spinner"></span>');C(".spinner").show();document.location="?page=chld_thm_cfg_menu&ctc_parent="+C(this).val()});C(document).on("click","#ctc_additional_css_label",function(T){C(this).toggleClass("open");C("#ctc_additional_css_files").slideToggle("fast")});k();a(p);e();C("input[type=submit],input[type=button]").prop("disabled",false);setTimeout(u,6000)});
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: lilaeamedia
|
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8QE5YJ8WE96AJ
|
4 |
Tags: child theme, custom theme, CSS, responsive design, CSS editor, theme generator
|
5 |
Requires at least: 3.7
|
6 |
-
Tested up to: 4.0
|
7 |
-
Stable tag: 1.5.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -142,7 +142,7 @@ https://www.youtube.com/watch?v=DSfx2RbZobo
|
|
142 |
|
143 |
= Why doesn't this work with my (insert theme vendor here) theme? =
|
144 |
|
145 |
-
Some themes (particularly commercial themes) do not
|
146 |
|
147 |
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.**
|
148 |
|
@@ -150,13 +150,13 @@ Contact the vendor directly to ask for this core functionality. It is our opinio
|
|
150 |
|
151 |
= Will this slow down my site? =
|
152 |
|
153 |
-
The
|
154 |
|
155 |
-
Once the child theme stylesheet is created, CTC adds very little overhead to the front-end since all of the functionality is in the admin.
|
156 |
|
157 |
= Why doesn't the Parent Theme have any styles when I "View Parent CSS"? =
|
158 |
|
159 |
-
|
160 |
|
161 |
= Where is it in the Admin? =
|
162 |
|
@@ -236,6 +236,13 @@ https://www.youtube.com/watch?v=iBiiAgsK4G4
|
|
236 |
|
237 |
== Changelog ==
|
238 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
239 |
= 1.5.3 =
|
240 |
* Fixed a bug in the way zero values are handled that was breaking css output in certian situations
|
241 |
* Added regex filter for non-printable (e.g., null) characters in input strings
|
@@ -391,7 +398,7 @@ https://www.youtube.com/watch?v=iBiiAgsK4G4
|
|
391 |
|
392 |
== Upgrade Notice ==
|
393 |
|
394 |
-
v.1.5.
|
395 |
|
396 |
== Create Your Child Theme ==
|
397 |
|
@@ -484,11 +491,10 @@ You can also click the Preview CSS tab to see your new masterpiece as CSS code.
|
|
484 |
== Caveats ==
|
485 |
|
486 |
* ALWAYS TEST YOUR CHILD THEME BEFORE ACTIVATING (See "Preview and Activate," above).
|
487 |
-
* No web font preview. Look for live preview of imported fonts in a later release.
|
488 |
* No legacy webkit-gradient. The Child Theme Configurator plugin does not support the legacy webkit gradient. If there is a demand, we will add it in a future release, but most Chrome and Safari users should have upgraded by now.
|
489 |
* 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.
|
490 |
* 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.
|
491 |
-
*
|
492 |
|
493 |
== Documentation ==
|
494 |
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8QE5YJ8WE96AJ
|
4 |
Tags: child theme, custom theme, CSS, responsive design, CSS editor, theme generator
|
5 |
Requires at least: 3.7
|
6 |
+
Tested up to: 4.0.1
|
7 |
+
Stable tag: 1.5.4
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
142 |
|
143 |
= Why doesn't this work with my (insert theme vendor here) theme? =
|
144 |
|
145 |
+
Some themes (particularly commercial themes) do not correctly load parent template files or automatically load child theme stylesheets or php files.
|
146 |
|
147 |
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.**
|
148 |
|
150 |
|
151 |
= Will this slow down my site? =
|
152 |
|
153 |
+
The plugin only loads the bulk of the code in the admin when you are using the tool. The biggest performance hit occurs when you generate the Child Theme files from the Parent/Child tab.
|
154 |
|
155 |
+
Once the child theme stylesheet is created, CTC adds very little overhead to the front-end since all of the functionality is in the admin.
|
156 |
|
157 |
= Why doesn't the Parent Theme have any styles when I "View Parent CSS"? =
|
158 |
|
159 |
+
Check the appropriate additional stylesheets under "Scan Parent Theme for 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.
|
160 |
|
161 |
= Where is it in the Admin? =
|
162 |
|
236 |
|
237 |
== Changelog ==
|
238 |
|
239 |
+
= 1.5.4 =
|
240 |
+
* New Feature: Load imported stylesheets into the CTC admin so web fonts can be previewed.
|
241 |
+
* Set preview swatch to z-index -1 to prevent it from covering up the controls
|
242 |
+
* Spread config data across multiple option records to prevent out of memory errors with large stylesheets.
|
243 |
+
* Do not automatically select Bootstrap CSS files as additional stylesheets to (greatly) reduce overhead.
|
244 |
+
* Add jQuery UI styles that are no longer being loaded by default in the WP admin (autoselect menus).
|
245 |
+
|
246 |
= 1.5.3 =
|
247 |
* Fixed a bug in the way zero values are handled that was breaking css output in certian situations
|
248 |
* Added regex filter for non-printable (e.g., null) characters in input strings
|
398 |
|
399 |
== Upgrade Notice ==
|
400 |
|
401 |
+
v.1.5.4 Finally adds web font previews and fixes some bugs. See changelog for details.
|
402 |
|
403 |
== Create Your Child Theme ==
|
404 |
|
491 |
== Caveats ==
|
492 |
|
493 |
* ALWAYS TEST YOUR CHILD THEME BEFORE ACTIVATING (See "Preview and Activate," above).
|
|
|
494 |
* No legacy webkit-gradient. The Child Theme Configurator plugin does not support the legacy webkit gradient. If there is a demand, we will add it in a future release, but most Chrome and Safari users should have upgraded by now.
|
495 |
* Only two-color gradients. The Child Theme Configurator plugin is powerful, but we have simplified the gradient interface. You can use any gradient you want as long as it has two colors and no intermediate stops.
|
496 |
* No @font-face rules. The Child Theme Configurator plugin only supports @media and @import. If you need other @rules, put them in a separate stylesheet and import them into the Child Theme stylesheet.
|
497 |
+
* The Child Theme Configurator plugin loads the rules that exist in the Parent stylesheet. To add new rules, use the Raw CSS input option.
|
498 |
|
499 |
== Documentation ==
|
500 |
|