Child Theme Configurator - Version 2.0.0

Version Description

  • New Theme Analyzer automatically checks for issues and determines correct settings
  • Step by step setup of Parent/Child settings
  • Simplified parent stylesheet handling options
  • Option to write new child theme styles to a separate stylesheet
  • Uses WordPress style dependencies to ensure correct child theme stylesheet load order
  • Automatically repairs themes that use outdated stylesheet handling methods
  • Parses parent theme files and only displays templates that can be be overridden by child themes
  • Numerous minor bug fixes
Download this release

Release Info

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

Code changes from version 1.7.8 to 2.0.0

Files changed (43) hide show
  1. child-theme-configurator.php +16 -105
  2. css/chld-thm-cfg.min.css +0 -1
  3. css/{chld-thm-cfg.css → chldthmcfg.css} +113 -18
  4. includes/class-ctc-admin.php +2084 -0
  5. includes/class-ctc-css.php +228 -116
  6. includes/class-ctc-preview.php +118 -0
  7. includes/class-ctc-ui.php +264 -66
  8. includes/class-ctc.php +103 -1616
  9. includes/forms/addl_css.php +2 -2
  10. includes/forms/addl_panels.php +27 -27
  11. includes/forms/backup.php +1 -1
  12. includes/forms/backups.php +2 -2
  13. includes/forms/fileform.php +12 -12
  14. includes/forms/files.php +14 -19
  15. includes/forms/images.php +3 -3
  16. includes/forms/main.php +34 -8
  17. includes/forms/parent-child.php +313 -254
  18. includes/forms/query-selector.php +16 -16
  19. includes/forms/related.php +1 -1
  20. includes/forms/rule-value.php +4 -4
  21. includes/forms/tabs.php +16 -21
  22. includes/forms/themepreview.php +7 -7
  23. includes/forms/webfonts.php +2 -2
  24. includes/forms/zipform.php +10 -0
  25. includes/help/de_DE.php +221 -0
  26. includes/help/{help_en_US.php → en_US.php} +47 -49
  27. js/chld-thm-cfg.js +0 -1522
  28. js/chld-thm-cfg.min.js +0 -1
  29. js/chldthmcfg.js +2257 -0
  30. js/chldthmcfg.min.js +2 -0
  31. lang/child-theme-configurator-de_DE.mo +0 -0
  32. lang/child-theme-configurator-de_DE.po +1381 -0
  33. lang/{chld_thm_cfg-sr_RS.mo → child-theme-configurator-sr_RS.mo} +0 -0
  34. lang/{chld_thm_cfg-sr_RS.po → child-theme-configurator-sr_RS.po} +0 -0
  35. lang/{chld_thm_cfg.pot → child-theme-configurator.pot} +439 -244
  36. readme.txt +85 -60
  37. screenshot-1.jpg +0 -0
  38. screenshot-2.jpg +0 -0
  39. screenshot-3.jpg +0 -0
  40. screenshot-4.jpg +0 -0
  41. screenshot-5.jpg +0 -0
  42. screenshot-6.jpg +0 -0
  43. screenshot-7.jpg +0 -0
child-theme-configurator.php CHANGED
@@ -5,8 +5,8 @@ if ( !defined( 'ABSPATH' ) ) exit;
5
  /*
6
  Plugin Name: Child Theme Configurator
7
  Plugin URI: http://www.childthemeconfigurator.com
8
- Description: Create child themes and customize styles, templates and functions. Enqueues stylesheets and web fonts. Handles rgba, vendor-prefixes and more.
9
- Version: 1.7.8
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com
12
  Text Domain: chld_thm_cfg
@@ -15,110 +15,27 @@ if ( !defined( 'ABSPATH' ) ) exit;
15
  Copyright (C) 2014-2015 Lilaea Media
16
  */
17
 
18
- defined( 'LF' ) or define( 'LF', "\n" );
19
- defined( 'LILAEAMEDIA_URL' ) or
20
- define( 'LILAEAMEDIA_URL', "http://www.lilaeamedia.com" );
21
- defined( 'CHLD_THM_CFG_DOCS_URL' ) or
22
- define( 'CHLD_THM_CFG_DOCS_URL', "http://www.childthemeconfigurator.com" );
23
- defined( 'CHLD_THM_CFG_OPTIONS' ) or
24
- define( 'CHLD_THM_CFG_OPTIONS', 'chld_thm_cfg_options' );
25
- define( 'CHLD_THM_CFG_VERSION', '1.7.8' );
26
- define( 'CHLD_THM_CFG_MIN_WP_VERSION', '3.7' );
27
- defined( 'CHLD_THM_CFG_BPSEL' ) or
28
- define( 'CHLD_THM_CFG_BPSEL', '2500' );
29
- defined( 'CHLD_THM_CFG_MAX_RECURSE_LOOPS' ) or
30
- define( 'CHLD_THM_CFG_MAX_RECURSE_LOOPS', '1000' );
31
- defined( 'CHLD_THM_CFG_MENU' ) or
32
- define( 'CHLD_THM_CFG_MENU', 'chld_thm_cfg_menu' );
33
  defined( 'CHLD_THM_CFG_DIR' ) or
34
  define( 'CHLD_THM_CFG_DIR', dirname( __FILE__ ) );
35
  defined( 'CHLD_THM_CFG_URL' ) or
36
  define( 'CHLD_THM_CFG_URL', plugin_dir_url( __FILE__ ) );
37
-
38
- class ChildThemeConfigurator {
39
- static $instance;
40
- static function init() {
41
- // initialize languages
42
- load_plugin_textdomain( 'chld_thm_cfg', FALSE, basename( CHLD_THM_CFG_DIR ) . '/lang' );
43
- // verify WP version support
44
- global $wp_version;
45
- if ( version_compare( $wp_version, CHLD_THM_CFG_MIN_WP_VERSION ) < 0 ):
46
- add_action( 'admin_notices', 'ChildthemeConfigurator::version_notice' );
47
- return;
48
- endif;
49
- // setup admin hooks
50
- if ( is_multisite() )
51
- add_action( 'network_admin_menu', 'ChildThemeConfigurator::network_admin' );
52
- //else
53
- add_action( 'admin_menu', 'ChildThemeConfigurator::admin' );
54
- // setup ajax actions
55
- add_action( 'wp_ajax_ctc_update', 'ChildThemeConfigurator::save' );
56
- add_action( 'wp_ajax_ctc_query', 'ChildThemeConfigurator::query' );
57
- }
58
- static function ctc() {
59
- // create admin object
60
- global $chld_thm_cfg; /// backward compat
61
- if ( !isset( self::$instance ) ):
62
- include_once( CHLD_THM_CFG_DIR . '/includes/class-ctc.php' );
63
- self::$instance = new ChildThemeConfiguratorAdmin( __FILE__ );
64
- endif;
65
- $chld_thm_cfg = self::$instance; /// backward compat
66
- return self::$instance;
67
- }
68
- static function save() {
69
- // ajax write
70
- self::ctc()->ajax_save_postdata();
71
- }
72
- static function query() {
73
- // ajax read
74
- self::ctc()->ajax_query_css();
75
- }
76
- static function network_admin() {
77
- $hook = add_theme_page(
78
- __( 'Child Theme Configurator', 'chld_thm_cfg' ),
79
- __( 'Child Themes', 'chld_thm_cfg' ),
80
- 'install_themes',
81
- CHLD_THM_CFG_MENU,
82
- 'ChildThemeConfigurator::render'
83
- );
84
- add_action( 'load-' . $hook, 'ChildThemeConfigurator::page_init' );
85
- }
86
- static function admin() {
87
- $hook = add_management_page(
88
- __( 'Child Theme Configurator', 'chld_thm_cfg' ),
89
- __( 'Child Themes', 'chld_thm_cfg' ),
90
- 'install_themes',
91
- CHLD_THM_CFG_MENU,
92
- 'ChildThemeConfigurator::render'
93
- );
94
- add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'ChildThemeConfigurator::action_links' );
95
- add_action( 'load-' . $hook, 'ChildThemeConfigurator::page_init' );
96
- }
97
- static function action_links( $actions ) {
98
- $actions[] = '<a href="' . admin_url( 'tools.php?page=' . CHLD_THM_CFG_MENU ). '">'
99
- . __( 'Child Themes', 'chld_thm_cfg' ) . '</a>' . LF;
100
- return $actions;
101
- }
102
- static function page_init() {
103
- // start admin controller
104
- self::ctc()->ctc_page_init();
105
- }
106
- static function render() {
107
- // display admin page
108
- self::ctc()->render();
109
- }
110
- static function version_notice() {
111
- deactivate_plugins( plugin_basename( __FILE__ ) );
112
- unset( $_GET[ 'activate' ] );
113
- echo '<div class="update-nag"><p>' .
114
- sprintf( __( 'Child Theme Configurator requires WordPress version %s or later.', 'chld_thm_cfg' ),
115
- CHLD_THM_CFG_MIN_WP_VERSION ) . '</p></div>' . LF;
116
- }
117
- }
118
 
119
  if ( is_admin() )
120
- add_action( 'plugins_loaded', 'ChildThemeConfigurator::init' );
 
 
 
121
 
 
 
 
 
 
 
 
 
122
 
123
  register_uninstall_hook( __FILE__, 'chld_thm_cfg_uninstall' );
124
 
@@ -135,9 +52,3 @@ if ( !defined( 'ABSPATH' ) ) exit;
135
  delete_option( CHLD_THM_CFG_OPTIONS . '_val_ndx' );
136
  }
137
 
138
- add_filter( 'style_loader_src', 'chld_thm_cfg_plugins_version', 10, 2 );
139
- function chld_thm_cfg_plugins_version( $src, $handle ) {
140
- if ( strstr( $src, get_stylesheet() ) )
141
- $src = preg_replace( "/ver=(.*?)(\&|$)/", 'ver=' . wp_get_theme()->Version . "$2", $src );
142
- return $src;
143
- }
5
  /*
6
  Plugin Name: Child Theme Configurator
7
  Plugin URI: http://www.childthemeconfigurator.com
8
+ Description: When the Customizer is not enough - Create child themes and customize styles, templates, functions and more.
9
+ Version: 2.0.0
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com
12
  Text Domain: chld_thm_cfg
15
  Copyright (C) 2014-2015 Lilaea Media
16
  */
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  defined( 'CHLD_THM_CFG_DIR' ) or
19
  define( 'CHLD_THM_CFG_DIR', dirname( __FILE__ ) );
20
  defined( 'CHLD_THM_CFG_URL' ) or
21
  define( 'CHLD_THM_CFG_URL', plugin_dir_url( __FILE__ ) );
22
+ defined( 'CHLD_THM_CFG_OPTIONS' ) or
23
+ define( 'CHLD_THM_CFG_OPTIONS', 'chld_thm_cfg_options' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
  if ( is_admin() )
26
+ include_once( dirname( __FILE__ ) . '/includes/class-ctc.php' );
27
+
28
+ if ( isset( $_GET['preview_ctc'] ) )
29
+ include_once( dirname( __FILE__ ) . '/includes/class-ctc-preview.php' );
30
 
31
+ add_filter( 'style_loader_src', 'chld_thm_cfg_version', 10, 2 );
32
+
33
+ function chld_thm_cfg_version( $src, $handle ) {
34
+ if ( strstr( $src, get_stylesheet() ) ):
35
+ $src = preg_replace( "/ver=(.*?)(\&|$)/", 'ver=' . wp_get_theme()->Version . "$2", $src );
36
+ endif;
37
+ return $src;
38
+ }
39
 
40
  register_uninstall_hook( __FILE__, 'chld_thm_cfg_uninstall' );
41
 
52
  delete_option( CHLD_THM_CFG_OPTIONS . '_val_ndx' );
53
  }
54
 
 
 
 
 
 
 
css/chld-thm-cfg.min.css DELETED
@@ -1 +0,0 @@
1
- body{background:0 0!important}p{line-height:1.4}.wrap h1,.wrap h2{font-size:23px;font-weight:400;line-height:29px;margin:.5em 0 1em}a.nav-tab,a.nav-tab:active,a.nav-tab:focus{outline:0;-moz-box-shadow:none;-webkit-box-shadow:none;box-shadow:none}h2 .ctc-recent-tab,h2 .nav-tab{font-size:13px;padding:6px 8px;font-weight:700;line-height:24px}.ctc-option-panel-container{position:relative;min-height:1100px;width:100%;overflow:auto}.ctc-three-col{-moz-columns:3;-moz-column-gap:3em;-webkit-columns:3;-webkit-column-gap:3em;columns:3;column-gap:3em}#all_styles_panel ul li,#ctc_recent_selectors ul li{margin:0}#all_styles_panel ul li a,#ctc_recent_selectors ul li a{text-decoration:none;font-size:.8em;line-height:1.2;word-wrap:break-word;display:block;padding:.5em}#all_styles_panel ul li a:focus,#all_styles_panel ul li a:hover,#ctc_recent_selectors ul li a:focus,#ctc_recent_selectors ul li a:hover{background-color:#fff;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}#view_child_options_panel,#view_parnt_options_panel{white-space:pre;overflow:auto;font-family:monospace;word-wrap:normal}.ctc-option-panel{visibility:hidden;position:absolute;width:100%;top:0;left:0;padding:10px 0 0}.ctc-recent-container{top:0;right:0;position:absolute;max-width:200px;width:17%;display:none;overflow:auto;visibility:visible;left:inherit;background-color:#E4E4E4}#ctc_recent_selectors{padding:0 8px}#live_preview_panel iframe{width:100%;min-height:1100px}a.ctc-recent-tab{float:right;border:1px solid #ccc;border-bottom:none;background-color:#E4E4E4;color:#555;display:inline-block;text-decoration:none;margin:-1px 0 0;box-shadow:none;-moz-box-shadow:none;-webkit-box-shadow:none;outline:0}.ctc-input-cell,.ctc-input-cell-wide{margin-right:2%;display:block;float:left}.ctc-option-panel-active{visibility:visible}.ctc-swatch{display:block;float:left;font-size:16px;padding:0;line-height:1;overflow:hidden}.ctc-hidden{display:none}.ctc-swatch.ctc-specific{min-height:60px;max-height:100px;max-width:100px;margin:0 2% 0 0}.ctc-selector-inner-container .ctc-swatch.ctc-specific{max-width:13%}.ctc-parent-row{clear:both;position:relative;margin:4px 0}.ctc-input-cell{width:30%;max-width:350px;word-wrap:break-word}.ctc-selector-inner-container .ctc-input-cell{width:35%}.ctc-input-cell-wide{width:60%}.ctc-input-cell-wide input[type=text]{width:100%}.ctc-input-cell-wide textarea{width:100%;height:200px;white-space:pre;overflow:auto;font-family:inherit;word-wrap:normal}.ctc-selector-inner-container .ctc-button-cell,.ctc-selector-inner-container .ctc-input-cell.ctc-button-cell{width:8%}.ctc-textarea-button-cell{margin:4px 10px 15px;text-align:right;float:right}.ctc-rewrite-toggle{font-size:.8em;padding-left:1em;display:none;outline:0}.ctc-delete-input{font-size:.8em;float:right;color:#8b0000;text-decoration:none}.ctc-selector-container{clear:both;background:#f9f9f9;border:1px solid #ddd;padding:10px;position:absolute;min-height:300px;width:80%;left:15%;top:30px;display:none;z-index:99999;-moz-box-shadow:0 2px 10px rgba(0,0,0,.3);-webkit-box-shadow:0 2px 10px rgba(0,0,0,.3);box-shadow:0 2px 10px rgba(0,0,0,.3)}.ctc-selector-inner-container{position:relative;min-height:300px;overflow:auto}.ctc-status-icon.failure,.ctc-status-icon.success{display:block;float:right;position:relative;height:16px;width:16px;margin:4px}.ctc-exit{display:block;width:20px;height:20px;position:absolute;top:-13px;right:-13px;transition:none!important;z-index:999;border:3px solid #f9f9f9;-moz-border-radius:16px;-webkit-border-radius:16px;border-radius:16px}.ctc-exit:active,.ctc-exit:hover{background-position:right top}.ctc-selector-row{clear:both;margin:0;padding:8px 0;border-top:1px solid #ddd;border-bottom:1px solid #fff}.ctc-input-row{clear:both;margin:4px 0;padding:4px 0;border-bottom:1px solid #ddd;position:relative}.howto.sep{border-bottom:1px solid #fff;margin-bottom:.5em;padding-bottom:.5em}.ctc-selector-cell{float:left;width:30%;margin-right:2%}.ctc-child-input-cell{display:block;float:left;margin-right:2%}.ctc-child-input-cell-container{float:left;width:40%;margin-right:2%}.ctc-child-input-cell-container label{float:left;clear:both;width:100px;margin-right:2%}.ctc-disabled{opacity:.5}.ctc-select{max-width:100%}.ctc-child-input-cell input[type=text].ctc-input-wide{width:200px}#ctc_additional_css_label{cursor:pointer}#ctc_additional_css_label span{white-space:nowrap}.clearfix:after,.clearfix:before{content:' ';display:table;margin:0;padding:0}.clear,.clearfix:after{clear:both}.ie7 .clearfix{zoom:1}.smaller{font-size:.85em}.writable{color:red}.ui-state-focus,.ui-state-hover,.ui-widget-content .ui-state-focus,.ui-widget-content .ui-state-hover,.ui-widget-header .ui-state-focus,.ui-widget-header .ui-state-hover{background-color:#DADADA;color:#212121}.ui-menu .ui-menu-item{position:relative;margin:0;padding:3px 1em 3px .4em;cursor:pointer;min-height:0;overflow:hidden;text-overflow:ellipsis;max-width:450px}.ctc-section-toggle{position:relative;cursor:pointer}.ctc-section-toggle:after{content:"\f140";font:400 20px/1 dashicons;color:#999;vertical-align:bottom}.ctc-section-toggle.open:after{content:"\f142"}a.ctc-section-toggle,a.ctc-section-toggle:active,a.ctc-section-toggle:hover,a.ctc-section-toggle:visited{text-decoration:none;float:right;font-size:.85em;box-shadow:none;-moz-box-shadow:none;-webkit-box-shadow:none;outline:0}.ctc-section-toggle-content{display:none;position:relative;margin:0;padding:1px 0}.ctc-theme-only{margin:0;padding:0;position:relative}h3.theme-name{margin:.25em 0;font-size:1.2em}.ctc-theme-option{max-width:250px}.ctc-theme-option-left{float:left;width:40%;margin-right:5%}.ctc-theme-option-right{float:right;width:55%;margin-right:0;font-size:.9em;line-height:1.3}.ctc-theme-option-image{height:auto;width:100%;border:1px solid #ddd}.ui-widget-content{border:1px solid #aaa;background-color:#fff}.ui-widget-header{border:1px solid #aaa;background-color:#ccc;font-weight:700}.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default{border:1px solid #d3d3d3;font-weight:400;color:#555}.ui-state-focus,.ui-widget-content .ui-state-active,.ui-widget-content .ui-state-focus,.ui-widget-content .ui-state-hover,.ui-widget-header .ui-state-active,.ui-widget-header .ui-state-focus,.ui-widget-header .ui-state-hover{font-weight:400;color:#212121}.ui-selectmenu-menu{padding:0;margin:0;position:absolute;top:0;left:0;display:none}.ui-selectmenu-menu .ui-menu{overflow:auto;max-height:372px;margin-top:0;overflow-x:hidden}.ui-selectmenu-menu .ui-menu .ui-menu-item{padding:6px}.ui-selectmenu-open{display:block}.ui-selectmenu-button{display:inline-block;overflow:hidden;position:relative;text-decoration:none;cursor:pointer;min-width:200px}.ui-selectmenu-button span.ui-icon{right:.5em;left:auto;margin-top:-10px;position:absolute;top:50%}.ui-icon-triangle-1-s:before{display:inline-block;-webkit-font-smoothing:antialiased;font:400 20px/1 dashicons;content:"\f140"}.ui-selectmenu-button span.ui-selectmenu-text{text-align:left;padding:.4em 2.1em .4em 1em;display:block;line-height:1.4;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}#get_pro_panel h1{font-size:1.75em;color:#c64200}#get_pro_panel h3{font-size:1.4em;margin-bottom:0}#get_pro_panel p{font-size:1em;margin:.5em 0}.ctc-input-cell .update-nag,.ctc-input-cell-wide.update-nag{margin:0}.ctc-input-cell-wide.update-nag{margin-bottom:1em}#get_pro_panel ul,.ctc-input-cell-wide.update-nag ul{list-style:square}#get_pro_panel li,.ctc-input-cell-wide.update-nag li{margin-left:2em}#get_pro_panel h3 a{display:block;padding:5px 10px;background-color:#c64200;color:#fff;text-decoration:none;text-align:center}#get_pro_panel h3 a:hover{background-color:#FF902E;color:#fff}#get_pro_panel img{max-width:100%;height:auto}.sp-container{position:absolute;top:0;left:0;display:inline-block;z-index:9999994;overflow:hidden}.sp-container.sp-flat,.sp-top{position:relative}.sp-container,.sp-container *{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}.sp-top{width:100%;display:inline-block}.sp-alpha-handle,.sp-color,.sp-dragger,.sp-hue,.sp-sat,.sp-slider,.sp-top-inner,.sp-val{position:absolute}.sp-top-inner{top:0;left:0;bottom:0;right:0}.sp-color{top:0;left:0;bottom:0;right:20%}.sp-hue{top:0;right:0;bottom:0;left:84%;height:100%}.sp-clear-enabled .sp-hue{top:33px;height:77.5%}.sp-fill{padding-top:80%}.sp-sat,.sp-val{top:0;left:0;right:0;bottom:0}.sp-alpha-enabled .sp-top{margin-bottom:18px}.sp-alpha-enabled .sp-alpha{display:block}.sp-alpha-handle{top:-4px;bottom:-4px;width:6px;left:50%;cursor:pointer;border:1px solid #000;background:#fff;opacity:.8}.sp-alpha{display:none;bottom:-14px;right:0;left:0;height:8px}.sp-alpha-inner{border:1px solid #333}.sp-clear{display:none}.sp-clear.sp-clear-display{background-position:center}.sp-clear-enabled .sp-clear{display:block;position:absolute;top:0;right:0;bottom:0;left:84%;height:28px}.sp-alpha,.sp-alpha-handle,.sp-clear,.sp-container,.sp-container button,.sp-container.sp-dragging .sp-input,.sp-dragger,.sp-preview,.sp-replacer,.sp-slider{-webkit-user-select:none;-moz-user-select:-moz-none;-o-user-select:none;user-select:none}.sp-container.sp-buttons-disabled .sp-button-container,.sp-container.sp-input-disabled .sp-input-container,.sp-container.sp-palette-buttons-disabled .sp-palette-button-container,.sp-initial-disabled .sp-initial,.sp-palette-disabled .sp-palette-container,.sp-palette-only .sp-picker-container{display:none}.sp-sat{background-image:-webkit-gradient(linear,0 0,100% 0,from(#FFF),to(rgba(204,154,129,0)));background-image:-webkit-linear-gradient(left,#FFF,rgba(204,154,129,0));background-image:-moz-linear-gradient(left,#fff,rgba(204,154,129,0));background-image:-o-linear-gradient(left,#fff,rgba(204,154,129,0));background-image:-ms-linear-gradient(left,#fff,rgba(204,154,129,0));background-image:linear-gradient(to right,#fff,rgba(204,154,129,0));-ms-filter:"progid:DXImageTransform.Microsoft.gradient(GradientType = 1, startColorstr=#FFFFFFFF, endColorstr=#00CC9A81)";filter:progid:DXImageTransform.Microsoft.gradient(GradientType=1, startColorstr='#FFFFFFFF', endColorstr='#00CC9A81')}.sp-val{background-image:-webkit-gradient(linear,0 100%,0 0,from(#000),to(rgba(204,154,129,0)));background-image:-webkit-linear-gradient(bottom,#000,rgba(204,154,129,0));background-image:-moz-linear-gradient(bottom,#000,rgba(204,154,129,0));background-image:-o-linear-gradient(bottom,#000,rgba(204,154,129,0));background-image:-ms-linear-gradient(bottom,#000,rgba(204,154,129,0));background-image:linear-gradient(to top,#000,rgba(204,154,129,0));-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorstr=#00CC9A81, endColorstr=#FF000000)";filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#00CC9A81', endColorstr='#FF000000')}.sp-hue{background:-moz-linear-gradient(top,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%);background:-ms-linear-gradient(top,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%);background:-o-linear-gradient(top,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%);background:-webkit-gradient(linear,left top,left bottom,from(red),color-stop(.17,#ff0),color-stop(.33,#0f0),color-stop(.5,#0ff),color-stop(.67,#00f),color-stop(.83,#f0f),to(red));background:-webkit-linear-gradient(top,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%);background:linear-gradient(to bottom,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%)}.sp-1{height:17%;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0000', endColorstr='#ffff00')}.sp-2{height:16%;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffff00', endColorstr='#00ff00')}.sp-3{height:17%;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ff00', endColorstr='#00ffff')}.sp-4{height:17%;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ffff', endColorstr='#0000ff')}.sp-5{height:16%;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#0000ff', endColorstr='#ff00ff')}.sp-6{height:17%;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff00ff', endColorstr='#ff0000')}.sp-hidden{display:none!important}.sp-cf:after,.sp-cf:before{content:"";display:table}.sp-cf:after{clear:both}@media (max-device-width:480px){.sp-color{right:40%}.sp-hue{left:63%}.sp-fill{padding-top:60%}}.sp-dragger{border-radius:5px;height:5px;width:5px;border:1px solid #fff;background:#000;cursor:pointer;top:0;left:0}.sp-slider{top:0;cursor:pointer;height:3px;left:-1px;right:-1px;border:1px solid #000;background:#fff;opacity:.8}.sp-container{border-radius:0;background-color:#ECECEC;border:1px solid #f0c49B;padding:0}.sp-clear,.sp-color,.sp-container,.sp-container button,.sp-container input,.sp-hue{font:400 12px "Lucida Grande","Lucida Sans Unicode","Lucida Sans",Geneva,Verdana,sans-serif;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box}.sp-top{margin-bottom:3px}.sp-clear,.sp-color,.sp-hue{border:1px solid #666}.sp-input-container{float:right;width:100px;margin-bottom:4px}.sp-initial-disabled .sp-input-container,.sp-input{width:100%}.sp-input{font-size:12px!important;border:1px inset;padding:4px 5px;margin:0;background:0 0;border-radius:3px;color:#222}.sp-input:focus{border:1px solid orange}.sp-input.sp-validation-error{border:1px solid red;background:#fdd}.sp-palette-container,.sp-picker-container{float:left;position:relative;padding:10px 10px 300px;margin-bottom:-290px}.sp-picker-container{width:172px;border-left:solid 1px #fff}.sp-palette-container{border-right:solid 1px #ccc;max-width:60px}.sp-palette-only .sp-palette-container{border:0}.sp-palette .sp-thumb-el{display:block;position:relative;float:left;cursor:pointer}.sp-palette .sp-thumb-el.sp-thumb-active,.sp-palette .sp-thumb-el:hover{border-color:orange}.sp-thumb-el{position:relative}.sp-initial{float:left;border:1px solid #333}.sp-initial span{width:30px;height:25px;border:none;display:block;float:left;margin:0}.sp-initial .sp-clear-display{background-position:center}.sp-button-container,.sp-palette-button-container{float:right}.sp-replacer{margin:0;overflow:hidden;cursor:pointer;padding:4px;display:inline-block;border:1px solid #91765d;background:#eee;color:#333;vertical-align:middle}.sp-replacer.sp-active,.sp-replacer:hover{border-color:#F0C49B;color:#111}.sp-replacer.sp-disabled{cursor:default;border-color:silver;color:silver}.sp-dd{padding:2px 0;height:16px;line-height:16px;float:left;font-size:10px;font-family:sans-serif}.sp-preview{width:25px;height:20px;border:1px solid #222;margin-right:5px;float:left;z-index:0}.sp-palette{max-width:220px}.sp-palette .sp-thumb-el{width:16px;height:16px;margin:2px 1px;border:1px solid #d0d0d0}.sp-container{padding-bottom:0}.sp-container button{background-color:#eee;background-image:-webkit-linear-gradient(top,#eee,#ccc);background-image:-moz-linear-gradient(top,#eee,#ccc);background-image:-ms-linear-gradient(top,#eee,#ccc);background-image:-o-linear-gradient(top,#eee,#ccc);background-image:linear-gradient(to bottom,#eee,#ccc);border:1px solid #ccc;border-bottom:1px solid #bbb;border-radius:3px;color:#333;font-size:14px;line-height:1;padding:5px 4px;text-align:center;text-shadow:0 1px 0 #eee;vertical-align:middle}.sp-container button:hover{background-color:#ddd;background-image:-webkit-linear-gradient(top,#ddd,#bbb);background-image:-moz-linear-gradient(top,#ddd,#bbb);background-image:-ms-linear-gradient(top,#ddd,#bbb);background-image:-o-linear-gradient(top,#ddd,#bbb);background-image:linear-gradient(to bottom,#ddd,#bbb);border:1px solid #bbb;border-bottom:1px solid #999;cursor:pointer;text-shadow:0 1px 0 #ddd}.sp-container button:active{border:1px solid #aaa;border-bottom:1px solid #888;-webkit-box-shadow:inset 0 0 5px 2px #aaa,0 1px 0 0 #eee;-moz-box-shadow:inset 0 0 5px 2px #aaa,0 1px 0 0 #eee;-ms-box-shadow:inset 0 0 5px 2px #aaa,0 1px 0 0 #eee;-o-box-shadow:inset 0 0 5px 2px #aaa,0 1px 0 0 #eee;box-shadow:inset 0 0 5px 2px #aaa,0 1px 0 0 #eee}.sp-cancel{font-size:11px;color:#d93f3f!important;margin:0 5px 0 0;padding:2px;vertical-align:middle;text-decoration:none}.sp-cancel:hover{color:#d93f3f!important;text-decoration:underline}.sp-palette span.sp-thumb-active,.sp-palette span:hover{border-color:#000}.sp-alpha,.sp-preview,.sp-thumb-el{position:relative;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==)}.sp-alpha-inner,.sp-preview-inner,.sp-thumb-inner{display:block;position:absolute;top:0;left:0;bottom:0;right:0}.sp-palette .sp-thumb-inner{background-position:50% 50%;background-repeat:no-repeat}.sp-palette .sp-thumb-light.sp-thumb-active .sp-thumb-inner{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAIVJREFUeNpiYBhsgJFMffxAXABlN5JruT4Q3wfi/0DsT64h8UD8HmpIPCWG/KemIfOJCUB+Aoacx6EGBZyHBqI+WsDCwuQ9mhxeg2A210Ntfo8klk9sOMijaURm7yc1UP2RNCMbKE9ODK1HM6iegYLkfx8pligC9lCD7KmRof0ZhjQACDAAceovrtpVBRkAAAAASUVORK5CYII=)}.sp-palette .sp-thumb-dark.sp-thumb-active .sp-thumb-inner{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAAAMdJREFUOE+tkgsNwzAMRMugEAahEAahEAZhEAqlEAZhEAohEAYh81X2dIm8fKpEspLGvudPOsUYpxE2BIJCroJmEW9qJ+MKaBFhEMNabSy9oIcIPwrB+afvAUFoK4H0tMaQ3XtlrggDhOVVMuT4E5MMG0FBbCEYzjYT7OxLEvIHQLY2zWwQ3D+9luyOQTfKDiFD3iUIfPk8VqrKjgAiSfGFPecrg6HN6m/iBcwiDAo7WiBeawa+Kwh7tZoSCGLMqwlSAzVDhoK+6vH4G0P5wdkAAAAASUVORK5CYII=)}.sp-clear-display{background-repeat:no-repeat;background-position:center;background-image:url(data:image/gif;base64,R0lGODlhFAAUAPcAAAAAAJmZmZ2dnZ6enqKioqOjo6SkpKWlpaampqenp6ioqKmpqaqqqqurq/Hx8fLy8vT09PX19ff39/j4+Pn5+fr6+vv7+wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAP8ALAAAAAAUABQAAAihAP9FoPCvoMGDBy08+EdhQAIJCCMybCDAAYUEARBAlFiQQoMABQhKUJBxY0SPICEYHBnggEmDKAuoPMjS5cGYMxHW3IiT478JJA8M/CjTZ0GgLRekNGpwAsYABHIypcAgQMsITDtWJYBR6NSqMico9cqR6tKfY7GeBCuVwlipDNmefAtTrkSzB1RaIAoXodsABiZAEFB06gIBWC1mLVgBa0AAOw==)}
 
css/{chld-thm-cfg.css → chldthmcfg.css} RENAMED
@@ -45,7 +45,6 @@ h2 .nav-tab, h2 .ctc-recent-tab {
45
  #ctc_recent_selectors ul li, #all_styles_panel ul li {
46
  margin: 0;
47
  }
48
-
49
  #ctc_recent_selectors ul li a, #all_styles_panel ul li a {
50
  text-decoration: none;
51
  font-size: .8em;
@@ -122,7 +121,50 @@ a.ctc-recent-tab {
122
  .ctc-option-panel-active {
123
  visibility: visible;
124
  }
125
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  .ctc-swatch {
127
  display: block;
128
  float: left;
@@ -176,16 +218,20 @@ a.ctc-recent-tab {
176
  .ctc-input-cell-wide input[type="text"] {
177
  width: 100%;
178
  }
179
-
180
- .ctc-input-cell-wide textarea {
181
  width: 100%;
182
  height: 200px;
 
 
 
183
  white-space: pre;
184
  overflow: auto;
185
  font-family: inherit;
186
  word-wrap: normal;
187
  }
188
-
 
 
189
  .ctc-save-input {
190
  }
191
 
@@ -307,8 +353,12 @@ a.ctc-recent-tab {
307
  }
308
  .howto.sep {
309
  border-bottom: 1px solid #fff;
310
- margin-bottom: .5em;
311
- padding-bottom: .5em;
 
 
 
 
312
  }
313
  .ctc-selector-cell {
314
  float: left;
@@ -358,8 +408,7 @@ a.ctc-recent-tab {
358
  #ctc_additional_css_label span {
359
  white-space: nowrap;
360
  }
361
-
362
- .clearfix:after, .clearfix:before {
363
  content: ' ';
364
  display: table;
365
  margin: 0;
@@ -407,14 +456,21 @@ a.ctc-recent-tab {
407
  cursor: pointer;
408
  }
409
 
410
- .ctc-section-toggle:after {
411
  content: "\f140";
412
- font: 400 20px/1 dashicons;
 
 
 
413
  color: #999;
414
- vertical-align: bottom;
 
 
 
 
415
  }
416
 
417
- .ctc-section-toggle.open:after {
418
  content: "\f142";
419
  }
420
  a.ctc-section-toggle, a.ctc-section-toggle:hover, a.ctc-section-toggle:active, a.ctc-section-toggle:visited {
@@ -468,7 +524,9 @@ h3.theme-name {
468
  width: 100%;
469
  border: 1px solid #ddd;
470
  }
471
-
 
 
472
  /* jquery UI widget classes */
473
 
474
  .ui-widget-content {
@@ -532,6 +590,7 @@ h3.theme-name {
532
  text-decoration: none;
533
  cursor: pointer;
534
  min-width: 200px;
 
535
  }
536
 
537
  .ui-selectmenu-button span.ui-icon {
@@ -572,16 +631,16 @@ h3.theme-name {
572
  font-size:1em;
573
  margin: .5em 0;
574
  }
575
- .ctc-input-cell .update-nag, .ctc-input-cell-wide.update-nag {
576
  margin: 0;
577
  }
578
- .ctc-input-cell-wide.update-nag {
579
  margin-bottom:1em;
580
  }
581
- #get_pro_panel ul, .ctc-input-cell-wide.update-nag ul {
582
  list-style: square;
583
  }
584
- #get_pro_panel li, .ctc-input-cell-wide.update-nag li {
585
  margin-left:2em;
586
  }
587
  #get_pro_panel h3 a {
@@ -601,6 +660,42 @@ h3.theme-name {
601
  max-width: 100%;
602
  height: auto;
603
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
604
 
605
  /***
606
  Spectrum Colorpicker v1.7.0
45
  #ctc_recent_selectors ul li, #all_styles_panel ul li {
46
  margin: 0;
47
  }
 
48
  #ctc_recent_selectors ul li a, #all_styles_panel ul li a {
49
  text-decoration: none;
50
  font-size: .8em;
121
  .ctc-option-panel-active {
122
  visibility: visible;
123
  }
124
+ .ctc-step {
125
+ -moz-border-radius:50%;
126
+ -webkit-border-radius:50%;
127
+ border-radius:50%;
128
+ text-align:center;
129
+ font-weight:700;
130
+ font-style:normal;
131
+
132
+ }
133
+ .ctc-step-number {
134
+ color:#fff;
135
+ font-size:20px;
136
+ width:24px;
137
+ height:24px;
138
+ line-height:1.1;
139
+ padding:8px;
140
+ float:left;
141
+ display:block;
142
+ margin-right:8px;
143
+ margin-bottom:2em;
144
+ }
145
+ .ctc-step-letter {
146
+ color:#fff;
147
+ font-size:1em;
148
+ width:24px;
149
+ height:24px;
150
+ padding:8px;
151
+ line-height:1;
152
+ float:right;
153
+ display:block;
154
+ margin-right:-8px;
155
+ margin-top:8px;
156
+
157
+ }
158
+ .ctc-step + strong {
159
+ font-size:1.1em;
160
+ }
161
+ .ctc-step + strong.shift:before {
162
+ position:relative;
163
+ content:'';
164
+ display:block;
165
+ height:10px;
166
+
167
+ }
168
  .ctc-swatch {
169
  display: block;
170
  float: left;
218
  .ctc-input-cell-wide input[type="text"] {
219
  width: 100%;
220
  }
221
+ #ctc_main textarea {
 
222
  width: 100%;
223
  height: 200px;
224
+ font-size: 12px;
225
+ }
226
+ .ctc-input-cell-wide textarea {
227
  white-space: pre;
228
  overflow: auto;
229
  font-family: inherit;
230
  word-wrap: normal;
231
  }
232
+ #ctc_theme_attributes_content .ctc-input-cell-wide textarea {
233
+ white-space: normal;
234
+ }
235
  .ctc-save-input {
236
  }
237
 
353
  }
354
  .howto.sep {
355
  border-bottom: 1px solid #fff;
356
+ margin-bottom: 1em;
357
+ padding-bottom: 1em;
358
+ }
359
+ .howto.indent {
360
+ padding-left:1.75em;
361
+ margin-top:.25em;
362
  }
363
  .ctc-selector-cell {
364
  float: left;
408
  #ctc_additional_css_label span {
409
  white-space: nowrap;
410
  }
411
+ .clearfix:before,.clearfix:after{
 
412
  content: ' ';
413
  display: table;
414
  margin: 0;
456
  cursor: pointer;
457
  }
458
 
459
+ .ctc-section-toggle:before {
460
  content: "\f140";
461
+ font-weight: 400;
462
+ font-size: 1.5em;
463
+ line-height:1;
464
+ font-family: dashicons;
465
  color: #999;
466
+ display:block;
467
+ float:right;
468
+ width:1em;
469
+ height:1em;
470
+
471
  }
472
 
473
+ .ctc-section-toggle.open:before {
474
  content: "\f142";
475
  }
476
  a.ctc-section-toggle, a.ctc-section-toggle:hover, a.ctc-section-toggle:active, a.ctc-section-toggle:visited {
524
  width: 100%;
525
  border: 1px solid #ddd;
526
  }
527
+ #ctc_theme_attributes_content,#ctc_stylesheet_handling_content {
528
+ padding: 1.5em 2.5em;
529
+ }
530
  /* jquery UI widget classes */
531
 
532
  .ui-widget-content {
590
  text-decoration: none;
591
  cursor: pointer;
592
  min-width: 200px;
593
+ padding:.4em 0;
594
  }
595
 
596
  .ui-selectmenu-button span.ui-icon {
631
  font-size:1em;
632
  margin: .5em 0;
633
  }
634
+ .ctc-input-cell .notice-warning, .ctc-input-cell-wide.notice-warning {
635
  margin: 0;
636
  }
637
+ .ctc-input-cell-wide.notice-warning {
638
  margin-bottom:1em;
639
  }
640
+ #get_pro_panel ul, .ctc-input-cell-wide.notice-warning ul {
641
  list-style: square;
642
  }
643
+ #get_pro_panel li, .ctc-input-cell-wide.notice-warning li {
644
  margin-left:2em;
645
  }
646
  #get_pro_panel h3 a {
660
  max-width: 100%;
661
  height: auto;
662
  }
663
+ .ctc_analyze_loading {
664
+ display:inline-block;
665
+ line-height:2em;
666
+ }
667
+ #ctc_main .dashicons-before:before {
668
+ float: left;
669
+ margin-top:.5em;
670
+ margin-right:.5em;
671
+ font-size:2em;
672
+ content: "\f534";
673
+ }
674
+ #ctc_main .dashicons-before.error:before {
675
+ color:#DC3232;
676
+ }
677
+ #ctc_main .dashicons-before.notice-warning:before {
678
+ color:#FFBA00;
679
+ }
680
+ #ctc_main .dashicons-before.updated:before {
681
+ color:#46B450;
682
+ content: "\f147";
683
+ }
684
+
685
+ /* big buttons that are hard to miss */
686
+
687
+ .wp-core-ui .button-primary, .wp-core-ui .button-secondary {
688
+ border-color: none;
689
+ text-shadow: none;
690
+ font-size: 1.3em;
691
+ line-height: 1.3;
692
+ height: auto;
693
+ margin: 0;
694
+ padding: .5em 1em;
695
+ border: none;
696
+ -webkit-border-radius: 3px;
697
+ border-radius: 3px;
698
+ }
699
 
700
  /***
701
  Spectrum Colorpicker v1.7.0
includes/class-ctc-admin.php ADDED
@@ -0,0 +1,2084 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Exit if accessed directly
3
+ if ( !defined( 'ABSPATH' ) ) exit;
4
+
5
+ /*
6
+ Class: Child_Theme_Configurator
7
+ Plugin URI: http://www.childthemeconfigurator.com/
8
+ Description: Main Controller Class
9
+ Version: 2.0.0
10
+ Author: Lilaea Media
11
+ Author URI: http://www.lilaeamedia.com/
12
+ Text Domain: child-theme-configurator
13
+ Domain Path: /lang
14
+ License: GPLv2
15
+ Copyright (C) 2014-2015 Lilaea Media
16
+ */
17
+ class ChildThemeConfiguratorAdmin {
18
+
19
+ // state
20
+ var $reset;
21
+ var $genesis;
22
+ var $reorder;
23
+ var $processdone;
24
+ var $childtype;
25
+ var $template;
26
+ var $is_ajax;
27
+ var $is_get;
28
+ var $is_post;
29
+ var $skip_form;
30
+ var $fs;
31
+ var $encoding;
32
+
33
+ var $fs_prompt;
34
+ var $fs_method;
35
+ var $uploadsubdir;
36
+ var $menuName; // backward compatibility with plugin extension
37
+ var $cache_updates = TRUE;
38
+ var $debug;
39
+ var $is_debug = 0;
40
+ // memory checks
41
+ var $max_sel;
42
+ var $sel_limit;
43
+ var $mem_limit;
44
+ // state arrays
45
+ var $themes = array();
46
+ var $errors = array();
47
+ var $files = array();
48
+ var $updates = array();
49
+ var $memory = array();
50
+ // objects
51
+ var $css;
52
+ var $ui;
53
+ // config arrays
54
+ var $postarrays = array(
55
+ 'ctc_img',
56
+ 'ctc_file_parnt',
57
+ 'ctc_file_child',
58
+ 'ctc_additional_css',
59
+ );
60
+ var $configfields = array(
61
+ 'theme_parnt',
62
+ 'child_type',
63
+ 'theme_child',
64
+ 'child_template',
65
+ 'child_name',
66
+ 'child_themeuri',
67
+ 'child_author',
68
+ 'child_authoruri',
69
+ 'child_descr',
70
+ 'child_tags',
71
+ 'child_version',
72
+ 'repairheader',
73
+ 'ignoreparnt',
74
+ 'handling',
75
+ 'enqueue',
76
+ 'configtype', // backward compatability - no longer used
77
+ );
78
+ var $actionfields = array(
79
+ 'load_styles',
80
+ 'parnt_templates_submit',
81
+ 'child_templates_submit',
82
+ 'image_submit',
83
+ 'theme_image_submit',
84
+ 'theme_screenshot_submit',
85
+ 'export_child_zip',
86
+ 'reset_permission',
87
+ 'templates_writable_submit',
88
+ 'set_writable',
89
+ 'upgrade',
90
+ );
91
+ var $imgmimes = array(
92
+ 'jpg|jpeg|jpe' => 'image/jpeg',
93
+ 'gif' => 'image/gif',
94
+ 'png' => 'image/png',
95
+ );
96
+
97
+ function __construct() {
98
+ $this->processdone = FALSE;
99
+ $this->reset = FALSE;
100
+ $this->genesis = FALSE;
101
+ $this->reorder = FALSE;
102
+ $this->encoding = WP_Http_Encoding::is_available();
103
+ $this->menuName = CHLD_THM_CFG_MENU; // backward compatability for plugins extension
104
+ $this->is_post = ( 'POST' == $_SERVER[ 'REQUEST_METHOD' ] );
105
+ $this->is_get = ( 'GET' == $_SERVER[ 'REQUEST_METHOD' ] );
106
+ $this->is_debug = get_option( CHLD_THM_CFG_OPTIONS . '_debug' );
107
+ if ( $this->is_debug )
108
+ $this->debug = get_site_transient( CHLD_THM_CFG_OPTIONS . '_debug' );
109
+ }
110
+
111
+ /**
112
+ * initialize configurator
113
+ */
114
+ function ctc_page_init () {
115
+ // get all available themes
116
+ $this->get_themes();
117
+ // load config data and validate
118
+ $this->load_config();
119
+ // perform any checks prior to processing config data
120
+ do_action( 'chld_thm_cfg_preprocess' );
121
+ // process any additional forms
122
+ do_action( 'chld_thm_cfg_forms', $this ); // hook for custom forms
123
+ // process main post data
124
+ $this->process_post();
125
+ // initialize UI
126
+ include_once( CHLD_THM_CFG_DIR . '/includes/class-ctc-ui.php' );
127
+ $this->ui = new ChildThemeConfiguratorUI();
128
+ // initialize help
129
+ $this->ui->render_help_content();
130
+ }
131
+
132
+ function render() {
133
+ $this->ui->render();
134
+ }
135
+
136
+ /* helper function to retreive css object properties */
137
+ function get( $property, $params = NULL ) {
138
+ return $this->css->get_prop( $property, $params );
139
+ }
140
+
141
+ function get_themes() {
142
+ // create cache of theme info
143
+ $this->themes = array( 'child' => array(), 'parnt' => array() );
144
+ foreach ( wp_get_themes() as $theme ):
145
+ // organize into parent and child themes
146
+ $group = $theme->parent() ? 'child' : 'parnt';
147
+ // get the theme slug
148
+ $slug = $theme->get_stylesheet();
149
+ // get the theme slug
150
+ $version = $theme->get( 'Version' );
151
+ // strip auto-generated timestamp from CTC child theme version
152
+ if ( 'child' == $group ) $version = preg_replace("/\.\d{6}\d+$/", '', $version );
153
+ // add theme to themes array
154
+ $this->themes[ $group ][ $slug ] = array(
155
+ 'Template' => $theme->get( 'Template' ),
156
+ 'Name' => $theme->get( 'Name' ),
157
+ 'ThemeURI' => $theme->get( 'ThemeURI' ),
158
+ 'Author' => $theme->get( 'Author' ),
159
+ 'AuthorURI' => $theme->get( 'AuthorURI' ),
160
+ 'Descr' => $theme->get( 'Description' ),
161
+ 'Tags' => $theme->get( 'Tags' ),
162
+ 'Version' => $version,
163
+ 'screenshot' => $theme->get_screenshot(),
164
+ 'allowed' => $theme->is_allowed(),
165
+ );
166
+ endforeach;
167
+ }
168
+
169
+ function validate_post( $action = 'ctc_update', $noncefield = '_wpnonce', $cap = 'install_themes' ) {
170
+ // security: request must be post, user must have permission, referrer must be local and nonce must match
171
+ return ( $this->is_post
172
+ && current_user_can( $cap ) // ( 'edit_themes' )
173
+ && ( $this->is_ajax ? check_ajax_referer( $action, $noncefield, FALSE ) :
174
+ check_admin_referer( $action, $noncefield, FALSE ) ) );
175
+ }
176
+
177
+ function load_config() {
178
+ include_once( CHLD_THM_CFG_DIR . '/includes/class-ctc-css.php' );
179
+ $this->css = new ChildThemeConfiguratorCSS();
180
+ if ( FALSE !== $this->css->load_config() ):
181
+ $this->debug( 'config exists', __FUNCTION__ );
182
+ // if themes do not exist reinitialize
183
+ if ( ! $this->check_theme_exists( $this->get( 'child' ) )
184
+ || ! $this->check_theme_exists( $this->get( 'parnt' ) ) ):
185
+ $this->debug( 'theme does not exist', __FUNCTION__ );
186
+ add_action( 'admin_notices', array( $this, 'config_notice' ) );
187
+ $this->css = new ChildThemeConfiguratorCSS();
188
+ $this->css->enqueue = 'enqueue';
189
+ endif;
190
+ else:
191
+ $this->debug( 'config does not exist', __FUNCTION__ );
192
+ // this is a fresh install
193
+ $this->css->enqueue = 'enqueue';
194
+ endif;
195
+ do_action( 'chld_thm_cfg_load' );
196
+ if ( $this->is_get ):
197
+ if ( $this->get( 'child' ) ):
198
+ // get filesystem credentials if available
199
+ $this->verify_creds();
200
+ $stylesheet = apply_filters(
201
+ 'chld_thm_cfg_target',
202
+ $this->css->get_child_target( $this->get_child_stylesheet() ),
203
+ $this->css );
204
+ // check file permissions
205
+ if ( !is_writable( $stylesheet ) && !$this->fs )
206
+ add_action( 'admin_notices', array( $this, 'writable_notice' ) );
207
+ if ( $fsize = $this->get( 'fsize' ) ):
208
+ $test = filesize( $stylesheet );
209
+ $this->debug( 'filesize saved: ' . $fsize . ' current: ' . $test, __FUNCTION__ );
210
+ if ( $test != $fsize )
211
+ add_action( 'admin_notices', array( $this, 'changed_notice' ) );
212
+ endif;
213
+ // enqueue flag will be null for existing install < 1.6.0
214
+ if ( !$this->get( 'enqueue' ) ):
215
+ $this->debug( 'no enqueue:', __FUNCTION__ );
216
+
217
+ add_action( 'admin_notices', array( $this, 'enqueue_notice' ) );
218
+ endif;
219
+ endif;
220
+ if ( !$this->seen_upgrade_notice() ):
221
+ add_action( 'admin_notices', array( $this, 'upgrade_notice' ) );
222
+ endif;
223
+ /**
224
+ * Future use: check if max selectors reached
225
+ *
226
+ if ( $this->get( 'max_sel' ) ):
227
+ $this->debug( 'Max selectors exceeded.', __FUNCTION__ );
228
+ //$this->errors[] = __( 'Maximum number of styles exceeded.', 'child-theme-configurator' );
229
+ add_action( 'admin_notices', array( $this, 'max_styles_notice' ) );
230
+ endif;
231
+ */
232
+ // check if file ownership is messed up from old version or other plugin
233
+ // by comparing owner of plugin to owner of child theme:
234
+ if ( fileowner( $this->css->get_child_target( '' ) ) != fileowner( CHLD_THM_CFG_DIR ) )
235
+ add_action( 'admin_notices', array( $this, 'owner_notice' ) );
236
+ endif;
237
+ }
238
+
239
+ function cache_debug() {
240
+ $this->updates[] = array(
241
+ 'obj' => 'debug',
242
+ 'key' => '',
243
+ 'data' => $this->print_debug( TRUE ),
244
+ );
245
+ }
246
+ /**
247
+ * ajax callback for saving form data
248
+ */
249
+ function ajax_save_postdata( $action = 'ctc_update' ) {
250
+ $this->is_ajax = TRUE;
251
+
252
+ // security check
253
+ if ( $this->validate_post( $action ) ):
254
+ if ( 'ctc_plugin' == $action ) do_action( 'chld_thm_cfg_pluginmode' );
255
+ $this->verify_creds(); // initialize filesystem access
256
+ // get configuration data from options API
257
+ if ( FALSE !== $this->load_config() ): // sanity check: only update if config data exists
258
+ if ( isset( $_POST[ 'ctc_is_debug' ] ) ):
259
+ // toggle debug
260
+ $this->toggle_debug();
261
+ else:
262
+ $this->css->parse_post_data(); // parse any passed values
263
+ // if child theme config has been set up, save new data
264
+ // return recent edits and selected stylesheets as cache updates
265
+ if ( $this->get( 'child' ) ):
266
+ // hook for add'l plugin files and subdirectories
267
+ do_action( 'chld_thm_cfg_addl_files', $this );
268
+ $this->css->write_css();
269
+ // add any additional updates to pass back to browser
270
+ do_action( 'chld_thm_cfg_cache_updates' );
271
+ /*
272
+ $this->updates[] = array(
273
+ 'obj' => 'addl_css',
274
+ 'key' => '',
275
+ 'data' => $this->get( 'addl_css' ),
276
+ );
277
+ */
278
+ endif;
279
+
280
+ // update config data in options API
281
+ $this->save_config();
282
+ endif;
283
+ endif;
284
+ endif;
285
+ $result = $this->css->obj_to_utf8( $this->updates );
286
+ // send all updates back to browser to update cache
287
+ die( json_encode( $result ) );
288
+ }
289
+
290
+ function save_config() {
291
+ // update config data in options API
292
+ $this->css->save_config();
293
+ }
294
+
295
+ /**
296
+ * ajax callback to query config data
297
+ */
298
+ function ajax_query_css( $action = 'ctc_update' ) {
299
+ $this->is_ajax = TRUE;
300
+ if ( $this->validate_post( $action ) ):
301
+ if ( 'ctc_plugin' == $action ) do_action( 'chld_thm_cfg_pluginmode' );
302
+ $this->load_config();
303
+ $regex = "/^ctc_query_/";
304
+ foreach( preg_grep( $regex, array_keys( $_POST ) ) as $key ):
305
+ $name = preg_replace( $regex, '', $key );
306
+ $param[ $name ] = sanitize_text_field( $_POST[ $key ] );
307
+ endforeach;
308
+ if ( !empty( $param[ 'obj' ] ) ):
309
+ // add any additional updates to pass back to browser
310
+ $this->updates[] = array(
311
+ 'key' => isset( $param[ 'key' ] ) ? $param[ 'key' ] : '',
312
+ 'obj' => $param[ 'obj' ],
313
+ 'data' => $this->get( $param[ 'obj' ], $param ),
314
+ );
315
+ do_action( 'chld_thm_cfg_cache_updates' );
316
+ die( json_encode( $this->updates ) );
317
+ endif;
318
+ endif;
319
+ die( 0 );
320
+ }
321
+
322
+ /**
323
+ * check if user has been notified about upgrade
324
+ */
325
+ function seen_upgrade_notice() {
326
+ $seen_upgrade_version = get_user_meta( get_current_user_id(), 'chld_thm_cfg_upgrade_notice', TRUE );
327
+ return version_compare( $seen_upgrade_version, CHLD_THM_CFG_PREV_VERSION, '>=' );
328
+ }
329
+
330
+ /**
331
+ * ajax callback to dismiss upgrade notice
332
+ */
333
+ function ajax_dismiss_notice( $action = 'ctc_update' ) {
334
+ $this->is_ajax = TRUE;
335
+ if ( $this->validate_post( $action ) ):
336
+ update_user_meta( get_current_user_id(), 'chld_thm_cfg_upgrade_notice' , CHLD_THM_CFG_VERSION );
337
+ $this->updates[] = array(
338
+ 'key' => '',
339
+ 'obj' => 'dismiss',
340
+ 'data' => CHLD_THM_CFG_VERSION,
341
+ );
342
+ die( json_encode( $this->updates ) );
343
+ endif;
344
+ die( 0 );
345
+ }
346
+
347
+ /**
348
+ * Handles processing for all form submissions.
349
+ * Older versions ( < 1.6.0 ) smelled like spaghetti so we moved conditions
350
+ * to switch statement with the main setup logic in a separate function.
351
+ */
352
+ function process_post() {
353
+ // make sure this is a post
354
+ if ( $this->is_post ):
355
+ // see if a valid action was passed
356
+ foreach ( $this->actionfields as $field ):
357
+ if ( in_array( 'ctc_' . $field, array_keys( $_POST ) ) ):
358
+ $actionfield = $field;
359
+ break;
360
+ endif;
361
+ endforeach;
362
+ if ( empty( $actionfield ) ) return FALSE;
363
+
364
+ // make sure post passes security checkpoint
365
+ $this->errors = array();
366
+ if ( $this->validate_post( apply_filters( 'chld_thm_cfg_action', 'ctc_update' ) ) ):
367
+ // reset debug log
368
+ delete_site_transient( CHLD_THM_CFG_OPTIONS . '_debug' );
369
+ // zip export does not require filesystem access so check that first
370
+ if ( 'export_child_zip' == $actionfield ):
371
+ $this->export_zip();
372
+ // if we get here the zip failed
373
+ $this->errors[] = __( 'Zip file creation failed.', 'child-theme-configurator' );
374
+ // all other actions require filesystem access
375
+ else:
376
+ // handle uploaded file before checking filesystem
377
+ if ( 'theme_image_submit' == $actionfield && isset( $_FILES[ 'ctc_theme_image' ] ) ):
378
+ $this->handle_file_upload( 'ctc_theme_image', $this->imgmimes );
379
+ elseif ( 'theme_screenshot_submit' == $actionfield && isset( $_FILES[ 'ctc_theme_screenshot' ] ) ):
380
+ $this->handle_file_upload( 'ctc_theme_screenshot', $this->imgmimes );
381
+ endif;
382
+ // now we need to check filesystem access
383
+ $args = preg_grep( "/nonce/", array_keys( $_POST ), PREG_GREP_INVERT );
384
+ $this->verify_creds( $args );
385
+ if ( $this->fs ):
386
+ $msg = FALSE;
387
+ // we have filesystem access so proceed with specific actions
388
+ switch( $actionfield ):
389
+ case 'load_styles':
390
+ // main child theme setup function
391
+ $msg = $this->setup_child_theme();
392
+ break;
393
+
394
+ case 'parnt_templates_submit':
395
+ // copy parent templates to child
396
+ if ( isset( $_POST[ 'ctc_file_parnt' ] ) ):
397
+ foreach ( $_POST[ 'ctc_file_parnt' ] as $file ):
398
+ $this->copy_parent_file( sanitize_text_field( $file ) );
399
+ endforeach;
400
+ $msg = '8&tab=file_options';
401
+ endif;
402
+ break;
403
+
404
+ case 'child_templates_submit':
405
+ // delete child theme files
406
+ if ( isset( $_POST[ 'ctc_file_child' ] ) ):
407
+ if ( in_array( 'functions', $_POST[ 'ctc_file_child' ] ) ):
408
+ $this->errors[] =
409
+ __( 'The Functions file is required and cannot be deleted.', 'child-theme-configurator' );
410
+ else:
411
+ foreach ( $_POST[ 'ctc_file_child' ] as $file ):
412
+ $this->delete_child_file( sanitize_text_field( $file ),
413
+ ( preg_match( "/^style|ctc\-plugins/", $file ) ? 'css' : 'php' ) );
414
+ endforeach;
415
+ $msg = '8&tab=file_options';
416
+ endif;
417
+ endif;
418
+ break;
419
+
420
+ case 'image_submit':
421
+ // delete child theme images
422
+ if ( isset( $_POST[ 'ctc_img' ] ) ):
423
+ foreach ( $_POST[ 'ctc_img' ] as $file ):
424
+ $this->delete_child_file( 'images/' . sanitize_text_field( $file ), 'img' );
425
+ endforeach;
426
+ $msg = '8&tab=file_options';
427
+ endif;
428
+ break;
429
+
430
+ case 'templates_writable_submit':
431
+ // make specific files writable ( systems not running suExec )
432
+ if ( isset( $_POST[ 'ctc_file_child' ] ) ):
433
+ foreach ( $_POST[ 'ctc_file_child' ] as $file ):
434
+ $this->set_writable( sanitize_text_field( $file ),
435
+ ( 0 === strpos( $file, 'style' ) ? 'css' : 'php' ) );
436
+ endforeach;
437
+ $msg = '8&tab=file_options';
438
+ endif;
439
+ break;
440
+
441
+ case 'set_writable':
442
+ // make child theme style.css and functions.php writable ( systems not running suExec )
443
+ $this->set_writable(); // no argument defaults to style.css
444
+ $this->set_writable( 'functions' );
445
+ $msg = '8&tab=file_options';
446
+ break;
447
+
448
+ case 'reset_permission':
449
+ // make child theme read-only ( systems not running suExec )
450
+ $this->unset_writable();
451
+ $msg = '8&tab=file_options';
452
+ break;
453
+
454
+ case 'theme_image_submit':
455
+ // move uploaded child theme images (now we have filesystem access)
456
+ if ( isset( $_POST[ 'movefile' ] ) ):
457
+ $this->move_file_upload( 'images' );
458
+ $msg = '8&tab=file_options';
459
+ endif;
460
+ break;
461
+
462
+ case 'theme_screenshot_submit':
463
+ // move uploaded child theme screenshot (now we have filesystem access)
464
+ if ( isset( $_POST[ 'movefile' ] ) ):
465
+ // remove old screenshot
466
+ foreach( array_keys( $this->imgmimes ) as $extreg ):
467
+ foreach ( explode( '|', $extreg ) as $ext ):
468
+ $this->delete_child_file( 'screenshot', $ext );
469
+ endforeach;
470
+ endforeach;
471
+ $this->move_file_upload( '' );
472
+ $msg = '8&tab=file_options';
473
+ endif;
474
+ break;
475
+ default:
476
+ // assume we are on the files tab so just redirect there
477
+ $msg = '8&tab=file_options';
478
+ endswitch;
479
+ endif; // end filesystem condition
480
+ endif; // end zip export condition
481
+ if ( empty( $this->errors ) && empty( $this->fs_prompt ) ):
482
+ $this->processdone = TRUE;
483
+ //die( '<pre><code><small>' . print_r( $_POST, TRUE ) . '</small></code></pre>' );
484
+ // no errors so we redirect with confirmation message
485
+ $this->update_redirect( $msg );
486
+ endif;
487
+ // otherwise fail gracefully
488
+ $msg = NULL;
489
+ return FALSE;
490
+ endif; // end post validation condition
491
+ // if you end up here you are persona non grata
492
+ $msg = NULL;
493
+ $this->errors[] = __( 'You do not have permission to configure child themes.', 'child-theme-configurator' );
494
+ endif; // end request method condition
495
+ return FALSE;
496
+ }
497
+
498
+ /**
499
+ * Handle the creation or update of a child theme
500
+ */
501
+ function setup_child_theme() {
502
+ $msg = 1;
503
+ // sanitize and extract config fields into local vars
504
+ foreach ( $this->configfields as $configfield ):
505
+ $varparts = explode( '_', $configfield );
506
+ $varname = end( $varparts );
507
+ ${$varname} = empty( $_POST[ 'ctc_' . $configfield ] ) ? '' :
508
+ preg_replace( "/\s+/s", ' ', sanitize_text_field( $_POST[ 'ctc_' . $configfield ] ) );
509
+ $this->debug( 'Extracting var ' . $varname . ' from ctc_' . $configfield . ' value: ' . ${$varname} , __FUNCTION__ );
510
+ endforeach;
511
+ // legacy plugin extension needs parent/new values but this version disables the inputs
512
+ // so get we them from current css object
513
+ if ( !$this->is_theme( $configtype ) && $this->is_legacy() ):
514
+ $parnt = $this->get( 'parnt' );
515
+ $child = $this->get( 'child' );
516
+ $name = $this->get( 'child_name' );
517
+ endif;
518
+ // validate parent and child theme inputs
519
+ if ( $parnt ):
520
+ if ( ! $this->check_theme_exists( $parnt ) ):
521
+ $this->errors[] = sprintf(
522
+ __( '%s does not exist. Please select a valid Parent Theme.', 'child-theme-configurator' ), $parnt );
523
+ endif;
524
+ else:
525
+ $this->errors[] = __( 'Please select a valid Parent Theme.', 'child-theme-configurator' );
526
+ endif;
527
+
528
+ // if this is reset, duplicate or existing, we must have a child theme
529
+ if ( 'new' != $type && empty( $child ) ):
530
+ $this->errors[] = __( 'Please select a valid Child Theme.', 'child-theme-configurator' );
531
+ // if this is a new or duplicate child theme we must validate child theme directory
532
+ elseif ( 'new' == $type || 'duplicate' == $type ):
533
+ if ( empty( $template ) && empty( $name ) ):
534
+ $this->errors[] = __( 'Please enter a valid Child Theme directory name.', 'child-theme-configurator' );
535
+ else:
536
+ $template_sanitized = preg_replace( "%[^\w\-]%", '', empty( $template ) ? $name : $template );
537
+ if ( $this->check_theme_exists( $template_sanitized ) ):
538
+ $this->errors[] = sprintf(
539
+ __( '<strong>%s</strong> exists. Please enter a different Child Theme template name.', 'child-theme-configurator' ), $template_sanitized );
540
+ elseif ( 'duplicate' == $type ):
541
+ // clone existing child theme
542
+ $this->clone_child_theme( $child, $template_sanitized );
543
+ if ( !empty( $this->errors ) ) return FALSE;
544
+ // if no errors, copy menus, widgets and customizer options
545
+ $this->copy_theme_mods( $child, $template_sanitized );
546
+ $msg = 3;
547
+ else:
548
+ $msg = 2;
549
+ endif;
550
+ $child = $template_sanitized;
551
+ endif;
552
+
553
+ endif;
554
+
555
+ // verify_child_dir creates child theme directory if it doesn't exist.
556
+ if ( FALSE === $this->verify_child_dir( $child ) ):
557
+ // if it returns false then it could not create directory.
558
+ $this->errors[] = __( 'Your theme directories are not writable.', 'child-theme-configurator' );
559
+ add_action( 'admin_notices', array( $this, 'writable_notice' ) );
560
+ return FALSE;
561
+ endif;
562
+
563
+ // load or reset config
564
+ if ( 'reset' == $type ):
565
+ $this->reset = TRUE;
566
+ $this->debug( 'resetting child theme', __FUNCTION__ );
567
+ $this->reset_child_theme();
568
+ $this->enqueue_parent_css( $this );
569
+ $msg = 4;
570
+ else:
571
+
572
+ // if any errors, bail before we create css object
573
+ if ( !empty( $this->errors ) ) return FALSE;
574
+
575
+ // if no name is passed, create one from the child theme directory
576
+ if ( empty( $name ) ):
577
+ $name = ucfirst( $child );
578
+ endif;
579
+
580
+ /**
581
+ * before we configure the child theme we need to check if this is a rebuild
582
+ * and compare some of the original settings to the new settings.
583
+ */
584
+ //$oldchild = $this->get( 'child' );
585
+ //$oldimports = $this->get( 'imports' );
586
+ //$oldenqueue = $this->get( 'enqueue' );
587
+ $oldhandling = $this->get( 'handling' );
588
+ // reset everything else
589
+ $this->css = new ChildThemeConfiguratorCSS();
590
+ // restore imports if this is a rebuild
591
+ //$this->css->imports[ 'child' ] = $oldimports;
592
+
593
+ // update with new parameters
594
+ if ( !$this->is_theme( $configtype ) )
595
+ $this->css->set_prop( 'enqueue', 'enqueue' );
596
+ else
597
+ $this->css->set_prop( 'enqueue', $enqueue );
598
+ $this->css->set_prop( 'handling', $handling );
599
+ $this->css->set_prop( 'ignoreparnt', $ignoreparnt );
600
+
601
+ $this->css->set_prop( 'parnt', $parnt );
602
+ $this->css->set_prop( 'child', $child );
603
+ $this->css->set_prop( 'child_name', $name );
604
+ $this->css->set_prop( 'child_author', $author );
605
+ $this->css->set_prop( 'child_themeuri', $themeuri );
606
+ $this->css->set_prop( 'child_authoruri', $authoruri );
607
+ $this->css->set_prop( 'child_descr', $descr );
608
+ $this->css->set_prop( 'child_tags', $tags );
609
+ $this->css->set_prop( 'child_version', strlen( $version ) ? $version : '1.0' );
610
+
611
+ if ( isset( $_POST[ 'ctc_action' ] ) && 'plugin' == $_POST[ 'ctc_action' ] ):
612
+ // this is for PRO plugins
613
+ $this->css->addl_css = array();
614
+ if ( isset( $_POST[ 'ctc_additional_css' ] ) && is_array( $_POST[ 'ctc_additional_css' ] ) ):
615
+ foreach ( $_POST[ 'ctc_additional_css' ] as $file )
616
+ $this->css->addl_css[] = sanitize_text_field( $file );
617
+ endif;
618
+ add_action( 'chld_thm_cfg_parse_stylesheets', array( &$this, 'parse_child_stylesheet_to_target' ) );
619
+ elseif ( isset( $_POST[ 'ctc_analysis' ] ) ):
620
+ // this is for themes
621
+ $this->evaluate_signals();
622
+ endif;
623
+ // roll back CTC Pro Genesis handling option
624
+ if ( $this->genesis ):
625
+ $handling = 'separate';
626
+ $enqueue = 'none';
627
+ $ignoreparnt = TRUE;
628
+ if ( $this->backup_or_restore_file( 'ctc-style.css', TRUE, 'style.css' ) &&
629
+ $this->backup_or_restore_file( 'style.css', TRUE, 'ctc-genesis.css' ) ):
630
+ $this->delete_child_file( 'ctc-genesis', 'css' );
631
+ else:
632
+ $this->errors[] = __( 'Could not upgrade child theme', 'child-theme-configurator' );
633
+ endif;
634
+ endif;
635
+
636
+ // if any errors, bail before we set action hooks or write to filesystem
637
+ if ( !empty( $this->errors ) ) return FALSE;
638
+
639
+ // override enqueue action for parent theme if it is already being loaded
640
+ if ( 'enqueue' == $enqueue && ( $this->get( 'parntloaded' ) || !$this->get( 'hasstyles' ) || $ignoreparnt ) ) $enqueue = 'none';
641
+
642
+ // parse parent stylesheet if theme or legacy plugin extension
643
+ if ( $this->is_theme( $configtype ) || $this->is_legacy() ):
644
+ // do we parse parent stylesheet?
645
+
646
+ if ( $this->get( 'hasstyles' ) && !$ignoreparnt ):
647
+ $this->debug( 'Adding action: parse_parent_stylesheet_to_source', __FUNCTION__ );
648
+ add_action( 'chld_thm_cfg_parse_stylesheets', array( &$this, 'parse_parent_stylesheet_to_source' ) );
649
+ endif;
650
+
651
+ // automatically network enable new theme // FIXME: shouldn't this be an option?
652
+ if ( is_multisite() )
653
+ add_action( 'chld_thm_cfg_addl_options', array( &$this, 'network_enable' ) );
654
+ endif;
655
+ $this->debug( 'Adding action: parse_additional_stylesheets_to_source', __FUNCTION__ );
656
+ add_action( 'chld_thm_cfg_parse_stylesheets', array( &$this, 'parse_additional_stylesheets_to_source' ) );
657
+
658
+ if ( 'separate' == $handling ):
659
+ // parse child theme style.css into source config
660
+ $this->debug( 'Adding action: parse_child_stylesheet_to_source', __FUNCTION__ );
661
+ add_action( 'chld_thm_cfg_parse_stylesheets', array( &$this, 'parse_child_stylesheet_to_source' ) );
662
+ // parse child theme ctc-style.css into target config
663
+ $this->debug( 'Adding action: parse_custom_stylesheet_to_target', __FUNCTION__ );
664
+ add_action( 'chld_thm_cfg_parse_stylesheets', array( &$this, 'parse_custom_stylesheet_to_target' ) );
665
+ elseif ( 'primary' == $handling ):
666
+ // parse child theme style.css into target config
667
+ $this->debug( 'Adding action: parse_child_stylesheet_to_target', __FUNCTION__ );
668
+ add_action( 'chld_thm_cfg_parse_stylesheets', array( &$this, 'parse_child_stylesheet_to_target' ) );
669
+ if ( $oldhandling != $handling ):
670
+ $this->debug( 'Adding action: parse_custom_stylesheet_to_target', __FUNCTION__ );
671
+ add_action( 'chld_thm_cfg_parse_stylesheets', array( &$this, 'parse_custom_stylesheet_to_target' ) );
672
+ endif;
673
+ endif;
674
+
675
+ // function to support wp_filesystem requirements
676
+ if ( $this->is_theme( $configtype ) ):
677
+ // is theme means this is not a plugin stylesheet config
678
+ add_action( 'chld_thm_cfg_addl_files', array( &$this, 'add_base_files' ), 10, 2 );
679
+ add_action( 'chld_thm_cfg_addl_files', array( &$this, 'copy_screenshot' ), 10, 2 );
680
+ add_action( 'chld_thm_cfg_addl_files', array( &$this, 'enqueue_parent_css' ), 15, 2 );
681
+ if ( $repairheader && 'reset' != $type ):
682
+ add_action( 'chld_thm_cfg_addl_files', array( &$this, 'repair_header' ) );
683
+ endif;
684
+
685
+ // legacy -- do we still need???
686
+ elseif( $this->is_legacy() && has_action( 'chld_thm_cfg_addl_files' ) ):
687
+ // backwards compatability for plugins extension < 2.0.0 (before pro)
688
+ // action exists so we have to hijack it to use new filesystem checks
689
+ remove_all_actions( 'chld_thm_cfg_addl_files' );
690
+ add_action( 'chld_thm_cfg_addl_files', array( &$this, 'write_addl_files' ), 10, 2 );
691
+ $this->css->set_prop( 'configtype', $configtype );
692
+ endif;
693
+
694
+ // plugin hooks for additional stylesheet handling options
695
+ // do_action( 'chld_thm_cfg_stylesheet_handling' );
696
+ // do_action( 'chld_thm_cfg_existing_theme' );
697
+
698
+ // plugin hook to parse additional or non-standard files
699
+ do_action( 'chld_thm_cfg_parse_stylesheets' );
700
+
701
+ // copy menus, widgets and other customizer options from parent to child if selected
702
+ if ( isset( $_POST[ 'ctc_parent_mods' ] ) && 'duplicate' != $type )
703
+ $this->copy_theme_mods( $parnt, $child );
704
+ // run code generation function in read-only mode to add existing external stylesheet links to config data
705
+ $this->enqueue_parent_css( $this->css, TRUE );
706
+ // hook for add'l plugin files and subdirectories. Must run after stylesheets are parsed to apply latest options
707
+ do_action( 'chld_thm_cfg_addl_files', $this );
708
+ // do not continue if errors
709
+ if ( !empty ( $this->errors ) ) return FALSE;
710
+ //echo ' no errors! saving...' . LF;
711
+ if ( 'separate' == $handling ):
712
+ $this->debug( 'Writing new stylesheet header...', __FUNCTION__ );
713
+ $this->rewrite_stylesheet_header();
714
+ endif;
715
+ // set flag to skip import link conversion on ajax save
716
+ $this->css->set_prop( 'converted', 1 );
717
+
718
+ // try to write new stylsheet. If it fails send alert.
719
+ $this->debug( 'Writing new CSS...', __FUNCTION__ );
720
+ if ( FALSE === $this->css->write_css() ):
721
+ //$this->debug( print_r( debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS ), TRUE ), __FUNCTION__ );
722
+ $this->errors[] = __( 'Your stylesheet is not writable.', 'child-theme-configurator' );
723
+ add_action( 'admin_notices', array( $this, 'writable_notice' ) );
724
+ return FALSE;
725
+ endif;
726
+ // get files to reload templates in new css object
727
+ $this->get_files( $parnt );
728
+ endif;
729
+ $this->debug( 'Saving new config...', __FUNCTION__ );
730
+ // save new object to WP options table
731
+ $this->save_config();
732
+ $this->debug( 'Firing additional options action...', __FUNCTION__ );
733
+ // plugin hook for additional child theme setup functions
734
+ do_action( 'chld_thm_cfg_addl_options', $this );
735
+
736
+ // return message id 1, which says new child theme created successfully;
737
+ return $msg;
738
+ }
739
+
740
+ /*
741
+ * TODO: this is a stub for future use
742
+ */
743
+ function sanitize_options( $input ) {
744
+ return $input;
745
+ }
746
+
747
+ /**
748
+ * remove slashes and non-alphas from stylesheet name
749
+ */
750
+ function sanitize_slug( $slug ) {
751
+ return preg_replace( "/[^\w\-]/", '', $slug );
752
+ }
753
+
754
+ function update_redirect( $msg = 1 ) {
755
+ if ( empty( $this->is_ajax ) ):
756
+ $ctcpage = apply_filters( 'chld_thm_cfg_admin_page', CHLD_THM_CFG_MENU );
757
+ $screen = get_current_screen()->id;
758
+ wp_safe_redirect(
759
+ ( strstr( $screen, '-network' ) ? network_admin_url( 'themes.php' ) : admin_url( 'tools.php' ) )
760
+ . '?page=' . $ctcpage . ( $msg ? '&updated=' . $msg : '' ) );
761
+ die();
762
+ endif;
763
+ }
764
+
765
+ function verify_child_dir( $path ) {
766
+ $this->debug( 'Verifying child dir: ' . $path, __FUNCTION__ );
767
+ if ( !$this->fs ):
768
+ $this->debug( 'No filesystem access.', __FUNCTION__ );
769
+ return FALSE; // return if no filesystem access
770
+ endif;
771
+ global $wp_filesystem;
772
+ $themedir = $wp_filesystem->find_folder( get_theme_root() );
773
+ if ( ! $wp_filesystem->is_writable( $themedir ) ):
774
+ $this->debug( 'Directory not writable: ' . $themedir, __FUNCTION__ );
775
+ return FALSE;
776
+ endif;
777
+ $childparts = explode( '/', $this->normalize_path( $path ) );
778
+ while ( count( $childparts ) ):
779
+ $subdir = array_shift( $childparts );
780
+ if ( empty( $subdir ) ) continue;
781
+ $themedir = trailingslashit( $themedir ) . $subdir;
782
+ if ( ! $wp_filesystem->is_dir( $themedir ) ):
783
+ if ( ! $wp_filesystem->mkdir( $themedir, FS_CHMOD_DIR ) ):
784
+ $this->debug( 'Could not make directory: ' . $themedir, __FUNCTION__ );
785
+ return FALSE;
786
+ endif;
787
+ elseif ( ! $wp_filesystem->is_writable( $themedir ) ):
788
+ $this->debug( 'Directory not writable: ' . $themedir, __FUNCTION__ );
789
+ return FALSE;
790
+ endif;
791
+ endwhile;
792
+ $this->debug( 'Child dir verified: ' . $themedir, __FUNCTION__ );
793
+ return TRUE;
794
+ }
795
+
796
+ function add_base_files( $obj ){
797
+ //$this->debug( LF . LF, __FUNCTION__ );
798
+ // add functions.php file
799
+ $contents = "<?php
800
+ // Exit if accessed directly
801
+ if ( !defined( 'ABSPATH' ) ) exit;
802
+ ";
803
+ $handling = $this->get( 'handling' );
804
+ $this->write_child_file( 'functions.php', $contents );
805
+ $this->backup_or_restore_file( 'style.css' );
806
+ $contents = $this->css->get_css_header_comment( $handling );
807
+ $this->debug( 'writing initial stylesheet header...' . LF . $contents, __FUNCTION__ );
808
+ $this->write_child_file( 'style.css', $contents );
809
+ if ( 'separate' == $handling ):
810
+ $this->backup_or_restore_file( 'ctc-style.css' );
811
+ $this->write_child_file( 'ctc-style.css', $contents . LF );
812
+ endif;
813
+ }
814
+
815
+ // parses @import syntax and converts to wp_enqueue_style statement
816
+ function convert_import_to_enqueue( $import, $count, $execute = FALSE ) {
817
+ $relpath = $this->get( 'child' );
818
+ $import = preg_replace( "#^.*?url\(([^\)]+?)\).*#", "$1", $import );
819
+ $import = preg_replace( "#[\'\"]#", '', $import );
820
+ $path = $this->css->convert_rel_url( trim( $import ), $relpath , FALSE );
821
+ $abs = preg_match( '%(https?:)?//%', $path );
822
+ if ( $execute )
823
+ wp_enqueue_style( 'chld_thm_cfg_ext' . $count, $abs ? $path : trailingslashit( get_theme_root_uri() ) . $path );
824
+ else
825
+ return "wp_enqueue_style( 'chld_thm_cfg_ext" . $count . "', "
826
+ . ( $abs ? "'" . $path . "'" : "trailingslashit( get_theme_root_uri() ) . '" . $path . "'" ) . ' );';
827
+ }
828
+
829
+ // converts enqueued path into @import statement for config settings
830
+ function convert_enqueue_to_import( $path ) {
831
+ if ( preg_match( '%(https?:)?//%', $path ) ):
832
+ $this->css->imports[ 'child' ]['@import url(' . $path . ')'] = 1;
833
+ return;
834
+ endif;
835
+ $regex = '#^' . preg_quote( trailingslashit( $this->get( 'child' ) ) ) . '#';
836
+ $path = preg_replace( $regex, '', $path, -1, $count );
837
+ if ( $count ):
838
+ $this->css->imports[ 'child' ]['@import url(' . $path . ')'] = 1;
839
+ return;
840
+ endif;
841
+ $parent = trailingslashit( $this->get( 'parnt' ) );
842
+ $regex = '#^' . preg_quote( $parent ) . '#';
843
+ $path = preg_replace( $regex, '../' . $parent, $path, -1, $count );
844
+ if ( $count )
845
+ $this->css->imports[ 'child' ]['@import url(' . $path . ')'] = 1;
846
+ }
847
+
848
+ /**
849
+ * Generates wp_enqueue_script code block for child theme functions file
850
+ * Enqueues parent and/or child stylesheet depending on value of 'enqueue' setting.
851
+ * If external imports are present, it enqueues them as well.
852
+ */
853
+ function enqueue_parent_code(){
854
+ //$this->debug( print_r( debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS ), TRUE ), __FUNCTION__ );
855
+ $imports = $this->get( 'imports' );
856
+ $enqueues = array();
857
+ $code = "// AUTO GENERATED - Do not modify or remove comment markers above or below:" . LF;
858
+ $deps = $this->get( 'parnt_deps' );
859
+ //echo '<h3>DEPS</h3><pre><code>' . print_r( $deps, TRUE ) . "</code></pre>\n";
860
+ $enq = $this->get( 'enqueue' );
861
+ $handling = $this->get( 'handling' );
862
+ $hasstyles = $this->get( 'hasstyles' );
863
+ $childloaded= $this->get( 'childloaded' );
864
+ $parntloaded= $this->get( 'parntloaded' );
865
+ $cssunreg = $this->get( 'cssunreg' );
866
+ $csswphead = $this->get( 'csswphead' );
867
+ $cssnotheme = $this->get( 'cssnotheme' );
868
+ $ignoreparnt= $this->get( 'ignoreparnt' );
869
+ $this->debug( 'deps: ' . print_r( $deps, TRUE ) . ' enq: ' . $enq . ' handling: ' . $handling
870
+ . ' hasstyles: ' . $hasstyles . ' parntloaded: ' . $parntloaded . ' childloaded: ' . $childloaded . ' ignoreparnt: ' . $ignoreparnt, __FUNCTION__ );
871
+ // enqueue parent stylesheet
872
+ if ( 'enqueue' == $enq && $hasstyles && !$parntloaded && !$ignoreparnt ):
873
+ $code .= "
874
+ if ( !function_exists( 'chld_thm_cfg_parent_css' ) ):
875
+ function chld_thm_cfg_parent_css() {
876
+ wp_enqueue_style( 'chld_thm_cfg_parent', trailingslashit( get_template_directory_uri() ) . 'style.css', array( " . implode( ',', $deps ) . " ) );
877
+ }
878
+ endif;
879
+ add_action( 'wp_enqueue_scripts', 'chld_thm_cfg_parent_css' );
880
+ ";
881
+ // if loading parent theme, reset deps and add parent stylesheet
882
+ $deps = array( "'chld_thm_cfg_parent'" );
883
+
884
+ // force a stylesheet dependency if parent is loading out of sequence
885
+ if ( $childloaded && $this->reorder ):
886
+ $code .= "
887
+ if ( !function_exists( 'chld_thm_cfg_add_parent_dep' ) ):
888
+ function chld_thm_cfg_add_parent_dep() {
889
+ global \$wp_styles;
890
+ array_unshift( \$wp_styles->registered[ '" . $childloaded . "' ]->deps, 'chld_thm_cfg_parent' );
891
+ }
892
+ endif;
893
+ add_action( 'wp_head', 'chld_thm_cfg_add_parent_dep', 2 );
894
+ ";
895
+ endif;
896
+ endif;
897
+ // enqueue external stylesheets (previously used @import in the stylesheet)
898
+ if ( !empty( $imports ) ):
899
+ $ext = 0;
900
+ foreach ( $imports as $import ):
901
+ if ( !empty( $import ) ):
902
+ $ext++;
903
+ $enqueues[] = ' ' . $this->convert_import_to_enqueue( $import, $ext );
904
+ endif;
905
+ endforeach;
906
+ endif;
907
+ // if child not loaded, enqueue it and add it to dependencies
908
+ if ( ( $csswphead || $cssunreg || $cssnotheme ) && 'separate' != $handling ): // FIXME: this test need help
909
+ $deps = array_merge( $deps, $this->get( 'child_deps' ) );
910
+ $enqueues[] = " wp_enqueue_style( 'chld_thm_cfg_child', trailingslashit( get_stylesheet_directory_uri() ) . 'style.css', array( " . implode( ',', $deps ) . " ) );";
911
+ // if loading child theme stylesheet, reset deps and add child stylesheet
912
+ $deps = array( "'chld_thm_cfg_child'" );
913
+ endif;
914
+ if ( 'separate' == $handling ):
915
+ $deps = array_merge( $deps, $this->get( 'child_deps' ) );
916
+ $enqueues[] = " wp_enqueue_style( 'chld_thm_cfg_separate', trailingslashit( get_stylesheet_directory_uri() ) . 'ctc-style.css', array( " . implode( ',', $deps ) . " ) );";
917
+ endif;
918
+ if ( count( $enqueues ) ):
919
+ $code .= "
920
+ if ( !function_exists( 'child_theme_configurator_css' ) ):
921
+ function child_theme_configurator_css() {" . LF;
922
+ $code .= implode( "\n", $enqueues );
923
+ $code .= "
924
+ }
925
+ endif;
926
+ add_action( 'wp_enqueue_scripts', 'child_theme_configurator_css' );" . LF;
927
+ endif;
928
+ if ( $ignoreparnt )
929
+ $code .= "
930
+ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT', TRUE );" . LF;
931
+ //$this->debug( $code, __FUNCTION__ );
932
+ return explode( "\n", $code ); // apply_filters( 'chld_thm_cfg_enqueue_code_filter', $code ) ); // FIXME?
933
+ }
934
+
935
+ // updates function file with wp_enqueue_script code block. If getexternals flag is passed function is run in read-only mode
936
+ function enqueue_parent_css( $obj, $getexternals = FALSE ) {
937
+ $this->debug( 'enqueueing parent css: getexternals = ' . $getexternals, __FUNCTION__ );
938
+ $marker = 'ENQUEUE PARENT ACTION';
939
+ $insertion = $this->enqueue_parent_code();
940
+ if ( $filename = $this->css->is_file_ok( $this->css->get_child_target( 'functions.php' ), 'write' ) ):
941
+ $this->insert_with_markers( $filename, $marker, $insertion, $getexternals );
942
+ /// FIXME - reset for Pro version
943
+ if ( !$getexternals && $this->reset ):
944
+ $marker = 'CTC ENQUEUE PLUGIN ACTION';
945
+ $this->insert_with_markers( $filename, $marker, array() );
946
+ endif;
947
+ endif;
948
+ }
949
+
950
+ /**
951
+ * Update functions file with wp_enqueue_style code block. Runs in read-only mode if getexternals is passed.
952
+ * This function uses the same method as the WP core function that updates .htaccess
953
+ * we would have used WP's insert_with_markers function,
954
+ * but it does not use wp_filesystem API.
955
+ */
956
+ function insert_with_markers( $filename, $marker, $insertion, $getexternals = FALSE ) {
957
+ if ( count( $this->errors ) ):
958
+ $this->debug( 'Errors detected, returning', __FUNCTION__ );
959
+ return FALSE;
960
+ endif;
961
+ // first check if this is an ajax update
962
+ if ( $this->is_ajax && is_readable( $filename ) && is_writable( $filename ) ):
963
+ // ok to proceed
964
+ $this->debug( 'Ajax update, bypassing wp filesystem.', __FUNCTION__ );
965
+ $markerdata = explode( "\n", @file_get_contents( $filename ) );
966
+ elseif ( !$this->fs ):
967
+ $this->debug( 'No filesystem access.', __FUNCTION__ );
968
+ return FALSE; // return if no filesystem access
969
+ else:
970
+ global $wp_filesystem;
971
+ if( !$wp_filesystem->exists( $this->fspath( $filename ) ) ):
972
+ if ( $getexternals ):
973
+ $this->debug( 'Read only and no functions file yet, returning...', __FUNCTION__ );
974
+ return FALSE;
975
+ else:
976
+ // make sure file exists with php header
977
+ $this->debug( 'No functions file, creating...', __FUNCTION__ );
978
+ $this->add_base_files( $this );
979
+ endif;
980
+ endif;
981
+ // get_contents_array returns extra linefeeds so just split it ourself
982
+ $markerdata = explode( "\n", $wp_filesystem->get_contents( $this->fspath( $filename ) ) );
983
+ endif;
984
+ $newfile = '';
985
+ $externals = array();
986
+ $phpopen = 0;
987
+ $in_comment = 0;
988
+ $foundit = FALSE;
989
+ if ( $markerdata ):
990
+ $state = TRUE;
991
+ foreach ( $markerdata as $n => $markerline ):
992
+ // remove double slash comment to end of line
993
+ $str = preg_replace( "/\/\/.*$/", '', $markerline );
994
+ preg_match_all("/(<\?|\?>|\*\/|\/\*)/", $str, $matches );
995
+ if ( $matches ):
996
+ foreach ( $matches[1] as $token ):
997
+ if ( '/*' == $token ):
998
+ $in_comment = 1;
999
+ elseif ( '*/' == $token ):
1000
+ $in_comment = 0;
1001
+ elseif ( '<?' == $token && !$in_comment ):
1002
+ $phpopen = 1;
1003
+ elseif ( '?>' == $token && !$in_comment ):
1004
+ $phpopen = 0;
1005
+ endif;
1006
+ endforeach;
1007
+ endif;
1008
+ if ( strpos( $markerline, '// BEGIN ' . $marker ) !== FALSE )
1009
+ $state = FALSE;
1010
+ if ( $state ):
1011
+ if ( $n + 1 < count( $markerdata ) )
1012
+ $newfile .= "{$markerline}\n";
1013
+ else
1014
+ $newfile .= "{$markerline}";
1015
+ elseif ( $getexternals ):
1016
+ // look for existing external stylesheets and add to imports config data
1017
+ if ( preg_match( "/wp_enqueue_style.+?'chld_thm_cfg_ext\d+'.+?'(.+?)'/", $markerline, $matches ) ):
1018
+ $this->debug( 'external link found : ' . $matches[ 1 ] );
1019
+ $this->convert_enqueue_to_import( $matches[ 1 ] );
1020
+ endif;
1021
+ endif;
1022
+ if ( strpos( $markerline, '// END ' . $marker ) !== FALSE ):
1023
+ if ( !$this->reset ):
1024
+ $newfile .= "// BEGIN {$marker}\n";
1025
+ if ( is_array( $insertion ) )
1026
+ foreach ( $insertion as $insertline )
1027
+ $newfile .= "{$insertline}\n";
1028
+ $newfile .= "// END {$marker}\n";
1029
+ endif;
1030
+ $state = TRUE;
1031
+ $foundit = TRUE;
1032
+ endif;
1033
+ endforeach;
1034
+ else:
1035
+ $this->debug( 'Could not parse functions file', __FUNCTION__ );
1036
+ return FALSE;
1037
+ endif;
1038
+ if ( $foundit ):
1039
+ $this->debug( 'Found marker, replaced inline', __FUNCTION__ );
1040
+ else:
1041
+ if ( !$this->reset ):
1042
+ // verify there is no PHP close tag at end of file
1043
+ if ( ! $phpopen ):
1044
+ $this->debug( 'PHP not open', __FUNCTION__ );
1045
+ //$this->errors[] = __( 'A closing PHP tag was detected in Child theme functions file so "Parent Stylesheet Handling" option was not configured. Closing PHP at the end of the file is discouraged as it can cause premature HTTP headers. Please edit <code>functions.php</code> to remove the final <code>?&gt;</code> tag and click "Generate/Rebuild Child Theme Files" again.', 'child-theme-configurator' );
1046
+ //return FALSE;
1047
+ $newfile .= '<?php' . LF;
1048
+ endif;
1049
+ $newfile .= "\n// BEGIN {$marker}\n";
1050
+ foreach ( $insertion as $insertline )
1051
+ $newfile .= "{$insertline}\n";
1052
+ $newfile .= "// END {$marker}\n";
1053
+ endif;
1054
+ endif;
1055
+ // only write file when getexternals is false
1056
+ if ( $getexternals ):
1057
+ $this->debug( 'Read only, returning.', __FUNCTION__ );
1058
+ else:
1059
+ $mode = 'direct' == $this->fs_method ? FALSE : 0666;
1060
+ $this->debug( 'Writing new functions file...', __FUNCTION__ );
1061
+ if ( $this->is_ajax && is_writable( $filename ) ):
1062
+ // with ajax we have to bypass wp filesystem so file must already be writable
1063
+ if ( FALSE === @file_put_contents( $filename, $newfile ) ):
1064
+ $this->debug( 'Ajax write failed.', __FUNCTION__ );
1065
+ return FALSE;
1066
+ endif;
1067
+ elseif ( FALSE === $wp_filesystem->put_contents(
1068
+ $this->fspath( $filename ),
1069
+ $newfile,
1070
+ $mode
1071
+ ) ): // chmod will fail unless we have fs access. user can secure files after configuring
1072
+ $this->debug( 'Filesystem write failed.', __FUNCTION__ );
1073
+ return FALSE;
1074
+ endif;
1075
+ $this->css->set_prop( 'converted', 1 );
1076
+ endif;
1077
+ }
1078
+
1079
+ // creates/updates file via filesystem API
1080
+ function write_child_file( $file, $contents ) {
1081
+ //$this->debug( LF . LF, __FUNCTION__ );
1082
+ if ( !$this->fs ):
1083
+ $this->debug( 'No filesystem access, returning.', __FUNCTION__ );
1084
+ return FALSE; // return if no filesystem access
1085
+ endif;
1086
+ global $wp_filesystem;
1087
+ if ( $file = $this->css->is_file_ok( $this->css->get_child_target( $file ), 'write' ) ):
1088
+ $mode = 'direct' == $this->fs_method ? FALSE : 0666;
1089
+ $file = $this->fspath( $file );
1090
+ if ( $wp_filesystem->exists( $file ) ):
1091
+ $this->debug( 'File exists, returning.', __FUNCTION__ );
1092
+ return FALSE;
1093
+ else:
1094
+ $this->debug( 'Writing to filesystem: ' . $file . LF . $contents, __FUNCTION__ );
1095
+ if ( FALSE === $wp_filesystem->put_contents(
1096
+ $file,
1097
+ $contents,
1098
+ $mode
1099
+ ) ):
1100
+ $this->debug( 'Filesystem write failed, returning.', __FUNCTION__ );
1101
+ return FALSE;
1102
+ endif;
1103
+ endif;
1104
+ else:
1105
+ $this->debug( 'No directory, returning.', __FUNCTION__ );
1106
+ return FALSE;
1107
+ endif;
1108
+ $this->debug( 'Filesystem write successful.', __FUNCTION__ );
1109
+ }
1110
+
1111
+ function copy_screenshot( $obj ) {
1112
+ // always copy screenshot
1113
+ $this->copy_parent_file( 'screenshot' );
1114
+ }
1115
+
1116
+ function copy_parent_file( $file, $ext = 'php' ) {
1117
+ if ( !$this->fs ):
1118
+ $this->debug( 'No filesystem access.', __FUNCTION__ );
1119
+ return FALSE; // return if no filesystem access
1120
+ endif;
1121
+ global $wp_filesystem;
1122
+ $parent_file = NULL;
1123
+ if ( 'screenshot' == $file ):
1124
+ foreach ( array_keys( $this->imgmimes ) as $extreg ):
1125
+ foreach( explode( '|', $extreg ) as $ext ):
1126
+ if ( $parent_file = $this->css->is_file_ok( $this->css->get_parent_source( 'screenshot.' . $ext ) ) ) break;
1127
+ endforeach;
1128
+ if ( $parent_file ):
1129
+ $parent_file = $this->fspath( $parent_file );
1130
+ break;
1131
+ endif;
1132
+ endforeach;
1133
+ else:
1134
+ $parent_file = $this->fspath( $this->css->is_file_ok( $this->css->get_parent_source( $file . '.' . $ext ) ) );
1135
+ endif;
1136
+ // get child theme + file + ext ( passing empty string and full child path to theme_basename )
1137
+ $child_file = $this->css->get_child_target( $file . '.' . $ext );
1138
+ // return true if file already exists
1139
+ if ( $wp_filesystem->exists( $this->fspath( $child_file ) ) ) return TRUE;
1140
+ $child_dir = dirname( $this->theme_basename( '', $child_file ) );
1141
+ $this->debug( 'Verifying child dir... ', __FUNCTION__ );
1142
+ if ( $parent_file // sanity check
1143
+ && $child_file // sanity check
1144
+ && $this->verify_child_dir( $child_dir ) //create child subdir if necessary
1145
+ && $wp_filesystem->copy( $parent_file, $this->fspath( $child_file ), FS_CHMOD_FILE ) ):
1146
+ $this->debug( 'Filesystem copy successful', __FUNCTION__ );
1147
+ return TRUE;
1148
+ endif;
1149
+ $this->errors[] = __( 'Could not copy file:' . $parent_file, 'child-theme-configurator' );
1150
+ }
1151
+
1152
+ function delete_child_file( $file, $ext = 'php' ) {
1153
+ if ( !$this->fs ):
1154
+ $this->debug( 'No filesystem access.', __FUNCTION__ );
1155
+ return FALSE; // return if no filesystem access
1156
+ endif;
1157
+ global $wp_filesystem;
1158
+ // verify file is in child theme and exists before removing.
1159
+ $file = ( 'img' == $ext ? $file : $file . '.' . $ext );
1160
+ if ( $child_file = $this->css->is_file_ok( $this->css->get_child_target( $file ), 'write' ) ):
1161
+ if ( $wp_filesystem->exists( $this->fspath( $child_file ) ) ):
1162
+ if ( $wp_filesystem->delete( $this->fspath( $child_file ) ) ):
1163
+ return TRUE;
1164
+ else:
1165
+ $this->errors[] = __( 'Could not delete ' . $ext . ' file.', 'child-theme-configurator' );
1166
+ $this->debug( 'Could not delete ' . $ext . ' file', __FUNCTION__ );
1167
+ endif;
1168
+ endif;
1169
+ endif;
1170
+ }
1171
+
1172
+ function get_files( $theme, $type = 'template' ) {
1173
+ //$this->debug( LF . LF, __FUNCTION__ );
1174
+ $isparent = ( $theme === $this->get( 'parnt' ) );
1175
+ if ( ( $templates = $this->get( 'templates' ) ) && $isparent && 'template' == $type ):
1176
+ return $templates;
1177
+ elseif ( !isset( $this->files[ $theme ] ) ):
1178
+
1179
+ $this->files[ $theme ] = array();
1180
+ $imgext = '(' . implode( '|', array_keys( $this->imgmimes ) ) . ')';
1181
+ foreach ( $this->css->recurse_directory(
1182
+ trailingslashit( get_theme_root() ) . $theme, '', TRUE ) as $file ):
1183
+ $file = $this->theme_basename( $theme, $file );
1184
+ if ( preg_match( "/^style\-(\d+)\.css$/", $file, $matches ) ):
1185
+ $date = date_i18n( 'D, j M Y g:i A', strtotime( $matches[ 1 ] ) );
1186
+ $this->files[ $theme ][ 'backup' ][ $file ] = $date;
1187
+ //$this->debug( 'This is a backup file', __FUNCTION__ );
1188
+ elseif ( preg_match( "/^ctc\-plugins\-(\d+)\.css$/", $file, $matches ) ):
1189
+ $date = date_i18n( 'D, j M Y g:i A', strtotime( $matches[ 1 ] ) );
1190
+ $this->files[ $theme ][ 'pluginbackup' ][ $file ] = $date;
1191
+ //$this->debug( 'This is a plugin backup file', __FUNCTION__ );
1192
+ elseif ( preg_match( "/\.php$/", $file ) ):
1193
+ if ( $isparent ):
1194
+
1195
+ if ( ( $file_verified = $this->css->is_file_ok( $this->css->get_parent_source( $file, $theme ) , 'read' ) ) ):
1196
+ $this->debug( 'scanning ' . $file_verified . '... ', __FUNCTION__ );
1197
+ $contents = @file_get_contents( $file_verified );
1198
+ // if file contains code it may be a template
1199
+ if ( preg_match( "/\w+\s*\(/", $contents ) ):
1200
+ //$this->debug( 'code detected ...', __FUNCTION__ );
1201
+ // if file contains functions, it is not a template
1202
+ if ( !preg_match( "/(function \w+?|require(_once)?)\s*\(/", $contents ) ):
1203
+ //$this->debug( 'No functions detected, adding to templates.', __FUNCTION__ );
1204
+ $this->files[ $theme ][ 'template' ][] = $file;
1205
+ else:
1206
+ //$this->debug( 'Functions detected, skipping.', __FUNCTION__ );
1207
+ endif;
1208
+ else:
1209
+ //$this->debug( 'No code, skipping.', __FUNCTION__ );
1210
+ endif;
1211
+ endif;
1212
+ else:
1213
+ //$this->debug( 'Child PHP, adding to templates', __FUNCTION__ );
1214
+ $this->files[ $theme ][ 'template' ][] = $file;
1215
+ endif;
1216
+ elseif ( preg_match( "/\.css$/", $file ) && 'style.css' != $file ):
1217
+ $this->files[ $theme ][ 'stylesheet' ][] = $file;
1218
+ //$this->debug( 'This is a stylesheet', __FUNCTION__ );
1219
+ elseif ( preg_match( "/^images\/.+?\." . $imgext . "$/", $file ) ):
1220
+ $this->files[ $theme ][ 'img' ][] = $file;
1221
+ //$this->debug( 'This is an image file', __FUNCTION__ );
1222
+ endif;
1223
+ endforeach;
1224
+ endif;
1225
+ if ( $isparent ):
1226
+ //$this->debug( 'Setting CSS object templates parameter', __FUNCTION__ );
1227
+ $this->css->templates = $this->files[ $theme ][ 'template' ];
1228
+ endif;
1229
+ $types = explode(",", $type);
1230
+ $files = array();
1231
+ foreach ( $types as $type )
1232
+ if ( isset( $this->files[ $theme ][ $type ] ) )
1233
+ $files = array_merge( $this->files[ $theme ][ $type ], $files );
1234
+ return $files;
1235
+ }
1236
+
1237
+ function theme_basename( $theme, $file ) {
1238
+ $file = $this->normalize_path( $file );
1239
+ // if no theme passed, returns theme + file
1240
+ $themedir = trailingslashit( $this->normalize_path( get_theme_root() ) ) . ( '' == $theme ? '' : trailingslashit( $theme ) );
1241
+ //$this->debug( 'Themedir: ' . $themedir . ' File: ' . $file , __FUNCTION__ );
1242
+ return preg_replace( '%^' . preg_quote( $themedir ) . '%', '', $file );
1243
+ }
1244
+
1245
+ function uploads_basename( $file ) {
1246
+ $file = $this->normalize_path( $file );
1247
+ $uplarr = wp_upload_dir();
1248
+ $upldir = trailingslashit( $this->normalize_path( $uplarr[ 'basedir' ] ) );
1249
+ return preg_replace( '%^' . preg_quote( $upldir ) . '%', '', $file );
1250
+ }
1251
+
1252
+ function uploads_fullpath( $file ) {
1253
+ $file = $this->normalize_path( $file );
1254
+ $uplarr = wp_upload_dir();
1255
+ $upldir = trailingslashit( $this->normalize_path( $uplarr[ 'basedir' ] ) );
1256
+ return $upldir . $file;
1257
+ }
1258
+
1259
+ function serialize_postarrays() {
1260
+ foreach ( $this->postarrays as $field )
1261
+ if ( isset( $_POST[ $field ] ) && is_array( $_POST[ $field ] ) )
1262
+ $_POST[ $field ] = implode( "%%", $_POST[ $field ] );
1263
+ }
1264
+
1265
+ function unserialize_postarrays() {
1266
+ foreach ( $this->postarrays as $field )
1267
+ if ( isset( $_POST[ $field ] ) && !is_array( $_POST[ $field ] ) )
1268
+ $_POST[ $field ] = explode( "%%", $_POST[ $field ] );
1269
+ }
1270
+
1271
+ function set_writable( $file = NULL ) {
1272
+
1273
+ if ( isset( $file ) ):
1274
+ $file = $this->css->get_child_target( $file . '.php' );
1275
+ else:
1276
+ $file = apply_filters( 'chld_thm_cfg_target', $this->css->get_child_target( 'separate' == $this->get( 'handling' ) ? 'ctc-style.css' : 'style.css' ), $this->css );
1277
+ endif;
1278
+ if ( $this->fs ): // filesystem access
1279
+ if ( is_writable( $file ) ) return;
1280
+ global $wp_filesystem;
1281
+ if ( $file && $wp_filesystem->chmod( $this->fspath( $file ), 0666 ) ) return;
1282
+ endif;
1283
+ $this->errors[] = __( 'Could not set write permissions.', 'child-theme-configurator' );
1284
+ add_action( 'admin_notices', array( $this, 'writable_notice' ) );
1285
+ return FALSE;
1286
+ }
1287
+
1288
+ function clone_child_theme( $child, $clone ) {
1289
+ if ( !$this->fs ) return FALSE; // return if no filesystem access
1290
+ global $wp_filesystem;
1291
+ // set child theme if not set for get_child_target to use new child theme as source
1292
+ $this->css->set_prop( 'child', $child );
1293
+
1294
+ $dir = untrailingslashit( $this->css->get_child_target( '' ) );
1295
+ $themedir = trailingslashit( get_theme_root() );
1296
+ $fsthemedir = $this->fspath( $themedir );
1297
+ $files = $this->css->recurse_directory( $dir, NULL, TRUE );
1298
+ $errors = array();
1299
+ foreach ( $files as $file ):
1300
+ $childfile = $this->theme_basename( $child, $this->normalize_path( $file ) );
1301
+ $newfile = trailingslashit( $clone ) . $childfile;
1302
+ $childpath = $fsthemedir . trailingslashit( $child ) . $childfile;
1303
+ $newpath = $fsthemedir . $newfile;
1304
+ $this->debug( 'Verifying child dir... ', __FUNCTION__ );
1305
+ if ( $this->verify_child_dir( is_dir( $file ) ? $newfile : dirname( $newfile ) ) ):
1306
+ if ( is_file( $file ) && !@$wp_filesystem->copy( $childpath, $newpath ) ):
1307
+ $errors[] = 'could not copy ' . $newpath;
1308
+ endif;
1309
+ else:
1310
+ $errors[] = 'invalid dir: ' . $newfile;
1311
+ endif;
1312
+ endforeach;
1313
+ }
1314
+
1315
+ function unset_writable() {
1316
+ if ( !$this->fs ) return FALSE; // return if no filesystem access
1317
+ global $wp_filesystem;
1318
+ $dir = untrailingslashit( $this->css->get_child_target( '' ) );
1319
+ $child = $this->theme_basename( '', $dir );
1320
+ $newchild = untrailingslashit( $child ) . '-new';
1321
+ $themedir = trailingslashit( get_theme_root() );
1322
+ $fsthemedir = $this->fspath( $themedir );
1323
+ // is child theme owned by user?
1324
+ if ( fileowner( $dir ) == fileowner( $themedir ) ):
1325
+ $copy = FALSE;
1326
+ $wp_filesystem->chmod( $dir );
1327
+ // recursive chmod ( as user )
1328
+ // WP_Filesystem RECURSIVE CHMOD IS FLAWED! IT SETS ALL CHILDREN TO PERM OF OUTERMOST DIR
1329
+ //if ( $wp_filesystem->chmod( $this->fspath( $dir ), FALSE, TRUE ) ):
1330
+ //endif;
1331
+ else:
1332
+ $copy = TRUE;
1333
+ endif;
1334
+ // n -> copy entire folder ( as user )
1335
+ $files = $this->css->recurse_directory( $dir, NULL, TRUE );
1336
+ $errors = array();
1337
+ foreach ( $files as $file ):
1338
+ $childfile = $this->theme_basename( $child, $this->normalize_path( $file ) );
1339
+ $newfile = trailingslashit( $newchild ) . $childfile;
1340
+ $childpath = $fsthemedir . trailingslashit( $child ) . $childfile;
1341
+ $newpath = $fsthemedir . $newfile;
1342
+ if ( $copy ):
1343
+ $this->debug( 'Verifying child dir... ' . $file, __FUNCTION__ );
1344
+ if ( $this->verify_child_dir( is_dir( $file ) ? $newfile : dirname( $newfile ) ) ):
1345
+ if ( is_file( $file ) && !$wp_filesystem->copy( $childpath, $newpath ) ):
1346
+ $errors[] = 'could not copy ' . $newpath;
1347
+ endif;
1348
+ else:
1349
+ $errors[] = 'invalid dir: ' . $newfile;
1350
+ endif;
1351
+ else:
1352
+ $wp_filesystem->chmod( $this->fspath( $file ) );
1353
+ endif;
1354
+ endforeach;
1355
+ if ( $copy ):
1356
+ // verify copy ( as webserver )
1357
+ $newfiles = $this->css->recurse_directory( trailingslashit( $themedir ) . $newchild, NULL, TRUE );
1358
+ $deleteddirs = $deletedfiles = 0;
1359
+ if ( count( $newfiles ) == count( $files ) ):
1360
+ // rename old ( as webserver )
1361
+ if ( !$wp_filesystem->exists( trailingslashit( $fsthemedir ) . $child . '-old' ) )
1362
+ $wp_filesystem->move( trailingslashit( $fsthemedir ) . $child, trailingslashit( $fsthemedir ) . $child . '-old' );
1363
+ // rename new ( as user )
1364
+ if ( !$wp_filesystem->exists( trailingslashit( $fsthemedir ) . $child ) )
1365
+ $wp_filesystem->move( trailingslashit( $fsthemedir ) . $newchild, trailingslashit( $fsthemedir ) . $child );
1366
+ // remove old files ( as webserver )
1367
+ $oldfiles = $this->css->recurse_directory( trailingslashit( $themedir ) . $child . '-old', NULL, TRUE );
1368
+ array_unshift( $oldfiles, trailingslashit( $themedir ) . $child . '-old' );
1369
+ foreach ( array_reverse( $oldfiles ) as $file ):
1370
+ if ( $wp_filesystem->delete( $this->fspath( $file ) )
1371
+ || ( is_dir( $file ) && @rmdir( $file ) )
1372
+ || ( is_file( $file ) && @unlink( $file ) ) ):
1373
+ $deletedfiles++;
1374
+ endif;
1375
+ endforeach;
1376
+ if ( $deletedfiles != count( $oldfiles ) ):
1377
+ $errors[] = 'deleted: ' . $deletedfiles . ' != ' . count( $oldfiles ) . ' files';
1378
+ endif;
1379
+ else:
1380
+ $errors[] = 'newfiles != files';
1381
+ endif;
1382
+ endif;
1383
+ if ( count( $errors ) ):
1384
+ $this->errors[] = __( 'There were errors while resetting permissions.', 'child-theme-configurator' ) ;
1385
+ add_action( 'admin_notices', array( $this, 'writable_notice' ) );
1386
+ endif;
1387
+ }
1388
+
1389
+ function set_skip_form() {
1390
+ $this->skip_form = TRUE;
1391
+ }
1392
+
1393
+ function handle_file_upload( $field, $childdir = NULL, $mimes = NULL ){
1394
+ $uploadedfile = $_FILES[ $field ];
1395
+ $upload_overrides = array(
1396
+ 'test_form' => FALSE,
1397
+ 'mimes' => ( is_array( $mimes ) ? $mimes : NULL )
1398
+ );
1399
+ if ( ! function_exists( 'wp_handle_upload' ) ) require_once( ABSPATH . 'wp-admin/includes/file.php' );
1400
+ $movefile = wp_handle_upload( $uploadedfile, $upload_overrides );
1401
+ if ( isset( $movefile[ 'error' ] ) ):
1402
+ $this->errors[] = $movefile[ 'error' ];
1403
+ return FALSE;
1404
+ endif;
1405
+ $_POST[ 'movefile' ] = $this->uploads_basename( $movefile[ 'file' ] );
1406
+ }
1407
+
1408
+ function move_file_upload( $subdir = 'images' ) {
1409
+ if ( !$this->fs ) return FALSE; // return if no filesystem access
1410
+ global $wp_filesystem;
1411
+ $source_file = sanitize_text_field( $_POST[ 'movefile' ] );
1412
+ $target_file = ( '' == $subdir ?
1413
+ preg_replace( "%^.+(\.\w+)$%", "screenshot$1", basename( $source_file ) ) :
1414
+ trailingslashit( $subdir ) . basename( $source_file ) );
1415
+ $this->debug( 'Verifying child dir... ', __FUNCTION__ );
1416
+ if ( FALSE !== $this->verify_child_dir( trailingslashit( $this->get( 'child' ) ) . $subdir ) ):
1417
+ $source_path = $this->fspath( $this->uploads_fullpath( $source_file ) );
1418
+ if ( $target_path = $this->css->is_file_ok( $this->css->get_child_target( $target_file ), 'write' ) ):
1419
+ $target_path = $this->fspath( $target_path );
1420
+ if ( $wp_filesystem->exists( $source_path ) ):
1421
+ if ( $wp_filesystem->move( $source_path, $target_path ) ) return TRUE;
1422
+ endif;
1423
+ endif;
1424
+ endif;
1425
+
1426
+ $this->errors[] = __( 'Could not upload file.', 'child-theme-configurator' );
1427
+ }
1428
+
1429
+ function export_zip() {
1430
+ if ( ( $child = $this->get( 'child' ) )
1431
+ && ( $dir = $this->css->is_file_ok( dirname( $this->css->get_child_target( 'style.css' ) ), 'search' ) )
1432
+ && ( $version = preg_replace( "%[^\w\.\-]%", '', $this->get( 'version' ) ) ) ):
1433
+ // use php system upload dir to store temp files so that we can use pclzip
1434
+ $tmpdir = ini_get( 'upload_tmp_dir' ) ? ini_get( 'upload_tmp_dir' ) : sys_get_temp_dir();
1435
+ $file = trailingslashit( $tmpdir ) . $child . '-' . $version . '.zip';
1436
+ mbstring_binary_safe_encoding();
1437
+
1438
+ require_once( ABSPATH . 'wp-admin/includes/class-pclzip.php' );
1439
+
1440
+ $archive = new PclZip( $file );
1441
+ if ( $archive->create( $dir, PCLZIP_OPT_REMOVE_PATH, dirname( $dir ) ) == 0 ) return FALSE;
1442
+ reset_mbstring_encoding();
1443
+ header( 'Content-Description: File Transfer' );
1444
+ header( 'Content-Type: application/octet-stream' );
1445
+ header( 'Content-Length: ' . filesize( $file ) );
1446
+ header( 'Content-Disposition: attachment; filename=' . basename( $file ) );
1447
+ header( 'Expires: 0' );
1448
+ header( 'Cache-Control: must-revalidate' );
1449
+ header( 'Pragma: public' );
1450
+ readfile( $file );
1451
+ unlink( $file );
1452
+ die();
1453
+ endif;
1454
+ }
1455
+
1456
+ /*
1457
+ *
1458
+ */
1459
+ function verify_creds( $args = array() ) {
1460
+ $this->fs_prompt = $this->fs = FALSE;
1461
+ //fs prompt does not support arrays as post data - serialize arrays
1462
+ $this->serialize_postarrays();
1463
+ // generate callback url
1464
+ $ctcpage = apply_filters( 'chld_thm_cfg_admin_page', CHLD_THM_CFG_MENU );
1465
+ $url = is_multisite() ? network_admin_url( 'themes.php?page=' . $ctcpage ) :
1466
+ admin_url( 'tools.php?page=' . $ctcpage );
1467
+ $nonce_url = wp_nonce_url( $url, apply_filters( 'chld_thm_cfg_action', 'ctc_update' ), '_wpnonce' );
1468
+ // buffer output so we can process prior to http header
1469
+ ob_start();
1470
+ if ( $creds = request_filesystem_credentials( $nonce_url, '', FALSE, FALSE, $args ) ):
1471
+ // check filesystem permission if direct or ftp creds exist
1472
+ if ( WP_Filesystem( $creds ) )
1473
+ // login ok
1474
+ $this->fs = TRUE;
1475
+ else
1476
+ // incorrect credentials, get form with error flag
1477
+ $creds = request_filesystem_credentials( $nonce_url, '', TRUE, FALSE, $args );
1478
+ else:
1479
+ // no credentials, initialize unpriveledged filesystem object
1480
+ WP_Filesystem();
1481
+ endif;
1482
+ // if form was generated, store it
1483
+ $this->fs_prompt = ob_get_contents();
1484
+ // now we can read/write if fs is TRUE otherwise fs_prompt will contain form
1485
+ ob_end_clean();
1486
+ //fs prompt does not support arrays as post data - unserialize arrays
1487
+ $this->unserialize_postarrays();
1488
+ }
1489
+
1490
+ /*
1491
+ * convert 'direct' filepath into wp_filesystem filepath
1492
+ */
1493
+ function fspath( $file ){
1494
+ if ( ! $this->fs ) return FALSE; // return if no filesystem access
1495
+ global $wp_filesystem;
1496
+ if ( is_dir( $file ) ):
1497
+ $dir = $file;
1498
+ $base = '';
1499
+ else:
1500
+ $dir = dirname( $file );
1501
+ $base = basename( $file );
1502
+ endif;
1503
+ $fsdir = $wp_filesystem->find_folder( $dir );
1504
+ return trailingslashit( $fsdir ) . $base;
1505
+ }
1506
+
1507
+ // back compatibility function for legacy plugins extension
1508
+ function write_addl_files( $obj ) {
1509
+ global $chld_thm_cfg_plugins;
1510
+ if ( !is_object( $chld_thm_cfg_plugins ) || !$this->fs ) return FALSE;
1511
+ $configtype = $this->get( 'configtype' );
1512
+ //echo $configtype . LF;
1513
+ if ( 'theme' == $configtype || !( $def = $chld_thm_cfg_plugins->defs->get_def( $configtype ) ) ) return FALSE;
1514
+ $child = trailingslashit( $this->get( 'child' ) );
1515
+ if ( isset( $def[ 'addl' ] ) && is_array( $def[ 'addl' ] ) && count( $def[ 'addl' ] ) ):
1516
+ foreach ( $def[ 'addl' ] as $path => $type ):
1517
+
1518
+ // sanitize the crap out of the target data -- it will be used to create paths
1519
+ $path = $this->normalize_path( preg_replace( "%[^\w\\//\-]%", '', sanitize_text_field( $child . $path ) ) );
1520
+ $this->debug( 'Verifying child dir... ', __FUNCTION__ );
1521
+ if ( ( 'dir' == $type && FALSE === $this->verify_child_dir( $path ) )
1522
+ || ( 'dir' != $type && FALSE === $this->write_child_file( $path, '' ) ) ):
1523
+ //$this->errors[] = __( 'Your theme directories are not writable.', 'chld_thm_cfg_plugins' );
1524
+ endif;
1525
+ endforeach;
1526
+ endif;
1527
+ // write main def file
1528
+ if ( isset( $def[ 'target' ] ) ):
1529
+ $path = $this->normalize_path( preg_replace( "%[^\w\\//\-\.]%", '', sanitize_text_field( $def[ 'target' ] ) ) ); //$child .
1530
+ if ( FALSE === $this->write_child_file( $path, '' ) ):
1531
+ //echo "invalid path: " . $path . ' ' . ' was: ' . $def[ 'target' ] . LF;
1532
+ //$this->errors[] = __( 'Your stylesheet is not writable.', 'chld_thm_cfg_plugins' );
1533
+ return FALSE;
1534
+ endif;
1535
+ endif;
1536
+ }
1537
+
1538
+ // backwards compatability < WP 3.9
1539
+ function normalize_path( $path ) {
1540
+ $path = str_replace( '\\', '/', $path );
1541
+ $path = preg_replace( '|/+|','/', $path );
1542
+ return $path;
1543
+ }
1544
+
1545
+ // case insensitive theme search
1546
+ function check_theme_exists( $theme ) {
1547
+ $search_array = array_map( 'strtolower', array_keys( wp_get_themes() ) );
1548
+ return in_array( strtolower( $theme ), $search_array );
1549
+ }
1550
+
1551
+ // helper functions to support legacy plugin extension
1552
+ function is_legacy() {
1553
+ return defined('CHLD_THM_CFG_PLUGINS_VERSION')
1554
+ && version_compare( CHLD_THM_CFG_PLUGINS_VERSION, '2.0.0', '<' );
1555
+ }
1556
+
1557
+ /* not using plugin mode */
1558
+ function is_theme( $configtype = '' ) {
1559
+ // if filter returns a value, we are using plugin mode
1560
+ // otherwise if configtype has a value and it is not a theme then we are in legacy plugin mode
1561
+ $pluginmode = apply_filters( 'chld_thm_cfg_action', NULL );
1562
+ if ( $pluginmode || ( !empty( $configtype ) && 'theme' != $configtype ) ):
1563
+ return FALSE;
1564
+ endif;
1565
+ if ( $this->is_legacy()
1566
+ && is_object( $this->css )
1567
+ && ( $configtype = $this->get( 'configtype' ) )
1568
+ && !empty( $configtype ) && 'theme' != $configtype ):
1569
+ return FALSE;
1570
+ endif;
1571
+ return TRUE;
1572
+ }
1573
+
1574
+ /* returns parent theme either from existing config or passed as post var */
1575
+ function get_current_parent() {
1576
+ // check if child was passed and use Template value
1577
+ if ( isset( $_GET[ 'ctc_child' ] ) && ( $child = sanitize_text_field( $_GET[ 'ctc_child' ] ) ) )
1578
+ return $this->themes[ 'child' ][ $child ][ 'Template' ];
1579
+ // otherwise check if parent was passed
1580
+ if ( isset( $_GET[ 'ctc_parent' ] ) && ( $parent = sanitize_text_field( $_GET[ 'ctc_parent' ] ) ) )
1581
+ return $parent;
1582
+ // otherwise use css object value
1583
+ elseif ( $parent = $this->get( 'parnt' ) )
1584
+ return $parent;
1585
+ // otherwise use template value
1586
+ else return get_template();
1587
+ }
1588
+
1589
+ /* returns child theme either from existing config or passed as post var */
1590
+ function get_current_child() {
1591
+ // check if parent was passed
1592
+ if ( isset( $_GET[ 'ctc_child' ] ) && ( $child = sanitize_text_field( $_GET[ 'ctc_child' ] ) ) )
1593
+ return $child;
1594
+ // otherwise use css object value
1595
+ elseif ( $child = $this->get( 'child' ) )
1596
+ return $child;
1597
+ // otherwise use stylesheet value
1598
+ else return get_stylesheet();
1599
+ }
1600
+
1601
+ /* returns new or existing */
1602
+ function get_current_childtype() {
1603
+ return isset( $this->childtype ) ? $this->childtype : ( count( $this->themes[ 'child' ] ) ? 'existing' : 'new' );
1604
+ }
1605
+
1606
+ /* returns true if current parent different than saved parent or current child different than saved child */
1607
+ function is_new_theme() {
1608
+ return ( $this->get_current_child() != $this->get( 'child' ) || $this->get_current_parent() != $this->get( 'parnt' ) );
1609
+ }
1610
+
1611
+ /* debug backtrace with extraneous steps (missing class, function or line) removed */
1612
+ function backtrace_summary() {
1613
+ $bt = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS );
1614
+ $thisstep = array_shift( $bt );
1615
+ foreach ( $bt as $ndx => $step )
1616
+ if ( isset( $step[ 'class' ] ) && isset( $step[ 'function' ] ) && isset( $step[ 'line' ] ) )
1617
+ echo $ndx . ': ' . $step[ 'class' ] . ' ' . $step[ 'function' ] . ' ' . $step[ 'line' ] . LF;
1618
+ }
1619
+
1620
+ function toggle_debug() {
1621
+ $debug = '';
1622
+ if ( $_POST[ 'ctc_is_debug' ] ):
1623
+ $this->is_debug = 1;
1624
+ $debug = $this->print_debug( TRUE );
1625
+ else:
1626
+ $this->is_debug = 0;
1627
+ endif;
1628
+ update_option( CHLD_THM_CFG_OPTIONS . '_debug', $this->is_debug );
1629
+ $this->updates[] = array(
1630
+ 'obj' => 'debug',
1631
+ 'key' => '',
1632
+ 'data' => $debug,
1633
+ );
1634
+ }
1635
+
1636
+ function debug( $msg = NULL, $fn = NULL) {
1637
+ $this->debug .= ( isset( $fn ) ? $fn . ': ' : '' ) . ( isset( $msg ) ? $msg . LF : '' );
1638
+ }
1639
+
1640
+ function set_benchmark( $step, $key, $label ) {
1641
+ $this->memory[ $key ][ $label ][ $step ][ 'memory' ] = memory_get_usage();
1642
+ $this->memory[ $key ][ $label ][ $step ][ 'peak' ] = memory_get_peak_usage();
1643
+
1644
+ $this->memory[ $key ][ $label ][ $step ][ 'selectors' ] = isset( $this->css ) ? $this->css->qskey : 0;
1645
+ }
1646
+
1647
+ /**
1648
+ * Future use
1649
+ *
1650
+ function calc_memory_usage() {
1651
+ //$this->debug( print_r( $this->memory, TRUE ), __FUNCTION__ );
1652
+
1653
+ $results = array();
1654
+ foreach ( $this->memory as $key => $labels ):
1655
+ if ( !is_array( $labels ) ) continue;
1656
+ foreach ( $labels as $label => $steps ):
1657
+ //if ( isset( $steps[ 'before' ] ) && isset( $steps[ 'after ' ] ) ):
1658
+ $results[] = $key . '|' . $label . '|'
1659
+ . ( $steps[ 'after' ][ 'memory' ] - $steps[ 'before' ][ 'memory' ] ) . '|'
1660
+ . ( $steps[ 'after' ][ 'peak' ] - $steps[ 'before' ][ 'peak' ] ) . '|'
1661
+ . ( $steps[ 'after' ][ 'peak' ] - $steps[ 'before' ][ 'memory' ] ) . '|'
1662
+ . $steps[ 'after' ][ 'selectors' ] . '|'
1663
+ . ( $steps[ 'after' ][ 'selectors' ] - $steps[ 'before' ][ 'selectors' ] );
1664
+ //endif;
1665
+ endforeach;
1666
+ endforeach;
1667
+ //$this->debug( "\n" . implode( "\n", $results ), __FUNCTION__ );
1668
+ }
1669
+ */
1670
+
1671
+ /**
1672
+ * Future use
1673
+ *
1674
+ function get_free_memory() {
1675
+
1676
+ if ( function_exists( 'memory_get_peak_usage' ) ) {
1677
+ $used = memory_get_peak_usage();
1678
+ } else {
1679
+ $used = memory_get_usage();
1680
+ }
1681
+ if ( !$this->mem_limit ) $this->get_real_limit();
1682
+ return $this->mem_limit - $used;
1683
+ }
1684
+ */
1685
+ function print_debug( $noecho = FALSE ) {
1686
+ $this->ctc()->debug( '*** END OF REQUEST ***', __FUNCTION__ );
1687
+ // save debug data for 1 hour
1688
+ set_site_transient( CHLD_THM_CFG_OPTIONS . '_debug', $this->debug, 3600 );
1689
+ $debug = '<textarea style="width:100%;height:200px">' . LF . $this->debug . LF . '</textarea>' . LF;
1690
+ if ( $noecho ) return $debug;
1691
+ echo $debug;
1692
+ }
1693
+
1694
+ function parse_parent_stylesheet_to_source() {
1695
+ $this->css->parse_css_file( 'parnt' );
1696
+ }
1697
+
1698
+ function parse_child_stylesheet_to_source() {
1699
+ $this->css->parse_css_file( 'child', 'style.css', 'parnt' );
1700
+ }
1701
+
1702
+ function parse_child_stylesheet_to_target() {
1703
+ $this->css->parse_css_file( 'child', 'style.css' );
1704
+ }
1705
+
1706
+ function parse_custom_stylesheet_to_target() {
1707
+ $this->css->parse_css_file( 'child', 'ctc-style.css' );
1708
+ }
1709
+
1710
+ function parse_genesis_stylesheet_to_source() {
1711
+ $this->css->parse_css_file( 'child', 'ctc-genesis.css', 'parnt' );
1712
+ }
1713
+
1714
+ function parse_additional_stylesheets_to_source() {
1715
+ // parse additional stylesheets
1716
+ foreach ( $this->css->addl_css as $file ):
1717
+ //$file = sanitize_text_field( $file );
1718
+ $this->css->parse_css_file( 'parnt', $file );
1719
+ endforeach;
1720
+ $this->debug( print_r( $this->css->addl_css, TRUE ), __FUNCTION__ );
1721
+ //endif;
1722
+ }
1723
+
1724
+ function reset_child_theme() {
1725
+ $parnt = $this->get( 'parnt' );
1726
+ $child = $this->get( 'child' );
1727
+ $name = $this->get( 'child_name' );
1728
+ $this->css = new ChildThemeConfiguratorCSS();
1729
+ $this->css->set_prop( 'parnt', $parnt );
1730
+ $this->css->set_prop( 'child', $child );
1731
+ $this->css->set_prop( 'child_name', $name );
1732
+ $this->css->set_prop( 'enqueue', 'enqueue' );
1733
+ $this->backup_or_restore_file( 'header.php', TRUE );
1734
+ $this->delete_child_file( 'header.ctcbackup', 'php' );
1735
+ $this->backup_or_restore_file( 'style.css', TRUE );
1736
+ $this->delete_child_file( 'style.ctcbackup', 'css' );
1737
+ $this->backup_or_restore_file( 'ctc-style.css', TRUE );
1738
+ $this->delete_child_file( 'ctc-style.ctcbackup', 'css' );
1739
+ }
1740
+
1741
+ function copy_theme_mods( $from, $to ) {
1742
+
1743
+ // we can copy settings from parent to child even if neither is currently active
1744
+ // so we need cases for active parent, active child or neither
1745
+
1746
+ // get active theme
1747
+ $active_theme = get_stylesheet();
1748
+ $this->debug( 'from: ' . $from . ' to: ' . $to . ' active: ' . $active_theme, __FUNCTION__ );
1749
+ // create temp array from parent settings
1750
+ $child_mods = get_option( 'theme_mods_' . $from );
1751
+ if ( $active_theme == $from ):
1752
+ $this->debug( 'from is active, using active widgets', __FUNCTION__ );
1753
+ // if parent theme is active, get widgets from active sidebars_widgets array
1754
+ $child_widgets = retrieve_widgets();
1755
+ else:
1756
+ $this->debug( 'from not active, using theme mods widgets', __FUNCTION__ );
1757
+ // otherwise get widgets from parent theme mods
1758
+ $child_widgets = empty( $child_mods[ 'sidebars_widgets' ][ 'data' ] ) ?
1759
+ array( 'wp_inactive_widgets' => array() ) : $child_mods[ 'sidebars_widgets' ][ 'data' ];
1760
+ endif;
1761
+ if ( $active_theme == $to ):
1762
+ $this->debug( 'to active, setting active widgets', __FUNCTION__ );
1763
+ // if child theme is active, remove widgets from temp array
1764
+ unset( $child_mods[ 'sidebars_widgets' ] );
1765
+ // copy widgets to active sidebars_widgets array
1766
+ wp_set_sidebars_widgets( $child_widgets );
1767
+ else:
1768
+ $this->debug( 'child not active, saving widgets in theme mods', __FUNCTION__ );
1769
+ // otherwise copy widgets to temp array with time stamp
1770
+ $child_mods[ 'sidebars_widgets' ][ 'data' ] = $child_widgets;
1771
+ $child_mods[ 'sidebars_widgets' ][ 'time' ] = time();
1772
+ endif;
1773
+ $this->debug( 'saving child theme mods:' . LF . print_r( $child_mods, TRUE ), __FUNCTION__ );
1774
+ // copy temp array to child mods
1775
+ update_option( 'theme_mods_' . $to, $child_mods );
1776
+ }
1777
+
1778
+ function network_enable() {
1779
+ if ( $child = $this->get( 'child' ) ):
1780
+ $allowed_themes = get_site_option( 'allowedthemes' );
1781
+ $allowed_themes[ $child ] = true;
1782
+ update_site_option( 'allowedthemes', $allowed_themes );
1783
+ endif;
1784
+ }
1785
+
1786
+ function backup_or_restore_file( $source, $restore = FALSE, $target = NULL ){
1787
+ $action = $restore ? 'Restore' : 'Backup';
1788
+ $this->debug( LF . LF . $action . ' main stylesheet...', __FUNCTION__ );
1789
+ if ( !$this->fs ):
1790
+ $this->debug( 'No filesystem access, returning', __FUNCTION__ );
1791
+ return FALSE; // return if no filesystem access
1792
+ endif;
1793
+ list( $base, $suffix ) = explode( '.', $source );
1794
+ if ( empty( $target ) )
1795
+ $target = $base . '.ctcbackup.' . $suffix;
1796
+ if ( $restore ):
1797
+ $source = $target;
1798
+ $target = $base . '.' . $suffix;
1799
+ endif;
1800
+ $fstarget = $this->fspath( $this->css->get_child_target( $target ) );
1801
+ $fssource = $this->fspath( $this->css->get_child_target( $source ) );
1802
+ global $wp_filesystem;
1803
+ if ( ( !$wp_filesystem->exists( $fssource ) ) || ( !$restore && $wp_filesystem->exists( $fstarget ) ) ):
1804
+ $this->debug( 'No stylesheet, returning', __FUNCTION__ );
1805
+ return FALSE;
1806
+ endif;
1807
+ if ( $wp_filesystem->copy( $fssource, $fstarget, FS_CHMOD_FILE ) ):
1808
+ $this->debug( 'Filesystem ' . $action . ' successful', __FUNCTION__ );
1809
+ return TRUE;
1810
+ else:
1811
+ $this->debug( 'Filesystem ' . $action . ' failed', __FUNCTION__ );
1812
+ return FALSE;
1813
+ endif;
1814
+ }
1815
+
1816
+ function rewrite_stylesheet_header(){
1817
+ $this->debug( LF . LF . 'Rewriting main stylesheet header...', __FUNCTION__ );
1818
+ if ( !$this->fs ):
1819
+ $this->debug( 'No filesystem access, returning', __FUNCTION__ );
1820
+ return FALSE; // return if no filesystem access
1821
+ endif;
1822
+ $origcss = $this->css->get_child_target( 'style.css' );
1823
+ $fspath = $this->fspath( $origcss );
1824
+ global $wp_filesystem;
1825
+ if( !$wp_filesystem->exists( $fspath ) ):
1826
+ $this->debug( 'No stylesheet, returning', __FUNCTION__ );
1827
+ return FALSE;
1828
+ endif;
1829
+ // get_contents_array returns extra linefeeds so just split it ourself
1830
+ $contents = $wp_filesystem->get_contents( $fspath );
1831
+ $child_headers = $this->css->get_css_header();
1832
+ if ( is_array( $child_headers ) )
1833
+ $regex = implode( '|', array_map( 'preg_quote', array_keys( $child_headers ) ) );
1834
+ else $regex = 'NO HEADERS';
1835
+ $regex = '/(' . $regex . '):.*$/';
1836
+ $this->debug( 'regex: ' . $regex, __FUNCTION__ );
1837
+ $header = str_replace( "\r", LF, substr( $contents, 0, 8192 ) );
1838
+ $contents = substr( $contents, 8192 );
1839
+ $this->debug( 'original header: ' . LF . $header, __FUNCTION__ );
1840
+ //$this->debug( 'stripping @import rules...', __FUNCTION__ );
1841
+ // strip out existing @import lines
1842
+ $header = preg_replace( '#\@import\s+url\(.+?\);\s*#s', '', $header );
1843
+ // parse header line by line
1844
+ $headerdata = explode( "\n", $header );
1845
+ $in_comment = 0;
1846
+ $found_header = 0;
1847
+ $headerdone = 0;
1848
+ $newheader = '';
1849
+ if ( $headerdata ):
1850
+ $this->debug( 'parsing header...', __FUNCTION__ );
1851
+ foreach ( $headerdata as $n => $headerline ):
1852
+ preg_match_all("/(\*\/|\/\*)/", $headerline, $matches );
1853
+ if ( $matches ):
1854
+ foreach ( $matches[1] as $token ):
1855
+ if ( '/*' == $token ):
1856
+ $in_comment = 1;
1857
+ elseif ( '*/' == $token ):
1858
+ $in_comment = 0;
1859
+ endif;
1860
+ endforeach;
1861
+ endif;
1862
+ if ( $in_comment ):
1863
+ $this->debug( 'in comment', __FUNCTION__ );
1864
+ if ( preg_match( $regex, $headerline, $matches ) && !empty( $matches[ 1 ] ) ):
1865
+ $found_header = 1;
1866
+ $key = $matches[ 1 ];
1867
+ $this->debug( 'found header: ' . $key, __FUNCTION__ );
1868
+ if ( array_key_exists( $key, $child_headers ) ):
1869
+ $this->debug( 'child header value exists: ', __FUNCTION__ );
1870
+ $value = trim( $child_headers[ $key ] );
1871
+ unset( $child_headers[ $key ] );
1872
+ if ( $value ):
1873
+ $this->debug( 'setting ' . $key . ' to ' . $value, __FUNCTION__ );
1874
+ $count = 0;
1875
+ $headerline = preg_replace(
1876
+ $regex,
1877
+ ( empty( $value ) ? '' : $key . ': ' . $value ),
1878
+ $headerline
1879
+ );
1880
+ else:
1881
+ $this->debug( 'removing ' . $key, __FUNCTION__ );
1882
+ continue;
1883
+ endif;
1884
+ endif;
1885
+ endif;
1886
+ $newheader .= $headerline . LF;
1887
+ elseif ( $found_header && !$headerdone ): // we have gone in and out of header block; insert any remaining parameters
1888
+ $this->debug( 'not in comment and after header', __FUNCTION__ );
1889
+ foreach ( $child_headers as $key => $value ):
1890
+ $this->debug( 'inserting ' . $key . ': ' . $value, __FUNCTION__ );
1891
+ if ( empty( $value ) ) continue;
1892
+ $newheader .= $key . ': ' . trim( $value ) . "\n";
1893
+ endforeach;
1894
+ // if importing parent, add after this line
1895
+ $newheader .= $headerline . "\n" . $this->css->get_css_imports();
1896
+ $headerdone = 1;
1897
+ else:
1898
+ $this->debug( 'not in comment', __FUNCTION__ );
1899
+ $newheader .= $headerline . LF;
1900
+ endif;
1901
+ endforeach;
1902
+ $this->debug( 'new header: ' . LF . $newheader, __FUNCTION__ );
1903
+ if ( !$found_header ) return FALSE;
1904
+ endif;
1905
+ $contents = $newheader . $contents;
1906
+ if ( FALSE === $wp_filesystem->put_contents( $fspath, $contents ) ):
1907
+ //$this->debug( 'Filesystem write to ' . $fspath . ' failed.', __FUNCTION__ );
1908
+ else:
1909
+ //$this->debug( 'Filesystem write to ' . $fspath . ' successful.', __FUNCTION__ );
1910
+ endif;
1911
+ //die( '<pre><code>' . $contents . '</code></pre>');
1912
+ }
1913
+
1914
+ function max_styles_notice() {
1915
+ $this->ui->notices( 'max_styles' );
1916
+ }
1917
+
1918
+ function config_notice() {
1919
+ $this->ui->notices( 'config' );
1920
+ }
1921
+
1922
+ function writable_notice() {
1923
+ $this->ui->notices( 'writable' );
1924
+ }
1925
+
1926
+ function enqueue_notice() {
1927
+ $this->ui->notices( 'enqueue' );
1928
+ }
1929
+
1930
+ function owner_notice() {
1931
+ $this->ui->notices( 'owner' );
1932
+ }
1933
+
1934
+ function changed_notice() {
1935
+ $this->ui->notices( 'changed' );
1936
+ }
1937
+
1938
+ function upgrade_notice() {
1939
+ $this->ui->notices( 'upgrade' );
1940
+ }
1941
+
1942
+ function get_child_stylesheet() {
1943
+ $handling = $this->get( 'handling' );
1944
+ if ( 'separate' == $handling )
1945
+ return 'ctc-style.css';
1946
+ elseif ( $this->reset )
1947
+ return FALSE;
1948
+ else
1949
+ return 'style.css';
1950
+ }
1951
+ /**
1952
+ * for themes with hard-coded stylesheets,
1953
+ * change references to stylesheet_uri to template_directory_uri
1954
+ * and move wp_head to end of head if possible
1955
+ */
1956
+ function repair_header() {
1957
+ // return if no flaws detected
1958
+ if ( ! $this->get( 'cssunreg' ) && !$this->get( 'csswphead' ) ) return;
1959
+ $this->debug( 'repairing parent header', __FUNCTION__ );
1960
+ // try to copy from parent
1961
+ $this->copy_parent_file( 'header' );
1962
+ // try to backup child header template
1963
+ $this->backup_or_restore_file( 'header.php' );
1964
+ // fetch current header template
1965
+ global $wp_filesystem;
1966
+ $cssstr = "get_template_directory_uri()";
1967
+ $wphstr = '<?php // MODIFIED BY CTC' . LF . 'wp_head();' . LF . '?>' . LF . '</head>';
1968
+ $filename = $this->css->get_child_target( 'header.php' );
1969
+ $contents = $wp_filesystem->get_contents( $this->fspath( $filename ) );
1970
+
1971
+ // change hard-wired stylesheet link so it loads parent theme instead
1972
+ if ( $this->get( 'cssunreg' ) || $this->get( 'csswphead' ) ):
1973
+ $repairs = 0;
1974
+ $contents = preg_replace( "#(get_bloginfo\(\s*['\"]stylesheet_url['\"]\s*\)|get_stylesheet_uri\(\s*\))#s", $cssstr . ' . "/style.css"', $contents, -1, $count );
1975
+ $repairs += $count;
1976
+ $contents = preg_replace( "#([^_])bloginfo\(\s*['\"]stylesheet_url['\"]\s*\)#s", "$1echo " . $cssstr . ' . "/style.css"', $contents, -1, $count );
1977
+ $repairs += $count;
1978
+ $contents = preg_replace( "#([^_])bloginfo\(\s*['\"]stylesheet_directory['\"]\s*\)#s", "$1echo " . $cssstr, $contents, -1, $count );
1979
+ $repairs += $count;
1980
+ $contents = preg_replace( "#(trailingslashit\()?(\s*)get_stylesheet_directory_uri\(\s*\)(\s*\))?\s*\.\s*['\"]\/?([\w\-\.\/]+?)\.css['\"]#s",
1981
+ "$2echo $cssstr . '$3.css'", $contents, -1, $count );
1982
+ $repairs += $count;
1983
+ if ( $repairs )
1984
+ $this->css->set_prop( 'parntloaded', TRUE );
1985
+ endif;
1986
+
1987
+ // put wp_head() call at the end of <head> section where it belongs
1988
+ if ( $this->get( 'csswphead' ) ):
1989
+ $contents = preg_replace( "#wp_head\(\s*\)\s*;#s", '', $contents );
1990
+ $contents = preg_replace( "#</head>#s", $wphstr, $contents );
1991
+ $contents = preg_replace( "#\s*<\?php\s*\?>\s*#s", LF, $contents ); // clean up
1992
+ endif;
1993
+
1994
+ // write new header template to child theme
1995
+ $this->debug( 'Writing to filesystem: ' . $filename . LF . $contents, __FUNCTION__ );
1996
+ if ( FALSE === $wp_filesystem->put_contents( $this->fspath( $filename ), $contents ) ):
1997
+ $this->debug( 'Filesystem write failed, returning.', __FUNCTION__ );
1998
+ return FALSE;
1999
+ endif;
2000
+ //die( '<textarea>' . $contents . '</textarea>' );
2001
+ }
2002
+
2003
+ /**
2004
+ * Evaluate signals collected from theme preview and set configuration accordingly
2005
+ */
2006
+ function evaluate_signals() {
2007
+ if ( !isset( $_POST[ 'ctc_analysis' ] ) ) return;
2008
+ $analysis = json_decode( urldecode( $_POST[ 'ctc_analysis' ] ) );
2009
+ //die( print_r( $analysis, TRUE ) );
2010
+ // stylesheets loaded outside wp_styles queue
2011
+ $unregs = array( 'thm_past_wphead', 'thm_unregistered', 'dep_unregistered', 'css_past_wphead', 'dep_past_wphead' );
2012
+ //echo '<pre><code>' . print_r( $analysis, TRUE ) . "</code></pre>\n";
2013
+
2014
+ // if this is a self-contained child theme ( e.g., Genesis ) use child as baseline
2015
+ $baseline = $this->get( 'ignoreparnt' ) ? 'child' : 'parnt';
2016
+ $this->debug( 'baseline: ' . $baseline, __FUNCTION__ );
2017
+ $this->css->parnt_deps = array();
2018
+ $this->css->child_deps = array();
2019
+ $this->css->addl_css = array();
2020
+
2021
+ // store stylesheet dependencies
2022
+ if ( isset( $analysis->{ $baseline } ) && isset( $analysis->{ $baseline }->deps ) ):
2023
+ foreach ( $analysis->{ $baseline }->deps[ 0 ] as $deparray ):
2024
+ if ( !in_array( $deparray[ 0 ], $unregs ) ):
2025
+ $this->css->parnt_deps[] = $deparray[ 0 ];
2026
+ endif;
2027
+ if ( !preg_match( "/^style([\-\.]min)?\.css$/", $deparray[ 1 ] ) ):
2028
+ $this->css->addl_css[] = sanitize_text_field( $deparray[ 1 ] );
2029
+ endif;
2030
+ endforeach;
2031
+ foreach ( $analysis->{ $baseline }->deps[ 1 ] as $deparray ):
2032
+ if ( !in_array( $deparray[ 0 ], $unregs ) ):
2033
+ $this->css->child_deps[] = $deparray[ 0 ];
2034
+ endif;
2035
+ if ( 'separate' == $this->get( 'handling' ) || !empty( $analysis->{ $baseline }->signals->ctc_child_loaded ) ):
2036
+ if ( !preg_match( "/^style([\-\.]min)?\.css$/", $deparray[ 1 ] ) ):
2037
+ $this->css->addl_css[] = sanitize_text_field( $deparray[ 1 ] );
2038
+ endif;
2039
+ endif;
2040
+ endforeach;
2041
+ endif;
2042
+ // store parent theme signals
2043
+ if ( isset( $analysis->{ $baseline }->signals ) ):
2044
+ $this->css->set_prop( 'hasstyles', isset( $analysis->{ $baseline }->signals->thm_has_styles ) ? 1 : 0 );
2045
+ $this->css->set_prop( 'csswphead', isset( $analysis->{ $baseline }->signals->thm_past_wphead ) ? 1 : 0 );
2046
+ $this->css->set_prop( 'cssunreg', isset( $analysis->{ $baseline }->signals->thm_unregistered ) ? 1 : 0 );
2047
+ endif;
2048
+ if ( isset( $analysis->child->signals ) ):
2049
+ // test these again for child theme
2050
+ $this->css->set_prop( 'csswphead', isset( $analysis->child->signals->thm_past_wphead ) ? 1 : 0 );
2051
+ $this->css->set_prop( 'cssunreg', isset( $analysis->child->signals->thm_unregistered ) ? 1 : 0 );
2052
+ // special case where theme does not link child stylesheet at all
2053
+ $this->css->set_prop( 'cssnotheme', isset( $analysis->child->signals->thm_notheme ) ? 1 : 0 );
2054
+ $this->css->set_prop( 'childloaded', isset( $analysis->child->signals->thm_child_loaded ) ? $analysis->child->signals->thm_child_loaded : 0 );
2055
+ // if theme loads parent theme when is_child_theme, add child dependency
2056
+ if ( isset( $analysis->child->signals->thm_parnt_loaded ) ):
2057
+ $this->css->set_prop( 'parntloaded', $analysis->child->signals->thm_parnt_loaded );
2058
+ if ( 'thm_unregistered' != $analysis->child->signals->thm_parnt_loaded ):
2059
+ array_unshift( $this->css->child_deps, $analysis->child->signals->thm_parnt_loaded );
2060
+ endif;
2061
+ else:
2062
+ $this->css->set_prop( 'parntloaded', 0 );
2063
+ endif;
2064
+ // if main styleheet is loading out of sequence, force dependency
2065
+ if ( isset( $analysis->child->signals->ctc_parnt_reorder ) )
2066
+ $this->reorder = TRUE;
2067
+ // roll back CTC Pro Genesis handling option
2068
+ if ( isset( $analysis->child->signals->ctc_gen_loaded ) )
2069
+ $this->genesis = TRUE;
2070
+ endif;
2071
+ }
2072
+ /**
2073
+ * Future use
2074
+ *
2075
+ function get_real_limit(){
2076
+ // sel_limit is now calculated based on free memory to prevent out of memory on serialization
2077
+ $this->mem_limit = $this->get_free_memory();
2078
+ $this->sel_limit = ( int ) ( $this->bytes_free / CHLD_THM_CFG_BPSEL );
2079
+ $this->debug( 'Free memory: ' . $this->bytes_free . ' max selectors: ' . $this->sel_limit, __FUNCTION__ );
2080
+ //$this->set_benchmark( 'before', 'execute', 'program' );
2081
+ $divisor = 1024 * 1024;
2082
+ }
2083
+ */
2084
+ }
includes/class-ctc-css.php CHANGED
@@ -6,7 +6,7 @@ if ( !defined( 'ABSPATH' ) ) exit;
6
  Class: ChildThemeConfiguratorCSS
7
  Plugin URI: http://www.childthemeconfigurator.com/
8
  Description: Handles all CSS input, output, parsing, normalization and storage
9
- Version: 1.7.8
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
@@ -15,6 +15,7 @@ if ( !defined( 'ABSPATH' ) ) exit;
15
  Copyright (C) 2014-2015 Lilaea Media
16
  */
17
  class ChildThemeConfiguratorCSS {
 
18
  // data dictionaries
19
  var $dict_query; // @media queries and 'base'
20
  var $dict_sel; // selectors
@@ -31,17 +32,25 @@ class ChildThemeConfiguratorCSS {
31
  var $selkey; // counter for dict_sel
32
  var $rulekey; // counter for dict_rule
33
  var $valkey; // counter for dict_val
34
- // miscellaneous properties
35
- var $imports; // @import rules
36
- var $styles; // temporary update cache
37
  var $child; // child theme slug
38
  var $parnt; // parent theme slug
39
  var $configtype; // legacy plugin slug
40
- var $addl_css; // parent additional stylesheets
41
- var $recent; // history of edited styles
42
- var $enqueue; // load parent css method (enqueue, import, none)
43
- var $converted; // @imports coverted to <link>?
44
- var $nowarn; // ignore stylesheet handling warnings
 
 
 
 
 
 
 
 
 
45
  var $child_name; // child theme name
46
  var $child_author; // child theme author
47
  var $child_authoruri; // child theme author website
@@ -49,7 +58,15 @@ class ChildThemeConfiguratorCSS {
49
  var $child_descr; // child theme description
50
  var $child_tags; // child theme tags
51
  var $child_version; // stylesheet version
 
 
 
 
 
 
 
52
  var $max_sel;
 
53
  var $temparray;
54
  var $vendorrule = array(
55
  'box\-sizing',
@@ -69,12 +86,18 @@ class ChildThemeConfiguratorCSS {
69
  );
70
  var $configvars = array(
71
  'addl_css',
72
- // the enqueue flag prevents the transition from 1.5.4
73
- // from breaking the stylesheet by forcing the user to regenerate
74
- // the config data before updating the stylesheet. Otherwise,
75
- // removing the @import for the parent stylesheet will cause
76
- // the parent core styles to be missing.
77
- 'enqueue',
 
 
 
 
 
 
78
  'max_sel',
79
  'imports',
80
  'child_version',
@@ -94,7 +117,7 @@ class ChildThemeConfiguratorCSS {
94
  'querykey',
95
  'recent',
96
  'converted',
97
- 'nowarn',
98
  );
99
  var $dicts = array(
100
  'dict_qs',
@@ -114,9 +137,8 @@ class ChildThemeConfiguratorCSS {
114
  $this->qskey = 0;
115
  $this->rulekey = 0;
116
  $this->valkey = 0;
117
- $this->child = '';
118
- $this->parnt = '';
119
- $this->configtype = 'theme'; // legacy support
120
  $this->child_name = '';
121
  $this->child_author = 'Child Theme Configurator';
122
  $this->child_themeuri = '';
@@ -124,9 +146,20 @@ class ChildThemeConfiguratorCSS {
124
  $this->child_descr = '';
125
  $this->child_tags = '';
126
  $this->child_version = '1.0';
127
- $this->max_sel = 0;
 
 
 
 
 
 
128
 
129
  // multi-dim arrays
 
 
 
 
 
130
  $this->dict_qs = array();
131
  $this->dict_sel = array();
132
  $this->dict_query = array();
@@ -135,9 +168,6 @@ class ChildThemeConfiguratorCSS {
135
  $this->dict_seq = array();
136
  $this->sel_ndx = array();
137
  $this->val_ndx = array();
138
- $this->addl_css = array();
139
- $this->recent = array();
140
- $this->imports = array( 'child' => array(), 'parnt' => array() );
141
  }
142
 
143
  // helper function to globalize ctc object
@@ -154,10 +184,12 @@ class ChildThemeConfiguratorCSS {
154
  if ( isset( $configarray[ $configkey ] ) )
155
  $this->{$configkey} = $configarray[ $configkey ];
156
  endforeach;
157
- $this->ctc()->debug( 'configvars: ' . print_r( $configarray, TRUE ), __FUNCTION__ );
158
  foreach ( $this->dicts as $configkey ):
159
- if ( ( $configarray = get_site_option( $option . '_' . $configkey ) ) && count( $configarray ) )
160
- $this->{$configkey} = $configarray;
 
 
161
  endforeach;
162
  else:
163
  return FALSE;
@@ -166,6 +198,8 @@ class ChildThemeConfiguratorCSS {
166
 
167
  // writes ctc config data to options api
168
  function save_config( $override = NULL ) {
 
 
169
  global $wpdb;
170
  if ( isset( $override ) ) $option = $override;
171
  else $option = apply_filters( 'chld_thm_cfg_option', '' );
@@ -173,46 +207,49 @@ class ChildThemeConfiguratorCSS {
173
  //echo 'saving option: ' . $option . LF;
174
  $configarray = array();
175
  foreach ( $this->configvars as $configkey )
176
- $configarray[ $configkey ] = $this->{$configkey};
177
- $this->ctc()->debug( 'configvars: ' . print_r( $configarray, TRUE ), __FUNCTION__ );
178
  if ( is_multisite() ):
179
  update_site_option( $option . '_configvars', $configarray );
180
  else:
181
- update_option( $option . '_configvars', $configarray, FALSE );
182
  // do not autoload ( passing false above only works if value changes
183
- // we have to turn off autoload for all existing options )
184
- $result = $wpdb->update(
185
- // SET 'autoload' = 'no'
186
- $wpdb->options, array( 'autoload' => 'no' ),
187
- // WHERE option_name = ?
188
- array( 'option_name' => $option . '_configvars' )
189
- );
190
  endif;
191
  foreach ( $this->dicts as $configkey ):
 
192
  if ( is_multisite() ):
193
  update_site_option( $option . '_' . $configkey, $this->{$configkey} );
194
  else:
195
- update_option( $option . '_' . $configkey, $this->{$configkey}, FALSE );
196
  // do not autoload ( passing false above only works if value changes
197
- // we have to turn off autoload for all existing options )
198
- $result = $wpdb->update(
199
- // SET 'autoload' = 'no'
200
- $wpdb->options, array( 'autoload' => 'no' ),
201
- // WHERE option_name = ?
202
- array( 'option_name' => $option . '_' . $configkey )
203
- );
204
  endif;
205
  endforeach;
206
  }
207
-
 
 
 
 
 
 
 
 
 
208
  /**
209
  * get_prop
210
  * Getter interface (data sliced different ways depending on objname )
211
  */
212
- function get_prop( $objname, $params = NULL ) {
213
- switch ( $objname ):
 
 
 
 
 
 
214
  case 'imports':
215
- return $this->obj_to_utf8( is_array( $this->imports[ 'child' ] ) ?
 
216
  ( current( $this->imports[ 'child' ] ) == 1 ?
217
  array_keys( $this->imports[ 'child' ] ) :
218
  array_keys( array_flip( $this->imports[ 'child' ] ) ) ) :
@@ -234,33 +271,57 @@ class ChildThemeConfiguratorCSS {
234
  array() : $this->obj_to_utf8( $this->denorm_sel_val( $params[ 'key' ] ) );
235
  case 'rules':
236
  ksort( $this->dict_rule );
237
- return $this->obj_to_utf8( $this->dict_rule );;
238
  case 'child':
239
  return $this->child;
240
  case 'parnt':
241
  return $this->parnt;
242
  case 'configtype': // legacy plugin extension support
243
  return $this->configtype;
 
 
244
  case 'addl_css':
245
- return isset( $this->addl_css ) ? $this->addl_css : array();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
246
  case 'child_name':
247
- return $this->child_name;
248
  case 'author':
249
- return $this->child_author;
250
  case 'themeuri':
251
  return isset( $this->child_themeuri ) ? $this->child_themeuri : FALSE;
252
  case 'authoruri':
253
  return isset( $this->child_authoruri ) ? $this->child_authoruri : FALSE;
254
  case 'descr':
255
- return isset( $this->child_descr ) ? $this->child_descr : FALSE;
256
  case 'tags':
257
- return isset( $this->child_tags ) ? $this->child_tags : FALSE;
258
  case 'version':
259
  return $this->child_version;
260
  case 'preview':
261
  $this->styles = '';
262
  if ( empty( $params[ 'key' ] ) || 'child' == $params[ 'key' ] ):
263
- $this->read_stylesheet( 'child' );
264
  else:
265
  if ( isset( $this->addl_css ) ):
266
  foreach ( $this->addl_css as $file ):
@@ -269,18 +330,22 @@ class ChildThemeConfiguratorCSS {
269
  $this->styles .= '/*** END ' . $file . ' ***/' . LF;
270
  endforeach;
271
  endif;
272
- list ( $template, $file ) = apply_filters( 'chld_thm_cfg_parent_preview_args', array( 'parnt', 'style.css' ) );
273
- if ( $this->ctc()->is_theme() || $this->ctc()->is_legacy() ):
274
- $this->styles .= '/*** BEGIN ' . $file . ' ***/' . LF;
275
- $this->read_stylesheet( $template, $file );
276
- $this->styles .= '/*** END ' . $file . ' ***/' . LF;
 
 
 
 
277
  endif;
278
  endif;
279
  $this->normalize_css();
280
  return $this->styles;
281
  break;
282
  default:
283
- return $this->obj_to_utf8( apply_filters( 'chld_thm_get_prop', NULL, $objname, $params ) );
284
  endswitch;
285
  return FALSE;
286
  }
@@ -289,9 +354,9 @@ class ChildThemeConfiguratorCSS {
289
  * set_prop
290
  * Setter interface (scalar values only)
291
  */
292
- function set_prop( $prop, $value ) {
293
- if ( is_null( $this->{ $prop } ) || is_scalar( $this->{ $prop } ) )
294
- $this->{ $prop } = $value;
295
  else return FALSE;
296
  }
297
 
@@ -305,31 +370,64 @@ class ChildThemeConfiguratorCSS {
305
  endif;
306
  }
307
 
 
 
 
 
 
 
 
308
  // creates header comments for stylesheet
309
  function get_css_header() {
310
- $parnt = $this->get_prop( 'parnt' );
311
- return '/*' . LF
312
- . 'Theme Name: ' . $this->get_prop( 'child_name' ) . LF
313
- . ( ( $attr = $this->get_prop( 'themeuri' ) ) ? 'Theme URI: ' . $attr . LF : '' )
314
- . 'Template: ' . $parnt . LF
315
- . 'Author: ' . $this->get_prop( 'author' ) . LF
316
- . ( ( $attr = $this->get_prop( 'authoruri' ) ) ? 'Author URI: ' . $attr . LF : '' )
317
- . ( ( $attr = $this->get_prop( 'descr' ) ) ? 'Description: ' . $attr . LF : '' )
318
- . ( ( $attr = $this->get_prop( 'tags' ) ) ? 'Tags: ' . $attr . LF : '' )
319
- . 'Version: ' . $this->get_prop( 'version' ) . '.' . time() . LF
320
- . 'Updated: ' . current_time( 'mysql' ) . LF
321
- . '*/' . LF . LF . '@charset "UTF-8";' . LF . LF
322
- . ( 'import' == $this->enqueue ? '@import url(\'../' . $parnt . '/style.css\');' . LF : '' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
323
  }
324
 
325
  // formats file path for child theme file
326
- function get_child_target( $file = 'style.css' ) {
327
- return trailingslashit( get_theme_root() ) . trailingslashit( $this->get_prop( 'child' ) ) . $file;
328
  }
329
 
330
  // formats file path for parent theme file
331
- function get_parent_source( $file = 'style.css' ) {
332
- return trailingslashit( get_theme_root() ) . trailingslashit( $this->get_prop( 'parnt' ) ) . $file;
333
  }
334
 
335
  /**
@@ -356,12 +454,15 @@ class ChildThemeConfiguratorCSS {
356
  $q = $this->get_dict_id( 'query', $query );
357
  $s = $this->get_dict_id( 'sel', $sel );
358
  if ( !isset( $this->sel_ndx[ $q ][ $s ] ) ):
359
- // stop parsing if limit is reached to prevent out of memory on serialize
 
 
360
  if ( $this->qskey >= $this->ctc()->sel_limit ):
361
  $this->max_sel = 1;
362
  $this->ctc()->debug( 'Maximum num selectors reached ( limit: ' . $this->ctc()->sel_limit . ' )', __FUNCTION__ );
363
  return FALSE;
364
  endif;
 
365
  // increment key number
366
  $this->sel_ndx[ $q ][ $s ] = ++$this->qskey;
367
  $this->dict_qs[ $this->qskey ][ 's' ] = $s;
@@ -400,7 +501,7 @@ class ChildThemeConfiguratorCSS {
400
  $rulevalid = NULL,
401
  $reset = FALSE
402
  ) {
403
- if ( $this->max_sel ) return;
404
  if ( FALSE === strpos( $query, '@' ) ):
405
  $query = 'base';
406
  endif;
@@ -455,7 +556,7 @@ class ChildThemeConfiguratorCSS {
455
  endif;
456
  }
457
 
458
- /*
459
  * rule_value_exists
460
  * Determine if a value already exists for a property
461
  * and return its id
@@ -469,7 +570,7 @@ class ChildThemeConfiguratorCSS {
469
  return FALSE;
470
  }
471
 
472
- /*
473
  * get_rule_value_id
474
  * Generate a new rulevalid by iterating existing ids
475
  * and returning the next in sequence
@@ -481,7 +582,7 @@ class ChildThemeConfiguratorCSS {
481
  return $newid;
482
  }
483
 
484
- /*
485
  * update_rule_value
486
  * Generate a new value subarray
487
  */
@@ -493,7 +594,7 @@ class ChildThemeConfiguratorCSS {
493
  );
494
  }
495
 
496
- /*
497
  * unset_rule_value
498
  * Delete (splice) old value subarray from values
499
  */
@@ -509,7 +610,7 @@ class ChildThemeConfiguratorCSS {
509
  endforeach;
510
  }
511
 
512
- /*
513
  * prune_if_empty
514
  * Automatically cleans up hierarchies when no values exist
515
  * in either parent or child for a given selector.
@@ -589,6 +690,18 @@ class ChildThemeConfiguratorCSS {
589
  $this->imports[ 'child' ] = array();
590
  $this->styles = $this->parse_css_input( $_POST[ 'ctc_child_imports' ] );
591
  $this->parse_css( 'child' );
 
 
 
 
 
 
 
 
 
 
 
 
592
  elseif ( isset( $_POST[ 'ctc_configtype' ] ) ):
593
  ob_start();
594
  do_action( 'chld_thm_cfg_get_stylesheets' );
@@ -648,7 +761,7 @@ class ChildThemeConfiguratorCSS {
648
  $important,
649
  $rulevalid
650
  );
651
- // clear the original selector's child value:
652
  $this->update_arrays(
653
  'child',
654
  $selarr[ 'query' ],
@@ -728,7 +841,7 @@ class ChildThemeConfiguratorCSS {
728
  $rule_part[ 'important' ],
729
  $rulevalid
730
  );
731
- // clear the original selector's child value:
732
  $this->update_arrays(
733
  'child',
734
  $rule_arr[ 'query' ],
@@ -773,7 +886,7 @@ class ChildThemeConfiguratorCSS {
773
  endif;
774
 
775
  // update enqueue function if imports have not been converted or new imports passed
776
- if ( isset( $_POST[ 'ctc_child_imports' ] ) || empty( $this->converted ) )
777
  add_action( 'chld_thm_cfg_addl_files', array( $this->ctc(), 'enqueue_parent_css' ), 15, 2 );
778
  }
779
 
@@ -787,7 +900,7 @@ class ChildThemeConfiguratorCSS {
787
 
788
  // strips non printables and potential commands
789
  function sanitize( $styles ) {
790
- return sanitize_text_field( preg_replace( '/[^[:print:]]/', '', $styles ) );
791
  }
792
 
793
  // escapes octal values in input to allow for specific ascii strings in content rule
@@ -806,11 +919,15 @@ class ChildThemeConfiguratorCSS {
806
  */
807
  function parse_css_file( $template, $file = 'style.css', $cfgtemplate = FALSE ) {
808
  if ( '' == $file ) $file = 'style.css';
809
- // have we run out of memory?
 
 
 
810
  if ( $this->max_sel ):
811
- $this->ctc()->debug( 'Insufficient memory to parse file.', __FUNCTION__ );
812
  return FALSE;
813
  endif;
 
814
  // turn off caching when parsing files to reduce memory usage
815
  $this->ctc()->cache_updates = FALSE;
816
  $this->styles = ''; // reset styles
@@ -845,12 +962,15 @@ class ChildThemeConfiguratorCSS {
845
  // read stylesheet
846
 
847
  if ( $stylesheet_verified = $this->is_file_ok( $stylesheet, 'read' ) ):
848
- // make sure we have space to parse
 
 
849
  if ( filesize( $stylesheet_verified ) * 3 > $this->ctc()->get_free_memory() ):
850
  $this->max_sel = 1;
851
- $this->ctc()->debug( 'Insufficient memory to read file', __FUNCTION__ );
852
  return;
853
  endif;
 
854
  $this->styles .= @file_get_contents( $stylesheet_verified ) . "\n";
855
  //echo 'count after get contents: ' . strlen( $this->styles ) . LF;
856
  else:
@@ -1026,14 +1146,12 @@ class ChildThemeConfiguratorCSS {
1026
  * New selectors are appended to the end of each media query block.
1027
  * FIXME - this function has grown too monolithic - refactor and componentize
1028
  */
1029
- function write_css( $backup = FALSE ) {
1030
- // write new stylesheet
1031
- $output = apply_filters( 'chld_thm_cfg_css_header', $this->get_css_header(), $this );
1032
  // turn the dictionaries into indexes (value => id into id => value):
1033
  $rulearr = array_flip( $this->dict_rule );
1034
  $valarr = array_flip( $this->dict_val );
1035
  $selarr = array_flip( $this->dict_sel );
1036
-
1037
  foreach ( $this->sort_queries() as $query => $sort_order ):
1038
  $has_selector = 0;
1039
  $sel_output = '';
@@ -1089,30 +1207,23 @@ class ChildThemeConfiguratorCSS {
1089
  if ( 'base' != $query ) $sel_output .= '}' . LF;
1090
  if ( $has_selector ) $output .= $sel_output;
1091
  endforeach;
1092
- $stylesheet = apply_filters( 'chld_thm_cfg_target', $this->get_child_target(), $this );
1093
- //echo 'writing stylesheet: ' . $stylesheet . LF;
 
1094
  //echo //print_r(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS), true) . LF;
1095
  if ( $stylesheet_verified = $this->is_file_ok( $stylesheet, 'write' ) ):
1096
  global $wp_filesystem; // this was initialized earlier;
1097
- // backup current stylesheet
1098
- if ( $backup && is_file( $stylesheet_verified ) ):
1099
- $timestamp = date( 'YmdHis', current_time( 'timestamp' ) );
1100
- $bakfile = preg_replace( "/\.css$/", '', $stylesheet_verified ) . '-' . $timestamp . '.css';
1101
- // don't write new stylesheet if backup fails
1102
- if ( !$wp_filesystem->copy(
1103
- $this->ctc()->fspath( $stylesheet_verified ),
1104
- $this->ctc()->fspath( $bakfile ) ) ) return FALSE;
1105
- endif;
1106
  // write new stylesheet:
1107
  // try direct write first, then wp_filesystem write
1108
  // stylesheet must already exist and be writable by web server
1109
  if ( $this->ctc()->is_ajax && is_writable( $stylesheet_verified ) ):
1110
  if ( FALSE === @file_put_contents( $stylesheet_verified, $output ) ):
1111
- $this->debug( 'Ajax write failed.', __FUNCTION__ );
1112
  return FALSE;
1113
  endif;
1114
- elseif ( FALSE === $wp_filesystem->put_contents( $this->ctc()->fspath( $stylesheet_verified ), $output ) ):
1115
- $this->debug( 'Filesystem write failed.', __FUNCTION__ );
1116
  return FALSE;
1117
  endif;
1118
  return TRUE;
@@ -1465,7 +1576,7 @@ class ChildThemeConfiguratorCSS {
1465
  /**
1466
  * denorm_rule_val
1467
  * Return array of unique values corresponding to specific rule
1468
- * FIXME: only return child if no parent value exists
1469
  */
1470
  function denorm_rule_val( $ruleid ) {
1471
  $rule_sel_arr = array();
@@ -1488,7 +1599,7 @@ class ChildThemeConfiguratorCSS {
1488
  * denorm_val_query
1489
  * Return array of queries, selectors, rules, and values corresponding to
1490
  * specific rule/value combo grouped by query, selector
1491
- * FIXME: only return child values corresponding to specific rulevalid of matching parent value
1492
  */
1493
  function denorm_val_query( $valid, $rule ) {
1494
  $value_query_arr = array();
@@ -1702,6 +1813,7 @@ class ChildThemeConfiguratorCSS {
1702
  /**
1703
  * is_file_ok
1704
  * verify file exists and is in valid location
 
1705
  */
1706
  function is_file_ok( $stylesheet, $permission = 'read' ) {
1707
  // remove any ../ manipulations
6
  Class: ChildThemeConfiguratorCSS
7
  Plugin URI: http://www.childthemeconfigurator.com/
8
  Description: Handles all CSS input, output, parsing, normalization and storage
9
+ Version: 2.0.0
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
15
  Copyright (C) 2014-2015 Lilaea Media
16
  */
17
  class ChildThemeConfiguratorCSS {
18
+
19
  // data dictionaries
20
  var $dict_query; // @media queries and 'base'
21
  var $dict_sel; // selectors
32
  var $selkey; // counter for dict_sel
33
  var $rulekey; // counter for dict_rule
34
  var $valkey; // counter for dict_val
35
+
36
+ // from parent/child form
 
37
  var $child; // child theme slug
38
  var $parnt; // parent theme slug
39
  var $configtype; // legacy plugin slug
40
+ var $handling; // child stylesheet handling option
41
+ var $enqueue; // whether or not to load parent theme
42
+ var $ignoreparnt; // no not parse or enqueue parent
43
+ var $hasstyles;
44
+ var $parntloaded;
45
+ var $childloaded;
46
+ var $parnt_deps; //
47
+ var $child_deps; //
48
+ var $addl_css;
49
+ var $cssunreg;
50
+ var $csswphead;
51
+ var $cssnotheme;
52
+
53
+ // header settings
54
  var $child_name; // child theme name
55
  var $child_author; // child theme author
56
  var $child_authoruri; // child theme author website
58
  var $child_descr; // child theme description
59
  var $child_tags; // child theme tags
60
  var $child_version; // stylesheet version
61
+
62
+ // miscellaneous properties
63
+ var $fsize; // used to check if styles changed since last update
64
+ var $converted; // @imports coverted to <link>?
65
+ var $templates; // cache of parent template files
66
+ var $imports; // @import rules
67
+ var $recent; // history of edited styles
68
  var $max_sel;
69
+ var $styles; // temporary update cache
70
  var $temparray;
71
  var $vendorrule = array(
72
  'box\-sizing',
86
  );
87
  var $configvars = array(
88
  'addl_css',
89
+ 'cssunreg',
90
+ 'csswphead',
91
+ 'cssnotheme',
92
+ 'parnt_deps',
93
+ 'child_deps',
94
+ 'hasstyles',
95
+ 'parntloaded',
96
+ 'childloaded',
97
+ 'ignoreparnt',
98
+ 'enqueue',
99
+ 'handling',
100
+ 'templates',
101
  'max_sel',
102
  'imports',
103
  'child_version',
117
  'querykey',
118
  'recent',
119
  'converted',
120
+ 'fsize',
121
  );
122
  var $dicts = array(
123
  'dict_qs',
137
  $this->qskey = 0;
138
  $this->rulekey = 0;
139
  $this->valkey = 0;
140
+ $this->max_sel = 0;
141
+
 
142
  $this->child_name = '';
143
  $this->child_author = 'Child Theme Configurator';
144
  $this->child_themeuri = '';
146
  $this->child_descr = '';
147
  $this->child_tags = '';
148
  $this->child_version = '1.0';
149
+
150
+ $this->configtype = 'theme'; // legacy support
151
+ $this->child = '';
152
+ $this->parnt = '';
153
+ $this->ignoreparnt = 0;
154
+
155
+ // do not set enqueue, not being set is used to flag old versions
156
 
157
  // multi-dim arrays
158
+ $this->templates = array();
159
+ $this->imports = array( 'child' => array(), 'parnt' => array() );
160
+
161
+ $this->recent = array();
162
+
163
  $this->dict_qs = array();
164
  $this->dict_sel = array();
165
  $this->dict_query = array();
168
  $this->dict_seq = array();
169
  $this->sel_ndx = array();
170
  $this->val_ndx = array();
 
 
 
171
  }
172
 
173
  // helper function to globalize ctc object
184
  if ( isset( $configarray[ $configkey ] ) )
185
  $this->{$configkey} = $configarray[ $configkey ];
186
  endforeach;
187
+ //$this->ctc()->debug( 'load_config vars: ' . print_r( $configarray, TRUE ), __FUNCTION__ );
188
  foreach ( $this->dicts as $configkey ):
189
+ if ( ( $configarray = get_site_option( $option . '_' . $configkey ) ) ):
190
+ if ( count( $configarray ) )
191
+ $this->{$configkey} = $configarray;
192
+ endif;
193
  endforeach;
194
  else:
195
  return FALSE;
198
 
199
  // writes ctc config data to options api
200
  function save_config( $override = NULL ) {
201
+ // set latest stylesheet size
202
+ $this->get_stylesheet_path();
203
  global $wpdb;
204
  if ( isset( $override ) ) $option = $override;
205
  else $option = apply_filters( 'chld_thm_cfg_option', '' );
207
  //echo 'saving option: ' . $option . LF;
208
  $configarray = array();
209
  foreach ( $this->configvars as $configkey )
210
+ $configarray[ $configkey ] = empty( $this->{$configkey} ) ? NULL : $this->{ $configkey };
211
+ //$this->ctc()->debug( 'save_config vars: ' . print_r( $configarray, TRUE ), __FUNCTION__ );
212
  if ( is_multisite() ):
213
  update_site_option( $option . '_configvars', $configarray );
214
  else:
 
215
  // do not autoload ( passing false above only works if value changes
216
+ update_option( $option . '_configvars', $configarray, FALSE );
 
 
 
 
 
 
217
  endif;
218
  foreach ( $this->dicts as $configkey ):
219
+
220
  if ( is_multisite() ):
221
  update_site_option( $option . '_' . $configkey, $this->{$configkey} );
222
  else:
 
223
  // do not autoload ( passing false above only works if value changes
224
+ update_option( $option . '_' . $configkey, $this->{$configkey}, FALSE );
 
 
 
 
 
 
225
  endif;
226
  endforeach;
227
  }
228
+
229
+ /**
230
+ * determine effective stylesheet path and measure size
231
+ */
232
+ function get_stylesheet_path() {
233
+ $stylesheet = apply_filters( 'chld_thm_cfg_target', $this->get_child_target( $this->ctc()->get_child_stylesheet() ), $this );
234
+ $this->fsize = filesize( $stylesheet );
235
+ $this->ctc()->debug( 'updated file size: ' . $this->fsize, __FUNCTION__ );
236
+ return $stylesheet;
237
+ }
238
  /**
239
  * get_prop
240
  * Getter interface (data sliced different ways depending on objname )
241
  */
242
+ function get_prop( $property, $params = NULL ) {
243
+ switch ( $property ):
244
+ case 'fsize':
245
+ return empty( $this->fsize ) ? FALSE : $this->fsize;
246
+ case 'converted':
247
+ return !empty( $this->converted );
248
+ case 'max_sel':
249
+ return empty( $this->max_sel ) ? FALSE : $this->max_sel;
250
  case 'imports':
251
+
252
+ return $this->obj_to_utf8( !empty( $this->imports[ 'child' ] ) && is_array( $this->imports[ 'child' ] ) ?
253
  ( current( $this->imports[ 'child' ] ) == 1 ?
254
  array_keys( $this->imports[ 'child' ] ) :
255
  array_keys( array_flip( $this->imports[ 'child' ] ) ) ) :
271
  array() : $this->obj_to_utf8( $this->denorm_sel_val( $params[ 'key' ] ) );
272
  case 'rules':
273
  ksort( $this->dict_rule );
274
+ return $this->obj_to_utf8( $this->dict_rule );
275
  case 'child':
276
  return $this->child;
277
  case 'parnt':
278
  return $this->parnt;
279
  case 'configtype': // legacy plugin extension support
280
  return $this->configtype;
281
+ case 'enqueue':
282
+ return empty( $this->enqueue ) ? FALSE : $this->enqueue;
283
  case 'addl_css':
284
+ return empty( $this->addl_css ) ? array() : $this->addl_css;
285
+ case 'parnt_deps':
286
+ return $this->quotify_prop( 'parnt_deps' );
287
+ case 'child_deps':
288
+ return $this->quotify_prop( 'child_deps' );
289
+ case 'templates':
290
+ return empty( $this->templates ) ? FALSE : $this->templates;
291
+ case 'ignoreparnt':
292
+ return empty( $this->ignoreparnt ) ? 0 : 1;
293
+ case 'parntloaded':
294
+ return empty( $this->parntloaded ) ? FALSE : $this->parntloaded;
295
+ case 'childloaded':
296
+ return empty( $this->childloaded ) ? FALSE : $this->childloaded;
297
+ case 'hasstyles':
298
+ return empty( $this->hasstyles ) ? 0 : 1;
299
+ case 'cssunreg':
300
+ return empty( $this->cssunreg ) ? 0 : 1;
301
+ case 'csswphead':
302
+ return empty( $this->csswphead ) ? 0 : 1;
303
+ case 'cssnotheme':
304
+ return empty( $this->cssnotheme ) ? 0 : 1;
305
+ case 'handling':
306
+ return empty( $this->handling ) ? 'primary' : $this->handling;
307
  case 'child_name':
308
+ return stripslashes( $this->child_name );
309
  case 'author':
310
+ return stripslashes( $this->child_author );
311
  case 'themeuri':
312
  return isset( $this->child_themeuri ) ? $this->child_themeuri : FALSE;
313
  case 'authoruri':
314
  return isset( $this->child_authoruri ) ? $this->child_authoruri : FALSE;
315
  case 'descr':
316
+ return isset( $this->child_descr ) ? stripslashes( $this->child_descr ) : FALSE;
317
  case 'tags':
318
+ return isset( $this->child_tags ) ? stripslashes( $this->child_tags ) : FALSE;
319
  case 'version':
320
  return $this->child_version;
321
  case 'preview':
322
  $this->styles = '';
323
  if ( empty( $params[ 'key' ] ) || 'child' == $params[ 'key' ] ):
324
+ $this->read_stylesheet( 'child', $this->ctc()->get_child_stylesheet() );
325
  else:
326
  if ( isset( $this->addl_css ) ):
327
  foreach ( $this->addl_css as $file ):
330
  $this->styles .= '/*** END ' . $file . ' ***/' . LF;
331
  endforeach;
332
  endif;
333
+ if ( $this->get_prop( 'hasstyles' ) && !$this->get_prop( 'ignoreparnt' ) ):
334
+ $this->styles .= '/*** BEGIN Parent style.css ***/' . LF;
335
+ $this->read_stylesheet( 'parnt', 'style.css' );
336
+ $this->styles .= '/*** END Parent style.css ***/' . LF;
337
+ endif;
338
+ if ( 'separate' == $this->get_prop( 'handling' ) ):
339
+ $this->styles .= '/*** BEGIN Child style.css ***/' . LF;
340
+ $this->read_stylesheet( 'child', 'style.css' );
341
+ $this->styles .= '/*** END Child style.css ***/' . LF;
342
  endif;
343
  endif;
344
  $this->normalize_css();
345
  return $this->styles;
346
  break;
347
  default:
348
+ return $this->obj_to_utf8( apply_filters( 'chld_thm_get_prop', NULL, $property, $params ) );
349
  endswitch;
350
  return FALSE;
351
  }
354
  * set_prop
355
  * Setter interface (scalar values only)
356
  */
357
+ function set_prop( $property, $value ) {
358
+ if ( is_null( $this->{ $property } ) || is_scalar( $this->{ $property } ) )
359
+ $this->{ $property } = $value;
360
  else return FALSE;
361
  }
362
 
370
  endif;
371
  }
372
 
373
+ function quotify_prop( $prop ) {
374
+ $arr = array();
375
+ if (!empty( $this->{$prop} ) && is_array( $this->{$prop} ) )
376
+ foreach ( $this->{$prop} as $el )
377
+ $arr[] = "'" . str_replace("'", "\'", $el ) . "'";
378
+ return $arr;
379
+ }
380
  // creates header comments for stylesheet
381
  function get_css_header() {
382
+ return array(
383
+ 'Theme Name' => $this->get_prop( 'child_name' ),
384
+ 'Theme URI' => ( ( $attr = $this->get_prop( 'themeuri' ) ) ? $attr : '' ),
385
+ 'Template' => $this->get_prop( 'parnt' ),
386
+ 'Author' => $this->get_prop( 'author' ),
387
+ 'Author URI' => ( ( $attr = $this->get_prop( 'authoruri' ) ) ? $attr : '' ),
388
+ 'Description' => ( ( $attr = $this->get_prop( 'descr' ) ) ? $attr : '' ),
389
+ 'Tags' => ( ( $attr = $this->get_prop( 'tags' ) ) ? $attr : '' ),
390
+ 'Version' => $this->get_prop( 'version' ) . '.' . time(),
391
+ 'Updated' => current_time( 'mysql' ),
392
+ );
393
+ }
394
+ function get_css_header_comment( $handling = 'primary' ) {
395
+ if ( 'separate' == $handling ):
396
+ $contents = "/*" . LF
397
+ . 'CTC Separate Stylesheet' . LF
398
+ . 'Updated: ' . current_time( 'mysql' ) . LF
399
+ . '*/' . LF;
400
+ else:
401
+ $contents = "/*" . LF;
402
+ foreach ( $this->get_css_header() as $param => $value ):
403
+ if ( $value ):
404
+ $contents .= $param . ': ' . $value . LF;
405
+ endif;
406
+ endforeach;
407
+ $contents .= LF . "*/" . LF . $this->get_css_imports();
408
+
409
+ endif;
410
+ return $contents;
411
+ }
412
+
413
+ function get_css_imports() {
414
+ $newheader = '';
415
+ if ( 'import' == $this->get_prop( 'enqueue' ) ):
416
+ $this->ctc()->debug( 'using import ', __FUNCTION__ );
417
+ if ( ! $this->get_prop( 'ignoreparnt' ) )
418
+ $newheader .= "@import url('../" . $this->get_prop( 'parnt' ) . "/style.css');" . LF;
419
+ endif;
420
+ return $newheader;
421
  }
422
 
423
  // formats file path for child theme file
424
+ function get_child_target( $file = '', $theme = NULL ) {
425
+ return trailingslashit( get_theme_root() ) . trailingslashit( $theme ? $theme : $this->get_prop( 'child' ) ) . $file;
426
  }
427
 
428
  // formats file path for parent theme file
429
+ function get_parent_source( $file = 'style.css', $theme = NULL ) {
430
+ return trailingslashit( get_theme_root() ) . trailingslashit( $theme ? $theme : $this->get_prop( 'parnt' ) ) . $file;
431
  }
432
 
433
  /**
454
  $q = $this->get_dict_id( 'query', $query );
455
  $s = $this->get_dict_id( 'sel', $sel );
456
  if ( !isset( $this->sel_ndx[ $q ][ $s ] ) ):
457
+ /**
458
+ * Future use: stop parsing if limit is reached to prevent out of memory on serialize
459
+ *
460
  if ( $this->qskey >= $this->ctc()->sel_limit ):
461
  $this->max_sel = 1;
462
  $this->ctc()->debug( 'Maximum num selectors reached ( limit: ' . $this->ctc()->sel_limit . ' )', __FUNCTION__ );
463
  return FALSE;
464
  endif;
465
+ */
466
  // increment key number
467
  $this->sel_ndx[ $q ][ $s ] = ++$this->qskey;
468
  $this->dict_qs[ $this->qskey ][ 's' ] = $s;
501
  $rulevalid = NULL,
502
  $reset = FALSE
503
  ) {
504
+ // if ( $this->max_sel ) return; // Future use
505
  if ( FALSE === strpos( $query, '@' ) ):
506
  $query = 'base';
507
  endif;
556
  endif;
557
  }
558
 
559
+ /**
560
  * rule_value_exists
561
  * Determine if a value already exists for a property
562
  * and return its id
570
  return FALSE;
571
  }
572
 
573
+ /**
574
  * get_rule_value_id
575
  * Generate a new rulevalid by iterating existing ids
576
  * and returning the next in sequence
582
  return $newid;
583
  }
584
 
585
+ /**
586
  * update_rule_value
587
  * Generate a new value subarray
588
  */
594
  );
595
  }
596
 
597
+ /**
598
  * unset_rule_value
599
  * Delete (splice) old value subarray from values
600
  */
610
  endforeach;
611
  }
612
 
613
+ /**
614
  * prune_if_empty
615
  * Automatically cleans up hierarchies when no values exist
616
  * in either parent or child for a given selector.
690
  $this->imports[ 'child' ] = array();
691
  $this->styles = $this->parse_css_input( $_POST[ 'ctc_child_imports' ] );
692
  $this->parse_css( 'child' );
693
+
694
+ elseif ( isset( $_POST[ 'ctc_analysis' ] ) ):
695
+
696
+ if ( $this->ctc()->cache_updates ):
697
+ $this->ctc()->updates[] = array(
698
+ 'obj' => 'analysis',
699
+ 'data' => array(),
700
+ );
701
+ endif;
702
+
703
+ $this->ctc()->evaluate_signals( $this->get_prop( 'ignoreparnt' ) );
704
+
705
  elseif ( isset( $_POST[ 'ctc_configtype' ] ) ):
706
  ob_start();
707
  do_action( 'chld_thm_cfg_get_stylesheets' );
761
  $important,
762
  $rulevalid
763
  );
764
+ // clear the original selector's new value:
765
  $this->update_arrays(
766
  'child',
767
  $selarr[ 'query' ],
841
  $rule_part[ 'important' ],
842
  $rulevalid
843
  );
844
+ // clear the original selector's new value:
845
  $this->update_arrays(
846
  'child',
847
  $rule_arr[ 'query' ],
886
  endif;
887
 
888
  // update enqueue function if imports have not been converted or new imports passed
889
+ if ( isset( $_POST[ 'ctc_analysis' ] ) || isset( $_POST[ 'ctc_child_imports' ] ) || !$this->get_prop( 'converted' ) )
890
  add_action( 'chld_thm_cfg_addl_files', array( $this->ctc(), 'enqueue_parent_css' ), 15, 2 );
891
  }
892
 
900
 
901
  // strips non printables and potential commands
902
  function sanitize( $styles ) {
903
+ return sanitize_text_field( preg_replace( '/[^[:print:]]|\{.*/', '', $styles ) );
904
  }
905
 
906
  // escapes octal values in input to allow for specific ascii strings in content rule
919
  */
920
  function parse_css_file( $template, $file = 'style.css', $cfgtemplate = FALSE ) {
921
  if ( '' == $file ) $file = 'style.css';
922
+
923
+ /**
924
+ * Future use: have we run out of memory?
925
+ *
926
  if ( $this->max_sel ):
927
+ //$this->ctc()->debug( 'Insufficient memory to parse file.', __FUNCTION__ );
928
  return FALSE;
929
  endif;
930
+ */
931
  // turn off caching when parsing files to reduce memory usage
932
  $this->ctc()->cache_updates = FALSE;
933
  $this->styles = ''; // reset styles
962
  // read stylesheet
963
 
964
  if ( $stylesheet_verified = $this->is_file_ok( $stylesheet, 'read' ) ):
965
+ /**
966
+ * Future use: make sure we have space to parse
967
+ *
968
  if ( filesize( $stylesheet_verified ) * 3 > $this->ctc()->get_free_memory() ):
969
  $this->max_sel = 1;
970
+ //$this->ctc()->debug( 'Insufficient memory to read file', __FUNCTION__ );
971
  return;
972
  endif;
973
+ */
974
  $this->styles .= @file_get_contents( $stylesheet_verified ) . "\n";
975
  //echo 'count after get contents: ' . strlen( $this->styles ) . LF;
976
  else:
1146
  * New selectors are appended to the end of each media query block.
1147
  * FIXME - this function has grown too monolithic - refactor and componentize
1148
  */
1149
+ function write_css() {
 
 
1150
  // turn the dictionaries into indexes (value => id into id => value):
1151
  $rulearr = array_flip( $this->dict_rule );
1152
  $valarr = array_flip( $this->dict_val );
1153
  $selarr = array_flip( $this->dict_sel );
1154
+ $output = '';
1155
  foreach ( $this->sort_queries() as $query => $sort_order ):
1156
  $has_selector = 0;
1157
  $sel_output = '';
1207
  if ( 'base' != $query ) $sel_output .= '}' . LF;
1208
  if ( $has_selector ) $output .= $sel_output;
1209
  endforeach;
1210
+ $output = $this->get_css_header_comment( $this->get_prop( 'handling' ) ) . LF . $output;
1211
+ $stylesheet = $this->get_stylesheet_path();
1212
+ $this->ctc()->debug( 'writing stylesheet: ' . $stylesheet, __FUNCTION__ );
1213
  //echo //print_r(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS), true) . LF;
1214
  if ( $stylesheet_verified = $this->is_file_ok( $stylesheet, 'write' ) ):
1215
  global $wp_filesystem; // this was initialized earlier;
1216
+ $mode = 'direct' == $this->ctc()->fs_method ? FALSE : 0666;
 
 
 
 
 
 
 
 
1217
  // write new stylesheet:
1218
  // try direct write first, then wp_filesystem write
1219
  // stylesheet must already exist and be writable by web server
1220
  if ( $this->ctc()->is_ajax && is_writable( $stylesheet_verified ) ):
1221
  if ( FALSE === @file_put_contents( $stylesheet_verified, $output ) ):
1222
+ $this->ctc()->debug( 'Ajax write failed.', __FUNCTION__ );
1223
  return FALSE;
1224
  endif;
1225
+ elseif ( FALSE === $wp_filesystem->put_contents( $this->ctc()->fspath( $stylesheet_verified ), $output, $mode ) ):
1226
+ $this->ctc()->debug( 'Filesystem write failed.', __FUNCTION__ );
1227
  return FALSE;
1228
  endif;
1229
  return TRUE;
1576
  /**
1577
  * denorm_rule_val
1578
  * Return array of unique values corresponding to specific rule
1579
+ * FIXME: only return child if no original value exists
1580
  */
1581
  function denorm_rule_val( $ruleid ) {
1582
  $rule_sel_arr = array();
1599
  * denorm_val_query
1600
  * Return array of queries, selectors, rules, and values corresponding to
1601
  * specific rule/value combo grouped by query, selector
1602
+ * FIXME: only return new values corresponding to specific rulevalid of matching original value
1603
  */
1604
  function denorm_val_query( $valid, $rule ) {
1605
  $value_query_arr = array();
1813
  /**
1814
  * is_file_ok
1815
  * verify file exists and is in valid location
1816
+ * must be in theme or plugin folders
1817
  */
1818
  function is_file_ok( $stylesheet, $permission = 'read' ) {
1819
  // remove any ../ manipulations
includes/class-ctc-preview.php ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Exit if accessed directly
3
+ if ( !defined( 'ABSPATH' ) ) exit;
4
+
5
+ error_reporting( E_ALL );
6
+ ini_set( 'display_errors', 1 );
7
+
8
+ class ChildThemeConfiguratorPreview {
9
+ /**
10
+ * Replaces core function to start preview theme output buffer.
11
+ */
12
+ static function preview_theme() {
13
+ // are we previewing?
14
+ if ( ! isset( $_GET[ 'template' ] ) || !wp_verify_nonce( $_GET['preview_ctc'] ) )
15
+ return;
16
+ // can user preview?
17
+ if ( !current_user_can( 'switch_themes' ) )
18
+ return;
19
+ // hide admin bar in preview
20
+ if ( isset( $_GET[ 'preview_iframe' ] ) )
21
+ show_admin_bar( false );
22
+ // sanitize template param
23
+ $_GET[ 'template' ] = preg_replace( '|[^a-z0-9_./-]|i', '', $_GET[ 'template' ] );
24
+ // check for manipulations
25
+ if ( validate_file( $_GET[ 'template' ] ) )
26
+ return;
27
+ // replace future get_template calls with preview template
28
+ add_filter( 'template', 'ChildThemeConfiguratorPreview::preview_theme_template_filter' );
29
+
30
+ if ( isset( $_GET[ 'stylesheet' ] ) ):
31
+ // sanitize stylesheet param
32
+ $_GET['stylesheet'] = preg_replace( '|[^a-z0-9_./-]|i', '', $_GET['stylesheet'] );
33
+ // check for manipulations
34
+ if ( validate_file( $_GET['stylesheet'] ) )
35
+ return;
36
+ // replace future get_stylesheet calls with preview stylesheet
37
+ add_filter( 'stylesheet', 'ChildThemeConfiguratorPreview::preview_theme_stylesheet_filter' );
38
+ endif;
39
+ // swap out theme mods with preview theme mods
40
+ add_filter( 'pre_option_theme_mods_' . get_option( 'stylesheet' ),
41
+ 'ChildThemeConfiguratorPreview::preview_mods' );
42
+ // impossibly high priority to test for stylesheets loaded after wp_head()
43
+ add_action( 'wp_print_styles', 'ChildThemeConfiguratorPreview::test_css', 999999 );
44
+ // pass the wp_styles queue back to use for stylesheet handle verification
45
+ add_action( 'wp_footer', 'ChildThemeConfiguratorPreview::current_queue' );
46
+
47
+ }
48
+
49
+ /**
50
+ * Retrieves child theme mods for preview
51
+ */
52
+ static function preview_mods() {
53
+ if ( ! isset( $_GET[ 'stylesheet' ] ) || get_option( 'stylesheet' ) == $_GET[ 'stylesheet' ] ) return false;
54
+ return get_option( 'theme_mods_' . preg_replace('|[^a-z0-9_./-]|i', '', $_GET['stylesheet']) );
55
+ }
56
+
57
+ /**
58
+ * Function to modify the current template when previewing a theme
59
+ *
60
+ * @return string
61
+ */
62
+ static function preview_theme_template_filter() {
63
+ return ( isset($_GET['template']) && current_user_can( 'switch_themes' ) ) ? $_GET['template'] : '';
64
+ }
65
+
66
+ /**
67
+ * Function to modify the current stylesheet when previewing a theme
68
+ *
69
+ * @return string
70
+ */
71
+ static function preview_theme_stylesheet_filter() {
72
+ return ( isset( $_GET['stylesheet'] ) && current_user_can( 'switch_themes' ) ) ? $_GET['stylesheet'] : '';
73
+ }
74
+
75
+ // retrieve wp_styles queue and pass back to configurator to verify stylesheet handles
76
+ static function current_queue() {
77
+ global $wp_styles;
78
+ $queue = implode( "\n", $wp_styles->queue );
79
+ echo "\n\n\n<!-- BEGIN WP QUEUE\n" . $queue . "\nEND WP QUEUE -->\n\n\n";
80
+ self::parse_stylesheet();
81
+ }
82
+
83
+ // enqueue dummy stylesheet with extremely high priority to test wp_head()
84
+ static function test_css() {
85
+ wp_enqueue_style( 'ctc-test', get_stylesheet_directory_uri() . '/ctc-test.css' );
86
+ }
87
+
88
+ static function parse_stylesheet() {
89
+ if ( is_child_theme() ):
90
+ $file = get_stylesheet_directory() . '/style.css';
91
+ if ( file_exists( $file ) && ( $styles = @file_get_contents( $file ) ) ):
92
+ if ( defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) ):
93
+ echo "\n\n\n<!-- CHLD_THM_CFG_IGNORE_PARENT -->\n\n\n";
94
+ endif;
95
+ if ( preg_match( '#\nUpdated: \d\d\d\d\-\d\d\-\d\d \d\d:\d\d:\d\d\n#s', $styles ) ):
96
+ echo "\n\n\n<!-- IS_CTC_THEME -->\n\n\n";
97
+ endif;
98
+
99
+ if ( preg_match( '#\@import\s+url\(.+?\/' . preg_quote( get_template() ) . '\/style\.css.*?\);#s', $styles ) ):
100
+ echo "\n\n\n<!-- HAS_CTC_IMPORT -->\n\n\n";
101
+ endif;
102
+ endif;
103
+ else:
104
+ $file = get_template_directory() . '/style.css';
105
+ if ( file_exists( $file ) && ( $styles = @file_get_contents( $file ) ) ):
106
+ $styles = preg_replace( '#\/\*.*?\*\/#s', '', $styles );
107
+ if ( preg_match( '#\n\s*([\[\.\#\:\w][\w\-\s\(\)\[\]\'\^\*\.\#\+:,"=>]+?)\s*\{(.*?)\}#s', $styles ) ):
108
+ echo "\n\n\n<!-- HAS_CTC_STYLES -->\n\n\n";
109
+ endif;
110
+ endif;
111
+ endif;
112
+ }
113
+ }
114
+
115
+ // replace core preview function with CTCP function for quick preview
116
+ remove_action( 'setup_theme', 'preview_theme' );
117
+ add_action( 'setup_theme', 'ChildThemeConfiguratorPreview::preview_theme' );
118
+
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.childthemeconfigurator.com/
7
  Description: Handles the plugin User Interface
8
- Version: 1.7.8
9
  Author: Lilaea Media
10
  Author URI: http://www.lilaeamedia.com/
11
  Text Domain: chld_thm_cfg
@@ -16,64 +16,64 @@ if ( !defined( 'ABSPATH' ) ) exit;
16
  class ChildThemeConfiguratorUI {
17
 
18
  var $warnings = array();
19
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  // helper function to globalize ctc object
21
  function ctc() {
22
  return ChildThemeConfigurator::ctc();
23
  }
24
-
 
 
 
 
 
 
 
 
25
  function render() {
26
- $css = $this->ctc()->css;
 
 
 
 
 
 
27
  $themes = $this->ctc()->themes;
28
- $child = $css->get_prop( 'child' );
29
  $hidechild = ( count( $themes[ 'child' ] ) ? '' : 'style="display:none"' );
30
- $enqueueset = ( isset( $css->enqueue ) && $child );
31
  $this->ctc()->debug( 'Enqueue set: ' . ( $enqueueset ? 'TRUE' : 'FALSE' ), __FUNCTION__ );
32
- if ( empty( $css->nowarn ) ) $this->parent_theme_check();
33
- $imports = $css->get_prop( 'imports' );
34
  $id = 0;
35
  $this->ctc()->fs_method = get_filesystem_method();
36
  add_thickbox();
37
- add_filter( 'chld_thm_cfg_files_tab_filter', array( $this, 'render_files_tab_options' ) );
38
- add_action( 'chld_thm_cfg_tabs', array( $this, 'render_addl_tabs' ), 10, 4 );
39
- add_action( 'chld_thm_cfg_panels', array( $this, 'render_addl_panels' ), 10, 4 );
40
- add_action( 'chld_thm_cfg_related_links', array( $this, 'lilaea_plug' ) );
41
- if ( $this->ctc()->is_debug ):
42
- $this->ctc()->debug( 'adding new debug action...', __FUNCTION__ );
43
- add_action( 'chld_thm_cfg_print_debug', array( $this->ctc(), 'print_debug' ) );
44
- endif;
45
  include ( CHLD_THM_CFG_DIR . '/includes/forms/main.php' );
46
  }
47
 
48
- function parent_theme_check() {
49
- // check header for hard-coded
50
- $bad_practice_descr = array(
51
- // Stylesheets should be enqueued using the <code>wp_enqueue_scripts</code> action.
52
- 'links' => __( 'A stylesheet link tag is hard-coded into the header template.', 'chld_thm_cfg' ),
53
- 'enqueue' => __( '<code>wp_enqueue_style()</code> called from the header template.', 'chld_thm_cfg' ),
54
- // <code>wp_head()</code> should be located just before the closing <code>&lt;/head&gt;</code> tag.
55
- 'wphead' => __( 'Code exists between the <code>wp_head()</code> function and the closing <code>&lt;/head&gt;</code> tag.', 'chld_thm_cfg'),
56
- );
57
- $parentfile = trailingslashit( get_theme_root() ) . trailingslashit( $this->ctc()->get_current_parent() ) . 'header.php';
58
- $childfile = trailingslashit( get_theme_root() ) . trailingslashit( $this->ctc()->css->get_prop( 'child' ) ) . 'header.php';
59
- if ( $file = ( file_exists( $childfile ) ? $childfile : ( file_exists( $parentfile ) ? $parentfile : FALSE ) ) ):
60
- $contents = file_get_contents( $file );
61
- $contents = preg_replace( "/\/\/.*?(\?>|\n)|\/\*.*?\*\/|<\!\-\-.*?\-\->/s", '', $contents );
62
- // check for linked stylesheets
63
- if ( preg_match( '/rel=[\'"]stylesheet[\'"]/is', $contents ) ) $this->warnings[] = $bad_practice_descr[ 'links' ];
64
- if ( preg_match( '/wp_enqueue_style/is', $contents ) ) $this->warnings[] = $bad_practice_descr[ 'enqueue' ];
65
- // check for code after wp_head
66
- if ( preg_match( '/wp_head(.*?)<\/head>/is', $contents, $matches ) ):
67
- $codeafter = preg_replace( "/[\(\)\?>;\s]/s", '', $matches[ 1 ] );
68
- if ( !empty( $codeafter ) ) $this->warnings[] = $bad_practice_descr[ 'wphead' ];
69
- endif;
70
- endif;
71
- }
72
-
73
  function render_theme_menu( $template = 'child', $selected = NULL ) {
74
 
75
  ?>
76
- <select class="ctc-select" id="ctc_theme_<?php echo $template; ?>" name="ctc_theme_<?php echo $template; ?>" style="visibility:hidden" <?php echo $this->ctc()->is_theme() ? '' : ' disabled '; ?> ><?php
 
 
 
77
  foreach ( $this->ctc()->themes[ $template ] as $slug => $theme )
78
  echo '<option value="' . $slug . '"' . ( $slug == $selected ? ' selected' : '' ) . '>'
79
  . esc_attr( $theme[ 'Name' ] ) . '</option>' . LF;
@@ -86,6 +86,10 @@ class ChildThemeConfiguratorUI {
86
  </div>
87
  <?php
88
  }
 
 
 
 
89
 
90
  function render_file_form( $template = 'parnt' ) {
91
  global $wp_filesystem;
@@ -97,9 +101,6 @@ class ChildThemeConfiguratorUI {
97
  ob_start();
98
  foreach ( $files as $file ):
99
  $templatefile = preg_replace( '%\.php$%', '', $file );
100
- $excludes = implode( "|", ( array ) apply_filters( 'chld_thm_cfg_template_excludes', $this->ctc()->excludes ) );
101
- if ( 'parnt' == $template && ( preg_match( '%^(' . $excludes . ' )\w*\/%',$templatefile )
102
- || 'functions' == basename( $templatefile ) ) ) continue;
103
  include ( CHLD_THM_CFG_DIR . '/includes/forms/file.php' );
104
  endforeach;
105
  if ( 'child' == $template && ( $backups = $this->ctc()->get_files( $theme, 'backup,pluginbackup' ) ) ):
@@ -113,6 +114,8 @@ class ChildThemeConfiguratorUI {
113
  if ( $counter ):
114
  include ( CHLD_THM_CFG_DIR . '/includes/forms/fileform.php' );
115
  endif;
 
 
116
  endif;
117
  }
118
 
@@ -151,27 +154,28 @@ class ChildThemeConfiguratorUI {
151
  function settings_errors() {
152
 
153
  if ( count( $this->ctc()->errors ) ):
154
- echo '<div class="error"><ul>' . LF;
155
  foreach ( $this->ctc()->errors as $err ):
156
  echo '<li>' . $err . '</li>' . LF;
157
  endforeach;
158
  echo '</ul></div>' . LF;
159
  elseif ( isset( $_GET[ 'updated' ] ) ):
160
- echo '<div class="updated">' . LF;
 
161
  if ( 8 == $_GET[ 'updated' ] ):
162
- echo '<p>' . __( 'Child Theme files modified successfully.', 'chld_thm_cfg' ) . '</p>' . LF;
 
 
163
  else:
164
- $child_theme = wp_get_theme( $this->ctc()->css->get_prop( 'child' ) );
165
- echo '<p>' . apply_filters( 'chld_thm_cfg_update_msg', sprintf( __( 'Child Theme <strong>%s</strong> has been generated successfully.
166
- ', 'chld_thm_cfg' ), $child_theme->Name ), $this->ctc() ) . LF;
167
  if ( $this->ctc()->is_theme() ):
168
- echo '<strong>' . __( 'IMPORTANT:', 'chld_thm_cfg' ) . LF;
169
- if ( is_multisite() && !$child_theme->is_allowed() ):
170
- echo 'You must <a href="' . network_admin_url( '/themes.php' ) . '" title="' . __( 'Go to Themes', 'chld_thm_cfg' ) . '" class="ctc-live-preview">' . __( 'Network enable', 'chld_thm_cfg' ) . '</a> ' . __( 'your child theme.', 'chld_thm_cfg' );
171
- else:
172
- echo '<a href="' . admin_url( '/customize.php?theme=' . $this->ctc()->css->get_prop( 'child' ) ) . '" title="' . __( 'Live Preview', 'chld_thm_cfg' ) . '" class="ctc-live-preview">' . __( 'Test your child theme', 'chld_thm_cfg' ) . '</a> ' . __( 'before activating.', 'chld_thm_cfg' );
173
- endif;
174
- echo '</strong></p>' . LF;
175
  endif;
176
  endif;
177
  echo '</div>' . LF;
@@ -180,8 +184,7 @@ class ChildThemeConfiguratorUI {
180
 
181
  function render_help_content() {
182
  global $wp_version;
183
- if ( version_compare( $wp_version, '3.3' ) >= 0 ) {
184
-
185
  $screen = get_current_screen();
186
 
187
  // load help content via output buffer so we can use plain html for updates
@@ -189,9 +192,12 @@ class ChildThemeConfiguratorUI {
189
 
190
  $regex_sidebar = '/' . preg_quote( '<!-- BEGIN sidebar -->' ) . '(.*?)' . preg_quote( '<!-- END sidebar -->' ) . '/s';
191
  $regex_tab = '/' . preg_quote( '<!-- BEGIN tab -->' ) . '\s*<h\d id="(.*?)">(.*?)<\/h\d>(.*?)' . preg_quote( '<!-- END tab -->' ) . '/s';
 
 
 
 
192
  ob_start();
193
- // stub for multiple languages future release
194
- include( CHLD_THM_CFG_DIR . '/includes/help/help_en_US.php' );
195
  $help_raw = ob_get_contents();
196
  ob_end_clean();
197
  // parse raw html for tokens
@@ -205,18 +211,19 @@ class ChildThemeConfiguratorUI {
205
  $id = array_shift( $tabs[ 1 ] );
206
  $title = array_shift( $tabs[ 2 ] );
207
  $content = array_shift( $tabs[ 3 ] );
208
- $screen->add_help_tab( array(
209
  'id' => $id,
210
  'title' => $title,
211
  'content' => $content,
212
  'priority' => ++$priority,
213
- ) );
 
214
  endwhile;
215
  endif;
216
  if ( isset( $sidebar[ 1 ] ) )
217
  $screen->set_help_sidebar( $sidebar[ 1 ] );
218
-
219
- }
220
  }
221
 
222
  function render_addl_tabs( $ctc, $active_tab = NULL, $hidechild = '' ) {
@@ -236,5 +243,196 @@ class ChildThemeConfiguratorUI {
236
  $output = preg_replace( $regex, "$1", $output );
237
  return $output;
238
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
239
  }
240
  ?>
5
  Class: Child_Theme_Configurator_UI
6
  Plugin URI: http://www.childthemeconfigurator.com/
7
  Description: Handles the plugin User Interface
8
+ Version: 2.0.0
9
  Author: Lilaea Media
10
  Author URI: http://www.lilaeamedia.com/
11
  Text Domain: chld_thm_cfg
16
  class ChildThemeConfiguratorUI {
17
 
18
  var $warnings = array();
19
+ var $swatch_txt;
20
+ var $colors;
21
+
22
+ function __construct() {
23
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 99 );
24
+ add_filter( 'chld_thm_cfg_files_tab_filter', array( $this, 'render_files_tab_options' ) );
25
+ add_action( 'chld_thm_cfg_tabs', array( $this, 'render_addl_tabs' ), 10, 4 );
26
+ add_action( 'chld_thm_cfg_panels', array( $this, 'render_addl_panels' ), 10, 4 );
27
+ add_action( 'chld_thm_cfg_related_links', array( $this, 'lilaea_plug' ) );
28
+ add_action( 'admin_notices', array( $this, 'get_colors' ) );
29
+ // temporary hook until Pro is updated
30
+ add_filter( 'chld_thm_cfg_localize_array', array( $this, 'filter_localize_array' ) );
31
+ if ( $this->ctc()->is_debug ):
32
+ //$this->ctc()->debug( 'adding new debug action...', __FUNCTION__ );
33
+ add_action( 'chld_thm_cfg_print_debug', array( $this->ctc(), 'print_debug' ) );
34
+ endif;
35
+ $this->swatch_txt = __( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', 'child-theme-configurator' );
36
+ }
37
  // helper function to globalize ctc object
38
  function ctc() {
39
  return ChildThemeConfigurator::ctc();
40
  }
41
+ function css() {
42
+ return ChildThemeConfigurator::ctc()->css;
43
+ }
44
+ function get_colors(){
45
+ global $_wp_admin_css_colors;
46
+ $user_admin_color = get_user_meta( get_current_user_id(), 'admin_color', TRUE );
47
+ $this->colors = $_wp_admin_css_colors[ $user_admin_color ]->colors;
48
+
49
+ }
50
  function render() {
51
+ // load web fonts for this theme
52
+ if ( $imports = $this->css()->get_prop( 'imports' ) ):
53
+ $ext = 0;
54
+ foreach ( $imports as $import ):
55
+ $this->ctc()->convert_import_to_enqueue( $import, ++$ext, TRUE );
56
+ endforeach;
57
+ endif;
58
  $themes = $this->ctc()->themes;
59
+ $child = $this->css()->get_prop( 'child' );
60
  $hidechild = ( count( $themes[ 'child' ] ) ? '' : 'style="display:none"' );
61
+ $enqueueset = ( isset( $this->css()->enqueue ) && $child );
62
  $this->ctc()->debug( 'Enqueue set: ' . ( $enqueueset ? 'TRUE' : 'FALSE' ), __FUNCTION__ );
63
+ $imports = $this->css()->get_prop( 'imports' );
 
64
  $id = 0;
65
  $this->ctc()->fs_method = get_filesystem_method();
66
  add_thickbox();
 
 
 
 
 
 
 
 
67
  include ( CHLD_THM_CFG_DIR . '/includes/forms/main.php' );
68
  }
69
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  function render_theme_menu( $template = 'child', $selected = NULL ) {
71
 
72
  ?>
73
+ <select class="ctc-select" id="ctc_theme_<?php echo $template; ?>" name="ctc_theme_<?php echo $template; ?>"
74
+ style="visibility:hidden" <?php echo $this->ctc()->is_theme() ? '' : ' disabled '; ?> autocomplete="off" >
75
+ <?php
76
+ uasort( $this->ctc()->themes[ $template ], array( $this, 'cmp_theme' ) );
77
  foreach ( $this->ctc()->themes[ $template ] as $slug => $theme )
78
  echo '<option value="' . $slug . '"' . ( $slug == $selected ? ' selected' : '' ) . '>'
79
  . esc_attr( $theme[ 'Name' ] ) . '</option>' . LF;
86
  </div>
87
  <?php
88
  }
89
+
90
+ function cmp_theme( $a, $b ) {
91
+ return strcmp( strtolower( $a[ 'Name' ] ), strtolower( $b[ 'Name' ] ) );
92
+ }
93
 
94
  function render_file_form( $template = 'parnt' ) {
95
  global $wp_filesystem;
101
  ob_start();
102
  foreach ( $files as $file ):
103
  $templatefile = preg_replace( '%\.php$%', '', $file );
 
 
 
104
  include ( CHLD_THM_CFG_DIR . '/includes/forms/file.php' );
105
  endforeach;
106
  if ( 'child' == $template && ( $backups = $this->ctc()->get_files( $theme, 'backup,pluginbackup' ) ) ):
114
  if ( $counter ):
115
  include ( CHLD_THM_CFG_DIR . '/includes/forms/fileform.php' );
116
  endif;
117
+ else:
118
+ echo $template . ' theme not set.';
119
  endif;
120
  }
121
 
154
  function settings_errors() {
155
 
156
  if ( count( $this->ctc()->errors ) ):
157
+ echo '<div class="error notice is-dismissible"><ul>' . LF;
158
  foreach ( $this->ctc()->errors as $err ):
159
  echo '<li>' . $err . '</li>' . LF;
160
  endforeach;
161
  echo '</ul></div>' . LF;
162
  elseif ( isset( $_GET[ 'updated' ] ) ):
163
+ $child_theme = wp_get_theme( $this->ctc()->css->get_prop( 'child' ) );
164
+ echo '<div class="updated notice is-dismissible">' . LF;
165
  if ( 8 == $_GET[ 'updated' ] ):
166
+ echo '<p>' . __( 'Child Theme files modified successfully.', 'child-theme-configurator' ) . '</p>' . LF;
167
+ elseif ( 4 == $_GET[ 'updated' ] ):
168
+ echo '<p>' . sprintf( __( 'Child Theme <strong>%s</strong> has been reset. Please configure it using the settings below.', 'child-theme-configurator' ), $child_theme->Name ) . '</p>' . LF;
169
  else:
170
+ echo '<p class="ctc-success-response">' . apply_filters( 'chld_thm_cfg_update_msg', sprintf( __( 'Child Theme <strong>%s</strong> has been generated successfully.', 'child-theme-configurator' ), $child_theme->Name ), $this->ctc() ) . LF;
 
 
171
  if ( $this->ctc()->is_theme() ):
172
+ echo '<strong>' . __( 'IMPORTANT:', 'child-theme-configurator' ) . LF;
173
+ if ( is_multisite() && !$child_theme->is_allowed() ):
174
+ echo 'You must <a href="' . network_admin_url( '/themes.php' ) . '" title="' . __( 'Go to Themes', 'child-theme-configurator' ) . '" class="ctc-live-preview">' . __( 'Network enable', 'child-theme-configurator' ) . '</a> ' . __( 'your child theme.', 'child-theme-configurator' );
175
+ else:
176
+ echo '<a href="' . admin_url( '/customize.php?theme=' . $this->ctc()->css->get_prop( 'child' ) ) . '" title="' . __( 'Live Preview', 'child-theme-configurator' ) . '" class="ctc-live-preview">' . __( 'Preview your child theme', 'child-theme-configurator' ) . '</a> ' . __( 'before activating.', 'child-theme-configurator' );
177
+ endif;
178
+ echo '</strong></p>' . LF;
179
  endif;
180
  endif;
181
  echo '</div>' . LF;
184
 
185
  function render_help_content() {
186
  global $wp_version;
187
+ if ( version_compare( $wp_version, '3.3' ) >= 0 ):
 
188
  $screen = get_current_screen();
189
 
190
  // load help content via output buffer so we can use plain html for updates
192
 
193
  $regex_sidebar = '/' . preg_quote( '<!-- BEGIN sidebar -->' ) . '(.*?)' . preg_quote( '<!-- END sidebar -->' ) . '/s';
194
  $regex_tab = '/' . preg_quote( '<!-- BEGIN tab -->' ) . '\s*<h\d id="(.*?)">(.*?)<\/h\d>(.*?)' . preg_quote( '<!-- END tab -->' ) . '/s';
195
+ $locale = get_locale();
196
+ $dir = CHLD_THM_CFG_DIR . '/includes/help/';
197
+ $file = $dir . $locale . '.php';
198
+ if ( !is_readable( $file ) ) $file = $dir . 'en_US.php';
199
  ob_start();
200
+ include( $file );
 
201
  $help_raw = ob_get_contents();
202
  ob_end_clean();
203
  // parse raw html for tokens
211
  $id = array_shift( $tabs[ 1 ] );
212
  $title = array_shift( $tabs[ 2 ] );
213
  $content = array_shift( $tabs[ 3 ] );
214
+ $tab = array(
215
  'id' => $id,
216
  'title' => $title,
217
  'content' => $content,
218
  'priority' => ++$priority,
219
+ );
220
+ $screen->add_help_tab( $tab );
221
  endwhile;
222
  endif;
223
  if ( isset( $sidebar[ 1 ] ) )
224
  $screen->set_help_sidebar( $sidebar[ 1 ] );
225
+ //die( print_r( $screen, TRUE ) );
226
+ endif;
227
  }
228
 
229
  function render_addl_tabs( $ctc, $active_tab = NULL, $hidechild = '' ) {
243
  $output = preg_replace( $regex, "$1", $output );
244
  return $output;
245
  }
246
+
247
+ function enqueue_scripts() {
248
+ wp_enqueue_style( 'chld-thm-cfg-admin', CHLD_THM_CFG_URL . 'css/chldthmcfg.css', array(), '2.0.0' );
249
+
250
+ // we need to use local jQuery UI Widget/Menu/Selectmenu 1.11.2 because selectmenu is not included in < 1.11.2
251
+ // this will be updated in a later release to use WP Core scripts when it is widely adopted
252
+ if ( !wp_script_is( 'jquery-ui-selectmenu', 'registered' ) ): // selectmenu.min.js
253
+ wp_enqueue_script( 'jquery-ui-selectmenu', CHLD_THM_CFG_URL . 'js/selectmenu.min.js',
254
+ array( 'jquery','jquery-ui-core','jquery-ui-position' ), FALSE, TRUE );
255
+ endif;
256
+ wp_enqueue_script( 'chld-thm-cfg-spectrum', CHLD_THM_CFG_URL . 'js/spectrum.min.js', array( 'jquery' ), FALSE, TRUE );
257
+ wp_enqueue_script( 'chld-thm-cfg-ctcgrad', CHLD_THM_CFG_URL . 'js/ctcgrad.min.js', array( 'jquery' ), FALSE, TRUE );
258
+ wp_enqueue_script( 'chld-thm-cfg-admin', CHLD_THM_CFG_URL . 'js/chldthmcfg.min.js',
259
+ array(
260
+ 'jquery-ui-autocomplete',
261
+ 'jquery-ui-selectmenu',
262
+ 'chld-thm-cfg-spectrum',
263
+ 'chld-thm-cfg-ctcgrad'
264
+ ), FALSE, TRUE );
265
+
266
+ $localize_array = apply_filters( 'chld_thm_cfg_localize_script', array(
267
+ 'converted' => $this->css()->get_prop( 'converted' ),
268
+ 'ssl' => is_ssl(),
269
+ 'homeurl' => get_home_url() . '?preview_ctc=' . wp_create_nonce(),
270
+ 'ajaxurl' => admin_url( 'admin-ajax.php' ),
271
+ 'theme_uri' => get_theme_root_uri(),
272
+ 'page' => CHLD_THM_CFG_MENU,
273
+ 'themes' => $this->ctc()->themes,
274
+ 'source' => apply_filters( 'chld_thm_cfg_source_uri', get_theme_root_uri() . '/'
275
+ . $this->css()->get_prop( 'parnt' ) . '/style.css', $this->css() ),
276
+ 'target' => apply_filters( 'chld_thm_cfg_target_uri', get_theme_root_uri() . '/'
277
+ . $this->css()->get_prop( 'child' ) . '/style.css', $this->css() ),
278
+ 'parnt' => $this->css()->get_prop( 'parnt' ),
279
+ 'child' => $this->css()->get_prop( 'child' ),
280
+ 'addl_css' => $this->css()->get_prop( 'addl_css' ),
281
+ 'imports' => $this->css()->get_prop( 'imports' ),
282
+ 'converted' => $this->css()->get_prop( 'converted' ),
283
+ 'is_debug' => $this->ctc()->is_debug,
284
+ '_background_url_txt' => __( 'URL/None', 'child-theme-configurator' ),
285
+ '_background_origin_txt' => __( 'Origin', 'child-theme-configurator' ),
286
+ '_background_color1_txt' => __( 'Color 1', 'child-theme-configurator' ),
287
+ '_background_color2_txt' => __( 'Color 2', 'child-theme-configurator' ),
288
+ '_border_width_txt' => __( 'Width/None', 'child-theme-configurator' ),
289
+ '_border_style_txt' => __( 'Style', 'child-theme-configurator' ),
290
+ '_border_color_txt' => __( 'Color', 'child-theme-configurator' ),
291
+ 'swatch_txt' => $this->swatch_txt,
292
+ 'load_txt' => __( 'Are you sure you wish to RESET? This will destroy any work you have done in the Configurator.', 'child-theme-configurator' ),
293
+ 'important_txt' => __( '<span style="font-size:10px">!</span>', 'child-theme-configurator' ),
294
+ 'selector_txt' => __( 'Selectors', 'child-theme-configurator' ),
295
+ 'close_txt' => __( 'Close', 'child-theme-configurator' ),
296
+ 'edit_txt' => __( 'Edit Selector', 'child-theme-configurator' ),
297
+ 'cancel_txt' => __( 'Cancel', 'child-theme-configurator' ),
298
+ 'rename_txt' => __( 'Rename', 'child-theme-configurator' ),
299
+ 'css_fail_txt' => __( 'The stylesheet cannot be displayed.', 'child-theme-configurator' ),
300
+ 'child_only_txt' => __( '(Child Only)', 'child-theme-configurator' ),
301
+ 'inval_theme_txt' => __( 'Please enter a valid Child Theme.', 'child-theme-configurator' ),
302
+ 'inval_name_txt' => __( 'Please enter a valid Child Theme name.', 'child-theme-configurator' ),
303
+ 'theme_exists_txt' => __( '<strong>%s</strong> exists. Please enter a different Child Theme', 'child-theme-configurator' ),
304
+ 'js_txt' => __( 'The page could not be loaded correctly.', 'child-theme-configurator' ),
305
+ 'jquery_txt' => __( 'Conflicting or out-of-date jQuery libraries were loaded by another plugin:', 'child-theme-configurator' ),
306
+ 'plugin_txt' => __( 'Deactivating or replacing plugins may resolve this issue.', 'child-theme-configurator' ),
307
+ 'contact_txt' => sprintf( __( '%sWhy am I seeing this?%s', 'child-theme-configurator' ),
308
+ '<a target="_blank" href="' . CHLD_THM_CFG_DOCS_URL . '/how-to-use/#script_dep">',
309
+ '</a>' ),
310
+ 'nosels_txt' => __( 'No Styles Available. Check Parent/Child settings.', 'child-theme-configurator' ),
311
+ 'anlz1_txt' => __( 'Updating', 'child-theme-configurator' ),
312
+ 'anlz2_txt' => __( 'Checking', 'child-theme-configurator' ),
313
+ 'anlz3_txt' => __( 'The theme "%s" generated unexpected PHP debug output.', 'child-theme-configurator' ),
314
+ 'anlz4_txt' => __( 'The theme "%s" could not be loaded.', 'child-theme-configurator' ),
315
+ 'anlz5_txt' => __( '<p>Please verify the theme has been installed correctly.</p>', 'child-theme-configurator' ),
316
+ 'anlz6_txt' => __( 'Show Debug Output', 'child-theme-configurator' ),
317
+ 'anlz7_txt' => __( "<p>You may not be able to use this Theme as a Child Theme while these conditions exist.</p><p>It is possible that this theme has specific requirements to work correctly as a child theme. Check your theme's documentation for more information.</p><p>Please make sure you are using the latest version of this theme. If so, please contact this Theme's author and report the error list above.</p>", 'child-theme-configurator' ),
318
+ 'anlz8_txt' => __( 'Do Not Activate "%s"! A PHP FATAL ERROR has been detected.', 'child-theme-configurator' ),
319
+ 'anlz9_txt' => __( 'This theme loads stylesheets after the wp_styles queue.', 'child-theme-configurator' ),
320
+ 'anlz10_txt' => __( '<p>This makes it difficult for plugins to override these styles. You can try to resolve this using the "Repair header template" option (Step 6, "Additional handling options", below).</p>', 'child-theme-configurator' ),
321
+ 'anlz11_txt' => __( "This theme loads the parent theme's <code>style.css</code> file outside the wp_styles queue.", 'child-theme-configurator' ),
322
+ 'anlz12_txt' => __( '<p>This is common with older themes but requires the use of <code>@import</code>, which is no longer recommended. You can try to resolve this using the "Repair header template" option (see step 6, "Additional handling options", below).</p>', 'child-theme-configurator' ),
323
+ 'anlz13_txt' => __( 'This child theme does not load a Configurator stylesheet.', 'child-theme-configurator' ),
324
+ 'anlz14_txt' => __( '<p>If you want to customize styles using this plugin, please click "Configure Child Theme" again to add this to the settings.</p>', 'child-theme-configurator' ),
325
+ 'anlz15_txt' => __( "This child theme uses the parent stylesheet but does not load the parent theme's <code>style.css</code> file.", 'child-theme-configurator' ),
326
+ 'anlz16_txt' => __( '<p>Please select a stylesheet handling method or check "Ignore parent theme stylesheets" (see step 6, below).</p>', 'child-theme-configurator' ),
327
+ 'anlz17_txt' => __( 'This child theme appears to be functioning correctly.', 'child-theme-configurator' ),
328
+ 'anlz18_txt' => __( 'This theme appears OK to use as a Child theme.', 'child-theme-configurator' ),
329
+ 'anlz19_txt' => __( 'This Child Theme has not been configured for this plugin.', 'child-theme-configurator' ),
330
+ 'anlz20_txt' => __( '<p>The Configurator makes significant modifications to the child theme, including stylesheet changes and additional php functions. Please consider using the DUPLICATE child theme option (see step 1, above) and keeping the original as a backup.</p>', 'child-theme-configurator' ),
331
+ 'anlz21_txt' => __( "This child theme uses <code>@import</code> to load the parent theme's <code>style.css</code> file.", 'child-theme-configurator' ),
332
+ 'anlz22_txt' => __( '<p>Please consider selecting "Use the WordPress style queue" for the parent stylesheet handling option (see step 6, below).</p>', 'child-theme-configurator' ),
333
+ 'anlz23_txt' => __( 'This theme loads additional stylesheets after the <code>style.css</code> file:', 'child-theme-configurator' ),
334
+ 'anlz24_txt' => __( '<p>Consider saving new custom styles to a "Separate stylesheet" (see step 5, below) so that you can customize these styles.</p>', 'child-theme-configurator' ),
335
+ 'anlz25_txt' => __( "The parent theme's <code>style.css</code> file is being loaded automatically.", 'child-theme-configurator' ),
336
+ 'anlz26_txt' => __( '<p>"Do not add any parent stylesheet handling" has been selected for "Parent stylesheet handling" (see step 6, below).</p>', 'child-theme-configurator' ),
337
+ 'anlz27_txt' => __( "This theme does not require the parent theme's <code>style.css</code> file for its appearance.", 'child-theme-configurator' ),
338
+ 'anlz28_txt' => __( "This Child Theme was configured with an earlier version.", 'child-theme-configurator' ),
339
+ 'anlz29_txt' => __( '<p>The selected stylesheet handling method is no longer used. Please update the configuration using the "Repair header template" option (see step 6, "Additional handling options", below).</p>', 'child-theme-configurator' ),
340
+ 'anlz30_txt' => __( 'Show Analysis Object', 'child-theme-configurator' ),
341
+ 'anlz31_txt' => __( 'This child theme was configured using the CTC Pro "Genesis stylesheet handling" method.', 'child-theme-configurator' ),
342
+ 'anlz32_txt' => __( '<p>This method has been replaced by the "Separate stylesheet" and "Ignore Parent Theme" options ( selected below ) for broader framework compatability.</p>', 'child-theme-configurator' ),
343
+ ) );
344
+ wp_localize_script(
345
+ 'chld-thm-cfg-admin',
346
+ 'ctcAjax',
347
+ apply_filters( 'chld_thm_cfg_localize_array', $localize_array )
348
+ );
349
+ }
350
+
351
+ function filter_localize_array( $arr ) {
352
+ $arr[ 'pluginmode' ] = !$this->ctc()->is_theme();
353
+ return $arr;
354
+ }
355
+ function notices( $msg ) {
356
+ ?>
357
+ <div class="notice-warning notice is-dismissible<?php echo ( 'upgrade' == $msg ? ' ctc-upgrade-notice' : '' ); ?>" style="display:block"><?php
358
+ switch( $msg ):
359
+
360
+ case 'writable': ?>
361
+
362
+ <div class="ctc-section-toggle" id="ctc_perm_options"><?php _e( 'The child theme is in read-only mode and Child Theme Configurator cannot apply changes. Click to see options', 'child-theme-configurator' ); ?></div><div class="ctc-section-toggle-content" id="ctc_perm_options_content"><p><ol><?php
363
+ $ctcpage = apply_filters( 'chld_thm_cfg_admin_page', CHLD_THM_CFG_MENU );
364
+ if ( 'WIN' != substr( strtoupper( PHP_OS ), 0, 3 ) ):
365
+ _e( '<li>Temporarily set write permissions by clicking the button below. When you are finished editing, revert to read-only by clicking "Make read-only" under the "Files" tab.</li>', 'child-theme-configurator' );
366
+ ?><form action="?page=<?php echo $ctcpage; ?>" method="post">
367
+ <?php wp_nonce_field( apply_filters( 'chld_thm_cfg_action', 'ctc_update' ) ); ?>
368
+ <input name="ctc_set_writable" class="button" type="submit" value="<?php _e( 'Make files writable', 'child-theme-configurator' ); ?>"/></form><?php endif;
369
+ _e( '<li><a target="_blank" href="http://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants" title="Editin wp-config.php">Add your FTP/SSH credentials to the WordPress config file</a>.</li>', 'child-theme-configurator' );
370
+ if ( isset( $_SERVER[ 'SERVER_SOFTWARE' ] ) && preg_match( '%iis%i',$_SERVER[ 'SERVER_SOFTWARE' ] ) )
371
+ _e( '<li><a target="_blank" href="http://technet.microsoft.com/en-us/library/cc771170" title="Setting Application Pool Identity">Assign WordPress to an application pool that has write permissions</a> (Windows IIS systems).</li>', 'child-theme-configurator' );
372
+ _e( '<li><a target="_blank" href="http://codex.wordpress.org/Changing_File_Permissions" title="Changing File Permissions">Set write permissions on the server manually</a> (not recommended).</li>', 'child-theme-configurator' );
373
+ if ( 'WIN' != substr( strtoupper( PHP_OS ), 0, 3 ) ):
374
+ _e( '<li>Run PHP under Apache with suEXEC (contact your web host).</li>', 'child-theme-configurator' );
375
+ endif; ?>
376
+ </ol></p></div><?php
377
+ break;
378
+
379
+
380
+ case 'owner':
381
+
382
+ $ctcpage = apply_filters( 'chld_thm_cfg_admin_page', CHLD_THM_CFG_MENU ); // FIXME? ?>
383
+ <p><?php _e( 'This Child Theme is not owned by your website account. It may have been created by a prior version of this plugin or by another program. Moving forward, it must be owned by your website account to make changes. Child Theme Configurator will attempt to correct this when you click the button below.', 'child-theme-configurator' ) ?></p>
384
+ <form action="?page=<?php echo $ctcpage; ?>" method="post"><?php
385
+ wp_nonce_field( apply_filters( 'chld_thm_cfg_action', 'ctc_update' ) );
386
+ break;
387
+
388
+
389
+ case 'enqueue': ?>
390
+
391
+ <p><?php _e( 'Child Theme Configurator needs to update its internal data. Please set your preferences below and click "Generate Child Theme Files" to update your configuration.', 'child-theme-configurator' ) ?></p><?php
392
+ break;
393
+
394
+
395
+ case 'max_styles':
396
+
397
+ echo sprintf( __( '<strong>However, some styles could not be parsed due to memory limits.</strong> Try deselecting "Additional Stylesheets" below and click "Generate/Rebuild Child Theme Files". %sWhy am I seeing this?%s', 'child-theme-configurator' ),
398
+ '<a target="_blank" href="' . LILAEAMEDIA_URL . '/child-theme-configurator#php_memory">',
399
+ '</a>' );
400
+ break;
401
+
402
+
403
+ case 'config': ?>
404
+
405
+ <p><?php _e( 'Child Theme Configurator did not detect any configuration data because a previously configured Child Theme has been removed. Please follow the steps for "CONFIGURE an existing Child Theme" under the "Parent/Child" Tab.', 'child-theme-configurator' ) ?></p><?php
406
+ break;
407
+
408
+
409
+ case 'changed': ?>
410
+
411
+ <p><?php _e( 'Your stylesheet has changed since the last time you used the Configurator. Please follow the steps for "CONFIGURE an existing Child Theme" under the "Parent/Child" Tab or you will lose these changes.', 'child-theme-configurator' ) ?></p><?php
412
+ break;
413
+
414
+
415
+ case 'upgrade':
416
+ $child = $this->css()->get_prop( 'child' );
417
+ ?>
418
+
419
+ <?php if ( $child ): ?>
420
+ <div class="clearfix">
421
+ <div style="width:67%;float:left;margin:0">
422
+ <?php endif; ?>
423
+ <h3><?php _e( 'This version of Child Theme Configurator includes significant updates.', 'child-theme-configurator' ); ?></h3>
424
+ <p class="howto"><?php _e( 'A lot of time and testing has gone into this release but there are always edge cases. If you have any questions, please', 'child-theme-configurator' ); ?> <a href="<?php echo LILAEAMEDIA_URL; ?>/contact" target="_blank"><?php _e( 'Contact Us.', 'child-theme-configurator' ); ?></a></p>
425
+ <p class="howto"><?php _e( 'For more information, please open the Help tab at the top right or ', 'child-theme-configurator' ) ?> <a href="http://www.childthemeconfigurator.com/tutorial-videos/" target="_blank"><?php _e( 'click here to view the latest videos.', 'child-theme-configurator' ); ?></a></p>
426
+ <?php if ( $child ): ?>
427
+ <p><?php _e( 'It is a good idea to save a Zip Archive of your Child Theme before using this version for the first time (click the button to the right to download). Remember you can always export your child themes from the "Files" Tab.', 'child-theme-configurator' ); ?></p>
428
+ </div>
429
+ <div style="width:33%;margin:0;float:left;text-align:center"><h3><?php _e( 'Backup Child Theme', 'child-theme-configurator' ); ?></h3>
430
+ <?php include ( CHLD_THM_CFG_DIR . '/includes/forms/zipform.php' ); ?></div>
431
+ </div>
432
+ <?php endif; ?>
433
+ <?php endswitch; ?>
434
+ </div><?php
435
+ }
436
+
437
  }
438
  ?>
includes/class-ctc.php CHANGED
@@ -2,1620 +2,107 @@
2
  // Exit if accessed directly
3
  if ( !defined( 'ABSPATH' ) ) exit;
4
 
5
- /*
6
- Class: Child_Theme_Configurator
7
- Plugin URI: http://www.childthemeconfigurator.com/
8
- Description: Main Controller Class
9
- Version: 1.7.8
10
- Author: Lilaea Media
11
- Author URI: http://www.lilaeamedia.com/
12
- Text Domain: chld_thm_cfg
13
- Domain Path: /lang
14
- License: GPLv2
15
- Copyright (C) 2014-2015 Lilaea Media
16
- */
17
- class ChildThemeConfiguratorAdmin {
18
-
19
- // state
20
- var $is_ajax;
21
- var $is_get;
22
- var $is_post;
23
- var $skip_form;
24
- var $fs;
25
-
26
- var $fs_prompt;
27
- var $fs_method;
28
- var $uploadsubdir;
29
- var $menuName; // backward compatibility with plugin extension
30
- var $cache_updates = TRUE;
31
- var $debug = '';
32
- var $is_debug = 0;
33
- var $swatch_text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
34
- var $max_sel;
35
- var $sel_limit;
36
- // state arrays
37
- var $themes = array();
38
- var $errors = array();
39
- var $files = array();
40
- var $updates = array();
41
- var $memory = array();
42
- // objects
43
- var $css;
44
- var $ui;
45
- // config arrays
46
- var $postarrays = array(
47
- 'ctc_img',
48
- 'ctc_file_parnt',
49
- 'ctc_file_child',
50
- 'ctc_additional_css',
51
- );
52
- var $configfields = array(
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
- 'nowarn',
66
- );
67
- var $actionfields = array(
68
- 'load_styles',
69
- 'parnt_templates_submit',
70
- 'child_templates_submit',
71
- 'image_submit',
72
- 'theme_image_submit',
73
- 'theme_screenshot_submit',
74
- 'export_child_zip',
75
- 'reset_permission',
76
- 'templates_writable_submit',
77
- 'set_writable',
78
- 'upgrade',
79
- );
80
- var $imgmimes = array(
81
- 'jpg|jpeg|jpe' => 'image/jpeg',
82
- 'gif' => 'image/gif',
83
- 'png' => 'image/png',
84
- );
85
- var $excludes = array(
86
- 'inc',
87
- 'core',
88
- 'lang',
89
- 'css',
90
- 'js',
91
- 'lib',
92
- 'theme',
93
- 'options',
94
- );
95
-
96
- function __construct() {
97
- $this->menuName = CHLD_THM_CFG_MENU; // backward compatability for plugins extension
98
- $this->is_post = ( 'POST' == $_SERVER[ 'REQUEST_METHOD' ] );
99
- $this->is_get = ( 'GET' == $_SERVER[ 'REQUEST_METHOD' ] );
100
- $this->is_debug = get_option( CHLD_THM_CFG_OPTIONS . '_debug' );
101
- if ( $this->is_debug && ( $this->debug = get_site_transient( CHLD_THM_CFG_OPTIONS . '_debug' ) ) )
102
- delete_site_transient( CHLD_THM_CFG_OPTIONS . '_debug' );
103
- // sel_limit is now calculated based on free memory to prevent out of memory on serialization
104
- $bytes_free = $this->get_free_memory();
105
- $this->sel_limit = ( int ) ( $bytes_free / CHLD_THM_CFG_BPSEL );
106
- $this->debug( 'Free memory: ' . $bytes_free . ' max selectors: ' . $this->sel_limit, __FUNCTION__ );
107
- //$this->set_benchmark( 'before', 'execute', 'program' );
108
- }
109
-
110
- function enqueue_scripts() {
111
- wp_enqueue_style( 'chld-thm-cfg-admin', CHLD_THM_CFG_URL . 'css/chld-thm-cfg.min.css', array(), '1.7.8' );
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
115
- if ( !wp_script_is( 'jquery-ui-selectmenu', 'registered' ) ): // selectmenu.min.js
116
- wp_enqueue_script( 'jquery-ui-selectmenu', CHLD_THM_CFG_URL . 'js/selectmenu.min.js',
117
- array( 'jquery','jquery-ui-core','jquery-ui-position' ), FALSE, TRUE );
118
- endif;
119
- wp_enqueue_script( 'ctc-spectrum', CHLD_THM_CFG_URL . 'js/spectrum.min.js', array( 'jquery' ), FALSE, TRUE );
120
- wp_enqueue_script( 'ctc-thm-cfg-ctcgrad', CHLD_THM_CFG_URL . 'js/ctcgrad.min.js', array( 'jquery' ), FALSE, TRUE );
121
- wp_enqueue_script( 'chld-thm-cfg-admin', CHLD_THM_CFG_URL . 'js/chld-thm-cfg.min.js',
122
- array(
123
- 'jquery-ui-autocomplete',
124
- 'jquery-ui-selectmenu',
125
- 'ctc-spectrum',
126
- 'ctc-thm-cfg-ctcgrad'
127
- ), FALSE, TRUE );
128
- $localize_array = apply_filters( 'chld_thm_cfg_localize_script', array(
129
- 'ssl' => is_ssl(),
130
- 'homeurl' => get_home_url(),
131
- 'ajaxurl' => admin_url( 'admin-ajax.php' ),
132
- 'theme_uri' => get_theme_root_uri(),
133
- 'page' => CHLD_THM_CFG_MENU,
134
- 'themes' => $this->themes,
135
- 'source' => apply_filters( 'chld_thm_cfg_source_uri', get_theme_root_uri() . '/'
136
- . $this->css->get_prop( 'parnt' ) . '/style.css', $this->css ),
137
- 'target' => apply_filters( 'chld_thm_cfg_target_uri', get_theme_root_uri() . '/'
138
- . $this->css->get_prop( 'child' ) . '/style.css', $this->css ),
139
- 'parnt' => $this->css->get_prop( 'parnt' ),
140
- 'child' => $this->css->get_prop( 'child' ),
141
- 'addl_css' => $this->css->get_prop( 'addl_css' ),
142
- 'imports' => $this->css->get_prop( 'imports' ),
143
- 'is_debug' => $this->is_debug,
144
- '_background_url_txt' => __( 'URL/None', 'chld_thm_cfg' ),
145
- '_background_origin_txt' => __( 'Origin', 'chld_thm_cfg' ),
146
- '_background_color1_txt' => __( 'Color 1', 'chld_thm_cfg' ),
147
- '_background_color2_txt' => __( 'Color 2', 'chld_thm_cfg' ),
148
- '_border_width_txt' => __( 'Width/None', 'chld_thm_cfg' ),
149
- '_border_style_txt' => __( 'Style', 'chld_thm_cfg' ),
150
- '_border_color_txt' => __( 'Color', 'chld_thm_cfg' ),
151
- 'swatch_txt' => $this->swatch_text,
152
- 'load_txt' => __( 'Are you sure? This will replace your current settings.', 'chld_thm_cfg' ),
153
- 'important_txt' => __( '<span style="font-size:10px">!</span>', 'chld_thm_cfg' ),
154
- 'selector_txt' => __( 'Selectors', 'chld_thm_cfg' ),
155
- 'close_txt' => __( 'Close', 'chld_thm_cfg' ),
156
- 'edit_txt' => __( 'Edit Selector', 'chld_thm_cfg' ),
157
- 'cancel_txt' => __( 'Cancel', 'chld_thm_cfg' ),
158
- 'rename_txt' => __( 'Rename', 'chld_thm_cfg' ),
159
- 'css_fail_txt' => __( 'The stylesheet cannot be displayed.', 'chld_thm_cfg' ),
160
- 'child_only_txt' => __( '(Child Only)', 'chld_thm_cfg' ),
161
- 'inval_theme_txt' => __( 'Please enter a valid Child Theme.', 'chld_thm_cfg' ),
162
- 'inval_name_txt' => __( 'Please enter a valid Child Theme name.', 'chld_thm_cfg' ),
163
- 'theme_exists_txt' => __( '<strong>%s</strong> exists. Please enter a different Child Theme', 'chld_thm_cfg' ),
164
- 'js_txt' => __( 'The page could not be loaded correctly.',
165
- 'chld_thm_cfg' ),
166
- 'jquery_txt' => __( 'Conflicting or out-of-date jQuery libraries were loaded by another plugin:',
167
- 'chld_thm_cfg' ),
168
- 'plugin_txt' => __( 'Deactivating or replacing plugins may resolve this issue.', 'chld_thm_cfg' ),
169
- 'contact_txt' => sprintf( __( '%sWhy am I seeing this?%s',
170
- 'chld_thm_cfg' ),
171
- '<a target="_blank" href="' . CHLD_THM_CFG_DOCS_URL . '/how-to-use/#script_dep">',
172
- '</a>' ),
173
- ) );
174
- wp_localize_script(
175
- 'chld-thm-cfg-admin',
176
- 'ctcAjax',
177
- apply_filters( 'chld_thm_cfg_localize_array', $localize_array )
178
- );
179
- }
180
-
181
- /**
182
- * initialize configurator
183
- */
184
- function ctc_page_init () {
185
- // get all available themes
186
- $this->get_themes();
187
- // load config data and validate
188
- $this->load_config();
189
- // perform any checks prior to processing config data
190
- do_action( 'chld_thm_cfg_preprocess' );
191
- // process any additional forms
192
- do_action( 'chld_thm_cfg_forms', $this ); // hook for custom forms
193
- // process main post data
194
- $this->process_post();
195
- // initialize UI
196
- include_once( CHLD_THM_CFG_DIR . '/includes/class-ctc-ui.php' );
197
- $this->ui = new ChildThemeConfiguratorUI();
198
- // initialize help
199
- $this->ui->render_help_content();
200
- // load styles and scripts
201
- add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 99 );
202
- // load web fonts for this theme
203
- $this->load_imports();
204
- }
205
-
206
- function render() {
207
- $this->ui->render();
208
- }
209
-
210
- function get_themes() {
211
- // create cache of theme info
212
- $this->themes = array( 'child' => array(), 'parnt' => array() );
213
- foreach ( wp_get_themes() as $theme ):
214
- // organize into parent and child themes
215
- $group = $theme->parent() ? 'child' : 'parnt';
216
- // get the theme slug
217
- $slug = $theme->get_stylesheet();
218
- // get the theme slug
219
- $version = $theme->get( 'Version' );
220
- // strip auto-generated timestamp from CTC child theme version
221
- if ( 'child' == $group ) $version = preg_replace("/\.\d{6}\d+$/", '', $version );
222
- // add theme to themes array
223
- $this->themes[ $group ][ $slug ] = array(
224
- 'Template' => $theme->get( 'Template' ),
225
- 'Name' => $theme->get( 'Name' ),
226
- 'ThemeURI' => $theme->get( 'ThemeURI' ),
227
- 'Author' => $theme->get( 'Author' ),
228
- 'AuthorURI' => $theme->get( 'AuthorURI' ),
229
- 'Descr' => $theme->get( 'Description' ),
230
- 'Tags' => $theme->get( 'Tags' ),
231
- 'Version' => $version,
232
- 'screenshot' => $theme->get_screenshot(),
233
- 'allowed' => $theme->is_allowed(),
234
- );
235
- endforeach;
236
- }
237
-
238
- function validate_post( $action = 'ctc_update', $noncefield = '_wpnonce', $cap = 'install_themes' ) {
239
- // security: request must be post, user must have permission, referrer must be local and nonce must match
240
- return ( $this->is_post
241
- && current_user_can( $cap ) // ( 'edit_themes' )
242
- && ( $this->is_ajax ? check_ajax_referer( $action, $noncefield, FALSE ) :
243
- check_admin_referer( $action, $noncefield, FALSE ) ) );
244
- }
245
-
246
- function load_config() {
247
- include_once( CHLD_THM_CFG_DIR . '/includes/class-ctc-css.php' );
248
- $this->css = new ChildThemeConfiguratorCSS();
249
- if ( FALSE !== $this->css->load_config() ):
250
- // if themes do not exist reinitialize
251
- if ( ! $this->check_theme_exists( $this->css->get_prop( 'child' ) )
252
- || ! $this->check_theme_exists( $this->css->get_prop( 'parnt' ) ) ):
253
- add_action( 'admin_notices', array( $this, 'config_notice' ) );
254
- $this->css = new ChildThemeConfiguratorCSS();
255
- $this->css->enqueue = 'enqueue';
256
- endif;
257
- else:
258
- // this is a fresh install
259
- $this->css->enqueue = 'enqueue';
260
- endif;
261
- do_action( 'chld_thm_cfg_load' );
262
- if ( $this->is_get ):
263
- if ( $this->css->get_prop( 'child' ) ):
264
- // get filesystem credentials if available
265
- $this->verify_creds();
266
- $stylesheet = apply_filters( 'chld_thm_cfg_target', $this->css->get_child_target( 'style.css' ), $this->css );
267
- // check file permissions
268
- if ( !is_writable( $stylesheet ) && !$this->fs ):
269
- add_action( 'admin_notices', array( $this, 'writable_notice' ) );
270
- endif;
271
- // enqueue flag will be null for existing install < 1.6.0
272
- if ( !isset( $this->css->enqueue ) ):
273
- add_action( 'admin_notices', array( $this, 'enqueue_notice' ) );
274
- endif;
275
- endif;
276
- // check if max selectors reached
277
- if ( isset( $this->css->max_sel ) && $this->css->max_sel ):
278
- $this->debug( 'Max selectors exceeded.', __FUNCTION__ );
279
- //$this->errors[] = __( 'Maximum number of styles exceeded.', 'chld_thm_cfg' );
280
- add_filter( 'chld_thm_cfg_update_msg', array( $this, 'max_styles_notice' ), 20 );
281
- endif;
282
- // check if file ownership is messed up from old version or other plugin
283
- // by comparing owner of plugin to owner of child theme:
284
- if ( fileowner( $this->css->get_child_target( '' ) ) != fileowner( CHLD_THM_CFG_DIR ) ):
285
- add_action( 'admin_notices', array( $this, 'owner_notice' ) );
286
- endif;
287
- endif;
288
- }
289
-
290
- function cache_debug() {
291
- $this->updates[] = array(
292
- 'obj' => 'debug',
293
- 'key' => '',
294
- 'data' => $this->print_debug( TRUE ),
295
- );
296
- }
297
- /**
298
- * ajax callback for saving form data
299
- */
300
- function ajax_save_postdata( $action = 'ctc_update' ) {
301
- $this->is_ajax = TRUE;
302
-
303
- // security check
304
- if ( $this->validate_post( $action ) ):
305
- if ( 'ctc_plugin' == $action ) do_action( 'chld_thm_cfg_pluginmode' );
306
- $this->verify_creds(); // initialize filesystem access
307
- // get configuration data from options API
308
- if ( FALSE !== $this->load_config() ): // sanity check: only update if config data exists
309
- if ( isset( $_POST[ 'ctc_is_debug' ] ) ):
310
- // toggle debug
311
- $this->toggle_debug();
312
- else:
313
- $this->css->parse_post_data(); // parse any passed values
314
- // if child theme config has been set up, save new data
315
- // return recent edits and selected stylesheets as cache updates
316
- if ( $this->css->get_prop( 'child' ) ):
317
- // hook for add'l plugin files and subdirectories
318
- do_action( 'chld_thm_cfg_addl_files', $this );
319
- $this->css->write_css();
320
- // add any additional updates to pass back to browser
321
- do_action( 'chld_thm_cfg_cache_updates' );
322
- /*
323
- $this->updates[] = array(
324
- 'obj' => 'addl_css',
325
- 'key' => '',
326
- 'data' => $this->css->get_prop( 'addl_css' ),
327
- );
328
- */
329
- endif;
330
-
331
- // update config data in options API
332
- $this->css->save_config();
333
- endif;
334
- endif;
335
- endif;
336
- $result = $this->css->obj_to_utf8( $this->updates );
337
- // send all updates back to browser to update cache
338
- die( json_encode( $result ) );
339
- }
340
-
341
- /**
342
- * ajax callback to query config data
343
- */
344
- function ajax_query_css( $action = 'ctc_update' ) {
345
- $this->is_ajax = TRUE;
346
- if ( $this->validate_post( $action ) ):
347
- if ( 'ctc_plugin' == $action ) do_action( 'chld_thm_cfg_pluginmode' );
348
- $this->load_config();
349
- $regex = "/^ctc_query_/";
350
- foreach( preg_grep( $regex, array_keys( $_POST ) ) as $key ):
351
- $name = preg_replace( $regex, '', $key );
352
- $param[ $name ] = sanitize_text_field( $_POST[ $key ] );
353
- endforeach;
354
- if ( !empty( $param[ 'obj' ] ) ):
355
- // add any additional updates to pass back to browser
356
- $this->updates[] = array(
357
- 'key' => isset( $param[ 'key' ] ) ? $param[ 'key' ] : '',
358
- 'obj' => $param[ 'obj' ],
359
- 'data' => $this->css->get_prop( $param[ 'obj' ], $param ),
360
- );
361
- do_action( 'chld_thm_cfg_cache_updates' );
362
- die( json_encode( $this->updates ) );
363
- endif;
364
- endif;
365
- die( 0 );
366
- }
367
-
368
- /***
369
- * Handles processing for all form submissions.
370
- * Older versions ( < 1.6.0 ) smelled like spaghetti so we moved conditions
371
- * to switch statement with the main setup logic in a separate function.
372
- */
373
- function process_post() {
374
- // make sure this is a post
375
- if ( $this->is_post ):
376
- // see if a valid action was passed
377
- foreach ( $this->actionfields as $field ):
378
- if ( in_array( 'ctc_' . $field, array_keys( $_POST ) ) ):
379
- $actionfield = $field;
380
- break;
381
- endif;
382
- endforeach;
383
- if ( empty( $actionfield ) ) return FALSE;
384
-
385
- // make sure post passes security checkpoint
386
- $this->errors = array();
387
- if ( $this->validate_post( apply_filters( 'chld_thm_cfg_action', 'ctc_update' ) ) ):
388
- // zip export does not require filesystem access so check that first
389
- if ( 'export_child_zip' == $actionfield ):
390
- $this->export_zip();
391
- // if we get here the zip failed
392
- $this->errors[] = __( 'Zip file creation failed.', 'chld_thm_cfg' );
393
- // all other actions require filesystem access
394
- else:
395
- // handle uploaded file before checking filesystem
396
- if ( 'theme_image_submit' == $actionfield && isset( $_FILES[ 'ctc_theme_image' ] ) ):
397
- $this->handle_file_upload( 'ctc_theme_image', $this->imgmimes );
398
- elseif ( 'theme_screenshot_submit' == $actionfield && isset( $_FILES[ 'ctc_theme_screenshot' ] ) ):
399
- $this->handle_file_upload( 'ctc_theme_screenshot', $this->imgmimes );
400
- endif;
401
- // now we need to check filesystem access
402
- $args = preg_grep( "/nonce/", array_keys( $_POST ), PREG_GREP_INVERT );
403
- $this->verify_creds( $args );
404
- if ( $this->fs ):
405
- $msg = FALSE;
406
- // we have filesystem access so proceed with specific actions
407
- switch( $actionfield ):
408
- case 'load_styles':
409
- // main child theme setup function
410
- $msg = $this->setup_child_theme();
411
- break;
412
-
413
- case 'parnt_templates_submit':
414
- // copy parent templates to child
415
- if ( isset( $_POST[ 'ctc_file_parnt' ] ) ):
416
- foreach ( $_POST[ 'ctc_file_parnt' ] as $file ):
417
- $this->copy_parent_file( sanitize_text_field( $file ) );
418
- endforeach;
419
- $msg = '8&tab=file_options';
420
- endif;
421
- break;
422
-
423
- case 'child_templates_submit':
424
- // delete child theme files
425
- if ( isset( $_POST[ 'ctc_file_child' ] ) ):
426
- if ( in_array( 'functions', $_POST[ 'ctc_file_child' ] ) ):
427
- $this->errors[] =
428
- __( 'The Functions file is required and cannot be deleted.',
429
- 'chld_thm_cfg' );
430
- else:
431
- foreach ( $_POST[ 'ctc_file_child' ] as $file ):
432
- $this->delete_child_file( sanitize_text_field( $file ),
433
- ( preg_match( "/^style|ctc\-plugins/", $file ) ? 'css' : 'php' ) );
434
- endforeach;
435
- $msg = '8&tab=file_options';
436
- endif;
437
- endif;
438
- break;
439
-
440
- case 'image_submit':
441
- // delete child theme images
442
- if ( isset( $_POST[ 'ctc_img' ] ) ):
443
- foreach ( $_POST[ 'ctc_img' ] as $file ):
444
- $this->delete_child_file( 'images/' . sanitize_text_field( $file ), 'img' );
445
- endforeach;
446
- $msg = '8&tab=file_options';
447
- endif;
448
- break;
449
-
450
- case 'templates_writable_submit':
451
- // make specific files writable ( systems not running suExec )
452
- if ( isset( $_POST[ 'ctc_file_child' ] ) ):
453
- foreach ( $_POST[ 'ctc_file_child' ] as $file ):
454
- $this->set_writable( sanitize_text_field( $file ),
455
- ( 0 === strpos( $file, 'style' ) ? 'css' : 'php' ) );
456
- endforeach;
457
- $msg = '8&tab=file_options';
458
- endif;
459
- break;
460
-
461
- case 'set_writable':
462
- // make child theme style.css and functions.php writable ( systems not running suExec )
463
- $this->set_writable(); // no argument defaults to style.css
464
- $this->set_writable( 'functions' );
465
- $msg = '8&tab=file_options';
466
- break;
467
-
468
- case 'reset_permission':
469
- // make child theme read-only ( systems not running suExec )
470
- $this->unset_writable();
471
- $msg = '8&tab=file_options';
472
- break;
473
-
474
- case 'theme_image_submit':
475
- // move uploaded child theme images (now we have filesystem access)
476
- if ( isset( $_POST[ 'movefile' ] ) ):
477
- $this->move_file_upload( 'images' );
478
- $msg = '8&tab=file_options';
479
- endif;
480
- break;
481
-
482
- case 'theme_screenshot_submit':
483
- // move uploaded child theme screenshot (now we have filesystem access)
484
- if ( isset( $_POST[ 'movefile' ] ) ):
485
- // remove old screenshot
486
- foreach( array_keys( $this->imgmimes ) as $extreg ):
487
- foreach ( explode( '|', $extreg ) as $ext ):
488
- $this->delete_child_file( 'screenshot', $ext );
489
- endforeach;
490
- endforeach;
491
- $this->move_file_upload( '' );
492
- $msg = '8&tab=file_options';
493
- endif;
494
- break;
495
- default:
496
- // assume we are on the files tab so just redirect there
497
- $msg = '8&tab=file_options';
498
- endswitch;
499
- endif; // end filesystem condition
500
- endif; // end zip export condition
501
- if ( empty( $this->errors ) && empty( $this->fs_prompt ) )
502
- // no errors so we redirect with confirmation message
503
- $this->update_redirect( $msg );
504
- // otherwise fail gracefully
505
- $msg = NULL;
506
- return FALSE;
507
- endif; // end post validation condition
508
- // if you end up here you are not welcome
509
- $msg = NULL;
510
- $this->errors[] = __( 'You do not have permission to configure child themes.', 'chld_thm_cfg' );
511
- endif; // end request method condition
512
- return FALSE;
513
- }
514
-
515
- function toggle_debug() {
516
- $debug = '';
517
- if ( $_POST[ 'ctc_is_debug' ] ):
518
- $this->is_debug = 1;
519
- $debug = $this->print_debug( TRUE );
520
- else:
521
- $this->is_debug = 0;
522
- endif;
523
- update_option( CHLD_THM_CFG_OPTIONS . '_debug', $this->is_debug );
524
- $this->updates[] = array(
525
- 'obj' => 'debug',
526
- 'key' => '',
527
- 'data' => $debug,
528
- );
529
- }
530
-
531
- /***
532
- * Handle the creation or update of a child theme
533
- */
534
- function setup_child_theme() {
535
- // sanitize and extract config fields into local vars
536
- foreach ( $this->configfields as $configfield ):
537
-
538
- $varparts = explode( '_', $configfield );
539
- $varname = end( $varparts );
540
- ${$varname} = empty( $_POST[ 'ctc_' . $configfield ] ) ? '' :
541
- preg_replace( "/\s+/s", ' ', sanitize_text_field( $_POST[ 'ctc_' . $configfield ] ) );
542
- $this->debug( 'Extracting var ' . $varname . ' from ctc_' . $configfield . ' value: ' . ${$varname} , __FUNCTION__ );
543
- endforeach;
544
-
545
- // legacy plugin extension needs parent/child values but this version disables the inputs
546
- // so get we them from current css object
547
- if ( !$this->is_theme( $configtype ) && $this->is_legacy() ):
548
- $parnt = $this->css->get_prop( 'parnt' );
549
- $child = $this->css->get_prop( 'child' );
550
- $name = $this->css->get_prop( 'child_name' );
551
- endif;
552
-
553
- // validate parent and child theme inputs
554
- if ( $parnt ):
555
- if ( ! $this->check_theme_exists( $parnt ) ):
556
- $this->errors[] = sprintf(
557
- __( '%s does not exist. Please select a valid Parent Theme.',
558
- 'chld_thm_cfg' ), $parnt );
559
- endif;
560
- else:
561
- $this->errors[] = __( 'Please select a valid Parent Theme.', 'chld_thm_cfg' );
562
- endif;
563
- if ( 'existing' == $type && empty( $child ) ):
564
- $this->errors[] = __( 'Please enter a valid Child Theme directory.', 'chld_thm_cfg' );
565
- endif;
566
- if ( empty( $name ) ):
567
- $name = ucfirst( $child );
568
- endif;
569
- // if this is a shiny brand new child theme certain rules apply
570
- if ( 'new' == $type ):
571
- if ( empty( $template ) && empty( $name ) ):
572
- $this->errors[] = __( 'Please enter a valid Child Theme template name.', 'chld_thm_cfg' );
573
- else:
574
- $child = preg_replace( "%[^\w\-]%", '', empty( $template ) ? $name : $template );
575
- if ( $this->check_theme_exists( $child ) ):
576
- $this->errors[] = sprintf(
577
- __( '<strong>%s</strong> exists. Please enter a different Child Theme template name.',
578
- 'chld_thm_cfg' ), $child );
579
- endif;
580
- endif;
581
- endif;
582
-
583
- // clone existing child theme
584
- if ( 'existing' == $type && isset( $_POST[ 'ctc_duplicate_theme' ] ) ):
585
- $clone = strtolower( preg_replace( "%[^\w\-]%", '', sanitize_text_field( $_POST[ 'ctc_duplicate_theme_slug' ] ) ) );
586
- if ( empty( $clone ) ):
587
- $this->errors[] = __( 'Please enter a valid Child Theme template name.', 'chld_thm_cfg' );
588
- else:
589
- if ( $this->check_theme_exists( $clone ) ):
590
- $this->errors[] = sprintf(
591
- __( '<strong>%s</strong> exists. Please enter a different Child Theme template name.',
592
- 'chld_thm_cfg' ), $clone );
593
- else:
594
- $this->clone_child_theme( $child, $clone );
595
- if ( empty( $this->errors ) ):
596
- $this->copy_theme_mods( $child, $clone );
597
- $child = $clone;
598
- endif;
599
- endif;
600
- endif;
601
- endif;
602
-
603
- if ( FALSE === $this->verify_child_dir( $child ) ):
604
- $this->errors[] = __( 'Your theme directories are not writable.', 'chld_thm_cfg' );
605
- add_action( 'admin_notices', array( $this, 'writable_notice' ) );
606
- endif;
607
-
608
- // if no errors so far, we are good to create child theme
609
- if ( empty( $this->errors ) ):
610
- // save imports in case this is a rebuild
611
- $imports = $this->css->imports;
612
- $nowarn = ( $nowarn || $this->css->nowarn ) ? 1 : 0;
613
- // reset everything else
614
- $this->css = new ChildThemeConfiguratorCSS();
615
- // restore imports if this is a rebuild
616
- $this->css->imports = $imports;
617
- $this->css->nowarn = $nowarn;
618
- // parse parent stylesheet if theme or legacy plugin extension
619
- if ( $this->is_theme( $configtype ) || $this->is_legacy() ):
620
- add_action( 'chld_thm_cfg_parse_stylesheets', array( &$this, 'parse_parent_stylesheet' ) );
621
- if ( is_multisite() )
622
- add_action( 'chld_thm_cfg_addl_options', array( &$this, 'network_enable' ) );
623
- endif;
624
-
625
- add_action( 'chld_thm_cfg_parse_stylesheets', array( &$this, 'parse_additional_stylesheets' ) );
626
- add_action( 'chld_thm_cfg_parse_stylesheets', array( &$this, 'parse_child_stylesheet' ) );
627
-
628
- // function to support wp_filesystem requirements
629
- if ( $this->is_theme( $configtype ) ):
630
- // is theme means this is not a plugin stylesheet config
631
- add_action( 'chld_thm_cfg_addl_files', array( &$this, 'add_base_files' ), 10, 2 );
632
- add_action( 'chld_thm_cfg_addl_files', array( &$this, 'copy_screenshot' ), 10, 2 );
633
- add_action( 'chld_thm_cfg_addl_files', array( &$this, 'enqueue_parent_css' ), 15, 2 );
634
- elseif( $this->is_legacy() && has_action( 'chld_thm_cfg_addl_files' ) ):
635
- // backwards compatability for plugins extension < 2.0.0 (before pro)
636
- // action exists so we have to hijack it to use new filesystem checks
637
- remove_all_actions( 'chld_thm_cfg_addl_files' );
638
- add_action( 'chld_thm_cfg_addl_files', array( &$this, 'write_addl_files' ), 10, 2 );
639
- $this->css->set_prop( 'configtype', $configtype );
640
- endif;
641
-
642
- // update with new parameters
643
- $this->css->set_prop( 'parnt', $parnt );
644
- $this->css->set_prop( 'child', $child );
645
- $this->css->set_prop( 'child_name', $name );
646
- $this->css->set_prop( 'child_author', $author );
647
- $this->css->set_prop( 'child_themeuri', $themeuri );
648
- $this->css->set_prop( 'child_authoruri', $authoruri );
649
- $this->css->set_prop( 'child_descr', $descr );
650
- $this->css->set_prop( 'child_tags', $tags );
651
- $this->css->set_prop( 'child_version', strlen( $version ) ? $version : '1.0' );
652
 
653
- $this->css->set_prop( 'nowarn', $nowarn );
654
- // set stylesheet handling option
655
- if ( isset( $_POST[ 'ctc_parent_enqueue' ] ) )
656
- $this->css->set_prop( 'enqueue', sanitize_text_field( $_POST[ 'ctc_parent_enqueue' ] ) );
657
- elseif ( !$this->is_theme( $configtype ) )
658
- $this->css->set_prop( 'enqueue', 'enqueue' );
659
-
660
- // plugin hooks for additional stylesheet handling options
661
- do_action( 'chld_thm_cfg_stylesheet_handling' );
662
- do_action( 'chld_thm_cfg_existing_theme' );
663
- // plugin hook to parse additional or non-standard files
664
- do_action( 'chld_thm_cfg_parse_stylesheets' );
665
-
666
- // copy menus, widgets and other customizer options from parent to child if selected
667
- if ( isset( $_POST[ 'ctc_parent_mods' ] ) ) // && empty( $_POST[ 'ctc_duplicate_theme' ] ) )
668
- $this->copy_theme_mods( $parnt, $child );
669
-
670
- // run code generation function in read-only mode to add existing external stylesheet links to config data
671
- $this->enqueue_parent_css( $this->css, TRUE );
672
- // hook for add'l plugin files and subdirectories. Must run after stylesheets are parsed to apply latest options
673
- do_action( 'chld_thm_cfg_addl_files', $this );
674
- // do not continue if errors
675
- if ( empty ( $this->errors ) ):
676
- // set flag to skip import link conversion on ajax save
677
- $this->css->converted = 1;
678
-
679
- // try to write new stylsheet. If it fails send alert.
680
- if ( FALSE === $this->css->write_css( isset( $_POST[ 'ctc_backup' ] ) ) ):
681
- $this->debug( 'failed to write', __FUNCTION__ );
682
- $this->errors[] = __( 'Your stylesheet is not writable.', 'chld_thm_cfg' );
683
- add_action( 'admin_notices', array( $this, 'writable_notice' ) );
684
- return FALSE;
685
- endif;
686
-
687
- // save new object to WP options table
688
- $this->css->save_config();
689
-
690
- // plugin hook for additional child theme setup functions
691
- do_action( 'chld_thm_cfg_addl_options', $this );
692
-
693
- // return message id 1, which says new child theme created successfully;
694
- return 1;
695
- endif;
696
- endif;
697
- return FALSE;
698
- }
699
-
700
- function load_imports() {
701
- // allows fonts and other externals to be previewed
702
- // loads early not to conflict with admin stylesheets
703
- if ( $imports = $this->css->get_prop( 'imports' ) ):
704
- $ext = 0;
705
- foreach ( $imports as $import ):
706
- $this->convert_import_to_enqueue( $import, ++$ext, TRUE );
707
- endforeach;
708
- endif;
709
- }
710
-
711
- /*
712
- * TODO: this is a stub for future use
713
- */
714
- function sanitize_options( $input ) {
715
- return $input;
716
- }
717
-
718
- /**
719
- * remove slashes and non-alphas from stylesheet name
720
- */
721
- function sanitize_slug( $slug ) {
722
- return preg_replace( "/[^\w\-]/", '', $slug );
723
- }
724
-
725
- function update_redirect( $msg = 1 ) {
726
- if ( empty( $this->is_ajax ) ):
727
- if ( $this->is_debug )
728
- set_site_transient( CHLD_THM_CFG_OPTIONS . '_debug', $this->debug, 3600 );
729
- $ctcpage = apply_filters( 'chld_thm_cfg_admin_page', CHLD_THM_CFG_MENU );
730
- $screen = get_current_screen()->id;
731
- wp_safe_redirect(
732
- ( strstr( $screen, '-network' ) ? network_admin_url( 'themes.php' ) : admin_url( 'tools.php' ) )
733
- . '?page=' . $ctcpage . ( $msg ? '&updated=' . $msg : '' ) );
734
- die();
735
- endif;
736
- }
737
-
738
- function verify_child_dir( $path ) {
739
- $this->debug( 'Verifying child dir: ' . $path, __FUNCTION__ );
740
- if ( !$this->fs ):
741
- $this->debug( 'No filesystem access.', __FUNCTION__ );
742
- return FALSE; // return if no filesystem access
743
- endif;
744
- global $wp_filesystem;
745
- $themedir = $wp_filesystem->find_folder( get_theme_root() );
746
- if ( ! $wp_filesystem->is_writable( $themedir ) ):
747
- $this->debug( 'Directory not writable: ' . $themedir, __FUNCTION__ );
748
- return FALSE;
749
- endif;
750
- $childparts = explode( '/', $this->normalize_path( $path ) );
751
- while ( count( $childparts ) ):
752
- $subdir = array_shift( $childparts );
753
- if ( empty( $subdir ) ) continue;
754
- $themedir = trailingslashit( $themedir ) . $subdir;
755
- if ( ! $wp_filesystem->is_dir( $themedir ) ):
756
- if ( ! $wp_filesystem->mkdir( $themedir, FS_CHMOD_DIR ) ):
757
- $this->debug( 'Could not make directory: ' . $themedir, __FUNCTION__ );
758
- return FALSE;
759
- endif;
760
- elseif ( ! $wp_filesystem->is_writable( $themedir ) ):
761
- $this->debug( 'Directory not writable: ' . $themedir, __FUNCTION__ );
762
- return FALSE;
763
- endif;
764
- endwhile;
765
- $this->debug( 'Child dir verified: ' . $themedir, __FUNCTION__ );
766
- return TRUE;
767
- }
768
-
769
- function add_base_files( $obj ){
770
- // add functions.php file
771
- $contents = "<?php
772
- // Exit if accessed directly
773
- if ( !defined( 'ABSPATH' ) ) exit;
774
- ";
775
- $this->write_child_file( 'functions.php', $contents );
776
- $this->write_child_file( 'style.css', $this->css->get_css_header() );
777
- }
778
-
779
- // parses @import syntax and converts to wp_enqueue_style statement
780
- function convert_import_to_enqueue( $import, $count, $execute = FALSE ) {
781
- $relpath = $this->css->get_prop( 'child' );
782
- $import = preg_replace( "#^.*?url\(([^\)]+?)\).*#", "$1", $import );
783
- $import = preg_replace( "#[\'\"]#", '', $import );
784
- $path = $this->css->convert_rel_url( trim( $import ), $relpath , FALSE );
785
- $abs = preg_match( '%(https?:)?//%', $path );
786
- if ( $execute )
787
- wp_enqueue_style( 'chld_thm_cfg_ext' . $count, $abs ? $path : trailingslashit( get_theme_root_uri() ) . $path );
788
- else
789
- return "wp_enqueue_style( 'chld_thm_cfg_ext" . $count . "', "
790
- . ( $abs ? "'" . $path . "'" : "trailingslashit( get_theme_root_uri() ) . '" . $path . "'" ) . ' );';
791
- }
792
-
793
- // converts enqueued path into @import statement for config settings
794
- function convert_enqueue_to_import( $path ) {
795
- if ( preg_match( '%(https?:)?//%', $path ) ):
796
- $this->css->imports[ 'child' ]['@import url(' . $path . ')'] = 1;
797
- return;
798
- endif;
799
- $regex = '#^' . preg_quote( trailingslashit( $this->css->get_prop( 'child' ) ) ) . '#';
800
- $path = preg_replace( $regex, '', $path, -1, $count );
801
- if ( $count ):
802
- $this->css->imports[ 'child' ]['@import url(' . $path . ')'] = 1;
803
- return;
804
- endif;
805
- $parent = trailingslashit( $this->css->get_prop( 'parnt' ) );
806
- $regex = '#^' . preg_quote( $parent ) . '#';
807
- $path = preg_replace( $regex, '../' . $parent, $path, -1, $count );
808
- if ( $count )
809
- $this->css->imports[ 'child' ]['@import url(' . $path . ')'] = 1;
810
- }
811
-
812
- /**
813
- * Generates wp_enqueue_script code block for child theme functions file
814
- * Enqueues parent and/or child stylesheet depending on value of 'enqueue' setting.
815
- * If external imports are present, it enqueues them as well.
816
- */
817
- function enqueue_parent_code(){
818
- $imports = $this->css->get_prop( 'imports' );
819
- $enqueues = array();
820
- $code = '';
821
- // enqueue parent stylesheet
822
- if ( 'enqueue' == $this->css->enqueue || 'both' == $this->css->enqueue )
823
- $enqueues[] = " wp_enqueue_style( 'chld_thm_cfg_parent', trailingslashit( get_template_directory_uri() ) . 'style.css' );";
824
- // enqueue external stylesheets (previously used @import in the stylesheet)
825
- if ( !empty( $imports ) ):
826
- $ext = 0;
827
- foreach ( $imports as $import ):
828
- $ext++;
829
- $enqueues[] = ' ' . $this->convert_import_to_enqueue( $import, $ext );
830
- endforeach;
831
- endif;
832
- if ( count( $enqueues ) ):
833
- $code = "// AUTO GENERATED - Do not modify or remove comment markers above or below:
834
- ";
835
- $code .= "
836
-
837
- if ( !function_exists( 'chld_thm_cfg_parent_css' ) ):
838
- function chld_thm_cfg_parent_css() {
839
- ";
840
- $code .= implode( "\n", $enqueues );
841
- $code .= "
842
- }
843
- endif;
844
- add_action( 'wp_enqueue_scripts', 'chld_thm_cfg_parent_css' );
845
- ";
846
- endif;
847
- // enqueue child stylesheet. This feature was added to avoid using @import to load parent stylesheet when links are hard-coded into header.php
848
- if ( 'child' == $this->css->enqueue || 'both' == $this->css->enqueue ):
849
- $code .= "
850
- if ( !function_exists( 'chld_thm_cfg_child_css' ) ):
851
- function chld_thm_cfg_child_css() {
852
- wp_enqueue_style( 'chld_thm_cfg_child', get_stylesheet_uri() );
853
- }
854
- endif;
855
- add_action( 'wp_enqueue_scripts', 'chld_thm_cfg_child_css', 999 );
856
- ";
857
- endif;
858
- return explode( "\n", apply_filters( 'chld_thm_cfg_enqueue_code_filter', $code ) );
859
- }
860
-
861
- // updates function file with wp_enqueue_script code block. If getexternals flag is passed function is run in read-only mode
862
- function enqueue_parent_css( $obj, $getexternals = FALSE ) {
863
- $marker = 'ENQUEUE PARENT ACTION';
864
- $insertion = $this->enqueue_parent_code();
865
- if ( $filename = $this->css->is_file_ok( $this->css->get_child_target( 'functions.php' ), 'write' ) )
866
- $this->insert_with_markers( $filename, $marker, $insertion, $getexternals );
867
- }
868
-
869
- /**
870
- * Update functions file with wp_enqueue_style code block. Runs in read-only mode if getexternals is passed.
871
- * This function uses the same method as the WP core function that updates .htaccess
872
- * we would have used WP's insert_with_markers function,
873
- * but it does not use wp_filesystem API.
874
- */
875
- function insert_with_markers( $filename, $marker, $insertion, $getexternals = FALSE ) {
876
- if ( count( $this->errors ) ):
877
- $this->debug( 'Errors detected, returning', __FUNCTION__ );
878
- return FALSE;
879
- endif;
880
- // first check if this is an ajax update
881
- if ( $this->is_ajax && is_readable( $filename ) && is_writable( $filename ) ):
882
- // ok to proceed
883
- $this->debug( 'Ajax update, bypassing wp filesystem.', __FUNCTION__ );
884
- $markerdata = explode( "\n", @file_get_contents( $filename ) );
885
- elseif ( !$this->fs ):
886
- $this->debug( 'No filesystem access.', __FUNCTION__ );
887
- return FALSE; // return if no filesystem access
888
- else:
889
- global $wp_filesystem;
890
- if( !$wp_filesystem->exists( $this->fspath( $filename ) ) ):
891
- // make sure file exists with php header
892
- $this->debug( 'No functions file, creating...', __FUNCTION__ );
893
- $this->add_base_files( $this );
894
- endif;
895
- // get_contents_array returns extra linefeeds so just split it ourself
896
- $markerdata = explode( "\n", $wp_filesystem->get_contents( $this->fspath( $filename ) ) );
897
- endif;
898
- $newfile = '';
899
- $externals = array();
900
- $phpopen = 0;
901
- $in_comment = 0;
902
- $foundit = FALSE;
903
- $lasttoken = '';
904
- if ( $markerdata ):
905
- $state = TRUE;
906
- foreach ( $markerdata as $n => $markerline ) {
907
- // update open state
908
- $openstars = 0;
909
- $closestars = 0;
910
- // remove double slash comment to end of line
911
- $str = preg_replace( "/\/\/.*$/", '', $markerline );
912
- preg_match_all("/(<\?|\?>|\*\/|\/\*)/", $str, $matches );
913
- if ( $matches ):
914
- foreach ( $matches[1] as $token ):
915
- $lasttoken = $token;
916
- if ( '/*' == $token ):
917
- $in_comment = 1;
918
- elseif ( '*/' == $token ):
919
- $in_comment = 0;
920
- elseif ( '<?' == $token && !$in_comment ):
921
- $phpopen = 1;
922
- elseif ( '?>' == $token && !$in_comment ):
923
- $phpopen = 0;
924
- endif;
925
- endforeach;
926
- endif;
927
- if ( strpos( $markerline, '// BEGIN ' . $marker ) !== FALSE )
928
- $state = FALSE;
929
- if ( $state ):
930
- if ( $n + 1 < count( $markerdata ) )
931
- $newfile .= "{$markerline}\n";
932
- else
933
- $newfile .= "{$markerline}";
934
- elseif ( $getexternals ):
935
- // look for existing external stylesheets and add to imports config data
936
- if ( preg_match( "/wp_enqueue_style.+?'chld_thm_cfg_ext\d+'.+?'(.+?)'/", $markerline, $matches ) )
937
- $this->convert_enqueue_to_import( $matches[ 1 ] );
938
- endif;
939
- if ( strpos( $markerline, '// END ' . $marker ) !== FALSE ):
940
- $newfile .= "// BEGIN {$marker}\n";
941
- if ( is_array( $insertion ) )
942
- foreach ( $insertion as $insertline )
943
- $newfile .= "{$insertline}\n";
944
- $newfile .= "// END {$marker}\n";
945
- $state = TRUE;
946
- $foundit = TRUE;
947
- endif;
948
- }
949
- else:
950
- $this->debug( 'Could not parse functions file', __FUNCTION__ );
951
- return FALSE;
952
- endif;
953
- if ( $foundit ):
954
- $this->debug( 'Found marker, replaced inline', __FUNCTION__ );
955
- else:
956
- // verify there is no PHP close tag at end of file
957
- if ( ! $phpopen ):
958
- $this->debug( 'PHP not open', __FUNCTION__ );
959
- $this->errors[] = __( 'A closing PHP tag was detected in Child theme functions file so "Parent Stylesheet Handling" option was not configured. Closing PHP at the end of the file is discouraged as it can cause premature HTTP headers. Please edit <code>functions.php</code> to remove the final <code>?&gt;</code> tag and click "Generate/Rebuild Child Theme Files" again.', 'chld_thm_cfg' );
960
- return FALSE;
961
- //$newfile .= '<?php' . LF;
962
- endif;
963
- $newfile .= "\n// BEGIN {$marker}\n";
964
- foreach ( $insertion as $insertline )
965
- $newfile .= "{$insertline}\n";
966
- $newfile .= "// END {$marker}\n";
967
- endif;
968
- // only write file when getexternals is false
969
- if ( ! $getexternals ):
970
- $this->debug( 'Writing new functions file...', __FUNCTION__ );
971
- if ( $this->is_ajax && is_writable( $filename ) ):
972
- if ( FALSE === @file_put_contents( $filename, $newfile ) ):
973
- $this->debug( 'Ajax write failed.', __FUNCTION__ );
974
- return FALSE;
975
- endif;
976
- elseif ( FALSE === $wp_filesystem->put_contents( $this->fspath( $filename ), $newfile ) ):
977
- $this->debug( 'Filesystem write failed.', __FUNCTION__ );
978
- return FALSE;
979
- endif;
980
- $this->css->converted = 1;
981
- endif;
982
- }
983
-
984
- // creates/updates file via filesystem API
985
- function write_child_file( $file, $contents ) {
986
- if ( !$this->fs ):
987
- $this->debug( 'No filesystem access.', __FUNCTION__ );
988
- return FALSE; // return if no filesystem access
989
- endif;
990
- global $wp_filesystem;
991
- if ( $file = $this->css->is_file_ok( $this->css->get_child_target( $file ), 'write' ) ):
992
- if ( !$wp_filesystem->exists( $this->fspath( $file ) ) ):
993
- $this->debug( 'Writing to filesystem: ' . $file, __FUNCTION__ );
994
- if ( FALSE === $wp_filesystem->put_contents( $this->fspath( $file ), $contents ) ):
995
- $this->debug( 'Filesystem write failed.', __FUNCTION__ );
996
- return FALSE;
997
- endif;
998
- else:
999
- $this->debug( 'File exists.', __FUNCTION__ );
1000
- return FALSE;
1001
- endif;
1002
- else:
1003
- $this->debug( 'No directory.', __FUNCTION__ );
1004
- return FALSE;
1005
- endif;
1006
- $this->debug( 'Filesystem write successful.', __FUNCTION__ );
1007
- }
1008
-
1009
- function copy_screenshot( $obj ) {
1010
- // always copy screenshot
1011
- $this->copy_parent_file( 'screenshot' );
1012
- }
1013
-
1014
- function copy_parent_file( $file, $ext = 'php' ) {
1015
- if ( !$this->fs ):
1016
- $this->debug( 'No filesystem access.', __FUNCTION__ );
1017
- return FALSE; // return if no filesystem access
1018
- endif;
1019
- global $wp_filesystem;
1020
- $parent_file = NULL;
1021
- if ( 'screenshot' == $file ):
1022
- foreach ( array_keys( $this->imgmimes ) as $extreg ):
1023
- foreach( explode( '|', $extreg ) as $ext ):
1024
- if ( $parent_file = $this->css->is_file_ok( $this->css->get_parent_source( 'screenshot.' . $ext ) ) ) break;
1025
- endforeach;
1026
- if ( $parent_file ):
1027
- $parent_file = $this->fspath( $parent_file );
1028
- break;
1029
- endif;
1030
- endforeach;
1031
- else:
1032
- $parent_file = $this->fspath( $this->css->is_file_ok( $this->css->get_parent_source( $file . '.' . $ext ) ) );
1033
- endif;
1034
- // get child theme + file + ext ( passing empty string and full child path to theme_basename )
1035
- $child_file = $this->css->get_child_target( $file . '.' . $ext );
1036
- // return true if file already exists
1037
- if ( $wp_filesystem->exists( $this->fspath( $child_file ) ) ) return TRUE;
1038
- $child_dir = dirname( $this->theme_basename( '', $child_file ) );
1039
- $this->debug( 'Verifying child dir... ', __FUNCTION__ );
1040
- if ( $parent_file // sanity check
1041
- && $child_file // sanity check
1042
- && $this->verify_child_dir( $child_dir ) //create child subdir if necessary
1043
- && $wp_filesystem->copy( $parent_file, $this->fspath( $child_file ), FS_CHMOD_FILE ) ) return TRUE;
1044
- $this->errors[] = __( 'Could not copy file:' . $parent_file, 'chld_thm_cfg' );
1045
- }
1046
-
1047
- function delete_child_file( $file, $ext = 'php' ) {
1048
- if ( !$this->fs ):
1049
- $this->debug( 'No filesystem access.', __FUNCTION__ );
1050
- return FALSE; // return if no filesystem access
1051
- endif;
1052
- global $wp_filesystem;
1053
- // verify file is in child theme and exists before removing.
1054
- $file = ( 'img' == $ext ? $file : $file . '.' . $ext );
1055
- if ( $child_file = $this->css->is_file_ok( $this->css->get_child_target( $file ), 'write' ) ):
1056
- if ( $wp_filesystem->exists( $this->fspath( $child_file ) ) ):
1057
- if ( $wp_filesystem->delete( $this->fspath( $child_file ) ) ):
1058
- return TRUE;
1059
- else:
1060
- $this->errors[] = __( 'Could not delete file.', 'chld_thm_cfg' );
1061
- $this->debug( 'Could not delete file', __FUNCTION__ );
1062
- endif;
1063
- endif;
1064
- endif;
1065
- }
1066
-
1067
- function get_files( $theme, $type = 'template' ) {
1068
- if ( !isset( $this->files[ $theme ] ) ):
1069
- $this->files[ $theme ] = array();
1070
- $imgext = '(' . implode( '|', array_keys( $this->imgmimes ) ) . ')';
1071
- foreach ( $this->css->recurse_directory(
1072
- trailingslashit( get_theme_root() ) . $theme, '', TRUE ) as $file ):
1073
- $file = $this->theme_basename( $theme, $file );
1074
- if ( preg_match( "/^style\-(\d+)\.css$/", $file, $matches ) ):
1075
- $date = date_i18n( 'D, j M Y g:i A', strtotime( $matches[ 1 ] ) );
1076
- $this->files[ $theme ][ 'backup' ][ $file ] = $date;
1077
- elseif ( preg_match( "/^ctc\-plugins\-(\d+)\.css$/", $file, $matches ) ):
1078
- $date = date_i18n( 'D, j M Y g:i A', strtotime( $matches[ 1 ] ) );
1079
- $this->files[ $theme ][ 'pluginbackup' ][ $file ] = $date;
1080
- elseif ( preg_match( "/\.php$/", $file ) ):
1081
- $this->files[ $theme ][ 'template' ][] = $file;
1082
- elseif ( preg_match( "/\.css$/", $file ) && 'style.css' != $file ):
1083
- $this->files[ $theme ][ 'stylesheet' ][] = $file;
1084
- elseif ( preg_match( "/^images\/.+?\." . $imgext . "$/", $file ) ):
1085
- $this->files[ $theme ][ 'img' ][] = $file;
1086
- endif;
1087
- endforeach;
1088
- endif;
1089
- $types = explode(",", $type);
1090
- $files = array();
1091
- foreach ( $types as $type )
1092
- if ( isset( $this->files[ $theme ][ $type ] ) )
1093
- $files = array_merge( $this->files[ $theme ][ $type ], $files );
1094
- return $files;
1095
- }
1096
-
1097
- function theme_basename( $theme, $file ) {
1098
- $file = $this->normalize_path( $file );
1099
- // if no theme passed, returns theme + file
1100
- $themedir = trailingslashit( $this->normalize_path( get_theme_root() ) ) . ( '' == $theme ? '' : trailingslashit( $theme ) );
1101
- $this->debug( 'Themedir: ' . $themedir . ' File: ' . $file , __FUNCTION__ );
1102
- return preg_replace( '%^' . preg_quote( $themedir ) . '%', '', $file );
1103
- }
1104
-
1105
- function uploads_basename( $file ) {
1106
- $file = $this->normalize_path( $file );
1107
- $uplarr = wp_upload_dir();
1108
- $upldir = trailingslashit( $this->normalize_path( $uplarr[ 'basedir' ] ) );
1109
- return preg_replace( '%^' . preg_quote( $upldir ) . '%', '', $file );
1110
- }
1111
-
1112
- function uploads_fullpath( $file ) {
1113
- $file = $this->normalize_path( $file );
1114
- $uplarr = wp_upload_dir();
1115
- $upldir = trailingslashit( $this->normalize_path( $uplarr[ 'basedir' ] ) );
1116
- return $upldir . $file;
1117
- }
1118
-
1119
- function serialize_postarrays() {
1120
- foreach ( $this->postarrays as $field )
1121
- if ( isset( $_POST[ $field ] ) && is_array( $_POST[ $field ] ) )
1122
- $_POST[ $field ] = implode( "%%", $_POST[ $field ] );
1123
- }
1124
-
1125
- function unserialize_postarrays() {
1126
- foreach ( $this->postarrays as $field )
1127
- if ( isset( $_POST[ $field ] ) && !is_array( $_POST[ $field ] ) )
1128
- $_POST[ $field ] = explode( "%%", $_POST[ $field ] );
1129
- }
1130
-
1131
- function set_writable( $file = NULL ) {
1132
-
1133
- $file = isset( $file ) ? $this->css->get_child_target( $file . '.php' ) :
1134
- apply_filters( 'chld_thm_cfg_target', $this->css->get_child_target(), $this->css );
1135
- if ( $this->fs ): // filesystem access
1136
- global $wp_filesystem;
1137
- if ( $file && $wp_filesystem->chmod( $this->fspath( $file ), 0666 ) ) return;
1138
- endif;
1139
- $this->errors[] = __( 'Could not set write permissions.', 'chld_thm_cfg' );
1140
- add_action( 'admin_notices', array( $this, 'writable_notice' ) );
1141
- return FALSE;
1142
- }
1143
-
1144
- function clone_child_theme( $child, $clone ) {
1145
- if ( !$this->fs ) return FALSE; // return if no filesystem access
1146
- global $wp_filesystem;
1147
- // set child theme if not set for get_child_target to use new child theme as source
1148
- $this->css->set_prop( 'child', $child );
1149
-
1150
- $dir = untrailingslashit( $this->css->get_child_target( '' ) );
1151
- $themedir = trailingslashit( get_theme_root() );
1152
- $fsthemedir = $this->fspath( $themedir );
1153
- $files = $this->css->recurse_directory( $dir, NULL, TRUE );
1154
- $errors = array();
1155
- foreach ( $files as $file ):
1156
- $childfile = $this->theme_basename( $child, $this->normalize_path( $file ) );
1157
- $newfile = trailingslashit( $clone ) . $childfile;
1158
- $childpath = $fsthemedir . trailingslashit( $child ) . $childfile;
1159
- $newpath = $fsthemedir . $newfile;
1160
- $this->debug( 'Verifying child dir... ', __FUNCTION__ );
1161
- if ( $this->verify_child_dir( is_dir( $file ) ? $newfile : dirname( $newfile ) ) ):
1162
- if ( is_file( $file ) && !@$wp_filesystem->copy( $childpath, $newpath ) ):
1163
- $errors[] = 'could not copy ' . $newpath;
1164
- endif;
1165
- else:
1166
- $errors[] = 'invalid dir: ' . $newfile;
1167
- endif;
1168
- endforeach;
1169
- }
1170
-
1171
- function unset_writable() {
1172
- if ( !$this->fs ) return FALSE; // return if no filesystem access
1173
- global $wp_filesystem;
1174
- $dir = untrailingslashit( $this->css->get_child_target( '' ) );
1175
- $child = $this->theme_basename( '', $dir );
1176
- $newchild = untrailingslashit( $child ) . '-new';
1177
- $themedir = trailingslashit( get_theme_root() );
1178
- $fsthemedir = $this->fspath( $themedir );
1179
- // is child theme owned by user?
1180
- if ( fileowner( $dir ) == fileowner( $themedir ) ):
1181
- $copy = FALSE;
1182
- $wp_filesystem->chmod( $dir );
1183
- // recursive chmod ( as user )
1184
- // WP_Filesystem RECURSIVE CHMOD IS FLAWED! IT SETS ALL CHILDREN TO PERM OF OUTERMOST DIR
1185
- //if ( $wp_filesystem->chmod( $this->fspath( $dir ), FALSE, TRUE ) ):
1186
- //endif;
1187
- else:
1188
- $copy = TRUE;
1189
- endif;
1190
- // n -> copy entire folder ( as user )
1191
- $files = $this->css->recurse_directory( $dir, NULL, TRUE );
1192
- $errors = array();
1193
- foreach ( $files as $file ):
1194
- $childfile = $this->theme_basename( $child, $this->normalize_path( $file ) );
1195
- $newfile = trailingslashit( $newchild ) . $childfile;
1196
- $childpath = $fsthemedir . trailingslashit( $child ) . $childfile;
1197
- $newpath = $fsthemedir . $newfile;
1198
- if ( $copy ):
1199
- $this->debug( 'Verifying child dir... ', __FUNCTION__ );
1200
- if ( $this->verify_child_dir( is_dir( $file ) ? $newfile : dirname( $newfile ) ) ):
1201
- if ( is_file( $file ) && !$wp_filesystem->copy( $childpath, $newpath ) ):
1202
- $errors[] = 'could not copy ' . $newpath;
1203
- endif;
1204
- else:
1205
- $errors[] = 'invalid dir: ' . $newfile;
1206
- endif;
1207
- else:
1208
- $wp_filesystem->chmod( $this->fspath( $file ) );
1209
- endif;
1210
- endforeach;
1211
- if ( $copy ):
1212
- // verify copy ( as webserver )
1213
- $newfiles = $this->css->recurse_directory( trailingslashit( $themedir ) . $newchild, NULL, TRUE );
1214
- $deleteddirs = $deletedfiles = 0;
1215
- if ( count( $newfiles ) == count( $files ) ):
1216
- // rename old ( as webserver )
1217
- if ( !$wp_filesystem->exists( trailingslashit( $fsthemedir ) . $child . '-old' ) )
1218
- $wp_filesystem->move( trailingslashit( $fsthemedir ) . $child, trailingslashit( $fsthemedir ) . $child . '-old' );
1219
- // rename new ( as user )
1220
- if ( !$wp_filesystem->exists( trailingslashit( $fsthemedir ) . $child ) )
1221
- $wp_filesystem->move( trailingslashit( $fsthemedir ) . $newchild, trailingslashit( $fsthemedir ) . $child );
1222
- // remove old files ( as webserver )
1223
- $oldfiles = $this->css->recurse_directory( trailingslashit( $themedir ) . $child . '-old', NULL, TRUE );
1224
- array_unshift( $oldfiles, trailingslashit( $themedir ) . $child . '-old' );
1225
- foreach ( array_reverse( $oldfiles ) as $file ):
1226
- if ( $wp_filesystem->delete( $this->fspath( $file ) )
1227
- || ( is_dir( $file ) && @rmdir( $file ) )
1228
- || ( is_file( $file ) && @unlink( $file ) ) ):
1229
- $deletedfiles++;
1230
- endif;
1231
- endforeach;
1232
- if ( $deletedfiles != count( $oldfiles ) ):
1233
- $errors[] = 'deleted: ' . $deletedfiles . ' != ' . count( $oldfiles ) . ' files';
1234
- endif;
1235
- else:
1236
- $errors[] = 'newfiles != files';
1237
- endif;
1238
- endif;
1239
- if ( count( $errors ) ):
1240
- $this->errors[] = __( 'There were errors while resetting permissions.', 'chld_thm_cfg' ) ;
1241
- add_action( 'admin_notices', array( $this, 'writable_notice' ) );
1242
- endif;
1243
- }
1244
-
1245
- function set_skip_form() {
1246
- $this->skip_form = TRUE;
1247
- }
1248
-
1249
- function handle_file_upload( $field, $childdir = NULL, $mimes = NULL ){
1250
- $uploadedfile = $_FILES[ $field ];
1251
- $upload_overrides = array(
1252
- 'test_form' => FALSE,
1253
- 'mimes' => ( is_array( $mimes ) ? $mimes : NULL )
1254
- );
1255
- if ( ! function_exists( 'wp_handle_upload' ) ) require_once( ABSPATH . 'wp-admin/includes/file.php' );
1256
- $movefile = wp_handle_upload( $uploadedfile, $upload_overrides );
1257
- if ( isset( $movefile[ 'error' ] ) ):
1258
- $this->errors[] = $movefile[ 'error' ];
1259
- return FALSE;
1260
- endif;
1261
- $_POST[ 'movefile' ] = $this->uploads_basename( $movefile[ 'file' ] );
1262
- }
1263
-
1264
- function move_file_upload( $subdir = 'images' ) {
1265
- if ( !$this->fs ) return FALSE; // return if no filesystem access
1266
- global $wp_filesystem;
1267
- $source_file = sanitize_text_field( $_POST[ 'movefile' ] );
1268
- $target_file = ( '' == $subdir ?
1269
- preg_replace( "%^.+(\.\w+)$%", "screenshot$1", basename( $source_file ) ) :
1270
- trailingslashit( $subdir ) . basename( $source_file ) );
1271
- $this->debug( 'Verifying child dir... ', __FUNCTION__ );
1272
- if ( FALSE !== $this->verify_child_dir( trailingslashit( $this->css->get_prop( 'child' ) ) . $subdir ) ):
1273
- $source_path = $this->fspath( $this->uploads_fullpath( $source_file ) );
1274
- if ( $target_path = $this->css->is_file_ok( $this->css->get_child_target( $target_file ), 'write' ) ):
1275
- $target_path = $this->fspath( $target_path );
1276
- if ( $wp_filesystem->exists( $source_path ) ):
1277
- if ( $wp_filesystem->move( $source_path, $target_path ) ) return TRUE;
1278
- endif;
1279
- endif;
1280
- endif;
1281
-
1282
- $this->errors[] = __( 'Could not upload file.', 'chld_thm_cfg' );
1283
- }
1284
-
1285
- function export_zip() {
1286
- if ( ( $child = $this->css->get_prop( 'child' ) )
1287
- && ( $dir = $this->css->is_file_ok( dirname( $this->css->get_child_target() ), 'search' ) )
1288
- && ( $version = preg_replace( "%[^\w\.\-]%", '', $this->css->get_prop( 'version' ) ) ) ):
1289
- // use php system upload dir to store temp files so that we can use pclzip
1290
- $tmpdir = ini_get( 'upload_tmp_dir' ) ? ini_get( 'upload_tmp_dir' ) : sys_get_temp_dir();
1291
- $file = trailingslashit( $tmpdir ) . $child . '-' . $version . '.zip';
1292
- mbstring_binary_safe_encoding();
1293
-
1294
- require_once( ABSPATH . 'wp-admin/includes/class-pclzip.php' );
1295
-
1296
- $archive = new PclZip( $file );
1297
- if ( $archive->create( $dir, PCLZIP_OPT_REMOVE_PATH, dirname( $dir ) ) == 0 ) return FALSE;
1298
- reset_mbstring_encoding();
1299
- header( 'Content-Description: File Transfer' );
1300
- header( 'Content-Type: application/octet-stream' );
1301
- header( 'Content-Length: ' . filesize( $file ) );
1302
- header( 'Content-Disposition: attachment; filename=' . basename( $file ) );
1303
- header( 'Expires: 0' );
1304
- header( 'Cache-Control: must-revalidate' );
1305
- header( 'Pragma: public' );
1306
- readfile( $file );
1307
- unlink( $file );
1308
- die();
1309
- endif;
1310
- }
1311
-
1312
- /*
1313
- *
1314
- */
1315
- function verify_creds( $args = array() ) {
1316
- $this->fs_prompt = $this->fs = FALSE;
1317
- //fs prompt does not support arrays as post data - serialize arrays
1318
- $this->serialize_postarrays();
1319
- // generate callback url
1320
- $ctcpage = apply_filters( 'chld_thm_cfg_admin_page', CHLD_THM_CFG_MENU );
1321
- $url = is_multisite() ? network_admin_url( 'themes.php?page=' . $ctcpage ) :
1322
- admin_url( 'tools.php?page=' . $ctcpage );
1323
- $nonce_url = wp_nonce_url( $url, apply_filters( 'chld_thm_cfg_action', 'ctc_update' ), '_wpnonce' );
1324
- // buffer output so we can process prior to http header
1325
- ob_start();
1326
- if ( $creds = request_filesystem_credentials( $nonce_url, '', FALSE, FALSE, $args ) ):
1327
- // check filesystem permission if direct or ftp creds exist
1328
- if ( WP_Filesystem( $creds ) )
1329
- // login ok
1330
- $this->fs = TRUE;
1331
- else
1332
- // incorrect credentials, get form with error flag
1333
- $creds = request_filesystem_credentials( $nonce_url, '', TRUE, FALSE, $args );
1334
- else:
1335
- // no credentials, initialize unpriveledged filesystem object
1336
- WP_Filesystem();
1337
- endif;
1338
- // if form was generated, store it
1339
- $this->fs_prompt = ob_get_contents();
1340
- // now we can read/write if fs is TRUE otherwise fs_prompt will contain form
1341
- ob_end_clean();
1342
- //fs prompt does not support arrays as post data - unserialize arrays
1343
- $this->unserialize_postarrays();
1344
- }
1345
-
1346
- /*
1347
- * convert 'direct' filepath into wp_filesystem filepath
1348
- */
1349
- function fspath( $file ){
1350
- if ( ! $this->fs ) return FALSE; // return if no filesystem access
1351
- global $wp_filesystem;
1352
- if ( is_dir( $file ) ):
1353
- $dir = $file;
1354
- $base = '';
1355
- else:
1356
- $dir = dirname( $file );
1357
- $base = basename( $file );
1358
- endif;
1359
- $fsdir = $wp_filesystem->find_folder( $dir );
1360
- return trailingslashit( $fsdir ) . $base;
1361
- }
1362
-
1363
- function writable_notice() {
1364
- ?> <div class="update-nag" style="display:block">
1365
- <div class="ctc-section-toggle" id="ctc_perm_options"><?php _e( 'The child theme is in read-only mode and Child Theme Configurator cannot apply changes. Click to see options', 'chld_thm_cfg' ); ?></div><div class="ctc-section-toggle-content" id="ctc_perm_options_content"><p><ol><?php
1366
- $ctcpage = apply_filters( 'chld_thm_cfg_admin_page', CHLD_THM_CFG_MENU );
1367
- if ( 'WIN' != substr( strtoupper( PHP_OS ), 0, 3 ) ):
1368
- _e( '<li>Temporarily set write permissions by clicking the button below. When you are finished editing, revert to read-only by clicking "Make read-only" under the "Files" tab.</li>', 'chld_thm_cfg' );
1369
- ?><form action="?page=<?php echo $ctcpage; ?>" method="post">
1370
- <?php wp_nonce_field( apply_filters( 'chld_thm_cfg_action', 'ctc_update' ) ); ?>
1371
- <input name="ctc_set_writable" class="button" type="submit" value="<?php _e( 'Make files writable', 'chld_thm_cfg' ); ?>"/></form><?php endif;
1372
- _e( '<li><a target="_blank" href="http://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants" title="Editin wp-config.php">Add your FTP/SSH credentials to the WordPress config file</a>.</li>', 'chld_thm_cfg' );
1373
- if ( isset( $_SERVER[ 'SERVER_SOFTWARE' ] ) && preg_match( '%iis%i',$_SERVER[ 'SERVER_SOFTWARE' ] ) )
1374
- _e( '<li><a target="_blank" href="http://technet.microsoft.com/en-us/library/cc771170" title="Setting Application Pool Identity">Assign WordPress to an application pool that has write permissions</a> (Windows IIS systems).</li>', 'chld_thm_cfg' );
1375
- _e( '<li><a target="_blank" href="http://codex.wordpress.org/Changing_File_Permissions" title="Changing File Permissions">Set write permissions on the server manually</a> (not recommended).</li>', 'chld_thm_cfg' );
1376
- if ( 'WIN' != substr( strtoupper( PHP_OS ), 0, 3 ) ):
1377
- _e( '<li>Run PHP under Apache with suEXEC (contact your web host).</li>', 'chld_thm_cfg' );
1378
- endif; ?>
1379
- </ol></p></div>
1380
- </div>
1381
- <?php
1382
- }
1383
-
1384
- function owner_notice() {
1385
- $ctcpage = apply_filters( 'chld_thm_cfg_admin_page', CHLD_THM_CFG_MENU );
1386
- ?>
1387
- <div class="update-nag">
1388
- <p><?php _e( 'This Child Theme is not owned by your website account. It may have been created by a prior version of this plugin or by another program. Moving forward, it must be owned by your website account to make changes. Child Theme Configurator will attempt to correct this when you click the button below.', 'chld_thm_cfg' ) ?></p>
1389
- <form action="?page=<?php echo $ctcpage; ?>" method="post">
1390
- <?php wp_nonce_field( apply_filters( 'chld_thm_cfg_action', 'ctc_update' ) ); ?>
1391
- <input name="ctc_reset_permission" class="button" type="submit" value="<?php _e( 'Correct Child Theme Permissions', 'chld_thm_cfg' ); ?>"/></form> </div>
1392
- <?php
1393
- }
1394
-
1395
- function enqueue_notice() {
1396
- ?>
1397
- <div class="update-nag">
1398
- <p><?php _e( 'Child Theme Configurator needs to update its interal data. Please set your preferences below and click "Generate Child Theme Files" to update your configuration.', 'chld_thm_cfg' ) ?></p>
1399
- </div>
1400
- <?php
1401
- }
1402
-
1403
- function max_styles_notice( $msg ) {
1404
- return $msg . ' ' . sprintf( __( '<strong>However, some styles could not be parsed due to memory limits.</strong> Try deselecting "Additional Stylesheets" below and click "Generate/Rebuild Child Theme Files". %sWhy am I seeing this?%s', 'chld_thm_cfg' ),
1405
- '<a target="_blank" href="' . LILAEAMEDIA_URL . '/child-theme-configurator#php_memory">',
1406
- '</a>' );
1407
- return $msg;
1408
- }
1409
-
1410
- function config_notice() {
1411
- ?>
1412
- <div class="update-nag">
1413
- <p><?php _e( 'Child Theme Configurator did not detect any configuration data because a previously configured Child Theme has been removed. Please set your preferences below and click "Generate Child Theme Files".', 'chld_thm_cfg' ) ?></p>
1414
- </div>
1415
- <?php
1416
- }
1417
-
1418
- // back compatibility function for legacy plugins extension
1419
- function write_addl_files( $obj ) {
1420
- global $chld_thm_cfg_plugins;
1421
- if ( !is_object( $chld_thm_cfg_plugins ) || !$this->fs ) return FALSE;
1422
- $configtype = $this->css->get_prop( 'configtype' );
1423
- //echo $configtype . LF;
1424
- if ( 'theme' == $configtype || !( $def = $chld_thm_cfg_plugins->defs->get_def( $configtype ) ) ) return FALSE;
1425
- $child = trailingslashit( $this->css->get_prop( 'child' ) );
1426
- if ( isset( $def[ 'addl' ] ) && is_array( $def[ 'addl' ] ) && count( $def[ 'addl' ] ) ):
1427
- foreach ( $def[ 'addl' ] as $path => $type ):
1428
-
1429
- // sanitize the crap out of the target data -- it will be used to create paths
1430
- $path = $this->normalize_path( preg_replace( "%[^\w\\//\-]%", '', sanitize_text_field( $child . $path ) ) );
1431
- $this->debug( 'Verifying child dir... ', __FUNCTION__ );
1432
- if ( ( 'dir' == $type && FALSE === $this->verify_child_dir( $path ) )
1433
- || ( 'dir' != $type && FALSE === $this->write_child_file( $path, '' ) ) ):
1434
- //$this->errors[] = __( 'Your theme directories are not writable.', 'chld_thm_cfg_plugins' );
1435
- endif;
1436
- endforeach;
1437
- endif;
1438
- // write main def file
1439
- if ( isset( $def[ 'target' ] ) ):
1440
- $path = $this->normalize_path( preg_replace( "%[^\w\\//\-\.]%", '', sanitize_text_field( $def[ 'target' ] ) ) ); //$child .
1441
- if ( FALSE === $this->write_child_file( $path, '' ) ):
1442
- //echo "invalid path: " . $path . ' ' . ' was: ' . $def[ 'target' ] . LF;
1443
- //$this->errors[] = __( 'Your stylesheet is not writable.', 'chld_thm_cfg_plugins' );
1444
- return FALSE;
1445
- endif;
1446
- endif;
1447
- }
1448
-
1449
- // backwards compatability < WP 3.9
1450
- function normalize_path( $path ) {
1451
- $path = str_replace( '\\', '/', $path );
1452
- $path = preg_replace( '|/+|','/', $path );
1453
- return $path;
1454
- }
1455
-
1456
- // case insensitive theme search
1457
- function check_theme_exists( $theme ) {
1458
- $search_array = array_map( 'strtolower', array_keys( wp_get_themes() ) );
1459
- return in_array( strtolower( $theme ), $search_array );
1460
- }
1461
-
1462
- // helper functions to support legacy plugin extension
1463
- function is_legacy() {
1464
- return defined('CHLD_THM_CFG_PLUGINS_VERSION')
1465
- && version_compare( CHLD_THM_CFG_PLUGINS_VERSION, '2.0.0', '<' );
1466
- }
1467
-
1468
- /* not using plugin mode */
1469
- function is_theme( $configtype = '' ) {
1470
- // if filter returns a value, we are using plugin mode
1471
- // otherwise if configtype has a value and it is not a theme then we are in legacy plugin mode
1472
- $pluginmode = apply_filters( 'chld_thm_cfg_action', NULL );
1473
- if ( $pluginmode || ( !empty( $configtype ) && 'theme' != $configtype ) ):
1474
- return FALSE;
1475
- endif;
1476
- if ( $this->is_legacy()
1477
- && is_object( $this->css )
1478
- && ( $configtype = $this->css->get_prop( 'configtype' ) )
1479
- && !empty( $configtype ) && 'theme' != $configtype ):
1480
- return FALSE;
1481
- endif;
1482
- return TRUE;
1483
- }
1484
-
1485
- /* returns parent theme either from existing config or passed as post var */
1486
- function get_current_parent() {
1487
- if ( isset( $_GET[ 'ctc_parent' ] ) && ( $parent = sanitize_text_field( $_GET[ 'ctc_parent' ] ) ) )
1488
- return $parent;
1489
- elseif ( $parent = $this->css->get_prop( 'parnt' ) )
1490
- return $parent;
1491
- else return get_template();
1492
- }
1493
-
1494
- /* returns child theme either from existing config or passed as post var */
1495
- function get_current_child() {
1496
- if ( isset( $_GET[ 'ctc_child' ] ) && ( $child = sanitize_text_field( $_GET[ 'ctc_child' ] ) ) )
1497
- return $child;
1498
- elseif ( $child = $this->css->get_prop( 'child' ) )
1499
- return $child;
1500
- else return get_stylesheet();
1501
- }
1502
- /* debug backtrace with extraneous steps (missing class, function or line) removed */
1503
- function backtrace_summary() {
1504
- $bt = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS );
1505
- $thisstep = array_shift( $bt );
1506
- foreach ( $bt as $ndx => $step )
1507
- if ( isset( $step[ 'class' ] ) && isset( $step[ 'function' ] ) && isset( $step[ 'line' ] ) )
1508
- echo $ndx . ': ' . $step[ 'class' ] . ' ' . $step[ 'function' ] . ' ' . $step[ 'line' ] . LF;
1509
- }
1510
-
1511
- function debug( $msg = NULL, $fn = NULL) {
1512
- $this->debug .= ( isset( $fn ) ? $fn . ': ' : '' ) . ( isset( $msg ) ? $msg . LF : '' );
1513
- }
1514
-
1515
- function set_benchmark( $step, $key, $label ) {
1516
- $this->memory[ $key ][ $label ][ $step ][ 'memory' ] = memory_get_usage();
1517
- $this->memory[ $key ][ $label ][ $step ][ 'peak' ] = memory_get_peak_usage();
1518
-
1519
- $this->memory[ $key ][ $label ][ $step ][ 'selectors' ] = isset( $this->css ) ? $this->css->qskey : 0;
1520
- }
1521
-
1522
- function calc_memory_usage() {
1523
- //$this->debug( print_r( $this->memory, TRUE ), __FUNCTION__ );
1524
-
1525
- $results = array();
1526
- foreach ( $this->memory as $key => $labels ):
1527
- if ( !is_array( $labels ) ) continue;
1528
- foreach ( $labels as $label => $steps ):
1529
- //if ( isset( $steps[ 'before' ] ) && isset( $steps[ 'after ' ] ) ):
1530
- $results[] = $key . '|' . $label . '|'
1531
- . ( $steps[ 'after' ][ 'memory' ] - $steps[ 'before' ][ 'memory' ] ) . '|'
1532
- . ( $steps[ 'after' ][ 'peak' ] - $steps[ 'before' ][ 'peak' ] ) . '|'
1533
- . ( $steps[ 'after' ][ 'peak' ] - $steps[ 'before' ][ 'memory' ] ) . '|'
1534
- . $steps[ 'after' ][ 'selectors' ] . '|'
1535
- . ( $steps[ 'after' ][ 'selectors' ] - $steps[ 'before' ][ 'selectors' ] );
1536
- //endif;
1537
- endforeach;
1538
- endforeach;
1539
- $this->debug( "\n" . implode( "\n", $results ), __FUNCTION__ );
1540
- }
1541
-
1542
- function get_free_memory() {
1543
- $limit = (int) ini_get('memory_limit') * 1024 * 1024;
1544
- $used = memory_get_usage();
1545
- return $limit - $used;
1546
- }
1547
-
1548
- function print_debug( $noecho = FALSE ) {
1549
- $debug = '<textarea style="width:100%;height:200px">' . LF . $this->debug . LF . '</textarea>' . LF;
1550
- if ( $noecho ) return $debug;
1551
- echo $debug;
1552
- }
1553
-
1554
- function parse_parent_stylesheet() {
1555
- $this->css->parse_css_file( 'parnt' );
1556
- }
1557
-
1558
- function parse_child_stylesheet() {
1559
- // get revert/backup
1560
- $revert = isset( $_POST[ 'ctc_revert' ] ) ? sanitize_text_field( $_POST[ 'ctc_revert' ] ) : '';
1561
- // parse child stylesheet, backup or skip ( to reset )
1562
- $this->css->parse_css_file( 'child', $revert );
1563
- }
1564
-
1565
- function parse_additional_stylesheets() {
1566
- // parse additional stylesheets
1567
- if ( isset( $_POST[ 'ctc_additional_css' ] ) && is_array( $_POST[ 'ctc_additional_css' ] ) ):
1568
- $this->css->addl_css = array();
1569
- foreach ( $_POST[ 'ctc_additional_css' ] as $file ):
1570
- $file = sanitize_text_field( $file );
1571
- $this->css->parse_css_file( 'parnt', $file );
1572
- $this->css->addl_css[] = $file;
1573
- endforeach;
1574
- endif;
1575
- }
1576
-
1577
- function copy_theme_mods( $from, $to ) {
1578
-
1579
- // we can copy settings from parent to child even if neither is currently active
1580
- // so we need cases for active parent, active child or neither
1581
-
1582
- // get active theme
1583
- $active_theme = get_stylesheet();
1584
- $this->debug( 'from: ' . $from . ' to: ' . $to . ' active: ' . $active_theme, __FUNCTION__ );
1585
- // create temp array from parent settings
1586
- $child_mods = get_option( 'theme_mods_' . $from );
1587
- if ( $active_theme == $from ):
1588
- $this->debug( 'from is active, using active widgets', __FUNCTION__ );
1589
- // if parent theme is active, get widgets from active sidebars_widgets array
1590
- $child_widgets = retrieve_widgets();
1591
- else:
1592
- $this->debug( 'from not active, using theme mods widgets', __FUNCTION__ );
1593
- // otherwise get widgets from parent theme mods
1594
- $child_widgets = $child_mods[ 'sidebars_widgets' ][ 'data' ];
1595
- endif;
1596
- if ( $active_theme == $to ):
1597
- $this->debug( 'to active, setting active widgets', __FUNCTION__ );
1598
- // if child theme is active, remove widgets from temp array
1599
- unset( $child_mods[ 'sidebars_widgets' ] );
1600
- // copy widgets to active sidebars_widgets array
1601
- wp_set_sidebars_widgets( $child_widgets );
1602
- else:
1603
- $this->debug( 'child not active, saving widgets in theme mods', __FUNCTION__ );
1604
- // otherwise copy widgets to temp array with time stamp
1605
- $child_mods[ 'sidebars_widgets' ][ 'data' ] = $child_widgets;
1606
- $child_mods[ 'sidebars_widgets' ][ 'time' ] = time();
1607
- endif;
1608
- $this->debug( 'saving child theme mods:' . LF . print_r( $child_mods, TRUE ), __FUNCTION__ );
1609
- // copy temp array to child mods
1610
- update_option( 'theme_mods_' . $to, $child_mods );
1611
- }
1612
-
1613
- function network_enable() {
1614
- if ( $child = $this->css->get_prop( 'child' ) ):
1615
- $allowed_themes = get_site_option( 'allowedthemes' );
1616
- $allowed_themes[ $child ] = true;
1617
- update_site_option( 'allowedthemes', $allowed_themes );
1618
- endif;
1619
- }
1620
-
1621
- }
2
  // Exit if accessed directly
3
  if ( !defined( 'ABSPATH' ) ) exit;
4
 
5
+ class ChildThemeConfigurator {
6
+ static $instance;
7
+ static function init() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
+ // verify WP version support
10
+ global $wp_version;
11
+ if ( version_compare( $wp_version, CHLD_THM_CFG_MIN_WP_VERSION ) < 0 ):
12
+ add_action( 'admin_notices', 'ChildthemeConfigurator::version_notice' );
13
+ return;
14
+ endif;
15
+ // setup admin hooks
16
+ if ( is_multisite() )
17
+ add_action( 'network_admin_menu', 'ChildThemeConfigurator::network_admin' );
18
+ add_action( 'admin_menu', 'ChildThemeConfigurator::admin' );
19
+ // setup ajax actions
20
+ add_action( 'wp_ajax_ctc_update', 'ChildThemeConfigurator::save' );
21
+ add_action( 'wp_ajax_ctc_query', 'ChildThemeConfigurator::query' );
22
+ add_action( 'wp_ajax_ctc_dismiss', 'ChildThemeConfigurator::dismiss' );
23
+ // initialize languages
24
+ add_action( 'init', 'ChildThemeConfigurator::lang' );
25
+ }
26
+ static function ctc() {
27
+ // create admin object
28
+ global $chld_thm_cfg; /// backward compat
29
+ if ( !isset( self::$instance ) ):
30
+ include_once( CHLD_THM_CFG_DIR . '/includes/class-ctc-admin.php' );
31
+ self::$instance = new ChildThemeConfiguratorAdmin( __FILE__ );
32
+ endif;
33
+ $chld_thm_cfg = self::$instance; // backward compat
34
+ return self::$instance;
35
+ }
36
+ static function lang() {
37
+ // initialize languages
38
+ load_plugin_textdomain( 'child-theme-configurator', FALSE, basename( CHLD_THM_CFG_DIR ) . '/lang' );
39
+ }
40
+ static function save() {
41
+ // ajax write
42
+ self::ctc()->ajax_save_postdata();
43
+ }
44
+ static function query() {
45
+ // ajax read
46
+ self::ctc()->ajax_query_css();
47
+ }
48
+ static function network_admin() {
49
+ $hook = add_theme_page(
50
+ __( 'Child Theme Configurator', 'child-theme-configurator' ),
51
+ __( 'Child Themes', 'child-theme-configurator' ),
52
+ 'install_themes',
53
+ CHLD_THM_CFG_MENU,
54
+ 'ChildThemeConfigurator::render'
55
+ );
56
+ add_action( 'load-' . $hook, 'ChildThemeConfigurator::page_init' );
57
+ }
58
+ static function admin() {
59
+ $hook = add_management_page(
60
+ __( 'Child Theme Configurator', 'child-theme-configurator' ),
61
+ __( 'Child Themes', 'child-theme-configurator' ),
62
+ 'install_themes',
63
+ CHLD_THM_CFG_MENU,
64
+ 'ChildThemeConfigurator::render'
65
+ );
66
+ add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'ChildThemeConfigurator::action_links' );
67
+ add_action( 'load-' . $hook, 'ChildThemeConfigurator::page_init' );
68
+ }
69
+ static function action_links( $actions ) {
70
+ $actions[] = '<a href="' . admin_url( 'tools.php?page=' . CHLD_THM_CFG_MENU ). '">'
71
+ . __( 'Child Themes', 'child-theme-configurator' ) . '</a>' . LF;
72
+ return $actions;
73
+ }
74
+ static function page_init() {
75
+ // start admin controller
76
+ self::ctc()->ctc_page_init();
77
+ }
78
+ static function render() {
79
+ // display admin page
80
+ self::ctc()->render();
81
+ }
82
+ static function version_notice() {
83
+ deactivate_plugins( plugin_basename( __FILE__ ) );
84
+ unset( $_GET[ 'activate' ] );
85
+ echo '<div class="notice-warning"><p>' .
86
+ sprintf( __( 'Child Theme Configurator requires WordPress version %s or later.', 'child-theme-configurator' ),
87
+ CHLD_THM_CFG_MIN_WP_VERSION ) . '</p></div>' . LF;
88
+ }
89
+ static function dismiss() {
90
+ self::ctc()->ajax_dismiss_notice();
91
+ }
92
+ }
93
+ defined( 'LF' ) or define( 'LF', "\n" );
94
+ defined( 'LILAEAMEDIA_URL' ) or
95
+ define( 'LILAEAMEDIA_URL', "http://www.lilaeamedia.com" );
96
+ defined( 'CHLD_THM_CFG_DOCS_URL' ) or
97
+ define( 'CHLD_THM_CFG_DOCS_URL', "http://www.childthemeconfigurator.com" );
98
+ define( 'CHLD_THM_CFG_VERSION', '2.0.0' );
99
+ define( 'CHLD_THM_CFG_PREV_VERSION', '1.7.9.1' );
100
+ define( 'CHLD_THM_CFG_MIN_WP_VERSION', '3.7' );
101
+ defined( 'CHLD_THM_CFG_BPSEL' ) or
102
+ define( 'CHLD_THM_CFG_BPSEL', '2500' );
103
+ defined( 'CHLD_THM_CFG_MAX_RECURSE_LOOPS' ) or
104
+ define( 'CHLD_THM_CFG_MAX_RECURSE_LOOPS', '1000' );
105
+ defined( 'CHLD_THM_CFG_MENU' ) or
106
+ define( 'CHLD_THM_CFG_MENU', 'chld_thm_cfg_menu' );
107
+
108
+ add_action( 'plugins_loaded', 'ChildThemeConfigurator::init' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/forms/addl_css.php CHANGED
@@ -4,11 +4,11 @@ if ( !defined( 'ABSPATH' ) ) exit;
4
  $stylesheets = $this->get_files( $this->get_current_parent(), 'stylesheet' );
5
  if ( count( $stylesheets ) ):?>
6
  <div class="ctc-input-cell ctc-section-toggle" id="ctc_additional_css_files"> <strong>
7
- <?php _e( 'Parse additional stylesheets:', 'chld_thm_cfg' ); ?>
8
  </strong> </div>
9
  <div class="ctc-input-cell-wide ctc-section-toggle-content" id="ctc_additional_css_files_content">
10
  <p style="margin-top:0">
11
- <?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' ); ?>
12
  </p>
13
  <ul>
14
  <?php foreach ( $stylesheets as $stylesheet ): ?>
4
  $stylesheets = $this->get_files( $this->get_current_parent(), 'stylesheet' );
5
  if ( count( $stylesheets ) ):?>
6
  <div class="ctc-input-cell ctc-section-toggle" id="ctc_additional_css_files"> <strong>
7
+ <?php _e( 'Parse additional stylesheets:', 'child-theme-configurator' ); ?>
8
  </strong> </div>
9
  <div class="ctc-input-cell-wide ctc-section-toggle-content" id="ctc_additional_css_files_content">
10
  <p style="margin-top:0">
11
+ <?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.', 'child-theme-configurator' ); ?>
12
  </p>
13
  <ul>
14
  <?php foreach ( $stylesheets as $stylesheet ): ?>
includes/forms/addl_panels.php CHANGED
@@ -6,38 +6,38 @@ if ( !defined( 'CHLD_THM_CFG_PLUGINS_VERSION' ) ):
6
  <div class="ctc-input-row clearfix">
7
  <div class="ctc-input-cell"><div style="padding:0 40px">
8
  <h1>Upgrade Offer</h1>
9
- <p class="larger"><?php _e( 'Use coupon code', 'chld_thm_cfg' ); ?><code><strong><?php _e( 'wordpress-org', 'chld_thm_cfg' ); ?></strong></code><?php _e( 'and get <strong>20% off entire order</strong>.', 'chld_thm_cfg' ); ?></p>
10
- <h3><a target="_blank" href="<?php echo LILAEAMEDIA_URL; ?>/cart/?add-to-cart=1710" title="<?php _e( 'Order Now', 'chld_thm_cfg' ); ?>"><?php _e( 'Order Now', 'chld_thm_cfg' ); ?></a></h3><small><?php _e( '*Prices and offers subject to change.', 'chld_thm_cfg' ); ?></small><hr style="margin:20px 0" />
11
- <a target="_blank" href="<?php echo LILAEAMEDIA_URL; ?>/plugins/intelliwidget/" title="<?php _e( 'Learn more about IntelliWidget', 'chld_thm_cfg' ); ?>"><img src="<?php echo CHLD_THM_CFG_URL . 'css/iw-banner.jpg'; ?>" width="430" height="430" /></a>
12
- <p><?php _e( 'IntelliWidget is a versatile widget manager that does the work of multiple plugins by combining custom page menus, featured posts, sliders and other dynamic content features into a single plugin that can display on a per-page or site-wide basis.', 'chld_thm_cfg' ); ?> <a target="_blank" href="<?php echo LILAEAMEDIA_URL; ?>/plugins/intelliwidget/" title="<?php _e( 'Learn more about IntelliWidget', 'chld_thm_cfg' ); ?>">
13
- <?php _e( 'Learn more', 'chld_thm_cfg'); ?><i class="dashicons dashicons-external" style="text-decoration:none"></i></a></p><hr style="margin:20px 0" />
14
- <a target="_blank" href="<?php echo LILAEAMEDIA_URL; ?>/plugins/intelliwidget-responsive-menu/" title="<?php _e( 'Learn more about IW Responsive Menu', 'chld_thm_cfg' ); ?>"><img src="<?php echo CHLD_THM_CFG_URL . 'css/iwrm-banner.jpg'; ?>" width="430" height="430" /></a>
15
- <p><?php _e( 'IntelliWidget Responsive Menu lets you break free from your theme’s built-in responsive menu options and gives you complete control over the user experience.', 'chld_thm_cfg' ); ?> <a target="_blank" href="<?php echo LILAEAMEDIA_URL; ?>/intelliwidget-responsive-menu/" title="<?php _e( 'Learn more about IW Responsive Menu', 'chld_thm_cfg' ); ?>">
16
- <?php _e( 'Learn more', 'chld_thm_cfg'); ?><i class="dashicons dashicons-external" style="text-decoration:none"></i></a></p>
17
  </div></div>
18
  <div class="ctc-input-cell-wide">
19
- <a target="_blank" href="<?php echo CHLD_THM_CFG_DOCS_URL; ?>/child-theme-configurator-pro/" title="<?php _e( 'Learn more about CTC Pro', 'chld_thm_cfg' ); ?>"><img src="<?php echo CHLD_THM_CFG_URL . 'css/pro-banner.jpg'; ?>" width="610" height="197" /></a>
20
- <h1><?php _e( 'Customizing WordPress just got even easier.', 'chld_thm_cfg' ); ?></h1>
21
- <p><?php _e( 'Thousands of users have already seen the benefits of using Child Theme Configurator. If you spend any amount of time customizing WordPress, CTC Pro will help maximize your productivity.', 'chld_thm_cfg' ); ?></p>
22
- <h1><?php _e( 'Designed by Developers Who Use It Every Day.', 'chld_thm_cfg' ); ?></h1>
23
- <p><?php _e( 'We\'ve packed in more features to make design work quicker and easier with <strong>Child Theme Configurator Pro.</strong>', 'chld_thm_cfg' ); ?></p>
24
  <ul>
25
- <li><h3><?php _e( 'Customize Plugin Stylesheets', 'chld_thm_cfg' ); ?></h3>
26
- <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>
27
- <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>
28
- <li><h3><?php _e( 'Color Palettes', 'chld_thm_cfg' ); ?></h3><p><?php _e( 'Keep the colors you select just a click away. No more searching for hex codes and RGB values.', 'chld_thm_cfg' ); ?></p></li>
29
- <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>
30
- <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>
31
- <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>
32
- <li><h3><?php _e( 'Genesis Framework Support', 'chld_thm_cfg' ); ?></h3>
33
- <p><?php _e( 'Automatically detects and configures Genesis Child Themes with more frameworks on the way.', 'chld_thm_cfg' ); ?></p></li>
34
- <li><h3><?php _e( 'Top-rated Online Support', 'chld_thm_cfg' ); ?></h3></li>
35
- <li><h3><?php _e( 'Online Documentation', 'chld_thm_cfg' ); ?></h3></li>
36
- <li><h3><?php _e( 'Tutorial Videos', 'chld_thm_cfg' ); ?></h3></li>
37
  </ul>
38
  <h1>Upgrade Offer</h1>
39
- <p class="larger"><?php _e( 'Use coupon code', 'chld_thm_cfg' ); ?><code><strong><?php _e( 'wordpress-org', 'chld_thm_cfg' ); ?></strong></code><?php _e( 'and get <strong>20% off entire order</strong>.', 'chld_thm_cfg' ); ?></p>
40
- <h3><a target="_blank" href="<?php echo LILAEAMEDIA_URL; ?>/cart/?add-to-cart=1710" title="<?php _e( 'Order Now', 'chld_thm_cfg' ); ?>"><?php _e( 'Order Now', 'chld_thm_cfg' ); ?></a></h3><small><?php _e( '*Prices and offers subject to change.', 'chld_thm_cfg' ); ?></small>
41
  </div>
42
  </div></div><?php
43
  endif;
6
  <div class="ctc-input-row clearfix">
7
  <div class="ctc-input-cell"><div style="padding:0 40px">
8
  <h1>Upgrade Offer</h1>
9
+ <p class="larger"><?php _e( 'Use coupon code', 'child-theme-configurator' ); ?><code><strong><?php _e( 'wordpress-org', 'child-theme-configurator' ); ?></strong></code><?php _e( 'and get <strong>20% off entire order</strong>.', 'child-theme-configurator' ); ?></p>
10
+ <h3><a target="_blank" href="<?php echo LILAEAMEDIA_URL; ?>/cart/?add-to-cart=1710" title="<?php _e( 'Order Now', 'child-theme-configurator' ); ?>"><?php _e( 'Order Now', 'child-theme-configurator' ); ?></a></h3><small><?php _e( '*Prices and offers subject to change.', 'child-theme-configurator' ); ?></small><hr style="margin:20px 0" />
11
+ <a target="_blank" href="<?php echo LILAEAMEDIA_URL; ?>/plugins/intelliwidget/" title="<?php _e( 'Learn more about IntelliWidget', 'child-theme-configurator' ); ?>"><img src="<?php echo CHLD_THM_CFG_URL . 'css/iw-banner.jpg'; ?>" width="430" height="430" /></a>
12
+ <p><?php _e( 'IntelliWidget is a versatile widget manager that does the work of multiple plugins by combining custom page menus, featured posts, sliders and other dynamic content features into a single plugin that can display on a per-page or site-wide basis.', 'child-theme-configurator' ); ?> <a target="_blank" href="<?php echo LILAEAMEDIA_URL; ?>/plugins/intelliwidget/" title="<?php _e( 'Learn more about IntelliWidget', 'child-theme-configurator' ); ?>">
13
+ <?php _e( 'Learn more', 'child-theme-configurator'); ?><i class="dashicons dashicons-external" style="text-decoration:none"></i></a></p><hr style="margin:20px 0" />
14
+ <a target="_blank" href="<?php echo LILAEAMEDIA_URL; ?>/plugins/intelliwidget-responsive-menu/" title="<?php _e( 'Learn more about IW Responsive Menu', 'child-theme-configurator' ); ?>"><img src="<?php echo CHLD_THM_CFG_URL . 'css/iwrm-banner.jpg'; ?>" width="430" height="430" /></a>
15
+ <p><?php _e( 'IntelliWidget Responsive Menu lets you break free from your theme’s built-in responsive menu options and gives you complete control over the user experience.', 'child-theme-configurator' ); ?> <a target="_blank" href="<?php echo LILAEAMEDIA_URL; ?>/intelliwidget-responsive-menu/" title="<?php _e( 'Learn more about IW Responsive Menu', 'child-theme-configurator' ); ?>">
16
+ <?php _e( 'Learn more', 'child-theme-configurator'); ?><i class="dashicons dashicons-external" style="text-decoration:none"></i></a></p>
17
  </div></div>
18
  <div class="ctc-input-cell-wide">
19
+ <a target="_blank" href="<?php echo CHLD_THM_CFG_DOCS_URL; ?>/child-theme-configurator-pro/" title="<?php _e( 'Learn more about CTC Pro', 'child-theme-configurator' ); ?>"><img src="<?php echo CHLD_THM_CFG_URL . 'css/pro-banner.jpg'; ?>" width="610" height="197" /></a>
20
+ <h1><?php _e( 'Customizing WordPress just got even easier.', 'child-theme-configurator' ); ?></h1>
21
+ <p><?php _e( 'Thousands of users have already seen the benefits of using Child Theme Configurator. If you spend any amount of time customizing WordPress, CTC Pro will help maximize your productivity.', 'child-theme-configurator' ); ?></p>
22
+ <h1><?php _e( 'Designed by Developers Who Use It Every Day.', 'child-theme-configurator' ); ?></h1>
23
+ <p><?php _e( 'We\'ve packed in more features to make design work quicker and easier with <strong>Child Theme Configurator Pro.</strong>', 'child-theme-configurator' ); ?></p>
24
  <ul>
25
+ <li><h3><?php _e( 'Customize Plugin Stylesheets', 'child-theme-configurator' ); ?></h3>
26
+ <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.', 'child-theme-configurator' ); ?></p></li>
27
+ <li><h3><?php _e( 'Quick Preview', 'child-theme-configurator' ); ?></h3><p><?php _e( 'Preview your child theme with a single click.', 'child-theme-configurator' ); ?></p></li>
28
+ <li><h3><?php _e( 'Color Palettes', 'child-theme-configurator' ); ?></h3><p><?php _e( 'Keep the colors you select just a click away. No more searching for hex codes and RGB values.', 'child-theme-configurator' ); ?></p></li>
29
+ <li><h3><?php _e( 'Find related styles', 'child-theme-configurator' ); ?></h3><p><?php _e( 'Use the "All Styles" panel to edit groups of selectors from a single combined list.', 'child-theme-configurator' ); ?></p></li>
30
+ <li><h3><?php _e( 'Find styles by Nav Menu', 'child-theme-configurator' ); ?></h3><p><?php _e( 'Tweak menus quickly and easily.', 'child-theme-configurator' ); ?></p></li>
31
+ <li><h3><?php _e( 'Most recent edits', 'child-theme-configurator' ); ?></h3><p><?php _e( 'Return to recently edited selectors from a toggleable sidebar.', 'child-theme-configurator' ); ?></p></li>
32
+ <li><h3><?php _e( 'Genesis Framework Support', 'child-theme-configurator' ); ?></h3>
33
+ <p><?php _e( 'Automatically detects and configures Genesis Child Themes with more frameworks on the way.', 'child-theme-configurator' ); ?></p></li>
34
+ <li><h3><?php _e( 'Top-rated Online Support', 'child-theme-configurator' ); ?></h3></li>
35
+ <li><h3><?php _e( 'Online Documentation', 'child-theme-configurator' ); ?></h3></li>
36
+ <li><h3><?php _e( 'Tutorial Videos', 'child-theme-configurator' ); ?></h3></li>
37
  </ul>
38
  <h1>Upgrade Offer</h1>
39
+ <p class="larger"><?php _e( 'Use coupon code', 'child-theme-configurator' ); ?><code><strong><?php _e( 'wordpress-org', 'child-theme-configurator' ); ?></strong></code><?php _e( 'and get <strong>20% off entire order</strong>.', 'child-theme-configurator' ); ?></p>
40
+ <h3><a target="_blank" href="<?php echo LILAEAMEDIA_URL; ?>/cart/?add-to-cart=1710" title="<?php _e( 'Order Now', 'child-theme-configurator' ); ?>"><?php _e( 'Order Now', 'child-theme-configurator' ); ?></a></h3><small><?php _e( '*Prices and offers subject to change.', 'child-theme-configurator' ); ?></small>
41
  </div>
42
  </div></div><?php
43
  endif;
includes/forms/backup.php CHANGED
@@ -5,4 +5,4 @@ if ( !defined( 'ABSPATH' ) ) exit;
5
  <label class="ctc-input-cell smaller<?php echo 'child' == $template && !$this->ctc()->fs && is_writable( $themeroot . $backup ) ? ' writable' : ''; ?>">
6
  <input class="ctc_checkbox" id="ctc_file_<?php echo $template . '_' . ++$counter; ?>"
7
  name="ctc_file_<?php echo $template; ?>[]" type="checkbox"
8
- value="<?php echo $templatefile; ?>" /><?php echo __( 'Backup', 'chld_thm_cfg' ) . ' ' . $label; ?></label>
5
  <label class="ctc-input-cell smaller<?php echo 'child' == $template && !$this->ctc()->fs && is_writable( $themeroot . $backup ) ? ' writable' : ''; ?>">
6
  <input class="ctc_checkbox" id="ctc_file_<?php echo $template . '_' . ++$counter; ?>"
7
  name="ctc_file_<?php echo $template; ?>[]" type="checkbox"
8
+ value="<?php echo $templatefile; ?>" /><?php echo __( 'Backup', 'child-theme-configurator' ) . ' ' . $label; ?></label>
includes/forms/backups.php CHANGED
@@ -3,10 +3,10 @@ if ( !defined( 'ABSPATH' ) ) exit;
3
  // Additional stylesheets
4
  ?><br/>
5
  <?php
6
- foreach ( $this->get_files( $this->css->get_prop( 'child' ), 'backup' ) as $backup => $label ): ?>
7
  <label>
8
  <input class="ctc_checkbox" id="ctc_revert_<?php echo $backup; ?>" name="ctc_revert" type="radio"
9
  value="<?php echo $backup; ?>" />
10
- <?php echo __( 'Restore backup from', 'chld_thm_cfg' ) . ' ' . $label; ?></label>
11
  <br/>
12
  <?php endforeach;
3
  // Additional stylesheets
4
  ?><br/>
5
  <?php
6
+ foreach ( $this->get_files( $this->css()->get_prop( 'child' ), 'backup' ) as $backup => $label ): ?>
7
  <label>
8
  <input class="ctc_checkbox" id="ctc_revert_<?php echo $backup; ?>" name="ctc_revert" type="radio"
9
  value="<?php echo $backup; ?>" />
10
+ <?php echo __( 'Restore backup from', 'child-theme-configurator' ) . ' ' . $label; ?></label>
11
  <br/>
12
  <?php endforeach;
includes/forms/fileform.php CHANGED
@@ -5,11 +5,11 @@ if ( !defined( 'ABSPATH' ) ) exit;
5
  $ctcpage = apply_filters( 'chld_thm_cfg_admin_page', CHLD_THM_CFG_MENU );
6
 
7
  if ( defined( 'DISALLOW_FILE_EDIT' ) && DISALLOW_FILE_EDIT ):
8
- $linktext = __( 'The Theme editor has been disabled. Template files must be edited offline.', 'chld_thm_cfg' );
9
  $editorlink = '';
10
  $editorlinkend = '';
11
  else:
12
- $linktext = __( 'Click here to edit template files using the Theme Editor', 'chld_thm_cfg' );
13
  $adminbase = 'theme-editor.php?theme=' . $this->ctc()->css->get_prop( 'child' )
14
  . ( 'parnt' == $template ? '&file=functions.php' : '' );
15
  $editorlink = '<a href="' . ( is_multisite() ? network_admin_url( $adminbase ) : admin_url( $adminbase ) ) . '" title="' . $linktext . '">';
@@ -20,17 +20,17 @@ endif;
20
  <form id="ctc_<?php echo $template; ?>_templates_form" method="post" action="?page=<?php echo $ctcpage; ?>&amp;tab=file_options">
21
  <?php wp_nonce_field( apply_filters( 'chld_thm_cfg_action', 'ctc_update' ) ); ?>
22
  <div class="ctc-input-cell"> <strong>
23
- <?php echo 'parnt' == $template ? __( 'Parent Templates', 'chld_thm_cfg' ) : __( 'Child Theme Files', 'chld_thm_cfg' ); ?>
24
  </strong>
25
  <?php
26
  if ( 'parnt' == $template ): ?>
27
  <p class="howto">
28
- <?php _e( 'Copy PHP template files from the parent theme by selecting them here.', 'chld_thm_cfg' ); ?>
29
- </p>
30
- <p><strong>
31
- <?php _e( 'CAUTION: If your child theme is active, the child theme version of the file will be used instead of the parent immediately after it is copied.', 'chld_thm_cfg' );?>
32
  </strong></p>
33
- <p class="howto"> <?php echo sprintf( __( 'The %s file is generated separately and cannot be copied here.', 'chld_thm_cfg' ),
34
  $editorlink . '<code>functions.php</code>' . $editorlinkend
35
  );
36
  else: ?>
@@ -40,8 +40,8 @@ else: ?>
40
  <p class="howto">
41
  <?php
42
  echo ( $this->ctc()->fs ?
43
- __( 'Delete child theme templates by selecting them here.', 'chld_thm_cfg' ) :
44
- __( 'Delete child theme templates or make them writable by selecting them here. Writable files are displayed in <span style="color:red">red</span>.', 'chld_thm_cfg' )
45
  ); ?>
46
  </p>
47
  <?php
@@ -54,11 +54,11 @@ else: ?>
54
  <?php if ( 'child' == $template && !$this->ctc()->fs ): ?>
55
  <input class="ctc_submit button button-primary" id="ctc_templates_writable_submit"
56
  name="ctc_templates_writable_submit" type="submit"
57
- value="<?php _e( 'Make Selected Writable', 'chld_thm_cfg' ); ?>" />&nbsp; &nbsp;
58
  <?php endif; ?>
59
  <input class="ctc_submit button button-primary" id="ctc_<?php echo $template; ?>_templates_submit"
60
  name="ctc_<?php echo $template; ?>_templates_submit" type="submit"
61
- value="<?php echo ( 'parnt' == $template ? __( 'Copy Selected to Child Theme', 'chld_thm_cfg' ) : __( 'Delete Selected', 'chld_thm_cfg' ) ); ?>" />
62
  </div>
63
  </form>
64
  </div>
5
  $ctcpage = apply_filters( 'chld_thm_cfg_admin_page', CHLD_THM_CFG_MENU );
6
 
7
  if ( defined( 'DISALLOW_FILE_EDIT' ) && DISALLOW_FILE_EDIT ):
8
+ $linktext = __( 'The Theme editor has been disabled. Template files must be edited offline.', 'child-theme-configurator' );
9
  $editorlink = '';
10
  $editorlinkend = '';
11
  else:
12
+ $linktext = __( 'Click here to edit template files using the Theme Editor', 'child-theme-configurator' );
13
  $adminbase = 'theme-editor.php?theme=' . $this->ctc()->css->get_prop( 'child' )
14
  . ( 'parnt' == $template ? '&file=functions.php' : '' );
15
  $editorlink = '<a href="' . ( is_multisite() ? network_admin_url( $adminbase ) : admin_url( $adminbase ) ) . '" title="' . $linktext . '">';
20
  <form id="ctc_<?php echo $template; ?>_templates_form" method="post" action="?page=<?php echo $ctcpage; ?>&amp;tab=file_options">
21
  <?php wp_nonce_field( apply_filters( 'chld_thm_cfg_action', 'ctc_update' ) ); ?>
22
  <div class="ctc-input-cell"> <strong>
23
+ <?php echo 'parnt' == $template ? __( 'Parent Templates', 'child-theme-configurator' ) : __( 'Child Theme Files', 'child-theme-configurator' ); ?>
24
  </strong>
25
  <?php
26
  if ( 'parnt' == $template ): ?>
27
  <p class="howto">
28
+ <?php _e( 'Copy PHP templates from the parent theme by selecting them here. The Configurator defines a template as a Theme PHP file having no PHP functions or classes. Other PHP files cannot be safely overridden by a child theme.', 'child-theme-configurator' ); ?>
29
+ </p>
30
+ <p class="howto"><strong>
31
+ <?php _e( 'CAUTION: If your child theme is active, the child theme version of the file will be used instead of the parent immediately after it is copied.', 'child-theme-configurator' );?>
32
  </strong></p>
33
+ <p class="howto"> <?php echo sprintf( __( 'The %s file is generated separately and cannot be copied here.', 'child-theme-configurator' ),
34
  $editorlink . '<code>functions.php</code>' . $editorlinkend
35
  );
36
  else: ?>
40
  <p class="howto">
41
  <?php
42
  echo ( $this->ctc()->fs ?
43
+ __( 'Delete child theme templates by selecting them here.', 'child-theme-configurator' ) :
44
+ __( 'Delete child theme templates or make them writable by selecting them here. Writable files are displayed in <span style="color:red">red</span>.', 'child-theme-configurator' )
45
  ); ?>
46
  </p>
47
  <?php
54
  <?php if ( 'child' == $template && !$this->ctc()->fs ): ?>
55
  <input class="ctc_submit button button-primary" id="ctc_templates_writable_submit"
56
  name="ctc_templates_writable_submit" type="submit"
57
+ value="<?php _e( 'Make Selected Writable', 'child-theme-configurator' ); ?>" />&nbsp; &nbsp;
58
  <?php endif; ?>
59
  <input class="ctc_submit button button-primary" id="ctc_<?php echo $template; ?>_templates_submit"
60
  name="ctc_<?php echo $template; ?>_templates_submit" type="submit"
61
+ value="<?php echo ( 'parnt' == $template ? __( 'Copy Selected to Child Theme', 'child-theme-configurator' ) : __( 'Delete Selected', 'child-theme-configurator' ) ); ?>" />
62
  </div>
63
  </form>
64
  </div>
includes/forms/files.php CHANGED
@@ -12,24 +12,24 @@ if ( !defined( 'ABSPATH' ) ) exit;
12
  <form id="ctc_theme_image_form" method="post" action="?page=<?php echo CHLD_THM_CFG_MENU; ?>" enctype="multipart/form-data">
13
  <?php wp_nonce_field( apply_filters( 'chld_thm_cfg_action', 'ctc_update' ) ); ?>
14
  <div class="ctc-input-cell"> <strong>
15
- <?php _e( 'Upload New Child Theme Image', 'chld_thm_cfg' ); ?>
16
  </strong>
17
  <p class="howto">
18
- <?php _e( 'Theme images reside under the <code>images</code> directory in your child theme and are meant for stylesheet use only. Use the Media Library for content images.', 'chld_thm_cfg' ); ?>
19
  </p>
20
  </div>
21
  <div class="ctc-input-cell-wide">
22
  <input type="file" id="ctc_theme_image" name="ctc_theme_image" value="" />
23
  <input class="ctc_submit button button-primary" id="ctc_theme_image_submit"
24
  name="ctc_theme_image_submit" type="submit"
25
- value="<?php _e( 'Upload', 'chld_thm_cfg' ); ?>" />
26
  </div>
27
  </form>
28
  </div>
29
  <?php if ( $screenshot = $this->get_theme_screenshot() ): ?>
30
  <div class="ctc-input-row clearfix" id="input_row_screenshot_view">
31
  <div class="ctc-input-cell"> <strong>
32
- <?php _e( 'Child Theme Screenshot', 'chld_thm_cfg' ); ?>
33
  </strong> </div>
34
  <div class="ctc-input-cell-wide"> <a href="<?php echo $screenshot; ?>" class="thickbox"><img src="<?php echo $screenshot; ?>" height="150" width="200" style="max-height:150px;max-width:200px;width:auto;height:auto" /></a> </div>
35
  </div>
@@ -38,48 +38,43 @@ if ( !defined( 'ABSPATH' ) ) exit;
38
  <form id="ctc_screenshot_form" method="post" action="?page=<?php echo CHLD_THM_CFG_MENU; ?>" enctype="multipart/form-data">
39
  <?php wp_nonce_field( apply_filters( 'chld_thm_cfg_action', 'ctc_update' ) ); ?>
40
  <div class="ctc-input-cell"> <strong>
41
- <?php _e( 'Upload New Screenshot', 'chld_thm_cfg' ); ?>
42
  </strong>
43
  <p class="howto">
44
- <?php _e( 'The theme screenshot should be a 4:3 ratio (e.g., 880px x 660px) JPG, PNG or GIF. It will be renamed <code>screenshot</code>.', 'chld_thm_cfg' ); ?>
45
  </p>
46
  </div>
47
  <div class="ctc-input-cell-wide">
48
  <input type="file" id="ctc_theme_screenshot" name="ctc_theme_screenshot" value="" />
49
  <input class="ctc_submit button button-primary" id="ctc_theme_screenshot_submit"
50
  name="ctc_theme_screenshot_submit" type="submit"
51
- value="<?php _e( 'Upload', 'chld_thm_cfg' ); ?>" />
52
  </div>
53
  </form>
54
  </div>
55
  <div class="ctc-input-row clearfix" id="input_row_screenshot">
56
- <form id="ctc_export_form" method="post" action="?page=<?php echo CHLD_THM_CFG_MENU; ?>">
57
- <?php wp_nonce_field( apply_filters( 'chld_thm_cfg_action', 'ctc_update' ) ); ?>
58
  <div class="ctc-input-cell"> <strong>
59
- <?php _e( 'Export Child Theme as Zip Archive', 'chld_thm_cfg' ); ?>
60
  </strong> </div>
61
- <div class="ctc-input-cell-wide">
62
- <input class="ctc_submit button button-primary" id="ctc_export_child_zip"
63
- name="ctc_export_child_zip" type="submit"
64
- value="<?php _e( 'Export', 'chld_thm_cfg' ); ?>" />
65
- </div>
66
- </form>
67
  </div>
68
  <?php if ( 'direct' != $this->ctc()->fs_method ): ?>
69
  <div class="ctc-input-row clearfix" id="input_row_permissions">
70
  <form id="ctc_permission_form" method="post" action="?page=<?php echo CHLD_THM_CFG_MENU; ?>">
71
  <?php wp_nonce_field( apply_filters( 'chld_thm_cfg_action', 'ctc_update' ) ); ?>
72
  <div class="ctc-input-cell"> <strong>
73
- <?php _e( 'Secure Child Theme', 'chld_thm_cfg' ); ?>
74
  </strong>
75
  <p class="howto">
76
- <?php _e( 'Attempt to reset child theme permissions to user ownership and read-only access.', 'chld_thm_cfg' ); ?>
77
  </p>
78
  </div>
79
  <div class="ctc-input-cell-wide">
80
  <input class="ctc_submit button button-primary" id="ctc_reset_permission"
81
  name="ctc_reset_permission" type="submit"
82
- value="<?php _e( 'Make read-only', 'chld_thm_cfg' ); ?>" />
83
  </div>
84
  </form>
85
  </div>
12
  <form id="ctc_theme_image_form" method="post" action="?page=<?php echo CHLD_THM_CFG_MENU; ?>" enctype="multipart/form-data">
13
  <?php wp_nonce_field( apply_filters( 'chld_thm_cfg_action', 'ctc_update' ) ); ?>
14
  <div class="ctc-input-cell"> <strong>
15
+ <?php _e( 'Upload New Child Theme Image', 'child-theme-configurator' ); ?>
16
  </strong>
17
  <p class="howto">
18
+ <?php _e( 'Theme images reside under the <code>images</code> directory in your child theme and are meant for stylesheet use only. Use the Media Library for content images.', 'child-theme-configurator' ); ?>
19
  </p>
20
  </div>
21
  <div class="ctc-input-cell-wide">
22
  <input type="file" id="ctc_theme_image" name="ctc_theme_image" value="" />
23
  <input class="ctc_submit button button-primary" id="ctc_theme_image_submit"
24
  name="ctc_theme_image_submit" type="submit"
25
+ value="<?php _e( 'Upload', 'child-theme-configurator' ); ?>" />
26
  </div>
27
  </form>
28
  </div>
29
  <?php if ( $screenshot = $this->get_theme_screenshot() ): ?>
30
  <div class="ctc-input-row clearfix" id="input_row_screenshot_view">
31
  <div class="ctc-input-cell"> <strong>
32
+ <?php _e( 'Child Theme Screenshot', 'child-theme-configurator' ); ?>
33
  </strong> </div>
34
  <div class="ctc-input-cell-wide"> <a href="<?php echo $screenshot; ?>" class="thickbox"><img src="<?php echo $screenshot; ?>" height="150" width="200" style="max-height:150px;max-width:200px;width:auto;height:auto" /></a> </div>
35
  </div>
38
  <form id="ctc_screenshot_form" method="post" action="?page=<?php echo CHLD_THM_CFG_MENU; ?>" enctype="multipart/form-data">
39
  <?php wp_nonce_field( apply_filters( 'chld_thm_cfg_action', 'ctc_update' ) ); ?>
40
  <div class="ctc-input-cell"> <strong>
41
+ <?php _e( 'Upload New Screenshot', 'child-theme-configurator' ); ?>
42
  </strong>
43
  <p class="howto">
44
+ <?php _e( 'The theme screenshot should be a 4:3 ratio (e.g., 880px x 660px) JPG, PNG or GIF. It will be renamed <code>screenshot</code>.', 'child-theme-configurator' ); ?>
45
  </p>
46
  </div>
47
  <div class="ctc-input-cell-wide">
48
  <input type="file" id="ctc_theme_screenshot" name="ctc_theme_screenshot" value="" />
49
  <input class="ctc_submit button button-primary" id="ctc_theme_screenshot_submit"
50
  name="ctc_theme_screenshot_submit" type="submit"
51
+ value="<?php _e( 'Upload', 'child-theme-configurator' ); ?>" />
52
  </div>
53
  </form>
54
  </div>
55
  <div class="ctc-input-row clearfix" id="input_row_screenshot">
 
 
56
  <div class="ctc-input-cell"> <strong>
57
+ <?php _e( 'Export Child Theme as Zip Archive', 'child-theme-configurator' ); ?>
58
  </strong> </div>
59
+ <div class="ctc-input-cell-wide"><?php
60
+ include ( CHLD_THM_CFG_DIR . '/includes/forms/zipform.php' );
61
+ ?></div>
 
 
 
62
  </div>
63
  <?php if ( 'direct' != $this->ctc()->fs_method ): ?>
64
  <div class="ctc-input-row clearfix" id="input_row_permissions">
65
  <form id="ctc_permission_form" method="post" action="?page=<?php echo CHLD_THM_CFG_MENU; ?>">
66
  <?php wp_nonce_field( apply_filters( 'chld_thm_cfg_action', 'ctc_update' ) ); ?>
67
  <div class="ctc-input-cell"> <strong>
68
+ <?php _e( 'Secure Child Theme', 'child-theme-configurator' ); ?>
69
  </strong>
70
  <p class="howto">
71
+ <?php _e( 'Attempt to reset child theme permissions to user ownership and read-only access.', 'child-theme-configurator' ); ?>
72
  </p>
73
  </div>
74
  <div class="ctc-input-cell-wide">
75
  <input class="ctc_submit button button-primary" id="ctc_reset_permission"
76
  name="ctc_reset_permission" type="submit"
77
+ value="<?php _e( 'Make read-only', 'child-theme-configurator' ); ?>" />
78
  </div>
79
  </form>
80
  </div>
includes/forms/images.php CHANGED
@@ -7,10 +7,10 @@ $ctcpage = apply_filters( 'chld_thm_cfg_admin_page', CHLD_THM_CFG_MENU );
7
  <form id="ctc_image_form" method="post" action="?page=<?php echo $ctcpage; ?>&amp;tab=file_options">
8
  <?php wp_nonce_field( apply_filters( 'chld_thm_cfg_action', 'ctc_update' ) ); ?>
9
  <div class="ctc-input-cell"> <strong>
10
- <?php _e( 'Child Theme Images', 'chld_thm_cfg' ); ?>
11
  </strong>
12
  <p class="howto">
13
- <?php _e( 'Delete child theme images by selecting them here.', 'chld_thm_cfg' );?>
14
  </p>
15
  </div>
16
  <div class="ctc-input-cell-wide"> <?php echo $inputs; ?> </div>
@@ -18,7 +18,7 @@ $ctcpage = apply_filters( 'chld_thm_cfg_admin_page', CHLD_THM_CFG_MENU );
18
  <div class="ctc-input-cell-wide" style="margin-top:10px;margin-bottom:10px">
19
  <input class="ctc_submit button button-primary" id="ctc_image_submit"
20
  name="ctc_image_submit" type="submit"
21
- value="<?php _e( 'Delete Selected', 'chld_thm_cfg' ); ?>" disabled />
22
  </div>
23
  </form>
24
  </div>
7
  <form id="ctc_image_form" method="post" action="?page=<?php echo $ctcpage; ?>&amp;tab=file_options">
8
  <?php wp_nonce_field( apply_filters( 'chld_thm_cfg_action', 'ctc_update' ) ); ?>
9
  <div class="ctc-input-cell"> <strong>
10
+ <?php _e( 'Child Theme Images', 'child-theme-configurator' ); ?>
11
  </strong>
12
  <p class="howto">
13
+ <?php _e( 'Delete child theme images by selecting them here.', 'child-theme-configurator' );?>
14
  </p>
15
  </div>
16
  <div class="ctc-input-cell-wide"> <?php echo $inputs; ?> </div>
18
  <div class="ctc-input-cell-wide" style="margin-top:10px;margin-bottom:10px">
19
  <input class="ctc_submit button button-primary" id="ctc_image_submit"
20
  name="ctc_image_submit" type="submit"
21
+ value="<?php _e( 'Delete Selected', 'child-theme-configurator' ); ?>" disabled />
22
  </div>
23
  </form>
24
  </div>
includes/forms/main.php CHANGED
@@ -1,8 +1,19 @@
1
  <?php
2
  if ( !defined( 'ABSPATH' ) ) exit;
 
 
3
  // main CTC Page
4
  ?>
5
  <style type="text/css">
 
 
 
 
 
 
 
 
 
6
  .ctc-status-icon.success {
7
  background:url(<?php echo admin_url( 'images/yes.png' );
8
  ?>) no-repeat;
@@ -20,24 +31,34 @@ background:#f9f9f9 url(<?php echo includes_url( 'images/xit-2x.gif' );
20
  </style>
21
  <div class="wrap" id="ctc_main">
22
  <?php do_action( 'chld_thm_cfg_related_links' ); ?>
23
- <h2><?php echo apply_filters( 'chld_thm_cfg_header', __( 'Child Theme Configurator', 'chld_thm_cfg' ) . ' ' . __( 'version', 'chld_thm_cfg' ) . ' ' . CHLD_THM_CFG_VERSION ); ?></h2>
24
- <?php
 
 
 
 
 
 
 
 
25
  if ( $this->ctc()->is_post && !$this->ctc()->fs ):
26
  echo $this->ctc()->fs_prompt;
27
  else: ?>
28
  <div id="ctc_error_notice">
29
  <?php $this->settings_errors(); ?>
30
  </div>
31
- <?php
32
  // if flag has been set because an action is required, do not render interface
33
  if ( !$this->ctc()->skip_form ):
34
  include ( CHLD_THM_CFG_DIR . '/includes/forms/tabs.php' );
35
- ?><div id="ctc_option_panel_wrapper" style="position:relative">
 
36
  <div class="ctc-option-panel-container">
37
  <?php
38
- $parent_child_panel = apply_filters( 'chld_thm_cfg_pc_panel',
39
- CHLD_THM_CFG_DIR . '/includes/forms/parent-child.php' );
40
- include ( $parent_child_panel );
 
41
  if ( $enqueueset ):
42
  include ( CHLD_THM_CFG_DIR . '/includes/forms/rule-value.php' );
43
  include ( CHLD_THM_CFG_DIR . '/includes/forms/query-selector.php' );
@@ -54,8 +75,13 @@ else: ?>
54
  endif;
55
  ?>
56
  </div>
57
- <?php do_action( 'chld_thm_cfg_sidebar' ); ?></div><?php
 
 
58
  endif;
59
  endif;
60
  ?>
 
 
 
61
  </div>
1
  <?php
2
  if ( !defined( 'ABSPATH' ) ) exit;
3
+ // backward compat
4
+ $css = $this->css();
5
  // main CTC Page
6
  ?>
7
  <style type="text/css">
8
+ .ctc-step-number {
9
+ background-color: <?php echo $this->colors[ 3 ]; ?>;
10
+ }
11
+ .ctc-step-letter {
12
+ background-color: <?php echo $this->colors[ 2 ]; ?>;
13
+ }
14
+ .ctc-step + strong {
15
+ color: <?php echo $this->colors[ 1 ]; ?>;
16
+ }
17
  .ctc-status-icon.success {
18
  background:url(<?php echo admin_url( 'images/yes.png' );
19
  ?>) no-repeat;
31
  </style>
32
  <div class="wrap" id="ctc_main">
33
  <?php do_action( 'chld_thm_cfg_related_links' ); ?>
34
+ <h2><?php echo apply_filters( 'chld_thm_cfg_header', __( 'Child Theme Configurator', 'child-theme-configurator' ) . ' ' . __( 'version', 'child-theme-configurator' ) . ' ' . CHLD_THM_CFG_VERSION ); ?></h2>
35
+ <label for="ctc_is_debug" style="float:right;font-size:9px">
36
+ <input class="ctc_checkbox" id="ctc_is_debug" name="ctc_is_debug" type="checkbox"
37
+ value="1" <?php echo checked( $this->ctc()->is_debug, 1 ); ?> autocomplete="off" />
38
+ <?php _e( 'Debug', 'chld_thm_cfg_plugins' ); ?>
39
+ </label><?php if ( $childname = $this->css()->get_prop( 'child_name' ) ): ?>
40
+ <h3>
41
+ <?php _e( 'Currently Loaded', 'child-theme-configurator' ); echo ': ' . $childname;?>
42
+ </h3>
43
+ <?php endif;
44
  if ( $this->ctc()->is_post && !$this->ctc()->fs ):
45
  echo $this->ctc()->fs_prompt;
46
  else: ?>
47
  <div id="ctc_error_notice">
48
  <?php $this->settings_errors(); ?>
49
  </div>
50
+ <?php
51
  // if flag has been set because an action is required, do not render interface
52
  if ( !$this->ctc()->skip_form ):
53
  include ( CHLD_THM_CFG_DIR . '/includes/forms/tabs.php' );
54
+ ?>
55
+ <div id="ctc_option_panel_wrapper" style="position:relative">
56
  <div class="ctc-option-panel-container">
57
  <?php
58
+ //$parent_child_panel = apply_filters( 'chld_thm_cfg_pc_panel',
59
+ // CHLD_THM_CFG_DIR . '/includes/forms/parent-child.php' );
60
+ //include ( $parent_child_panel );
61
+ include ( CHLD_THM_CFG_DIR . '/includes/forms/parent-child.php' );
62
  if ( $enqueueset ):
63
  include ( CHLD_THM_CFG_DIR . '/includes/forms/rule-value.php' );
64
  include ( CHLD_THM_CFG_DIR . '/includes/forms/query-selector.php' );
75
  endif;
76
  ?>
77
  </div>
78
+ <?php do_action( 'chld_thm_cfg_sidebar' ); ?>
79
+ </div>
80
+ <?php
81
  endif;
82
  endif;
83
  ?>
84
+ <div id="ctc_debug_container">
85
+ <?php do_action( 'chld_thm_cfg_print_debug' ); ?>
86
+ </div>
87
  </div>
includes/forms/parent-child.php CHANGED
@@ -4,300 +4,359 @@ if ( !defined( 'ABSPATH' ) ) exit;
4
  ?>
5
 
6
  <div id="parent_child_options_panel" class="ctc-option-panel<?php echo 'parent_child_options' == $active_tab ? ' ctc-option-panel-active' : ''; ?>">
7
- <form id="ctc_load_form" method="post" action=""><!-- ?page=<?php echo CHLD_THM_CFG_MENU; ?>"-->
8
- <?php
 
 
 
 
9
  wp_nonce_field( 'ctc_update' );
10
  //if ( '' == $hidechild )
11
  do_action( 'chld_thm_cfg_controls', $this->ctc() );
12
  $disabled = $this->ctc()->is_legacy() && !$this->ctc()->is_theme() ? ' disabled ' : '';
13
  $disabledclass = $this->ctc()->is_legacy() && !$this->ctc()->is_theme() ? ' ctc-disabled ' : '';
14
- ?>
15
- <div class="ctc-input-row clearfix ctc-themeonly-container<?php echo $disabledclass; ?>" id="input_row_parnt">
16
- <div class="ctc-input-cell"> <strong>
17
- <?php _e( 'Parent Theme', 'chld_thm_cfg' ); ?>
18
- </strong> </div>
19
- <div class="ctc-input-cell">
20
- <?php $this->render_theme_menu( 'parnt', $this->ctc()->get_current_parent() ); ?>
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' : '' ); ?>
32
- <?php echo $hidechild . ' ' . $disabled;?> />
33
- <label for="ctc_child_type_new">
34
- <?php _e( 'Create New Child Theme', 'chld_thm_cfg' ); ?>
 
 
 
35
  </label>
36
- </div>
37
- <div class="ctc-input-cell">
 
 
 
38
  <input class="ctc-radio ctc-themeonly" id="ctc_child_type_existing" name="ctc_child_type" type="radio" value="existing"
39
- <?php echo ( empty( $hidechild ) ? 'checked' : '' ); ?>
40
- <?php echo $hidechild . ' ' . $disabled; ?> />
41
- &nbsp;
42
- <label for="ctc_child_type_existing" <?php echo $hidechild;?>>
43
- <?php _e( 'Use Existing Child Theme', 'chld_thm_cfg' ); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  </label>
45
- </div>
46
- <div class="ctc-input-cell" style="clear:both"> <strong>&nbsp;</strong> </div>
47
- <div class="ctc-input-cell" >
48
- <input class="ctc_text ctc-themeonly" id="ctc_child_template" name="ctc_child_template" type="text" placeholder="<?php _e( 'New Child Theme Slug', 'chld_thm_cfg' ); ?>" autocomplete="off" <?php echo $disabled; ?> />
49
- </div>
50
- <?php if ( '' == $hidechild ): ?>
51
- <div class="ctc-input-cell">
52
- <?php $this->render_theme_menu( 'child', $this->ctc()->get_current_child() ); ?>
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_authoruri">
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>
102
- <div class="ctc-input-cell">
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>
107
- <div class="ctc-input-row clearfix ctc-themeonly-container<?php echo $disabledclass; ?>" id="input_row_duplicate_theme" <?php echo $hidechild;?>>
108
- <div class="ctc-input-cell"> <strong>
109
- <?php _e( 'Duplicate Existing Child Theme', 'chld_thm_cfg' ); ?>
 
110
  </strong> </div>
111
  <div class="ctc-input-cell">
112
- <input class="ctc_checkbox ctc-themeonly" id="ctc_duplicate_theme" name="ctc_duplicate_theme" type="checkbox"
113
- value="1" <?php echo $disabled; ?> />
114
- <input class="ctc_text" id="ctc_duplicate_theme_slug" name="ctc_duplicate_theme_slug" type="text"
115
- value="" placeholder="<?php _e( 'Duplicate Theme Slug', 'chld_thm_cfg' ); ?>" autocomplete="off" />
116
- </div>
117
- <div class="ctc-input-cell howto"> <strong>
118
- <?php _e( 'NOTE:', 'chld_thm_cfg' ); ?>
119
- </strong>
120
- <?php _e( 'This will copy all child theme files and apply changes to new version.', 'chld_thm_cfg' ); ?>
121
  </div>
 
 
 
122
  </div>
123
- <div class="ctc-input-row clearfix" id="input_row_debug">
124
- <div class="ctc-input-cell">
 
 
 
 
 
 
 
 
125
  <strong>
126
- <?php _e( 'Debug', 'chld_thm_cfg_plugins' ); ?>
127
  </strong>
128
- </div>
129
- <div class="ctc-input-cell">
130
- <input class="ctc_checkbox" id="ctc_is_debug" name="ctc_is_debug" type="checkbox"
131
- value="1" <?php echo checked( $this->ctc()->is_debug, 1 ); ?> autocomplete="off" />
132
- </div>
133
- <div class="ctc-input-cell howto">
134
- <?php _e( 'Check the box to enable debugging output.', 'chld_thm_cfg_plugins' ); ?>
135
- </div>
136
- </div>
137
  </div>
138
- <?php $parent_handling = ( isset( $css->enqueue ) ? $css->enqueue : 'enqueue' ); ?>
139
- <div class="ctc-input-row clearfix ctc-themeonly-container<?php echo $disabledclass; ?>">
140
- <div class="ctc-input-cell ctc-section-toggle" id="ctc_stylesheet_handling">
141
- <strong><?php _e( 'Stylesheet handling', 'chld_thm_cfg' ); ?></strong>
142
- <?php _e( '(click to view options)', 'chld_thm_cfg' ); ?>
143
- </div><?php if ( empty( $css->nowarn ) && count( $this->warnings ) && in_array( $css->enqueue, array( 'none', 'enqueue' ) ) ):?>
144
- <div class="ctc-input-cell-wide update-nag"><strong><?php _e( 'This theme may not apply child theme styles correctly with the current settings:', 'chld_thm_cfg' ); ?></strong><ul class="smaller">
145
- <?php foreach ( $this->warnings as $warning ) echo '<li>' . $warning . '</li>' . LF; ?>
146
- </ul><span class="alignright"><label class="smaller"><input type="checkbox" name="ctc_nowarn" value="1" /><?php _e( "Don't show again.", 'chld_thm_cfg'); ?></label> &nbsp; <a href="#" class="ctc-section-toggle" id="ctc_stylesheet_handling2"><?php _e( 'View options', 'chld_thm_cfg'); ?></a></span></div>
147
- <?php endif; ?>
148
- <div class="ctc-section-toggle-content clear" id="ctc_stylesheet_handling_content">
149
- <div class="ctc-input-cell clear"><a href="<?php echo CHLD_THM_CFG_DOCS_URL; ?>/how-to-use/#stylesheet_handling" target="_blank"><?php _e( 'Which option should I use?', 'chld_thm_cfg' ); ?></a></div>
150
- <div class="ctc-input-cell">
151
- <label>
152
- <input class="ctc_radio ctc-themeonly" id="ctc_parent_enqueue_none" name="ctc_parent_enqueue" type="radio"
153
- value="none" <?php checked( 'none', $parent_handling ); ?> <?php echo $disabled; ?> />
154
- <?php _e( 'None (handled by theme)', 'chld_thm_cfg' ); ?>
155
- </label>
156
  </div>
157
- <div class="ctc-input-cell howto sep">
158
- <?php _e( 'Select this option if all stylesheets are correctly enqueued for child themes. If you find that styles are not being applied correctly, use a different option.', 'chld_thm_cfg' ); ?>
159
  </div>
160
- <div class="ctc-input-cell clear">&nbsp;</div>
161
- <div class="ctc-input-cell">
162
- <label>
163
- <input class="ctc_radio ctc-themeonly" id="ctc_parent_enqueue_enqueue" name="ctc_parent_enqueue" type="radio"
164
- value="enqueue" <?php checked( 'enqueue', $parent_handling ); ?> <?php echo $disabled; ?> />
165
- <?php _e( 'Enqueue parent stylesheet (default)', 'chld_thm_cfg' ); ?>
166
- </label>
167
- </strong> </div>
168
- <div class="ctc-input-cell howto sep"><?php _e( "Select this option if the theme enqueues the active stylesheet but has no special handling for child themes. Start with this option if unsure.", 'chld_thm_cfg' ); ?>
169
- </div>
170
- <div class="ctc-input-cell clear">&nbsp;</div>
171
- <div class="ctc-input-cell">
172
- <label>
173
- <input class="ctc_radio ctc-themeonly" id="ctc_parent_enqueue_child" name="ctc_parent_enqueue" type="radio"
174
- value="child" <?php checked( 'child', $parent_handling ); ?> <?php echo $disabled; ?> />
175
- <?php _e( 'Enqueue child stylesheet', 'chld_thm_cfg' ); ?>
176
- </label>
177
- </strong> </div>
178
- <div class="ctc-input-cell howto sep"><?php _e( 'Select this option if the theme enqueues the parent stylesheet but does not enqueue the child stylesheet at all. This can happen if <code>get_template()</code> or <code>get_template_directory_uri()</code> is used to link the stylesheet.', 'chld_thm_cfg' ); ?>
179
- </div>
180
- <div class="ctc-input-cell clear"><?php if ( count( $this->warnings ) ): ?><div class="update-nag">
181
- <strong><?php _e( 'Recommended for this theme:', 'chld_thm_cfg' ); ?></strong></div>
182
- <?php endif; ?>&nbsp;</div>
183
- <div class="ctc-input-cell">
184
- <label>
185
- <input class="ctc_radio ctc-themeonly" id="ctc_parent_enqueue_both" name="ctc_parent_enqueue" type="radio"
186
- value="both" <?php checked( 'both', $parent_handling ); ?> <?php echo $disabled; ?> />
187
- <?php _e( 'Enqueue both parent and child stylesheets', 'chld_thm_cfg' ); ?>
188
- </label>
189
- </strong> </div>
190
- <div class="ctc-input-cell howto sep"><?php _e( 'Select this option if stylesheet link tags are hard-coded into the header template (common in older themes). This enables the child stylesheet to override the parent stylesheet without using <code>@import</code>.', 'chld_thm_cfg' ); ?>
191
- </div><?php do_action( 'chld_thm_cfg_enqueue_options' ); ?>
192
- <div class="ctc-input-cell clear">&nbsp;</div>
193
- <div class="ctc-input-cell">
194
- <label>
195
- <input class="ctc_radio ctc-themeonly" id="ctc_parent_enqueue_import" name="ctc_parent_enqueue" type="radio"
196
- value="import" <?php checked( 'import', $parent_handling ); ?> <?php echo $disabled; ?> />
197
- <?php _e( '<code>@import</code> parent stylesheet', 'chld_thm_cfg' ); ?>
198
- </label>
199
  </strong> </div>
200
- <div class="ctc-input-cell howto"><?php _e( "This option imports the parent stylesheet from the child stylesheet. This enables the child stylesheet to override the parent stylesheet, but using <code>@import</code> is no longer recommended.", 'chld_thm_cfg' ); ?>
201
- </div>
202
- </div></div><?php if ( ! is_multisite() || ! empty( $this->ctc()->themes[ 'parnt' ][ $this->ctc()->get_current_parent() ][ 'allowed' ] ) ): ?>
203
- <div class="ctc-input-row clearfix ctc-themeonly-container<?php echo $disabledclass; ?>">
204
- <div class="ctc-input-cell"> <strong><label for="ctc_parent_mods">
205
- <?php _e( 'Copy Parent Theme Menus, Widgets and other Customizer Options', 'chld_thm_cfg' ); ?>
206
- </label></strong> </div>
207
- <div class="ctc-input-cell">
208
- <input class="ctc_checkbox ctc-themeonly" id="ctc_parent_mods" name="ctc_parent_mods" type="checkbox"
209
- value="1" <?php echo $disabled; ?> />
210
- </div>
211
- <div class="ctc-input-cell howto"> <strong>
212
- <?php _e( 'NOTE:', 'chld_thm_cfg' ); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
213
  </strong>
214
- <?php _e( 'This will overwrite child theme options you may have already set.', 'chld_thm_cfg' ); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
215
  </div>
216
- </div><?php endif; ?>
217
- <?php if ( '' == $hidechild ): ?>
218
- <div class="ctc-input-row clearfix">
219
- <div class="ctc-input-cell"> <strong><label for="ctc_backup">
220
- <?php _e( 'Backup current stylesheet', 'chld_thm_cfg' ); ?>
221
- </label></strong> </div>
222
  <div class="ctc-input-cell">
223
- <input class="ctc_checkbox" id="ctc_backup" name="ctc_backup" type="checkbox"
224
- value="1" />
 
225
  </div>
226
- <div class="ctc-input-cell howto"> <strong>
227
- <?php _e( 'NOTE:', 'chld_thm_cfg' ); ?>
228
- </strong>
229
- <?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' ); ?>
230
- </div>
231
- </div>
232
- <div class="ctc-input-row clearfix">
233
- <div class="ctc-input-cell ctc-section-toggle" id="ctc_revert_css"> <strong>
234
- <?php _e( 'Reset/Restore from backup', 'chld_thm_cfg' ); ?>
235
- </strong> </div>
236
- <div class="ctc-input-cell-wide ctc-section-toggle-content" id="ctc_revert_css_content">
237
- <label>
238
- <input class="ctc_checkbox" id="ctc_revert_none" name="ctc_revert" type="radio"
239
- value="" checked="" />
240
- <?php _e( 'Leave unchanged', 'chld_thm_cfg' );?>
241
- </label>
242
- <br/>
243
- <label>
244
- <input class="ctc_checkbox" id="ctc_revert_all" name="ctc_revert" type="radio"
245
- value="all" />
246
- <?php _e( 'Reset all', 'chld_thm_cfg' );?>
247
  </label>
248
- <div id="ctc_backup_files"><?php
249
- foreach ( $this->ctc()->get_files( $css->get_prop( 'child' ), 'backup' ) as $backup => $label ): ?>
250
- <label>
251
- <input class="ctc_checkbox" id="ctc_revert_<?php echo $backup; ?>" name="ctc_revert" type="radio"
252
- value="<?php echo $backup; ?>" />
253
- <?php echo __( 'Restore backup from', 'chld_thm_cfg' ) . ' ' . $label; ?></label>
254
- <br/>
255
- <?php endforeach; ?>
256
- </div>
257
  </div>
258
  </div>
259
  <?php endif; ?>
260
- <div class="ctc-input-row clearfix" id="ctc_stylesheet_files">
261
- <?php
262
- // Additional stylesheets
263
- $stylesheets = $this->ctc()->get_files( $this->ctc()->get_current_parent(), 'stylesheet' );
264
- if ( count( $stylesheets ) ):?>
265
- <div class="ctc-input-cell ctc-section-toggle" id="ctc_additional_css_files"> <strong>
266
- <?php _e( 'Parse additional stylesheets', 'chld_thm_cfg' ); ?>
267
- </strong> </div>
268
- <div class="ctc-input-cell-wide ctc-section-toggle-content" id="ctc_additional_css_files_content">
269
- <p style="margin-top:0" class="howto">
270
- <?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' ); ?>
271
- </p>
272
- <ul>
273
- <?php foreach ( $stylesheets as $stylesheet ): ?>
274
- <li>
275
- <label>
276
- <input class="ctc_checkbox" name="ctc_additional_css[]" type="checkbox"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
277
  value="<?php echo $stylesheet; ?>" />
278
- <?php echo esc_attr( $stylesheet ); ?></label>
279
- </li>
280
- <?php endforeach; ?>
281
- </ul>
282
- </div><?php
283
- endif; ?>
284
  </div>
285
  <div class="ctc-input-row clearfix">
286
- <?php if ( '' == $hidechild && !$enqueueset ): ?>
287
- <div class="ctc-input-cell"> <strong>&nbsp;</strong> </div>
288
  <div class="ctc-input-cell-wide">
289
- <div class="update-nag">
290
- <strong><?php _e( 'Please read before you click:', 'chld_thm_cfg' ); ?></strong>
291
- <p><?php _e( 'This plugin makes significant modifications to your child theme, to include changing CSS, removing comments and adding php functions.', 'chld_thm_cfg' ); ?>
292
- <?php _e( 'If you are using an existing Child Theme,', 'chld_thm_cfg' ); ?> <a href="<?php echo CHLD_THM_CFG_DOCS_URL; ?>/how-to-use/#duplicating-existing-child-themes" target="_blank"><?php _e( 'please consider using the Duplicate Child Theme option', 'chld_thm_cfg' ); ?></a> <?php _e( 'before proceeding.', 'chld_thm_cfg' ); ?></p>
293
- </div><p>&nbsp;</p></div>
294
- <?php endif; ?>
295
- <div class="ctc-input-cell"> <strong>&nbsp;</strong> </div>
296
- <div class="ctc-input-cell">
297
  <input class="ctc_submit button button-primary" id="ctc_load_styles" name="ctc_load_styles" type="submit"
298
- value="<?php _e( 'Generate/Rebuild Child Theme Files', 'chld_thm_cfg' ); ?>" disabled />
299
  </div>
300
  </div>
 
 
301
  </form>
302
- <div id="ctc_debug_container"><?php do_action( 'chld_thm_cfg_print_debug' ); ?></div>
303
  </div>
4
  ?>
5
 
6
  <div id="parent_child_options_panel" class="ctc-option-panel<?php echo 'parent_child_options' == $active_tab ? ' ctc-option-panel-active' : ''; ?>">
7
+ <form id="ctc_load_form" method="post" action="">
8
+
9
+
10
+ <?php if ( $this->ctc()->is_theme() ): ?>
11
+
12
+ <?php // theme inputs
13
  wp_nonce_field( 'ctc_update' );
14
  //if ( '' == $hidechild )
15
  do_action( 'chld_thm_cfg_controls', $this->ctc() );
16
  $disabled = $this->ctc()->is_legacy() && !$this->ctc()->is_theme() ? ' disabled ' : '';
17
  $disabledclass = $this->ctc()->is_legacy() && !$this->ctc()->is_theme() ? ' ctc-disabled ' : '';
18
+
19
+ ?><input type="hidden" name="ctc_analysis" value="" />
 
 
 
 
 
 
 
20
  <div class="ctc-input-row clearfix ctc-themeonly-container<?php echo $disabledclass; ?>" id="input_row_child">
21
+ <div class="ctc-input-cell"><span class="ctc-step ctc-step-number">1</span><strong class="shift">
22
+ <?php _e( 'Select an action:', 'child-theme-configurator' ); ?>
23
+ </strong></div>
24
+ <div class="ctc-input-cell-wide">
25
+ <label>
 
26
  <input class="ctc-radio ctc-themeonly" id="ctc_child_type_new" name="ctc_child_type" type="radio" value="new"
27
+ <?php checked( $this->ctc()->get_current_childtype(), 'new' ); ?> />
28
+ <strong>
29
+ <?php _e( 'CREATE a new Child Theme', 'child-theme-configurator' ); ?>
30
+ </strong>
31
+ <p class="howto indent sep">
32
+ <?php _e( 'Install a new customizable child theme using an installed theme as a parent.', 'child-theme-configurator' ); ?>
33
+ </p>
34
  </label>
35
+ <!-- /div -->
36
+ <?php if ( '' == $hidechild ): ?>
37
+ <!-- div class="ctc-input-cell clear">&nbsp;</div>
38
+ <div class="ctc-input-cell-wide" -->
39
+ <label>
40
  <input class="ctc-radio ctc-themeonly" id="ctc_child_type_existing" name="ctc_child_type" type="radio" value="existing"
41
+ <?php checked( $this->ctc()->get_current_childtype(), 'existing' ); ?> />
42
+ <strong>
43
+ <?php _e( 'CONFIGURE an existing Child Theme', 'child-theme-configurator' ); ?>
44
+ </strong>
45
+ <p class="howto indent sep">
46
+ <?php _e( 'Set up a previously installed child theme for use with the Configurator or to modify current settings.', 'child-theme-configurator' ); ?>
47
+ </p>
48
+ </label>
49
+ <!-- /div>
50
+ <div class="ctc-input-cell clear">&nbsp;</div>
51
+ <div class="ctc-input-cell-wide" -->
52
+ <label>
53
+ <input class="ctc-radio ctc-themeonly" id="ctc_child_type_duplicate" name="ctc_child_type" type="radio" value="duplicate" />
54
+ <strong>
55
+ <?php _e( 'DUPLICATE an existing Child Theme', 'child-theme-configurator' ); ?>
56
+ </strong>
57
+ <p class="howto indent sep">
58
+ <?php _e( 'Make a complete copy of an existing Child Theme in a new directory, including any menus, widgets and other Customizer settings. The option to copy the Parent Theme settings (step 8, below) is disabled with this action.', 'child-theme-configurator' ); ?>
59
+ </p>
60
+ </label>
61
+ <!-- /div>
62
+ <div class="ctc-input-cell clear">&nbsp;</div>
63
+ <div class="ctc-input-cell-wide" -->
64
+ <label>
65
+ <input class="ctc-radio ctc-themeonly" id="ctc_child_type_reset" name="ctc_child_type" type="radio" value="reset" />
66
+ <strong>
67
+ <?php _e( 'RESET an existing Child Theme (this will destroy any work you have done in the Configurator)', 'child-theme-configurator' ); ?>
68
+ </strong>
69
+ <p class="howto indent">
70
+ <?php _e( 'Revert the Child theme stylesheet and functions files to their state before the initial configuration or last reset. Additional child theme files will not be removed, but you can delete them under the Files tab.', 'child-theme-configurator' ); ?>
71
+ </p>
72
  </label>
 
 
 
 
 
 
 
 
73
  </div>
74
  <?php endif; ?>
75
  </div>
76
+ <div class="ctc-input-row clearfix ctc-themeonly-container<?php echo $disabledclass; ?>" id="input_row_new_theme_option" style="display:none">
77
+ <div class="ctc-input-cell" style="clear:both"><span class="ctc-step ctc-step-number">2</span>
78
+ <strong class="shift">
79
+ <?php _e( 'Select a Parent Theme:', 'child-theme-configurator' ); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  </strong> </div>
81
+ <div class="ctc-input-cell" >
82
+ <?php $this->render_theme_menu( 'parnt', $this->ctc()->get_current_parent() ); ?>
83
+ <input type="button" class="button button-primary ctc-analyze-theme" value="<?php _e( 'Analyze', 'child-theme-configurator' ); ?>" />
 
 
 
 
 
 
 
 
 
 
 
 
84
  </div>
85
+ <div class="ctc-input-cell"><span class="ctc-analyze-howto"><span class="ctc-step ctc-step-number">3</span><strong><?php _e( 'Analyze Parent Theme', 'child-theme-configurator' ); ?></strong><p class="howto indent"><?php _e( 'Click "Analyze" to determine stylesheet dependencies and other potential issues.', 'child-theme-configurator' ); ?></p></span></div>
86
+ <div class="ctc-input-cell clear">&nbsp;</div>
87
+ <div class="ctc-input-cell-wide ctc-analysis" id="parnt_analysis_notice">&nbsp;</div>
88
  </div>
89
+ <?php if ( '' == $hidechild ): ?>
90
+ <div class="ctc-input-row clearfix ctc-themeonly-container<?php echo $disabledclass; ?>" id="input_row_existing_theme_option" style="display:none">
91
+ <div class="ctc-input-cell"><span class="ctc-step ctc-step-number">2</span><strong class="shift">
92
+ <?php _e( 'Select a Child Theme:', 'child-theme-configurator' ); ?>
93
  </strong> </div>
94
  <div class="ctc-input-cell">
95
+ <?php $this->render_theme_menu( 'child', $this->ctc()->get_current_child() ); ?>
96
+ <input type="button" class="button button-primary ctc-analyze-theme" value="<?php _e( 'Analyze', 'child-theme-configurator' ); ?>" />
 
 
 
 
 
 
 
97
  </div>
98
+ <div class="ctc-input-cell"><span class="ctc-analyze-howto"><span class="ctc-step ctc-step-number">3</span><strong><?php _e( 'Analyze Child Theme', 'child-theme-configurator' ); ?></strong><p class="howto indent"><?php _e( 'Click "Analyze" to determine stylesheet dependencies and other potential issues.', 'child-theme-configurator' ); ?></p></span></div>
99
+ <div class="ctc-input-cell clear">&nbsp;</div>
100
+ <div class="ctc-input-cell-wide ctc-analysis" id="child_analysis_notice">&nbsp;</div>
101
  </div>
102
+ <?php
103
+ endif; ?>
104
+ <div class="ctc-input-row clearfix ctc-themeonly-container<?php echo $disabledclass; ?>" id="input_row_new_theme_slug" style="display:none">
105
+ <div class="ctc-input-cell" style="clear:both"><span class="ctc-step ctc-step-number">4</span><strong class="shift">
106
+ <?php _e( 'Name the new theme directory:', 'child-theme-configurator' ); ?>
107
+ </strong></div>
108
+ <div class="ctc-input-cell" >
109
+ <input class="ctc_text ctc-themeonly" id="ctc_child_template" name="ctc_child_template" type="text" placeholder="<?php _e( 'Directory Name', 'child-theme-configurator' ); ?>" autocomplete="off" <?php echo $disabled; ?> />
110
+ </div>
111
+ <div class="ctc-input-cell"><span class="howto">
112
  <strong>
113
+ <?php _e( 'NOTE:', 'child-theme-configurator' ); ?>
114
  </strong>
115
+ <?php _e( 'This is NOT the name of the Child Theme. You can customize the name, description, etc. in step 7, below.', 'child-theme-configurator' ); ?></span></div>
 
 
 
 
 
 
 
 
116
  </div>
117
+ <div class="ctc-input-row clearfix ctc-themeonly-container<?php echo $disabledclass; ?>" id="input_row_theme_slug" style="display:none">
118
+ <div class="ctc-input-cell" style="clear:both"><span class="ctc-step ctc-step-number">4</span><strong class="shift">
119
+ <?php _e( 'Verify Child Theme directory:', 'child-theme-configurator' ); ?>
120
+ </strong> </div>
121
+ <div class="ctc-input-cell" ><code id="theme_slug_container">
122
+ </code>
 
 
 
 
 
 
 
 
 
 
 
 
123
  </div>
124
+ <div class="ctc-input-cell" ><span class="howto">
125
+ <?php _e( 'For verification only (you cannot modify the directory of an existing Child Theme).', 'child-theme-configurator' ); ?></span>
126
  </div>
127
+ </div>
128
+ <?php
129
+ $handling = $this->ctc()->is_new_theme() ? 'primary' : $this->ctc()->get( 'handling' );
130
+ $ignoreparnt = $this->ctc()->is_new_theme() ? 0 : $this->ctc()->get( 'ignoreparnt' );
131
+ $enqueue = $this->ctc()->is_new_theme() ? 'enqueue' : $this->ctc()->get( 'enqueue' );
132
+ $this->ctc()->debug( 'handling: ' . $handling . ' ignore: ' . $ignoreparnt . ' enqueue: ' . $enqueue . ' is new: ' . $this->ctc()->is_new_theme(), 'parent-child.php' );
133
+ ?>
134
+ <div class="ctc-input-row clearfix ctc-themeonly-container<?php echo $disabledclass; ?>" id="input_row_stylesheet_handling_container">
135
+ <div class="ctc-input-cell clear" id="input_row_stylesheet_handling" title="<?php _e( 'Click to expand', 'child-theme-configurator' ); ?>"><span class="ctc-step ctc-step-number">5</span><strong class="shift">
136
+ <?php _e( 'Select where to save new styles:', 'child-theme-configurator' ); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
  </strong> </div>
138
+ <div class="ctc-input-cell-wide sep"><div id="child_handling_notice"></div>
139
+ <label>
140
+ <input class="ctc_radio ctc-themeonly" id="ctc_handling_primary" name="ctc_handling" type="radio"
141
+ value="primary" <?php checked( $handling, 'primary' ); ?> <?php echo $disabled; ?> autocomplete="off" />
142
+ <strong>
143
+ <?php _e( "Primary Stylesheet (style.css)", 'child-theme-configurator' ); ?>
144
+ </strong>
145
+ <p class="howto indent sep">
146
+ <?php _e( 'Save new custom styles directly to the Child Theme primary stylesheet, replacing the existing values. The primary stylesheet will load in the order set by the theme.', 'child-theme-configurator' ); ?>
147
+ </p>
148
+ </label>
149
+ </div>
150
+ <div class="ctc-input-cell clear">&nbsp;</div>
151
+ <div class="ctc-input-cell-wide">
152
+ <label>
153
+ <input class="ctc_radio ctc-themeonly" id="ctc_handling_separate" name="ctc_handling" type="radio"
154
+ value="separate" <?php checked( $handling, 'separate' ); ?> <?php echo $disabled; ?> autocomplete="off" />
155
+ <strong>
156
+ <?php _e( 'Separate Stylesheet', 'child-theme-configurator' ); ?>
157
+ </strong>
158
+ <p class="howto indent">
159
+ <?php _e( 'Save new custom styles to a separate stylesheet and use any existing child theme styles as a baseline. Select this option if you want to preserve the original child theme styles instead of overwriting them. This option also allows you to customize stylesheets that load after the primary stylesheet.', 'child-theme-configurator' ); ?>
160
+ </p>
161
+ </label>
162
+ </div>
163
+ </div>
164
+ <div class="ctc-input-row clearfix ctc-themeonly-container<?php echo $disabledclass; ?>" id="input_row_parent_handling_container" style="display:none">
165
+ <div class="ctc-input-cell clear" id="input_row_parent_handling" title="<?php _e( 'Click to expand', 'child-theme-configurator' ); ?>"><span class="ctc-step ctc-step-number">6</span><strong class="shift">
166
+ <?php _e( 'Select Parent Theme stylesheet handling:', 'child-theme-configurator' ); ?>
167
  </strong>
168
+ <p class="howto"></p>
169
+ </div>
170
+ <div class="ctc-input-cell-wide sep"><div id="parent_handling_notice"></div>
171
+ <?php // deprecated enqueue values
172
+ if ( 'both' == $enqueue || 'child' == $enqueue ):
173
+ $enqueue = 'enqueue';
174
+ endif; ?>
175
+ <label>
176
+ <input class="ctc_checkbox ctc-themeonly" id="ctc_enqueue_enqueue" name="ctc_enqueue" type="radio"
177
+ value="enqueue" <?php checked( $enqueue, 'enqueue' ); ?> <?php echo $disabled; ?> autocomplete="off" />
178
+ <strong>
179
+ <?php _e( 'Use the WordPress style queue.', 'child-theme-configurator' ); ?>
180
+ </strong>
181
+ </label>
182
+ <p class="howto indent sep">
183
+ <?php _e( "Let the Configurator determine the appropriate actions and dependencies and update the functions file automatically.", 'child-theme-configurator' ); ?>
184
+ </p>
185
+ <label>
186
+ <input class="ctc_checkbox ctc-themeonly" id="ctc_enqueue_import" name="ctc_enqueue" type="radio"
187
+ value="import" <?php checked( $enqueue, 'import' ); ?> <?php echo $disabled; ?> autocomplete="off" />
188
+ <strong>
189
+ <?php _e( 'Use <code>@import</code> in the child theme stylesheet.', 'child-theme-configurator' ); ?>
190
+ </strong>
191
+ </label>
192
+ <p class="howto indent sep">
193
+ <?php _e( "Only use this option if the parent stylesheet cannot be loaded using the WordPress style queue. Using <code>@import</code> is not recommended.", 'child-theme-configurator' ); ?>
194
+ </p>
195
+ <label>
196
+ <input class="ctc_checkbox ctc-themeonly" id="ctc_enqueue_none" name="ctc_enqueue" type="radio"
197
+ value="none" <?php checked( $enqueue, 'none' ); ?> <?php echo $disabled; ?> autocomplete="off" />
198
+ <strong>
199
+ <?php _e( 'Do not add any parent stylesheet handling.', 'child-theme-configurator' ); ?>
200
+ </strong>
201
+ <p class="howto indent sep">
202
+ <?php _e( "Select this option if this theme already handles the parent theme stylesheet or if the parent theme's <code>style.css</code> file is not used for its appearance.", 'child-theme-configurator' ); ?>
203
+ </p>
204
+ </label></div>
205
+ <div class="ctc-input-cell clear"><strong style="float:right"><?php _e( 'Additional handling options', 'child-theme-configurator' ); ?>:</strong>
206
+ <p class="howto">
207
+ </p>
208
+ </div>
209
+ <div class="ctc-input-cell-wide">
210
+ <label><input class="ctc_checkbox ctc-themeonly" id="ctc_ignoreparnt" name="ctc_ignoreparnt" type="checkbox"
211
+ value="1" autocomplete="off" />
212
+ <strong><?php _e( 'Ignore parent theme stylesheets.', 'child-theme-configurator' ); ?></strong>
213
+ <p class="howto indent"><?php _e( 'Do not load or parse the parent theme styles. Only use this option if the Child Theme uses a Framework like Genesis and only uses child theme stylesheets for its appearance.', 'child-theme-configurator' ); ?></p></label></div>
214
+ <div id="ctc_repairheader_container" style="display:none">
215
+ <div class="ctc-input-cell clear">
216
+ <p class="howto">
217
+ </p>
218
+ </div>
219
+ <div class="ctc-input-cell-wide sep">
220
+ <label><input class="ctc_checkbox ctc-themeonly" id="ctc_repairheader" name="ctc_repairheader" type="checkbox"
221
+ value="1" autocomplete="off" />
222
+ <strong><?php _e( 'Repair the header template in the child theme.', 'child-theme-configurator' ); ?></strong>
223
+ <p class="howto indent"><?php _e( 'Let the Configurator (try to) resolve any stylesheet issues listed above. This can fix many, but not all, common problems.', 'child-theme-configurator' ); ?></p></label></div>
224
+ </div>
225
+ <?php //do_action( 'chld_thm_cfg_enqueue_options' ); // removed for ctc 2.0 ?>
226
+ </div>
227
+ <div class="ctc-input-row clearfix ctc-themeonly-container<?php echo $disabledclass; ?>" id="ctc_child_header_parameters" style="display:none">
228
+ <div class="ctc-input-cell ctc-section-toggle" id="ctc_theme_attributes" title="<?php _e( 'Click to toggle form', 'child-theme-configurator' ); ?>"><span class="ctc-step ctc-step-number">7</span><strong>
229
+ <?php _e( 'Customize the Child Theme Name, Description, Author, Version, etc.:', 'child-theme-configurator' ); ?>
230
+ </strong> <span class="howto"><?php _e( '(Click to toggle form)', 'child-theme-configurator' ); ?></span></div>
231
+ <div class="clear ctc-section-toggle-content" id="ctc_theme_attributes_content">
232
+ <div class="ctc-input-row clearfix ctc-themeonly-container<?php echo $disabledclass; ?>" id="input_row_child_name">
233
+ <div class="ctc-input-cell"> <strong>
234
+ <?php _e( 'Child Theme Name', 'child-theme-configurator' ); ?>
235
+ </strong> </div>
236
+ <div class="ctc-input-cell-wide">
237
+ <input class="ctc_text ctc-themeonly" id="ctc_child_name" name="ctc_child_name" type="text"
238
+ value="<?php echo esc_attr( $this->ctc()->get( 'child_name' ) ); ?>" placeholder="<?php _e( 'Theme Name', 'child-theme-configurator' ); ?>" autocomplete="off" <?php echo $disabled; ?> />
239
+ </div>
240
+ </div>
241
+ <div class="ctc-input-row clearfix ctc-themeonly-container<?php echo $disabledclass; ?>" id="input_row_child_website">
242
+ <div class="ctc-input-cell"> <strong>
243
+ <?php _e( 'Theme Website', 'child-theme-configurator' ); ?>
244
+ </strong> </div>
245
+ <div class="ctc-input-cell-wide">
246
+ <input class="ctc_text ctc-themeonly" id="ctc_child_themeuri" name="ctc_child_themeuri" type="text"
247
+ value="<?php echo esc_attr( $this->ctc()->get( 'themeuri' ) ); ?>" placeholder="<?php _e( 'Theme Website', 'child-theme-configurator' ); ?>" autocomplete="off" <?php echo $disabled; ?> />
248
+ </div>
249
+ </div>
250
+ <div class="ctc-input-row clearfix ctc-themeonly-container<?php echo $disabledclass; ?>" id="input_row_child_author">
251
+ <div class="ctc-input-cell"> <strong>
252
+ <?php _e( 'Author', 'child-theme-configurator' ); ?>
253
+ </strong> </div>
254
+ <div class="ctc-input-cell-wide">
255
+ <input class="ctc_text" id="ctc_child_author" name="ctc_child_author" type="text"
256
+ value="<?php echo esc_attr( $this->ctc()->get( 'author' ) ); ?>" placeholder="<?php _e( 'Author', 'child-theme-configurator' ); ?>" autocomplete="off" />
257
+ </div>
258
+ </div>
259
+ <div class="ctc-input-row clearfix ctc-themeonly-container<?php echo $disabledclass; ?>" id="input_row_child_authoruri">
260
+ <div class="ctc-input-cell"> <strong>
261
+ <?php _e( 'Author Website', 'child-theme-configurator' ); ?>
262
+ </strong> </div>
263
+ <div class="ctc-input-cell-wide">
264
+ <input class="ctc_text ctc-themeonly" id="ctc_child_authoruri" name="ctc_child_authoruri" type="text"
265
+ value="<?php echo esc_attr( $this->ctc()->get( 'authoruri' ) ); ?>" placeholder="<?php _e( 'Author Website', 'child-theme-configurator' ); ?>" autocomplete="off" <?php echo $disabled; ?> />
266
+ </div>
267
+ </div>
268
+ <div class="ctc-input-row clearfix ctc-themeonly-container<?php echo $disabledclass; ?>" id="input_row_child_descr">
269
+ <div class="ctc-input-cell"> <strong>
270
+ <?php _e( 'Theme Description', 'child-theme-configurator' ); ?>
271
+ </strong> </div>
272
+ <div class="ctc-input-cell-wide">
273
+ <textarea class="ctc_text ctc-themeonly" id="ctc_child_descr" name="ctc_child_descr" placeholder="<?php _e( 'Description', 'child-theme-configurator' ); ?>" autocomplete="off" <?php echo $disabled; ?> ><?php echo esc_textarea( $this->ctc()->get( 'descr' ) ); ?></textarea>
274
+ </div>
275
+ </div>
276
+ <div class="ctc-input-row clearfix ctc-themeonly-container<?php echo $disabledclass; ?>" id="input_row_child_tags">
277
+ <div class="ctc-input-cell"> <strong>
278
+ <?php _e( 'Theme Tags', 'child-theme-configurator' ); ?>
279
+ </strong> </div>
280
+ <div class="ctc-input-cell-wide">
281
+ <textarea class="ctc_text ctc-themeonly" id="ctc_child_tags" name="ctc_child_tags" placeholder="<?php _e( 'Tags', 'child-theme-configurator' ); ?>" autocomplete="off" <?php echo $disabled; ?> ><?php echo esc_textarea( $this->ctc()->get( 'tags' ) ); ?></textarea>
282
+ </div>
283
+ </div>
284
+ <div class="clearfix ctc-themeonly-container<?php echo $disabledclass; ?>" id="input_row_child_version">
285
+ <div class="ctc-input-cell"> <strong>
286
+ <?php _e( 'Version', 'child-theme-configurator' ); ?>
287
+ </strong> </div>
288
+ <div class="ctc-input-cell">
289
+ <input class="ctc_text" id="ctc_child_version" name="ctc_child_version" type="text"
290
+ value="<?php echo esc_attr( $this->ctc()->get( 'version' ) ); ?>" placeholder="<?php _e( 'Version', 'child-theme-configurator' ); ?>" autocomplete="off" />
291
+ </div>
292
+ </div>
293
  </div>
294
+ </div>
295
+ <?php if ( ! is_multisite() || ! empty( $this->ctc()->themes[ 'parnt' ][ $this->ctc()->get_current_parent() ][ 'allowed' ] ) ): ?>
296
+ <div class="ctc-input-row clearfix ctc-themeonly-container<?php echo $disabledclass; ?>" id="ctc_copy_theme_mods" style="display:none">
 
 
 
297
  <div class="ctc-input-cell">
298
+ <label for="ctc_parent_mods"><span class="ctc-step ctc-step-number">8</span><strong>
299
+ <?php _e( 'Copy Menus, Widgets and other Customizer Settings from the Parent Theme to the Child Theme:', 'child-theme-configurator' ); ?>
300
+ </strong> </label>
301
  </div>
302
+ <div class="ctc-input-cell-wide howto">
303
+ <label for="ctc_parent_mods">
304
+ <input class="ctc_checkbox ctc-themeonly" id="ctc_parent_mods" name="ctc_parent_mods" type="checkbox"
305
+ value="1" <?php echo $disabled; ?> />
306
+ <strong>
307
+ <?php _e( 'NOTE:', 'child-theme-configurator' ); ?>
308
+ </strong>
309
+ <?php _e( "This option replaces the Child Theme's existing Menus, Widgets and other Customizer Settings with those from the Parent Theme. You should only need to use this option the first time you configure a Child Theme.", 'child-theme-configurator' ); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
310
  </label>
 
 
 
 
 
 
 
 
 
311
  </div>
312
  </div>
313
  <?php endif; ?>
314
+
315
+ <div class="ctc-input-row clearfix" id="ctc_configure_submit" style="display:none">
316
+ <div class="ctc-input-cell"><span class="ctc-step ctc-step-number">9</span><strong class="shift"><?php _e( 'Click to run the Configurator:', 'child-theme-configurator' ); ?></strong> </div>
317
+ <div class="ctc-input-cell-wide">
318
+ <input class="ctc_submit button button-primary" id="ctc_load_styles" name="ctc_load_styles" type="submit"
319
+ value="<?php _e( 'Configure Child Theme', 'child-theme-configurator' ); ?>" disabled />
320
+ </div>
321
+ </div>
322
+
323
+ <?php
324
+ else:
325
+
326
+
327
+ // plugin inputs
328
+ wp_nonce_field( 'ctc_plugin' ); ?>
329
+ <input class="ctc-hidden" id="ctc_theme_parnt" name="ctc_theme_parnt" type="hidden" value="<?php echo $this->ctc()->css->get_prop( 'parnt' ); ?>" />
330
+ <input class="ctc-hidden" id="ctc_theme_child" name="ctc_theme_child" type="hidden" value="<?php echo $this->ctc()->css->get_prop( 'child' ); ?>" />
331
+ <input class="ctc-hidden" id="ctc_action" name="ctc_action" type="hidden" value="plugin" />
332
+ <input class="ctc-hidden" id="ctc_child_type" name="ctc_child_type" type="hidden" value="existing" />
333
+ <div class="ctc-input-row clearfix" id="ctc_stylesheet_files"><?php
334
+ $stylesheets = ChildThemeConfiguratorPlugins::ctcp()->get_css_files();
335
+ if ( count( $stylesheets ) ):?>
336
+ <div class="ctc-input-cell ctc-section-toggle" id="ctc_additional_css_files"> <strong>
337
+ <?php _e( 'Parse Plugin stylesheets:', 'chld_thm_cfg' ); ?>
338
+ </strong> </div>
339
+ <div class="ctc-input-cell-wide ctc-section-toggle-content" id="ctc_additional_css_files_content" style="display:block">
340
+ <p style="margin-top:0">
341
+ <?php _e( 'Select the plugin stylesheets you wish to customize below.', 'chld_thm_cfg' ); ?>
342
+ </p><ul><?php
343
+ foreach ( $stylesheets as $stylesheet => $label ): ?>
344
+ <li><label>
345
+ <input class="ctc_checkbox" name="ctc_additional_css[]" type="checkbox"
346
  value="<?php echo $stylesheet; ?>" />
347
+ <?php echo $label; ?></label></li><?php
348
+ endforeach; ?>
349
+ </ul></div><?php
350
+ endif; ?>
 
 
351
  </div>
352
  <div class="ctc-input-row clearfix">
353
+ <div class="ctc-input-cell"><strong class="shift"><?php _e( 'Click to run the Configurator:', 'child-theme-configurator' ); ?></strong> </div>
 
354
  <div class="ctc-input-cell-wide">
 
 
 
 
 
 
 
 
355
  <input class="ctc_submit button button-primary" id="ctc_load_styles" name="ctc_load_styles" type="submit"
356
+ value="<?php _e( 'Configure Plugin Styles', 'child-theme-configurator' ); ?>" disabled />
357
  </div>
358
  </div>
359
+ <?php endif; ?>
360
+
361
  </form>
 
362
  </div>
includes/forms/query-selector.php CHANGED
@@ -10,8 +10,8 @@ if ( !defined( 'ABSPATH' ) ) exit;
10
  <?php wp_nonce_field( apply_filters( 'chld_thm_cfg_action', 'ctc_update' ) ); ?>
11
  <div class="ctc-input-row clearfix" id="input_row_query">
12
  <div class="ctc-input-cell"> <strong>
13
- <?php _e( 'Query', 'chld_thm_cfg' ); ?>
14
- </strong> </div>
15
  <div class="ctc-input-cell" id="ctc_sel_ovrd_query_selected">&nbsp;</div>
16
  <div class="ctc-input-cell">
17
  <div class="ui-widget">
@@ -21,7 +21,7 @@ if ( !defined( 'ABSPATH' ) ) exit;
21
  </div>
22
  <div class="ctc-input-row clearfix" id="input_row_selector">
23
  <div class="ctc-input-cell"> <strong>
24
- <?php _e( 'Selector', 'chld_thm_cfg' ); ?>
25
  </strong> <a href="#" class="ctc-rewrite-toggle"></a></div>
26
  <div class="ctc-input-cell" id="ctc_sel_ovrd_selector_selected">&nbsp;</div>
27
  <div class="ctc-input-cell">
@@ -34,35 +34,35 @@ if ( !defined( 'ABSPATH' ) ) exit;
34
  <div class="ctc-selector-row clearfix" id="ctc_sel_ovrd_rule_inputs_container" style="display:none">
35
  <div class="ctc-input-row clearfix">
36
  <div class="ctc-input-cell"><strong>
37
- <?php _e( 'Sample', 'chld_thm_cfg' ); ?>
38
  </strong></div>
39
  <div class="ctc-input-cell clearfix" style="max-height:150px;overflow:hidden">
40
- <div class="ctc-swatch" id="ctc_child_all_0_swatch"><?php echo $this->ctc()->swatch_text; ?></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
- <a class="ctc-delete-input" id="ctc_delete_query_selector" href="#"><?php _e( 'Delete Child Values', 'chld_thm_cfg' ); ?></a>
47
  <input type="hidden" id="ctc_sel_ovrd_qsid"
48
  name="ctc_sel_ovrd_qsid" value="" />
49
  </div>
50
  </div>
51
  <div class="ctc-input-row clearfix" id="ctc_sel_ovrd_rule_header" style="display:none">
52
  <div class="ctc-input-cell"> <strong>
53
- <?php _e( 'Property', 'chld_thm_cfg' ); ?>
54
  </strong> </div>
55
  <div class="ctc-input-cell"> <strong>
56
- <?php _e( 'Parent Value', 'chld_thm_cfg' ); ?>
57
  </strong> </div>
58
  <div class="ctc-input-cell"> <strong>
59
- <?php _e( 'Child Value', 'chld_thm_cfg' ); ?>
60
  </strong> </div>
61
  </div>
62
  <div id="ctc_sel_ovrd_rule_inputs" style="display:none"> </div>
63
  <div class="ctc-input-row clearfix" id="ctc_sel_ovrd_new_rule" style="display:none">
64
  <div class="ctc-input-cell"> <strong>
65
- <?php _e( 'New Property', 'chld_thm_cfg' ); ?>
66
  </strong> </div>
67
  <div class="ctc-input-cell">
68
  <div class="ui-widget">
@@ -72,7 +72,7 @@ if ( !defined( 'ABSPATH' ) ) exit;
72
  </div>
73
  <div class="ctc-input-row clearfix" id="input_row_selector">
74
  <div class="ctc-input-cell"> <strong>
75
- <?php _e( 'Order', 'chld_thm_cfg' ); ?>
76
  </strong> </div>
77
  <div class="ctc-input-cell" id="ctc_child_load_order_container">&nbsp;</div>
78
  </div>
@@ -81,14 +81,14 @@ if ( !defined( 'ABSPATH' ) ) exit;
81
  <div class="ctc-input-cell">
82
  <div class="ctc-textarea-button-cell" id="ctc_save_query_selector_cell">
83
  <input type="button" class="button" id="ctc_copy_selector"
84
- name="ctc_copy_selector" value="<?php _e( 'Copy Selector', 'chld_thm_cfg' ); ?>" /> &nbsp;
85
  <input type="button" class="button button-primary ctc-save-input" id="ctc_save_new_selectors"
86
- name="ctc_save_new_selectors" value="<?php _e( 'Save', 'chld_thm_cfg' ); ?>" disabled />
87
  </div>
88
  <strong>
89
- <?php _e( 'Raw CSS', 'chld_thm_cfg' ); ?>
90
  </strong>
91
- <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>
92
  </div>
93
  <div class="ctc-input-cell-wide">
94
  <textarea id="ctc_new_selectors" name="ctc_new_selectors" wrap="off"></textarea>
10
  <?php wp_nonce_field( apply_filters( 'chld_thm_cfg_action', 'ctc_update' ) ); ?>
11
  <div class="ctc-input-row clearfix" id="input_row_query">
12
  <div class="ctc-input-cell"> <strong>
13
+ <?php _e( '@media Query', 'child-theme-configurator' ); ?>
14
+ </strong> <?php _e( '( or "base" )', 'child-theme-configurator' ); ?></div>
15
  <div class="ctc-input-cell" id="ctc_sel_ovrd_query_selected">&nbsp;</div>
16
  <div class="ctc-input-cell">
17
  <div class="ui-widget">
21
  </div>
22
  <div class="ctc-input-row clearfix" id="input_row_selector">
23
  <div class="ctc-input-cell"> <strong>
24
+ <?php _e( 'Selector', 'child-theme-configurator' ); ?>
25
  </strong> <a href="#" class="ctc-rewrite-toggle"></a></div>
26
  <div class="ctc-input-cell" id="ctc_sel_ovrd_selector_selected">&nbsp;</div>
27
  <div class="ctc-input-cell">
34
  <div class="ctc-selector-row clearfix" id="ctc_sel_ovrd_rule_inputs_container" style="display:none">
35
  <div class="ctc-input-row clearfix">
36
  <div class="ctc-input-cell"><strong>
37
+ <?php _e( 'Sample', 'child-theme-configurator' ); ?>
38
  </strong></div>
39
  <div class="ctc-input-cell clearfix" style="max-height:150px;overflow:hidden">
40
+ <div class="ctc-swatch" id="ctc_child_all_0_swatch"><?php echo $this->swatch_txt; ?></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', 'child-theme-configurator' ); ?>" disabled />
46
+ <a class="ctc-delete-input" id="ctc_delete_query_selector" href="#"><?php _e( 'Delete Child Values', 'child-theme-configurator' ); ?></a>
47
  <input type="hidden" id="ctc_sel_ovrd_qsid"
48
  name="ctc_sel_ovrd_qsid" value="" />
49
  </div>
50
  </div>
51
  <div class="ctc-input-row clearfix" id="ctc_sel_ovrd_rule_header" style="display:none">
52
  <div class="ctc-input-cell"> <strong>
53
+ <?php _e( 'Property', 'child-theme-configurator' ); ?>
54
  </strong> </div>
55
  <div class="ctc-input-cell"> <strong>
56
+ <?php _e( 'Baseline Value', 'child-theme-configurator' ); ?>
57
  </strong> </div>
58
  <div class="ctc-input-cell"> <strong>
59
+ <?php _e( 'Child Value', 'child-theme-configurator' ); ?>
60
  </strong> </div>
61
  </div>
62
  <div id="ctc_sel_ovrd_rule_inputs" style="display:none"> </div>
63
  <div class="ctc-input-row clearfix" id="ctc_sel_ovrd_new_rule" style="display:none">
64
  <div class="ctc-input-cell"> <strong>
65
+ <?php _e( 'New Property', 'child-theme-configurator' ); ?>
66
  </strong> </div>
67
  <div class="ctc-input-cell">
68
  <div class="ui-widget">
72
  </div>
73
  <div class="ctc-input-row clearfix" id="input_row_selector">
74
  <div class="ctc-input-cell"> <strong>
75
+ <?php _e( 'Order', 'child-theme-configurator' ); ?>
76
  </strong> </div>
77
  <div class="ctc-input-cell" id="ctc_child_load_order_container">&nbsp;</div>
78
  </div>
81
  <div class="ctc-input-cell">
82
  <div class="ctc-textarea-button-cell" id="ctc_save_query_selector_cell">
83
  <input type="button" class="button" id="ctc_copy_selector"
84
+ name="ctc_copy_selector" value="<?php _e( 'Copy Selector', 'child-theme-configurator' ); ?>" /> &nbsp;
85
  <input type="button" class="button button-primary ctc-save-input" id="ctc_save_new_selectors"
86
+ name="ctc_save_new_selectors" value="<?php _e( 'Save', 'child-theme-configurator' ); ?>" disabled />
87
  </div>
88
  <strong>
89
+ <?php _e( 'Raw CSS', 'child-theme-configurator' ); ?>
90
  </strong>
91
+ <p class="howto"><?php _e( 'Use to enter shorthand CSS or new @media queries and selectors.', 'child-theme-configurator' );?></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.', 'child-theme-configurator' ); ?></p>
92
  </div>
93
  <div class="ctc-input-cell-wide">
94
  <textarea id="ctc_new_selectors" name="ctc_new_selectors" wrap="off"></textarea>
includes/forms/related.php CHANGED
@@ -1 +1 @@
1
- <span style="float:right;margin-left:2em;margin-top:-6px;text-shadow:1px 2px 0 #fff"><strong><?php _e( 'New user?','chld_thm_cfg' ); ?> <span style="color:#F1823B"><?php _e( 'Click help', 'chld_thm_cfg' ); ?></span></strong> <i class="dashicons dashicons-arrow-right-alt" style="color:#F1823B"></i></span><a href="<?php echo CHLD_THM_CFG_DOCS_URL; ?>/child-theme-configurator-pro/" target="_blank" title="<?php _e( 'Get CTC Pro and other tools', 'chld_thm_cfg' ); ?>" style="float:right"><img src="<?php echo CHLD_THM_CFG_URL; ?>css/lilaea-logo.png" height="36" width="145" alt="<?php _e( 'Lilaea Media - Responsive Tools for a Mobile World', 'chld_thm_cfg' ); ?>" /></a>
1
+ <span style="float:right;margin-left:2em;margin-top:-6px;text-shadow:1px 2px 0 #fff"><strong><?php _e( 'New user?', 'child-theme-configurator' ); ?> <span style="color:#F1823B"><?php _e( 'Click help', 'child-theme-configurator' ); ?></span></strong> <i class="dashicons dashicons-arrow-right-alt" style="color:#F1823B"></i></span><a href="<?php echo CHLD_THM_CFG_DOCS_URL; ?>/child-theme-configurator-pro/" target="_blank" title="<?php _e( 'Get CTC Pro and other tools', 'child-theme-configurator' ); ?>" style="float:right"><img src="<?php echo CHLD_THM_CFG_URL; ?>css/lilaea-logo.png" height="36" width="145" alt="<?php _e( 'Lilaea Media - Responsive Tools for a Mobile World', 'child-theme-configurator' ); ?>" /></a>
includes/forms/rule-value.php CHANGED
@@ -10,7 +10,7 @@ if ( !defined( 'ABSPATH' ) ) exit;
10
  <?php wp_nonce_field( apply_filters( 'chld_thm_cfg_action', 'ctc_update' ) ); ?>
11
  <div class="ctc-input-row clearfix" id="ctc_input_row_rule_menu">
12
  <div class="ctc-input-cell"> <strong>
13
- <?php _e( 'Property', 'chld_thm_cfg' ); ?>
14
  </strong> </div>
15
  <div class="ctc-input-cell" id="ctc_rule_menu_selected">&nbsp;</div>
16
  <div id="ctc_status_rule_val"></div>
@@ -23,13 +23,13 @@ if ( !defined( 'ABSPATH' ) ) exit;
23
  </div>
24
  <div class="ctc-input-row clearfix" id="ctc_input_row_rule_header" style="display:none">
25
  <div class="ctc-input-cell"> <strong>
26
- <?php _e( 'Value', 'chld_thm_cfg' ); ?>
27
  </strong> </div>
28
  <div class="ctc-input-cell"> <strong>
29
- <?php _e( 'Sample', 'chld_thm_cfg' ); ?>
30
  </strong> </div>
31
  <div class="ctc-input-cell"> <strong>
32
- <?php _e( 'Selectors', 'chld_thm_cfg' ); ?>
33
  </strong> </div>
34
  </div>
35
  <div class="ctc-rule-value-input-container clearfix" id="ctc_rule_value_inputs" style="display:none"> </div>
10
  <?php wp_nonce_field( apply_filters( 'chld_thm_cfg_action', 'ctc_update' ) ); ?>
11
  <div class="ctc-input-row clearfix" id="ctc_input_row_rule_menu">
12
  <div class="ctc-input-cell"> <strong>
13
+ <?php _e( 'Property', 'child-theme-configurator' ); ?>
14
  </strong> </div>
15
  <div class="ctc-input-cell" id="ctc_rule_menu_selected">&nbsp;</div>
16
  <div id="ctc_status_rule_val"></div>
23
  </div>
24
  <div class="ctc-input-row clearfix" id="ctc_input_row_rule_header" style="display:none">
25
  <div class="ctc-input-cell"> <strong>
26
+ <?php _e( 'Value', 'child-theme-configurator' ); ?>
27
  </strong> </div>
28
  <div class="ctc-input-cell"> <strong>
29
+ <?php _e( 'Sample', 'child-theme-configurator' ); ?>
30
  </strong> </div>
31
  <div class="ctc-input-cell"> <strong>
32
+ <?php _e( 'Selectors', 'child-theme-configurator' ); ?>
33
  </strong> </div>
34
  </div>
35
  <div class="ctc-rule-value-input-container clearfix" id="ctc_rule_value_inputs" style="display:none"> </div>
includes/forms/tabs.php CHANGED
@@ -8,32 +8,27 @@ $active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : 'parent_child_options';
8
  <h2 class="nav-tab-wrapper clearfix">
9
  <a id="parent_child_options" href=""
10
  class="nav-tab<?php echo 'parent_child_options' == $active_tab ? ' nav-tab-active' : ''; ?>">
11
- <?php _e( 'Parent/Child', 'chld_thm_cfg' ); ?>
12
- </a>
13
- <?php if ( $enqueueset ): ?>
14
- <!----><a id="query_selector_options" href=""
15
  class="nav-tab<?php echo 'query_selector_options' == $active_tab ? ' nav-tab-active' : ''; ?>" <?php echo $hidechild; ?>>
16
- <?php _e( 'Query/Selector', 'chld_thm_cfg' ); ?>
17
- </a><!----><a id="rule_value_options" href=""
18
  class="nav-tab<?php echo 'rule_value_options' == $active_tab ? ' nav-tab-active' : ''; ?>" <?php echo $hidechild; ?>>
19
- <?php _e( 'Property/Value', 'chld_thm_cfg' ); ?>
20
- </a><!----><a id="import_options" href=""
21
  class="nav-tab<?php echo 'import_options' == $active_tab ? ' nav-tab-active' : ''; ?>" <?php echo $hidechild; ?>>
22
- <?php _e( 'Web Fonts', 'chld_thm_cfg' ); ?>
23
- </a><!----><a id="view_child_options" href=""
24
- class="nav-tab<?php echo 'view_child_options' == $active_tab ? ' nav-tab-active' : ''; ?>" <?php echo $hidechild; ?>>
25
- <?php _e( 'Child CSS', 'chld_thm_cfg' ); ?>
26
- </a><!----><a id="view_parnt_options" href=""
27
  class="nav-tab<?php echo 'view_parnt_options' == $active_tab ? ' nav-tab-active' : ''; ?>" <?php echo $hidechild; ?>>
28
- <?php _e( 'Parent CSS', 'chld_thm_cfg' ); ?>
29
- </a>
30
- <?php
 
 
31
  if ( '' == $hidechild ):
32
- ?>
33
- <a id="file_options" href="" class="nav-tab<?php echo 'file_options' == $active_tab ? ' nav-tab-active' : ''; ?>" <?php echo $hidechild; ?>>
34
- <?php _e( 'Files', 'chld_thm_cfg' ); ?>
35
- </a>
36
- <?php
37
  endif;
38
  do_action( 'chld_thm_cfg_tabs', $this->ctc(), $active_tab, $hidechild );
39
  endif; ?>
8
  <h2 class="nav-tab-wrapper clearfix">
9
  <a id="parent_child_options" href=""
10
  class="nav-tab<?php echo 'parent_child_options' == $active_tab ? ' nav-tab-active' : ''; ?>">
11
+ <?php _e( 'Parent/Child', 'child-theme-configurator' ); ?>
12
+ </a><?php if ( $enqueueset ): ?><a id="query_selector_options" href=""
 
 
13
  class="nav-tab<?php echo 'query_selector_options' == $active_tab ? ' nav-tab-active' : ''; ?>" <?php echo $hidechild; ?>>
14
+ <?php _e( 'Query/Selector', 'child-theme-configurator' ); ?>
15
+ </a><a id="rule_value_options" href=""
16
  class="nav-tab<?php echo 'rule_value_options' == $active_tab ? ' nav-tab-active' : ''; ?>" <?php echo $hidechild; ?>>
17
+ <?php _e( 'Property/Value', 'child-theme-configurator' ); ?>
18
+ </a><a id="import_options" href=""
19
  class="nav-tab<?php echo 'import_options' == $active_tab ? ' nav-tab-active' : ''; ?>" <?php echo $hidechild; ?>>
20
+ <?php _e( 'Web Fonts', 'child-theme-configurator' ); ?>
21
+ </a><a id="view_parnt_options" href=""
 
 
 
22
  class="nav-tab<?php echo 'view_parnt_options' == $active_tab ? ' nav-tab-active' : ''; ?>" <?php echo $hidechild; ?>>
23
+ <?php _e( 'Baseline Styles', 'child-theme-configurator' ); ?>
24
+ </a><a id="view_child_options" href=""
25
+ class="nav-tab<?php echo 'view_child_options' == $active_tab ? ' nav-tab-active' : ''; ?>" <?php echo $hidechild; ?>>
26
+ <?php _e( 'Child Styles', 'child-theme-configurator' ); ?>
27
+ </a><?php
28
  if ( '' == $hidechild ):
29
+ ?><a id="file_options" href="" class="nav-tab<?php echo 'file_options' == $active_tab ? ' nav-tab-active' : ''; ?>" <?php echo $hidechild; ?>>
30
+ <?php _e( 'Files', 'child-theme-configurator' ); ?>
31
+ </a><?php
 
 
32
  endif;
33
  do_action( 'chld_thm_cfg_tabs', $this->ctc(), $active_tab, $hidechild );
34
  endif; ?>
includes/forms/themepreview.php CHANGED
@@ -9,15 +9,15 @@ if ( !defined( 'ABSPATH' ) ) exit;
9
  <div class="ctc-theme-option-left"><img src="<?php echo $theme[ 'screenshot' ]; ?>" class="ctc-theme-option-image"/></div>
10
  <div class="ctc-theme-option-right">
11
  <h3 class="theme-name"><?php echo $theme[ 'Name' ]; ?></h3>
12
- <?php _e( 'Version: ', 'chld_thm_cfg' ); echo esc_attr( $theme[ 'Version' ] );?>
13
  <br/>
14
- <?php _e( 'By: ', 'chld_thm_cfg' ); echo esc_attr( $theme[ 'Author' ] );?>
15
  <br/><?php if ( !is_multisite() || $theme[ 'allowed' ] ): ?>
16
- <a href="<?php echo admin_url( '/customize.php?theme=' . $slug );?>" title="<?php _e( 'Preview', 'chld_thm_cfg' );
17
- if ( is_multisite() ) _e(' in default Site', 'chld_thm_cfg'); ?>" class="ctc-live-preview" target="_blank">
18
- <?php _e( 'Live Preview', 'chld_thm_cfg' ); ?>
19
  </a><?php else: ?>
20
- <a href="<?php echo network_admin_url( '/themes.php?theme=' . $slug );?>" title="<?php _e( 'Go to Themes', 'chld_thm_cfg' ); ?>" class="ctc-live-preview">
21
- <?php _e( 'Not Network Enabled', 'chld_thm_cfg' );?>
22
  </a><?php endif; ?></div>
23
  </div>
9
  <div class="ctc-theme-option-left"><img src="<?php echo $theme[ 'screenshot' ]; ?>" class="ctc-theme-option-image"/></div>
10
  <div class="ctc-theme-option-right">
11
  <h3 class="theme-name"><?php echo $theme[ 'Name' ]; ?></h3>
12
+ <?php _e( 'Version: ', 'child-theme-configurator' ); echo esc_attr( $theme[ 'Version' ] );?>
13
  <br/>
14
+ <?php _e( 'By: ', 'child-theme-configurator' ); echo esc_attr( $theme[ 'Author' ] );?>
15
  <br/><?php if ( !is_multisite() || $theme[ 'allowed' ] ): ?>
16
+ <a href="<?php echo admin_url( '/customize.php?theme=' . $slug );?>" title="<?php _e( 'Preview', 'child-theme-configurator' );
17
+ if ( is_multisite() ) _e(' in default Site', 'child-theme-configurator'); ?>" class="ctc-live-preview" target="_blank">
18
+ <?php _e( 'Live Preview', 'child-theme-configurator' ); ?>
19
  </a><?php else: ?>
20
+ <a href="<?php echo network_admin_url( '/themes.php?theme=' . $slug );?>" title="<?php _e( 'Go to Themes', 'child-theme-configurator' ); ?>" class="ctc-live-preview">
21
+ <?php _e( 'Not Network Enabled', 'child-theme-configurator' );?>
22
  </a><?php endif; ?></div>
23
  </div>
includes/forms/webfonts.php CHANGED
@@ -12,10 +12,10 @@ $ctcpage = apply_filters( 'chld_thm_cfg_admin_page', CHLD_THM_CFG_MENU );
12
  <div class="ctc-input-cell">
13
  <div class="ctc-textarea-button-cell" id="ctc_save_imports_cell">
14
  <input type="button" class="button ctc-save-input" id="ctc_save_imports"
15
- name="ctc_save_imports" value="<?php _e( 'Save', 'chld_thm_cfg' ); ?>" disabled />
16
  </div>
17
  <strong>
18
- <?php _e( 'Linked Stylesheets', 'chld_thm_cfg' ); ?>
19
  </strong>
20
  <p><?php _e( 'Use <code>@import url( [path] );</code> to link additional stylesheets. Child Theme Configurator uses the <code>@import</code> keyword to identify them and convert them to <code>&lt;link&gt;</code> tags. <strong>Example:</strong>');?></p>
21
  <p><code>@import url(http://fonts.googleapis.com/css?family=Oswald);</code></p>
12
  <div class="ctc-input-cell">
13
  <div class="ctc-textarea-button-cell" id="ctc_save_imports_cell">
14
  <input type="button" class="button ctc-save-input" id="ctc_save_imports"
15
+ name="ctc_save_imports" value="<?php _e( 'Save', 'child-theme-configurator' ); ?>" disabled />
16
  </div>
17
  <strong>
18
+ <?php _e( 'Linked Stylesheets', 'child-theme-configurator' ); ?>
19
  </strong>
20
  <p><?php _e( 'Use <code>@import url( [path] );</code> to link additional stylesheets. Child Theme Configurator uses the <code>@import</code> keyword to identify them and convert them to <code>&lt;link&gt;</code> tags. <strong>Example:</strong>');?></p>
21
  <p><code>@import url(http://fonts.googleapis.com/css?family=Oswald);</code></p>
includes/forms/zipform.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( !defined( 'ABSPATH' ) ) exit;
3
+ ?>
4
+ <form method="post" action="?page=<?php echo CHLD_THM_CFG_MENU; ?>">
5
+ <?php wp_nonce_field( apply_filters( 'chld_thm_cfg_action', 'ctc_update' ) ); ?>
6
+ <input class="ctc_submit button button-primary"
7
+ name="ctc_export_child_zip" type="submit"
8
+ value="<?php _e( 'Export Zip', 'child-theme-configurator' ); ?>" />
9
+ </form>
10
+
includes/help/de_DE.php ADDED
@@ -0,0 +1,221 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( !defined( 'ABSPATH' ) ) exit;
3
+ // Help Content
4
+ ?>
5
+ <!-- BEGIN tab -->
6
+ <h3 id="ctc_tutorial">Hier starten: Anleitungs-Videos</h3>
7
+ <p><iframe width="560" height="315" src="https://www.youtube.com/embed/xL0YmieF6d0?rel=0&modestbranding=1" frameborder="0" allowfullscreen></iframe></p>
8
+ <p><iframe width="560" height="315" src="https://www.youtube.com/embed/vhQ5oi20rYE?rel=0&modestbranding=1" frameborder="0" allowfullscreen></iframe></p>
9
+ <p>Wir betten aus Leistungsgründen keine Anleitungsvideos mehr ein. <a href="http://www.childthemeconfigurator.com/tutorial-videos" target="_blank">Hier klicken, um die Videos anzuschauen.</a></p><!-- END tab -->
10
+ <!-- BEGIN tab -->
11
+ <h3 id="ctc_getting_started">Eltern/Kind-Tab</h3>
12
+ <ol><li><strong>Eine Aktion auswählen:</strong>
13
+ <ul><li><strong>Neues Kind-Thema ERZEUGEN</strong> - Installiere ein neues anpassbares Kind-Thema mit einem installierten Thema als Eltern.</li>
14
+ <li><strong>Bestehendes Kind-Thema ANPASSEN</strong> - Aufsetzen eines vorher installierten Kindthemas für den Konfigurator oder zum Ändern der aktuellen Einstellungen.</li>
15
+ <li><strong>Bestehendes Kind-Thema DUPLIZIEREN</strong> - Eine vollständige Kopie eines Kindthemas in ein neues Verzeichnis erstellen, inkl. Menüs, Widgets und anderer Einstellungen. Die Option zum Kopieren der Eltern-Einstellungen (Schritt 8 unten) ist mit dieser Aktion deaktiviert.</li>
16
+ <li><strong>Bestehendes Kind-Thema ZURÜCKSETZEN</strong> (dies wird all Ihre Arbeit im Konfigurator überschreiben) - Kind-Thema-Formatvorlage und Funktionsdateien auf ihren ursprünglichen Zustand setzen (vor der Initial-Konfiguration oder dem letzten Zurücksetzen).</li></ul></li>
17
+ <li><strong>Eltern-Thema auswählen</strong> falls Sie ein neues Kind-Thema erstellen; ein Kind-Thema auswählen, falls Sie anpassen, duplizieren, oder zurücksetzen möchten.</li>
18
+ <li><strong>Analysiere Kind-Thema</strong> - "Analysieren" klicken, um Formatvorlage-Abhängigkeiten und andere mögliche Probleme zu erkennen.</li>
19
+ <li><strong>Neues Verzeichnis benennen</strong> beim Erstellen eines neuen Kindthemas; ansonsten prüft es, ob das Verzeichnis korrekt ist. - Dies ist NICHT der Name des Kindthemas. Sie können den Namen, die Beschreibung etc. in Schritt 7 unten anpassen.</li>
20
+ <li><strong>Speicherort der neuen Stile auswählen:</strong><ul>
21
+ <li><strong>Primäre Formatvorlage (style.css)</strong> - Sichere neue angepasste Stile direkt in die primäre Formatvorlage des Kindthemas (ersetze vorhandene Werte). Die primäre Formatvorlage wird in der vom Thema definierten Reihenfolge geladen.</li>
22
+ <li><strong>Separate Formatvorlage</strong> - Sichere neue angepasste Stile in separate Formatvorlage und verwende bestehende Kindthemen-Stile als Basis. Diese Option wählen, wenn Sie die Original-Kindthemen-Stile behalten wollen (statt zu überschreiben). Diese Option erlaubt es Ihnen, nach der primären Formatvorlage geladene Formatvorlagen anzupassen.</li></ul></li>
23
+ <li><strong>Elternthema-Formatvorlage Behandlung auswählen:</strong><ul>
24
+ <li><strong>Benutze die WordPress Stil-Warteschlange.</strong> - Den Konfigurator die richtigen Aktionen und Abhängigkeiten auswählen lassen und Funktionendateien automatisch aktualisieren.</li>
25
+ <li><strong>Benutze @import</strong> in der Kind-Thema-Formatvorlage. - Diese Option nur benutzen, wenn die Eltern-Formatvorlage nicht mit der WordPress-Warteschlange geladen werden kann. Die Benutzung von <code>@import</code> ist nicht länger empfohlen.</li>
26
+ <li><strong>Keine zusätzliche Eltern-Formatvorlage-Behandlung hinzufügen.</strong> - Diese Option auswählen, wenn dieses Thema die Elternthema-Formatvorlage schon behandelt oder die Eltern-Thema <code>style.css</code>-Datei für die Darstellung/Anzeige nicht benutzt wird.</li></ul></li>
27
+ <li><strong>Kind-Thema-Name, Beschreibung, Autor, Version etc. anpassen</strong></li>
28
+ <li><strong>Kopieren der Elternthema-Menüs, Widgets und anderer Einstellungen in das Kind-Thema.</strong> - HINWEIS: Dies überschreibt alle im Kind-Thema vorgenommenen Änderungen und Einstellungen.</li>
29
+ <li><strong>Klicken Sie auf die Schaltfläche</strong> um den Konfigurator zu starten.</li>
30
+ <li><strong>WICHTIG: <a target="_blank" href="<?php echo CHLD_THM_CFG_DOCS_URL; ?>/how-to-use/#preview_activate" title="Testen Sie Ihr Kind-Thema vor der Aktivierung!">Testen Sie Ihr Kind-Thema immer mit der Live-Vorschau (Themen-Konfigurator) vor der Aktivierung!</a></strong></li>
31
+ </ol>
32
+ <!-- END tab -->
33
+ <!-- BEGIN tab -->
34
+ <h3 id="ctc_query_selector">Abfrage/Selektor-Tab</h3>
35
+ <p>Es gibt zwei Wege, Eltern-Stile (Basiswerte) zu identifizieren und zu übersteuern. Der Child Theme Configurator lässt Sie Stile suchen nach <strong>Selektor</strong> oder nach <strong>Eigenschaft</strong>. Wenn Sie einen bestimmten Selektor ändern wollen (z.Bsp. h1), benutzen Sie den "Abfrage/Selektor"-Tab. Wenn Sie einen Wert Webseiten-weit ändern wollen (z.Bsp. die Farbe des Typs), benutzen Sie den "Eigenschaften/Wert"-Tab.</p>
36
+ <p>Der Abfrage/Selektor-Tab lässt Sie bestimmte Selektoren finden und bearbeiten. Zuerst finden Sie die Abfrage, die den gesuchten Selektor enthält, indem Sie in die <strong>Abfrage</strong> Autoauswahl-Box schreiben. Wählen Sie durch Mausklick oder "Eingabe"- bzw. "Tabulator"-Tasten. Selektoren sind in der <strong>Basis</strong> Abfrage standardmäßig.</p>
37
+ <p>Dann finden Sie den mit der Eingabe in der <strong>Selektor</strong> Autoauswahl-Box. Wählen Sie aus mit Mausklick oder der "Eingabe"- bzw. den "Tabulator"-Tasten.</p>
38
+ <p>Dies lädt alle Eigenschaften für diesen Selektor mit den Eltern-Werten auf der linken und den Kind-Werten auf der rechten Seite. Alle bestehenden Kind-Werte werden automatisch abgefüllt. Es gibt auch eine Musteransicht, welches die Kombination der Eltern- und Kindwerte Übersteuerungen anzeigt. Beachten Sie, dass der <strong>Rahmen</strong> und <strong>Hintergrundbild</strong> speziell behandelt werden.</p>
39
+ <p>Wenn Sie zusätzliche Eigenschaften zu einem bestehenden Selektor hinzufügen wollen, laden Sie zuerst den Selektor mit dem Abfrage/Selektor-Tab. Dann finden Sie die zu übersteuernde Eigenschaft mit der Eingabe in die <strong>Neue Eigenschaft</strong>-Auswahlbox. Wählen Sie mit einem Mausklick oder der Eingabe der ENTER- oder TAB-Taste. Dies wird der Auswahl eine neue Eingabezeile hinzufügen.</p>
40
+ <p>Das "Reihenfolge"-Feld enthält die Original-Reihenfolge des Selektors der Eltern-Formatvorlage. Sie können die Selektor-Reihenfolge ändern, indem Sie eine tiefere/höhere Zahl im Reihenfolge-Feld eingeben. Sie können auch Stil-Übersteuerungen forcieren (sogenannter !important-Schalter), indem Sie das "!" Kästchen neben der Eingabe anwählen. Benutzen Sie es nicht zu oft.</p>
41
+ <p>Klicken Sie auf "Sichern" um die Kind-Formatvorlage zu aktualisieren und die Änderungen im Wordpress-Admin zu speichern.</p>
42
+ <!-- END tab -->
43
+ <!-- BEGIN tab -->
44
+ <h3 id="ctc_new_styles">Rohes CSS hinzufügen</h3>
45
+ <p>Wenn Sie komplett neue Selektoren oder sogar @media-Queries hinzufügen wollen, können Sie formloses CSS im Textfeld "Rohes CSS" eingeben. Achten Sie auf eine korrekte Syntax (bspw. passende geschweifte Klammern etc.), damit der Parser die neuen Stile laden kann. Sie erkennen Fehler an einem roten "X", welches neben der Sichern-Schaltfläche erscheint.</p>
46
+ <p>Wenn Sie die Shorthand-Syntax für Eigenschaften und Werte bevorzugen (anstatt der Vorgaben durch den Kind-Thema-Konfigurator), können Sie diese hier auch eingeben. Der Parser wir diese Eingaben automatisch in normalisierten CSS-Code konvertieren.</p>
47
+ <p>Wenn Sie zusätzliche Eigenschaften zu einem bestehenden Selektor hinzufügen möchten, laden Sie zuerst den Selektor mit dem Abfrage/Selektor-Tab. Dann suchen Sie die Eigenschaft zum Übersteuern, indem Sie in die <strong>Neue Eigenschaft</strong>-Box schreiben. Wählen Sie mit einem Mausklick oder der Eingabe der ENTER- oder TAB-Taste. Dies wird der Auswahl eine neue Eingabezeile hinzufügen.</p>
48
+ <!-- END tab -->
49
+ <!-- BEGIN tab -->
50
+ <h3 id="ctc_property_value">Eigenschaften/Wert-Tab</h3>
51
+ <p>Es gibt zwei Wege, Eltern-Stile (Basiswerte) zu identifizieren und zu übersteuern. Der Child Theme Configurator lässt Sie Stile suchen nach <strong>Selektor</strong> oder nach <strong>Eigenschaft</strong>. Wenn Sie einen bestimmten Selektor ändern wollen (z.Bsp. h1), benutzen Sie den "Abfrage/Selektor"-Tab. Wenn Sie einen Wert Webseiten-weit ändern wollen (z.Bsp. die Farbe des Typs), benutzen Sie den "Eigenschaften/Wert"-Tab.</p>
52
+ <p>Der Eigenschaften/Wert-Tab lässt Sie bestimmte Werte für eine gewisse Eigenschaft finden und ermöglicht dann das Bearbeiten für individuelle Selektoren, welche diese Eigenschaft-/Wert-Kombination benutzen. Zuerst finden Sie die Eigenschaft, die Sie übersteuern möchten, indem Sie diese in der <strong>Eigenschaft</strong> Autoauswahl-Box eingeben. Wählen Sie durch Mausklick oder "Eingabe"- bzw. "Tabulator"-Tasten.</p>
53
+ <p>Dies lädt alle einzigartigen Werte dieser Eigenschaft in der Eltern-Formatvorlage mit einer Mustervorschau für diese Werte. Wenn Werte in der Kind-Formatvorlage existieren, die nicht in der Eltern-Formatvorlage enthalten sind, werden diese ebenfalls angezeigt.</p>
54
+ <p>Für jeden einzigartigen Wert, klicken Sie auf die "Selektoren"-Verknüpfung, um eine Liste der Selektoren mit dieser Eigenschaften-/Wert-Kombination anzuzeigen, nach Abfrage gruppiert mit einer Muster-Vorschau der Werte und Eingaben für die Kind-Werte. Alle bestehenden Kind-Werte werden automatisch abgefüllt.</p>
55
+ <p>Klicken Sie auf "Sichern" um die Kind-Formatvorlage zu aktualisieren und die Änderungen im Wordpress-Admin zu speichern.</p>
56
+ <!-- END tab -->
57
+ <!-- BEGIN tab -->
58
+ <h3 id="ctc_imports">Webschriftarten-Tab</h3>
59
+ <p>Sie können zusätzliche Formatvorlagen und Webschriftarten verknüpfen, indem Sie @import Regeln in das Textfeld auf dem Webschriftarten-Tab eingeben.</p>
60
+ <p><strong>Hinweis:</strong> Child Theme Configurator schreibt nicht mehr länger @import Regeln in die Formatvorlage. Stattdessen benutzt es das @import Schlüsselwort und stellt sie in die Warteschlange. WordPress wandelt sie dann um in &lt;link&gt; Tags im verarbeiteten HTML.</p>
61
+ <p>Wichtig: importieren Sie die Eltern-Formatvorlage nicht hier. Benutzen Sie die "Eltern-Formatvorlage-Behandlung"-Option auf dem Eltern/Kind-Tab.</p>
62
+ <p>Wenn Sie eine Formatvorlage unter "Zusätzliche Formatvorlegen einlesen" gewählt haben, als Sie das Kind-Thema erstellt haben, werden diese Stile für Übersteuerungen in der Kind-Formatvorlage zur Verfügung stehen.</p>
63
+ <p>WordPress lädt automatisch zusätzliche Formatvorlagen, wenn es das Eltern-Thema lädt, also müssen Sie @import rules dafür hier nicht hinzufügen.</p>
64
+ <p>Unten ist ein Beispiel, welche eine lokale angepasste Formatvorlage lädt (Sie müssen das "fonts"-Verzeichnis und die Formatvorlage hinzufügen), sowie die Schriftart "Open Sans" von Google Web Fonts:</p>
65
+ <blockquote><pre><code>&#64;import url(fonts/Formatvorlage.css);
66
+ &#64;import url(http://fonts.googleapis.com/css?family=Open+Sans:400,400italic,700,700italic);</code></pre></blockquote>
67
+ <!-- END tab -->
68
+ <!-- BEGIN tab -->
69
+ <h3 id="ctc_files">Dateien-Tab</h3>
70
+ <h5>Eltern-Vorlagen</h5>
71
+ <p>Kopieren von PHP-Vorlagendateien des Eltern-Themes, indem Sie die Kästchen auswählen und "Auswahl zu gewählten Kind-Themen kopieren", und die Vorlage wird zum Kind-Themenverzeichnis hinzugefügt.</p>
72
+ <p><strong>ACHTUNG: Wenn Ihr Kind-Thema aktiv ist, wird nach dem Kopiervorgang sofort die Kind-Thema-Version der Datei anstatt der Eltern-Datei benutzt.</strong></p>
73
+ <p>Die <code>functions.php</code>-Datei wird getrennt erstellt und kann nicht hierher kopiert werden.</p>
74
+ <h5>Kind-Thema-Dateien</h5>
75
+ <p>Vorlagen, die vom Eltern-Thema kopiert wurden, sowie alle Formatvorlagen-Sicherungen, sind hier aufgelistet. Vorlagen können mittels des Themen-Editors im Design-Menü bearbeitet werden.</p>
76
+ <p>Löschen Sie Kind-Thema-Dateien, indem Sie die Kästchen anwählen und auf "Auswahl löschen" klicken.</p>
77
+ <h5>Kind-Thema-Bilder</h5>
78
+ <p>Diese Bilder befinden sich unter dem <code>Images</code>-Verzeichnis in Ihrem Kind-Thema-Verzeichnis und sind nur für Formatvorlagen vorgesehen. Benutzen Sie die Medienbibliothek für Inhaltsbilder.</p>
79
+ <p>Sie können neue Bilder mittels des "Bild hochladen"-Formulars hochladen. Löschen Sie Bilder durch die Auswahl der Kästchen und dem Klicken auf "Auswahl löschen".</p>
80
+ <h5>Kind-Thema Screenshot</h5>
81
+ <p>Sie können hier einen speziellen/angepassten Screenshot für das Kind-Thema hochladen.</p>
82
+ <p>Der Themen-Screenshot sollte ein 4:3-Verhältnis aufweisen (z.Bsp, 880px x 660px) JPG, PNG oder GIF. Es wird in <code>screenshot</code> umbenannt.</p>
83
+ <h5>Kind-Thema als ZIP-Archiv exportieren </h5>
84
+ <p>Sie können Ihr Kind-Thema für den Gebrauch auf einer anderen Wordpress-Webseite herunterladen, indem Sie auf "Export" klicken.</p>
85
+ <!-- END tab -->
86
+ <!-- BEGIN tab -->
87
+ <h3 id="ctc_preview">Vorschau und Aktivierung</h3>
88
+ <p><strong>WICHTIG: <a target="_blank" href="<?php echo CHLD_THM_CFG_DOCS_URL; ?>/how-to-use/#preview_activate" title="Testen Sie Ihr Kind-Thema vor der Aktivierung!">Testen Sie Ihr Kind-Thema vor der Aktivierung!</a></strong> Einige Themen (hauptsächlich kommerzielle Themen) laden Eltern-Formatvorlagen nicht korrekt oder laden Kind-Formatvorlagen automatisch oder PHP-Dateien. <strong>Im schlimmsten Fall wird bei Aktivierung Ihre Webseite unbrauchbar.</strong></p>
89
+ <ol>
90
+ <li>Navigieren Sie zu Design > Themen im Wordpress-Admin. Sie werden nun die neuen Kind-Themen als eine der installierten Themen sehen.</li>
91
+ <li>Klicken Sie auf "Live-Vorschau" unterhalb des Kind-Themas, um es in Aktion zu sehen.</li>
92
+ <li>Wenn Sie das Kind-Thema nun live schalten wollen, klicken Sie auf "Aktivieren."</li>
93
+ </ol>
94
+ <p><strong>MULTISITE NUTZER:</strong> Sie müssen Ihr Thema Netzwerk-aktivieren, um es in der Live-Vorschau zu sehen. Gehen Sie zu 'Themen' in der Netzwerk-Administration.</p>
95
+ <!-- END tab -->
96
+ <!-- BEGIN tab -->
97
+ <h3 id="ctc_permissions">Dateiberechtigungen</h3>
98
+ <p>Wordpress wurde für verschiedene Serverkonfigurationen entwickelt. Child Theme Configurator benutzt die WordPress Filesystem API, um Webseiten das Bearbeiten von Dateien zu ermöglichen, die Nutzerberechtigungen benötigen.</p>
99
+ <p>Allerdings, weil die meiste Funktionalität mittels AJAX(Hintergrund)-Anfragen passiert, muss die Kind-Formatvorlage auf dem Server beschreibbar sein.</p>
100
+ <p>Das Plugin erkennt automatisch Ihre Konfiguration und liefert eine Anzahl von Optionen, um diese Anforderung zu lösen. Benutzen Sie die zur Verfügung gestellten Verknüpfungen, um mehr zu erfahren, beispielsweise:</p>
101
+ <ol>
102
+ <li>Die Formatvorlage mithilfe des Plugins vorübergehend schreibbar machen.</li>
103
+ <li>Hinzufügen von FTP/SSH-Berechtigungen zur Wordpress-Konfigurationsdatei.</li>
104
+ <li>Auf einem Server die Schreibberechtigung manuell setzen.</li>
105
+ <li>Ihrem Webserver die Schreibberechtigung in gewissen Situationen erlauben.</li>
106
+ </ol>
107
+ <!-- END tab -->
108
+ <!-- BEGIN tab -->
109
+ <h3 id="ctc_faq">FAQs</h3>
110
+ <<h5 id="broken_theme">HILFE! Ich habe eine Datei geändert und kann nun über nicht mehr über wp-admin einloggen, um es zu reparieren!</h5>
111
+ <p>Um aus einem defekten Thema herauszukommen, müssen Sie das problematische Themen-Verzeichnis umbenennen (via FTP, SSH oder Ihrem Webhoster-Kontrollpanel bzw. Dateimanager), so dass Wordpress es nicht mehr finden kann. WordPress wird dann einen Fehler generieren und zum Standard-Thema zurückkehren (aktuell Twenty-Fourteen).</p>
112
+
113
+ <p>Das Kind-Thema ist normalerweise in Ihrem Themen-Verzeichnis</p>
114
+
115
+ <code>[path/to/wordpress]/wp-content/themes/[child-theme]</code>
116
+
117
+ <p>Um dies in der Zukunft zu vermeiden, testen Sie Ihr Kind-Thema immer in der Live-Vorschau, bevor Sie es aktivieren.</p>
118
+ <h5 id="no-comments">Wie füge ich Kommentare hinzu?</h5>
119
+ <p><strong>Kommentare sind nicht beliebig erlaubt.</strong> Eine hohe Flexibilität bei der Vorschau und zum Ändern von Stilen erfordert ein kompliziertes Parsen (Auslesen) und Datenstrukturen. Kommentare zu unterhalten, die an ein bestimmtes Element in der Formatvorlage gebunden sind, ist sehr aufwändig im Vergleich zum Nutzen. Obwohl wir dies in der Zukunft als Funktion bringen wollen, <em>werden zurzeit noch alle Kommentare aus dem Code der Kind-Formatvorlage entfernt.</em></p>
120
+ <h5 id="menus_broken">Wieso werden meine Menüs inkorrekt angezeigt, wenn ich das neue Kind-Thema aktiviere?</h5>...oder...
121
+ <h5 id="header_broken">Wieso fehlt mein angepasster Header (custom header), wenn ich das neue Kind-Thema aktiviere?</h5>...oder...
122
+ <h5 id="background_broken">Wieso ändert sich mein angepasster Hintergrund zurück zum Standard, wenn ich das Kind-Thema aktiviere?</h5>...oder...
123
+ <h5 id="options_broken">Wieso verschwinden meine Themen-Optionen, wenn ich das Kind-Thema aktiviere?</h5>
124
+ <p>Diese Optionen sind für jedes Thema spezifisch und werden getrennt in der Datenbank gespeichert. Beim Erstellen eines neuen Kind-Themas sind diese Optionen leer.</p>
125
+
126
+ <p><strong>Viele dieser Optionen können in das Kind-Thema kopiert werden, indem man das Kästchen "Kopieren Eltern-Theme-Menüs, Widgets und andere Design-Optionen" anklickt, wenn Sie die Kind-Thema-Dateien auf dem Eltern/Kind-Tab erstellen.</strong></p>
127
+
128
+ <p>Wenn Sie andere Optionen setzen wollen, können Sie diese nach dem Aktivieren des Kind-Themas aktivieren, oder mittels der Live-Vorschau unter Design > Themen.</p>
129
+ <ul class="instructions">
130
+ <li><strong>Menüs: </strong> Gehen Sie zu Design > Menüs und klicken Sie den "Position"-Tab. Standardmäßig wird das Primärmenü die Verknüpfungen automatisch aus den bestehenden Seiten erstellen. Wählen Sie Ihr angepasstes Menü aus der Auswahlliste und klicken Sie "Neues Menü benutzen". Dies ersetzt das Standardmenü und Sie sehen die korrekten Verknüpfungen.</li>
131
+
132
+ <li><strong>Header (Kopf): </strong> Gehen Sie zu Design > Header. Einige Themen zeigen standardmäßig den Titel und die Tagline Ihrer "Allgemeinen Einstellungen". Wählen Sie "Bild auswählen" und finden Sie einen "Kopf" aus der Medienbibliothek oder mittels Hochladen. Dies ersetzt den Standard mit dem angepassten Bild.</li>
133
+
134
+ <li><strong>Hintergrund: </strong> Gehen Sie zu Design > Hintergrund und wählen Sie ein neues Hintergrundbild oder eine Farbe.</li>
135
+
136
+ <li><strong>Optionen: </strong> Jedes Thema behandelt Optionen speziell/anders. Meistens erstellen Sie einen Satz Optionen und speichern ihn in der Wordpress-Datenbank. Einige Optionen sind spezifisch für das aktive Thema (oder Kind-Thema), und einige nur für das Eltern-Thema bestimmt (d.h. das Kind-Thema kann sie NICHT übersteuern). Sie müssen sich beim Themen-Autor erkundigen, welche auf welche Art funktionieren.</li>
137
+ </ul>
138
+ </p>
139
+ <h5 id="existing_parent">Wie verschiebe ich bereits gemachte Änderungen an meinem Thema in mein Kind-Thema?</h5>
140
+ <p><a href="<?php echo CHLD_THM_CFG_DOCS_URL; ?>/how-to-use/#child_from_modified_parent" class="scroll-to">Folgen Sie diesen Schritten</a>. </p>
141
+ <h5 id="web_fonts">Wie füge ich Webschriftarten hinzu?</h5>
142
+ <p>Die einfachste Methode ist das Einfügen des @import code, geliefert von <a href="http://www.google.com/fonts" title="Google Fonts">Google</a>, <a href="http://www.fontsquirrel.com/" title="Font Squirrel">Font Squirrel</a> oder jeder anderen Schriftartenseite auf dem Schriftarten-Tab. Die Schriftarten werden dann zum Gebrauch als Wert der <strong>font-family</strong> Eigenschaft zur Verfügung stehen. Stellen Sie sicher, dass Sie die Lizenz zum Gebrauch der Webschriftarten verstehen. </p>
143
+ <p>Sie können auch eine sekundäre Formatvorlage erstellen, welche die @font-face Regeln enthält, und diese auf dem Webschriftarten-Tab importieren. </p>
144
+ <h5 id="plugin">Funktionert das mit Plugins?</h5>
145
+ <p>Wir bieten eine Premium-Erweiterung an, die Sie Stile für jedes auf der Webseite installierte Plugin einfach verändern lässt. Der Child Theme Configurator Plugin Extension scannt Ihre Plugins und erlaubt die Erstellung von angepassten Formatvorlagen in Ihrem Kind-Thema. <a href="<?php echo CHLD_THM_CFG_DOCS_URL; ?>/child-theme-configurator-pro/" title="Die Kontrolle über Ihre Plugin-Stile mit der Child Theme Configurator Plugin Erweiterung für WordPress übernehmen">Mehr erfahren <i class="genericon genericon-next"></i></a>
146
+ <h5 id="doesnt_work">Wieso funktioniert das in meinem (Hersteller des Themas hier einfügen) Thema nicht?</h5>
147
+ <p>Einige Themen (hauptsächlich kommerzielle Themen) laden die Eltern-Vorlagen-Dateien nicht korrekt oder laden Kind-Thema-Formatvorlagen oder PHP-Dateien automatisch.</p><p>Das ist unglücklich, weil es im besten Fall den Webmaster daran hindert, Anpassungen vorzunehmen (abgesehen von solchen durch die Themen-Optionen), die einen Upgrade überleben. <strong>Im schlimmsten Fall jedoch wird Ihre Webseite unbrauchbar, wenn Sie das Kind-Thema aktivieren.</strong> </p>
148
+ <p>Kontaktieren Sie direkt den Hersteller, um diese Kern-Funktionalität zu verlangen. Unserer Meinung nach sollten ALLE Themen (vor allem kommerzielle) die von Wordpress.org beschriebenen Themen-Tests erfüllen. </p>
149
+ <h5 id="missing_parent">Wieso hat das Eltern-Thema keine Stile, wenn ich auf "Eltern-CSS anzeigen" gehe?</h5>
150
+ <p>Ihr Eltern-Thema benutzt für die Formatvorlagen womöglich einen getrennten Ort. Wählen Sie individuelle Formatvorlagen aus dem "Zusätzliche Formatvorlagen auslesen"-Abschnitt des Eltern/Kind-Tabs und klicken Sie erneut auf "Neuaufbau Kind-Thema-Dateien". </p>
151
+ <h5 id="performance">Wird das meine Webseite verlangsamen?</h5>
152
+ Sobald die Kind-Formatvorlage erstellt ist, fügt CTC im Frontend nur ein wenig Zusatzlast hinzu, da die ganze Funktionalität im Admin enthalten ist.
153
+
154
+ Das Plugin lädt den Hauptteil des Codes im Admin nur, wenn Sie das Tool benutzen. Die größte Performance-Einbuße geschieht, wenn Sie die Kind-Themen-Dateien auf dem Eltern/Kind-Tab erstellen. </p>
155
+ <h5 id="where_are_styles">Wo sind die Stile? Der Konfigurator zeigt nichts an!</h5>
156
+ <p>Alle Stile werden dynamisch geladen. Sie müssen in den Textfelder etwas eingeben, um die Stile zum Bearbeiten auszuwählen.</p>
157
+ <p>"Base" ist die Abfragegruppe, die mit keiner bestimmten at-Regel verbunden sind.</p>
158
+ <p>Beginnen Sie mit einem Klick auf den "Abfage/Selektor"-Tab und der Eingabe von "base" in der ersten Box. In der zweiten Box können Sie dann mit der Eingabe beginnen, um die Stil-Selektoren zum Bearbeiten zu holen. </p>
159
+ <h5 id="preview-not-loading">Wieso zeigen die Vorschau-Tab "Formatvorlage kann nicht angezeigt werden"?</h5>
160
+ <p>Sie müssen ein Kind-Thema auf dem Eltern/Kind-Tab für die Ansicht der Vorschau laden. Das kann auch passieren, wenn Ihre WP_CONTENT_URL sich von $bloginfo('site_url') unterscheidet. Ajax kann keine domänenübergreifenden Abfagen machen. Überprüfen Sie, ob der Einstellungen > Allgemein > "WordPress Adresse (URL)"-Wert korrekt ist. (Oft fehlt das "www"" in der Domäne.) </p>
161
+ <h5 id="edit_manually">Kann ich das Kind-Thema manuell offline bearbeiten (oder mithilfe des Editors), oder muss ich unbedingt den Konfigurator benutzen?</h5>
162
+ <p>Sie können jede gewünschte Änderung an der Formatvorlage vornehmen. Stellen Sie nur sicher, die geänderte Formatvorlage mittels des Eltern/Kind-Panels zu importieren, ansonsten wird der Konfigurator Ihre Änderungen beim nächsten Gebrauch überschreiben. Folgen Sie den üblichen Schritten, aber wählen Sie die Auswahloption "Bestehendes Kind-Thema benutzen" als Kind-Thema-Option. Der Konfigurator wird die internen Daten aus der neuen Formatvorlage automatisch aktualisieren. </p>
163
+ <h5 id="update_child">Wenn das Eltern-Thema geändert wird (z.Bsp. Upgrade), muss ich das Kind-Thema aktualisieren?</h5>
164
+ <p>Nein. Das ist der Zweck von Kind-Themen. Änderungen am Eltern-Thema werden vom Kind-Thema automatisch geerbt.</p>
165
+ <p>Ein Kind-Thema ist keine Kopie eines Eltern-Themas. Es ist eine besondere Funktion von WordPress, die Sie bestimmte Stile und Funktionen übersteuern lässt, während der Rest intakt bleibt. Das einzige Mal, dass Sie nach einem Upgrade Änderungen machen müssen ist, wenn das Eltern-Thema Stile oder Funktionsnamen ändert oder entfernt. Qualitäts-Themen sollten alle veralteten Funktionen oder Stile in den Upgrade-Hinweisen erwähnen, so dass Nutzer von Kind-Themen die entsprechenden Anpassungen vornehmen können. </p>
166
+ <h5 id="functions">Wo sind die .PHP-Dateien?</h5>
167
+ <p>Der Konfigurator fügt dem Kind-Themenverzeichnis automatisch eine leere functions.php-Datei hinzu. Sie können Dateien des Eltern-Themas mittels des "Dateien"-Tabs kopieren. Wenn Sie neue Vorlagen und Verzeichnisse erstellen möchten, müssen Sie diese manuell via FTP oder SSH hochladen. Beachten Sie, dass ein Kind-Thema die Eltern-Vorlagen automatisch erbt, es sei denn, sie bestehen bereits im Kind-Thema-Verzeichnis. Kopieren Sie nur Vorlagen, die Sie auch wirklich anpassen möchten.</p>
168
+ <h5 id="specific_color">Wie ändere ich eine(n) bestimmte Farbe/Schriftarttyp/Hintergrund?</h5>
169
+ <p>Sie können einen bestimmten Wert global mittels des Eigenschaften/Wert-Tabs übersteuern. Siehe Eigenschaften/Werte, oben.</p>
170
+ <h5 id="add_styles">Wie füge ich Stile hinzu, die nicht im Eltern-Thema enthalten sind?</h5>
171
+ <p>Sie können Abfragen und Selektoren mittels des "Rohes CSS"-Textfelds auf dem Abfrage/Selektor-Tab hinzufügen. Siehe Abfrage/Selektor, oben. </p>
172
+ <h5 id="add_styles">Wie entferne ich Stile aus dem Eltern-Thema?</h5>
173
+ <p>Sie sollten eigentlich Stile aus dem Eltern-Thema nicht entfernen. Sie können allerdings die Eigenschaft auf "Erben"," "Keine," oder Null setzen (abhängig von der Eigenschaft). Das wird den Eltern-Wert negieren. Ein wenig Probieren wird nötig sein.</p>
174
+ <h5 id="remove_styles">Wie entferne ich einen Stil aus einem Kind-Thema?</h5>
175
+ <p>Löschen Sie den Wert aus der Eingabe der Eigenschaft, die sie entfernen möchten. Der Child Theme Configurator fügt Übersteuerungen nur für Eigenschaften mit Werten hinzu. </p>
176
+ <h5 id="important_flag">Wie setze ich den !important-Schalter?</h5>
177
+ <p>Wir empfehlen immer ein gutes, verschachteltes Design, anstatt auf globale Übersteuerungen zu vertrauen. Dazu haben Sie die Möglichkeit, die Lade-Reihenfolge von Kind-Formatvorlagen zu ändern, indem Sie einen Wert im "Reihenfolge"-Feld eingeben. Sie können Eigenschaften als wichtig setzen, indem Sie das Kästchen mit dem "!" neben jeder Eingabe setzen. Benutzen Sie es massvoll. </p>
178
+ <h5 id="gradients">Wie erstelle ich browser-unabhängige Farbverläufe?</h5>
179
+ <p>Der Child Theme Configurator benutzt eine standarisierte Syntax für Farbverläufe und unterstützt nur zweifarbige Verläufe ohne Zwischenstopps. Die Eingaben bestehen aus dem Startpunkt (z.Bsp. top, left, 135deg, etc.), der Startfarbe und der Endfarbe. Browser-spezifische Syntax wird automatisch erstellt, wenn Sie diese Werte speichern. Siehe Tricks/Fallen, unten, für weitere Informationen. </p>
180
+ <h5 id="responsive">Wie mache ich das Thema responsive?</h5>
181
+ <p>Die kurze Antwort ist, ein responsives Eltern-Thema zu benutzen. Einige übliche Methoden für responsives Design sind:
182
+ <ul class="instructions"><li>Vermeiden von festen Breiten und Höhen. Der Gebrauch von max- and min-height Werten und Prozenten sind Wege, das Design dem Browser des Benutzers anzupassen.</li>
183
+ <li>Die Kombination von floats und clears mit inline und relative-Positionen erlaubt den Elementen, sich der umgebenden Behälterbreite fließend anzupassen.</li>
184
+ <li>Anzeigen und Verbergen von Inhalt mittels JavaScript.</li></ul>
185
+ <!-- END tab -->
186
+ <!-- BEGIN tab -->
187
+ <h3 id="ctc_glossary">Glossar</h3>
188
+ <ul>
189
+ <li id="parent_theme"><strong>Eltern-Thema</strong> Das Wordpress-Thema, welches Sie bearbeiten möchten. Wordpress lädt zuerst das Kind-Thema, dann das Eltern-Thema. Wenn ein Stil im Kind-Thema enthalten ist, übersteuert es das Eltern-Thema.</li>
190
+ <li id="child_theme"><strong>Kind-Thema</strong> Neues Thema, basierend auf einem Eltern-Thema. Sie können eine beliebige Anzahl von Kind-Themen von einem einzigen Eltern-Thema erstellen.</li>
191
+ <li id="class"><strong>Klasse</strong> Ein Begriff, der zum Organisieren von Objekten benutzt wird. Zum Beispiel, ein &lt;div&gt; könnte die "blue-text"-Klasse zugewiesen sein. Die Formatvorlage weist dann Mitgliedern der "blue-text"-Klasse den Wert "color: blue;" zu. Somit würde &lt;div&gt; als blauer Text im Browser dargestellt. Klassen-Selektoren beginnen mit einem Punkt.</li>
192
+ <li id="class"><strong>ID</strong> Eine einzigartige Zeichenkette, die ein bestimmtes Element bezeichnet. ID-Selektoren beginnen mit einem Hashtag (#).</li>
193
+ <li id="selector"><strong>Abfrage</strong> @media-Query-Anweisungen (siehe At-Regel unten).</li>
194
+ <li id="query"><strong>Selektor</strong> Kombination eines oder mehrere Elemente, Klassen, IDs oder andere Begriffe zum Identifizieren von Objektgruppen.</li>
195
+ <li id="property"><strong>Eigenschaft</strong> Einer von vielen standardisierten Begriffen, die dem Browser mitteilen, wie Objekte mit einem bestimmten Selektor anzuzeigen sind. Beispiele sind <strong>color</strong>, <strong>background-image</strong> und <strong>font-size</strong>.</li>
196
+ <li id="value"><strong>Wert</strong> Daten, die mit einer Eigenschaft korrespondieren.</li>
197
+ <li id="at-rule"><strong>At-Regel</strong> Ein CSS-Browser-Befehl, um die Standard-Funktionalität zu erweitern. Der Child Theme Configurator unterstützt zwei At-Regeln:
198
+ <ul>
199
+ <li id="at_import"><strong>@import</strong> Weist den Browser an, zusätzliche CSS-Informationen aus einer externen Quelle zu laden.</li>
200
+ <li id="at_media"><strong>@media (Media Query)</strong> Identifiziert Stilblöcke, die nur benutzt werden, wenn gewisse Browser-Eigenschaften zutreffen. Beispiele sind max-width, screen und print.</li>
201
+ </ul>
202
+ </li>
203
+ <li id="child_theme"><strong>Basis-Stil</strong> Ein Stil einer beliebigen Kind- oder Eltern-Vorlage, der durch die Formatvorlage des Kind-Themas übersteuert werden kann. Meistens stammen diese aus der Formatvorlage des Eltern-Themas.</li>
204
+ <li id="override"><strong>Übersteuerung</strong> Wenn ein Selektor in Kind- und Eltern-Thema besteht, bekommt derjenige aus dem Kind-Thema Priorität. Das ist eines der besonderen Merkmale des Kind-Thema-Konfigurators: es hilft dabei, <strong>exakte Übersteuerungen</strong> von Selektoren des Eltern-Themas zu erstellen, und eliminiert viele Stunden des mühsamen Versuchens.</li>
205
+ <li id="child_theme"><strong>Themenvorlage</strong> Eine PHP-Datei eines Themas ohne Funktionen und Klassen. Andere PHP-Dateien können nicht ohne Weiteres sicher überschrieben werden.</li>
206
+ </ul>
207
+ <!-- END tab -->
208
+ <!-- BEGIN sidebar -->
209
+ <h4>Unsere Plugins werden Sie nicht mit Spendeneinblendungen nerven...</h4>
210
+ <span style="font-size:smaller">...aber wir LIEBEN Empfehlungen.</span><br/><a href="http://wordpress.org/support/view/plugin-reviews/child-theme-configurator?rate=5#postform">Geben Sie uns 5 Sterne</a>
211
+ <h4>Wir stellen CTC Pro vor</h4>
212
+ <a href="<?php echo CHLD_THM_CFG_DOCS_URL; ?>/child-theme-configurator-pro/" title="Erfahren Sie mehr über CTC Pro"><img src="<?php echo CHLD_THM_CFG_URL . 'css/pro-banner.jpg'; ?>" width="150" height="48" /></a>
213
+ <p style="font-size:smaller">Von Wordpress-Entwicklern entworfen, die es jeden Tag benutzen. CTC Pro stellt Plugin-Formatvorlagen und andere Funktionen zur Verfügung, die Ihre Arbeit schneller und einfacher machen. Das ist ein kostenloses Upgrade für Nutzer, die die Plugin-Erweiterung erworben haben. <a href="<?php echo CHLD_THM_CFG_DOCS_URL; ?>/child-theme-configurator-pro/" title="Child Theme Configurator Pro">Mehr erfahren</a></p>
214
+ <h4 id="ctc_help_sidebar">Links/Verknüpfungen</h4>
215
+ <ul>
216
+ <li><a href="http://www.lilaeamedia.com/about/contact/">Uns kontaktieren</a></li>
217
+ <li><a href="http://www.childthemeconfigurator.com/">Plugin-Webseite</a></li>
218
+ <li><a href="http://codex.wordpress.org/Child_Themes">WordPress Codex</a></li>
219
+ <li><a href="http://wordpress.stackexchange.com/">WordPress Development (StackExchange)</a></li>
220
+ </ul>
221
+ <!-- END sidebar -->
includes/help/{help_en_US.php → en_US.php} RENAMED
@@ -3,62 +3,55 @@ if ( !defined( 'ABSPATH' ) ) exit;
3
  // Help Content
4
  ?>
5
  <!-- BEGIN tab -->
6
- <h3 id="ctc_getting_started">Start Here</h3>
7
- <p><strong style="font-size:large">10 Easy Steps to Create a Child Theme:</strong></p>
8
- <ol>
9
- <li><strong>Select the theme</strong> you want to configure from the &quot;Parent Theme&quot; menu.</li>
10
- <li><strong>Select &quot;new&quot; or &quot;existing&quot;.</strong>
11
- <ul>
12
- <li>If there are currently no child themes available, the &quot;Child Theme&quot; and &quot;Child Theme Names&quot; will be entered for you automatically based on the parent theme selected. You may edit these if you like, but they cannot be the same as an existing theme.</li>
13
- <li>If there are existing child themes available, there will be an additional menu labeled &quot;Use Existing Child Theme&quot; from which you can select, or enter a new value in the input box to create a new one.</li>
14
- </ul>
15
- </li>
16
- <li><strong>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>None (handled by theme)</strong>
20
- Select this option if all stylesheets are correctly enqueued for child themes. If you find that styles are not being applied correctly, use a different option.</li>
21
- <li><strong>Enqueue parent stylesheet (default)</strong>
22
- Select this option if the theme enqueues the active stylesheet but has no special handling for child themes. Start with this option if unsure.</li>
23
- <li><strong>Enqueue child stylesheet</strong>
24
- Select this option if the theme enqueues the parent stylesheet but does not enqueue the child stylesheet at all. This can happen if <code>get_template()</code> or <code>get_template_directory_uri()</code> is used to link the stylesheet.</li>
25
- <li><strong>Enqueue both parent and child stylesheets</strong>
26
- Select this option if stylesheet link tags are hard-coded into the header template (common in older themes). This enables the child stylesheet to override the parent stylesheet without using <code>@import.</code></li>
27
- <li><strong><code>@import</code> parent stylesheet</strong>
28
- This option imports the parent stylesheet from the child stylesheet. This enables the child stylesheet to override the parent stylesheet, but using <code>@import</code> is no longer recommended.</li>
29
- </ul></li>
30
- <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>
31
- <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>
32
- <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>
33
- <li><strong>Choose additional stylesheets</strong> If your theme uses additional stylesheets, you can open the &quot;Parse Additional Stylesheets&quot; toggle and they will appear as checkbox options. Stylesheets that are being used by the parent theme should be automatically selected for you. Only select additional stylesheets you wish to customize to reduce overhead. <strong>NOTE: If the parent theme uses Bootstrap stylesheets, they will not be automatically selected.</strong> You can select Bootstrap stylesheets manually if you need to customize them, but in most cases they add unecessary overhead to the configuration data.</li>
34
- <li><strong>Click "Generate/Rebuild Child Theme Files."</strong></li>
35
- <li><strong>IMPORTANT: <a target="_blank" href="<?php echo CHLD_THM_CFG_DOCS_URL; ?>/how-to-use/#preview_activate" title="Test your child theme before activating!">Always test your child theme with Live Preview before activating!</a></strong></li>
36
  </ol>
37
  <!-- END tab -->
38
  <!-- BEGIN tab -->
39
- <h3 id="ctc_tutorial">Tutorial Videos</h3>
40
- <p>We are no longer embedding videos for performance reasons. <a href="http://www.childthemeconfigurator.com/tutorial-videos" target="_blank">Click here to view videos.</a></p><!-- END tab -->
41
- <!-- BEGIN tab -->
42
  <h3 id="ctc_query_selector">Query/Selector Tab</h3>
43
- <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>property</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 "Property/Value" tab.</p>
44
  <p>The Query/Selector tab lets you find specific selectors and edit them. First, find the query that contains the selector you wish to edit by typing in the <strong>Query</strong> autoselect box. Select by clicking with the mouse or by pressing the "Enter" or "Tab" keys. Selectors are in the <strong>base</strong> query by default.</p>
45
  <p>Next, find the selector by typing in the <strong>Selector</strong> autoselect box. Select by clicking with the mouse or by pressing the "Enter" or "Tab" keys.</p>
46
- <p>This will load all of the properties for that selector with the Parent values on the left and the Child values inputs on the right. Any existing child values will be automatically populated. There is also a Sample preview that displays the combination of Parent and Child overrides. Note that the <strong>border</strong> and <strong>background-image</strong> get special treatment.</p>
 
47
  <p>The "Order" field contains the original sequence of the selector in the parent theme stylesheet. You can change the selector order sequence by entering a lower or higher number in the "Order" field. You can also force style overrides (so called "!important" flag) by checking the "!" box next to each input. Please use judiciously.</p>
48
  <p>Click "Save" to update the child stylesheet and save your changes to the WordPress admin.</p>
49
  <!-- END tab -->
50
  <!-- BEGIN tab -->
51
- <h3 id="ctc_new_styles">Adding New Styles</h3>
52
- <p>If you wish to add additional properties to a given selector, first load the selector using the Query/Selector tab. Then find the property you wish to override by typing in the <strong>New Property</strong> autoselect box. Select by clicking with the mouse or by pressing the "Enter" or "Tab" keys. This will add a new input row to the selector inputs.</p>
53
  <p>If you wish to add completely new selectors, or even new @media queries, you can enter free-form CSS in the "Raw CSS" textarea. Be aware that your syntax must be correct (i.e., balanced curly braces, etc.) for the parser to load the new styles. You will know it is invalid because a red "X" will appear next to the save button.</p>
54
  <p>If you prefer to use shorthand syntax for properties and values instead of the inputs provided by the Child Theme Configurator, you can enter them here as well. The parser will convert your input into normalized CSS code automatically.</p>
 
55
  <!-- END tab -->
56
  <!-- BEGIN tab -->
57
  <h3 id="ctc_property_value">Property/Value Tab</h3>
58
- <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>property</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 "Property/Value" tab.</p>
59
  <p>The Property/Value tab lets you find specific values for a given property and then edit that value for individual selectors that use that property/value combination. First, find the property you wish to override by typing in the <strong>Property</strong> autoselect box. Select by clicking with the mouse or by pressing the "Enter" or "Tab" keys.</p>
60
  <p>This will load all of the unique values that exist for that property in the parent stylesheet with a Sample preview for that value. If there are values that exist in the child stylesheet that do not exist in the parent stylesheet, they will be displayed as well.</p>
61
- <p>For each unique value, click the "Selectors" link to view a list of selectors that use that property/value combination, grouped by query with a Sample preview of the value and inputs for the child value. Any existing child values will be automatically populated.</p>
62
  <p>Click "Save" to update the child stylesheet and save your changes to the WordPress admin.</p>
63
  <!-- END tab -->
64
  <!-- BEGIN tab -->
@@ -92,7 +85,7 @@ This option imports the parent stylesheet from the child stylesheet. This enable
92
  <!-- END tab -->
93
  <!-- BEGIN tab -->
94
  <h3 id="ctc_preview">Preview and Activate</h3>
95
- <p><strong>IMPORTANT: <a target="_blank" href="<?php echo CHLD_THM_CFG_DOCS_URL; ?>/how-to-use/#preview_activate" title="Test your child theme before activating!">Test your child theme before activating!</a></strong> Some themes (particularly commercial themes) do not correctly load parent template files or automatically load child theme stylesheets or php files. <strong>In the worst cases they will break your website when you activate the child theme.</strong></p>
96
  <ol>
97
  <li>Navigate to Appearance > Themes in the WordPress Admin. You will now see the new Child Theme as one of the installed Themes.</li>
98
  <li>Click "Live Preview" below the new Child Theme to see it in action.</li>
@@ -177,7 +170,7 @@ The plugin only loads the bulk of the code in the admin when you are using the t
177
  <h5 id="add_styles">How do I add styles that aren't in the Parent Theme?</h5>
178
  <p>You can add queries and selectors using the "Raw CSS" textarea on the Query/Selector tab. See Query/Selector, above. </p>
179
  <h5 id="add_styles">How do I remove a style from the Parent Theme?</h5>
180
- <p>You shouldn't really "remove" a style from the Parent. You can, however, set the property to "inherit," "none," or zero (depending on the property). This will negate the Parent value. Some experimentation may be necessary.</p>
181
  <h5 id="remove_styles">How do I remove a style from the Child Theme?</h5>
182
  <p>Delete the value from the input for the property you wish to remove. The Child Theme Configurator only adds overrides for properties that contain values. </p>
183
  <h5 id="important_flag">How do I set the !important flag?</h5>
@@ -195,28 +188,33 @@ The plugin only loads the bulk of the code in the admin when you are using the t
195
  <ul>
196
  <li id="parent_theme"><strong>Parent Theme</strong> The WordPress Theme you wish to edit. WordPress first loads the Child Theme, then loads the Parent Theme. If a style exists in the Child Theme, it overrides the Parent Theme.</li>
197
  <li id="child_theme"><strong>Child Theme</strong> New Theme based on Parent Theme. You can create any number of Child Themes from a single Parent Theme.</li>
198
- <li id="class"><strong>Class</strong> A term used to organize objects. For example, a &lt;div&gt; might be assigned the "blue-text" class. The stylesheet might then assign "color: blue;" to members of the "blue-text" class. Thus, the &lt;div&gt; would display text as blue in the browser.</li>
199
- <li id="selector"><strong>Selector</strong> One or more html elements, classes, ids or other terms used to identify groups of objects.</li>
 
 
200
  <li id="property"><strong>Property</strong> One of many standardized terms used to tell the browser how to display objects matching a given selector. Examples are <strong>color</strong>, <strong>background-image</strong> and <strong>font-size</strong>.</li>
 
201
  <li id="at-rule"><strong>At-rule</strong> CSS browser instruction to extend default functionality. The Child Theme Configurator supports two At-rules:
202
  <ul>
203
- <li id="import"><strong>@import</strong> Instructs the browser to load additional CSS information from an external source.</li>
204
- <li id="query"><strong>@media (Media Query)</strong> Identifies blocks of styles that are used only when certain browser characteristics are true. Examples are max-width, screen and print.</li>
205
  </ul>
206
  </li>
 
207
  <li id="override"><strong>Override</strong> When a selector exists in both the Child Theme and the Parent Theme, the Child Theme takes priority over the Parent theme. This is where the Child Theme Configurator stands out: it helps you create <strong>exact overrides</strong> of selectors from the Parent Theme, eliminating hours of trial and error.</li>
 
208
  </ul>
209
  <!-- END tab -->
210
- <h3 id="ctc_help_sidebar">Links</h3>
211
  <!-- BEGIN sidebar -->
212
  <h4>Our plugins will not nag you for donations...</h4>
213
  <span style="font-size:smaller">...but we LOVE referrals.</span><br/><a href="http://wordpress.org/support/view/plugin-reviews/child-theme-configurator?rate=5#postform">Give Us 5 Stars</a>
214
  <h4>Introducing CTC Pro</h4>
215
- <a href="<?php echo CHLD_THM_CFG_DOCS_URL; ?>/child-theme-configurator-pro/" title="<?php _e( 'Learn more about CTC Pro', 'chld_thm_cfg' ); ?>"><img src="<?php echo CHLD_THM_CFG_URL . 'css/pro-banner.jpg'; ?>" width="150" height="48" /></a>
216
  <p style="font-size:smaller">Designed by WordPress developers who use it every day, CTC Pro adds plugin stylesheets and other features to make design work quicker and easier. This is a free upgrade for users that purchased the Plugins Extension. <a href="<?php echo CHLD_THM_CFG_DOCS_URL; ?>/child-theme-configurator-pro/" title="Child Theme Configurator Pro">Learn more</a></p>
 
217
  <ul>
218
- <li><a href="http://www.lilaeamedia.com/about/contact/">Contact us</a></li>
219
- <li><a href="http://www.childthemeconfigurator.com/">Plugin Website</a></li>
220
  <li><a href="http://codex.wordpress.org/Child_Themes">WordPress Codex</a></li>
221
  <li><a href="http://wordpress.stackexchange.com/">WordPress Development (StackExchange)</a></li>
222
  </ul>
3
  // Help Content
4
  ?>
5
  <!-- BEGIN tab -->
6
+ <h3 id="ctc_tutorial">Start Here: Tutorial Videos</h3>
7
+ <p><iframe width="560" height="315" src="https://www.youtube.com/embed/xL0YmieF6d0?rel=0&modestbranding=1" frameborder="0" allowfullscreen></iframe></p>
8
+ <p><iframe width="560" height="315" src="https://www.youtube.com/embed/vhQ5oi20rYE?rel=0&modestbranding=1" frameborder="0" allowfullscreen></iframe></p>
9
+ <p>Many more videos are available. <a href="<?php echo CHLD_THM_CFG_DOCS_URL; ?>/tutorial-videos" target="_blank">Click here to view videos.</a></p><!-- END tab -->
10
+ <!-- BEGIN tab -->
11
+ <h3 id="ctc_getting_started">Parent/Child Tab</h3>
12
+ <ol><li><strong>Select an action:</strong>
13
+ <ul><li><strong>CREATE a new Child Theme</strong> - Install a new customizable child theme using an installed theme as a parent.</li>
14
+ <li><strong>CONFIGURE an existing Child Theme</strong> - Set up a previously installed child theme for use with the Configurator or to modify current settings.</li>
15
+ <li><strong>DUPLICATE an existing Child Theme</strong> - Make a complete copy of an existing Child Theme in a new directory, including any menus, widgets and other Customizer settings. The option to copy the Parent Theme settings (step 8, below) is disabled with this action.</li>
16
+ <li><strong>RESET an existing Child Theme</strong> (this will destroy any work you have done in the Configurator) - Revert the Child theme stylesheet and functions files to their state before the initial configuration or last reset.</li></ul></li>
17
+ <li><strong>Select a Parent Theme</strong> if creating a new Child Theme; select a Child Theme if configuring, duplicating or resetting.</li>
18
+ <li><strong>Analyze Child Theme</strong> - Click "Analyze" to determine stylesheet dependencies and other potential issues.</li>
19
+ <li><strong>Name the new theme directory</strong> if creating a new Child Theme; otherwise verify it the directory is correct. - This is NOT the name of the Child Theme. You can customize the name, description, etc. in step 7, below.</li>
20
+ <li><strong>Select where to save new styles:</strong><ul>
21
+ <li><strong>Primary Stylesheet (style.css)</strong> - Save new custom styles directly to the Child Theme primary stylesheet, replacing the existing values. The primary stylesheet will load in the order set by the theme.</li>
22
+ <li><strong>Separate Stylesheet</strong> - Save new custom styles to a separate stylesheet and use any existing child theme styles as a baseline. Select this option if you want to preserve the original child theme styles instead of overwriting them. This option also allows you to customize stylesheets that load after the primary stylesheet.</li></ul></li>
23
+ <li><strong>Select Parent Theme stylesheet handling:</strong><ul>
24
+ <li><strong>Use the WordPress style queue.</strong> - Let the Configurator determine the appropriate actions and dependencies and update the functions file automatically.</li>
25
+ <li><strong>Use @import</strong> in the child theme stylesheet. - Only use this option if the parent stylesheet cannot be loaded using the WordPress style queue. Using @import is not recommended.</li>
26
+ <li><strong>Do not add any parent stylesheet handling.</strong> - Select this option if this theme already handles the parent theme stylesheet or if the parent theme's style.css file is not used for its appearance.</li></ul></li>
27
+ <li><strong>Customize the Child Theme Name, Description, Author, Version, etc.</strong></li>
28
+ <li><strong>Copy Parent Theme Menus, Widgets and other Customizer Settings to Child Theme.</strong> - NOTE: This will overwrite any child theme options you may have already set.</li>
29
+ <li><strong>Click the button</strong> to run the Configurator.</li>
30
+ <li><strong>IMPORTANT: <a target="_blank" href="<?php echo CHLD_THM_CFG_DOCS_URL; ?>/how-to-use/#preview_activate" title="Preview your child theme before activating!">Always test your child theme with Live Preview (theme customizer) before activating!</a></strong></li>
 
 
 
 
 
31
  </ol>
32
  <!-- END tab -->
33
  <!-- BEGIN tab -->
 
 
 
34
  <h3 id="ctc_query_selector">Query/Selector Tab</h3>
35
+ <p>There are two ways to identify and override baseline (parent) styles. The Child Theme Configurator lets you search styles by <strong>selector</strong> and by <strong>property</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 "Property/Value" tab.</p>
36
  <p>The Query/Selector tab lets you find specific selectors and edit them. First, find the query that contains the selector you wish to edit by typing in the <strong>Query</strong> autoselect box. Select by clicking with the mouse or by pressing the "Enter" or "Tab" keys. Selectors are in the <strong>base</strong> query by default.</p>
37
  <p>Next, find the selector by typing in the <strong>Selector</strong> autoselect box. Select by clicking with the mouse or by pressing the "Enter" or "Tab" keys.</p>
38
+ <p>This will load all of the properties for that selector with the Original values on the left and the New values inputs on the right. Any existing new values will be automatically populated. There is also a Sample preview that displays the combination of Parent and Child overrides. Note that the <strong>border</strong> and <strong>background-image</strong> get special treatment.</p>
39
+ <p>If you wish to add additional properties to an existing selector, first load the selector using the Query/Selector tab. Then find the property you wish to override by typing in the <strong>New Property</strong> autoselect box. Select by clicking with the mouse or by pressing the "Enter" or "Tab" keys. This will add a new input row to the selector inputs.</p>
40
  <p>The "Order" field contains the original sequence of the selector in the parent theme stylesheet. You can change the selector order sequence by entering a lower or higher number in the "Order" field. You can also force style overrides (so called "!important" flag) by checking the "!" box next to each input. Please use judiciously.</p>
41
  <p>Click "Save" to update the child stylesheet and save your changes to the WordPress admin.</p>
42
  <!-- END tab -->
43
  <!-- BEGIN tab -->
44
+ <h3 id="ctc_new_styles">Adding Raw CSS</h3>
 
45
  <p>If you wish to add completely new selectors, or even new @media queries, you can enter free-form CSS in the "Raw CSS" textarea. Be aware that your syntax must be correct (i.e., balanced curly braces, etc.) for the parser to load the new styles. You will know it is invalid because a red "X" will appear next to the save button.</p>
46
  <p>If you prefer to use shorthand syntax for properties and values instead of the inputs provided by the Child Theme Configurator, you can enter them here as well. The parser will convert your input into normalized CSS code automatically.</p>
47
+ <p>If you wish to add additional properties to an existing selector, first load the selector using the Query/Selector tab. Then find the property you wish to override by typing in the <strong>New Property</strong> autoselect box. Select by clicking with the mouse or by pressing the "Enter" or "Tab" keys. This will add a new input row to the selector inputs.</p>
48
  <!-- END tab -->
49
  <!-- BEGIN tab -->
50
  <h3 id="ctc_property_value">Property/Value Tab</h3>
51
+ <p>There are two ways to identify and override baseline (parent) styles. The Child Theme Configurator lets you search styles by <strong>selector</strong> and by <strong>property</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 "Property/Value" tab.</p>
52
  <p>The Property/Value tab lets you find specific values for a given property and then edit that value for individual selectors that use that property/value combination. First, find the property you wish to override by typing in the <strong>Property</strong> autoselect box. Select by clicking with the mouse or by pressing the "Enter" or "Tab" keys.</p>
53
  <p>This will load all of the unique values that exist for that property in the parent stylesheet with a Sample preview for that value. If there are values that exist in the child stylesheet that do not exist in the parent stylesheet, they will be displayed as well.</p>
54
+ <p>For each unique value, click the "Selectors" link to view a list of selectors that use that property/value combination, grouped by query with a Sample preview of the value and inputs for the new value. Any existing new values will be automatically populated.</p>
55
  <p>Click "Save" to update the child stylesheet and save your changes to the WordPress admin.</p>
56
  <!-- END tab -->
57
  <!-- BEGIN tab -->
85
  <!-- END tab -->
86
  <!-- BEGIN tab -->
87
  <h3 id="ctc_preview">Preview and Activate</h3>
88
+ <p><strong>IMPORTANT: <a target="_blank" href="<?php echo CHLD_THM_CFG_DOCS_URL; ?>/how-to-use/#preview_activate" title="Preview your child theme before activating!">Preview your child theme before activating!</a></strong> Some themes (particularly commercial themes) do not correctly load parent template files or automatically load child theme stylesheets or php files. <strong>In the worst cases they will break your website when you activate the child theme.</strong></p>
89
  <ol>
90
  <li>Navigate to Appearance > Themes in the WordPress Admin. You will now see the new Child Theme as one of the installed Themes.</li>
91
  <li>Click "Live Preview" below the new Child Theme to see it in action.</li>
170
  <h5 id="add_styles">How do I add styles that aren't in the Parent Theme?</h5>
171
  <p>You can add queries and selectors using the "Raw CSS" textarea on the Query/Selector tab. See Query/Selector, above. </p>
172
  <h5 id="add_styles">How do I remove a style from the Parent Theme?</h5>
173
+ <p>You shouldn't really "remove" a style from the Parent. You can, however, set the property to "inherit," "none," or zero (depending on the property). This will negate the Original value. Some experimentation may be necessary.</p>
174
  <h5 id="remove_styles">How do I remove a style from the Child Theme?</h5>
175
  <p>Delete the value from the input for the property you wish to remove. The Child Theme Configurator only adds overrides for properties that contain values. </p>
176
  <h5 id="important_flag">How do I set the !important flag?</h5>
188
  <ul>
189
  <li id="parent_theme"><strong>Parent Theme</strong> The WordPress Theme you wish to edit. WordPress first loads the Child Theme, then loads the Parent Theme. If a style exists in the Child Theme, it overrides the Parent Theme.</li>
190
  <li id="child_theme"><strong>Child Theme</strong> New Theme based on Parent Theme. You can create any number of Child Themes from a single Parent Theme.</li>
191
+ <li id="class"><strong>Class</strong> A term used to organize objects. For example, a &lt;div&gt; might be assigned the "blue-text" class. The stylesheet might then assign "color: blue;" to members of the "blue-text" class. Thus, the &lt;div&gt; would display text as blue in the browser. Class selectors begin with a period (.).</li>
192
+ <li id="class"><strong>ID</strong> A unique string used to identify a specific element. ID selectors begin with a hash (#).</li>
193
+ <li id="selector"><strong>Query</strong> @media query instruction (see At-rule, below).</li>
194
+ <li id="query"><strong>Selector</strong> Combination of html tag names, ids and classes used to identify objects or groups of objects.</li>
195
  <li id="property"><strong>Property</strong> One of many standardized terms used to tell the browser how to display objects matching a given selector. Examples are <strong>color</strong>, <strong>background-image</strong> and <strong>font-size</strong>.</li>
196
+ <li id="value"><strong>Value</strong> Data corresponding to a Property.</li>
197
  <li id="at-rule"><strong>At-rule</strong> CSS browser instruction to extend default functionality. The Child Theme Configurator supports two At-rules:
198
  <ul>
199
+ <li id="at_import"><strong>@import</strong> Instructs the browser to load additional CSS information from an external source.</li>
200
+ <li id="at_media"><strong>@media (Media Query)</strong> Identifies blocks of styles that are used only when certain browser characteristics are true. Examples are max-width, screen and print.</li>
201
  </ul>
202
  </li>
203
+ <li id="child_theme"><strong>Baseline Style</strong> A style from any existing Parent Theme or Child Theme stylesheet that can be overridden by the Child Theme custom stylesheet. Most of the time these will come from the Parent Theme's stylesheets.</li>
204
  <li id="override"><strong>Override</strong> When a selector exists in both the Child Theme and the Parent Theme, the Child Theme takes priority over the Parent theme. This is where the Child Theme Configurator stands out: it helps you create <strong>exact overrides</strong> of selectors from the Parent Theme, eliminating hours of trial and error.</li>
205
+ <li id="child_theme"><strong>Theme Template</strong> A Theme PHP file having no PHP functions or classes. Other PHP files cannot be safely overridden by a child theme.</li>
206
  </ul>
207
  <!-- END tab -->
 
208
  <!-- BEGIN sidebar -->
209
  <h4>Our plugins will not nag you for donations...</h4>
210
  <span style="font-size:smaller">...but we LOVE referrals.</span><br/><a href="http://wordpress.org/support/view/plugin-reviews/child-theme-configurator?rate=5#postform">Give Us 5 Stars</a>
211
  <h4>Introducing CTC Pro</h4>
212
+ <a href="<?php echo CHLD_THM_CFG_DOCS_URL; ?>/child-theme-configurator-pro/" title="Learn more about CTC Pro"><img src="<?php echo CHLD_THM_CFG_URL . 'css/pro-banner.jpg'; ?>" width="150" height="48" /></a>
213
  <p style="font-size:smaller">Designed by WordPress developers who use it every day, CTC Pro adds plugin stylesheets and other features to make design work quicker and easier. This is a free upgrade for users that purchased the Plugins Extension. <a href="<?php echo CHLD_THM_CFG_DOCS_URL; ?>/child-theme-configurator-pro/" title="Child Theme Configurator Pro">Learn more</a></p>
214
+ <h4 id="ctc_help_sidebar">Links</h4>
215
  <ul>
216
+ <li><a href="<?php echo LILAEAMEDIA_URL; ?>/contact/">Contact us</a></li>
217
+ <li><a href="<?php echo CHLD_THM_CFG_DOCS_URL; ?>">Plugin Website</a></li>
218
  <li><a href="http://codex.wordpress.org/Child_Themes">WordPress Codex</a></li>
219
  <li><a href="http://wordpress.stackexchange.com/">WordPress Development (StackExchange)</a></li>
220
  </ul>
js/chld-thm-cfg.js DELETED
@@ -1,1522 +0,0 @@
1
- /*!
2
- * Script: chld-thm-cfg.js
3
- * Plugin URI: http://www.childthemeconfigurator.com/
4
- * Description: Handles jQuery, AJAX and other UI
5
- * Version: 1.7.8
6
- * Author: Lilaea Media
7
- * Author URI: http://www.lilaeamedia.com/
8
- * License: GPLv2
9
- * Copyright (C) 2014-2015 Lilaea Media
10
- */
11
-
12
- // ** for muliple property values: **
13
- // make sure sequence is passed with rule/val updates
14
- // determine sequence based on sequence of value array
15
- // add sequence to input name
16
-
17
- ( function( $ ) {
18
- $.chldthmcfg = {
19
- //console.log( 'executing main function' );
20
- esc_quot: function( str ) {
21
- var self = this;
22
- return self.is_empty( str ) ? str : str.toString().replace( /"/g, '&quot;' );
23
- },
24
-
25
- getxt: function( key ){
26
- return ( text = ctcAjax[ key + '_txt' ] ) ? text : '';
27
- },
28
-
29
- from_ascii: function( str ) {
30
- var ascii = parseInt( str ),
31
- chr = String.fromCharCode( ascii )
32
- return chr;
33
- },
34
-
35
- to_ascii: function( str ) {
36
- var ascii = str.charCodeAt( 0 );
37
- return ascii;
38
- },
39
-
40
- /**
41
- * is_empty
42
- * return true if value evaluates to false, null, null string,
43
- * empty array, empty object or undefined
44
- * but NOT 0 ( zero returns false )
45
- */
46
- is_empty: function( obj ) {
47
- // first bail when definitely empty or undefined ( true ) NOTE: numeric zero returns false !
48
- if ( 'undefined' == typeof obj || false === obj || null === obj || '' === obj ) { return true; }
49
- // then, if this is bool, string or number it must not be empty ( false )
50
- if ( true === obj || "string" === typeof obj || "number" === typeof obj ) { return false; }
51
- // check for object type to be safe
52
- if ( "object" === typeof obj ) {
53
- // Use a standard for in loop
54
- for ( var x in obj ) {
55
- // A for in will iterate over members on the prototype
56
- // chain as well, but Object.getOwnPropertyNames returns
57
- // only those directly on the object, so use hasOwnProperty.
58
- if ( obj.hasOwnProperty( x ) ) {
59
- // any value means not empty ( false )
60
- return false;
61
- }
62
- }
63
- // no properties, so return empty ( true )
64
- return true;
65
- }
66
- // this must be an unsupported datatype, so return not empty
67
- return false;
68
- },
69
-
70
- /**
71
- * theme_exists
72
- * returns true if theme is already present for type
73
- */
74
- theme_exists: function( testslug, testtype ) {
75
- var exists = false;
76
- $.each( ctcAjax.themes, function( type, theme ) {
77
- $.each( theme, function( slug, data ) {
78
- if ( slug.toLowerCase() === testslug.toLowerCase() && ( 'parnt' == type || 'new' == testtype ) ) {
79
- exists = true;
80
- return false;
81
- }
82
- } );
83
- if ( exists ) return false;
84
- } );
85
- return exists;
86
- },
87
-
88
- validate: function() {
89
- var self = this,
90
- regex = /[^\w\-]/,
91
- newslug = $( '#ctc_child_template' ).length ? $( '#ctc_child_template' )
92
- .val().toString().replace( regex ) : '',
93
- slug = $( '#ctc_theme_child' ).length ? $( '#ctc_theme_child' )
94
- .val().toString().replace( regex ) : newslug,
95
- type = $( 'input[name=ctc_child_type]:checked' ).val(),
96
- errors = [];
97
- if ( 'new' == type ) slug = newslug;
98
- if ( self.theme_exists( slug, type ) ) {
99
- errors.push( self.getxt( 'theme_exists' ).toString().replace( /%s/, slug ) );
100
- }
101
- if ( '' === slug ) {
102
- errors.push( self.getxt( 'inval_theme' ) );
103
- }
104
- if ( '' === $( '#ctc_child_name' ).val() ) {
105
- errors.push( self.getxt( 'inval_name' ) );
106
- }
107
- if ( errors.length ) {
108
- self.set_notice( { 'error': errors } );
109
- return false;
110
- }
111
- return true;
112
- },
113
-
114
- autogen_slugs: function() {
115
- if ( $( '#ctc_theme_parnt' ).length ) {
116
- var self = this,
117
- parent = $( '#ctc_theme_parnt' ).val(),
118
- slug = slugbase = parent + '-child',
119
- name = ctcAjax.themes.parnt[ parent ].Name + ' Child',
120
- suffix = '',
121
- padded = '',
122
- pad = '00';
123
- while ( self.theme_exists( slug, 'new' ) ) {
124
- suffix = ( '' == suffix ? 2 : suffix + 1 );
125
- padded = pad.substring( 0, pad.length - suffix.toString().length ) + suffix.toString();
126
- slug = slugbase + padded;
127
- }
128
- self.testslug = slug;
129
- self.testname = name + ( padded.length ? ' ' + padded : '' );
130
- }
131
- },
132
-
133
- focus_panel: function( id ) {
134
- var panelid = id + '_panel';
135
- $( '.nav-tab' ).removeClass( 'nav-tab-active' );
136
- $( '.ctc-option-panel' ).removeClass( 'ctc-option-panel-active' );
137
- //$( '.ctc-selector-container' ).hide();
138
- $( id ).addClass( 'nav-tab-active' );
139
- $( '.ctc-option-panel-container' ).scrollTop( 0 );
140
- $( panelid ).addClass( 'ctc-option-panel-active' );
141
- },
142
-
143
- selector_input_toggle: function( obj ) {
144
- //console.log( 'selector_input_toggle: ' + obj );
145
- var self = this,
146
- origval;
147
- if ( $( '#ctc_rewrite_selector' ).length ) {
148
- origval = $( '#ctc_rewrite_selector_orig' ).val();
149
- $( '#ctc_sel_ovrd_selector_selected' ).text( origval );
150
- $( obj ).text( self.getxt( 'rename' ) );
151
- } else {
152
- origval = $( '#ctc_sel_ovrd_selector_selected' ).text();
153
- $( '#ctc_sel_ovrd_selector_selected' ).html(
154
- '<textarea id="ctc_rewrite_selector"'
155
- + ' name="ctc_rewrite_selector" autocomplete="off"></textarea>'
156
- + '<input id="ctc_rewrite_selector_orig" name="ctc_rewrite_selector_orig"'
157
- + ' type="hidden" value="' + self.esc_quot( origval ) + '"/>' );
158
- $( '#ctc_rewrite_selector' ).val( origval );
159
- $( obj ).text( self.getxt( 'cancel' ) );
160
- }
161
- },
162
-
163
- fade_update_notice: function() {
164
- $( '.updated, .error' ).slideUp( 'slow', function() { $( '.updated' ).remove(); } );
165
- },
166
-
167
- coalesce_inputs: function( obj ) {
168
- //**console.log( 'coalesce_inputs ' + $( obj ).attr( 'id' ) );
169
- var self = this,
170
- id = $( obj ).attr( 'id' ),
171
- regex = /^(ctc_(ovrd|\d+)_(parent|child)_([0-9a-z\-]+)_(\d+?)(_(\d+))?)(_\w+)?$/,
172
- container = $( obj ).parents( '.ctc-selector-row, .ctc-parent-row' ).first(),
173
- swatch = container.find( '.ctc-swatch' ).first(),
174
- cssrules = { 'parent': {}, 'child': {} },
175
- gradient = {
176
- 'parent': {
177
- 'origin': '',
178
- 'start': '',
179
- 'end': ''
180
- },
181
- 'child': {
182
- 'origin': '',
183
- 'start': '',
184
- 'end': ''
185
- }
186
- },
187
- has_gradient = { 'child': false, 'parent': false },
188
- postdata = {};
189
- // set up objects for all neighboring inputs
190
- container.find( '.ctc-parent-value, .ctc-child-value' ).each( function() {
191
- var inputid = $( this ).attr( 'id' ),
192
- inputparts = inputid.toString().match( regex ),
193
- inputseq = inputparts[ 2 ],
194
- inputtheme = inputparts[ 3 ],
195
- inputrule = ( 'undefined' == typeof inputparts[ 4 ] ? '' : inputparts[ 4 ] ),
196
- rulevalid = inputparts[ 7 ],
197
- qsid = inputparts[ 5 ],
198
- rulepart = ( 'undefined' == typeof inputparts[ 7 ] ? '' : inputparts[ 8 ] ),
199
- value = ( 'parent' == inputtheme ? $( this ).text().replace( /!$/, '' ) :
200
- ( 'seq' != inputrule && 'ctc_delete_query_selector' == id ? '' : $( this ).val() ) ), // clear values if delete was clicked
201
- important = ( 'seq' == inputrule ? false : 'ctc_' + inputseq + '_child_' + inputrule + '_i_' + qsid + '_' + rulevalid ),
202
- parts, subparts;
203
- //**console.log( inputparts );
204
- //**console.log( 'value: ' + value );
205
- if ( 'child' == inputtheme ) {
206
- if ( !self.is_empty( $( this ).data( 'color' ) ) ) {
207
- value = self.color_text( $( this ).data( 'color' ) );
208
- $( this ).data( 'color', null );
209
- }
210
- postdata[ inputid ] = value;
211
- if ( important )
212
- postdata[ important ] = ( $( '#' + important ).is( ':checked' ) ) ? 1 : 0;
213
- }
214
- if ( '' !== value ) {
215
- // handle specific inputs
216
- if ( !self.is_empty( rulepart ) ) {
217
- switch( rulepart ) {
218
- case '_border_width':
219
- cssrules[ inputtheme ][ inputrule + '-width' ] = ( 'none' == value ? 0 : value );
220
- break;
221
- case '_border_style':
222
- cssrules[ inputtheme ][ inputrule + '-style' ] = value;
223
- break;
224
- case '_border_color':
225
- cssrules[ inputtheme ][ inputrule + '-color' ] = value;
226
- break;
227
- case '_background_url':
228
- cssrules[ inputtheme ][ 'background-image' ] = self.image_url( inputtheme, value );
229
- break;
230
- case '_background_color':
231
- cssrules[ inputtheme ][ 'background-color' ] = value; // was obj.value ???
232
- break;
233
- case '_background_color1':
234
- gradient[ inputtheme ].start = value;
235
- has_gradient[ inputtheme ] = true;
236
- break;
237
- case '_background_color2':
238
- gradient[ inputtheme ].end = value;
239
- has_gradient[ inputtheme ] = true;
240
- break;
241
- case '_background_origin':
242
- gradient[ inputtheme ].origin = value;
243
- has_gradient[ inputtheme ] = true;
244
- break;
245
- }
246
- } else {
247
- // handle borders
248
- if ( parts = inputrule.toString().match( /^border(\-(top|right|bottom|left))?$/ ) && !value.match( /none/ ) ) {
249
- var borderregx = new RegExp( self.border_regx + self.color_regx, 'i' ),
250
- subparts = value.toString().match( borderregx );
251
- //**console.log( 'border after regex: ');
252
- //**console.log( value );
253
- //**console.log( borderregx );
254
- //**console.log( subparts );
255
- if ( !self.is_empty( subparts ) ) {
256
- subparts.shift();
257
- cssrules[ inputtheme ][ inputrule + '-width' ] = subparts.shift() || '';
258
- subparts.shift();
259
- cssrules[ inputtheme ][ inputrule + '-style' ] = subparts.shift() || '';
260
- cssrules[ inputtheme ][ inputrule + '-color' ] = subparts.shift() || '';
261
- }
262
- // handle background images
263
- } else if ( 'background-image' == inputrule && !value.match( /none/ ) ) {
264
- if ( value.toString().match( /url\(/ ) ) {
265
- cssrules[ inputtheme ][ 'background-image' ] = self.image_url( inputtheme, value );
266
- } else {
267
- var gradregex = new RegExp( self.grad_regx + self.color_regx + self.color_regx, 'i' ),
268
- subparts = value.toString().match( gradregex );
269
- //**console.log( 'background-image after regex: ');
270
- //**console.log( value );
271
- //**console.log( gradregex );
272
- //**console.log( subparts );
273
- if ( !self.is_empty( subparts ) && subparts.length > 2 ) {
274
- subparts.shift();
275
- gradient[ inputtheme ].origin = subparts.shift() || 'top';
276
- gradient[ inputtheme ].start = subparts.shift() || 'transparent';
277
- gradient[ inputtheme ].end = subparts.shift() || 'transparent';
278
- has_gradient[ inputtheme ] = true;
279
- } else {
280
- cssrules[ inputtheme ][ 'background-image' ] = value;
281
- }
282
- }
283
- } else if ( 'seq' != inputrule ) {
284
- cssrules[ inputtheme ][ inputrule ] = value;
285
- }
286
- }
287
- }
288
- } );
289
- // update swatch
290
- if ( 'undefined' != typeof swatch && !self.is_empty( swatch.attr( 'id' ) ) ) {
291
- swatch.removeAttr( 'style' );
292
- if ( has_gradient.parent ) {
293
- swatch.ctcgrad( gradient.parent.origin, [ gradient.parent.start, gradient.parent.end ] );
294
- }
295
- //**console.log( 'combined css rules' );
296
- //**console.log( cssrules );
297
- swatch.css( cssrules.parent );
298
- if ( !( swatch.attr( 'id' ).toString().match( /parent/ ) ) ) {
299
- if ( has_gradient.child ) {
300
- swatch.ctcgrad( gradient.child.origin, [ gradient.child.start, gradient.child.end ] );
301
- }
302
- //console.log( cssrules.child );
303
- swatch.css( cssrules.child );
304
- }
305
- swatch.css( {'z-index':-1} );
306
- }
307
- return postdata;
308
- },
309
-
310
- decode_value: function( rule, value ) {
311
- //**console.log( 'in decode_value ( ' + rule + ' ...' );
312
- value = ( 'undefined' == typeof value ? '' : value );
313
- var self = this,
314
- obj = {
315
- 'orig': value,
316
- 'names': [ '' ],
317
- 'values': [ value ]
318
- };
319
- if ( rule.toString().match( /^border(\-(top|right|bottom|left))?$/ ) ) {
320
- var regex = new RegExp( self.border_regx + '(' + self.color_regx + ')?', 'i' ),
321
- params = value.toString().match( regex );
322
- if ( self.is_empty( params ) ) params = [];
323
- obj.names = [
324
- '_border_width',
325
- '_border_style',
326
- '_border_color',
327
- ];
328
- orig = params.shift();
329
- //**console.log( value );
330
- //**console.log( regex );
331
- //**console.log( params );
332
- obj.values[ 0 ] = params.shift() || '';
333
- params.shift();
334
- obj.values[ 1 ] = params.shift() || '';
335
- params.shift();
336
- obj.values[ 2 ] = params.shift() || '';
337
- } else if ( rule.toString().match( /^background\-image/ ) ) {
338
- obj.names = [
339
- '_background_url',
340
- '_background_origin',
341
- '_background_color1',
342
- '_background_color2'
343
- ];
344
- obj.values = [ '', '', '', '' ];
345
- if ( !self.is_empty( value ) && !( value.toString().match( /(url|none)/ ) ) ) {
346
- var params = value.toString().split( /:/ ),
347
- stop1, stop2;
348
- //**console.log( value );
349
- //**console.log( params );
350
- obj.values[ 1 ] = params.shift() || '';
351
- obj.values[ 2 ] = params.shift() || '';
352
- stop1 = params.shift() || '';
353
- obj.values[ 3 ] = params.shift() || '';
354
- stop2 = params.shift() || '';
355
- obj.orig = [
356
- obj.values[ 1 ],
357
- obj.values[ 2 ],
358
- obj.values[ 3 ]
359
- ].join( ' ' );
360
- } else {
361
- obj.values[ 0 ] = value;
362
- }
363
- }
364
- //**console.log( obj );
365
- return obj;
366
- },
367
-
368
- image_url: function( theme, value ) {
369
- var self = this,
370
- parts = value.toString().match( /url\(['" ]*(.+?)['" ]*\)/ ),
371
- path = self.is_empty( parts ) ? null : parts[ 1 ],
372
- url = ctcAjax.theme_uri + '/' + ( 'parent' == theme ? ctcAjax.parnt : ctcAjax.child ) + '/',
373
- image_url;
374
- if ( !path ) {
375
- return false;
376
- } else if ( path.toString().match( /^(data:|https?:|\/)/ ) ) {
377
- image_url = value;
378
- } else {
379
- image_url = 'url(' + url + path + ')';
380
- }
381
- return image_url;
382
- },
383
-
384
- setup_menus: function() {
385
- var self = this;
386
- //console.log( 'setup_menus' );
387
- self.setup_query_menu();
388
- self.setup_selector_menu();
389
- self.setup_rule_menu();
390
- self.setup_new_rule_menu();
391
- self.load_queries();
392
- self.load_rules();
393
- // selectors will be loaded after query selected
394
- self.set_query( self.current_query );
395
- },
396
-
397
- load_queries: function() {
398
- var self = this;
399
- //console.log( 'load_queries' );
400
- // retrieve unique media queries
401
- self.query_css( 'queries', null );
402
- },
403
-
404
- load_selectors: function() {
405
- var self = this;
406
- //console.log( 'load_selectors' );
407
- // retrieve unique selectors from query value
408
- self.query_css( 'selectors', self.current_query );
409
- },
410
-
411
- load_rules: function() {
412
- var self = this;
413
- //console.log( 'load_rules' );
414
- // retrieve all unique rules
415
- self.query_css( 'rules', null );
416
- },
417
-
418
- load_selector_values: function() {
419
- var self = this;
420
- //console.log( 'load_selector_values: ' + self.current_qsid );
421
- // retrieve individual values from qsid
422
- self.query_css( 'qsid', self.current_qsid );
423
- },
424
-
425
- get_queries: function( request, response ) {
426
- //console.log( 'get_queries' );
427
- //console.log( this );
428
- var arr = [],
429
- matcher = new RegExp( $.ui.autocomplete.escapeRegex( request.term ), "i" );
430
-
431
- // note: key = ndx, value = query name
432
- $.each( this.element.data( 'menu' ), function( key, val ) {
433
- if ( matcher.test( val ) ) {
434
- arr.push( { 'label': val, 'value': val } );
435
- }
436
- } );
437
-
438
- response( arr );
439
- },
440
-
441
- get_selectors: function( request, response ) {
442
- //console.log( 'get_selectors' );
443
- var arr = [],
444
- matcher = new RegExp( $.ui.autocomplete.escapeRegex( request.term ), "i" );
445
- // note: key = selector name, value = qsid
446
- $.each( this.element.data( 'menu' ), function( key, val ) {
447
- if ( matcher.test( key ) ) {
448
- arr.push( { 'label': key, 'value': val } );
449
- }
450
- } );
451
- response( arr );
452
- },
453
-
454
- get_rules: function( request, response ) {
455
- //console.log( 'get_rules' );
456
- var arr = [],
457
- matcher = new RegExp( $.ui.autocomplete.escapeRegex( request.term ), "i" );
458
- // note: key = ruleid, value = rule name
459
- $.each( this.element.data( 'menu' ), function( key, val ) {
460
- if ( matcher.test( key ) ) {
461
- arr.push( { 'label': key, 'value': val } );
462
- }
463
- } );
464
- response( arr );
465
- },
466
-
467
- get_filtered_rules: function( request, response ) {
468
- //console.log( 'get_filtered_rules' );
469
- var arr = [],
470
- matcher = new RegExp( $.ui.autocomplete.escapeRegex( request.term ), "i" ); //,
471
- $.each( $( '#ctc_rule_menu' ).data( 'menu' ), function( key, val ) {
472
- //multiple versions of rule ok
473
- if ( matcher.test( key ) ) {
474
- arr.push( { 'label': key, 'value': val } );
475
- }
476
- } );
477
- response( arr );
478
- },
479
-
480
- /**
481
- * parent and child values are stored in separate arrays
482
- * this function puts them into parent/child columns by rulevalid
483
- */
484
- merge_ruleval_arrays: function( rule, value, isnew ) {
485
- //**console.log( 'merge_ruleval_arrays' );
486
- var self = this,
487
- valarr = {};
488
- nextval = isnew ? value.child.pop() : null; // if new rule, pop off the top before counting
489
- //**console.log( value );
490
- $.each( [ 'parnt', 'child' ], function( ndx, template ) {
491
- // iterate through parent and child val arrays and populate new assoc array with parent/child for each rulevalid
492
- if ( !self.is_empty( value[ template ] ) ) {
493
- $.each( value[ template ], function( ndx2, val ) {
494
- if ( isnew ) {
495
- // if new rule, increment new rulevalid but do not add to parent/child assoc array
496
- if ( parseInt( val[ 2 ] ) >= parseInt( nextval[ 2 ] ) ) nextval[ 2 ] = parseInt( val[ 2 ] ) + 1;
497
- } else {
498
- // add to parent/child assoc array with rulevalid as key
499
- if ( self.is_empty( valarr[ val[ 2 ] ] ) ) valarr[ val[ 2 ] ] = {};
500
- valarr[ val[ 2 ] ][ template ] = val;
501
- }
502
- } );
503
- }
504
- } );
505
- // if new rule, create new parent child assoc array element with new rulevalid as key
506
- if ( isnew ) {
507
- valarr[ nextval[ 2 ] ] = {
508
- parnt: [],
509
- child: nextval
510
- };
511
- }
512
- return valarr;
513
- },
514
-
515
- /**
516
- * input_row
517
- * render individual row of inputs for a given selector/rule combination
518
- * qsid query/selector id
519
- * rule css property
520
- * seq panel id from rule/value tab
521
- * data contains all rules/values for selector
522
- * isnew is passed true when new rule is selected from menu
523
- */
524
- input_row: function( qsid, rule, seq, data, isnew ) {
525
- //console.log( 'in input_row' );
526
- var self = this,
527
- html = '';
528
- if ( !self.is_empty( data ) && !self.is_empty( data.value ) && !self.is_empty( data.value[ rule ] ) ) {
529
- var value = data.value[ rule ],
530
- valarr = self.merge_ruleval_arrays( rule, value, isnew );
531
- $.each( valarr, function( ndx, val ) {
532
- var pval = self.decode_value( rule, self.is_empty( val.parnt ) ? '' : val.parnt[ 0 ] ),
533
- pimp = self.is_empty( val.parnt ) || 0 == val.parnt[ 1 ] ? 0 : 1,
534
- cval = self.decode_value( rule, self.is_empty( val.child ) ? '' : val.child[ 0 ] ),
535
- cimp = self.is_empty( val.child ) || 0 == val.child[ 1 ] ? 0 : 1;
536
- html += '<div class="ctc-' + ( 'ovrd' == seq ? 'input' : 'selector' ) + '-row clearfix"><div class="ctc-input-cell">';
537
- if ( 'ovrd' == seq ) {
538
- html += rule.replace( /\d+/g, self.from_ascii );
539
- } else {
540
- html += data.selector + '<br/><a href="#" class="ctc-selector-edit"'
541
- + ' id="ctc_selector_edit_' + qsid + '" >' + self.getxt( 'edit' ) + '</a> '
542
- + ( self.is_empty( pval.orig ) ? self.getxt( 'child_only' ) : '' );
543
- }
544
- html += '</div><div class="ctc-parent-value ctc-input-cell"' + ( 'ovrd' != seq ? ' style="display:none"' : '' )
545
- + ' id="ctc_' + seq + '_parent_' + rule + '_' + qsid + '_' + ndx + '">'
546
- + ( self.is_empty( pval.orig ) ? '[no value]' : pval.orig + ( pimp ? self.getxt( 'important' ) : '' ) )
547
- + '</div><div class="ctc-input-cell">';
548
- if ( !self.is_empty( pval.names ) ) {
549
- $.each( pval.names, function( namendx, newname ) {
550
- newname = ( self.is_empty( newname ) ? '' : newname );
551
- html += '<div class="ctc-child-input-cell clear">';
552
- var id = 'ctc_' + seq + '_child_' + rule + '_' + qsid + '_' + ndx + newname,
553
- newval;
554
- if ( false === ( newval = cval.values.shift() ) ) {
555
- newval = '';
556
- }
557
-
558
- html += ( self.is_empty( newname ) ? '' : self.getxt( newname ) + ':<br/>' )
559
- + '<input type="text" id="' + id + '" name="' + id + '" class="ctc-child-value'
560
- + ( ( newname + rule ).toString().match( /color/ ) ? ' color-picker' : '' )
561
- + ( ( newname ).toString().match( /url/ ) ? ' ctc-input-wide' : '' )
562
- + '" value="' + self.esc_quot( newval ) + '" /></div>';
563
- } );
564
- var impid = 'ctc_' + seq + '_child_' + rule + '_i_' + qsid + '_' + ndx;
565
- html += '<label for="' + impid + '"><input type="checkbox"'
566
- + ' id="' + impid + '" name="' + impid + '" value="1" '
567
- + ( cimp ? 'checked' : '' ) + ' />'
568
- + self.getxt( 'important' ) + '</label>';
569
- }
570
- html += '</div>';
571
- if ( 'ovrd' != seq ) {
572
- html += '<div class="ctc-swatch ctc-specific"'
573
- + ' id="ctc_child_' + rule + '_' + qsid + '_' + ndx + '_swatch">'
574
- + self.getxt( 'swatch' ) + '</div>'
575
- + '<div class="ctc-child-input-cell ctc-button-cell"'
576
- + ' id="ctc_save_' + rule + '_' + qsid + '_' + ndx + '_cell">'
577
- + '<input type="button" class="button ctc-save-input"'
578
- + ' id="ctc_save_' + rule + '_' + qsid + '_' + ndx + '"'
579
- + ' name="ctc_save_' + rule + '_' + qsid + '_' + ndx + '"'
580
- + ' value="Save" /></div>';
581
- }
582
- html += '</div><!-- end input row -->' + "\n";
583
- } );
584
- }
585
- return html;
586
- },
587
-
588
- scrolltop: function() {
589
- $('html, body, .ctc-option-panel-container').animate( { scrollTop: 0 } );
590
- },
591
-
592
- css_preview: function( theme ) {
593
- var self = this,
594
- theme;
595
- //console.log( 'css_preview: ' + theme );
596
- if ( !( theme = theme.match( /(child|parnt)/ )[ 1 ] ) ) {
597
- theme = 'child';
598
- }
599
- // retrieve raw stylesheet ( parent or child )
600
- self.query_css( 'preview', theme );
601
- },
602
-
603
- /**
604
- * The "setup" functions initialize jQuery UI widgets
605
- */
606
- setup_iris: function( obj ) {
607
- // deprecated: using spectrum for alpha support
608
- var self = this;
609
- self.setup_spectrum( obj );
610
- },
611
-
612
- setup_spectrum: function( obj ) {
613
- var self = this,
614
- colortxt = $( obj ).attr( 'id' ) + '_colortxt',
615
- palette = !self.is_empty( ctcAjax.palette );
616
- try {
617
- $( obj ).spectrum( {
618
- showInput: true,
619
- allowEmpty: true,
620
- showAlpha: true,
621
- showInitial: true,
622
- preferredFormat: "hex", // 'name', //
623
- clickoutFiresChange: true,
624
- move: function( color ) {
625
- $( obj ).data( 'color', color );
626
- self.coalesce_inputs( obj );
627
- },
628
- showPalette: palette ? true : false,
629
- showSelectionPalette: palette ? true : false,
630
- palette: [ ],
631
- maxSelectionSize: 36,
632
- localStorageKey: "ctc-palette." + ctcAjax.child,
633
- hideAfterPaletteSelect: true,
634
- } ).on( 'change', function( e ){
635
- var color = $( this ).spectrum( 'get' );
636
- //console.log( 'color change: ' + color );
637
- self.coalesce_inputs( this );
638
- } ).on( 'keyup', function( e ) {
639
- // update spectrum ui to match text input after half-second delay
640
- var $this = this,
641
- $val = $( this ).val();
642
- clearTimeout( $( this ).data( 'spectrumTimer' ) );
643
- $( this ).data( 'spectrumTimer', setTimeout(
644
- function() {
645
- self.coalesce_inputs( $this );
646
- $( $this ).spectrum( 'set', $val );
647
-
648
- },
649
- 500
650
- ) );
651
- } );
652
-
653
- } catch ( exn ) {
654
- self.jquery_exception( exn, 'Spectrum Color Picker' );
655
- }
656
- },
657
-
658
- color_text: function( color ) {
659
- var self = this;
660
- if ( self.is_empty( color ) ) {
661
- return '';
662
- } else if ( color.getAlpha() < 1 ) {
663
- return color.toRgbString();
664
- } else {
665
- return color.toHexString();
666
- }
667
- },
668
-
669
- setup_query_menu: function() {
670
- var self = this;
671
- //console.log( 'setup_query_menu' );
672
- try {
673
- $( '#ctc_sel_ovrd_query' ).autocomplete( {
674
- source: self.get_queries,
675
- minLength: 0,
676
- selectFirst: true,
677
- autoFocus: true,
678
- select: function( e, ui ) {
679
- self.set_query( ui.item.value );
680
- return false;
681
- },
682
- focus: function( e ) {
683
- e.preventDefault();
684
- }
685
- } ).data( 'menu' , {} );
686
- } catch ( exn ) {
687
- self.jquery_exception( exn, 'Query Menu' );
688
- }
689
- },
690
-
691
- setup_selector_menu: function() {
692
- var self = this;
693
- //console.log( 'setup_selector_menu' );
694
- try {
695
- $( '#ctc_sel_ovrd_selector' ).autocomplete( {
696
- source: self.get_selectors,
697
- selectFirst: true,
698
- autoFocus: true,
699
- select: function( e, ui ) {
700
- self.set_selector( ui.item.value, ui.item.label );
701
- return false;
702
- },
703
- focus: function( e ) {
704
- e.preventDefault();
705
- }
706
- } ).data( 'menu' , {} );
707
- } catch ( exn ) {
708
- self.jquery_exception( exn, 'Selector Menu' );
709
- }
710
- },
711
-
712
- setup_rule_menu: function() {
713
- var self = this;
714
- //console.log( 'setup_rule_menu' );
715
- try {
716
- $( '#ctc_rule_menu' ).autocomplete( {
717
- source: self.get_rules,
718
- //minLength: 0,
719
- selectFirst: true,
720
- autoFocus: true,
721
- select: function( e, ui ) {
722
- self.set_rule( ui.item.value, ui.item.label );
723
- return false;
724
- },
725
- focus: function( e ) {
726
- e.preventDefault();
727
- }
728
- } ).data( 'menu' , {} );
729
- } catch ( exn ) {
730
- self.jquery_exception( exn, 'Property Menu' );
731
- }
732
- },
733
-
734
- setup_new_rule_menu: function() {
735
- var self = this;
736
- try {
737
- $( '#ctc_new_rule_menu' ).autocomplete( {
738
- source: self.get_filtered_rules,
739
- //minLength: 0,
740
- selectFirst: true,
741
- autoFocus: true,
742
- select: function( e, ui ) {
743
- //console.log( 'new rule selected' );
744
- e.preventDefault();
745
- var newrule = ui.item.label.replace( /[^\w\-]/g, self.to_ascii ),
746
- n = 1,
747
- row,
748
- first;
749
- //console.log( 'current qsdata before:' );
750
- //console.log( self.current_qsdata );
751
- if ( self.is_empty( self.current_qsdata.value ) ) {
752
- self.current_qsdata.value = {};
753
- }
754
- if ( self.is_empty( self.current_qsdata.value[ ui.item.label ] ) ) {
755
- self.current_qsdata.value[ ui.item.label ] = {};
756
- }
757
- if ( self.is_empty( self.current_qsdata.value[ ui.item.label ].child ) ) {
758
- self.current_qsdata.value[ ui.item.label ].child = [];
759
- }
760
- //console.log( 'current qsdata after:' );
761
- //console.log( self.current_qsdata );
762
- // seed current qsdata with new blank value with id 1
763
- // this will be modified during input_row function to be next id in order
764
- self.current_qsdata.value[ ui.item.label ].child.push( [ '', 0, 1, 1 ] );
765
- row = $( self.input_row( self.current_qsid, newrule, 'ovrd', self.current_qsdata, true ) );
766
- $( '#ctc_sel_ovrd_rule_inputs' ).append( row );
767
- $( '#ctc_new_rule_menu' ).val( '' );
768
-
769
- row.find( 'input[type="text"]' ).each( function( ndx, el ) {
770
- if (! first) first = el;
771
- if ( $( el ).hasClass( 'color-picker' ) )
772
- self.setup_spectrum( el );
773
- } );
774
- if ( first )
775
- $( first ).focus();
776
- if ( self.jquery_err.length )
777
- self.jquery_notice( 'setup_new_rule_menu' );
778
- return false;
779
- },
780
- focus: function( e ) {
781
- e.preventDefault();
782
- }
783
- } ).data( 'menu' , {} );
784
- } catch ( exn ) {
785
- self.jquery_exception( exn, 'New Property Menu' );
786
- }
787
- },
788
-
789
- set_existing: function() {
790
- var self = this;
791
- if ( $( '#ctc_theme_child' ).length && $( '#ctc_child_type_existing' ).is( ':checked' ) ) {
792
- var child = $( '#ctc_theme_child' ).val();
793
- if ( !self.is_empty( child ) ) {
794
- $( '#ctc_child_name' ).val( ctcAjax.themes.child[ child ].Name );
795
- $( '#ctc_child_author' ).val( ctcAjax.themes.child[ child ].Author );
796
- $( '#ctc_child_version' ).val( ctcAjax.themes.child[ child ].Version );
797
- $( '#ctc_child_authoruri' ).val( ctcAjax.themes.child[ child ].AuthorURI );
798
- $( '#ctc_child_themeuri' ).val( ctcAjax.themes.child[ child ].ThemeURI );
799
- $( '#ctc_child_descr' ).val( ctcAjax.themes.child[ child ].Descr );
800
- $( '#ctc_child_tags' ).val( ctcAjax.themes.child[ child ].Tags );
801
- $( '#ctc_duplicate_theme' ).prop( 'checked', false );
802
- $( '#ctc_duplicate_theme_slug' ).val( '' );
803
- $( '#input_row_duplicate_theme' ).show();
804
- }
805
- }
806
- },
807
-
808
- set_notice: function( noticearr ) {
809
- var self = this,
810
- errorHtml = '';
811
- if ( !self.is_empty( noticearr ) ) {
812
- $.each( noticearr, function( type, list ) {
813
- errorHtml += '<div class="' + type + '"><ul>' + "\n";
814
- $( list ).each( function( ndx, el ) {
815
- errorHtml += '<li>' + el.toString() + '</li>' + "\n";
816
- } );
817
- errorHtml += '</ul></div>';
818
- } );
819
- }
820
- $( '#ctc_error_notice' ).html( errorHtml );
821
- $( 'html, body' ).animate( { scrollTop: 0 }, 'slow' );
822
- },
823
-
824
- set_parent_menu: function( obj ) {
825
- $( '#ctc_theme_parnt' ).parents( '.ctc-input-row' ).first()
826
- .append( '<span class="ctc-status-icon spinner"></span>' );
827
- $( '.spinner' ).show();
828
- document.location='?page=' + ctcAjax.page + '&ctc_parent=' + obj.value;
829
- },
830
-
831
- set_child_menu: function( obj ) {
832
- var self = this,
833
- template,
834
- parent;
835
- if ( !self.is_empty( ctcAjax.themes.child[ obj.value ] ) ) {
836
- template = ctcAjax.themes.child[ obj.value ].Template,
837
- parent = $( '#ctc_theme_parnt' ).val();
838
- //console.log( 'template: ' + template + ' parent: ' + parent );
839
- if ( template == parent ) {
840
- $( '#ctc_child_name' ).val( ctcAjax.themes.child[ obj.value ].Name );
841
- $( '#ctc_child_author' ).val( ctcAjax.themes.child[ obj.value ].Author );
842
- $( '#ctc_child_version' ).val( ctcAjax.themes.child[ obj.value ].Version );
843
- } else {
844
- $( '#ctc_theme_child' ).parents( '.ctc-input-row' ).first()
845
- .append( '<span class="ctc-status-icon spinner"></span>' );
846
- $( '.spinner' ).show();
847
- document.location='?page=' + ctcAjax.page + '&ctc_parent=' + template + '&ctc_child=' + obj.value;
848
- }
849
- }
850
- },
851
-
852
- set_query: function( value ) {
853
- var self = this;
854
- if ( self.is_empty( value ) ) return false;
855
- //console.log( 'set_query: ' + value );
856
- self.current_query = value;
857
- $( '#ctc_sel_ovrd_query' ).val( '' );
858
- $( '#ctc_sel_ovrd_query_selected' ).text( value );
859
- $( '#ctc_sel_ovrd_selector' ).val( '' );
860
- $( '#ctc_sel_ovrd_selector_selected' ).html( '&nbsp;' );
861
- //$( '#ctc_sel_ovrd_rule_inputs' ).html( '' );
862
- self.load_selectors();
863
- self.scrolltop();
864
- },
865
-
866
- set_selector: function( value, label ) {
867
- var self = this;
868
- if ( self.is_empty( value ) ) return false;
869
- //console.log( 'set_selector: ' + value + ' label: ' + label );
870
- $( '#ctc_sel_ovrd_selector' ).val( '' );
871
- self.current_qsid = value;
872
- self.reload_menus = false;
873
- self.load_selector_values();
874
- self.scrolltop();
875
- },
876
-
877
- set_rule: function( value, label ) {
878
- //console.log( 'set_rule: ' + value + ' label: ' + label );
879
- var self = this;
880
- if ( self.is_empty( value ) ) return false;
881
- $( '#ctc_rule_menu' ).val( '' );
882
- $( '#ctc_rule_menu_selected' ).text( label );
883
- $( '.ctc-rewrite-toggle' ).text( self.getxt( 'rename' ) );
884
- $( '#ctc_rule_value_inputs, #ctc_input_row_rule_header' ).show();
885
- // retrieve unique values by rule
886
- self.query_css( 'rule_val', value );
887
- self.scrolltop();
888
- },
889
-
890
- set_qsid: function( obj ) {
891
- var self = this;
892
- //console.log( 'set_qsid: ' + $( obj ).attr( 'id' ) );
893
- self.current_qsid = $( obj ).attr( 'id' ).match( /_(\d+)$/ )[ 1 ];
894
- self.focus_panel( '#query_selector_options' );
895
- self.reload_menus = true;
896
- self.load_selector_values();
897
- },
898
-
899
- /**
900
- * slurp website home page and parse header for linked stylesheets
901
- * set these to be parsed as "default" stylesheets
902
- */
903
- set_addl_css: function() {
904
- //console.log( 'set_addl_css' );
905
- var self = this,
906
- template = $( '#ctc_theme_parnt' ).val(),
907
- theme_uri = ctcAjax.theme_uri.replace( /^https?:\/\//, '' ),
908
- homeurl = ctcAjax.homeurl.replace( /^https?/, ctcAjax.ssl ? 'https' : 'http' ),
909
- url = homeurl + '?preview=1&p=x&template=' + template + '&stylesheet=' + template,
910
- regex = new RegExp( "<link rel=[\"']stylesheet[\"'][^>]+?"
911
- + theme_uri + '/' + template + '/(.+?\\.css)[^>]+?>', 'g' ),
912
- additional;
913
- if ( self.is_empty( template ) ) return;
914
- //console.log( template );
915
- if ( template != ctcAjax.parnt ) {
916
- $.get( url, function( data ) {
917
- //console.log( data );
918
- while ( additional = regex.exec( data ) ) {
919
- //console.log( additional );
920
- if ( 'style.css' == additional[ 1 ] ) break; // bail after main stylesheet
921
- if ( additional[ 1 ].match( /bootstrap/ ) ) continue; // don't autoselect Bootstrap stylesheets
922
- $( '.ctc_checkbox' ).each( function( ndx, el ) {
923
- if ( $( this ).val() == additional[ 1 ] ) $( this ).prop( 'checked', true );
924
- } );
925
- }
926
- data = null; // send page to garbage
927
- } );
928
- } else {
929
- //console.log('existing... using addl_css array');
930
- $( ctcAjax.addl_css ).each( function( ndx, el ) {
931
- $( '#ctc_stylesheet_files .ctc_checkbox' ).each( function( index, elem ) {
932
- if ( $( this ).val() == el ) $( this ).prop( 'checked', true );
933
- } );
934
- } );
935
- }
936
- },
937
-
938
- /**
939
- * Retrieve data from server and execute callback on completion
940
- */
941
- query_css: function( obj, key, params ) {
942
- //console.log( 'query_css: ' + obj + ' key: ' + key );
943
- var self = this,
944
- postdata = { 'ctc_query_obj' : obj, 'ctc_query_key': key },
945
- status_sel = '#ctc_status_' + obj + ( 'val_qry' == obj ? '_' + key : '' );
946
-
947
- if ( 'object' === typeof params ) {
948
- $.each( params, function( key, val ) {
949
- postdata[ 'ctc_query_' + key ] = val;
950
- } );
951
- }
952
- $( '.query-icon,.ctc-status-icon' ).remove();
953
- //console.log( status_sel + ' ' + $( status_sel ).length );
954
- $( status_sel + ' .ctc-status-icon' ).remove();
955
- $( status_sel ).append( '<span class="ctc-status-icon spinner query-icon"></span>' );
956
- $( '.spinner' ).show();
957
- // add wp ajax action to array
958
- //console.log( $( '#ctc_action' ).val() );
959
- postdata[ 'action' ] = ( !self.is_empty( $( '#ctc_action' ).val() )
960
- && 'plugin' == $( '#ctc_action' ).val() ) ?
961
- 'ctc_plgqry' : 'ctc_query';
962
- postdata[ '_wpnonce' ] = $( '#_wpnonce' ).val();
963
- // ajax post input data
964
- //console.log( 'query_css postdata:' );
965
- //console.log( postdata );
966
- self.ajax_post( obj, postdata );
967
- },
968
- /**
969
- * Post data to server for saving and execute callback on completion
970
- */
971
- save: function( obj ) {
972
- //console.log( 'save: ' + $( obj ).attr( 'id' ) );
973
- var self = this,
974
- url = ctcAjax.ajaxurl, // get ajax url from localized object
975
- postdata = {},
976
- $selector, $query, $imports, $rule,
977
- id = $( obj ).attr( 'id' ), newsel, origsel;
978
-
979
- // disable the button until ajax returns
980
- $( obj ).prop( 'disabled', true );
981
- // clear previous success/fail icons
982
- $( '.ctc-query-icon,.ctc-status-icon' ).remove();
983
- // show spinner
984
- $( obj ).parent( '.ctc-textarea-button-cell, .ctc-button-cell' )
985
- .append( '<span class="ctc-status-icon spinner save-icon"></span>' );
986
- if ( id.match( /ctc_configtype/ ) ) {
987
- $( obj ).parents( '.ctc-input-row' ).first()
988
- .append( '<span class="ctc-status-icon spinner save-icon"></span>' );
989
- postdata[ 'ctc_configtype' ] = $( obj ).val();
990
- } else if ( ( $selector = $( '#ctc_new_selectors' ) )
991
- && 'ctc_save_new_selectors' == $( obj ).attr( 'id' ) ) {
992
- postdata[ 'ctc_new_selectors' ] = $selector.val();
993
- if ( $query = $( '#ctc_sel_ovrd_query_selected' ) ) {
994
- postdata[ 'ctc_sel_ovrd_query' ] = $query.text();
995
- }
996
- self.reload_menus = true;
997
- } else if ( ( $imports = $( '#ctc_child_imports' ) )
998
- && 'ctc_save_imports' == id ) {
999
- postdata[ 'ctc_child_imports' ] = $imports.val();
1000
- } else if ( 'ctc_is_debug' == id ) {
1001
- postdata[ 'ctc_is_debug' ] = $( '#ctc_is_debug' ).is( ':checked' ) ? 1 : 0;
1002
- } else {
1003
- // coalesce inputs
1004
- postdata = self.coalesce_inputs( obj );
1005
- }
1006
- $( '.save-icon' ).show();
1007
- // add rename selector value if it exists
1008
- $( '#ctc_sel_ovrd_selector_selected' )
1009
- .find( '#ctc_rewrite_selector' ).each( function() {
1010
- newsel = $( '#ctc_rewrite_selector' ).val();
1011
- origsel = $( '#ctc_rewrite_selector_orig' ).val();
1012
- if ( self.is_empty( newsel ) || !newsel.toString().match( /\w/ ) ) {
1013
- newsel = origsel;
1014
- } else {
1015
- postdata[ 'ctc_rewrite_selector' ] = newsel;
1016
- self.reload_menus = true;
1017
- }
1018
- $( '.ctc-rewrite-toggle' ).text( self.getxt( 'rename' ) );
1019
- $( '#ctc_sel_ovrd_selector_selected' ).html( newsel );
1020
- } );
1021
- // add wp ajax action to array
1022
- //console.log( $( '#ctc_action' ).val() );
1023
- postdata[ 'action' ] = ( !self.is_empty( $( '#ctc_action' ).val() )
1024
- && 'plugin' == $( '#ctc_action' ).val() ) ?
1025
- 'ctc_plugin' : 'ctc_update';
1026
- postdata[ '_wpnonce' ] = $( '#_wpnonce' ).val();
1027
- //console.log( postdata );
1028
- // ajax post input data
1029
- self.ajax_post( 'qsid', postdata );
1030
- },
1031
-
1032
- ajax_post: function( obj, data, datatype ) {
1033
- var self = this,
1034
- url = ctcAjax.ajaxurl;
1035
- //console.log( 'ajax_post: ' + obj );
1036
- //console.log( data );
1037
- // get ajax url from localized object
1038
- $.ajax( {
1039
- url: url,
1040
- data: data,
1041
- dataType: ( self.is_empty( datatype ) ? 'json' : datatype ),
1042
- // 'ctc_update' == data.action && // 'rule_val' == obj ? 'text' : // 'qsid' == obj ? 'text' :
1043
- // 'ctc_update' == data.action && 'qsid' == obj ? 'text' :
1044
- type: 'POST'
1045
- } ).done( function( response ) {
1046
- //console.log( response );
1047
- self.handle_success( obj, response );
1048
- } ).fail( function() {
1049
- self.handle_failure( obj );
1050
- } );
1051
- },
1052
-
1053
- handle_failure: function( obj ) {
1054
- var self = this;
1055
- //console.log( 'handle_failure: ' + obj );
1056
- $( '.query-icon, .save-icon' ).removeClass( 'spinner' ).addClass( 'failure' );
1057
- $( 'input[type=submit], input[type=button], input[type=checkbox],.ctc-delete-input' ).prop( 'disabled', false );
1058
- $( '.ajax-pending' ).removeClass( 'ajax-pending' );
1059
- //FIXME: return fail text in ajax response
1060
- if ( 'preview' == obj )
1061
- $( '#view_parnt_options_panel,#view_child_options_panel' )
1062
- .text( self.getxt( 'css_fail' ) );
1063
- },
1064
-
1065
- handle_success: function( obj, response ) {
1066
- var self = this;
1067
- // query response
1068
- //console.log( 'handle_success: ' + obj );
1069
- //console.log( response );
1070
- // hide spinner
1071
- $( '.query-icon, .save-icon' ).removeClass( 'spinner' );
1072
- $( '.ajax-pending' ).removeClass( 'ajax-pending' );
1073
- // hide spinner
1074
- if ( self.is_empty( response ) ) {
1075
- self.handle_failure( obj );
1076
- } else {
1077
- $( '#ctc_new_selectors' ).val( '' );
1078
- // update data objects
1079
- // show check mark
1080
- // FIXME: distinction between save and query, update specific status icon
1081
- $( '.query-icon, .save-icon' ).addClass( 'success' );
1082
- $( 'input[type=submit], input[type=button], input[type=checkbox],.ctc-delete-input' ).prop( 'disabled', false );
1083
- // update ui from each response object
1084
- $( response ).each( function() {
1085
- if ( 'function' == typeof self.update[ this.obj ] ) {
1086
- //console.log( 'executing method update.' + this.obj );
1087
- self.update[ this.obj ].call( self, this );
1088
- } else {
1089
- //console.log( 'Fail: no method update.' + this.obj );
1090
- }
1091
- } );
1092
- }
1093
- },
1094
-
1095
- jquery_exception: function( exn, type ) {
1096
- var self = this,
1097
- ln = self.is_empty( exn.lineNumber ) ? '' : ' line: ' + exn.lineNumber,
1098
- fn = self.is_empty( exn.fileName ) ? '' : ' ' + exn.fileName.split( /\?/ )[ 0 ];
1099
- self.jquery_err.push( '<code><small>' + type + ': ' + exn.message + fn + ln + '</small></code>' );
1100
- },
1101
-
1102
- jquery_notice: function( fn ) {
1103
- //console.log( fn );
1104
- var self = this,
1105
- culprits = [],
1106
- errors = [];
1107
- // disable form submits
1108
- $( 'input[type=submit], input[type=button]' ).prop( 'disabled', true );
1109
- $( 'script' ).each( function( ndx,el ){
1110
- var url = $( this ).prop( 'src' );
1111
- if ( !self.is_empty( url ) && url.match( /jquery(\.min|\.js|\-?ui)/i )
1112
- && ! url.match( /load\-scripts.php/ ) ) {
1113
- culprits.push( '<code><small>' + url.split( /\?/ )[ 0 ] + '</small></code>' );
1114
- }
1115
- } );
1116
- errors.push( '<strong>' + self.getxt( 'js' ) + '</strong> ' + self.getxt( 'contact' ) );
1117
- //if ( 1 == ctcAjax.is_debug ) {
1118
- errors.push( self.jquery_err.join( '<br/>' ) );
1119
- //}
1120
- if ( culprits.length ) {
1121
- errors.push( self.getxt( 'jquery' ) + '<br/>' + culprits.join( '<br/>' ) );
1122
- }
1123
- errors.push( self.getxt( 'plugin' ) );
1124
- self.set_notice( { 'error': errors } );
1125
- },
1126
-
1127
- update: {
1128
- // render individual selector inputs on Query/Selector tab
1129
- qsid: function( res ) {
1130
- //console.log( res );
1131
- var self = this,
1132
- id, html, val, selector, empty;
1133
- self.current_qsid = res.key;
1134
- self.current_qsdata = res.data;
1135
- //console.log( 'update.qsid: ' + self.current_qsid );
1136
- $( '#ctc_sel_ovrd_qsid' ).val( self.current_qsid );
1137
- if ( self.is_empty( self.current_qsdata.seq ) ) {
1138
- $( '#ctc_child_load_order_container' ).empty();
1139
- } else {
1140
- id = 'ctc_ovrd_child_seq_' + self.current_qsid;
1141
- val = parseInt( self.current_qsdata.seq );
1142
- html = '<input type="text" id="' + id + '" name="' + id + '"'
1143
- + ' class="ctc-child-value" value="' + val + '" />';
1144
- $( '#ctc_child_load_order_container' ).html( html );
1145
- }
1146
- if ( self.is_empty( self.current_qsdata.value ) ) {
1147
- //console.log( 'qsdata is empty' );
1148
- empty = true;
1149
- $( '#ctc_sel_ovrd_rule_inputs' ).empty();
1150
- } else {
1151
- //console.log( 'qsdata NOT empty' );
1152
- empty = false;
1153
- html = '';
1154
- $.each( self.current_qsdata.value, function( rule, value ) {
1155
- html += self.input_row( self.current_qsid, rule, 'ovrd', self.current_qsdata );
1156
- } );
1157
- $( '#ctc_sel_ovrd_rule_inputs' ).html( html ).find( '.color-picker' ).each( function() {
1158
- self.setup_spectrum( this );
1159
- } );
1160
- self.coalesce_inputs( '#ctc_child_all_0_swatch' );
1161
- }
1162
- if ( self.jquery_err.length ) {
1163
- self.jquery_notice( 'update.qsid' );
1164
- } else {
1165
- //console.log( 'reload menus: ' + ( self.reload_menus ? 'true' : 'false' ) );
1166
- if ( self.reload_menus ) {
1167
- self.load_queries();
1168
- self.set_query( self.current_qsdata.query );
1169
- self.load_rules();
1170
- }
1171
- $( '#ctc_sel_ovrd_selector_selected' ).text( self.current_qsdata.selector );
1172
- $( '.ctc-rewrite-toggle' ).text( self.getxt( 'rename' ) );
1173
- $( '.ctc-rewrite-toggle' ).show();
1174
- if ( !empty ){
1175
- $( '#ctc_sel_ovrd_rule_header,'
1176
- + '#ctc_sel_ovrd_new_rule,'
1177
- + '#ctc_sel_ovrd_rule_inputs_container,'
1178
- + '#ctc_sel_ovrd_rule_inputs' ).show();
1179
- } else {
1180
- $( '#ctc_sel_ovrd_rule_header,'
1181
- + '#ctc_sel_ovrd_new_rule,'
1182
- + '#ctc_sel_ovrd_rule_inputs_container,'
1183
- + '#ctc_sel_ovrd_rule_inputs' ).hide();
1184
- }
1185
- //self.scrolltop();
1186
- }
1187
- },
1188
- // render list of unique values for given rule on Property/Value tab
1189
- rule_val: function( res ) {
1190
- //console.log( 'update.rule_val: ' + res.key );
1191
- //console.log( res.data );
1192
- var self = this,
1193
- rule = $( '#ctc_rule_menu_selected' ).text(),
1194
- html = '<div class="ctc-input-row clearfix" id="ctc_rule_row_' + rule + '">' + "\n";
1195
- //console.log( 'rule: ' + rule );
1196
- if ( !self.is_empty( res.data ) ) {
1197
- $.each( res.data, function( valid, value ) {
1198
- var parentObj = self.decode_value( rule, value );
1199
- html += '<div class="ctc-parent-row clearfix"'
1200
- + ' id="ctc_rule_row_' + rule + '_' + valid + '">' + "\n"
1201
- + '<div class="ctc-input-cell ctc-parent-value"'
1202
- + ' id="ctc_' + valid + '_parent_' + rule + '_' + valid + '">'
1203
- + parentObj.orig + '</div>' + "\n"
1204
- + '<div class="ctc-input-cell">' + "\n"
1205
- + '<div class="ctc-swatch ctc-specific"'
1206
- + ' id="ctc_' + valid + '_parent_' + rule + '_' + valid + '_swatch">'
1207
- + self.getxt( 'swatch' ) + '</div></div>' + "\n"
1208
- + '<div class="ctc-input-cell">'
1209
- + '<a href="#" class="ctc-selector-handle"'
1210
- + ' id="ctc_selector_' + rule + '_' + valid + '">'
1211
- + self.getxt( 'selector' ) + '</a></div>' + "\n"
1212
- + '<div id="ctc_selector_' + rule + '_' + valid + '_container"'
1213
- + ' class="ctc-selector-container">' + "\n"
1214
- + '<a href="#" id="ctc_selector_' + rule + '_' + valid + '_close"'
1215
- + ' class="ctc-selector-handle ctc-exit" title="'
1216
- + self.getxt( 'close' ) + '"></a>'
1217
- + '<div id="ctc_selector_' + rule + '_' + valid + '_inner_container"'
1218
- + ' class="ctc-selector-inner-container clearfix">' + "\n"
1219
- + '<div id="ctc_status_val_qry_' + valid + '"></div>' + "\n"
1220
- + '<div id="ctc_selector_' + rule + '_' + valid + '_rows"></div>' + "\n"
1221
- + '</div></div></div>' + "\n";
1222
- } );
1223
- html += '</div>' + "\n";
1224
- }
1225
- $( '#ctc_rule_value_inputs' ).html( html ).find( '.ctc-swatch' ).each( function() {
1226
- self.coalesce_inputs( this );
1227
- } );
1228
- },
1229
- // render list of selectors grouped by query for given value on Property/Value Tab
1230
- val_qry: function( res ) {
1231
- var self = this,
1232
- html = '';
1233
- if ( !self.is_empty( res.data ) ) {
1234
- $.each( res.data, function( rule, queries ) {
1235
- page_rule = rule;
1236
- $.each( queries, function( query, selectors ) {
1237
- html += '<h4 class="ctc-query-heading">' + query + '</h4>' + "\n";
1238
- if ( !self.is_empty( selectors ) ) {
1239
- $.each( selectors, function( qsid, qsdata ) {
1240
- html += self.input_row( qsid, rule, res.key, qsdata );
1241
- } );
1242
- }
1243
- } );
1244
- } );
1245
- }
1246
- selector = '#ctc_selector_' + rule + '_' + res.key + '_rows';
1247
- $( selector ).html( html ).find( '.color-picker' ).each( function() {
1248
- self.setup_spectrum( this );
1249
- } );
1250
- $( selector ).find( '.ctc-swatch' ).each( function() {
1251
- self.coalesce_inputs( this );
1252
- } );
1253
- if ( self.jquery_err.length ) self.jquery_notice( 'val_qry' );
1254
- },
1255
- // populate list of queries and attach to query input element
1256
- queries: function( res ) {
1257
- $( '#ctc_sel_ovrd_query' ).data( 'menu', res.data );
1258
- },
1259
- // populate list of selectors and attach to selector input element
1260
- selectors: function( res ) {
1261
- $( '#ctc_sel_ovrd_selector' ).data( 'menu', res.data );
1262
- },
1263
- // populate list of rules and attach to rule input element
1264
- rules: function( res ) {
1265
- $( '#ctc_rule_menu' ).data( 'menu', res.data );
1266
- },
1267
- // render debug output
1268
- debug: function( res ) {
1269
- $( '#ctc_debug_container' ).html( res.data );
1270
- //console.log( 'debug:' );
1271
- //console.log( res.data );
1272
- },
1273
- // render stylesheet preview on child or parent css tab
1274
- preview: function( res ) {
1275
- $( '#view_' + res.key + '_options_panel' ).text( res.data );
1276
- }
1277
-
1278
- },
1279
-
1280
- // initialize object vars, bind event listeners to elements, load menus and start plugin
1281
- init: function() {
1282
- //console.log( 'initializing...' )
1283
- var self = this;
1284
- // auto populate parent/child tab values
1285
- self.autogen_slugs();
1286
- self.set_existing();
1287
- // initialize theme menus
1288
- if ( !$( '#ctc_theme_parnt' ).is( 'input' ) ) {
1289
- //console.log( 'initializing theme select menus...' )
1290
- try {
1291
- $.widget( 'ctc.themeMenu', $.ui.selectmenu, {
1292
- _renderItem: function( ul, item ) {
1293
- var li = $( "<li>" ),
1294
- sel = item.value.replace( /[^\w\-]/, '' );
1295
- $( '#ctc_theme_option_' + sel )
1296
- .detach().appendTo( li );
1297
- return li.appendTo( ul );
1298
- }
1299
- } );
1300
- } catch( exn ) {
1301
- self.jquery_exception( exn, 'Theme Menu' );
1302
- }
1303
- try {
1304
- $( '#ctc_theme_parnt' ).themeMenu( {
1305
- select: function( event, ui ) {
1306
- self.set_parent_menu( ui.item );
1307
- }
1308
- } );
1309
- } catch( exn ) {
1310
- if ( 'function' == typeof themeMenu )
1311
- $( '#ctc_theme_parnt' ).themeMenu( 'destroy' );
1312
- else $( '#ctc_theme_parnt-button' ).remove();
1313
- self.jquery_exception( exn, 'Parent Theme Menu' );
1314
- }
1315
- if ( self.is_empty( ctcAjax.themes.child ) ) {
1316
- if ( $( '#ctc_child_name' ).length ) {
1317
- $( '#ctc_child_name' ).val( self.testname );
1318
- $( '#ctc_child_template' ).val( self.testslug );
1319
- }
1320
- } else {
1321
- try {
1322
- $( '#ctc_theme_child' ).themeMenu( {
1323
- select: function( event, ui ) {
1324
- self.set_child_menu( ui.item );
1325
- }
1326
- } );
1327
- } catch( exn ) {
1328
- if ( 'function' == typeof themeMenu )
1329
- $( '#ctc_theme_child' ).themeMenu( 'destroy' );
1330
- else $( '#ctc_theme_child-button' ).remove();
1331
- self.jquery_exception( exn, 'Child Theme Menu' );
1332
- }
1333
- }
1334
- }
1335
- if ( self.is_empty( self.jquery_err ) ){
1336
- //console.log( 'delegating event bindings...' )
1337
- $( '#ctc_main' ).on( 'click', '.ctc-selector-handle', function( e ) {
1338
- //'.ctc-option-panel-container'
1339
- e.preventDefault();
1340
- if ( $( this ).hasClass( 'ajax-pending' ) ) return false;
1341
- $( this ).addClass( 'ajax-pending' );
1342
- //set_notice( '' );
1343
- var id = $( this ).attr( 'id' ).toString().replace( '_close', '' ),
1344
- parts = id.toString().match( /_([^_]+)_(\d+)$/ );
1345
- if ( $( '#' + id + '_container' ).is( ':hidden' ) ) {
1346
- if ( !self.is_empty( parts[ 1 ] ) && !self.is_empty( parts[ 2 ] ) ) {
1347
- rule = parts[ 1 ];
1348
- valid = parts[ 2 ];
1349
- // retrieve selectors / values for individual value
1350
- self.query_css( 'val_qry', valid, { 'rule': rule } );
1351
- }
1352
- }
1353
- $( '#' + id + '_container' ).fadeToggle( 'fast' );
1354
- $( '.ctc-selector-container' ).not( '#' + id + '_container' ).fadeOut( 'fast' );
1355
- } );
1356
- $( '#ctc_main' ).on( 'click', '.ctc-save-input[type=button], .ctc-delete-input', function( e ) {
1357
- e.preventDefault();
1358
- if ( $( this ).hasClass( 'ajax-pending' ) ) return false;
1359
- $( this ).addClass( 'ajax-pending' );
1360
- self.save( this ); // refresh menus after updating data
1361
- return false;
1362
- } );
1363
- $( '#ctc_main' ).on( 'keydown', '.ctc-selector-container .ctc-child-value[type=text]', function( e ) {
1364
- if ( 13 === e.which ) {
1365
- //console.log( 'return key pressed' );
1366
- var $obj = $( this ).parents( '.ctc-selector-row' ).find( '.ctc-save-input[type=button]' ).first();
1367
- if ( $obj.length ) {
1368
- e.preventDefault();
1369
- //console.log( $obj.attr( 'id' ) );
1370
- if ( $obj.hasClass( 'ajax-pending' ) ) return false;
1371
- $obj.addClass( 'ajax-pending' );
1372
- self.save( $obj );
1373
- return false;
1374
- }
1375
- }
1376
- } );
1377
- $( '#ctc_main' ).on( 'click', '.ctc-selector-edit', function( e ) {
1378
- e.preventDefault();
1379
- if ( $( this ).hasClass( 'ajax-pending' ) ) return false;
1380
- $( this ).addClass( 'ajax-pending' );
1381
- self.set_qsid( this );
1382
- } );
1383
- $( '#ctc_main' ).on( 'click', '.ctc-rewrite-toggle', function( e ) {
1384
- e.preventDefault();
1385
- self.selector_input_toggle( this );
1386
- } );
1387
- $( '#ctc_main' ).on( 'click', '#ctc_copy_selector', function( e ) {
1388
- var txt = $( '#ctc_sel_ovrd_selector_selected' ).text().trim();
1389
- if ( !self.is_empty( txt ) )
1390
- $( '#ctc_new_selectors' ).val( $( '#ctc_new_selectors' ).val() + "\n" + txt + " {\n\n}" );
1391
- } );
1392
- $( '#ctc_configtype' ).on( 'change', function( e ) {
1393
- var val = $( this ).val();
1394
- if ( self.is_empty( val ) || 'theme' == val ) {
1395
- $( '.ctc-theme-only, .ctc-themeonly-container' ).removeClass( 'ctc-disabled' );
1396
- $( '.ctc-theme-only, .ctc-themeonly-container input' ).prop( 'disabled', false );
1397
- try {
1398
- $( '#ctc_theme_parnt, #ctc_theme_child' ).themeMenu( 'enable' );
1399
- } catch ( exn ) {
1400
- self.jquery_exception( exn, 'Theme Menu' );
1401
- }
1402
- } else {
1403
- $( '.ctc-theme-only, .ctc-themeonly-container' ).addClass( 'ctc-disabled' );
1404
- $( '.ctc-theme-only, .ctc-themeonly-container input' ).prop( 'disabled', true );
1405
- try {
1406
- $( '#ctc_theme_parnt, #ctc_theme_child' ).themeMenu( 'disable' );
1407
- } catch ( exn ) {
1408
- self.jquery_exception( exn, 'Theme Menu' );
1409
- }
1410
- }
1411
- } );
1412
- // these elements are not replaced so use direct selector events
1413
- $( '.nav-tab' ).on( 'click', function( e ) {
1414
- e.preventDefault();
1415
- // clear the notice box
1416
- //set_notice( '' );
1417
- $( '.ctc-query-icon,.ctc-status-icon' ).remove();
1418
- var id = '#' + $( this ).attr( 'id' );
1419
- self.focus_panel( id );
1420
- } );
1421
- $( '.ctc-section-toggle' ).on( 'click', function( e ) {
1422
- e.preventDefault();
1423
- $( this ).parents( '.ctc-input-row, .update-nag' ).first().find( '.ctc-section-toggle' )
1424
- .each( function() {
1425
- $( this ).toggleClass( 'open' );
1426
- } );
1427
- var id = $( this ).attr( 'id' ).replace(/\d$/, '') + '_content';
1428
- $( '#' + id ).stop().slideToggle( 'fast' );
1429
- return false;
1430
- } );
1431
- $( '#view_child_options, #view_parnt_options' ).on( 'click', function( e ){
1432
- if ( $( this ).hasClass( 'ajax-pending' ) ) return false;
1433
- $( this ).addClass( 'ajax-pending' );
1434
- self.css_preview( $( this ).attr( 'id' ) );
1435
- } );
1436
- $( '#ctc_load_form' ).on( 'submit', function() {
1437
- return ( self.validate() ); //&& confirm( self.getxt( 'load' ) ) ) ;
1438
- } );
1439
- $( '#ctc_query_selector_form' ).on( 'submit', function( e ) {
1440
- e.preventDefault();
1441
- $this = $( '#ctc_save_query_selector' );
1442
- if ( $this.hasClass( 'ajax-pending' ) ) return false;
1443
- $this.addClass( 'ajax-pending' );
1444
- self.save( $this ); // refresh menus after updating data
1445
- return false;
1446
- } );
1447
- $( '#ctc_rule_value_form' ).on( 'submit', function( e ) {
1448
- //console.log( 'rule value empty submit' );
1449
- e.preventDefault();
1450
- return false;
1451
- } );
1452
- $( '#ctc_theme_child, #ctc_theme_child-button, #ctc_child_type_existing' )
1453
- .on( 'focus click', function() {
1454
- // change the inputs to use existing child theme
1455
- $( '#ctc_child_type_existing' ).prop( 'checked', true );
1456
- $( '#ctc_child_type_new' ).prop( 'checked', false );
1457
- $( '#ctc_child_template' ).val( '' );
1458
- self.set_existing();
1459
- } );
1460
- $( '#ctc_duplicate_theme' ).on( 'click', function() {
1461
- if ( $( '#ctc_duplicate_theme' ).is( ':checked' ) ) {
1462
- $( '#ctc_child_name' ).val( self.testname );
1463
- $( '#ctc_duplicate_theme_slug' ).val( self.testslug );
1464
- } else {
1465
- self.set_existing();
1466
- }
1467
- } );
1468
- $( '#ctc_child_type_new, #ctc_child_template' ).on( 'focus click', function() {
1469
- // change the inputs to use new child theme
1470
- $( '#ctc_child_type_existing' ).prop( 'checked', false );
1471
- $( '#ctc_duplicate_theme' ).prop( 'checked', false );
1472
- $( '#ctc_duplicate_theme_slug' ).val( '' );
1473
- $( '#ctc_child_type_new' ).prop( 'checked', true );
1474
- $( '#input_row_duplicate_theme' ).hide();
1475
- $( '#ctc_child_name' ).val( self.testname );
1476
- $( '#ctc_child_template' ).val( self.testslug );
1477
- } );
1478
- $( '#ctc_is_debug' ).on( 'change', function( e ) {
1479
- self.save( this );
1480
- } );
1481
- $( '.ctc-live-preview' ).on( 'click', function( e ) {
1482
- e.stopImmediatePropagation();
1483
- e.preventDefault();
1484
- document.location = $( this ).prop( 'href' );
1485
- return false;
1486
- } );
1487
- //console.log( 'loading autoselect menus...' )
1488
- // initialize autoselect menus
1489
- self.setup_menus();
1490
- //console.log( 'checking for additional stylesheets...' )
1491
- // mark additional linked stylesheets for parsing
1492
- self.set_addl_css();
1493
- // show last 25 selectors edited
1494
- // render_recent();
1495
- // turn on submit buttons (disabled until everything is loaded to prevent errors)
1496
- //console.log( 'releasing submit buttons...' )
1497
- $( 'input[type=submit], input[type=button]' ).prop( 'disabled', false );
1498
- self.scrolltop();
1499
- //console.log( 'Ready.' )
1500
- // disappear any notices after 20 seconds
1501
- setTimeout( self.fade_update_notice, 20000 );
1502
- } else {
1503
- //$( '.ctc-select' ).css( { 'visibility': 'visible' } ).show();
1504
- self.jquery_notice( 'init' );
1505
- }
1506
- },
1507
- // object properties
1508
- testslug: '',
1509
- testname: '',
1510
- reload_menus: false,
1511
- current_query: 'base',
1512
- current_qsid: null,
1513
- current_qsdata: {},
1514
- jquery_err: [],
1515
- color_regx: '\\s+(\\#[a-f0-9]{3,6}|rgba?\\([\\d., ]+?\\)|hsla?\\([\\d%., ]+?\\)|[a-z]+)',
1516
- border_regx: '(\\w+)(\\s+(\\w+))?',
1517
- grad_regx: '(\\w+)'
1518
-
1519
- };
1520
- //console.log( 'creating new chldthmcfg object ...' );
1521
- $.chldthmcfg.init();
1522
- } ( jQuery ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/chld-thm-cfg.min.js DELETED
@@ -1 +0,0 @@
1
- !function(e){e.chldthmcfg={esc_quot:function(e){var t=this;return t.is_empty(e)?e:e.toString().replace(/"/g,"&quot;")},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,a){return e.each(a,function(e,a){return e.toLowerCase()!==t.toLowerCase()||"parnt"!=i&&"new"!=c?void 0:(n=!0,!1)}),n?!1:void 0}),n},validate:function(){var t=this,c=/[^\w\-]/,n=e("#ctc_child_template").length?e("#ctc_child_template").val().toString().replace(c):"",i=e("#ctc_theme_child").length?e("#ctc_theme_child").val().toString().replace(c):n,a=e("input[name=ctc_child_type]:checked").val(),r=[];return"new"==a&&(i=n),t.theme_exists(i,a)&&r.push(t.getxt("theme_exists").toString().replace(/%s/,i)),""===i&&r.push(t.getxt("inval_theme")),""===e("#ctc_child_name").val()&&r.push(t.getxt("inval_name")),r.length?(t.set_notice({error:r}),!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",a="",r="",s="00";t.theme_exists(n,"new");)a=""==a?2:a+1,r=s.substring(0,s.length-a.toString().length)+a.toString(),n=slugbase+r;t.testslug=n,t.testname=i+(r.length?" "+r:"")}},focus_panel:function(t){var c=t+"_panel";e(".nav-tab").removeClass("nav-tab-active"),e(".ctc-option-panel").removeClass("ctc-option-panel-active"),e(t).addClass("nav-tab-active"),e(".ctc-option-panel-container").scrollTop(0),e(c).addClass("ctc-option-panel-active")},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=e(t).attr("id"),i=/^(ctc_(ovrd|\d+)_(parent|child)_([0-9a-z\-]+)_(\d+?)(_(\d+))?)(_\w+)?$/,a=e(t).parents(".ctc-selector-row, .ctc-parent-row").first(),r=a.find(".ctc-swatch").first(),s={parent:{},child:{}},l={parent:{origin:"",start:"",end:""},child:{origin:"",start:"",end:""}},_={child:!1,parent:!1},o={};return a.find(".ctc-parent-value, .ctc-child-value").each(function(){var t,a,r=e(this).attr("id"),u=r.toString().match(i),d=u[2],p=u[3],h="undefined"==typeof u[4]?"":u[4],m=u[7],v=u[5],f="undefined"==typeof u[7]?"":u[8],g="parent"==p?e(this).text().replace(/!$/,""):"seq"!=h&&"ctc_delete_query_selector"==n?"":e(this).val(),y="seq"==h?!1:"ctc_"+d+"_child_"+h+"_i_"+v+"_"+m;if("child"==p&&(c.is_empty(e(this).data("color"))||(g=c.color_text(e(this).data("color")),e(this).data("color",null)),o[r]=g,y&&(o[y]=e("#"+y).is(":checked")?1:0)),""!==g)if(c.is_empty(f))if(t=h.toString().match(/^border(\-(top|right|bottom|left))?$/)&&!g.match(/none/)){var x=new RegExp(c.border_regx+c.color_regx,"i"),a=g.toString().match(x);c.is_empty(a)||(a.shift(),s[p][h+"-width"]=a.shift()||"",a.shift(),s[p][h+"-style"]=a.shift()||"",s[p][h+"-color"]=a.shift()||"")}else if("background-image"!=h||g.match(/none/))"seq"!=h&&(s[p][h]=g);else if(g.toString().match(/url\(/))s[p]["background-image"]=c.image_url(p,g);else{var w=new RegExp(c.grad_regx+c.color_regx+c.color_regx,"i"),a=g.toString().match(w);!c.is_empty(a)&&a.length>2?(a.shift(),l[p].origin=a.shift()||"top",l[p].start=a.shift()||"transparent",l[p].end=a.shift()||"transparent",_[p]=!0):s[p]["background-image"]=g}else switch(f){case"_border_width":s[p][h+"-width"]="none"==g?0:g;break;case"_border_style":s[p][h+"-style"]=g;break;case"_border_color":s[p][h+"-color"]=g;break;case"_background_url":s[p]["background-image"]=c.image_url(p,g);break;case"_background_color":s[p]["background-color"]=g;break;case"_background_color1":l[p].start=g,_[p]=!0;break;case"_background_color2":l[p].end=g,_[p]=!0;break;case"_background_origin":l[p].origin=g,_[p]=!0}}),"undefined"==typeof r||c.is_empty(r.attr("id"))||(r.removeAttr("style"),_.parent&&r.ctcgrad(l.parent.origin,[l.parent.start,l.parent.end]),r.css(s.parent),r.attr("id").toString().match(/parent/)||(_.child&&r.ctcgrad(l.child.origin,[l.child.start,l.child.end]),r.css(s.child)),r.css({"z-index":-1})),o},decode_value:function(e,t){t="undefined"==typeof t?"":t;var c=this,n={orig:t,names:[""],values:[t]};if(e.toString().match(/^border(\-(top|right|bottom|left))?$/)){var i=new RegExp(c.border_regx+"("+c.color_regx+")?","i"),a=t.toString().match(i);c.is_empty(a)&&(a=[]),n.names=["_border_width","_border_style","_border_color"],orig=a.shift(),n.values[0]=a.shift()||"",a.shift(),n.values[1]=a.shift()||"",a.shift(),n.values[2]=a.shift()||""}else if(e.toString().match(/^background\-image/))if(n.names=["_background_url","_background_origin","_background_color1","_background_color2"],n.values=["","","",""],c.is_empty(t)||t.toString().match(/(url|none)/))n.values[0]=t;else{var r,s,a=t.toString().split(/:/);n.values[1]=a.shift()||"",n.values[2]=a.shift()||"",r=a.shift()||"",n.values[3]=a.shift()||"",s=a.shift()||"",n.orig=[n.values[1],n.values[2],n.values[3]].join(" ")}return n},image_url:function(e,t){var c,n=this,i=t.toString().match(/url\(['" ]*(.+?)['" ]*\)/),a=n.is_empty(i)?null:i[1],r=ctcAjax.theme_uri+"/"+("parent"==e?ctcAjax.parnt:ctcAjax.child)+"/";return a?c=a.toString().match(/^(data:|https?:|\/)/)?t:"url("+r+a+")":!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");e.each(e("#ctc_rule_menu").data("menu"),function(e,t){i.test(e)&&n.push({label:e,value:t})}),c(n)},merge_ruleval_arrays:function(t,c,n){var i=this,a={};return nextval=n?c.child.pop():null,e.each(["parnt","child"],function(t,r){i.is_empty(c[r])||e.each(c[r],function(e,t){n?parseInt(t[2])>=parseInt(nextval[2])&&(nextval[2]=parseInt(t[2])+1):(i.is_empty(a[t[2]])&&(a[t[2]]={}),a[t[2]][r]=t)})}),n&&(a[nextval[2]]={parnt:[],child:nextval}),a},input_row:function(t,c,n,i,a){var r=this,s="";if(!r.is_empty(i)&&!r.is_empty(i.value)&&!r.is_empty(i.value[c])){var l=i.value[c],_=r.merge_ruleval_arrays(c,l,a);e.each(_,function(a,l){var _=r.decode_value(c,r.is_empty(l.parnt)?"":l.parnt[0]),o=r.is_empty(l.parnt)||0==l.parnt[1]?0:1,u=r.decode_value(c,r.is_empty(l.child)?"":l.child[0]),d=r.is_empty(l.child)||0==l.child[1]?0:1;if(s+='<div class="ctc-'+("ovrd"==n?"input":"selector")+'-row clearfix"><div class="ctc-input-cell">',s+="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(_.orig)?r.getxt("child_only"):""),s+='</div><div class="ctc-parent-value ctc-input-cell"'+("ovrd"!=n?' style="display:none"':"")+' id="ctc_'+n+"_parent_"+c+"_"+t+"_"+a+'">'+(r.is_empty(_.orig)?"[no value]":_.orig+(o?r.getxt("important"):""))+'</div><div class="ctc-input-cell">',!r.is_empty(_.names)){e.each(_.names,function(e,i){i=r.is_empty(i)?"":i,s+='<div class="ctc-child-input-cell clear">';var l,_="ctc_"+n+"_child_"+c+"_"+t+"_"+a+i;!1===(l=u.values.shift())&&(l=""),s+=(r.is_empty(i)?"":r.getxt(i)+":<br/>")+'<input type="text" id="'+_+'" name="'+_+'" class="ctc-child-value'+((i+c).toString().match(/color/)?" color-picker":"")+(i.toString().match(/url/)?" ctc-input-wide":"")+'" value="'+r.esc_quot(l)+'" /></div>'});var p="ctc_"+n+"_child_"+c+"_i_"+t+"_"+a;s+='<label for="'+p+'"><input type="checkbox" id="'+p+'" name="'+p+'" value="1" '+(d?"checked":"")+" />"+r.getxt("important")+"</label>"}s+="</div>","ovrd"!=n&&(s+='<div class="ctc-swatch ctc-specific" id="ctc_child_'+c+"_"+t+"_"+a+'_swatch">'+r.getxt("swatch")+'</div><div class="ctc-child-input-cell ctc-button-cell" id="ctc_save_'+c+"_"+t+"_"+a+'_cell"><input type="button" class="button ctc-save-input" id="ctc_save_'+c+"_"+t+"_"+a+'" name="ctc_save_'+c+"_"+t+"_"+a+'" value="Save" /></div>'),s+="</div><!-- end input row -->\n"})}return s},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(e){var t=this;t.setup_spectrum(e)},setup_spectrum:function(t){var c=this,n=(e(t).attr("id")+"_colortxt",!c.is_empty(ctcAjax.palette));try{e(t).spectrum({showInput:!0,allowEmpty:!0,showAlpha:!0,showInitial:!0,preferredFormat:"hex",clickoutFiresChange:!0,move:function(n){e(t).data("color",n),c.coalesce_inputs(t)},showPalette:n?!0:!1,showSelectionPalette:n?!0:!1,palette:[],maxSelectionSize:36,localStorageKey:"ctc-palette."+ctcAjax.child,hideAfterPaletteSelect:!0}).on("change",function(t){e(this).spectrum("get");c.coalesce_inputs(this)}).on("keyup",function(t){var n=this,i=e(this).val();clearTimeout(e(this).data("spectrumTimer")),e(this).data("spectrumTimer",setTimeout(function(){c.coalesce_inputs(n),e(n).spectrum("set",i)},500))})}catch(i){c.jquery_exception(i,"Spectrum Color Picker")}},color_text:function(e){var t=this;return t.is_empty(e)?"":e.getAlpha()<1?e.toRgbString():e.toHexString()},setup_query_menu:function(){var t=this;try{e("#ctc_sel_ovrd_query").autocomplete({source:t.get_queries,minLength:0,selectFirst:!0,autoFocus:!0,select:function(e,c){return t.set_query(c.item.value),!1},focus:function(e){e.preventDefault()}}).data("menu",{})}catch(c){t.jquery_exception(c,"Query Menu")}},setup_selector_menu:function(){var t=this;try{e("#ctc_sel_ovrd_selector").autocomplete({source:t.get_selectors,selectFirst:!0,autoFocus:!0,select:function(e,c){return t.set_selector(c.item.value,c.item.label),!1},focus:function(e){e.preventDefault()}}).data("menu",{})}catch(c){t.jquery_exception(c,"Selector Menu")}},setup_rule_menu:function(){var t=this;try{e("#ctc_rule_menu").autocomplete({source:t.get_rules,selectFirst:!0,autoFocus:!0,select:function(e,c){return t.set_rule(c.item.value,c.item.label),!1},focus:function(e){e.preventDefault()}}).data("menu",{})}catch(c){t.jquery_exception(c,"Property Menu")}},setup_new_rule_menu:function(){var t=this;try{e("#ctc_new_rule_menu").autocomplete({source:t.get_filtered_rules,selectFirst:!0,autoFocus:!0,select:function(c,n){c.preventDefault();var i,a,r=n.item.label.replace(/[^\w\-]/g,t.to_ascii);return t.is_empty(t.current_qsdata.value)&&(t.current_qsdata.value={}),t.is_empty(t.current_qsdata.value[n.item.label])&&(t.current_qsdata.value[n.item.label]={}),t.is_empty(t.current_qsdata.value[n.item.label].child)&&(t.current_qsdata.value[n.item.label].child=[]),t.current_qsdata.value[n.item.label].child.push(["",0,1,1]),i=e(t.input_row(t.current_qsid,r,"ovrd",t.current_qsdata,!0)),e("#ctc_sel_ovrd_rule_inputs").append(i),e("#ctc_new_rule_menu").val(""),i.find('input[type="text"]').each(function(c,n){a||(a=n),e(n).hasClass("color-picker")&&t.setup_spectrum(n)}),a&&e(a).focus(),t.jquery_err.length&&t.jquery_notice("setup_new_rule_menu"),!1},focus:function(e){e.preventDefault()}}).data("menu",{})}catch(c){t.jquery_exception(c,"New Property 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),e("#ctc_duplicate_theme").prop("checked",!1),e("#ctc_duplicate_theme_slug").val(""),e("#input_row_duplicate_theme").show())}},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_parnt").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,n,i=this;i.is_empty(ctcAjax.themes.child[t.value])||(c=ctcAjax.themes.child[t.value].Template,n=e("#ctc_theme_parnt").val(),c==n?(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)):(e("#ctc_theme_child").parents(".ctc-input-row").first().append('<span class="ctc-status-icon spinner"></span>'),e(".spinner").show(),document.location="?page="+ctcAjax.page+"&ctc_parent="+c+"&ctc_child="+t.value))},set_query:function(t){var c=this;return c.is_empty(t)?!1:(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("&nbsp;"),c.load_selectors(),void c.scrolltop())},set_selector:function(t,c){var n=this;return n.is_empty(t)?!1:(e("#ctc_sel_ovrd_selector").val(""),n.current_qsid=t,n.reload_menus=!1,n.load_selector_values(),void n.scrolltop())},set_rule:function(t,c){var n=this;return n.is_empty(t)?!1:(e("#ctc_rule_menu").val(""),e("#ctc_rule_menu_selected").text(c),e(".ctc-rewrite-toggle").text(n.getxt("rename")),e("#ctc_rule_value_inputs, #ctc_input_row_rule_header").show(),n.query_css("rule_val",t),void n.scrolltop())},set_qsid:function(t){var c=this;c.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?:\/\//,""),a=ctcAjax.homeurl.replace(/^https?/,ctcAjax.ssl?"https":"http"),r=a+"?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(r,function(c){for(;(t=s.exec(c))&&"style.css"!=t[1];)t[1].match(/bootstrap/)||e(".ctc_checkbox").each(function(c,n){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(t,n){e(this).val()==c&&e(this).prop("checked",!0)})}))},query_css:function(t,c,n){var i=this,a={ctc_query_obj:t,ctc_query_key:c},r="#ctc_status_"+t+("val_qry"==t?"_"+c:"");"object"==typeof n&&e.each(n,function(e,t){a["ctc_query_"+e]=t}),e(".query-icon,.ctc-status-icon").remove(),e(r+" .ctc-status-icon").remove(),e(r).append('<span class="ctc-status-icon spinner query-icon"></span>'),e(".spinner").show(),a.action=i.is_empty(e("#ctc_action").val())||"plugin"!=e("#ctc_action").val()?"ctc_query":"ctc_plgqry",a._wpnonce=e("#_wpnonce").val(),i.ajax_post(t,a)},save:function(t){var c,n,i,a,r,s=this,l=(ctcAjax.ajaxurl,{}),_=e(t).attr("id");e(t).prop("disabled",!0),e(".ctc-query-icon,.ctc-status-icon").remove(),e(t).parent(".ctc-textarea-button-cell, .ctc-button-cell").append('<span class="ctc-status-icon spinner save-icon"></span>'),_.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"==_?l.ctc_child_imports=i.val():"ctc_is_debug"==_?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(){a=e("#ctc_rewrite_selector").val(),r=e("#ctc_rewrite_selector_orig").val(),s.is_empty(a)||!a.toString().match(/\w/)?a=r:(l.ctc_rewrite_selector=a,s.reload_menus=!0),e(".ctc-rewrite-toggle").text(s.getxt("rename")),e("#ctc_sel_ovrd_selector_selected").html(a)}),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,a=ctcAjax.ajaxurl;e.ajax({url:a,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], input[type=checkbox],.ctc-delete-input").prop("disabled",!1),e(".ajax-pending").removeClass("ajax-pending"),"preview"==t&&e("#view_parnt_options_panel,#view_child_options_panel").text(c.getxt("css_fail"))},handle_success:function(t,c){var n=this;e(".query-icon, .save-icon").removeClass("spinner"),e(".ajax-pending").removeClass("ajax-pending"),n.is_empty(c)?n.handle_failure(t):(e("#ctc_new_selectors").val(""),e(".query-icon, .save-icon").addClass("success"),e("input[type=submit], input[type=button], input[type=checkbox],.ctc-delete-input").prop("disabled",!1),e(c).each(function(){"function"==typeof n.update[this.obj]&&n.update[this.obj].call(n,this)}))},jquery_exception:function(e,t){var c=this,n=c.is_empty(e.lineNumber)?"":" line: "+e.lineNumber,i=c.is_empty(e.fileName)?"":" "+e.fileName.split(/\?/)[0];c.jquery_err.push("<code><small>"+t+": "+e.message+i+n+"</small></code>")},jquery_notice:function(t){var c=this,n=[],i=[];e("input[type=submit], input[type=button]").prop("disabled",!0),e("script").each(function(t,i){var a=e(this).prop("src");c.is_empty(a)||!a.match(/jquery(\.min|\.js|\-?ui)/i)||a.match(/load\-scripts.php/)||n.push("<code><small>"+a.split(/\?/)[0]+"</small></code>")}),i.push("<strong>"+c.getxt("js")+"</strong> "+c.getxt("contact")),i.push(c.jquery_err.join("<br/>")),n.length&&i.push(c.getxt("jquery")+"<br/>"+n.join("<br/>")),i.push(c.getxt("plugin")),c.set_notice({error:i})},update:{qsid:function(t){var c,n,i,a,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)?(a=!0,e("#ctc_sel_ovrd_rule_inputs").empty()):(a=!1,n="",e.each(r.current_qsdata.value,function(e,t){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_spectrum(this)}),r.coalesce_inputs("#ctc_child_all_0_swatch")),r.jquery_err.length?r.jquery_notice("update.qsid"):(r.reload_menus&&(r.load_queries(),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-rewrite-toggle").show(),a?e("#ctc_sel_ovrd_rule_header,#ctc_sel_ovrd_new_rule,#ctc_sel_ovrd_rule_inputs_container,#ctc_sel_ovrd_rule_inputs").hide():e("#ctc_sel_ovrd_rule_header,#ctc_sel_ovrd_new_rule,#ctc_sel_ovrd_rule_inputs_container,#ctc_sel_ovrd_rule_inputs").show())},rule_val:function(t){var c=this,n=e("#ctc_rule_menu_selected").text(),i='<div class="ctc-input-row clearfix" id="ctc_rule_row_'+n+'">\n';c.is_empty(t.data)||(e.each(t.data,function(e,t){var a=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+'">'+a.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,a){page_rule=i,e.each(a,function(a,r){n+='<h4 class="ctc-query-heading">'+a+"</h4>\n",c.is_empty(r)||e.each(r,function(e,a){n+=c.input_row(e,i,t.key,a)})})}),selector="#ctc_selector_"+rule+"_"+t.key+"_rows",e(selector).html(n).find(".color-picker").each(function(){c.setup_spectrum(this)}),e(selector).find(".ctc-swatch").each(function(){c.coalesce_inputs(this)}),c.jquery_err.length&&c.jquery_notice("val_qry")},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>"),i=c.value.replace(/[^\w\-]/,"");return e("#ctc_theme_option_"+i).detach().appendTo(n),n.appendTo(t)}})}catch(c){t.jquery_exception(c,"Theme Menu")}try{e("#ctc_theme_parnt").themeMenu({select:function(e,c){t.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("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], .ctc-delete-input",function(c){return c.preventDefault(),e(this).hasClass("ajax-pending")?!1:(e(this).addClass("ajax-pending"),t.save(this),!1)}),e("#ctc_main").on("keydown",".ctc-selector-container .ctc-child-value[type=text]",function(c){if(13===c.which){var n=e(this).parents(".ctc-selector-row").find(".ctc-save-input[type=button]").first();if(n.length)return c.preventDefault(),n.hasClass("ajax-pending")?!1:(n.addClass("ajax-pending"),t.save(n),!1)}}),e("#ctc_main").on("click",".ctc-selector-edit",function(c){return c.preventDefault(),e(this).hasClass("ajax-pending")?!1:(e(this).addClass("ajax-pending"),void t.set_qsid(this))}),e("#ctc_main").on("click",".ctc-rewrite-toggle",function(e){e.preventDefault(),t.selector_input_toggle(this)}),e("#ctc_main").on("click","#ctc_copy_selector",function(c){var n=e("#ctc_sel_ovrd_selector_selected").text().trim();t.is_empty(n)||e("#ctc_new_selectors").val(e("#ctc_new_selectors").val()+"\n"+n+" {\n\n}")}),e("#ctc_configtype").on("change",function(c){var n=e(this).val();if(t.is_empty(n)||"theme"==n){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(i){t.jquery_exception(i,"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(i){t.jquery_exception(i,"Theme Menu")}}}),e(".nav-tab").on("click",function(c){c.preventDefault(),e(".ctc-query-icon,.ctc-status-icon").remove();var n="#"+e(this).attr("id");t.focus_panel(n)}),e(".ctc-section-toggle").on("click",function(t){t.preventDefault(),e(this).parents(".ctc-input-row, .update-nag").first().find(".ctc-section-toggle").each(function(){e(this).toggleClass("open")});var c=e(this).attr("id").replace(/\d$/,"")+"_content";return e("#"+c).stop().slideToggle("fast"),!1}),e("#view_child_options, #view_parnt_options").on("click",function(c){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_rule_value_form").on("submit",function(e){return e.preventDefault(),!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_duplicate_theme").on("click",function(){e("#ctc_duplicate_theme").is(":checked")?(e("#ctc_child_name").val(t.testname),e("#ctc_duplicate_theme_slug").val(t.testslug)):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_duplicate_theme").prop("checked",!1),e("#ctc_duplicate_theme_slug").val(""),e("#ctc_child_type_new").prop("checked",!0),e("#input_row_duplicate_theme").hide(),e("#ctc_child_name").val(t.testname),e("#ctc_child_template").val(t.testslug)}),e("#ctc_is_debug").on("change",function(e){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("init")},testslug:"",testname:"",reload_menus:!1,current_query:"base",current_qsid:null,current_qsdata:{},jquery_err:[],color_regx:"\\s+(\\#[a-f0-9]{3,6}|rgba?\\([\\d., ]+?\\)|hsla?\\([\\d%., ]+?\\)|[a-z]+)",border_regx:"(\\w+)(\\s+(\\w+))?",grad_regx:"(\\w+)"},e.chldthmcfg.init()}(jQuery);
 
js/chldthmcfg.js ADDED
@@ -0,0 +1,2257 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * Script: chldthmcfg.js
3
+ * Plugin URI: http://www.childthemeconfigurator.com/
4
+ * Description: Handles jQuery, AJAX and other UI
5
+ * Version: 2.0.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
+ // ** for muliple property values: **
13
+ // make sure sequence is passed with rule/val updates
14
+ // determine sequence based on sequence of value array
15
+ // add sequence to input name
16
+
17
+ ( function( $ ) {
18
+ 'use strict';
19
+ $.chldthmcfg = {
20
+ //console.log( 'executing main function' );
21
+ escquo: function( str ) {
22
+ var self = this;
23
+ return self.is_empty( str ) ? str : str.toString().replace( /"/g, '&quot;' );
24
+ },
25
+
26
+ getxt: function( key, merge ){
27
+ var text = window.ctcAjax[ key + '_txt' ];
28
+ if ( text ) {
29
+ if ( merge ) {
30
+ text = text.replace( /%s/, merge );
31
+ }
32
+ return text;
33
+ }
34
+ return '';
35
+ },
36
+
37
+ frascii: function( str ) {
38
+ var ascii = parseInt( str ),
39
+ chr = String.fromCharCode( ascii );
40
+ return chr;
41
+ },
42
+
43
+ toascii: function( str ) {
44
+ var ascii = str.charCodeAt( 0 );
45
+ return ascii;
46
+ },
47
+
48
+ /**
49
+ * is_empty
50
+ * return true if value evaluates to false, null, null string,
51
+ * empty array, empty object or undefined
52
+ * but NOT 0 ( zero returns false ) unless zero flag is passed
53
+ */
54
+ is_empty: function( obj, zeros ) {
55
+ // first bail when definitely empty or undefined ( true ) NOTE: numeric zero returns false !
56
+ if ( 'undefined' === typeof obj || false === obj || null === obj || '' === obj ) {
57
+ // console.log( 'matched empty' );
58
+ return true;
59
+ }
60
+ // if zeros flag is set, return true for 0 or '0'
61
+ if ( 'undefined' !== typeof zeros && '0' === obj || 0 === obj ) {
62
+ // console.log( 'matched zero literal:' + obj );
63
+ return true;
64
+ }
65
+ // then, if this is bool, string or number it must not be empty ( false )
66
+ if ( true === obj || "string" === typeof obj || "number" === typeof obj ) {
67
+ return false;
68
+ }
69
+ // check for object type to be safe
70
+ if ( "object" === typeof obj ) {
71
+ // Use a standard for in loop
72
+ for ( var x in obj ) {
73
+ // for in will iterate over members on the prototype
74
+ // chain as well, but Object.getOwnPropertyNames returns
75
+ // only those directly on the object, so use hasOwnProperty.
76
+ if ( obj.hasOwnProperty( x ) ) {
77
+ // any value means not empty ( false )
78
+ return false;
79
+ }
80
+ }
81
+ // no properties, so return empty ( true )
82
+ return true;
83
+ }
84
+ // this must be an unsupported datatype, so return not empty
85
+ return false;
86
+ },
87
+
88
+ /**
89
+ * theme_exists
90
+ * returns true if theme is already present for type
91
+ */
92
+ theme_exists: function( testslug, testtype ) {
93
+ var exists = false;
94
+ $.each( window.ctcAjax.themes, function( type, theme ) {
95
+ $.each( theme, function( slug, data ) {
96
+ data = null;
97
+ if ( slug.toLowerCase() === testslug.toLowerCase() && ( 'parnt' === type || 'new' === testtype ) ) {
98
+ exists = true; // no need to continue testing
99
+ return false; // in this context "return false" means "break"
100
+ }
101
+ } );
102
+ if ( exists ) { // no need to continue testing
103
+ return false; // in this context "return false" means "break"
104
+ }
105
+ } );
106
+ return exists;
107
+ },
108
+
109
+ validate: function() {
110
+ var self = this,
111
+ regex = /[^\w\-]/,
112
+ newslug = $( '#ctc_child_template' ).length ? $( '#ctc_child_template' )
113
+ .val().toString().replace( regex ) : '',
114
+ slug = $( '#ctc_theme_child' ).length ? $( '#ctc_theme_child' )
115
+ .val().toString().replace( regex ) : newslug,
116
+ type = $( 'input[name=ctc_child_type]:checked' ).val(),
117
+ errors = [];
118
+ if ( 'new' === type ) {
119
+ slug = newslug;
120
+ }
121
+ if ( self.theme_exists( slug, type ) ) {
122
+ errors.push( self.getxt( 'theme_exists' ).toString().replace( /%s/, slug ) );
123
+ }
124
+ if ( self.is_empty( slug ) ) {
125
+ errors.push( self.getxt( 'inval_theme' ) );
126
+ }
127
+ //if ( self.is_empty( $( '#ctc_child_name' ).val() ) ) {
128
+ // errors.push( self.getxt( 'inval_name' ) );
129
+ //}
130
+ if ( errors.length ) {
131
+ self.set_notice( { 'error': errors } );
132
+ return false;
133
+ }
134
+ if ( 'reset' === type ) {
135
+ if ( confirm( self.getxt( 'load' ) ) ) {
136
+ return true;
137
+ }
138
+ return false;
139
+ }
140
+ return true;
141
+ },
142
+
143
+ autogen_slugs: function() {
144
+ if ( $( '#ctc_theme_parnt' ).length ) {
145
+ var self = this,
146
+ parent = $( '#ctc_theme_parnt' ).val(),
147
+ slugbase= parent + '-child',
148
+ slug = slugbase,
149
+ name = window.ctcAjax.themes.parnt[ parent ].Name + ' Child',
150
+ suffix = '',
151
+ padded = '',
152
+ pad = '00';
153
+ while ( self.theme_exists( slug, 'new' ) ) {
154
+ suffix = ( self.is_empty( suffix ) ? 2 : suffix + 1 );
155
+ padded = pad.substring( 0, pad.length - suffix.toString().length ) + suffix.toString();
156
+ slug = slugbase + padded;
157
+ }
158
+ self.testslug = slug;
159
+ self.testname = name + ( padded.length ? ' ' + padded : '' );
160
+ //console.log( 'autogen_slugs: parent: ' + parent + ' slug: ' + slug );
161
+ }
162
+ },
163
+
164
+ focus_panel: function( id ) {
165
+ var panelid = id + '_panel';
166
+ $( '.nav-tab' ).removeClass( 'nav-tab-active' );
167
+ $( '.ctc-option-panel' ).removeClass( 'ctc-option-panel-active' );
168
+ //$( '.ctc-selector-container' ).hide();
169
+ $( id ).addClass( 'nav-tab-active' );
170
+ $( '.ctc-option-panel-container' ).scrollTop( 0 );
171
+ $( panelid ).addClass( 'ctc-option-panel-active' );
172
+ },
173
+
174
+ selector_input_toggle: function( obj ) {
175
+ //console.log( 'selector_input_toggle: ' + obj );
176
+ var self = this,
177
+ origval;
178
+ if ( $( '#ctc_rewrite_selector' ).length ) {
179
+ origval = $( '#ctc_rewrite_selector_orig' ).val();
180
+ $( '#ctc_sel_ovrd_selector_selected' ).text( origval );
181
+ $( obj ).text( self.getxt( 'rename' ) );
182
+ } else {
183
+ origval = $( '#ctc_sel_ovrd_selector_selected' ).text();
184
+ $( '#ctc_sel_ovrd_selector_selected' ).html(
185
+ '<textarea id="ctc_rewrite_selector"' +
186
+ ' name="ctc_rewrite_selector" autocomplete="off"></textarea>' +
187
+ '<input id="ctc_rewrite_selector_orig" name="ctc_rewrite_selector_orig"' +
188
+ ' type="hidden" value="' + self.escquo( origval ) + '"/>' );
189
+ $( '#ctc_rewrite_selector' ).val( origval );
190
+ $( obj ).text( self.getxt( 'cancel' ) );
191
+ }
192
+ },
193
+
194
+ coalesce_inputs: function( obj ) {
195
+ //**console.log( 'coalesce_inputs ' + $( obj ).attr( 'id' ) );
196
+ var self = this,
197
+ id = $( obj ).attr( 'id' ),
198
+ regex = /^(ctc_(ovrd|\d+)_(parent|child)_([0-9a-z\-]+)_(\d+?)(_(\d+))?)(_\w+)?$/,
199
+ container = $( obj ).parents( '.ctc-selector-row, .ctc-parent-row' ).first(),
200
+ swatch = container.find( '.ctc-swatch' ).first(),
201
+ cssrules = { 'parent': {}, 'child': {} },
202
+ gradient = {
203
+ 'parent': {
204
+ 'origin': '',
205
+ 'start': '',
206
+ 'end': ''
207
+ },
208
+ 'child': {
209
+ 'origin': '',
210
+ 'start': '',
211
+ 'end': ''
212
+ }
213
+ },
214
+ has_gradient = { 'child': false, 'parent': false },
215
+ postdata = {};
216
+ // set up objects for all neighboring inputs
217
+ container.find( '.ctc-parent-value, .ctc-child-value' ).each( function() {
218
+ var inputid = $( this ).attr( 'id' ),
219
+ inputparts = inputid.toString().match( regex ),
220
+ inputseq = inputparts[ 2 ],
221
+ inputtheme = inputparts[ 3 ],
222
+ inputrule = ( 'undefined' === typeof inputparts[ 4 ] ? '' : inputparts[ 4 ] ),
223
+ rulevalid = inputparts[ 7 ],
224
+ qsid = inputparts[ 5 ],
225
+ rulepart = ( 'undefined' === typeof inputparts[ 7 ] ? '' : inputparts[ 8 ] ),
226
+ value = ( 'parent' === inputtheme ? $( this ).text().replace( /!$/, '' ) :
227
+ ( 'seq' !== inputrule && 'ctc_delete_query_selector' === id ? '' :
228
+ $( this ).val() ) ), // clear values if delete was clicked
229
+ important = ( 'seq' === inputrule ? false : 'ctc_' + inputseq + '_child_' + inputrule + '_i_' + qsid + '_' + rulevalid ),
230
+ parts, subparts;
231
+ //**console.log( inputparts );
232
+ //**console.log( 'value: ' + value );
233
+ if ( 'child' === inputtheme ) {
234
+ if ( !self.is_empty( $( this ).data( 'color' ) ) ) {
235
+ value = self.color_text( $( this ).data( 'color' ) );
236
+ $( this ).data( 'color', null );
237
+ }
238
+ postdata[ inputid ] = value;
239
+ if ( important ) {
240
+ postdata[ important ] = ( $( '#' + important ).is( ':checked' ) ) ? 1 : 0;
241
+ }
242
+ }
243
+ if ( '' !== value ) {
244
+ // handle specific inputs
245
+ if ( !self.is_empty( rulepart ) ) {
246
+ switch( rulepart ) {
247
+ case '_border_width':
248
+ cssrules[ inputtheme ][ inputrule + '-width' ] = ( 'none' === value ? 0 : value );
249
+ break;
250
+ case '_border_style':
251
+ cssrules[ inputtheme ][ inputrule + '-style' ] = value;
252
+ break;
253
+ case '_border_color':
254
+ cssrules[ inputtheme ][ inputrule + '-color' ] = value;
255
+ break;
256
+ case '_background_url':
257
+ cssrules[ inputtheme ][ 'background-image' ] = self.image_url( inputtheme, value );
258
+ break;
259
+ case '_background_color':
260
+ cssrules[ inputtheme ][ 'background-color' ] = value; // was obj.value ???
261
+ break;
262
+ case '_background_color1':
263
+ gradient[ inputtheme ].start = value;
264
+ has_gradient[ inputtheme ] = true;
265
+ break;
266
+ case '_background_color2':
267
+ gradient[ inputtheme ].end = value;
268
+ has_gradient[ inputtheme ] = true;
269
+ break;
270
+ case '_background_origin':
271
+ gradient[ inputtheme ].origin = value;
272
+ has_gradient[ inputtheme ] = true;
273
+ break;
274
+ }
275
+ } else {
276
+ // handle borders
277
+ if ( ( parts = inputrule.toString().match( /^border(\-(top|right|bottom|left))?$/ ) && !value.match( /none/ ) ) ) {
278
+ var borderregx = new RegExp( self.border_regx + self.color_regx, 'i' );
279
+ subparts = value.toString().match( borderregx );
280
+ //**console.log( 'border after regex: ');
281
+ //**console.log( value );
282
+ //**console.log( borderregx );
283
+ //**console.log( subparts );
284
+ if ( !self.is_empty( subparts ) ) {
285
+ subparts.shift();
286
+ cssrules[ inputtheme ][ inputrule + '-width' ] = subparts.shift() || '';
287
+ subparts.shift();
288
+ cssrules[ inputtheme ][ inputrule + '-style' ] = subparts.shift() || '';
289
+ cssrules[ inputtheme ][ inputrule + '-color' ] = subparts.shift() || '';
290
+ }
291
+ // handle background images
292
+ } else if ( 'background-image' === inputrule && !value.match( /none/ ) ) {
293
+ if ( value.toString().match( /url\(/ ) ) {
294
+ cssrules[ inputtheme ][ 'background-image' ] = self.image_url( inputtheme, value );
295
+ } else {
296
+ var gradregex = new RegExp( self.grad_regx + self.color_regx + self.color_regx, 'i' );
297
+ subparts = value.toString().match( gradregex );
298
+ //**console.log( 'background-image after regex: ');
299
+ //**console.log( value );
300
+ //**console.log( gradregex );
301
+ //**console.log( subparts );
302
+ if ( !self.is_empty( subparts ) && subparts.length > 2 ) {
303
+ subparts.shift();
304
+ gradient[ inputtheme ].origin = subparts.shift() || 'top';
305
+ gradient[ inputtheme ].start = subparts.shift() || 'transparent';
306
+ gradient[ inputtheme ].end = subparts.shift() || 'transparent';
307
+ has_gradient[ inputtheme ] = true;
308
+ } else {
309
+ cssrules[ inputtheme ][ 'background-image' ] = value;
310
+ }
311
+ }
312
+ } else if ( 'seq' !== inputrule ) {
313
+ cssrules[ inputtheme ][ inputrule ] = value;
314
+ }
315
+ }
316
+ }
317
+ } );
318
+ // update swatch
319
+ if ( 'undefined' !== typeof swatch && !self.is_empty( swatch.attr( 'id' ) ) ) {
320
+ swatch.removeAttr( 'style' );
321
+ if ( has_gradient.parent ) {
322
+ swatch.ctcgrad( gradient.parent.origin, [ gradient.parent.start, gradient.parent.end ] );
323
+ }
324
+ //**console.log( 'combined css rules' );
325
+ //**console.log( cssrules );
326
+ swatch.css( cssrules.parent );
327
+ if ( !( swatch.attr( 'id' ).toString().match( /parent/ ) ) ) {
328
+ if ( has_gradient.child ) {
329
+ swatch.ctcgrad( gradient.child.origin, [ gradient.child.start, gradient.child.end ] );
330
+ }
331
+ //console.log( cssrules.child );
332
+ swatch.css( cssrules.child );
333
+ }
334
+ swatch.css( {'z-index':-1} );
335
+ }
336
+ return postdata;
337
+ },
338
+
339
+ decode_value: function( rule, value ) {
340
+ //**console.log( 'in decode_value ( ' + rule + ' ...' );
341
+ value = ( 'undefined' === typeof value ? '' : value );
342
+ var self = this,
343
+ obj = {
344
+ 'orig': value,
345
+ 'names': [ '' ],
346
+ 'values': [ value ]
347
+ },
348
+ params;
349
+ if ( rule.toString().match( /^border(\-(top|right|bottom|left))?$/ ) ) {
350
+ var regex = new RegExp( self.border_regx + '(' + self.color_regx + ')?', 'i' ),
351
+ orig;
352
+ params = value.toString().match( regex );
353
+ if ( self.is_empty( params ) ) {
354
+ params = [];
355
+ }
356
+ obj.names = [
357
+ '_border_width',
358
+ '_border_style',
359
+ '_border_color',
360
+ ];
361
+ orig = params.shift();
362
+ //**console.log( value );
363
+ //**console.log( regex );
364
+ //**console.log( params );
365
+ obj.values[ 0 ] = params.shift() || '';
366
+ params.shift();
367
+ obj.values[ 1 ] = params.shift() || '';
368
+ params.shift();
369
+ obj.values[ 2 ] = params.shift() || '';
370
+ } else if ( rule.toString().match( /^background\-image/ ) ) {
371
+ obj.names = [
372
+ '_background_url',
373
+ '_background_origin',
374
+ '_background_color1',
375
+ '_background_color2'
376
+ ];
377
+ obj.values = [ '', '', '', '' ];
378
+ if ( !self.is_empty( value ) && !( value.toString().match( /(url|none)/ ) ) ) {
379
+ var stop1, stop2;
380
+ params = value.toString().split( /:/ );
381
+ //**console.log( value );
382
+ //**console.log( params );
383
+ obj.values[ 1 ] = params.shift() || '';
384
+ obj.values[ 2 ] = params.shift() || '';
385
+ stop1 = params.shift() || '';
386
+ obj.values[ 3 ] = params.shift() || '';
387
+ stop2 = params.shift() || '';
388
+ obj.orig = [
389
+ obj.values[ 1 ],
390
+ obj.values[ 2 ],
391
+ obj.values[ 3 ]
392
+ ].join( ' ' );
393
+ } else {
394
+ obj.values[ 0 ] = value;
395
+ }
396
+ }
397
+ //**console.log( obj );
398
+ return obj;
399
+ },
400
+
401
+ image_url: function( theme, value ) {
402
+ var self = this,
403
+ parts = value.toString().match( /url\(['" ]*(.+?)['" ]*\)/ ),
404
+ path = self.is_empty( parts ) ? null : parts[ 1 ],
405
+ url = window.ctcAjax.theme_uri + '/' + ( 'parent' === theme ? window.ctcAjax.parnt : window.ctcAjax.child ) + '/',
406
+ image_url;
407
+ if ( !path ) {
408
+ return false;
409
+ } else if ( path.toString().match( /^(data:|https?:|\/)/ ) ) {
410
+ image_url = value;
411
+ } else {
412
+ image_url = 'url(' + url + path + ')';
413
+ }
414
+ return image_url;
415
+ },
416
+
417
+ setup_menus: function() {
418
+ var self = this;
419
+ //console.log( 'setup_menus' );
420
+ self.setup_query_menu();
421
+ self.setup_selector_menu();
422
+ self.setup_rule_menu();
423
+ self.setup_new_rule_menu();
424
+ self.load_queries();
425
+ self.load_rules();
426
+ // selectors will be loaded after query selected
427
+ self.set_query( self.currquery );
428
+ },
429
+
430
+ load_queries: function() {
431
+ var self = this;
432
+ //console.log( 'load_queries' );
433
+ // retrieve unique media queries
434
+ self.query_css( 'queries', null );
435
+ },
436
+
437
+ load_selectors: function() {
438
+ var self = this;
439
+ //console.log( 'load_selectors' );
440
+ // retrieve unique selectors from query value
441
+ self.query_css( 'selectors', self.currquery );
442
+ },
443
+
444
+ load_rules: function() {
445
+ var self = this;
446
+ //console.log( 'load_rules' );
447
+ // retrieve all unique rules
448
+ self.query_css( 'rules', null );
449
+ },
450
+
451
+ load_selector_values: function() {
452
+ var self = this;
453
+ //console.log( 'load_selector_values: ' + self.currqsid );
454
+ // retrieve individual values from qsid
455
+ self.query_css( 'qsid', self.currqsid );
456
+ },
457
+
458
+ get_queries: function( request, response ) {
459
+ //console.log( 'get_queries' );
460
+ //console.log( this );
461
+ var //self = this,
462
+ arr = [],
463
+ matcher = new RegExp( $.ui.autocomplete.escapeRegex( request.term ), "i" );
464
+ if ( $.chldthmcfg.is_empty( this.element.data( 'menu' ) ) ) {
465
+ arr.push( { 'label': window.ctcAjax.nosels_txt, 'value': null } );
466
+ } else {
467
+ // note: key = ndx, value = query name
468
+ $.each( this.element.data( 'menu' ), function( key, val ) {
469
+ if ( matcher.test( val ) ) {
470
+ arr.push( { 'label': val, 'value': val } );
471
+ }
472
+ } );
473
+ }
474
+ response( arr );
475
+ },
476
+
477
+ get_selectors: function( request, response ) {
478
+ //console.log( 'get_selectors' );
479
+ var //self = this,
480
+ arr = [],
481
+ matcher = new RegExp( $.ui.autocomplete.escapeRegex( request.term ), "i" );
482
+ if ( $.chldthmcfg.is_empty( this.element.data( 'menu' ) ) ) {
483
+ arr.push( { 'label': window.ctcAjax.nosels_txt, 'value': null } );
484
+ } else {
485
+ // note: key = selector name, value = qsid
486
+ $.each( this.element.data( 'menu' ), function( key, val ) {
487
+ if ( matcher.test( key ) ) {
488
+ arr.push( { 'label': key, 'value': val } );
489
+ }
490
+ } );
491
+ }
492
+ response( arr );
493
+ },
494
+
495
+ get_rules: function( request, response ) {
496
+ //console.log( 'get_rules' );
497
+ var //self = this,
498
+ arr = [],
499
+ matcher = new RegExp( $.ui.autocomplete.escapeRegex( request.term ), "i" );
500
+ if ( $.chldthmcfg.is_empty( this.element.data( 'menu' ) ) ) {
501
+ arr.push( { 'label': window.ctcAjax.nosels_txt, 'value': null } );
502
+ } else {
503
+ // note: key = ruleid, value = rule name
504
+ $.each( this.element.data( 'menu' ), function( key, val ) {
505
+ if ( matcher.test( key ) ) {
506
+ arr.push( { 'label': key, 'value': val } );
507
+ }
508
+ } );
509
+ }
510
+ response( arr );
511
+ },
512
+
513
+ get_filtered_rules: function( request, response ) {
514
+ //console.log( 'get_filtered_rules' );
515
+ var arr = [],
516
+ matcher = new RegExp( $.ui.autocomplete.escapeRegex( request.term ), "i" ); //,
517
+ $.each( $( '#ctc_rule_menu' ).data( 'menu' ), function( key, val ) {
518
+ //multiple versions of rule ok
519
+ if ( matcher.test( key ) ) {
520
+ arr.push( { 'label': key, 'value': val } );
521
+ }
522
+ } );
523
+ response( arr );
524
+ },
525
+
526
+ /**
527
+ * parent and new values are stored in separate arrays
528
+ * this function puts them into parent/child columns by rulevalid
529
+ */
530
+ merge_ruleval_arrays: function( rule, value, isnew ) {
531
+ //**console.log( 'merge_ruleval_arrays' );
532
+ var self = this,
533
+ valarr = {},
534
+ nextval = isnew ? value.child.pop() : null; // if new rule, pop off the top before counting
535
+ //**console.log( value );
536
+ $.each( [ 'parnt', 'child' ], function( ndx, template ) {
537
+ // iterate through parent and child val arrays and populate new assoc array with parent/child for each rulevalid
538
+ if ( !self.is_empty( value[ template ] ) ) {
539
+ $.each( value[ template ], function( ndx2, val ) {
540
+ if ( isnew ) {
541
+ // if new rule, increment new rulevalid but do not add to parent/child assoc array
542
+ if ( parseInt( val[ 2 ] ) >= parseInt( nextval[ 2 ] ) ) {
543
+ nextval[ 2 ] = parseInt( val[ 2 ] ) + 1;
544
+ }
545
+ } else {
546
+ // add to parent/child assoc array with rulevalid as key
547
+ if ( self.is_empty( valarr[ val[ 2 ] ] ) ) {
548
+ valarr[ val[ 2 ] ] = {};
549
+ }
550
+ valarr[ val[ 2 ] ][ template ] = val;
551
+ }
552
+ } );
553
+ }
554
+ } );
555
+ // if new rule, create new parent child assoc array element with new rulevalid as key
556
+ if ( isnew ) {
557
+ valarr[ nextval[ 2 ] ] = {
558
+ parnt: [],
559
+ child: nextval
560
+ };
561
+ }
562
+ return valarr;
563
+ },
564
+
565
+ /**
566
+ * input_row
567
+ * render individual row of inputs for a given selector/rule combination
568
+ * qsid query/selector id
569
+ * rule css property
570
+ * seq panel id from rule/value tab
571
+ * data contains all rules/values for selector
572
+ * isnew is passed true when new rule is selected from menu
573
+ */
574
+ input_row: function( qsid, rule, seq, data, isnew ) {
575
+ //console.log( 'in input_row' );
576
+ var self = this,
577
+ html = '';
578
+ if ( !self.is_empty( data ) && !self.is_empty( data.value ) && !self.is_empty( data.value[ rule ] ) ) {
579
+ var value = data.value[ rule ],
580
+ valarr = self.merge_ruleval_arrays( rule, value, isnew );
581
+ $.each( valarr, function( ndx, val ) {
582
+ var pval = self.decode_value( rule, self.is_empty( val.parnt ) ? '' : val.parnt[ 0 ] ),
583
+ pimp = self.is_empty( val.parnt ) || self.is_empty( val.parnt[ 1 ], 1 ) ? 0 : 1,
584
+ cval = self.decode_value( rule, self.is_empty( val.child ) ? '' : val.child[ 0 ] ),
585
+ cimp = self.is_empty( val.child ) || self.is_empty( val.child[ 1 ], 1 ) ? 0 : 1;
586
+ html += '<div class="ctc-' + ( 'ovrd' === seq ? 'input' : 'selector' ) + '-row clearfix"><div class="ctc-input-cell">';
587
+ if ( 'ovrd' === seq ) {
588
+ html += rule.replace( /\d+/g, self.frascii );
589
+ } else {
590
+ html += data.selector + '<br/><a href="#" class="ctc-selector-edit"' +
591
+ ' id="ctc_selector_edit_' + qsid + '" >' + self.getxt( 'edit' ) + '</a> ' +
592
+ ( self.is_empty( pval.orig ) ? self.getxt( 'child_only' ) : '' );
593
+ }
594
+ html += '</div><div class="ctc-parent-value ctc-input-cell"' + ( 'ovrd' !== seq ? ' style="display:none"' : '' ) +
595
+ ' id="ctc_' + seq + '_parent_' + rule + '_' + qsid + '_' + ndx + '">' +
596
+ ( self.is_empty( pval.orig ) ? '[no value]' : pval.orig + ( pimp ? self.getxt( 'important' ) : '' ) ) +
597
+ '</div><div class="ctc-input-cell">';
598
+ if ( !self.is_empty( pval.names ) ) {
599
+ $.each( pval.names, function( namendx, newname ) {
600
+ newname = ( self.is_empty( newname ) ? '' : newname );
601
+ html += '<div class="ctc-child-input-cell clear">';
602
+ var id = 'ctc_' + seq + '_child_' + rule + '_' + qsid + '_' + ndx + newname,
603
+ newval;
604
+ if ( false === ( newval = cval.values.shift() ) ) {
605
+ newval = '';
606
+ }
607
+
608
+ html += ( self.is_empty( newname ) ? '' : self.getxt( newname ) + ':<br/>' ) +
609
+ '<input type="text" id="' + id + '" name="' + id + '" class="ctc-child-value' +
610
+ ( ( newname + rule ).toString().match( /color/ ) ? ' color-picker' : '' ) +
611
+ ( ( newname ).toString().match( /url/ ) ? ' ctc-input-wide' : '' ) +
612
+ '" value="' + self.escquo( newval ) + '" /></div>';
613
+ } );
614
+ var impid = 'ctc_' + seq + '_child_' + rule + '_i_' + qsid + '_' + ndx;
615
+ html += '<label for="' + impid + '"><input type="checkbox"' +
616
+ ' id="' + impid + '" name="' + impid + '" value="1" ' +
617
+ ( cimp ? 'checked' : '' ) + ' />' +
618
+ self.getxt( 'important' ) + '</label>';
619
+ }
620
+ html += '</div>';
621
+ if ( 'ovrd' !== seq ) {
622
+ html += '<div class="ctc-swatch ctc-specific"' +
623
+ ' id="ctc_child_' + rule + '_' + qsid + '_' + ndx + '_swatch">' +
624
+ self.getxt( 'swatch' ) + '</div>' +
625
+ '<div class="ctc-child-input-cell ctc-button-cell"' +
626
+ ' id="ctc_save_' + rule + '_' + qsid + '_' + ndx + '_cell">' +
627
+ '<input type="button" class="button ctc-save-input"' +
628
+ ' id="ctc_save_' + rule + '_' + qsid + '_' + ndx + '"' +
629
+ ' name="ctc_save_' + rule + '_' + qsid + '_' + ndx + '"' +
630
+ ' value="Save" /></div>';
631
+ }
632
+ html += '</div><!-- end input row -->' + "\n";
633
+ } );
634
+ }
635
+ return html;
636
+ },
637
+
638
+ scrolltop: function() {
639
+ $('html, body, .ctc-option-panel-container').animate( { scrollTop: 0 } );
640
+ },
641
+
642
+ css_preview: function( theme ) {
643
+ var self = this;
644
+ //console.log( 'css_preview: ' + theme );
645
+ if ( !( theme = theme.match( /(child|parnt)/ )[ 1 ] ) ) {
646
+ theme = 'child';
647
+ }
648
+ //console.log( 'css_preview: ' + theme );
649
+ // retrieve raw stylesheet ( parent or child )
650
+ self.query_css( 'preview', theme );
651
+ },
652
+
653
+ /**
654
+ * The "setup" functions initialize jQuery UI widgets
655
+ */
656
+ setup_iris: function( obj ) {
657
+ // deprecated: using spectrum for alpha support
658
+ var self = this;
659
+ self.setup_spectrum( obj );
660
+ },
661
+
662
+ setup_spectrum: function( obj ) {
663
+ var self = this,
664
+ //colortxt = $( obj ).attr( 'id' ) + '_colortxt',
665
+ palette = !self.is_empty( window.ctcAjax.palette );
666
+ try {
667
+ $( obj ).spectrum( {
668
+ showInput: true,
669
+ allowEmpty: true,
670
+ showAlpha: true,
671
+ showInitial: true,
672
+ preferredFormat: "hex", // 'name', //
673
+ clickoutFiresChange: true,
674
+ move: function( color ) {
675
+ $( obj ).data( 'color', color );
676
+ self.coalesce_inputs( obj );
677
+ },
678
+ showPalette: palette ? true : false,
679
+ showSelectionPalette: palette ? true : false,
680
+ palette: [ ],
681
+ maxSelectionSize: 36,
682
+ localStorageKey: "ctc-palette." + window.ctcAjax.child,
683
+ hideAfterPaletteSelect: true,
684
+ } ).on( 'change', function( ){
685
+ //var color = $( this ).spectrum( 'get' );
686
+ //console.log( 'color change: ' + color );
687
+ self.coalesce_inputs( this );
688
+ } ).on( 'keyup', function( ) {
689
+ // update spectrum ui to match text input after half-second delay
690
+ var $this = this,
691
+ $val = self.addhash( $( this ).val() );
692
+ $( $this ).val( $val );
693
+ clearTimeout( $( this ).data( 'spectrumTimer' ) );
694
+ $( this ).data( 'spectrumTimer', setTimeout(
695
+ function() {
696
+ self.coalesce_inputs( $this );
697
+ $( $this ).spectrum( 'set', $val );
698
+ },
699
+ 500
700
+ ) );
701
+ } );
702
+
703
+ } catch ( exn ) {
704
+ self.jquery_exception( exn, 'Spectrum Color Picker' );
705
+ }
706
+ },
707
+ addhash: function( color ) {
708
+ return color.replace( /^#?([a-f0-9]{3,6}.*)/, "#$1" );
709
+ },
710
+ color_text: function( color ) {
711
+ var self = this;
712
+ if ( self.is_empty( color ) ) {
713
+ return '';
714
+ } else if ( color.getAlpha() < 1 ) {
715
+ return color.toRgbString();
716
+ } else {
717
+ return color.toHexString();
718
+ }
719
+ },
720
+
721
+ setup_query_menu: function() {
722
+ var self = this;
723
+ //console.log( 'setup_query_menu' );
724
+ try {
725
+ $( '#ctc_sel_ovrd_query' ).autocomplete( {
726
+ source: self.get_queries,
727
+ minLength: 0,
728
+ selectFirst: true,
729
+ autoFocus: true,
730
+ select: function( e, ui ) {
731
+ self.set_query( ui.item.value );
732
+ return false;
733
+ },
734
+ focus: function( e ) {
735
+ e.preventDefault();
736
+ }
737
+ } ).data( 'menu' , {} );
738
+ } catch ( exn ) {
739
+ self.jquery_exception( exn, 'Query Menu' );
740
+ }
741
+ },
742
+
743
+ setup_selector_menu: function() {
744
+ var self = this;
745
+ //console.log( 'setup_selector_menu' );
746
+ try {
747
+ $( '#ctc_sel_ovrd_selector' ).autocomplete( {
748
+ source: self.get_selectors,
749
+ selectFirst: true,
750
+ autoFocus: true,
751
+ select: function( e, ui ) {
752
+ self.set_selector( ui.item.value, ui.item.label );
753
+ return false;
754
+ },
755
+ focus: function( e ) {
756
+ e.preventDefault();
757
+ }
758
+ } ).data( 'menu' , {} );
759
+ } catch ( exn ) {
760
+ self.jquery_exception( exn, 'Selector Menu' );
761
+ }
762
+ },
763
+
764
+ setup_rule_menu: function() {
765
+ var self = this;
766
+ //console.log( 'setup_rule_menu' );
767
+ try {
768
+ $( '#ctc_rule_menu' ).autocomplete( {
769
+ source: self.get_rules,
770
+ //minLength: 0,
771
+ selectFirst: true,
772
+ autoFocus: true,
773
+ select: function( e, ui ) {
774
+ self.set_rule( ui.item.value, ui.item.label );
775
+ return false;
776
+ },
777
+ focus: function( e ) {
778
+ e.preventDefault();
779
+ }
780
+ } ).data( 'menu' , {} );
781
+ } catch ( exn ) {
782
+ self.jquery_exception( exn, 'Property Menu' );
783
+ }
784
+ },
785
+
786
+ setup_new_rule_menu: function() {
787
+ var self = this;
788
+ try {
789
+ $( '#ctc_new_rule_menu' ).autocomplete( {
790
+ source: self.get_filtered_rules,
791
+ //minLength: 0,
792
+ selectFirst: true,
793
+ autoFocus: true,
794
+ select: function( e, ui ) {
795
+ //console.log( 'new rule selected' );
796
+ e.preventDefault();
797
+ var newrule = ui.item.label.replace( /[^\w\-]/g, self.toascii ),
798
+ row,
799
+ first;
800
+ //console.log( 'current qsdata before:' );
801
+ //console.log( self.currdata );
802
+ if ( self.is_empty( self.currdata.value ) ) {
803
+ self.currdata.value = {};
804
+ }
805
+ if ( self.is_empty( self.currdata.value[ ui.item.label ] ) ) {
806
+ self.currdata.value[ ui.item.label ] = {};
807
+ }
808
+ if ( self.is_empty( self.currdata.value[ ui.item.label ].child ) ) {
809
+ self.currdata.value[ ui.item.label ].child = [];
810
+ }
811
+ //console.log( 'current qsdata after:' );
812
+ //console.log( self.currdata );
813
+ // seed current qsdata with new blank value with id 1
814
+ // this will be modified during input_row function to be next id in order
815
+ self.currdata.value[ ui.item.label ].child.push( [ '', 0, 1, 1 ] );
816
+ row = $( self.input_row( self.currqsid, newrule, 'ovrd', self.currdata, true ) );
817
+ $( '#ctc_sel_ovrd_rule_inputs' ).append( row );
818
+ $( '#ctc_new_rule_menu' ).val( '' );
819
+
820
+ row.find( 'input[type="text"]' ).each( function( ndx, el ) {
821
+ if (! first) {
822
+ first = el;
823
+ }
824
+ if ( $( el ).hasClass( 'color-picker' ) ){
825
+ self.setup_spectrum( el );
826
+ }
827
+ } );
828
+ if ( first ){
829
+ $( first ).focus();
830
+ }
831
+ // if ( self.jqueryerr.length ) {
832
+ // self.jquery_notice( 'setup_new_rule_menu' );
833
+ // }
834
+ return false;
835
+ },
836
+ focus: function( e ) {
837
+ e.preventDefault();
838
+ }
839
+ } ).data( 'menu' , {} );
840
+ } catch ( exn ) {
841
+ self.jquery_exception( exn, 'New Property Menu' );
842
+ }
843
+ },
844
+ set_theme_params: function( template, themedir ) {
845
+ $( '#ctc_child_author' ).val( window.ctcAjax.themes[ template ][ themedir ].Author );
846
+ $( '#ctc_child_version' ).val( window.ctcAjax.themes[ template ][ themedir ].Version );
847
+ $( '#ctc_child_authoruri' ).val( window.ctcAjax.themes[ template ][ themedir ].AuthorURI );
848
+ $( '#ctc_child_themeuri' ).val( window.ctcAjax.themes[ template ][ themedir ].ThemeURI );
849
+ $( '#ctc_child_descr' ).val( window.ctcAjax.themes[ template ][ themedir ].Descr );
850
+ $( '#ctc_child_tags' ).val( window.ctcAjax.themes[ template ][ themedir ].Tags );
851
+ },
852
+ update_form: function() {
853
+ var self = this,
854
+ themedir;
855
+ $( '#input_row_stylesheet_handling_container,#input_row_parent_handling_container,#ctc_additional_css_files_container,#input_row_new_theme_slug,#input_row_duplicate_theme_slug,#ctc_copy_theme_mods,#ctc_child_header_parameters,#ctc_configure_submit,#input_row_theme_slug' ).slideUp( 'fast' );
856
+ $( '#ctc_configure_submit .ctc-step' ).text( '9' );
857
+ if ( $( '#ctc_theme_child' ).length && !$( '#ctc_child_type_new' ).is( ':checked' ) ) {
858
+ themedir = $( '#ctc_theme_child' ).val();
859
+ //console.log( 'update_form (existing) ... ' + themedir );
860
+ self.existing = 1;
861
+ self.currparnt = window.ctcAjax.themes.child[ themedir ].Template;
862
+ self.autogen_slugs();
863
+ $( '#ctc_theme_parnt' ).val( self.currparnt );
864
+ $( '#ctc_theme_parnt-button .ui-selectmenu-text' ).text( window.ctcAjax.themes.parnt[ self.currparnt ].Name );
865
+ self.set_theme_params( 'child', themedir );
866
+ //self.set_child_menu( document.getElementById( 'ctc_theme_child' ) );
867
+ if ( $( '#ctc_child_type_duplicate' ).is( ':checked' ) ) {
868
+ $( '#ctc_child_template' ).val( self.testslug );
869
+ $( '#ctc_child_name' ).val( self.testname );
870
+ $( '.ctc-analyze-theme, .ctc-analyze-howto' ).show();
871
+ $( '#ctc_load_styles' ).val( 'Duplicate Child Theme' );
872
+ } else if ( $( '#ctc_child_type_reset' ).is( ':checked' ) ) {
873
+ $( '#ctc_configure_submit .ctc-step' ).text( '3' );
874
+ $( '#ctc_configure_submit' ).slideDown( 'fast' );
875
+ $( '#theme_slug_container' ).text( themedir );
876
+ $( '.ctc-analyze-theme, .ctc-analyze-howto' ).hide();
877
+ //$( '#input_row_theme_slug' ).slideDown( 'fast' );
878
+ $( '#ctc_enqueue_none' ).prop( 'checked', true );
879
+ $( '#ctc_load_styles' ).val( 'Reset Child Theme to Previous State' );
880
+ } else {
881
+ $( '#ctc_child_template' ).val( '' );
882
+ $( '#theme_slug_container' ).text( themedir );
883
+ $( '.ctc-analyze-theme, .ctc-analyze-howto' ).show();
884
+ $( '#ctc_child_name' ).val( window.ctcAjax.themes.child[ themedir ].Name );
885
+ $( '#ctc_load_styles' ).val( 'Configure Child Theme' );
886
+ }
887
+ $( '#input_row_existing_theme_option' ).slideDown( 'fast' );
888
+ $( '#input_row_new_theme_option' ).slideUp( 'fast' );
889
+ } else {
890
+ self.existing = 0;
891
+ self.autogen_slugs();
892
+ //themedir = $( '#ctc_theme_parnt' ).val();
893
+ $( '#ctc_theme_parnt' ).val( self.currparnt );
894
+ $( '#ctc_theme_parnt-button .ui-selectmenu-text' ).text( window.ctcAjax.themes.parnt[ self.currparnt ].Name );
895
+ //console.log( 'update_form (new) ... ' + self.currparnt );
896
+ //self.set_parent_menu( document.getElementById( 'ctc_theme_parnt' ) );
897
+ //console.log( 'setting to new...' + $( '#ctc_theme_parnt' ).val() );
898
+ self.set_theme_params( 'parnt', self.currparnt );
899
+ $( '#input_row_existing_theme_option,#input_row_duplicate_theme_container,#input_row_theme_slug' ).slideUp( 'fast' );
900
+ $( '#input_row_new_theme_option' ).slideDown( 'fast' );
901
+ $( '#ctc_child_name' ).val( self.testname );
902
+ $( '#ctc_child_template' ).val( self.testslug );
903
+ $( '.ctc-analyze-theme, .ctc-analyze-howto' ).show();
904
+ $( '#ctc_load_styles' ).val( 'Create New Child Theme' );
905
+ }
906
+ },
907
+ set_notice: function( noticearr ) {
908
+ var self = this,
909
+ errorHtml = '',
910
+ out;
911
+ if ( !self.is_empty( noticearr ) ) {
912
+ $.each( noticearr, function( type, list ) {
913
+ errorHtml += '<div class="' + type + ' notice is-dismissible dashicons-before"><ul>' + "\n";
914
+ $( list ).each( function( ndx, el ) {
915
+ errorHtml += '<li>' + el.toString() + '</li>' + "\n";
916
+ } );
917
+ errorHtml += '</ul></div>';
918
+ } );
919
+ }
920
+ out = $( errorHtml );
921
+ $( '#ctc_error_notice' ).html( out );
922
+ self.bind_dismiss( out );
923
+ $( 'html, body' ).animate( { scrollTop: 0 }, 'slow' );
924
+ },
925
+
926
+ set_parent_menu: function( obj ) {
927
+ // refresh page with current parent theme
928
+ var self = this;
929
+ self.currparnt = obj.value;
930
+ self.update_form();
931
+ //self.show_loading();
932
+ //document.location = '?page=' + window.ctcAjax.page + '&ctc_parent=' + obj.value;
933
+ },
934
+
935
+ set_child_menu: function( obj ) {
936
+ var self = this;
937
+ self.currchild = obj.value;
938
+ self.update_form();
939
+ },
940
+
941
+ set_query: function( value ) {
942
+ var self = this;
943
+ if ( self.is_empty( value ) ) {
944
+ return false;
945
+ }
946
+ //console.log( 'set_query: ' + value );
947
+ self.currquery = value;
948
+ $( '#ctc_sel_ovrd_query' ).val( '' );
949
+ $( '#ctc_sel_ovrd_query_selected' ).text( value );
950
+ $( '#ctc_sel_ovrd_selector' ).val( '' );
951
+ $( '#ctc_sel_ovrd_selector_selected' ).html( '&nbsp;' );
952
+ //$( '#ctc_sel_ovrd_rule_inputs' ).html( '' );
953
+ self.load_selectors();
954
+ self.scrolltop();
955
+ },
956
+
957
+ set_selector: function( value, label ) {
958
+ var self = this;
959
+ label = null;
960
+ if ( self.is_empty( value ) ) {
961
+ return false;
962
+ }
963
+ //console.log( 'set_selector: ' + value + ' label: ' + label );
964
+ $( '#ctc_sel_ovrd_selector' ).val( '' );
965
+ self.currqsid = value;
966
+ self.reload = false;
967
+ self.load_selector_values();
968
+ self.scrolltop();
969
+ },
970
+
971
+ set_rule: function( value, label ) {
972
+ //console.log( 'set_rule: ' + value + ' label: ' + label );
973
+ var self = this;
974
+ if ( self.is_empty( value ) ) {
975
+ return false;
976
+ }
977
+ $( '#ctc_rule_menu' ).val( '' );
978
+ $( '#ctc_rule_menu_selected' ).text( label );
979
+ $( '.ctc-rewrite-toggle' ).text( self.getxt( 'rename' ) );
980
+ $( '#ctc_rule_value_inputs, #ctc_input_row_rule_header' ).show();
981
+ // retrieve unique values by rule
982
+ self.query_css( 'rule_val', value );
983
+ self.scrolltop();
984
+ },
985
+
986
+ set_qsid: function( obj ) {
987
+ var self = this;
988
+ //console.log( 'set_qsid: ' + $( obj ).attr( 'id' ) );
989
+ self.currqsid = $( obj ).attr( 'id' ).match( /_(\d+)$/ )[ 1 ];
990
+ self.focus_panel( '#query_selector_options' );
991
+ self.reload = true;
992
+ self.load_selector_values();
993
+ },
994
+ /**
995
+ * Retrieve data from server and execute callback on completion
996
+ */
997
+ query_css: function( obj, key, params ) {
998
+ //console.log( 'query_css: ' + obj + ' key: ' + key );
999
+ var self = this,
1000
+ postdata = { 'ctc_query_obj' : obj, 'ctc_query_key': key },
1001
+ status_sel = '#ctc_status_' + obj + ( 'val_qry' === obj ? '_' + key : '' );
1002
+
1003
+ if ( 'object' === typeof params ) {
1004
+ $.each( params, function( key, val ) {
1005
+ postdata[ 'ctc_query_' + key ] = val;
1006
+ } );
1007
+ }
1008
+ $( '.query-icon,.ctc-status-icon' ).remove();
1009
+ //console.log( status_sel + ' ' + $( status_sel ).length );
1010
+ $( status_sel + ' .ctc-status-icon' ).remove();
1011
+ $( status_sel ).append( '<span class="ctc-status-icon spinner is-active query-icon"></span>' );
1012
+ // add wp ajax action to array
1013
+ //console.log( $( '#ctc_action' ).val() );
1014
+ postdata.action = ( !self.is_empty( $( '#ctc_action' ).val() ) &&
1015
+ 'plugin' === $( '#ctc_action' ).val() ) ?
1016
+ 'ctc_plgqry' : 'ctc_query';
1017
+ postdata._wpnonce = $( '#_wpnonce' ).val();
1018
+ // ajax post input data
1019
+ //console.log( 'query_css postdata:' );
1020
+ //console.log( postdata );
1021
+ self.ajax_post( obj, postdata );
1022
+ },
1023
+ /**
1024
+ * Post data to server for saving and execute callback on completion
1025
+ */
1026
+ save: function( obj ) {
1027
+ //console.log( 'save: ' + $( obj ).attr( 'id' ) );
1028
+ var self = this,
1029
+ postdata = {},
1030
+ $selector,
1031
+ $query,
1032
+ $imports,
1033
+ id = $( obj ).attr( 'id' ),
1034
+ newsel,
1035
+ origsel;
1036
+
1037
+ // disable the button until ajax returns
1038
+ $( obj ).prop( 'disabled', true );
1039
+ // clear previous success/fail icons
1040
+ $( '.ctc-query-icon,.ctc-status-icon' ).remove();
1041
+ // show spinner
1042
+ $( obj ).parent( '.ctc-textarea-button-cell, .ctc-button-cell' )
1043
+ .append( '<span class="ctc-status-icon spinner save-icon"></span>' );
1044
+ if ( id.match( /ctc_configtype/ ) ) {
1045
+ $( obj ).parents( '.ctc-input-row' ).first()
1046
+ .append( '<span class="ctc-status-icon spinner save-icon"></span>' );
1047
+ postdata.ctc_configtype = $( obj ).val();
1048
+ } else if ( ( $selector = $( '#ctc_new_selectors' ) ) &&
1049
+ 'ctc_save_new_selectors' === $( obj ).attr( 'id' ) ) {
1050
+ postdata.ctc_new_selectors = $selector.val();
1051
+ if ( ( $query = $( '#ctc_sel_ovrd_query_selected' ) ) ) {
1052
+ postdata.ctc_sel_ovrd_query = $query.text();
1053
+ }
1054
+ self.reload = true;
1055
+ } else if ( ( $imports = $( '#ctc_child_imports' ) ) &&
1056
+ 'ctc_save_imports' === id ) {
1057
+ postdata.ctc_child_imports = $imports.val();
1058
+ } else if ( 'ctc_is_debug' === id ) {
1059
+ postdata.ctc_is_debug = $( '#ctc_is_debug' ).is( ':checked' ) ? 1 : 0;
1060
+ } else {
1061
+ // coalesce inputs
1062
+ postdata = self.coalesce_inputs( obj );
1063
+ }
1064
+ $( '.save-icon' ).addClass( 'is-active' );
1065
+ // add rename selector value if it exists
1066
+ $( '#ctc_sel_ovrd_selector_selected' )
1067
+ .find( '#ctc_rewrite_selector' ).each( function() {
1068
+ newsel = $( '#ctc_rewrite_selector' ).val();
1069
+ origsel = $( '#ctc_rewrite_selector_orig' ).val();
1070
+ if ( self.is_empty( newsel ) || !newsel.toString().match( /\w/ ) ) {
1071
+ newsel = origsel;
1072
+ } else {
1073
+ postdata.ctc_rewrite_selector = newsel;
1074
+ self.reload = true;
1075
+ }
1076
+ $( '.ctc-rewrite-toggle' ).text( self.getxt( 'rename' ) );
1077
+ $( '#ctc_sel_ovrd_selector_selected' ).html( newsel );
1078
+ } );
1079
+ // add wp ajax action to array
1080
+ //console.log( $( '#ctc_action' ).val() );
1081
+ postdata.action = ( !self.is_empty( $( '#ctc_action' ).val() ) &&
1082
+ 'plugin' === $( '#ctc_action' ).val() ) ?
1083
+ 'ctc_plugin' : 'ctc_update';
1084
+ postdata._wpnonce = $( '#_wpnonce' ).val();
1085
+ //console.log( postdata );
1086
+ // ajax post input data
1087
+ self.ajax_post( 'qsid', postdata );
1088
+ },
1089
+
1090
+ ajax_post: function( obj, data, datatype ) {
1091
+ var self = this;
1092
+ //console.log( 'ajax_post: ' + obj );
1093
+ //console.log( data );
1094
+ // get ajax url from localized object
1095
+ $.ajax( {
1096
+ url: window.ctcAjax.ajaxurl,
1097
+ data: data,
1098
+ dataType:
1099
+ //'ctc_update' === data.action && 'qsid' === obj ? 'text' :
1100
+ //'ctc_update' == data.action && // 'rule_val' == obj ? 'text' : // 'qsid' == obj ? 'text' :
1101
+ ( self.is_empty( datatype ) ? 'json' : datatype ),
1102
+ type: 'POST'
1103
+ } ).done( function( response ) {
1104
+ //console.log( response );
1105
+ self.handle_success( obj, response );
1106
+ } ).fail( function( jxr, status, err ) {
1107
+ //console.log( status );
1108
+ //console.log( err );
1109
+ self.handle_failure( obj );
1110
+ } ).always( function() {
1111
+ if ( self.jqueryerr.length ) {
1112
+ self.jquery_notice();
1113
+ }
1114
+ } );
1115
+ },
1116
+
1117
+ handle_failure: function( obj ) {
1118
+ var self = this;
1119
+ //console.log( 'handle_failure: ' + obj );
1120
+ $( '.query-icon, .save-icon' ).removeClass( 'spinner' ).addClass( 'failure' );
1121
+ $( 'input[type=submit], input[type=button], input[type=checkbox],.ctc-delete-input' ).prop( 'disabled', false );
1122
+ $( '.ajax-pending' ).removeClass( 'ajax-pending' );
1123
+ //FIXME: return fail text in ajax response
1124
+ if ( 'preview' === obj ) {
1125
+ $( '#view_parnt_options_panel,#view_child_options_panel' )
1126
+ .text( self.getxt( 'css_fail' ) );
1127
+ }
1128
+ },
1129
+
1130
+ handle_success: function( obj, response ) {
1131
+ var self = this;
1132
+ // query response
1133
+ //console.log( 'handle_success: ' + obj );
1134
+ //console.log( response );
1135
+ // hide spinner
1136
+ $( '.query-icon, .save-icon' ).removeClass( 'spinner' );
1137
+ $( '.ajax-pending' ).removeClass( 'ajax-pending' );
1138
+ // hide spinner
1139
+ if ( self.is_empty( response ) ) {
1140
+ self.handle_failure( obj );
1141
+ } else {
1142
+ $( '#ctc_new_selectors' ).val( '' );
1143
+ // update data objects
1144
+ // show check mark
1145
+ // FIXME: distinction between save and query, update specific status icon
1146
+ $( '.query-icon, .save-icon' ).addClass( 'success' );
1147
+ $( 'input[type=submit], input[type=button], input[type=checkbox],.ctc-delete-input' ).prop( 'disabled', false );
1148
+ // update ui from each response object
1149
+ $( response ).each( function() {
1150
+ if ( 'function' === typeof self.update[ this.obj ] ) {
1151
+ //console.log( 'executing method update.' + this.obj );
1152
+ self.update[ this.obj ].call( self, this );
1153
+ } else {
1154
+ //console.log( 'Fail: no method update.' + this.obj );
1155
+ }
1156
+ } );
1157
+ }
1158
+ },
1159
+
1160
+ jquery_exception: function( exn, type ) {
1161
+ var self = this,
1162
+ ln = self.is_empty( exn.lineNumber ) ? '' : ' line: ' + exn.lineNumber,
1163
+ fn = self.is_empty( exn.fileName ) ? '' : ' ' + exn.fileName.split( /\?/ )[ 0 ];
1164
+ self.jqueryerr.push( '<code><small>' + type + ': ' + exn.message + fn + ln + '</small></code>' );
1165
+ //console.log( 'jquery error detected' );
1166
+ },
1167
+
1168
+ jquery_notice: function( fn ) {
1169
+ //console.log( fn );
1170
+ fn = null;
1171
+ var self = this,
1172
+ culprits = [],
1173
+ errors = [];
1174
+ if ( self.jqueryerr.length ){
1175
+ // disable form submits
1176
+ $( 'input[type=submit], input[type=button]' ).prop( 'disabled', true );
1177
+ $( 'script' ).each( function(){
1178
+ var url = $( this ).prop( 'src' );
1179
+ if ( !self.is_empty( url ) && url.match( /jquery(\.min|\.js|\-?ui)/i ) &&
1180
+ ! url.match( /load\-scripts.php/ ) ) {
1181
+ culprits.push( '<code><small>' + url.split( /\?/ )[ 0 ] + '</small></code>' );
1182
+ }
1183
+ } );
1184
+ errors.push( '<strong>' + self.getxt( 'js' ) + '</strong> ' + self.getxt( 'contact' ) );
1185
+ //if ( 1 == window.ctcAjax.is_debug ) {
1186
+ errors.push( self.jqueryerr.join( '<br/>' ) );
1187
+ //}
1188
+ if ( culprits.length ) {
1189
+ errors.push( self.getxt( 'jquery' ) + '<br/>' + culprits.join( '<br/>' ) );
1190
+ }
1191
+ errors.push( self.getxt( 'plugin' ) );
1192
+ }
1193
+ //return errors;
1194
+ self.set_notice( { 'error': errors } );
1195
+ },
1196
+ /*
1197
+ // test for jquery issues
1198
+
1199
+ $.each( jqueryerr, function( index, err ) {
1200
+ notice.hasnotice = 1;
1201
+ notice.style = 'error';
1202
+ notice.jquery += err;
1203
+ } );
1204
+ */
1205
+
1206
+
1207
+ update: {
1208
+ // render individual selector inputs on Query/Selector tab
1209
+ qsid: function( res ) {
1210
+ //console.log( res );
1211
+ var self = this,
1212
+ id, html, val, empty;
1213
+ self.currqsid = res.key;
1214
+ self.currdata = res.data;
1215
+ //console.log( 'update.qsid: ' + self.currqsid );
1216
+ $( '#ctc_sel_ovrd_qsid' ).val( self.currqsid );
1217
+ if ( self.is_empty( self.currdata.seq ) ) {
1218
+ $( '#ctc_child_load_order_container' ).empty();
1219
+ } else {
1220
+ id = 'ctc_ovrd_child_seq_' + self.currqsid;
1221
+ val = parseInt( self.currdata.seq );
1222
+ html = '<input type="text" id="' + id + '" name="' + id + '"' +
1223
+ ' class="ctc-child-value" value="' + val + '" />';
1224
+ $( '#ctc_child_load_order_container' ).html( html );
1225
+ }
1226
+ if ( self.is_empty( self.currdata.value ) ) {
1227
+ //console.log( 'qsdata is empty' );
1228
+ empty = true;
1229
+ $( '#ctc_sel_ovrd_rule_inputs' ).empty();
1230
+ } else {
1231
+ //console.log( 'qsdata NOT empty' );
1232
+ empty = false;
1233
+ html = '';
1234
+ $.each( self.currdata.value, function( rule, value ) {
1235
+ value = null;
1236
+ html += self.input_row( self.currqsid, rule, 'ovrd', self.currdata );
1237
+ } );
1238
+ $( '#ctc_sel_ovrd_rule_inputs' ).html( html ).find( '.color-picker' ).each( function() {
1239
+ self.setup_spectrum( this );
1240
+ } );
1241
+ self.coalesce_inputs( '#ctc_child_all_0_swatch' );
1242
+ }
1243
+ // if ( self.jqueryerr.length ) {
1244
+ // self.jquery_notice( 'update.qsid' );
1245
+ // } else {
1246
+ //console.log( 'reload menus: ' + ( self.reload ? 'true' : 'false' ) );
1247
+ if ( self.reload ) {
1248
+ self.load_queries();
1249
+ self.set_query( self.currdata.query );
1250
+ self.load_rules();
1251
+ }
1252
+ $( '#ctc_sel_ovrd_selector_selected' ).text( self.currdata.selector );
1253
+ $( '.ctc-rewrite-toggle' ).text( self.getxt( 'rename' ) );
1254
+ $( '.ctc-rewrite-toggle' ).show();
1255
+ if ( !empty ){
1256
+ $( '#ctc_sel_ovrd_rule_header,' +
1257
+ '#ctc_sel_ovrd_new_rule,' +
1258
+ '#ctc_sel_ovrd_rule_inputs_container,' +
1259
+ '#ctc_sel_ovrd_rule_inputs' ).show();
1260
+ } else {
1261
+ $( '#ctc_sel_ovrd_rule_header,' +
1262
+ '#ctc_sel_ovrd_new_rule,' +
1263
+ '#ctc_sel_ovrd_rule_inputs_container,' +
1264
+ '#ctc_sel_ovrd_rule_inputs' ).hide();
1265
+ }
1266
+ //self.scrolltop();
1267
+ // }
1268
+ },
1269
+ // render list of unique values for given rule on Property/Value tab
1270
+ rule_val: function( res ) {
1271
+ //console.log( 'update.rule_val: ' + res.key );
1272
+ //console.log( res.data );
1273
+ var self = this,
1274
+ rule = $( '#ctc_rule_menu_selected' ).text(),
1275
+ html = '<div class="ctc-input-row clearfix" id="ctc_rule_row_' + rule + '">' + "\n";
1276
+ //console.log( 'rule: ' + rule );
1277
+ if ( !self.is_empty( res.data ) ) {
1278
+ $.each( res.data, function( valid, value ) {
1279
+ var parentObj = self.decode_value( rule, value );
1280
+ html += '<div class="ctc-parent-row clearfix"' +
1281
+ ' id="ctc_rule_row_' + rule + '_' + valid + '">' + "\n" +
1282
+ '<div class="ctc-input-cell ctc-parent-value"' +
1283
+ ' id="ctc_' + valid + '_parent_' + rule + '_' + valid + '">' +
1284
+ parentObj.orig + '</div>' + "\n" +
1285
+ '<div class="ctc-input-cell">' + "\n" +
1286
+ '<div class="ctc-swatch ctc-specific"' +
1287
+ ' id="ctc_' + valid + '_parent_' + rule + '_' + valid + '_swatch">' +
1288
+ self.getxt( 'swatch' ) + '</div></div>' + "\n" +
1289
+ '<div class="ctc-input-cell">' +
1290
+ '<a href="#" class="ctc-selector-handle"' +
1291
+ ' id="ctc_selector_' + rule + '_' + valid + '">' +
1292
+ self.getxt( 'selector' ) + '</a></div>' + "\n" +
1293
+ '<div id="ctc_selector_' + rule + '_' + valid + '_container"' +
1294
+ ' class="ctc-selector-container">' + "\n" +
1295
+ '<a href="#" id="ctc_selector_' + rule + '_' + valid + '_close"' +
1296
+ ' class="ctc-selector-handle ctc-exit" title="' +
1297
+ self.getxt( 'close' ) + '"></a>' +
1298
+ '<div id="ctc_selector_' + rule + '_' + valid + '_inner_container"' +
1299
+ ' class="ctc-selector-inner-container clearfix">' + "\n" +
1300
+ '<div id="ctc_status_val_qry_' + valid + '"></div>' + "\n" +
1301
+ '<div id="ctc_selector_' + rule + '_' + valid + '_rows"></div>' + "\n" +
1302
+ '</div></div></div>' + "\n";
1303
+ } );
1304
+ html += '</div>' + "\n";
1305
+ }
1306
+ $( '#ctc_rule_value_inputs' ).html( html ).find( '.ctc-swatch' ).each( function() {
1307
+ self.coalesce_inputs( this );
1308
+ } );
1309
+ },
1310
+ // render list of selectors grouped by query for given value on Property/Value Tab
1311
+ val_qry: function( res ) {
1312
+ //console.log( 'in val_qry' );
1313
+ //console.log( res );
1314
+ var self = this,
1315
+ html = '',
1316
+ page_rule,
1317
+ selector;
1318
+ if ( !self.is_empty( res.data ) ) {
1319
+ $.each( res.data, function( rule, queries ) {
1320
+ page_rule = rule;
1321
+ $.each( queries, function( query, selectors ) {
1322
+ html += '<h4 class="ctc-query-heading">' + query + '</h4>' + "\n";
1323
+ if ( !self.is_empty( selectors ) ) {
1324
+ $.each( selectors, function( qsid, qsdata ) {
1325
+ html += self.input_row( qsid, rule, res.key, qsdata );
1326
+ } );
1327
+ }
1328
+ } );
1329
+ } );
1330
+ }
1331
+ selector = '#ctc_selector_' + page_rule + '_' + res.key + '_rows';
1332
+ //console.log( selector );
1333
+
1334
+ $( selector ).html( html ).find( '.color-picker' ).each( function() {
1335
+ self.setup_spectrum( this );
1336
+ } );
1337
+ $( selector ).find( '.ctc-swatch' ).each( function() {
1338
+ self.coalesce_inputs( this );
1339
+ } );
1340
+ // if ( self.jqueryerr.length ) {
1341
+ // self.jquery_notice( 'val_qry' );
1342
+ // }
1343
+ },
1344
+ // populate list of queries and attach to query input element
1345
+ queries: function( res ) {
1346
+ $( '#ctc_sel_ovrd_query' ).data( 'menu', res.data );
1347
+ },
1348
+ // populate list of selectors and attach to selector input element
1349
+ selectors: function( res ) {
1350
+ $( '#ctc_sel_ovrd_selector' ).data( 'menu', res.data );
1351
+ },
1352
+ // populate list of rules and attach to rule input element
1353
+ rules: function( res ) {
1354
+ $( '#ctc_rule_menu' ).data( 'menu', res.data );
1355
+ },
1356
+ // render debug output
1357
+ debug: function( res ) {
1358
+ $( '#ctc_debug_container' ).html( res.data );
1359
+ //console.log( 'debug:' );
1360
+ //console.log( res.data );
1361
+ },
1362
+ // render stylesheet preview on child or parent css tab
1363
+ preview: function( res ) {
1364
+ $( '#view_' + res.key + '_options_panel' ).text( res.data );
1365
+ },
1366
+ dismiss: function( res ) {
1367
+ //console.log( 'dismiss came home!' );
1368
+ //console.log( res );
1369
+ //var self = this;
1370
+ //self.dismiss_notice();
1371
+ }
1372
+
1373
+ },
1374
+ // applies core dismiss behavior to injected elements
1375
+ bind_dismiss: function( el ) {
1376
+ //console.log( 'bind_dismiss' );
1377
+ var self = this,
1378
+ $this = $( el ),
1379
+ $button = $( '<button type="button" class="notice-dismiss"><span class="screen-reader-text"></span></button>' ),
1380
+ btnText = window.commonL10n.dismiss || '';
1381
+
1382
+ // Ensure plain text
1383
+ $button.find( '.screen-reader-text' ).text( btnText );
1384
+
1385
+ $this.append( $button );
1386
+
1387
+ $button.on( 'click.wp-dismiss-notice', function( event ) {
1388
+ event.preventDefault();
1389
+ self.dismiss_notice( el );
1390
+ });
1391
+ },
1392
+ dismiss_notice: function( el ) {
1393
+ $( el ).fadeTo( 100 , 0, function() {
1394
+ $( this ).slideUp( 100, function() {
1395
+ $( this ).remove();
1396
+ });
1397
+ });
1398
+ },
1399
+ reset_handling: function() {
1400
+ //console.log( '----> resetting form...' );
1401
+ $( '#parnt_analysis_notice .notice, #child_analysis_notice .notice' ).slideUp();
1402
+ $( '#ctc_enqueue_enqueue' ).prop( 'checked', true );
1403
+ $( '#ctc_handling_primary' ).prop( 'checked', true );
1404
+ $( '#ctc_ignoreparnt' ).prop( 'checked', false );
1405
+ $( '#ctc_repairheader' ).prop( 'checked', false );
1406
+ },
1407
+ // initialize object vars, bind event listeners to elements, load menus and start plugin
1408
+ init: function() {
1409
+ //console.log( 'initializing...' )
1410
+ var self = this;
1411
+ // try to initialize theme menus
1412
+ if ( !$( '#ctc_theme_parnt' ).is( 'input' ) ) {
1413
+ //console.log( 'initializing theme select menus...' );
1414
+ try {
1415
+ $.widget( 'ctc.themeMenu', $.ui.selectmenu, {
1416
+ _renderItem: function( ul, item ) {
1417
+ var li = $( "<li>" ),
1418
+ sel = item.value.replace( /[^\w\-]/, '' );
1419
+ $( '#ctc_theme_option_' + sel )
1420
+ .detach().appendTo( li );
1421
+ return li.appendTo( ul );
1422
+ }
1423
+ } );
1424
+ } catch( exn ) {
1425
+ self.jquery_exception( exn, 'Theme Menu' );
1426
+ }
1427
+ try {
1428
+ $( '#ctc_theme_parnt' ).themeMenu( {
1429
+ select: function( event, ui ) {
1430
+ self.reset_handling();
1431
+ self.set_parent_menu( ui.item );
1432
+ }
1433
+ } );
1434
+ } catch( exn ) {
1435
+ if ( 'function' === typeof themeMenu ) {
1436
+ $( '#ctc_theme_parnt' ).themeMenu( 'destroy' );
1437
+ } else {
1438
+ $( '#ctc_theme_parnt-button' ).remove();
1439
+ }
1440
+ self.jquery_exception( exn, 'Parent Theme Menu' );
1441
+ }
1442
+ if ( self.is_empty( window.ctcAjax.themes.child ) ) {
1443
+ if ( $( '#ctc_child_name' ).length ) {
1444
+ $( '#ctc_child_name' ).val( self.testname );
1445
+ $( '#ctc_child_template' ).val( self.testslug );
1446
+ }
1447
+ } else {
1448
+ try {
1449
+ $( '#ctc_theme_child' ).themeMenu( {
1450
+ select: function( event, ui ) {
1451
+ self.reset_handling();
1452
+ self.set_child_menu( ui.item );
1453
+ }
1454
+ } );
1455
+ } catch( exn ) {
1456
+ if ( 'function' === typeof themeMenu ) {
1457
+ $( '#ctc_theme_child' ).themeMenu( 'destroy' );
1458
+ } else {
1459
+ $( '#ctc_theme_child-button' ).remove();
1460
+ }
1461
+ self.jquery_exception( exn, 'Child Theme Menu' );
1462
+ }
1463
+ }
1464
+ }
1465
+
1466
+ // auto populate parent/child tab values
1467
+ self.currparnt = $( '#ctc_theme_parnt' ).val();
1468
+ self.currchild = $( '#ctc_theme_child' ).length ? $( '#ctc_theme_child' ).val() : '';
1469
+ $( '#ctc_main' ).on( 'click', '.ctc-section-toggle', function( e ) {
1470
+ e.preventDefault();
1471
+ $( this ).parents( '.ctc-input-row, .notice-warning, .updated, .error' ).first().find( '.ctc-section-toggle' )
1472
+ .each( function() {
1473
+ $( this ).toggleClass( 'open' );
1474
+ } );
1475
+ var id = $( this ).attr( 'id' ).replace(/\d$/, '') + '_content';
1476
+ $( '#' + id ).stop().slideToggle( 'fast' );
1477
+ return false;
1478
+ } );
1479
+
1480
+ $( '#ctc_main' ).on( 'click', '.ctc-upgrade-notice .notice-dismiss', function() { // e ) {
1481
+ //console.log( 'dismiss upgrade clicked!' );
1482
+ //e.preventDefault();
1483
+ var postdata = {
1484
+ 'action': 'ctc_dismiss',
1485
+ '_wpnonce': $( '#_wpnonce' ).val()
1486
+ };
1487
+ self.ajax_post( 'dismiss', postdata );
1488
+ } );
1489
+
1490
+ if ( self.is_empty( self.jqueryerr ) ){
1491
+ //console.log( 'delegating event bindings...' )
1492
+ $( '#ctc_main' ).on( 'click', '.ctc-selector-handle', function( e ) {
1493
+ //'.ctc-option-panel-container'
1494
+ e.preventDefault();
1495
+ if ( $( this ).hasClass( 'ajax-pending' ) ) {
1496
+ return false;
1497
+ }
1498
+ $( this ).addClass( 'ajax-pending' );
1499
+ //set_notice( '' );
1500
+ var id = $( this ).attr( 'id' ).toString().replace( '_close', '' ),
1501
+ parts = id.toString().match( /_([^_]+)_(\d+)$/ ),
1502
+ rule,
1503
+ valid;
1504
+ if ( $( '#' + id + '_container' ).is( ':hidden' ) ) {
1505
+ if ( !self.is_empty( parts[ 1 ] ) && !self.is_empty( parts[ 2 ] ) ) {
1506
+ rule = parts[ 1 ];
1507
+ valid = parts[ 2 ];
1508
+ // retrieve selectors / values for individual value
1509
+ self.query_css( 'val_qry', valid, { 'rule': rule } );
1510
+ }
1511
+ }
1512
+ $( '#' + id + '_container' ).fadeToggle( 'fast' );
1513
+ $( '.ctc-selector-container' ).not( '#' + id + '_container' ).fadeOut( 'fast' );
1514
+ } );
1515
+
1516
+ $( '#ctc_main' ).on( 'click', '.ctc-save-input[type=button], .ctc-delete-input', function( e ) {
1517
+ e.preventDefault();
1518
+ if ( $( this ).hasClass( 'ajax-pending' ) ) {
1519
+ return false;
1520
+ }
1521
+ $( this ).addClass( 'ajax-pending' );
1522
+ self.save( this ); // refresh menus after updating data
1523
+ return false;
1524
+ } );
1525
+
1526
+ $( '#ctc_main' ).on( 'keydown', '.ctc-selector-container .ctc-child-value[type=text]', function( e ) {
1527
+ if ( 13 === e.which ) {
1528
+ //console.log( 'return key pressed' );
1529
+ var $obj = $( this ).parents( '.ctc-selector-row' ).find( '.ctc-save-input[type=button]' ).first();
1530
+ if ( $obj.length ) {
1531
+ e.preventDefault();
1532
+ //console.log( $obj.attr( 'id' ) );
1533
+ if ( $obj.hasClass( 'ajax-pending' ) ) {
1534
+ return false;
1535
+ }
1536
+ $obj.addClass( 'ajax-pending' );
1537
+ self.save( $obj );
1538
+ return false;
1539
+ }
1540
+ }
1541
+ } );
1542
+
1543
+ $( '#ctc_main' ).on( 'click', '.ctc-selector-edit', function( e ) {
1544
+ e.preventDefault();
1545
+ if ( $( this ).hasClass( 'ajax-pending' ) ) {
1546
+ return false;
1547
+ }
1548
+ $( this ).addClass( 'ajax-pending' );
1549
+ self.set_qsid( this );
1550
+ } );
1551
+
1552
+ $( '#ctc_main' ).on( 'click', '.ctc-rewrite-toggle', function( e ) {
1553
+ e.preventDefault();
1554
+ self.selector_input_toggle( this );
1555
+ } );
1556
+
1557
+ $( '#ctc_main' ).on( 'click', '#ctc_copy_selector', function( ) {
1558
+ var txt = $( '#ctc_sel_ovrd_selector_selected' ).text().trim();
1559
+ if ( !self.is_empty( txt ) ){
1560
+ $( '#ctc_new_selectors' ).val( $( '#ctc_new_selectors' ).val() + "\n" + txt + " {\n\n}" );
1561
+ }
1562
+ } );
1563
+
1564
+ $( '#ctc_configtype' ).on( 'change', function( ) {
1565
+ var val = $( this ).val();
1566
+ if ( self.is_empty( val ) || 'theme' === val ) {
1567
+ $( '.ctc-theme-only, .ctc-themeonly-container' ).removeClass( 'ctc-disabled' );
1568
+ $( '.ctc-theme-only, .ctc-themeonly-container input' ).prop( 'disabled', false );
1569
+ try {
1570
+ $( '#ctc_theme_parnt, #ctc_theme_child' ).themeMenu( 'enable' );
1571
+ } catch ( exn ) {
1572
+ self.jquery_exception( exn, 'Theme Menu' );
1573
+ }
1574
+ } else {
1575
+ $( '.ctc-theme-only, .ctc-themeonly-container' ).addClass( 'ctc-disabled' );
1576
+ $( '.ctc-theme-only, .ctc-themeonly-container input' ).prop( 'disabled', true );
1577
+ try {
1578
+ $( '#ctc_theme_parnt, #ctc_theme_child' ).themeMenu( 'disable' );
1579
+ } catch ( exn ) {
1580
+ self.jquery_exception( exn, 'Theme Menu' );
1581
+ }
1582
+ }
1583
+ } );
1584
+
1585
+ // these elements are not replaced so use direct selector events
1586
+ $( '.nav-tab' ).on( 'click', function( e ) {
1587
+ e.preventDefault();
1588
+ // clear the notice box
1589
+ //set_notice( '' );
1590
+ $( '.ctc-query-icon,.ctc-status-icon' ).remove();
1591
+ var id = '#' + $( this ).attr( 'id' );
1592
+ self.focus_panel( id );
1593
+ } );
1594
+
1595
+ $( '#view_child_options, #view_parnt_options' ).on( 'click', function( ){
1596
+ if ( $( this ).hasClass( 'ajax-pending' ) ) {
1597
+ return false;
1598
+ }
1599
+ $( this ).addClass( 'ajax-pending' );
1600
+ self.css_preview( $( this ).attr( 'id' ) );
1601
+ } );
1602
+
1603
+ $( '#ctc_load_form' ).on( 'submit', function() {
1604
+ return ( self.validate() );
1605
+ } );
1606
+
1607
+ $( '#ctc_query_selector_form' ).on( 'submit', function( e ) {
1608
+ e.preventDefault();
1609
+ var $this = $( '#ctc_save_query_selector' );
1610
+ if ( $this.hasClass( 'ajax-pending' ) ) {
1611
+ return false;
1612
+ }
1613
+ $this.addClass( 'ajax-pending' );
1614
+ self.save( $this ); // refresh menus after updating data
1615
+ return false;
1616
+ } );
1617
+
1618
+ $( '#ctc_rule_value_form' ).on( 'submit', function( e ) {
1619
+ //console.log( 'rule value empty submit' );
1620
+ e.preventDefault();
1621
+ return false;
1622
+ } );
1623
+
1624
+ // update interface for existing child theme
1625
+ $( '#ctc_child_type_new,#ctc_child_type_existing,#ctc_child_type_duplicate,#ctc_child_type_reset' )
1626
+ .on( 'focus click', function() {
1627
+ //console.log( 'child type clicked!' );
1628
+ self.reset_handling();
1629
+ self.update_form();
1630
+ } );
1631
+
1632
+ $( '#ctc_is_debug' ).on( 'change', function( ) {
1633
+ self.save( this );
1634
+ } );
1635
+
1636
+ $( '.ctc-live-preview' ).on( 'click', function( e ) {
1637
+ e.stopImmediatePropagation();
1638
+ e.preventDefault();
1639
+ document.location = $( this ).prop( 'href' );
1640
+ return false;
1641
+ } );
1642
+ //console.log( 'loading autoselect menus...' )
1643
+ // initialize autoselect menus
1644
+ self.setup_menus();
1645
+
1646
+ // turn on submit buttons (disabled until everything is loaded to prevent errors)
1647
+ //console.log( 'releasing submit buttons...' )
1648
+ $( 'input[type=submit], input[type=button]' ).prop( 'disabled', false );
1649
+ self.scrolltop();
1650
+ self.update_form();
1651
+ //console.log( 'Ready.' );
1652
+ }
1653
+ if ( self.jqueryerr.length ) {
1654
+ self.jquery_notice();
1655
+ }
1656
+ },
1657
+ // object properties
1658
+ testslug: '',
1659
+ testname: '',
1660
+ reload: false,
1661
+ currquery: 'base',
1662
+ currqsid: null,
1663
+ currdata: {},
1664
+ currparnt: '',
1665
+ currchild: '',
1666
+ existing: false,
1667
+ jqueryerr: [], // stores jquery exceptions thrown during init
1668
+ color_regx: '\\s+(\\#[a-f0-9]{3,6}|rgba?\\([\\d., ]+?\\)|hsla?\\([\\d%., ]+?\\)|[a-z]+)',
1669
+ border_regx: '(\\w+)(\\s+(\\w+))?',
1670
+ grad_regx: '(\\w+)'
1671
+
1672
+ };
1673
+ $.chldthmanalyze = {
1674
+ escrgx: function( str ) {
1675
+ return str.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
1676
+ },
1677
+
1678
+ trmcss: function( str ) {
1679
+ //console.log( 'trmcss: ' + str );
1680
+ return 'undefined' === typeof str ? '' : str.replace( /\-css$/, '' );
1681
+ },
1682
+ show_loading: function( resubmit ) {
1683
+ var template = $.chldthmcfg.existing ? 'child' : 'parnt',
1684
+ stylesheet = ( 'child' === template ? $.chldthmcfg.currchild : $.chldthmcfg.currparnt ),
1685
+ name = window.ctcAjax.themes[ template ][ stylesheet ].Name,
1686
+ notice = '<strong class="ctc_analyze_loading"><span class="spinner is-active"></span>' +
1687
+ $.chldthmcfg.getxt( resubmit ? 'anlz1' : 'anlz2' ) + ' ' + name + '...</strong>';
1688
+ self.noticediv = ( 'child' === template ? '' : '' );
1689
+ $( '#' + template + '_analysis_notice' ).html( notice );
1690
+ //$( 'html, body' ).animate( { scrollTop: 0 }, 'slow' );
1691
+ },
1692
+ hide_loading: function() {
1693
+ $( '.ctc_analyze_loading' ).fadeTo( 200, 0, function(){ $( this ).slideUp( 200, function() { $( this ).remove(); } ); } );
1694
+ },
1695
+ setssl: function( url ){
1696
+ return url.replace( /^https?/, window.ctcAjax.ssl ? 'https' : 'http' );
1697
+ },
1698
+ /**
1699
+ * Fetch website home page and parse <head> for linked stylesheets
1700
+ * Use this to store dependencies and to mark them to be parsed as "default" stylesheets
1701
+ * Detects other signals for configuration heuristics during child theme setup.
1702
+ */
1703
+ analyze_theme: function( template ) {
1704
+ //console.log( 'analyze_theme' );
1705
+ var self = this,
1706
+ //template = $.chldthmcfg.existing ? 'child' : 'parnt',
1707
+ stylesheet = ( 'child' === template ? $.chldthmcfg.currchild : $.chldthmcfg.currparnt ),
1708
+ testparams = '&template=' + $.chldthmcfg.currparnt + '&stylesheet=' + stylesheet,
1709
+ homeurl = self.setssl( window.ctcAjax.homeurl ),
1710
+ themepath = window.ctcAjax.theme_uri.replace( /^https?:\/\//, '' ),
1711
+ url = homeurl + testparams,
1712
+ escaped = self.escrgx( $.chldthmcfg.currparnt ) + ( 'child' === template ? '|' + self.escrgx( stylesheet ) : '' ),
1713
+ regex_link = new RegExp( "<link( rel=[\"']stylesheet[\"'] id=['\"]([^'\"]+?)['\"])?[^>]+?" +
1714
+ self.escrgx( themepath ) + '/(' + escaped + ')/(.+?\\.css)[^>]+?>', 'gi' ),
1715
+ regex_err = /<br \/>\n[^\n]+?(fatal|strict|notice|warning|error)[\s\S]+?<br \/>/gi,
1716
+ msg,
1717
+ queue,
1718
+ csslink,
1719
+ themeloaded = 0, // flag when style.css link is detected
1720
+ testloaded = 0, // flag when test link is detected
1721
+ analysis = {
1722
+ deps: [[],[]],
1723
+ signals: {
1724
+ /*
1725
+ err_fatal: 0,
1726
+ err_fnf: 0,
1727
+ err_other: 0,
1728
+ ctc_sep_loaded: 0,
1729
+ ctc_ext_loaded: 0,
1730
+ ctc_child_loaded: 0,
1731
+ ctc_parnt_loaded: 0,
1732
+ thm_past_wphead: 0,
1733
+ thm_unregistered: 0,
1734
+ thm_parnt_loaded: 0,
1735
+ thm_child_loaded: 0,
1736
+ thm_is_ctc: 0,
1737
+ thm_has_styles: 0,
1738
+ thm_notheme: 0
1739
+ */
1740
+ },
1741
+ queue: []
1742
+ };
1743
+
1744
+ //console.log( 'Fetching home page: ' + url );
1745
+ $.get( url, function( data ) {
1746
+
1747
+ // console.log( data );
1748
+ // retrieve enqueued stylesheet ids
1749
+ if ( ( queue = data.match( /BEGIN WP QUEUE\n([\n\w\-\.]*?)END WP QUEUE/ ) ) ) {
1750
+ analysis.queue = queue[ 1 ].split(/\n/);
1751
+ //console.log( 'QUEUE:' );
1752
+ //console.log( analysis.queue );
1753
+ } else {
1754
+ //console.log( 'NO QUEUE' );
1755
+ analysis.queue = [];
1756
+ analysis.signals.thm_noqueue = 1;
1757
+ //analysis.signals.failure = 1;
1758
+ }
1759
+ if ( data.match( /<!\-\- CHLD_THM_CFG_IGNORE_PARENT \-\->/ ) ) {
1760
+ analysis.signals.thm_ignoreparnt = 1;
1761
+ }
1762
+
1763
+ if ( data.match( /<!\-\- IS_CTC_THEME \-\->/ ) ) {
1764
+ analysis.signals.thm_is_ctc = 1;
1765
+ }
1766
+
1767
+ if ( data.match( /<!\-\- HAS_CTC_STYLES \-\->/ ) ) {
1768
+ analysis.signals.thm_has_styles = 1;
1769
+ }
1770
+ if ( data.match( /<!\-\- HAS_CTC_IMPORT \-\->/ ) ) {
1771
+ analysis.signals.thm_has_import = 1;
1772
+ }
1773
+
1774
+ // remove comments to avoid flagging conditional stylesheets ( IE compatability, etc. )
1775
+ data = data.replace( /<!\-\-[\s\S]*?\-\->/g, '' );
1776
+ //console.log( 'PARSE:' );
1777
+ while ( ( msg = regex_err.exec( data ) ) ) {
1778
+ var errstr = msg[ 0 ].replace( /<.*?>/g, '' );
1779
+ self.phperr[ template ].push( errstr );
1780
+ analysis.signals.err_php = 1;
1781
+ if ( errstr.match( /Fatal error/i ) ) {
1782
+ analysis.signals.err_fatal = 1;
1783
+ } else if ( errstr.match( /(FileNotFoundException|Failed opening|failed to open stream)/i ) ) {
1784
+ analysis.signals.err_fnf = 1;
1785
+ }
1786
+ }
1787
+ while ( ( csslink = regex_link.exec( data ) ) ) {
1788
+ //console.log( csslink );
1789
+ var stylesheetid = self.trmcss( csslink[ 2 ] ),
1790
+ stylesheettheme = csslink[ 3 ],
1791
+ stylesheetpath = csslink[ 4 ],
1792
+ linktheme = $.chldthmcfg.currparnt === stylesheettheme ? 'parnt' : 'child',
1793
+ noid = 0;
1794
+ //console.log( 'stylesheetid: ' + stylesheetid );
1795
+ // flag stylesheet links that have no id or are not in wp_styles
1796
+ if ( '' === stylesheetid || -1 === $.inArray( stylesheetid, analysis.queue ) ) {
1797
+ noid = 1;
1798
+ //console.log( 'no id for ' + stylesheetpath + '!' );
1799
+ } else if ( 0 === stylesheetid.indexOf( 'chld_thm_cfg' ) ) { // handle ctc-generated links
1800
+ // console.log( 'ctc link detected: ' + stylesheetid + ' themeloaded: ' + themeloaded );
1801
+ if ( stylesheetpath.match( /^ctc\-style([\-\.]min)?\.css$/ ) ) {
1802
+ //console.log( 'separate stylesheet detected' );
1803
+ themeloaded = 1;
1804
+ analysis.signals.ctc_sep_loaded = 1; // flag that separate stylesheet has been detected
1805
+ } else if ( stylesheetpath.match( /^ctc\-genesis([\-\.]min)?\.css$/ ) ) {
1806
+ //console.log( 'genesis stylesheet detected' );
1807
+ themeloaded = 1;
1808
+ analysis.signals.ctc_gen_loaded = 1; // flag that genesis "parent" has been detected
1809
+ } else if ( stylesheetid.match( /$chld_thm_cfg_ext/ ) ) {
1810
+ analysis.signals.ctc_ext_loaded = 1; // flag that external stylesheet link detected
1811
+ analysis.deps[ themeloaded ].push( [ stylesheetid, stylesheetpath ] );
1812
+ } else if ( 'chld_thm_cfg_child' === stylesheetid ) {
1813
+ analysis.signals.ctc_child_loaded = 1; // flag that ctc child stylesheet link detected
1814
+ analysis.deps[ themeloaded ].push( [ stylesheetid, stylesheetpath ] );
1815
+ } else if ( 'chld_thm_cfg_parent' === stylesheetid ) {
1816
+ analysis.signals.ctc_parnt_loaded = 1; // flag that ctc parent stylesheet link detected
1817
+ analysis.deps[ themeloaded ].push( [ stylesheetid, stylesheetpath ] );
1818
+ if ( themeloaded ){
1819
+ //console.log( 'parent link out of sequence' );
1820
+ analysis.signals.ctc_parnt_reorder = 1; // flag that ctc parent stylesheet link out of order
1821
+ }
1822
+ }
1823
+ continue;
1824
+ }
1825
+ // flag main theme stylesheet link
1826
+ if ( stylesheetpath.match( /^style([\-\.]min)?\.css$/ ) ) {
1827
+ //console.log( linktheme + ' theme stylesheet detected: ' + stylesheettheme + '/' + stylesheetpath );
1828
+ themeloaded = 1; // flag that main theme stylesheet has been detected
1829
+ // if main theme stylesheet link has no id then it is unregistered ( hard-wired )
1830
+ if ( 'parnt' === linktheme ) {
1831
+ analysis.signals.thm_parnt_loaded = noid ? 'thm_unregistered' : stylesheetid;
1832
+ } else {
1833
+ analysis.signals.thm_child_loaded = noid ? 'thm_unregistered' : stylesheetid;
1834
+ }
1835
+ if ( noid ) {
1836
+ if ( testloaded ) {
1837
+ analysis.signals.thm_past_wphead = 1;
1838
+ analysis.deps[ themeloaded ].push( [ 'thm_past_wphead', stylesheetpath ] );
1839
+ //console.log( 'Unreachable theme stylesheet detected' );
1840
+ } else {
1841
+ analysis.signals.thm_unregistered = 1;
1842
+ analysis.deps[ themeloaded ].push( [ 'thm_unregistered', stylesheetpath ] );
1843
+ //console.log( 'Unregistered theme stylesheet detected' );
1844
+ }
1845
+ } else {
1846
+ analysis.deps[ themeloaded ].push( [ stylesheetid, stylesheetpath ] );
1847
+ //console.log( 'Theme stylesheet OK!' );
1848
+ }
1849
+
1850
+ } else if ( 'ctc-test.css' === stylesheetpath ) { // flag test stylesheet link
1851
+ //console.log( 'end of queue reached' );
1852
+ testloaded = 1; // flag that test queue has been detected ( end of wp_head )
1853
+ } else {
1854
+ var err = null;
1855
+ // if stylesheet link has id and loads before main theme stylesheet, add it as a dependency
1856
+ // otherwise add it as a parse option
1857
+ if ( noid ) {
1858
+ err = 'dep_unregistered';
1859
+ }
1860
+ if ( testloaded ) {
1861
+ if ( themeloaded ) {
1862
+ //console.log( 'Unreachable stylesheet detected!' + stylesheetpath );
1863
+ err = 'css_past_wphead';
1864
+ } else {
1865
+ err = 'dep_past_wphead';
1866
+ }
1867
+ }
1868
+ // Flag stylesheet links that have no id and are loaded after main theme stylesheet.
1869
+ // This indicates loading outside of wp_head()
1870
+ if ( err ) {
1871
+ analysis.signals[ err ] = 1;
1872
+ stylesheetid = err;
1873
+ }
1874
+ analysis.deps[ themeloaded ].push( [ stylesheetid, stylesheetpath ] );
1875
+ }
1876
+ }
1877
+ if ( ! themeloaded ){
1878
+ analysis.signals.thm_notheme = 1; // flag that no theme stylesheet has been detected
1879
+ }
1880
+ data = null; // send page to garbage
1881
+ self.analysis[ template ] = analysis;
1882
+ $( document ).trigger( 'analysisdone' );
1883
+ } ).fail( function(){
1884
+ analysis.signals.failure = 1;
1885
+ self.analysis[ template ] = analysis;
1886
+ $( document ).trigger( 'analysisdone' );
1887
+ } );
1888
+ },
1889
+
1890
+ /**
1891
+ * Uses analysis data to auto configure form, pass parameters
1892
+ * for child theme setup and display results to user.
1893
+ */
1894
+ css_notice: function() {
1895
+ //console.log( 'in css_notice' );
1896
+ var self = this,
1897
+ template = $.chldthmcfg.existing ? 'child' : 'parnt',
1898
+ stylesheet = ( 'child' === template ? $.chldthmcfg.currchild : $.chldthmcfg.currparnt ),
1899
+ name = window.ctcAjax.themes[ template ][ stylesheet ].Name,
1900
+ hidden = '',
1901
+ notice = {
1902
+ notices: [],
1903
+ },
1904
+ errnotice = {
1905
+ style: 'notice-warning',
1906
+ headline: $.chldthmcfg.getxt( 'anlz3', name ),
1907
+ errlist: ''
1908
+ },
1909
+ resubmit = 0,
1910
+ resubmitdata= {},
1911
+ anlz;
1912
+ // legacy support for Pro
1913
+ $( window.ctcAjax.addl_css ).each( function( ndx, el ) {
1914
+ $( '#ctc_stylesheet_files .ctc_checkbox' ).each( function() {
1915
+ //console.log( 'plugin stylesheet match' );
1916
+ if ( el === $( this ).val() ) { $( this ).prop( 'checked', true ); }
1917
+ } );
1918
+ } );
1919
+
1920
+ if ( self.analysis[ template ].signals.failure ||
1921
+ ( self.analysis[ template ].signals.thm_noqueue && !self.phperr[ template ].length ) ) {
1922
+ notice.notices.push( {
1923
+ headline: $.chldthmcfg.getxt( 'anlz4', name ),
1924
+ msg: $.chldthmcfg.getxt( 'anlz5' ),
1925
+ style: 'error'
1926
+ } );
1927
+ } else {
1928
+ // test errors
1929
+ if ( self.phperr[ template ].length ) {
1930
+ $.each( self.phperr[ template ], function( index, err ) {
1931
+ if ( err.match( /Fatal error/i ) ) {
1932
+ errnotice.style = 'error';
1933
+ errnotice.headline = $.chldthmcfg.getxt( 'anlz8', name );
1934
+ }
1935
+ /*
1936
+ if ( $.chldthmcfg.existing && err.match( /(FileNotFoundException|Failed opening|failed to open stream)/i ) ) {
1937
+ //console.log( 'Probably using get_stylesheet_directory()' );
1938
+ notice.subhead = 'A file cannot be found in the Child Theme\'s directory.';
1939
+ }
1940
+ */
1941
+ errnotice.errlist += err + "\n";
1942
+ } );
1943
+ errnotice.msg = '<div style="background-color:#ffeebb;padding:6px">' +
1944
+ '<div class="ctc-section-toggle" id="ctc_analysis_errs">' +
1945
+ $.chldthmcfg.getxt( 'anlz6' ) + '</div>' +
1946
+ '<div id="ctc_analysis_errs_content" style="display:none"><textarea>' +
1947
+ errnotice.errlist + '</textarea></div></div>' +
1948
+ $.chldthmcfg.getxt( 'anlz7' );
1949
+ notice.notices.push( errnotice );
1950
+ }
1951
+ if ( self.analysis[ template ].signals.thm_past_wphead || self.analysis[ template ].signals.dep_past_wphead ) {
1952
+ // || self.analysis[ template ].signals.css_past_wphead ){
1953
+ notice.notices.push( {
1954
+ headline: $.chldthmcfg.getxt( 'anlz9' ),
1955
+ style: 'notice-warning',
1956
+ msg: $.chldthmcfg.getxt( 'anlz10' )
1957
+ } );
1958
+ $( '#ctc_repairheader' ).prop( 'checked', true );
1959
+ $( '#ctc_repairheader_container' ).show();
1960
+ }
1961
+ if ( self.analysis[ template ].signals.thm_unregistered ) {
1962
+ if (
1963
+ !self.analysis[ template ].signals.ctc_child_loaded &&
1964
+ !self.analysis[ template ].signals.ctc_sep_loaded ){
1965
+ // test for stylesheet enqueue issues
1966
+ notice.notices.push( {
1967
+ headline: $.chldthmcfg.getxt( 'anlz11' ),
1968
+ style: 'notice-warning',
1969
+ msg: $.chldthmcfg.getxt( 'anlz12' )
1970
+ } );
1971
+ $( '#ctc_repairheader_container' ).show();
1972
+ $( '#ctc_repairheader' ).prop( 'checked', true );
1973
+ }
1974
+ }
1975
+ if ( 'child' === template ) {
1976
+ if ( self.analysis.child.signals.ctc_parnt_reorder ) {
1977
+ //console.log( 'reorder flag detected, resubmitting.' );
1978
+ resubmit = 1;
1979
+ }
1980
+ if ( !self.analysis.child.signals.ctc_child_loaded &&
1981
+ !self.analysis.child.signals.ctc_sep_loaded &&
1982
+ !self.analysis.child.signals.thm_child_loaded ){
1983
+ notice.notices.push( {
1984
+ headline: $.chldthmcfg.getxt( 'anlz13' ),
1985
+ style: 'notice-warning',
1986
+ msg: $.chldthmcfg.getxt( 'anlz14' )
1987
+ } );
1988
+ resubmit = 1;
1989
+ }
1990
+ if ( self.analysis[ template ].signals.ctc_gen_loaded ) {
1991
+ notice.notices.push( {
1992
+ headline: $.chldthmcfg.getxt( 'anlz31' ),
1993
+ msg: $.chldthmcfg.getxt( 'anlz32' ),
1994
+ style: 'notice-warning'
1995
+ } );
1996
+ }
1997
+ if ( self.analysis.parnt.signals.thm_has_styles &&
1998
+ !self.analysis.child.signals.ctc_gen_loaded &&
1999
+ !self.analysis.child.signals.thm_parnt_loaded &&
2000
+ !self.analysis.child.signals.ctc_parnt_loaded &&
2001
+ !self.analysis.child.signals.thm_ignoreparnt &&
2002
+ !self.analysis.child.signals.thm_has_import ){
2003
+ notice.notices.push( {
2004
+ headline: $.chldthmcfg.getxt( 'anlz15' ),
2005
+ style: 'notice-warning',
2006
+ msg: $.chldthmcfg.getxt( 'anlz16' )
2007
+ } );
2008
+ resubmit = 1;
2009
+ }
2010
+ if ( self.analysis.child.signals.thm_unregistered &&
2011
+ self.analysis.child.signals.thm_child_loaded &&
2012
+ 'thm_unregistered' === self.analysis.child.signals.thm_child_loaded &&
2013
+ self.analysis.child.signals.ctc_child_loaded &&
2014
+ self.analysis.child.signals.ctc_parnt_loaded ) {
2015
+ notice.notices.push( {
2016
+ headline: $.chldthmcfg.getxt( 'anlz28' ),
2017
+ style: 'notice-warning',
2018
+ msg: $.chldthmcfg.getxt( 'anlz29' )
2019
+ } );
2020
+ $( '#ctc_repairheader_container' ).show();
2021
+ $( '#ctc_repairheader' ).prop( 'checked', true );
2022
+ }
2023
+
2024
+ if ( !self.analysis.child.signals.thm_is_ctc &&
2025
+ !$( '#ctc_child_type_duplicate' ).is( ':checked' ) ) {
2026
+ notice.notices.push( {
2027
+ headline: $.chldthmcfg.getxt( 'anlz19' ),
2028
+ msg: $.chldthmcfg.getxt( 'anlz20' ),
2029
+ style: 'notice-warning'
2030
+ } );
2031
+ }
2032
+ }
2033
+ // automatically set form inputs based on current analysis
2034
+ if ( self.analysis[ template ].signals.ctc_sep_loaded || self.analysis[ template ].signals.ctc_gen_loaded ){
2035
+ //console.log( 'Separate stylesheet detected' );
2036
+ $( '#ctc_handling_separate' ).prop( 'checked', true );
2037
+ }
2038
+ if ( !notice.notices.length ) {
2039
+ notice.notices.push( {
2040
+ headline: '' + ( 'child' === template ? $.chldthmcfg.getxt( 'anlz17' ) : $.chldthmcfg.getxt( 'anlz18' ) ) + '',
2041
+ style: 'updated',
2042
+ msg: ''
2043
+ } );
2044
+ }
2045
+
2046
+ if ( 'child' === template && self.analysis.child.signals.thm_has_import ) {
2047
+ notice.notices.push( {
2048
+ headline: $.chldthmcfg.getxt( 'anlz21' ),
2049
+ msg: $.chldthmcfg.getxt( 'anlz22' ),
2050
+ style: 'notice-warning'
2051
+ } );
2052
+ //console.log( 'Import parent detected' );
2053
+ $( '#ctc_enqueue_import' ).prop( 'checked', true );
2054
+ }
2055
+ if ( self.analysis[ template ].signals.thm_ignoreparnt || self.analysis[ template ].signals.ctc_gen_loaded ){
2056
+ //console.log( 'Ignore parent detected' );
2057
+ $( '#ctc_ignoreparnt' ).prop( 'checked', true );
2058
+ if ( !$( '#ctc_enqueue_none' ).is( ':checked' ) ) {
2059
+ $( '#ctc_enqueue_none' ).prop( 'checked', true );
2060
+ resubmit = 1;
2061
+ resubmitdata.ctc_enqueue = 'none';
2062
+ }
2063
+ } else {
2064
+ $( '#ctc_ignoreparnt' ).prop( 'checked', false );
2065
+ }
2066
+ if ( !self.analysis[ template ].signals.ctc_sep_loaded &&
2067
+ !self.analysis[ template ].signals.ctc_gen_loaded &&
2068
+ !self.analysis[ template ].signals.ctc_child_loaded &&
2069
+ !self.analysis[ template ].signals.thm_unregistered &&
2070
+ !self.analysis[ template ].signals.thm_past_wphead &&
2071
+ self.analysis[ template ].deps[ 1 ].length ) {
2072
+ var sheets = '';
2073
+ $.each( self.analysis[ template ].deps[ 1 ], function( ndx, el ) {
2074
+ if ( el[ 1 ].match( /^style([\-\.]min)?\.css$/ ) ) { return; }
2075
+ sheets += '<li>' + el[ 1 ] + "</li>\n";
2076
+ } );
2077
+ if ( '' !== sheets ) {
2078
+ sheets = "<ul class='howto' style='padding-left:1em'>\n" + sheets + "</ul>\n";
2079
+ notice.notices.push( {
2080
+ headline: $.chldthmcfg.getxt( 'anlz23' ),
2081
+ msg: sheets + $.chldthmcfg.getxt( 'anlz24' ),
2082
+ style: 'updated'
2083
+ } );
2084
+ }
2085
+ }
2086
+ if ( 'child' === template && self.analysis[ template ].signals.thm_parnt_loaded ) {
2087
+ //if ( !$( '#ctc_enqueue_none' ).is( ':checked' ) ) {
2088
+ notice.notices.push( {
2089
+ headline: $.chldthmcfg.getxt( 'anlz25' ),
2090
+ msg: $.chldthmcfg.getxt( 'anlz26' ),
2091
+ style: 'updated'
2092
+ } );
2093
+ //}
2094
+ $( '#ctc_enqueue_none' ).prop( 'checked', true );
2095
+ resubmit = 1;
2096
+ resubmitdata.ctc_enqueue = 'none';
2097
+ }
2098
+ // if no parent styles, no need to enqueue
2099
+ if ( !self.analysis.parnt.signals.thm_has_styles ) {
2100
+ //if ( !$( '#ctc_enqueue_none' ).is( ':checked' ) ) {
2101
+ notice.notices.push( {
2102
+ headline: $.chldthmcfg.getxt( 'anlz27' ),
2103
+ msg: $.chldthmcfg.getxt( 'anlz26' ),
2104
+ style: 'updated'
2105
+ } );
2106
+ //}
2107
+ $( '#ctc_enqueue_none' ).prop( 'checked', true );
2108
+ resubmit = 1;
2109
+ resubmitdata.ctc_enqueue = 'none';
2110
+ }
2111
+ }
2112
+
2113
+ /**
2114
+ * Auto-configure parameters
2115
+ * Some configuration must be done based on theme-specific signals
2116
+ * These are passed back as hidden inputs
2117
+ */
2118
+ // parent has styles
2119
+ hidden = encodeURIComponent( JSON.stringify( self.analysis ) );
2120
+
2121
+ $( 'input[name="ctc_analysis"]' ).val( hidden );
2122
+ resubmitdata.ctc_analysis = hidden;
2123
+ if ( self.is_success() && resubmit && !self.resubmitting ){
2124
+ self.resubmitting = 1;
2125
+ self.resubmit( resubmitdata );
2126
+ return;
2127
+ } else {
2128
+ self.resubmitting = 0;
2129
+ self.hide_loading();
2130
+ $.each( notice.notices, function( ndx, notice ){
2131
+ //console.log( notice );
2132
+ var $out = $( '<div class="' + notice.style + ' notice is-dismissible dashicons-before" >' +
2133
+ '<h4>' + notice.headline + '</h4>' +
2134
+ notice.msg +
2135
+ '</div>' );
2136
+ $.chldthmcfg.bind_dismiss( $out );
2137
+ $out.hide().appendTo( '#' + template + '_analysis_notice' ).slideDown();
2138
+ } );
2139
+
2140
+ if ( $( '#ctc_is_debug' ).is( ':checked' ) ) {
2141
+ anlz = '<div style="background-color:#ddd;padding:6px">' +
2142
+ '<div class="ctc-section-toggle" id="ctc_analysis_obj">' +
2143
+ $.chldthmcfg.getxt( 'anlz30' ) +
2144
+ '</div>' +
2145
+ '<div id="ctc_analysis_obj_content" style="display:none">' +
2146
+ '<textarea style="font-family:monospace;font-size:10px">' +
2147
+ JSON.stringify( self.analysis, null, 2 ) +
2148
+ '</textarea></div></div>';
2149
+
2150
+ $( anlz ).appendTo( '#' + template + '_analysis_notice' );
2151
+
2152
+ }
2153
+
2154
+ if ( !$( '#ctc_child_type_reset' ).is( ':checked' ) ) {
2155
+ $( '#input_row_stylesheet_handling_container,#input_row_parent_handling_container,#ctc_child_header_parameters,#ctc_configure_submit' ).slideDown( 'fast' );
2156
+ if ( $( '#ctc_child_type_duplicate' ).is( ':checked' ) ) {
2157
+ $( '#ctc_configure_submit .ctc-step' ).text( '8' );
2158
+ $( '#ctc_copy_theme_mods' ).find( 'input' ).prop( 'checked', false );
2159
+ } else {
2160
+ $( '#ctc_configure_submit .ctc-step' ).text( '9' );
2161
+ $( '#ctc_copy_theme_mods' ).slideDown( 'fast' );
2162
+ }
2163
+ if ( $( '#ctc_child_type_duplicate' ).is( ':checked' ) || $( '#ctc_child_type_new' ).is( ':checked' ) ) {
2164
+ $( '#input_row_theme_slug' ).hide();
2165
+ $( '#input_row_new_theme_slug' ).slideDown( 'fast' );
2166
+ } else {
2167
+ $( '#input_row_new_theme_slug' ).hide();
2168
+ $( '#input_row_theme_slug' ).slideDown( 'fast' );
2169
+ }
2170
+ }
2171
+
2172
+ //console.log( 'end css_notice' );
2173
+ }
2174
+
2175
+ },
2176
+ resubmit: function( data ) {
2177
+ var self = this;
2178
+ self.hide_loading();
2179
+ self.show_loading( true );
2180
+ data.action = 'ctc_update';
2181
+ data._wpnonce = $( '#_wpnonce' ).val();
2182
+ //console.log( '=====>>> RESUBMIT CALLED! <<<=====' );
2183
+ //console.log( data );
2184
+ $.ajax( {
2185
+ url: window.ctcAjax.ajaxurl,
2186
+ data: data,
2187
+ //dataType: 'json',
2188
+ type: 'POST'
2189
+ } ).done( function( response ) {
2190
+ //console.log( 'resubmit done:' );
2191
+ //console.log( response );
2192
+ self.hide_loading();
2193
+ self.do_analysis();
2194
+ } ).fail( function( xhr, status, err ) {
2195
+ //self.do_analysis();
2196
+ self.hide_loading();
2197
+ //console.log( status + ' ' + err );
2198
+ // FIXME: handle failure
2199
+ } );
2200
+ },
2201
+ do_analysis: function() {
2202
+ var self = this;
2203
+ self.analysis = { parnt: {}, child: {} };
2204
+ self.phperr = { parnt: [], child: [] };
2205
+ self.done = 0;
2206
+ self.show_loading( false );
2207
+ self.analyze_theme( 'parnt' );
2208
+ if ( $.chldthmcfg.existing ) {
2209
+ self.analyze_theme( 'child' );
2210
+ }
2211
+ //$( '#ctc_enqueue_enqueue' ).prop( 'checked', true );
2212
+ //$( '#ctc_handling_primary' ).prop( 'checked', true );
2213
+ //$( '#ctc_ignoreparent' ).prop( 'checked', false );
2214
+ },
2215
+ // initialize object vars, bind event listeners to elements, load menus and start plugin
2216
+ init: function() {
2217
+ //console.log( 'initializing...' )
2218
+ var self = this;
2219
+ // ajax request done
2220
+ $( document ).on( 'analysisdone', function(){
2221
+ self.done++;
2222
+ //console.log( 'analysis came home ' + self.done );
2223
+ //console.log( 'existing: ' + $.chldthmcfg.existing );
2224
+ //console.log( 'parent: ' + $( '#ctc_theme_parnt' ).val() );
2225
+ // all ajax requests done
2226
+ if ( self.done > $.chldthmcfg.existing ){
2227
+ //console.log( 'analysis complete!' );
2228
+ self.done = 0;
2229
+ self.css_notice();
2230
+ }
2231
+ } );
2232
+ // run analyzer on demand
2233
+ $( '#ctc_main' ).on( 'click', '.ctc-analyze-theme', function() {
2234
+ if ( self.is_success() ) {
2235
+ $.chldthmcfg.dismiss_notice( $( '.ctc-success-response' ).parent( '.notice' ) );
2236
+ }
2237
+ self.do_analysis();
2238
+ } );
2239
+ // if page is success response run the analyzer on load
2240
+ if ( self.is_success() || window.ctcAjax.pluginmode ) {
2241
+ self.do_analysis();
2242
+ }
2243
+ },
2244
+ analysis: {}, // analysis signals object
2245
+ done: 0, // analysis semphore
2246
+ resubmitting: 0, // resubmit semaphore
2247
+ is_success: function(){
2248
+ return $( '.ctc-success-response' ).length;
2249
+ }
2250
+ };
2251
+ // don't initialize if this is FTP request
2252
+ if (!$( '#request-filesystem-credentials-form' ).length ){
2253
+ $.chldthmcfg.init();
2254
+ $.chldthmanalyze.init();
2255
+ }
2256
+ } ( jQuery ) );
2257
+
js/chldthmcfg.min.js ADDED
@@ -0,0 +1,2 @@
 
 
1
+ !function(e){"use strict";e.chldthmcfg={escquo:function(e){var t=this;return t.is_empty(e)?e:e.toString().replace(/"/g,"&quot;")},getxt:function(e,t){var c=window.ctcAjax[e+"_txt"];return c?(t&&(c=c.replace(/%s/,t)),c):""},frascii:function(e){var t=parseInt(e),c=String.fromCharCode(t);return c},toascii:function(e){var t=e.charCodeAt(0);return t},is_empty:function(e,t){if("undefined"==typeof e||!1===e||null===e||""===e)return!0;if("undefined"!=typeof t&&"0"===e||0===e)return!0;if(!0===e||"string"==typeof e||"number"==typeof e)return!1;if("object"==typeof e){for(var c in e)if(e.hasOwnProperty(c))return!1;return!0}return!1},theme_exists:function(t,c){var n=!1;return e.each(window.ctcAjax.themes,function(i,s){return e.each(s,function(e,s){return s=null,e.toLowerCase()!==t.toLowerCase()||"parnt"!==i&&"new"!==c?void 0:(n=!0,!1)}),n?!1:void 0}),n},validate:function(){var t=this,c=/[^\w\-]/,n=e("#ctc_child_template").length?e("#ctc_child_template").val().toString().replace(c):"",i=e("#ctc_theme_child").length?e("#ctc_theme_child").val().toString().replace(c):n,s=e("input[name=ctc_child_type]:checked").val(),a=[];return"new"===s&&(i=n),t.theme_exists(i,s)&&a.push(t.getxt("theme_exists").toString().replace(/%s/,i)),t.is_empty(i)&&a.push(t.getxt("inval_theme")),a.length?(t.set_notice({error:a}),!1):"reset"===s?confirm(t.getxt("load"))?!0:!1:!0},autogen_slugs:function(){if(e("#ctc_theme_parnt").length){for(var t=this,c=e("#ctc_theme_parnt").val(),n=c+"-child",i=n,s=window.ctcAjax.themes.parnt[c].Name+" Child",a="",l="",r="00";t.theme_exists(i,"new");)a=t.is_empty(a)?2:a+1,l=r.substring(0,r.length-a.toString().length)+a.toString(),i=n+l;t.testslug=i,t.testname=s+(l.length?" "+l:"")}},focus_panel:function(t){var c=t+"_panel";e(".nav-tab").removeClass("nav-tab-active"),e(".ctc-option-panel").removeClass("ctc-option-panel-active"),e(t).addClass("nav-tab-active"),e(".ctc-option-panel-container").scrollTop(0),e(c).addClass("ctc-option-panel-active")},selector_input_toggle:function(t){var c,n=this;e("#ctc_rewrite_selector").length?(c=e("#ctc_rewrite_selector_orig").val(),e("#ctc_sel_ovrd_selector_selected").text(c),e(t).text(n.getxt("rename"))):(c=e("#ctc_sel_ovrd_selector_selected").text(),e("#ctc_sel_ovrd_selector_selected").html('<textarea id="ctc_rewrite_selector" name="ctc_rewrite_selector" autocomplete="off"></textarea><input id="ctc_rewrite_selector_orig" name="ctc_rewrite_selector_orig" type="hidden" value="'+n.escquo(c)+'"/>'),e("#ctc_rewrite_selector").val(c),e(t).text(n.getxt("cancel")))},coalesce_inputs:function(t){var c=this,n=e(t).attr("id"),i=/^(ctc_(ovrd|\d+)_(parent|child)_([0-9a-z\-]+)_(\d+?)(_(\d+))?)(_\w+)?$/,s=e(t).parents(".ctc-selector-row, .ctc-parent-row").first(),a=s.find(".ctc-swatch").first(),l={parent:{},child:{}},r={parent:{origin:"",start:"",end:""},child:{origin:"",start:"",end:""}},o={child:!1,parent:!1},_={};return s.find(".ctc-parent-value, .ctc-child-value").each(function(){var t,s,a=e(this).attr("id"),d=a.toString().match(i),u=d[2],h=d[3],p="undefined"==typeof d[4]?"":d[4],m=d[7],g=d[5],f="undefined"==typeof d[7]?"":d[8],v="parent"===h?e(this).text().replace(/!$/,""):"seq"!==p&&"ctc_delete_query_selector"===n?"":e(this).val(),y="seq"===p?!1:"ctc_"+u+"_child_"+p+"_i_"+g+"_"+m;if("child"===h&&(c.is_empty(e(this).data("color"))||(v=c.color_text(e(this).data("color")),e(this).data("color",null)),_[a]=v,y&&(_[y]=e("#"+y).is(":checked")?1:0)),""!==v)if(c.is_empty(f))if(t=p.toString().match(/^border(\-(top|right|bottom|left))?$/)&&!v.match(/none/)){var w=new RegExp(c.border_regx+c.color_regx,"i");s=v.toString().match(w),c.is_empty(s)||(s.shift(),l[h][p+"-width"]=s.shift()||"",s.shift(),l[h][p+"-style"]=s.shift()||"",l[h][p+"-color"]=s.shift()||"")}else if("background-image"!==p||v.match(/none/))"seq"!==p&&(l[h][p]=v);else if(v.toString().match(/url\(/))l[h]["background-image"]=c.image_url(h,v);else{var x=new RegExp(c.grad_regx+c.color_regx+c.color_regx,"i");s=v.toString().match(x),!c.is_empty(s)&&s.length>2?(s.shift(),r[h].origin=s.shift()||"top",r[h].start=s.shift()||"transparent",r[h].end=s.shift()||"transparent",o[h]=!0):l[h]["background-image"]=v}else switch(f){case"_border_width":l[h][p+"-width"]="none"===v?0:v;break;case"_border_style":l[h][p+"-style"]=v;break;case"_border_color":l[h][p+"-color"]=v;break;case"_background_url":l[h]["background-image"]=c.image_url(h,v);break;case"_background_color":l[h]["background-color"]=v;break;case"_background_color1":r[h].start=v,o[h]=!0;break;case"_background_color2":r[h].end=v,o[h]=!0;break;case"_background_origin":r[h].origin=v,o[h]=!0}}),"undefined"==typeof a||c.is_empty(a.attr("id"))||(a.removeAttr("style"),o.parent&&a.ctcgrad(r.parent.origin,[r.parent.start,r.parent.end]),a.css(l.parent),a.attr("id").toString().match(/parent/)||(o.child&&a.ctcgrad(r.child.origin,[r.child.start,r.child.end]),a.css(l.child)),a.css({"z-index":-1})),_},decode_value:function(e,t){t="undefined"==typeof t?"":t;var c,n=this,i={orig:t,names:[""],values:[t]};if(e.toString().match(/^border(\-(top|right|bottom|left))?$/)){var s,a=new RegExp(n.border_regx+"("+n.color_regx+")?","i");c=t.toString().match(a),n.is_empty(c)&&(c=[]),i.names=["_border_width","_border_style","_border_color"],s=c.shift(),i.values[0]=c.shift()||"",c.shift(),i.values[1]=c.shift()||"",c.shift(),i.values[2]=c.shift()||""}else if(e.toString().match(/^background\-image/))if(i.names=["_background_url","_background_origin","_background_color1","_background_color2"],i.values=["","","",""],n.is_empty(t)||t.toString().match(/(url|none)/))i.values[0]=t;else{var l,r;c=t.toString().split(/:/),i.values[1]=c.shift()||"",i.values[2]=c.shift()||"",l=c.shift()||"",i.values[3]=c.shift()||"",r=c.shift()||"",i.orig=[i.values[1],i.values[2],i.values[3]].join(" ")}return i},image_url:function(e,t){var c,n=this,i=t.toString().match(/url\(['" ]*(.+?)['" ]*\)/),s=n.is_empty(i)?null:i[1],a=window.ctcAjax.theme_uri+"/"+("parent"===e?window.ctcAjax.parnt:window.ctcAjax.child)+"/";return s?c=s.toString().match(/^(data:|https?:|\/)/)?t:"url("+a+s+")":!1},setup_menus:function(){var e=this;e.setup_query_menu(),e.setup_selector_menu(),e.setup_rule_menu(),e.setup_new_rule_menu(),e.load_queries(),e.load_rules(),e.set_query(e.currquery)},load_queries:function(){var e=this;e.query_css("queries",null)},load_selectors:function(){var e=this;e.query_css("selectors",e.currquery)},load_rules:function(){var e=this;e.query_css("rules",null)},load_selector_values:function(){var e=this;e.query_css("qsid",e.currqsid)},get_queries:function(t,c){var n=[],i=new RegExp(e.ui.autocomplete.escapeRegex(t.term),"i");e.chldthmcfg.is_empty(this.element.data("menu"))?n.push({label:window.ctcAjax.nosels_txt,value:null}):e.each(this.element.data("menu"),function(e,t){i.test(t)&&n.push({label:t,value:t})}),c(n)},get_selectors:function(t,c){var n=[],i=new RegExp(e.ui.autocomplete.escapeRegex(t.term),"i");e.chldthmcfg.is_empty(this.element.data("menu"))?n.push({label:window.ctcAjax.nosels_txt,value:null}):e.each(this.element.data("menu"),function(e,t){i.test(e)&&n.push({label:e,value:t})}),c(n)},get_rules:function(t,c){var n=[],i=new RegExp(e.ui.autocomplete.escapeRegex(t.term),"i");e.chldthmcfg.is_empty(this.element.data("menu"))?n.push({label:window.ctcAjax.nosels_txt,value:null}):e.each(this.element.data("menu"),function(e,t){i.test(e)&&n.push({label:e,value:t})}),c(n)},get_filtered_rules:function(t,c){var n=[],i=new RegExp(e.ui.autocomplete.escapeRegex(t.term),"i");e.each(e("#ctc_rule_menu").data("menu"),function(e,t){i.test(e)&&n.push({label:e,value:t})}),c(n)},merge_ruleval_arrays:function(t,c,n){var i=this,s={},a=n?c.child.pop():null;return e.each(["parnt","child"],function(t,l){i.is_empty(c[l])||e.each(c[l],function(e,t){n?parseInt(t[2])>=parseInt(a[2])&&(a[2]=parseInt(t[2])+1):(i.is_empty(s[t[2]])&&(s[t[2]]={}),s[t[2]][l]=t)})}),n&&(s[a[2]]={parnt:[],child:a}),s},input_row:function(t,c,n,i,s){var a=this,l="";if(!a.is_empty(i)&&!a.is_empty(i.value)&&!a.is_empty(i.value[c])){var r=i.value[c],o=a.merge_ruleval_arrays(c,r,s);e.each(o,function(s,r){var o=a.decode_value(c,a.is_empty(r.parnt)?"":r.parnt[0]),_=a.is_empty(r.parnt)||a.is_empty(r.parnt[1],1)?0:1,d=a.decode_value(c,a.is_empty(r.child)?"":r.child[0]),u=a.is_empty(r.child)||a.is_empty(r.child[1],1)?0:1;if(l+='<div class="ctc-'+("ovrd"===n?"input":"selector")+'-row clearfix"><div class="ctc-input-cell">',l+="ovrd"===n?c.replace(/\d+/g,a.frascii):i.selector+'<br/><a href="#" class="ctc-selector-edit" id="ctc_selector_edit_'+t+'" >'+a.getxt("edit")+"</a> "+(a.is_empty(o.orig)?a.getxt("child_only"):""),l+='</div><div class="ctc-parent-value ctc-input-cell"'+("ovrd"!==n?' style="display:none"':"")+' id="ctc_'+n+"_parent_"+c+"_"+t+"_"+s+'">'+(a.is_empty(o.orig)?"[no value]":o.orig+(_?a.getxt("important"):""))+'</div><div class="ctc-input-cell">',!a.is_empty(o.names)){e.each(o.names,function(e,i){i=a.is_empty(i)?"":i,l+='<div class="ctc-child-input-cell clear">';var r,o="ctc_"+n+"_child_"+c+"_"+t+"_"+s+i;!1===(r=d.values.shift())&&(r=""),l+=(a.is_empty(i)?"":a.getxt(i)+":<br/>")+'<input type="text" id="'+o+'" name="'+o+'" class="ctc-child-value'+((i+c).toString().match(/color/)?" color-picker":"")+(i.toString().match(/url/)?" ctc-input-wide":"")+'" value="'+a.escquo(r)+'" /></div>'});var h="ctc_"+n+"_child_"+c+"_i_"+t+"_"+s;l+='<label for="'+h+'"><input type="checkbox" id="'+h+'" name="'+h+'" value="1" '+(u?"checked":"")+" />"+a.getxt("important")+"</label>"}l+="</div>","ovrd"!==n&&(l+='<div class="ctc-swatch ctc-specific" id="ctc_child_'+c+"_"+t+"_"+s+'_swatch">'+a.getxt("swatch")+'</div><div class="ctc-child-input-cell ctc-button-cell" id="ctc_save_'+c+"_"+t+"_"+s+'_cell"><input type="button" class="button ctc-save-input" id="ctc_save_'+c+"_"+t+"_"+s+'" name="ctc_save_'+c+"_"+t+"_"+s+'" value="Save" /></div>'),l+="</div><!-- end input row -->\n"})}return l},scrolltop:function(){e("html, body, .ctc-option-panel-container").animate({scrollTop:0})},css_preview:function(e){var t=this;(e=e.match(/(child|parnt)/)[1])||(e="child"),t.query_css("preview",e)},setup_iris:function(e){var t=this;t.setup_spectrum(e)},setup_spectrum:function(t){var c=this,n=!c.is_empty(window.ctcAjax.palette);try{e(t).spectrum({showInput:!0,allowEmpty:!0,showAlpha:!0,showInitial:!0,preferredFormat:"hex",clickoutFiresChange:!0,move:function(n){e(t).data("color",n),c.coalesce_inputs(t)},showPalette:n?!0:!1,showSelectionPalette:n?!0:!1,palette:[],maxSelectionSize:36,localStorageKey:"ctc-palette."+window.ctcAjax.child,hideAfterPaletteSelect:!0}).on("change",function(){c.coalesce_inputs(this)}).on("keyup",function(){var t=this,n=c.addhash(e(this).val());e(t).val(n),clearTimeout(e(this).data("spectrumTimer")),e(this).data("spectrumTimer",setTimeout(function(){c.coalesce_inputs(t),e(t).spectrum("set",n)},500))})}catch(i){c.jquery_exception(i,"Spectrum Color Picker")}},addhash:function(e){return e.replace(/^#?([a-f0-9]{3,6}.*)/,"#$1")},color_text:function(e){var t=this;return t.is_empty(e)?"":e.getAlpha()<1?e.toRgbString():e.toHexString()},setup_query_menu:function(){var t=this;try{e("#ctc_sel_ovrd_query").autocomplete({source:t.get_queries,minLength:0,selectFirst:!0,autoFocus:!0,select:function(e,c){return t.set_query(c.item.value),!1},focus:function(e){e.preventDefault()}}).data("menu",{})}catch(c){t.jquery_exception(c,"Query Menu")}},setup_selector_menu:function(){var t=this;try{e("#ctc_sel_ovrd_selector").autocomplete({source:t.get_selectors,selectFirst:!0,autoFocus:!0,select:function(e,c){return t.set_selector(c.item.value,c.item.label),!1},focus:function(e){e.preventDefault()}}).data("menu",{})}catch(c){t.jquery_exception(c,"Selector Menu")}},setup_rule_menu:function(){var t=this;try{e("#ctc_rule_menu").autocomplete({source:t.get_rules,selectFirst:!0,autoFocus:!0,select:function(e,c){return t.set_rule(c.item.value,c.item.label),!1},focus:function(e){e.preventDefault()}}).data("menu",{})}catch(c){t.jquery_exception(c,"Property Menu")}},setup_new_rule_menu:function(){var t=this;try{e("#ctc_new_rule_menu").autocomplete({source:t.get_filtered_rules,selectFirst:!0,autoFocus:!0,select:function(c,n){c.preventDefault();var i,s,a=n.item.label.replace(/[^\w\-]/g,t.toascii);return t.is_empty(t.currdata.value)&&(t.currdata.value={}),t.is_empty(t.currdata.value[n.item.label])&&(t.currdata.value[n.item.label]={}),t.is_empty(t.currdata.value[n.item.label].child)&&(t.currdata.value[n.item.label].child=[]),t.currdata.value[n.item.label].child.push(["",0,1,1]),i=e(t.input_row(t.currqsid,a,"ovrd",t.currdata,!0)),e("#ctc_sel_ovrd_rule_inputs").append(i),e("#ctc_new_rule_menu").val(""),i.find('input[type="text"]').each(function(c,n){s||(s=n),e(n).hasClass("color-picker")&&t.setup_spectrum(n)}),s&&e(s).focus(),!1},focus:function(e){e.preventDefault()}}).data("menu",{})}catch(c){t.jquery_exception(c,"New Property Menu")}},set_theme_params:function(t,c){e("#ctc_child_author").val(window.ctcAjax.themes[t][c].Author),e("#ctc_child_version").val(window.ctcAjax.themes[t][c].Version),e("#ctc_child_authoruri").val(window.ctcAjax.themes[t][c].AuthorURI),e("#ctc_child_themeuri").val(window.ctcAjax.themes[t][c].ThemeURI),e("#ctc_child_descr").val(window.ctcAjax.themes[t][c].Descr),e("#ctc_child_tags").val(window.ctcAjax.themes[t][c].Tags)},update_form:function(){var t,c=this;e("#input_row_stylesheet_handling_container,#input_row_parent_handling_container,#ctc_additional_css_files_container,#input_row_new_theme_slug,#input_row_duplicate_theme_slug,#ctc_copy_theme_mods,#ctc_child_header_parameters,#ctc_configure_submit,#input_row_theme_slug").slideUp("fast"),e("#ctc_configure_submit .ctc-step").text("9"),e("#ctc_theme_child").length&&!e("#ctc_child_type_new").is(":checked")?(t=e("#ctc_theme_child").val(),c.existing=1,c.currparnt=window.ctcAjax.themes.child[t].Template,c.autogen_slugs(),e("#ctc_theme_parnt").val(c.currparnt),e("#ctc_theme_parnt-button .ui-selectmenu-text").text(window.ctcAjax.themes.parnt[c.currparnt].Name),c.set_theme_params("child",t),e("#ctc_child_type_duplicate").is(":checked")?(e("#ctc_child_template").val(c.testslug),e("#ctc_child_name").val(c.testname),e(".ctc-analyze-theme, .ctc-analyze-howto").show(),e("#ctc_load_styles").val("Duplicate Child Theme")):e("#ctc_child_type_reset").is(":checked")?(e("#ctc_configure_submit .ctc-step").text("3"),e("#ctc_configure_submit").slideDown("fast"),e("#theme_slug_container").text(t),e(".ctc-analyze-theme, .ctc-analyze-howto").hide(),e("#ctc_enqueue_none").prop("checked",!0),e("#ctc_load_styles").val("Reset Child Theme to Previous State")):(e("#ctc_child_template").val(""),e("#theme_slug_container").text(t),e(".ctc-analyze-theme, .ctc-analyze-howto").show(),e("#ctc_child_name").val(window.ctcAjax.themes.child[t].Name),e("#ctc_load_styles").val("Configure Child Theme")),e("#input_row_existing_theme_option").slideDown("fast"),e("#input_row_new_theme_option").slideUp("fast")):(c.existing=0,c.autogen_slugs(),e("#ctc_theme_parnt").val(c.currparnt),e("#ctc_theme_parnt-button .ui-selectmenu-text").text(window.ctcAjax.themes.parnt[c.currparnt].Name),c.set_theme_params("parnt",c.currparnt),e("#input_row_existing_theme_option,#input_row_duplicate_theme_container,#input_row_theme_slug").slideUp("fast"),e("#input_row_new_theme_option").slideDown("fast"),e("#ctc_child_name").val(c.testname),e("#ctc_child_template").val(c.testslug),e(".ctc-analyze-theme, .ctc-analyze-howto").show(),e("#ctc_load_styles").val("Create New Child Theme"))},set_notice:function(t){var c,n=this,i="";n.is_empty(t)||e.each(t,function(t,c){i+='<div class="'+t+' notice is-dismissible dashicons-before"><ul>\n',e(c).each(function(e,t){i+="<li>"+t.toString()+"</li>\n"}),i+="</ul></div>"}),c=e(i),e("#ctc_error_notice").html(c),n.bind_dismiss(c),e("html, body").animate({scrollTop:0},"slow")},set_parent_menu:function(e){var t=this;t.currparnt=e.value,t.update_form()},set_child_menu:function(e){var t=this;t.currchild=e.value,t.update_form()},set_query:function(t){var c=this;return c.is_empty(t)?!1:(c.currquery=t,e("#ctc_sel_ovrd_query").val(""),e("#ctc_sel_ovrd_query_selected").text(t),e("#ctc_sel_ovrd_selector").val(""),e("#ctc_sel_ovrd_selector_selected").html("&nbsp;"),c.load_selectors(),void c.scrolltop())},set_selector:function(t,c){var n=this;return c=null,n.is_empty(t)?!1:(e("#ctc_sel_ovrd_selector").val(""),n.currqsid=t,n.reload=!1,n.load_selector_values(),void n.scrolltop())},set_rule:function(t,c){var n=this;return n.is_empty(t)?!1:(e("#ctc_rule_menu").val(""),e("#ctc_rule_menu_selected").text(c),e(".ctc-rewrite-toggle").text(n.getxt("rename")),e("#ctc_rule_value_inputs, #ctc_input_row_rule_header").show(),n.query_css("rule_val",t),void n.scrolltop())},set_qsid:function(t){var c=this;c.currqsid=e(t).attr("id").match(/_(\d+)$/)[1],c.focus_panel("#query_selector_options"),c.reload=!0,c.load_selector_values()},query_css:function(t,c,n){var i=this,s={ctc_query_obj:t,ctc_query_key:c},a="#ctc_status_"+t+("val_qry"===t?"_"+c:"");"object"==typeof n&&e.each(n,function(e,t){s["ctc_query_"+e]=t}),e(".query-icon,.ctc-status-icon").remove(),e(a+" .ctc-status-icon").remove(),e(a).append('<span class="ctc-status-icon spinner is-active query-icon"></span>'),s.action=i.is_empty(e("#ctc_action").val())||"plugin"!==e("#ctc_action").val()?"ctc_query":"ctc_plgqry",s._wpnonce=e("#_wpnonce").val(),i.ajax_post(t,s)},save:function(t){var c,n,i,s,a,l=this,r={},o=e(t).attr("id");e(t).prop("disabled",!0),e(".ctc-query-icon,.ctc-status-icon").remove(),e(t).parent(".ctc-textarea-button-cell, .ctc-button-cell").append('<span class="ctc-status-icon spinner save-icon"></span>'),o.match(/ctc_configtype/)?(e(t).parents(".ctc-input-row").first().append('<span class="ctc-status-icon spinner save-icon"></span>'),r.ctc_configtype=e(t).val()):(c=e("#ctc_new_selectors"))&&"ctc_save_new_selectors"===e(t).attr("id")?(r.ctc_new_selectors=c.val(),(n=e("#ctc_sel_ovrd_query_selected"))&&(r.ctc_sel_ovrd_query=n.text()),l.reload=!0):(i=e("#ctc_child_imports"))&&"ctc_save_imports"===o?r.ctc_child_imports=i.val():"ctc_is_debug"===o?r.ctc_is_debug=e("#ctc_is_debug").is(":checked")?1:0:r=l.coalesce_inputs(t),e(".save-icon").addClass("is-active"),e("#ctc_sel_ovrd_selector_selected").find("#ctc_rewrite_selector").each(function(){s=e("#ctc_rewrite_selector").val(),a=e("#ctc_rewrite_selector_orig").val(),l.is_empty(s)||!s.toString().match(/\w/)?s=a:(r.ctc_rewrite_selector=s,l.reload=!0),e(".ctc-rewrite-toggle").text(l.getxt("rename")),e("#ctc_sel_ovrd_selector_selected").html(s)}),r.action=l.is_empty(e("#ctc_action").val())||"plugin"!==e("#ctc_action").val()?"ctc_update":"ctc_plugin",r._wpnonce=e("#_wpnonce").val(),l.ajax_post("qsid",r)},ajax_post:function(t,c,n){var i=this;e.ajax({url:window.ctcAjax.ajaxurl,data:c,dataType:i.is_empty(n)?"json":n,type:"POST"}).done(function(e){i.handle_success(t,e)}).fail(function(){i.handle_failure(t)}).always(function(){i.jqueryerr.length&&i.jquery_notice()})},handle_failure:function(t){var c=this;e(".query-icon, .save-icon").removeClass("spinner").addClass("failure"),e("input[type=submit], input[type=button], input[type=checkbox],.ctc-delete-input").prop("disabled",!1),e(".ajax-pending").removeClass("ajax-pending"),"preview"===t&&e("#view_parnt_options_panel,#view_child_options_panel").text(c.getxt("css_fail"))},handle_success:function(t,c){var n=this;e(".query-icon, .save-icon").removeClass("spinner"),e(".ajax-pending").removeClass("ajax-pending"),n.is_empty(c)?n.handle_failure(t):(e("#ctc_new_selectors").val(""),e(".query-icon, .save-icon").addClass("success"),e("input[type=submit], input[type=button], input[type=checkbox],.ctc-delete-input").prop("disabled",!1),e(c).each(function(){"function"==typeof n.update[this.obj]&&n.update[this.obj].call(n,this)}))},jquery_exception:function(e,t){var c=this,n=c.is_empty(e.lineNumber)?"":" line: "+e.lineNumber,i=c.is_empty(e.fileName)?"":" "+e.fileName.split(/\?/)[0];c.jqueryerr.push("<code><small>"+t+": "+e.message+i+n+"</small></code>")},jquery_notice:function(t){t=null;var c=this,n=[],i=[];c.jqueryerr.length&&(e("input[type=submit], input[type=button]").prop("disabled",!0),e("script").each(function(){var t=e(this).prop("src");c.is_empty(t)||!t.match(/jquery(\.min|\.js|\-?ui)/i)||t.match(/load\-scripts.php/)||n.push("<code><small>"+t.split(/\?/)[0]+"</small></code>")}),i.push("<strong>"+c.getxt("js")+"</strong> "+c.getxt("contact")),i.push(c.jqueryerr.join("<br/>")),n.length&&i.push(c.getxt("jquery")+"<br/>"+n.join("<br/>")),i.push(c.getxt("plugin"))),c.set_notice({error:i})},update:{qsid:function(t){var c,n,i,s,a=this;a.currqsid=t.key,a.currdata=t.data,e("#ctc_sel_ovrd_qsid").val(a.currqsid),a.is_empty(a.currdata.seq)?e("#ctc_child_load_order_container").empty():(c="ctc_ovrd_child_seq_"+a.currqsid,i=parseInt(a.currdata.seq),n='<input type="text" id="'+c+'" name="'+c+'" class="ctc-child-value" value="'+i+'" />',e("#ctc_child_load_order_container").html(n)),a.is_empty(a.currdata.value)?(s=!0,e("#ctc_sel_ovrd_rule_inputs").empty()):(s=!1,n="",e.each(a.currdata.value,function(e,t){t=null,n+=a.input_row(a.currqsid,e,"ovrd",a.currdata)}),e("#ctc_sel_ovrd_rule_inputs").html(n).find(".color-picker").each(function(){a.setup_spectrum(this)}),a.coalesce_inputs("#ctc_child_all_0_swatch")),a.reload&&(a.load_queries(),a.set_query(a.currdata.query),a.load_rules()),e("#ctc_sel_ovrd_selector_selected").text(a.currdata.selector),e(".ctc-rewrite-toggle").text(a.getxt("rename")),e(".ctc-rewrite-toggle").show(),s?e("#ctc_sel_ovrd_rule_header,#ctc_sel_ovrd_new_rule,#ctc_sel_ovrd_rule_inputs_container,#ctc_sel_ovrd_rule_inputs").hide():e("#ctc_sel_ovrd_rule_header,#ctc_sel_ovrd_new_rule,#ctc_sel_ovrd_rule_inputs_container,#ctc_sel_ovrd_rule_inputs").show()},rule_val:function(t){var c=this,n=e("#ctc_rule_menu_selected").text(),i='<div class="ctc-input-row clearfix" id="ctc_rule_row_'+n+'">\n';c.is_empty(t.data)||(e.each(t.data,function(e,t){var s=c.decode_value(n,t);i+='<div class="ctc-parent-row clearfix" id="ctc_rule_row_'+n+"_"+e+'">\n<div class="ctc-input-cell ctc-parent-value" id="ctc_'+e+"_parent_"+n+"_"+e+'">'+s.orig+'</div>\n<div class="ctc-input-cell">\n<div class="ctc-swatch ctc-specific" id="ctc_'+e+"_parent_"+n+"_"+e+'_swatch">'+c.getxt("swatch")+'</div></div>\n<div class="ctc-input-cell"><a href="#" class="ctc-selector-handle" id="ctc_selector_'+n+"_"+e+'">'+c.getxt("selector")+'</a></div>\n<div id="ctc_selector_'+n+"_"+e+'_container" class="ctc-selector-container">\n<a href="#" id="ctc_selector_'+n+"_"+e+'_close" class="ctc-selector-handle ctc-exit" title="'+c.getxt("close")+'"></a><div id="ctc_selector_'+n+"_"+e+'_inner_container" class="ctc-selector-inner-container clearfix">\n<div id="ctc_status_val_qry_'+e+'"></div>\n<div id="ctc_selector_'+n+"_"+e+'_rows"></div>\n</div></div></div>\n'}),i+="</div>\n"),e("#ctc_rule_value_inputs").html(i).find(".ctc-swatch").each(function(){c.coalesce_inputs(this)})},val_qry:function(t){var c,n,i=this,s="";i.is_empty(t.data)||e.each(t.data,function(n,a){c=n,e.each(a,function(c,a){s+='<h4 class="ctc-query-heading">'+c+"</h4>\n",i.is_empty(a)||e.each(a,function(e,c){s+=i.input_row(e,n,t.key,c)})})}),n="#ctc_selector_"+c+"_"+t.key+"_rows",e(n).html(s).find(".color-picker").each(function(){i.setup_spectrum(this)}),e(n).find(".ctc-swatch").each(function(){i.coalesce_inputs(this)})},queries:function(t){e("#ctc_sel_ovrd_query").data("menu",t.data)},selectors:function(t){e("#ctc_sel_ovrd_selector").data("menu",t.data)},rules:function(t){e("#ctc_rule_menu").data("menu",t.data)},debug:function(t){e("#ctc_debug_container").html(t.data)},preview:function(t){e("#view_"+t.key+"_options_panel").text(t.data)},dismiss:function(){}},bind_dismiss:function(t){var c=this,n=e(t),i=e('<button type="button" class="notice-dismiss"><span class="screen-reader-text"></span></button>'),s=window.commonL10n.dismiss||"";i.find(".screen-reader-text").text(s),n.append(i),i.on("click.wp-dismiss-notice",function(e){e.preventDefault(),c.dismiss_notice(t)})},dismiss_notice:function(t){e(t).fadeTo(100,0,function(){e(this).slideUp(100,function(){e(this).remove()})})},reset_handling:function(){e("#parnt_analysis_notice .notice, #child_analysis_notice .notice").slideUp(),e("#ctc_enqueue_enqueue").prop("checked",!0),e("#ctc_handling_primary").prop("checked",!0),e("#ctc_ignoreparnt").prop("checked",!1),e("#ctc_repairheader").prop("checked",!1)},init:function(){var t=this;if(!e("#ctc_theme_parnt").is("input")){try{e.widget("ctc.themeMenu",e.ui.selectmenu,{_renderItem:function(t,c){var n=e("<li>"),i=c.value.replace(/[^\w\-]/,"");return e("#ctc_theme_option_"+i).detach().appendTo(n),n.appendTo(t)}})}catch(c){t.jquery_exception(c,"Theme Menu")}try{e("#ctc_theme_parnt").themeMenu({select:function(e,c){t.reset_handling(),t.set_parent_menu(c.item)}})}catch(c){"function"==typeof themeMenu?e("#ctc_theme_parnt").themeMenu("destroy"):e("#ctc_theme_parnt-button").remove(),t.jquery_exception(c,"Parent Theme Menu")}if(t.is_empty(window.ctcAjax.themes.child))e("#ctc_child_name").length&&(e("#ctc_child_name").val(t.testname),e("#ctc_child_template").val(t.testslug));else try{e("#ctc_theme_child").themeMenu({select:function(e,c){t.reset_handling(),t.set_child_menu(c.item)}})}catch(c){"function"==typeof themeMenu?e("#ctc_theme_child").themeMenu("destroy"):e("#ctc_theme_child-button").remove(),t.jquery_exception(c,"Child Theme Menu")}}t.currparnt=e("#ctc_theme_parnt").val(),t.currchild=e("#ctc_theme_child").length?e("#ctc_theme_child").val():"",e("#ctc_main").on("click",".ctc-section-toggle",function(t){t.preventDefault(),e(this).parents(".ctc-input-row, .notice-warning, .updated, .error").first().find(".ctc-section-toggle").each(function(){e(this).toggleClass("open")});var c=e(this).attr("id").replace(/\d$/,"")+"_content";return e("#"+c).stop().slideToggle("fast"),!1}),e("#ctc_main").on("click",".ctc-upgrade-notice .notice-dismiss",function(){var c={action:"ctc_dismiss",_wpnonce:e("#_wpnonce").val()};t.ajax_post("dismiss",c)}),t.is_empty(t.jqueryerr)&&(e("#ctc_main").on("click",".ctc-selector-handle",function(c){if(c.preventDefault(),e(this).hasClass("ajax-pending"))return!1;e(this).addClass("ajax-pending");var n,i,s=e(this).attr("id").toString().replace("_close",""),a=s.toString().match(/_([^_]+)_(\d+)$/);e("#"+s+"_container").is(":hidden")&&(t.is_empty(a[1])||t.is_empty(a[2])||(n=a[1],i=a[2],t.query_css("val_qry",i,{rule:n}))),e("#"+s+"_container").fadeToggle("fast"),e(".ctc-selector-container").not("#"+s+"_container").fadeOut("fast")}),e("#ctc_main").on("click",".ctc-save-input[type=button], .ctc-delete-input",function(c){return c.preventDefault(),e(this).hasClass("ajax-pending")?!1:(e(this).addClass("ajax-pending"),t.save(this),!1)}),e("#ctc_main").on("keydown",".ctc-selector-container .ctc-child-value[type=text]",function(c){if(13===c.which){var n=e(this).parents(".ctc-selector-row").find(".ctc-save-input[type=button]").first();if(n.length)return c.preventDefault(),n.hasClass("ajax-pending")?!1:(n.addClass("ajax-pending"),t.save(n),!1)}}),e("#ctc_main").on("click",".ctc-selector-edit",function(c){return c.preventDefault(),e(this).hasClass("ajax-pending")?!1:(e(this).addClass("ajax-pending"),void t.set_qsid(this))}),e("#ctc_main").on("click",".ctc-rewrite-toggle",function(e){e.preventDefault(),t.selector_input_toggle(this)}),e("#ctc_main").on("click","#ctc_copy_selector",function(){var c=e("#ctc_sel_ovrd_selector_selected").text().trim();t.is_empty(c)||e("#ctc_new_selectors").val(e("#ctc_new_selectors").val()+"\n"+c+" {\n\n}")}),e("#ctc_configtype").on("change",function(){var c=e(this).val();if(t.is_empty(c)||"theme"===c){e(".ctc-theme-only, .ctc-themeonly-container").removeClass("ctc-disabled"),e(".ctc-theme-only, .ctc-themeonly-container input").prop("disabled",!1);try{e("#ctc_theme_parnt, #ctc_theme_child").themeMenu("enable")}catch(n){t.jquery_exception(n,"Theme Menu")}}else{e(".ctc-theme-only, .ctc-themeonly-container").addClass("ctc-disabled"),e(".ctc-theme-only, .ctc-themeonly-container input").prop("disabled",!0);try{e("#ctc_theme_parnt, #ctc_theme_child").themeMenu("disable")}catch(n){t.jquery_exception(n,"Theme Menu")}}}),e(".nav-tab").on("click",function(c){c.preventDefault(),e(".ctc-query-icon,.ctc-status-icon").remove();var n="#"+e(this).attr("id");t.focus_panel(n)}),e("#view_child_options, #view_parnt_options").on("click",function(){return e(this).hasClass("ajax-pending")?!1:(e(this).addClass("ajax-pending"),void t.css_preview(e(this).attr("id")))}),e("#ctc_load_form").on("submit",function(){return t.validate()}),e("#ctc_query_selector_form").on("submit",function(c){c.preventDefault();var n=e("#ctc_save_query_selector");return n.hasClass("ajax-pending")?!1:(n.addClass("ajax-pending"),t.save(n),!1)}),e("#ctc_rule_value_form").on("submit",function(e){return e.preventDefault(),!1}),e("#ctc_child_type_new,#ctc_child_type_existing,#ctc_child_type_duplicate,#ctc_child_type_reset").on("focus click",function(){t.reset_handling(),t.update_form()}),e("#ctc_is_debug").on("change",function(){t.save(this)}),e(".ctc-live-preview").on("click",function(t){return t.stopImmediatePropagation(),t.preventDefault(),document.location=e(this).prop("href"),!1}),t.setup_menus(),e("input[type=submit], input[type=button]").prop("disabled",!1),t.scrolltop(),t.update_form()),t.jqueryerr.length&&t.jquery_notice()},testslug:"",testname:"",reload:!1,currquery:"base",currqsid:null,currdata:{},currparnt:"",currchild:"",existing:!1,jqueryerr:[],color_regx:"\\s+(\\#[a-f0-9]{3,6}|rgba?\\([\\d., ]+?\\)|hsla?\\([\\d%., ]+?\\)|[a-z]+)",border_regx:"(\\w+)(\\s+(\\w+))?",grad_regx:"(\\w+)"},e.chldthmanalyze={escrgx:function(e){return e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1")},trmcss:function(e){return"undefined"==typeof e?"":e.replace(/\-css$/,"")},show_loading:function(t){var c=e.chldthmcfg.existing?"child":"parnt",n="child"===c?e.chldthmcfg.currchild:e.chldthmcfg.currparnt,i=window.ctcAjax.themes[c][n].Name,s='<strong class="ctc_analyze_loading"><span class="spinner is-active"></span>'+e.chldthmcfg.getxt(t?"anlz1":"anlz2")+" "+i+"...</strong>";self.noticediv="",e("#"+c+"_analysis_notice").html(s)},hide_loading:function(){e(".ctc_analyze_loading").fadeTo(200,0,function(){e(this).slideUp(200,function(){e(this).remove()})})},setssl:function(e){return e.replace(/^https?/,window.ctcAjax.ssl?"https":"http")},analyze_theme:function(t){var c,n,i,s=this,a="child"===t?e.chldthmcfg.currchild:e.chldthmcfg.currparnt,l="&template="+e.chldthmcfg.currparnt+"&stylesheet="+a,r=s.setssl(window.ctcAjax.homeurl),o=window.ctcAjax.theme_uri.replace(/^https?:\/\//,""),_=r+l,d=s.escrgx(e.chldthmcfg.currparnt)+("child"===t?"|"+s.escrgx(a):""),u=new RegExp("<link( rel=[\"']stylesheet[\"'] id=['\"]([^'\"]+?)['\"])?[^>]+?"+s.escrgx(o)+"/("+d+")/(.+?\\.css)[^>]+?>","gi"),h=/<br \/>\n[^\n]+?(fatal|strict|notice|warning|error)[\s\S]+?<br \/>/gi,p=0,m=0,g={deps:[[],[]],signals:{},queue:[]};e.get(_,function(a){for((n=a.match(/BEGIN WP QUEUE\n([\n\w\-\.]*?)END WP QUEUE/))?g.queue=n[1].split(/\n/):(g.queue=[],g.signals.thm_noqueue=1),a.match(/<!\-\- CHLD_THM_CFG_IGNORE_PARENT \-\->/)&&(g.signals.thm_ignoreparnt=1),a.match(/<!\-\- IS_CTC_THEME \-\->/)&&(g.signals.thm_is_ctc=1),a.match(/<!\-\- HAS_CTC_STYLES \-\->/)&&(g.signals.thm_has_styles=1),a.match(/<!\-\- HAS_CTC_IMPORT \-\->/)&&(g.signals.thm_has_import=1),a=a.replace(/<!\-\-[\s\S]*?\-\->/g,"");c=h.exec(a);){var l=c[0].replace(/<.*?>/g,"");s.phperr[t].push(l),g.signals.err_php=1,l.match(/Fatal error/i)?g.signals.err_fatal=1:l.match(/(FileNotFoundException|Failed opening|failed to open stream)/i)&&(g.signals.err_fnf=1)}for(;i=u.exec(a);){var r=s.trmcss(i[2]),o=i[3],_=i[4],d=e.chldthmcfg.currparnt===o?"parnt":"child",f=0;if(""===r||-1===e.inArray(r,g.queue))f=1;else if(0===r.indexOf("chld_thm_cfg")){_.match(/^ctc\-style([\-\.]min)?\.css$/)?(p=1,g.signals.ctc_sep_loaded=1):_.match(/^ctc\-genesis([\-\.]min)?\.css$/)?(p=1,g.signals.ctc_gen_loaded=1):r.match(/$chld_thm_cfg_ext/)?(g.signals.ctc_ext_loaded=1,g.deps[p].push([r,_])):"chld_thm_cfg_child"===r?(g.signals.ctc_child_loaded=1,g.deps[p].push([r,_])):"chld_thm_cfg_parent"===r&&(g.signals.ctc_parnt_loaded=1,
2
+ g.deps[p].push([r,_]),p&&(g.signals.ctc_parnt_reorder=1));continue}if(_.match(/^style([\-\.]min)?\.css$/))p=1,"parnt"===d?g.signals.thm_parnt_loaded=f?"thm_unregistered":r:g.signals.thm_child_loaded=f?"thm_unregistered":r,f?m?(g.signals.thm_past_wphead=1,g.deps[p].push(["thm_past_wphead",_])):(g.signals.thm_unregistered=1,g.deps[p].push(["thm_unregistered",_])):g.deps[p].push([r,_]);else if("ctc-test.css"===_)m=1;else{var v=null;f&&(v="dep_unregistered"),m&&(v=p?"css_past_wphead":"dep_past_wphead"),v&&(g.signals[v]=1,r=v),g.deps[p].push([r,_])}}p||(g.signals.thm_notheme=1),a=null,s.analysis[t]=g,e(document).trigger("analysisdone")}).fail(function(){g.signals.failure=1,s.analysis[t]=g,e(document).trigger("analysisdone")})},css_notice:function(){var t,c=this,n=e.chldthmcfg.existing?"child":"parnt",i="child"===n?e.chldthmcfg.currchild:e.chldthmcfg.currparnt,s=window.ctcAjax.themes[n][i].Name,a="",l={notices:[]},r={style:"notice-warning",headline:e.chldthmcfg.getxt("anlz3",s),errlist:""},o=0,_={};if(e(window.ctcAjax.addl_css).each(function(t,c){e("#ctc_stylesheet_files .ctc_checkbox").each(function(){c===e(this).val()&&e(this).prop("checked",!0)})}),c.analysis[n].signals.failure||c.analysis[n].signals.thm_noqueue&&!c.phperr[n].length)l.notices.push({headline:e.chldthmcfg.getxt("anlz4",s),msg:e.chldthmcfg.getxt("anlz5"),style:"error"});else{if(c.phperr[n].length&&(e.each(c.phperr[n],function(t,c){c.match(/Fatal error/i)&&(r.style="error",r.headline=e.chldthmcfg.getxt("anlz8",s)),r.errlist+=c+"\n"}),r.msg='<div style="background-color:#ffeebb;padding:6px"><div class="ctc-section-toggle" id="ctc_analysis_errs">'+e.chldthmcfg.getxt("anlz6")+'</div><div id="ctc_analysis_errs_content" style="display:none"><textarea>'+r.errlist+"</textarea></div></div>"+e.chldthmcfg.getxt("anlz7"),l.notices.push(r)),(c.analysis[n].signals.thm_past_wphead||c.analysis[n].signals.dep_past_wphead)&&(l.notices.push({headline:e.chldthmcfg.getxt("anlz9"),style:"notice-warning",msg:e.chldthmcfg.getxt("anlz10")}),e("#ctc_repairheader").prop("checked",!0),e("#ctc_repairheader_container").show()),c.analysis[n].signals.thm_unregistered&&(c.analysis[n].signals.ctc_child_loaded||c.analysis[n].signals.ctc_sep_loaded||(l.notices.push({headline:e.chldthmcfg.getxt("anlz11"),style:"notice-warning",msg:e.chldthmcfg.getxt("anlz12")}),e("#ctc_repairheader_container").show(),e("#ctc_repairheader").prop("checked",!0))),"child"===n&&(c.analysis.child.signals.ctc_parnt_reorder&&(o=1),c.analysis.child.signals.ctc_child_loaded||c.analysis.child.signals.ctc_sep_loaded||c.analysis.child.signals.thm_child_loaded||(l.notices.push({headline:e.chldthmcfg.getxt("anlz13"),style:"notice-warning",msg:e.chldthmcfg.getxt("anlz14")}),o=1),c.analysis[n].signals.ctc_gen_loaded&&l.notices.push({headline:e.chldthmcfg.getxt("anlz31"),msg:e.chldthmcfg.getxt("anlz32"),style:"notice-warning"}),!c.analysis.parnt.signals.thm_has_styles||c.analysis.child.signals.ctc_gen_loaded||c.analysis.child.signals.thm_parnt_loaded||c.analysis.child.signals.ctc_parnt_loaded||c.analysis.child.signals.thm_ignoreparnt||c.analysis.child.signals.thm_has_import||(l.notices.push({headline:e.chldthmcfg.getxt("anlz15"),style:"notice-warning",msg:e.chldthmcfg.getxt("anlz16")}),o=1),c.analysis.child.signals.thm_unregistered&&c.analysis.child.signals.thm_child_loaded&&"thm_unregistered"===c.analysis.child.signals.thm_child_loaded&&c.analysis.child.signals.ctc_child_loaded&&c.analysis.child.signals.ctc_parnt_loaded&&(l.notices.push({headline:e.chldthmcfg.getxt("anlz28"),style:"notice-warning",msg:e.chldthmcfg.getxt("anlz29")}),e("#ctc_repairheader_container").show(),e("#ctc_repairheader").prop("checked",!0)),c.analysis.child.signals.thm_is_ctc||e("#ctc_child_type_duplicate").is(":checked")||l.notices.push({headline:e.chldthmcfg.getxt("anlz19"),msg:e.chldthmcfg.getxt("anlz20"),style:"notice-warning"})),(c.analysis[n].signals.ctc_sep_loaded||c.analysis[n].signals.ctc_gen_loaded)&&e("#ctc_handling_separate").prop("checked",!0),l.notices.length||l.notices.push({headline:""+("child"===n?e.chldthmcfg.getxt("anlz17"):e.chldthmcfg.getxt("anlz18")),style:"updated",msg:""}),"child"===n&&c.analysis.child.signals.thm_has_import&&(l.notices.push({headline:e.chldthmcfg.getxt("anlz21"),msg:e.chldthmcfg.getxt("anlz22"),style:"notice-warning"}),e("#ctc_enqueue_import").prop("checked",!0)),c.analysis[n].signals.thm_ignoreparnt||c.analysis[n].signals.ctc_gen_loaded?(e("#ctc_ignoreparnt").prop("checked",!0),e("#ctc_enqueue_none").is(":checked")||(e("#ctc_enqueue_none").prop("checked",!0),o=1,_.ctc_enqueue="none")):e("#ctc_ignoreparnt").prop("checked",!1),!c.analysis[n].signals.ctc_sep_loaded&&!c.analysis[n].signals.ctc_gen_loaded&&!c.analysis[n].signals.ctc_child_loaded&&!c.analysis[n].signals.thm_unregistered&&!c.analysis[n].signals.thm_past_wphead&&c.analysis[n].deps[1].length){var d="";e.each(c.analysis[n].deps[1],function(e,t){t[1].match(/^style([\-\.]min)?\.css$/)||(d+="<li>"+t[1]+"</li>\n")}),""!==d&&(d="<ul class='howto' style='padding-left:1em'>\n"+d+"</ul>\n",l.notices.push({headline:e.chldthmcfg.getxt("anlz23"),msg:d+e.chldthmcfg.getxt("anlz24"),style:"updated"}))}"child"===n&&c.analysis[n].signals.thm_parnt_loaded&&(l.notices.push({headline:e.chldthmcfg.getxt("anlz25"),msg:e.chldthmcfg.getxt("anlz26"),style:"updated"}),e("#ctc_enqueue_none").prop("checked",!0),o=1,_.ctc_enqueue="none"),c.analysis.parnt.signals.thm_has_styles||(l.notices.push({headline:e.chldthmcfg.getxt("anlz27"),msg:e.chldthmcfg.getxt("anlz26"),style:"updated"}),e("#ctc_enqueue_none").prop("checked",!0),o=1,_.ctc_enqueue="none")}return a=encodeURIComponent(JSON.stringify(c.analysis)),e('input[name="ctc_analysis"]').val(a),_.ctc_analysis=a,c.is_success()&&o&&!c.resubmitting?(c.resubmitting=1,void c.resubmit(_)):(c.resubmitting=0,c.hide_loading(),e.each(l.notices,function(t,c){var i=e('<div class="'+c.style+' notice is-dismissible dashicons-before" ><h4>'+c.headline+"</h4>"+c.msg+"</div>");e.chldthmcfg.bind_dismiss(i),i.hide().appendTo("#"+n+"_analysis_notice").slideDown()}),e("#ctc_is_debug").is(":checked")&&(t='<div style="background-color:#ddd;padding:6px"><div class="ctc-section-toggle" id="ctc_analysis_obj">'+e.chldthmcfg.getxt("anlz30")+'</div><div id="ctc_analysis_obj_content" style="display:none"><textarea style="font-family:monospace;font-size:10px">'+JSON.stringify(c.analysis,null,2)+"</textarea></div></div>",e(t).appendTo("#"+n+"_analysis_notice")),e("#ctc_child_type_reset").is(":checked")||(e("#input_row_stylesheet_handling_container,#input_row_parent_handling_container,#ctc_child_header_parameters,#ctc_configure_submit").slideDown("fast"),e("#ctc_child_type_duplicate").is(":checked")?(e("#ctc_configure_submit .ctc-step").text("8"),e("#ctc_copy_theme_mods").find("input").prop("checked",!1)):(e("#ctc_configure_submit .ctc-step").text("9"),e("#ctc_copy_theme_mods").slideDown("fast")),e("#ctc_child_type_duplicate").is(":checked")||e("#ctc_child_type_new").is(":checked")?(e("#input_row_theme_slug").hide(),e("#input_row_new_theme_slug").slideDown("fast")):(e("#input_row_new_theme_slug").hide(),e("#input_row_theme_slug").slideDown("fast"))),void 0)},resubmit:function(t){var c=this;c.hide_loading(),c.show_loading(!0),t.action="ctc_update",t._wpnonce=e("#_wpnonce").val(),e.ajax({url:window.ctcAjax.ajaxurl,data:t,type:"POST"}).done(function(){c.hide_loading(),c.do_analysis()}).fail(function(){c.hide_loading()})},do_analysis:function(){var t=this;t.analysis={parnt:{},child:{}},t.phperr={parnt:[],child:[]},t.done=0,t.show_loading(!1),t.analyze_theme("parnt"),e.chldthmcfg.existing&&t.analyze_theme("child")},init:function(){var t=this;e(document).on("analysisdone",function(){t.done++,t.done>e.chldthmcfg.existing&&(t.done=0,t.css_notice())}),e("#ctc_main").on("click",".ctc-analyze-theme",function(){t.is_success()&&e.chldthmcfg.dismiss_notice(e(".ctc-success-response").parent(".notice")),t.do_analysis()}),(t.is_success()||window.ctcAjax.pluginmode)&&t.do_analysis()},analysis:{},done:0,resubmitting:0,is_success:function(){return e(".ctc-success-response").length}},e("#request-filesystem-credentials-form").length||(e.chldthmcfg.init(),e.chldthmanalyze.init())}(jQuery);
lang/child-theme-configurator-de_DE.mo ADDED
Binary file
lang/child-theme-configurator-de_DE.po ADDED
@@ -0,0 +1,1381 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2016 Child Theme Configurator
2
+ # This file is distributed under the same license as the Child Theme Configurator package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: Child Theme Configurator 2.0.0\n"
6
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/child-theme-configurator\n"
7
+ "POT-Creation-Date: 2016-03-24 08:21+0100\n"
8
+ "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=UTF-8\n"
10
+ "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2016-03-25 11:34+0100\n"
12
+ "Language-Team: \n"
13
+ "X-Generator: Poedit 1.8.6\n"
14
+ "Last-Translator: \n"
15
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
16
+ "Language: de_DE\n"
17
+
18
+ #: includes/class-ctc-admin.php:337
19
+ msgid "Zip file creation failed."
20
+ msgstr "ZIP-Dateierstellung fehlgeschlagen."
21
+
22
+ #: includes/class-ctc-admin.php:373
23
+ msgid "The Functions file is required and cannot be deleted."
24
+ msgstr "Die Funktionendatei wird benötigt und kann nicht gelöscht werden."
25
+
26
+ #: includes/class-ctc-admin.php:457
27
+ msgid "You do not have permission to configure child themes."
28
+ msgstr "Sie haben keine Berechtigung, Kindthemen zu konfigurieren."
29
+
30
+ #: includes/class-ctc-admin.php:486
31
+ msgid "%s does not exist. Please select a valid Parent Theme."
32
+ msgstr "%s existiert nicht. Bitte wählen Sie ein gültiges Elternthema."
33
+
34
+ #: includes/class-ctc-admin.php:489
35
+ msgid "Please select a valid Parent Theme."
36
+ msgstr "Bitte wählen Sie ein gültiges Elternthema."
37
+
38
+ #: includes/class-ctc-admin.php:494
39
+ msgid "Please select a valid Child Theme."
40
+ msgstr "Bitte wählen Sie ein gültiges Kindthema."
41
+
42
+ #: includes/class-ctc-admin.php:498
43
+ msgid "Please enter a valid Child Theme directory name."
44
+ msgstr "Bitte geben Sie ein gültiges Kindthema-Verzeichnis ein."
45
+
46
+ #: includes/class-ctc-admin.php:503
47
+ msgid ""
48
+ "<strong>%s</strong> exists. Please enter a different Child Theme template "
49
+ "name."
50
+ msgstr ""
51
+ "<strong>%s</strong> existiert. Bitte geben Sie einen anderen Kindthema-"
52
+ "Vorlagennamen ein."
53
+
54
+ #: includes/class-ctc-admin.php:522
55
+ msgid "Your theme directories are not writable."
56
+ msgstr "Ihr Themenverzeichnis ist schreibgeschützt."
57
+
58
+ #: includes/class-ctc-admin.php:676
59
+ msgid "Your stylesheet is not writable."
60
+ msgstr "Ihre Formatvorlage ist schreibgeschützt."
61
+
62
+ #: includes/class-ctc-admin.php:1208
63
+ msgid "Could not set write permissions."
64
+ msgstr "Konnte Schreibberechtigungen nicht setzen."
65
+
66
+ #: includes/class-ctc-admin.php:1309
67
+ msgid "There were errors while resetting permissions."
68
+ msgstr "Beim Zurücksetzen der Berechtigungen traten Fehler auf."
69
+
70
+ #: includes/class-ctc-admin.php:1351
71
+ msgid "Could not upload file."
72
+ msgstr "Konnte Datei nicht hochladen."
73
+
74
+ #: includes/class-ctc-admin.php:1716
75
+ msgid "Could not copy file"
76
+ msgstr "Konnte Datei nicht kopieren"
77
+
78
+ #: includes/class-ctc-ui.php:33
79
+ msgid "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
80
+ msgstr "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
81
+
82
+ #: includes/class-ctc-ui.php:159
83
+ msgid "Child Theme files modified successfully."
84
+ msgstr "Kindthema-Dateien erfolgreich geändert."
85
+
86
+ #: includes/class-ctc-ui.php:161
87
+ msgid ""
88
+ "Child Theme <strong>%s</strong> has been reset. Please configure it using "
89
+ "the settings below."
90
+ msgstr ""
91
+ "Kindthema <strong>%s</strong> zurückgesetzt. Bitte mit den Einstellungen "
92
+ "unten konfigurieren."
93
+
94
+ #: includes/class-ctc-ui.php:163
95
+ msgid "Child Theme <strong>%s</strong> has been generated successfully."
96
+ msgstr "Kindthema <strong>%s</strong> wurde erfolgreich erstellt."
97
+
98
+ #: includes/class-ctc-ui.php:165
99
+ msgid "IMPORTANT:"
100
+ msgstr "WICHTIG:"
101
+
102
+ #: includes/class-ctc-ui.php:167 includes/forms/themepreview.php:20
103
+ msgid "Go to Themes"
104
+ msgstr "Gehe zu Themen"
105
+
106
+ #: includes/class-ctc-ui.php:167
107
+ msgid "Network enable"
108
+ msgstr "Netzwerkfähig machen"
109
+
110
+ #: includes/class-ctc-ui.php:167
111
+ msgid "your child theme."
112
+ msgstr "Ihr Kindthema"
113
+
114
+ #: includes/class-ctc-ui.php:169 includes/forms/themepreview.php:18
115
+ msgid "Live Preview"
116
+ msgstr "Live-Vorschau"
117
+
118
+ #: includes/class-ctc-ui.php:169
119
+ msgid "Preview your child theme"
120
+ msgstr "Vorschau Ihres Kindthemas"
121
+
122
+ #: includes/class-ctc-ui.php:169
123
+ msgid "before activating."
124
+ msgstr "vor der Aktivierung."
125
+
126
+ #: includes/class-ctc-ui.php:277
127
+ msgid "URL/None"
128
+ msgstr "URL/Keine"
129
+
130
+ #: includes/class-ctc-ui.php:278
131
+ msgid "Origin"
132
+ msgstr "Quelle"
133
+
134
+ #: includes/class-ctc-ui.php:279
135
+ msgid "Color 1"
136
+ msgstr "Farbe 1"
137
+
138
+ #: includes/class-ctc-ui.php:280
139
+ msgid "Color 2"
140
+ msgstr "Farbe 2"
141
+
142
+ #: includes/class-ctc-ui.php:281
143
+ msgid "Width/None"
144
+ msgstr "Breite/Keine"
145
+
146
+ #: includes/class-ctc-ui.php:282
147
+ msgid "Style"
148
+ msgstr "Stil"
149
+
150
+ #: includes/class-ctc-ui.php:283
151
+ msgid "Color"
152
+ msgstr "Farbe"
153
+
154
+ #: includes/class-ctc-ui.php:285
155
+ msgid ""
156
+ "Are you sure you wish to RESET? This will destroy any work you have done in "
157
+ "the Configurator."
158
+ msgstr ""
159
+ "Möchten Sie wirklich zurücksetzen? Dies wird jegliche Arbeit im Konfigurator "
160
+ "überschreiben."
161
+
162
+ #: includes/class-ctc-ui.php:286
163
+ msgid "<span style=\"font-size:10px\">!</span>"
164
+ msgstr "<span style=\"font-size:10px\">!</span>"
165
+
166
+ #: includes/class-ctc-ui.php:287 includes/forms/rule-value.php:32
167
+ msgid "Selectors"
168
+ msgstr "Selektoren"
169
+
170
+ #: includes/class-ctc-ui.php:288
171
+ msgid "Close"
172
+ msgstr "Schließen"
173
+
174
+ #: includes/class-ctc-ui.php:289
175
+ msgid "Edit Selector"
176
+ msgstr "Selektor wählen"
177
+
178
+ #: includes/class-ctc-ui.php:290
179
+ msgid "Cancel"
180
+ msgstr "Abbrechen"
181
+
182
+ #: includes/class-ctc-ui.php:291
183
+ msgid "Rename"
184
+ msgstr "Umbennen"
185
+
186
+ #: includes/class-ctc-ui.php:292
187
+ msgid "The stylesheet cannot be displayed."
188
+ msgstr "Die Formatvorlage kann nicht angezeigt werden."
189
+
190
+ #: includes/class-ctc-ui.php:293
191
+ msgid "(Child Only)"
192
+ msgstr "(Nur Kind)"
193
+
194
+ #: includes/class-ctc-ui.php:294
195
+ msgid "Please enter a valid Child Theme."
196
+ msgstr "Bitte gültiges Kindthema eingeben."
197
+
198
+ #: includes/class-ctc-ui.php:295
199
+ msgid "Please enter a valid Child Theme name."
200
+ msgstr "Bitte gültigen Kindthema-Namen eingeben."
201
+
202
+ #: includes/class-ctc-ui.php:296
203
+ msgid "<strong>%s</strong> exists. Please enter a different Child Theme"
204
+ msgstr "<strong>%s</strong> existiert. Bitte anderen Kindthema-Namen eingeben"
205
+
206
+ #: includes/class-ctc-ui.php:297
207
+ msgid "The page could not be loaded correctly."
208
+ msgstr "Die Seite konnte nicht korrekt geladen werden."
209
+
210
+ #: includes/class-ctc-ui.php:298
211
+ msgid ""
212
+ "Conflicting or out-of-date jQuery libraries were loaded by another plugin:"
213
+ msgstr ""
214
+ "jQuery-Bibliotheken-Konflikt oder veraltete wurden von anderem Plugin "
215
+ "geladen."
216
+
217
+ #: includes/class-ctc-ui.php:299
218
+ msgid "Deactivating or replacing plugins may resolve this issue."
219
+ msgstr "Deaktivieren oder Ersetzen von Plugins könnte das Problem lösen."
220
+
221
+ #: includes/class-ctc-ui.php:300
222
+ msgid "%sWhy am I seeing this?%s"
223
+ msgstr "%sWieso sehe ich das?%s"
224
+
225
+ #: includes/class-ctc-ui.php:303
226
+ msgid "No Styles Available. Check Parent/Child settings."
227
+ msgstr "Keine Stile verfügbar. Prüfen Sie Eltern/Kind-Einstellungen."
228
+
229
+ #: includes/class-ctc-ui.php:304
230
+ msgid "Updating"
231
+ msgstr "Aktualisiere"
232
+
233
+ #: includes/class-ctc-ui.php:305
234
+ msgid "Checking"
235
+ msgstr "Prüfe"
236
+
237
+ #: includes/class-ctc-ui.php:306
238
+ msgid "The theme \"%s\" generated unexpected PHP debug output."
239
+ msgstr "Das Thema \"%s\" erzeugte unerwartete PHP-Debug-Ausgabe."
240
+
241
+ #: includes/class-ctc-ui.php:307
242
+ msgid "The theme \"%s\" could not be loaded."
243
+ msgstr "Das Thema \"%s\" konnte nicht geladen werden."
244
+
245
+ #: includes/class-ctc-ui.php:308
246
+ msgid "<p>Please verify the theme has been installed correctly.</p>"
247
+ msgstr "<p>Bitte prüfen Sie, ob das Thema korrekt installiert wurde.</p>"
248
+
249
+ #: includes/class-ctc-ui.php:309
250
+ msgid "Show Debug Output"
251
+ msgstr "Zeige Debug-Ausgabe"
252
+
253
+ #: includes/class-ctc-ui.php:310
254
+ msgid ""
255
+ "<p>You may not be able to use this Theme as a Child Theme while these "
256
+ "conditions exist.</p><p>It is possible that this theme has specific "
257
+ "requirements to work correctly as a child theme. Check your theme's "
258
+ "documentation for more information.</p><p>Please make sure you are using the "
259
+ "latest version of this theme. If so, please contact this Theme's author and "
260
+ "report the error list above.</p>"
261
+ msgstr ""
262
+ "<p>Sie können dieses Thema unter diesen Bedingungen vielleicht nicht "
263
+ "benutzen.</p><p>Möglicherweise braucht das Thema spezielle Anforderungen, um "
264
+ "korrekt als Kindthema zu funktionieren. Prüfen Sie die Themen-Dokumentation "
265
+ "für weitere Infos.</p>Bitte stellen Sie sicher, die neueste Version dieses "
266
+ "Themas zu benutzen. Falls ja, kontaktieren Sie den Themenautor und melden "
267
+ "Sie den obigen Fehler.</p>"
268
+
269
+ #: includes/class-ctc-ui.php:311
270
+ msgid "Do Not Activate \"%s\"! A PHP FATAL ERROR has been detected."
271
+ msgstr "Aktivieren Sie nicht \"%s\"! Ein PHP FATAL ERROR wurde entdeckt."
272
+
273
+ #: includes/class-ctc-ui.php:312
274
+ msgid "This theme loads stylesheets after the wp_styles queue."
275
+ msgstr "Dieses Thema lädt Formatvorlagen nach der wp_styles Warteschlange."
276
+
277
+ #: includes/class-ctc-ui.php:313
278
+ msgid ""
279
+ "<p>This makes it difficult for plugins to override these styles. You can try "
280
+ "to resolve this using the \"Repair header template\" option (Step 6, "
281
+ "\"Additional handling options\", below).</p>"
282
+ msgstr ""
283
+ "<p>Dies macht es schwierig für Plugins, diese Stile zu übersteuern. Sie "
284
+ "können dies eventuell mit der \"Reparieren Header-Vorlage\"-Option beheben "
285
+ "(Schritt 6, \"Zusätzliche Behandlungsoptionen\", unten)</p>"
286
+
287
+ #: includes/class-ctc-ui.php:314
288
+ msgid ""
289
+ "This theme loads the parent theme's <code>style.css</code> file outside the "
290
+ "wp_styles queue."
291
+ msgstr ""
292
+ "Dieses Thema lädt die Elternthema <code>style.css</code>-Datei außerhalb der "
293
+ "wp_styles-Warteschlange."
294
+
295
+ #: includes/class-ctc-ui.php:315
296
+ msgid ""
297
+ "<p>This is common with older themes but requires the use of <code>@import</"
298
+ "code>, which is no longer recommended. You can try to resolve this using the "
299
+ "\"Repair header template\" option (see step 6, \"Additional handling options"
300
+ "\", below).</p>"
301
+ msgstr ""
302
+ "<p>Dies ist üblich bei älteren Themen, benötigt aber den Gebrauch von "
303
+ "<code>@import</code> (nicht mehr empfohlen). Sie können dies eventuell mit "
304
+ "der \"Reparieren Header-Vorlage\"-Option beheben (Schritt 6, \"Zusätzliche "
305
+ "Behandlungsoptionen\", unten)</p>"
306
+
307
+ #: includes/class-ctc-ui.php:316
308
+ msgid "This child theme does not load a Configurator stylesheet."
309
+ msgstr "Dieses Kindthema lädt keine Konfigurator-Formatvorlage."
310
+
311
+ #: includes/class-ctc-ui.php:317
312
+ msgid ""
313
+ "<p>If you want to customize styles using this plugin, please click "
314
+ "\"Configure Child Theme\" again to add this to the settings.</p>"
315
+ msgstr ""
316
+ "<p>Wenn Sie Stile mit diesem Plugin anpassen wollen, bitte klicken Sie "
317
+ "erneut \"Kindthema konfigurieren\", um dies zu den Einstellungen "
318
+ "hinzuzufügen.</p>"
319
+
320
+ #: includes/class-ctc-ui.php:318
321
+ msgid ""
322
+ "This child theme uses the parent stylesheet but does not load the parent "
323
+ "theme's <code>style.css</code> file."
324
+ msgstr ""
325
+ "Dieses Kindthema benutzt die Eltern-Formatvorlage, aber lädt nicht die "
326
+ "Elternthema <code>style.css</code>-Datei."
327
+
328
+ #: includes/class-ctc-ui.php:319
329
+ msgid ""
330
+ "<p>Please select a stylesheet handling method or check \"Ignore parent theme "
331
+ "stylesheets\" (see step 6, below).</p>"
332
+ msgstr ""
333
+ "<p>Bitte wählen Sie eine Formatvorlage-Behandlungsmethode oder kreuzen Sie "
334
+ "\"Elternthema-Formatvorlagen ignorieren\" an (siehe Schritt 6 unten).</p>"
335
+
336
+ #: includes/class-ctc-ui.php:320
337
+ msgid "This child theme appears to be functioning correctly."
338
+ msgstr "Dieses Kindthema scheint korrekt zu funktionieren."
339
+
340
+ #: includes/class-ctc-ui.php:321
341
+ msgid "This theme appears OK to use as a Child theme."
342
+ msgstr "Dieses Thema scheint als Kindthema OK zu sein."
343
+
344
+ #: includes/class-ctc-ui.php:322
345
+ msgid "This Child Theme has not been configured for this plugin."
346
+ msgstr "Dieses Kindthema wurde für dieses Plugin nicht konfiguriert."
347
+
348
+ #: includes/class-ctc-ui.php:323
349
+ msgid ""
350
+ "<p>The Configurator makes significant modifications to the child theme, "
351
+ "including stylesheet changes and additional php functions. Please consider "
352
+ "using the DUPLICATE child theme option (see step 1, above) and keeping the "
353
+ "original as a backup.</p>"
354
+ msgstr ""
355
+ "<p>Der Konfigurator macht umfangreiche Änderungen am Kindthema, inklusive "
356
+ "Formatvorlage-Änderungen und zusätzlichen PHP-Funktionen. Bitte ziehen Sie "
357
+ "die DUPLIZIEREN-Option für Kindthemen in Betracht (siehe Schritt 1 oben), um "
358
+ "das Original als Backup zu behalten.</p>"
359
+
360
+ #: includes/class-ctc-ui.php:324
361
+ msgid ""
362
+ "This child theme uses <code>@import</code> to load the parent theme's "
363
+ "<code>style.css</code> file."
364
+ msgstr ""
365
+ "Dieses Thema benutzt das Elternthema <code>@import</code>, um die Eltern "
366
+ "<code>style.css</code>-Datei zu laden."
367
+
368
+ #: includes/class-ctc-ui.php:325
369
+ msgid ""
370
+ "<p>Please consider selecting \"Use the WordPress style queue\" for the "
371
+ "parent stylesheet handling option (see step 6, below).</p>"
372
+ msgstr ""
373
+ "<p>Ziehen Sie bitte die Option \"Benutzen Sie die Wordpress Stil-"
374
+ "Warteschlange\" in Betracht für die Formatvorlage-Behandlung (siehe Schritt "
375
+ "6 unten)</p>"
376
+
377
+ #: includes/class-ctc-ui.php:326
378
+ msgid ""
379
+ "This theme loads additional stylesheets after the <code>style.css</code> "
380
+ "file:"
381
+ msgstr ""
382
+ "Dieses Thema lädt zusätzliche Formatvorlagen nach der <code>style.css</code>-"
383
+ "Datei."
384
+
385
+ #: includes/class-ctc-ui.php:327
386
+ msgid ""
387
+ "<p>Consider saving new custom styles to a \"Separate stylesheet\" (see step "
388
+ "5, below) so that you can customize these styles.</p>"
389
+ msgstr ""
390
+ "<p>Ziehen Sie in Betracht, neue Stile in eine separate Formatvorlage zu "
391
+ "sichern (siehe Schritt 5 unten), so dass Sie die Stile anpassen können.</p>"
392
+
393
+ #: includes/class-ctc-ui.php:328
394
+ msgid ""
395
+ "The parent theme's <code>style.css</code> file is being loaded automatically."
396
+ msgstr ""
397
+ "Die Elternthema-Datei <code>style.css</code> wird automatisch geladen."
398
+
399
+ #: includes/class-ctc-ui.php:329
400
+ msgid ""
401
+ "<p>\"Do not add any parent stylesheet handling\" has been selected for "
402
+ "\"Parent stylesheet handling\" (see step 6, below).</p>"
403
+ msgstr ""
404
+ "<p>\"Elternthema-Behandlung nicht hinzufügen\" wurde ausgewählt für "
405
+ "\"Elternthema-Behandlung\" (siehe Schritt 6 unten).</p>"
406
+
407
+ #: includes/class-ctc-ui.php:330
408
+ msgid ""
409
+ "This theme does not require the parent theme's <code>style.css</code> file "
410
+ "for its appearance."
411
+ msgstr ""
412
+ "Dieses Thema benötigt die <code>style.css</code>-Datei des Elternthemas "
413
+ "nicht für die Anzeige."
414
+
415
+ #: includes/class-ctc-ui.php:331
416
+ msgid "This Child Theme was configured with an earlier version."
417
+ msgstr "Dieses Kindthema wurde mit einer früheren Version konfiguriert."
418
+
419
+ #: includes/class-ctc-ui.php:332
420
+ msgid ""
421
+ "<p>The selected stylesheet handling method is no longer used. Please update "
422
+ "the configuration using the \"Repair header template\" option (see step 6, "
423
+ "\"Additional handling options\", below).</p>"
424
+ msgstr ""
425
+ "<p>Die ausgewählte Formatvorlage-Behandlungsmethode wird nicht mehr benutzt. "
426
+ "Bitte aktualisieren Sie die Konfiguration mit der \"Reparieren Header-Vorlage"
427
+ "\"-Option (siehe Schritt 6 unten, \"Zusätzliche Behandlungsoptionen\").</p>"
428
+
429
+ #: includes/class-ctc-ui.php:333
430
+ msgid "Show Analysis Object"
431
+ msgstr "Zeige Analyse von Objekt"
432
+
433
+ #: includes/class-ctc-ui.php:353
434
+ msgid ""
435
+ "The child theme is in read-only mode and Child Theme Configurator cannot "
436
+ "apply changes. Click to see options"
437
+ msgstr ""
438
+ "Dieses Kindthema ist im Nur-Lese-Modus und der Kindthemen-Konfigurator kann "
439
+ "die Änderungen nicht anwenden. Klicken Sie für Optionen"
440
+
441
+ #: includes/class-ctc-ui.php:356
442
+ msgid ""
443
+ "<li>Temporarily set write permissions by clicking the button below. When you "
444
+ "are finished editing, revert to read-only by clicking \"Make read-only\" "
445
+ "under the \"Files\" tab.</li>"
446
+ msgstr ""
447
+ "<li>Temporär die Schreibberechtigungen setzen (mit dem Klicken der "
448
+ "Schaltfläche). Wenn Sie mit der Bearbeitung fertig sind, können Sie \"Nur "
449
+ "lesbar\" klicken (Dateien-Tab), um zum alten Zustand zurück zu kehren.</li>"
450
+
451
+ #: includes/class-ctc-ui.php:359
452
+ msgid "Make files writable"
453
+ msgstr "Dateien beschreibbar machen"
454
+
455
+ #: includes/class-ctc-ui.php:360
456
+ msgid ""
457
+ "<li><a target=\"_blank\" href=\"http://codex.wordpress.org/Editing_wp-"
458
+ "config.php#WordPress_Upgrade_Constants\" title=\"Editin wp-config.php\">Add "
459
+ "your FTP/SSH credentials to the WordPress config file</a>.</li>"
460
+ msgstr ""
461
+ "<li><a target=\"_blank\" href=\"http://codex.wordpress.org/Editing_wp-"
462
+ "config.php#WordPress_Upgrade_Constants\" title=\"Editin wp-config.php\">Add "
463
+ "your FTP/SSH credentials to the WordPress config file</a>.</li>"
464
+
465
+ #: includes/class-ctc-ui.php:362
466
+ msgid ""
467
+ "<li><a target=\"_blank\" href=\"http://technet.microsoft.com/en-us/library/"
468
+ "cc771170\" title=\"Setting Application Pool Identity\">Assign WordPress to "
469
+ "an application pool that has write permissions</a> (Windows IIS systems).</"
470
+ "li>"
471
+ msgstr ""
472
+ "<li><a target=\"_blank\" href=\"http://technet.microsoft.com/en-us/library/"
473
+ "cc771170\" title=\"Setting Application Pool Identity\">Assign WordPress to "
474
+ "an application pool that has write permissions</a> (Windows IIS systems).</"
475
+ "li>"
476
+
477
+ #: includes/class-ctc-ui.php:363
478
+ msgid ""
479
+ "<li><a target=\"_blank\" href=\"http://codex.wordpress.org/"
480
+ "Changing_File_Permissions\" title=\"Changing File Permissions\">Set write "
481
+ "permissions on the server manually</a> (not recommended).</li>"
482
+ msgstr ""
483
+ "<li><a target=\"_blank\" href=\"http://codex.wordpress.org/"
484
+ "Changing_File_Permissions\" title=\"Changing File Permissions\">Set write "
485
+ "permissions on the server manually</a> (not recommended).</li>"
486
+
487
+ #: includes/class-ctc-ui.php:365
488
+ msgid "<li>Run PHP under Apache with suEXEC (contact your web host).</li>"
489
+ msgstr ""
490
+ "<li>PHP unter Apache mit suEXEC laufen lassen (kontaktieren Sie Ihren "
491
+ "Provider).</li>"
492
+
493
+ #: includes/class-ctc-ui.php:374
494
+ msgid ""
495
+ "This Child Theme is not owned by your website account. It may have been "
496
+ "created by a prior version of this plugin or by another program. Moving "
497
+ "forward, it must be owned by your website account to make changes. Child "
498
+ "Theme Configurator will attempt to correct this when you click the button "
499
+ "below."
500
+ msgstr ""
501
+ "Dieses Kindthema gehört nicht Ihrem Webseiten-Konto. Es könnte von einer "
502
+ "früheren Version dieses Plugins oder einem anderen Programm erstellt worden "
503
+ "sein. Um fortzufahren und Änderungen zu machen, müssen Sie es besitzen. Der "
504
+ "Kindthema-Konfigurator wird versuchen, dies zu korrigieren, wenn Sie die "
505
+ "Schaltfläche unten klicken."
506
+
507
+ #: includes/class-ctc-ui.php:382
508
+ msgid ""
509
+ "Child Theme Configurator needs to update its internal data. Please set your "
510
+ "preferences below and click \"Generate Child Theme Files\" to update your "
511
+ "configuration."
512
+ msgstr ""
513
+ "Der Kindthema-Konfigurator muss interne Daten aktualisieren. Bitte setzen "
514
+ "Sie Ihre Voreinstellungen unten und klicken Sie auf \"Erzeuge Kindthemen-"
515
+ "Dateien\", um die Konfiguration zu aktualisieren."
516
+
517
+ #: includes/class-ctc-ui.php:388
518
+ msgid ""
519
+ "<strong>However, some styles could not be parsed due to memory limits.</"
520
+ "strong> Try deselecting \"Additional Stylesheets\" below and click "
521
+ "\"Generate/Rebuild Child Theme Files\". %sWhy am I seeing this?%s"
522
+ msgstr ""
523
+ "<strong>Einige Stile konnten jedoch wegen Speicherlimiten nicht gelesen "
524
+ "werden.</strong> Versuchen Sie die Deselektion von \"Zusätzliche "
525
+ "Formatvorlagen\" unten und klicken Sie auf \"Erzeugen/Neuaufbau Kindthemen-"
526
+ "Dateien\". %sWieso sehe ich das?%s"
527
+
528
+ #: includes/class-ctc-ui.php:396
529
+ msgid ""
530
+ "Child Theme Configurator did not detect any configuration data because a "
531
+ "previously configured Child Theme has been removed. Please set your "
532
+ "preferences below and click \"Generate Child Theme Files\"."
533
+ msgstr ""
534
+ "Der Kindthema-Konfigurator enteckte keine Konfigurationsdaten, weil ein "
535
+ "früher konfiguriertes Kindthema entfernt wurde. Bitte setzen Sie Ihre "
536
+ "Voreinstellungen unten und klicken Sie auf \"Erzeugen Kindthema-Dateien\"."
537
+
538
+ #. Plugin Name of the plugin/theme
539
+ #: includes/class-ctc.php:49 includes/class-ctc.php:59
540
+ #: includes/forms/main.php:10
541
+ msgid "Child Theme Configurator"
542
+ msgstr "Kindthema-Konfigurator"
543
+
544
+ #: includes/class-ctc.php:50 includes/class-ctc.php:60
545
+ #: includes/class-ctc.php:70
546
+ msgid "Child Themes"
547
+ msgstr "Kindthemen"
548
+
549
+ #: includes/class-ctc.php:85
550
+ msgid "Child Theme Configurator requires WordPress version %s or later."
551
+ msgstr "Kindthema-Konfigurator benötigt WordPress-Version %s oder neuer."
552
+
553
+ #: includes/forms/addl_css.php:7
554
+ msgid "Parse additional stylesheets:"
555
+ msgstr "Zusätzliche Formatvorlagen einlesen:"
556
+
557
+ #: includes/forms/addl_css.php:11
558
+ msgid ""
559
+ "Stylesheets that are currently being loaded by the parent theme are "
560
+ "automatically selected below (except for Bootstrap stylesheets which add a "
561
+ "large amount data to the configuration). To further reduce overhead, select "
562
+ "only the additional stylesheets you wish to customize."
563
+ msgstr ""
564
+ "Aktuell geladene Formatvorlagen vom Elternthema werden unten automatisch "
565
+ "ausgewählt (ausgenommen Bootstrap-Stylesheets, welche der Konfiguration eine "
566
+ "enorme Datenmenge hinzufügen). Um weiteren Overhead zu vermeiden, wählen Sie "
567
+ "nur die Stylesheets aus, die Sie auch anpassen möchten."
568
+
569
+ #: includes/forms/addl_panels.php:9 includes/forms/addl_panels.php:39
570
+ msgid "Use coupon code"
571
+ msgstr "Gutschein-Code benutzen"
572
+
573
+ #: includes/forms/addl_panels.php:9 includes/forms/addl_panels.php:39
574
+ msgid "wordpress-org"
575
+ msgstr "wordpress-org"
576
+
577
+ #: includes/forms/addl_panels.php:9 includes/forms/addl_panels.php:39
578
+ msgid "and get <strong>20% off entire order</strong>."
579
+ msgstr "und erhalten Sie <strong> 20% auf die ganze Bestellung</strong>."
580
+
581
+ #: includes/forms/addl_panels.php:10 includes/forms/addl_panels.php:40
582
+ msgid "Order Now"
583
+ msgstr "Jetzt bestellen"
584
+
585
+ #: includes/forms/addl_panels.php:10 includes/forms/addl_panels.php:40
586
+ msgid "*Prices and offers subject to change."
587
+ msgstr "*Preise und Angebote können sich ändern."
588
+
589
+ #: includes/forms/addl_panels.php:11 includes/forms/addl_panels.php:12
590
+ msgid "Learn more about IntelliWidget"
591
+ msgstr "Mehr über IntelliWidget erfahren"
592
+
593
+ #: includes/forms/addl_panels.php:12
594
+ msgid ""
595
+ "IntelliWidget is a versatile widget manager that does the work of multiple "
596
+ "plugins by combining custom page menus, featured posts, sliders and other "
597
+ "dynamic content features into a single plugin that can display on a per-page "
598
+ "or site-wide basis."
599
+ msgstr ""
600
+ "IntelliWidget ist ein cleverer Widget-Manager, der die Arbeit von mehreren "
601
+ "Plugins erledigt, indem er Seitenmenüs, angesagte Beiträge, Slider und "
602
+ "anderen dynamischen Inhalt in ein einzelnes Plugin kombiniert, welche pro "
603
+ "Seite oder Site angezeigt werden können."
604
+
605
+ #: includes/forms/addl_panels.php:13 includes/forms/addl_panels.php:16
606
+ msgid "Learn more"
607
+ msgstr "Mehr erfahren"
608
+
609
+ #: includes/forms/addl_panels.php:14 includes/forms/addl_panels.php:15
610
+ msgid "Learn more about IW Responsive Menu"
611
+ msgstr "Mehr über IW Responsive Menu erfahren"
612
+
613
+ #: includes/forms/addl_panels.php:15
614
+ msgid ""
615
+ "IntelliWidget Responsive Menu lets you break free from your theme’s built-in "
616
+ "responsive menu options and gives you complete control over the user "
617
+ "experience."
618
+ msgstr ""
619
+ "IntelliWidget Responsive Menu lässt Sie aus den eingebauten Themen-"
620
+ "Menüoptionen ausbrechen und gibt Ihnen komplette Kontrolle über die "
621
+ "Benutzererfahrung."
622
+
623
+ #: includes/forms/addl_panels.php:19 includes/help/de_DE.php:214
624
+ msgid "Learn more about CTC Pro"
625
+ msgstr "Mehr über CTC Pro erfahren"
626
+
627
+ #: includes/forms/addl_panels.php:20
628
+ msgid "Customizing WordPress just got even easier."
629
+ msgstr "WordPress anzupassen ist jetzt noch einfacher."
630
+
631
+ #: includes/forms/addl_panels.php:21
632
+ msgid ""
633
+ "Thousands of users have already seen the benefits of using Child Theme "
634
+ "Configurator. If you spend any amount of time customizing WordPress, CTC Pro "
635
+ "will help maximize your productivity."
636
+ msgstr ""
637
+ "Tausende von Benutzern haben die Vorteile des Kindthema-Konfigurators (CTC) "
638
+ "schon gesehen. Wenn Sie Zeit mit der Anpassung von WordPress verwenden, holt "
639
+ "CTC Pro das Maximum an Produktivität heraus."
640
+
641
+ #: includes/forms/addl_panels.php:22
642
+ msgid "Designed by Developers Who Use It Every Day."
643
+ msgstr "Von Entwicklern kreiert, die es jeden Tag benutzen."
644
+
645
+ #: includes/forms/addl_panels.php:23
646
+ msgid ""
647
+ "We've packed in more features to make design work quicker and easier with "
648
+ "<strong>Child Theme Configurator Pro.</strong>"
649
+ msgstr ""
650
+ "Wir haben noch mehr Funktionen hineingepackt, um das Designen schneller und "
651
+ "einfacher zu machen mit <strong>Child Theme Configurator Pro.</strong>"
652
+
653
+ #: includes/forms/addl_panels.php:25
654
+ msgid "Customize Plugin Stylesheets"
655
+ msgstr "Plugin-Formatvorlagen anpassen"
656
+
657
+ #: includes/forms/addl_panels.php:26
658
+ msgid ""
659
+ "Apply the power of CTC's top-rated interface to your site's plugin styles. "
660
+ "All new design makes it much easier to get the results you want."
661
+ msgstr ""
662
+ "Wenden Sie die Macht von CTC's top-bewerteter Schnittstelle für Ihre Plugin-"
663
+ "Stile an. Das ganz neue Design macht es noch einfacher, die gewünschten "
664
+ "Resultate zu erhalten."
665
+
666
+ #: includes/forms/addl_panels.php:27
667
+ msgid "Quick Preview"
668
+ msgstr "Schnelle Vorschau"
669
+
670
+ #: includes/forms/addl_panels.php:27
671
+ msgid "Preview your child theme with a single click."
672
+ msgstr "Vorschau Ihres Kindthemas mit nur einem Klick."
673
+
674
+ #: includes/forms/addl_panels.php:28
675
+ msgid "Color Palettes"
676
+ msgstr "Farbpaletten"
677
+
678
+ #: includes/forms/addl_panels.php:28
679
+ msgid ""
680
+ "Keep the colors you select just a click away. No more searching for hex "
681
+ "codes and RGB values."
682
+ msgstr ""
683
+ "Die gewünschten Farben nur einen Klick entfernt. Kein umständliches Suchen "
684
+ "nach Hex-Codes und RGB-Werten."
685
+
686
+ #: includes/forms/addl_panels.php:29
687
+ msgid "Find related styles"
688
+ msgstr "Finde verwandte Stile"
689
+
690
+ #: includes/forms/addl_panels.php:29
691
+ msgid ""
692
+ "Use the \"All Styles\" panel to edit groups of selectors from a single "
693
+ "combined list."
694
+ msgstr ""
695
+ "Benutze Sie das \"Alle Stile\"-Werkzeug, um Gruppen von Selektoren in einer "
696
+ "einzigen kombinierten Liste zu bearbeiten."
697
+
698
+ #: includes/forms/addl_panels.php:30
699
+ msgid "Find styles by Nav Menu"
700
+ msgstr "Finde Stile mittels Nav-Menü"
701
+
702
+ #: includes/forms/addl_panels.php:30
703
+ msgid "Tweak menus quickly and easily."
704
+ msgstr "Menüs einfach und schnell anpassen."
705
+
706
+ #: includes/forms/addl_panels.php:31
707
+ msgid "Most recent edits"
708
+ msgstr "Letzte Bearbeitungen"
709
+
710
+ #: includes/forms/addl_panels.php:31
711
+ msgid "Return to recently edited selectors from a toggleable sidebar."
712
+ msgstr ""
713
+ "Zu den kürzlich bearbeiteten Selektoren mittels Umschalt-Seitenleiste "
714
+ "zurückkehren."
715
+
716
+ #: includes/forms/addl_panels.php:32
717
+ msgid "Genesis Framework Support"
718
+ msgstr "Genesis Framework Support"
719
+
720
+ #: includes/forms/addl_panels.php:33
721
+ msgid ""
722
+ "Automatically detects and configures Genesis Child Themes with more "
723
+ "frameworks on the way."
724
+ msgstr ""
725
+ "Entdeckt und konfiguriert automatisch Genesis-Kindthemen (mehr Frameworks "
726
+ "werden folgen)."
727
+
728
+ #: includes/forms/addl_panels.php:34
729
+ msgid "Top-rated Online Support"
730
+ msgstr "Top-bewerteter Online-Support"
731
+
732
+ #: includes/forms/addl_panels.php:35
733
+ msgid "Online Documentation"
734
+ msgstr "Online-Dokumentation"
735
+
736
+ #: includes/forms/addl_panels.php:36
737
+ msgid "Tutorial Videos"
738
+ msgstr "Anleitungs-Videos"
739
+
740
+ #: includes/forms/addl_tabs.php:8
741
+ msgid "Upgrade"
742
+ msgstr "Upgrade"
743
+
744
+ #: includes/forms/backup.php:8
745
+ msgid "Backup"
746
+ msgstr "Backup"
747
+
748
+ #: includes/forms/backups.php:10
749
+ msgid "Restore backup from"
750
+ msgstr "Backup wiederherstellen vom"
751
+
752
+ #: includes/forms/fileform.php:8
753
+ msgid ""
754
+ "The Theme editor has been disabled. Template files must be edited offline."
755
+ msgstr ""
756
+ "Der Themeneditor wurde deaktiviert. Vorlagendateien müssen offline "
757
+ "bearbeitet werden."
758
+
759
+ #: includes/forms/fileform.php:12
760
+ msgid "Click here to edit template files using the Theme Editor"
761
+ msgstr ""
762
+ "Hier klicken, um die Vorlagendateien mit dem Themeneditor zu bearbeiten"
763
+
764
+ #: includes/forms/fileform.php:23
765
+ msgid "Parent Templates"
766
+ msgstr "Eltern-Vorlagen"
767
+
768
+ #: includes/forms/fileform.php:23
769
+ msgid "Child Theme Files"
770
+ msgstr "Kindthemen-Dateien"
771
+
772
+ #: includes/forms/fileform.php:28
773
+ msgid ""
774
+ "Copy PHP templates from the parent theme by selecting them here. The "
775
+ "Configurator defines a template as a Theme PHP file having no PHP functions "
776
+ "or classes. Other PHP files cannot be safely overridden by a child theme."
777
+ msgstr ""
778
+ "PHP-Vorlagendateien des Elternthemas kopieren, indem Sie sie hier auswählen. "
779
+ "Der Konfigurator definiert eine Vorlage als eine PHP-Datei ohne Klassen bzw. "
780
+ "Funktionen. Andere PHP-Dateien können vom Kindthema nicht sicher "
781
+ "überschrieben werden."
782
+
783
+ #: includes/forms/fileform.php:31
784
+ msgid ""
785
+ "CAUTION: If your child theme is active, the child theme version of the file "
786
+ "will be used instead of the parent immediately after it is copied."
787
+ msgstr ""
788
+ "WARNUNG: Wenn Ihr Kindthema aktiv ist, wird sofort die Kindthema-Version der "
789
+ "Datei anstelle der Eltern-Version benutzt, nachdem sie kopiert wurde."
790
+
791
+ #: includes/forms/fileform.php:33
792
+ msgid "The %s file is generated separately and cannot be copied here."
793
+ msgstr "Die %s-Datei wird separat erzeugt und kann hier nicht kopiert werden."
794
+
795
+ #: includes/forms/fileform.php:43
796
+ msgid "Delete child theme templates by selecting them here."
797
+ msgstr "Kindthema-Vorlagen löschen, indem Sie sie hier auswählen."
798
+
799
+ #: includes/forms/fileform.php:44
800
+ msgid ""
801
+ "Delete child theme templates or make them writable by selecting them here. "
802
+ "Writable files are displayed in <span style=\"color:red\">red</span>."
803
+ msgstr ""
804
+ "Kindthema-Vorlagen löschen oder beschreibbar machen, indem Sie sie hier "
805
+ "auswählen. Beschreibbare Dateien sind in <span style=\"color:red\">rot</"
806
+ "span> angezeigt."
807
+
808
+ #: includes/forms/fileform.php:57
809
+ msgid "Make Selected Writable"
810
+ msgstr "Auswahl beschreibbar machen"
811
+
812
+ #: includes/forms/fileform.php:61
813
+ msgid "Copy Selected to Child Theme"
814
+ msgstr "In gewähltes Kindthema kopieren"
815
+
816
+ #: includes/forms/fileform.php:61 includes/forms/images.php:21
817
+ msgid "Delete Selected"
818
+ msgstr "Auswahl löschen"
819
+
820
+ #: includes/forms/files.php:15
821
+ msgid "Upload New Child Theme Image"
822
+ msgstr "Neues Kindthema-Abbild (Image) hochladen"
823
+
824
+ #: includes/forms/files.php:18
825
+ msgid ""
826
+ "Theme images reside under the <code>images</code> directory in your child "
827
+ "theme and are meant for stylesheet use only. Use the Media Library for "
828
+ "content images."
829
+ msgstr ""
830
+ "Themenbilder befinden sich unter dem <code>images</code>-Verzeichnis in "
831
+ "Ihrem Kindthema und sind nur für Formatvorlagen gedacht. Nutzen Sie die "
832
+ "Medienbibliothek für Inhaltsbilder."
833
+
834
+ #: includes/forms/files.php:25 includes/forms/files.php:51
835
+ msgid "Upload"
836
+ msgstr "Hochladen"
837
+
838
+ #: includes/forms/files.php:32
839
+ msgid "Child Theme Screenshot"
840
+ msgstr "Kindthema-Screenshot"
841
+
842
+ #: includes/forms/files.php:41
843
+ msgid "Upload New Screenshot"
844
+ msgstr "Neuer Kindthema-Screenshot"
845
+
846
+ #: includes/forms/files.php:44
847
+ msgid ""
848
+ "The theme screenshot should be a 4:3 ratio (e.g., 880px x 660px) JPG, PNG or "
849
+ "GIF. It will be renamed <code>screenshot</code>."
850
+ msgstr ""
851
+ "Der Themen-Screenshot sollte das Format 4:3 haben (bspw. 880px x 660px) JPG, "
852
+ "PNG oder GIF. Es wird umbenannt zu <code>screenshot</code>."
853
+
854
+ #: includes/forms/files.php:59
855
+ msgid "Export Child Theme as Zip Archive"
856
+ msgstr "Kindthema als ZIP-Archiv exportieren"
857
+
858
+ #: includes/forms/files.php:64
859
+ msgid "Export"
860
+ msgstr "Exportieren"
861
+
862
+ #: includes/forms/files.php:73
863
+ msgid "Secure Child Theme"
864
+ msgstr "Kindthema absichern"
865
+
866
+ #: includes/forms/files.php:76
867
+ msgid ""
868
+ "Attempt to reset child theme permissions to user ownership and read-only "
869
+ "access."
870
+ msgstr ""
871
+ "Versuche, die Kindthema-Berechtigungen zurückzusetzen (auf Nur-Lese-Zugriff "
872
+ "und Benutzerbesitz)."
873
+
874
+ #: includes/forms/files.php:82
875
+ msgid "Make read-only"
876
+ msgstr "Nur-Lesbar machen"
877
+
878
+ #: includes/forms/images.php:10
879
+ msgid "Child Theme Images"
880
+ msgstr "Kindthemen-Bilder"
881
+
882
+ #: includes/forms/images.php:13
883
+ msgid "Delete child theme images by selecting them here."
884
+ msgstr "Auswahl der Kindthemen-Bilder zum Löschen."
885
+
886
+ #: includes/forms/main.php:14
887
+ msgid "Debug"
888
+ msgstr "Debug"
889
+
890
+ #: includes/forms/main.php:17
891
+ msgid "Currently Loaded"
892
+ msgstr "Aktuell geladen"
893
+
894
+ #: includes/forms/parent-child.php:22
895
+ msgid "Select an action:"
896
+ msgstr "Aktion auswählen:"
897
+
898
+ #: includes/forms/parent-child.php:29
899
+ msgid "CREATE a new Child Theme"
900
+ msgstr "ERZEUGE ein neues Kindthema"
901
+
902
+ #: includes/forms/parent-child.php:32
903
+ msgid ""
904
+ "Install a new customizable child theme using an installed theme as a parent."
905
+ msgstr ""
906
+ "Ein neues anpassbares Kindthema mittels installiertem Thema als Elternthema "
907
+ "installieren."
908
+
909
+ #: includes/forms/parent-child.php:43
910
+ msgid "CONFIGURE an existing Child Theme"
911
+ msgstr "Bestehendes Kindthema ANPASSEN"
912
+
913
+ #: includes/forms/parent-child.php:46
914
+ msgid ""
915
+ "Set up a previously installed child theme for use with the Configurator or "
916
+ "to modify current settings."
917
+ msgstr ""
918
+ "Ein vorher installiertes Kindthema aufsetzen, um es mit dem Konfigurator "
919
+ "bearbeiten zu können."
920
+
921
+ #: includes/forms/parent-child.php:55
922
+ msgid "DUPLICATE an existing Child Theme"
923
+ msgstr "Bestehenes Kindthema DUPLIZIEREN"
924
+
925
+ #: includes/forms/parent-child.php:58
926
+ msgid ""
927
+ "Make a complete copy of an existing Child Theme in a new directory, "
928
+ "including any menus, widgets and other Customizer settings. The option to "
929
+ "copy the Parent Theme settings (step 8, below) is disabled with this action."
930
+ msgstr ""
931
+ "Eine vollständige Kopie eines bestehenden Kindthemas in neuem Verzeichnis "
932
+ "erstellen, inkl. Menüs, Widgets und andere Einstellungen. Die Option zum "
933
+ "Kopieren der Elternthema-Einstellungen (Schritt 8 unten) ist mit dieser "
934
+ "Aktion deaktiviert."
935
+
936
+ #: includes/forms/parent-child.php:67
937
+ msgid ""
938
+ "RESET an existing Child Theme (this will destroy any work you have done in "
939
+ "the Configurator)"
940
+ msgstr ""
941
+ "Ein bestehendes Kindthema ZURÜCKSETZEN (zerstört all Ihre bisherige Arbeit "
942
+ "mit dem Konfigurator)"
943
+
944
+ #: includes/forms/parent-child.php:70
945
+ msgid ""
946
+ "Revert the Child theme stylesheet and functions files to their state before "
947
+ "the initial configuration or last reset. Additional child theme files will "
948
+ "not be removed, but you can delete them under the Files tab."
949
+ msgstr ""
950
+ "Kindthema-Formatvorlage und Funktionsdateien auf ihren ursprünglichen "
951
+ "Zustand setzen (vor der Initial-Konfiguration oder dem letzten "
952
+ "Zurücksetzen). Zusätzliche Kindthemen-Dateien werden belassen, aber sie "
953
+ "können mittels \"Dateien\"-Tab gelöscht werden."
954
+
955
+ #: includes/forms/parent-child.php:79
956
+ msgid "Select a Parent Theme:"
957
+ msgstr "Elternthema auswählen:"
958
+
959
+ #: includes/forms/parent-child.php:83 includes/forms/parent-child.php:96
960
+ msgid "Analyze"
961
+ msgstr "Analysieren"
962
+
963
+ #: includes/forms/parent-child.php:85 includes/forms/parent-child.php:98
964
+ msgid ""
965
+ "Click \"Analyze\" to determine stylesheet dependencies and other potential "
966
+ "issues."
967
+ msgstr ""
968
+ "\"Analysieren\" klicken, um Formatvorlage-Abhängigkeiten und andere mögliche "
969
+ "Probleme zu erkennen."
970
+
971
+ #: includes/forms/parent-child.php:92
972
+ msgid "Select a Child Theme:"
973
+ msgstr "Kindthema auswählen:"
974
+
975
+ #: includes/forms/parent-child.php:98
976
+ msgid "Analyze Child Theme"
977
+ msgstr "Kindthema analysieren"
978
+
979
+ #: includes/forms/parent-child.php:106
980
+ msgid "Name the new theme directory:"
981
+ msgstr "Neues Verzeichnis benennen:"
982
+
983
+ #: includes/forms/parent-child.php:109
984
+ msgid "Directory Name"
985
+ msgstr "Verzeichnisname"
986
+
987
+ #: includes/forms/parent-child.php:113 includes/forms/parent-child.php:307
988
+ msgid "NOTE:"
989
+ msgstr "HINWEIS:"
990
+
991
+ #: includes/forms/parent-child.php:115
992
+ msgid ""
993
+ "This is NOT the name of the Child Theme. You can customize the name, "
994
+ "description, etc. in step 7, below."
995
+ msgstr ""
996
+ "Dies ist NICHT der Name des Kindthemas. Sie können Name, Beschreibung etc. "
997
+ "in Schritt 7 unten anpassen."
998
+
999
+ #: includes/forms/parent-child.php:119
1000
+ msgid "Verify Child Theme directory:"
1001
+ msgstr "Kindthema-Verzeichnis prüfen:"
1002
+
1003
+ #: includes/forms/parent-child.php:125
1004
+ msgid ""
1005
+ "For verification only (you cannot modify the directory of an existing Child "
1006
+ "Theme)."
1007
+ msgstr ""
1008
+ "Nur zur Überprüfung (Sie können das Verzeichnis eines Kindthemas nicht "
1009
+ "verändern)."
1010
+
1011
+ #: includes/forms/parent-child.php:135 includes/forms/parent-child.php:165
1012
+ msgid "Click to expand"
1013
+ msgstr "Zum Erweitern klicken"
1014
+
1015
+ #: includes/forms/parent-child.php:136
1016
+ msgid "Select where to save new styles:"
1017
+ msgstr "Speicherort der neuen Stile auswählen:"
1018
+
1019
+ #: includes/forms/parent-child.php:143
1020
+ msgid "Primary Stylesheet (style.css)"
1021
+ msgstr "Primäre Formatvorlage (style.css)"
1022
+
1023
+ #: includes/forms/parent-child.php:146
1024
+ msgid ""
1025
+ "Save new custom styles directly to the Child Theme primary stylesheet, "
1026
+ "replacing the existing values. The primary stylesheet will load in the order "
1027
+ "set by the theme."
1028
+ msgstr ""
1029
+ "Sichere neue angepasste Stile direkt in das primäre Formatvorlage des "
1030
+ "Kindthemas (ersetze vorhandene Werte). Die primäre Formatvorlage wird in "
1031
+ "definierter Reihenfolge geladen."
1032
+
1033
+ #: includes/forms/parent-child.php:156
1034
+ msgid "Separate Stylesheet"
1035
+ msgstr "Separate Formatvorlage"
1036
+
1037
+ #: includes/forms/parent-child.php:159
1038
+ msgid ""
1039
+ "Save new custom styles to a separate stylesheet and use any existing child "
1040
+ "theme styles as a baseline. Select this option if you want to preserve the "
1041
+ "original child theme styles instead of overwriting them. This option also "
1042
+ "allows you to customize stylesheets that load after the primary stylesheet."
1043
+ msgstr ""
1044
+ "Sichere neue angepasste Stile in separates Formatvorlage und verwende "
1045
+ "bestehende Kindthemen-Stile als Basis. Diese Option wählen, wenn Sie die "
1046
+ "Original-Kindthemen-Stile behalten wollen (statt zu überschreiben). Diese "
1047
+ "Option erlaubt Ihnen, nach der primären Formatvorlage geladene "
1048
+ "Formatvorlagen anzupassen."
1049
+
1050
+ #: includes/forms/parent-child.php:166
1051
+ msgid "Select Parent Theme stylesheet handling:"
1052
+ msgstr "Elternthema-Formatvorlage Behandlung auswählen:"
1053
+
1054
+ #: includes/forms/parent-child.php:179
1055
+ msgid "Use the WordPress style queue."
1056
+ msgstr "Benutze die WordPress Stil-Warteschlange."
1057
+
1058
+ #: includes/forms/parent-child.php:183
1059
+ msgid ""
1060
+ "Let the Configurator determine the appropriate actions and dependencies and "
1061
+ "update the functions file automatically."
1062
+ msgstr ""
1063
+ "Den Konfigurator die richtigen Aktionen und Abhängigkeiten auswählen lassen "
1064
+ "und Funktionendateien automatisch aktualisieren."
1065
+
1066
+ #: includes/forms/parent-child.php:189
1067
+ msgid "Use <code>@import</code> in the child theme stylesheet."
1068
+ msgstr "Benutze <code>@import</code> in der Kindthema-Formatvorlage."
1069
+
1070
+ #: includes/forms/parent-child.php:193
1071
+ msgid ""
1072
+ "Only use this option if the parent stylesheet cannot be loaded using the "
1073
+ "WordPress style queue. Using <code>@import</code> is not recommended."
1074
+ msgstr ""
1075
+ "Diese Option nur benutzen, wenn die Eltern-Formatvorlage nicht mit der "
1076
+ "WordPress-Warteschlange geladen werden kann. Benutzung von <code>@import</"
1077
+ "code> ist nicht länger empfohlen."
1078
+
1079
+ #: includes/forms/parent-child.php:199
1080
+ msgid "Do not add any parent stylesheet handling."
1081
+ msgstr "Keine zusätzliche Eltern-Formatvorlage-Behandlung hinzufügen."
1082
+
1083
+ #: includes/forms/parent-child.php:202
1084
+ msgid ""
1085
+ "Select this option if this theme already handles the parent theme stylesheet "
1086
+ "or if the parent theme's <code>style.css</code> file is not used for its "
1087
+ "appearance."
1088
+ msgstr ""
1089
+ "Diese Option wählen, wenn dieses Thema die Elternthema-Formatvorlage schon "
1090
+ "behandelt oder die Eltern-Thema <code>style.css</code>-Datei für die Anzeige "
1091
+ "nicht benutzt wird."
1092
+
1093
+ #: includes/forms/parent-child.php:205
1094
+ msgid "Additional handling options"
1095
+ msgstr "Zusätzliche Behandlungs-Optionen"
1096
+
1097
+ #: includes/forms/parent-child.php:212
1098
+ msgid "Ignore parent theme stylesheets."
1099
+ msgstr "Elternthema-Formatvorlagen ignorieren."
1100
+
1101
+ #: includes/forms/parent-child.php:213
1102
+ msgid ""
1103
+ "Do not load or parse the parent theme styles. Only use this option if the "
1104
+ "Child Theme uses a Framework like Genesis and only uses child theme "
1105
+ "stylesheets for its appearance."
1106
+ msgstr ""
1107
+ "Elternthema-Stile nicht laden oder auslesen. Diese Option nur benutzen, "
1108
+ "falls das Kindthema ein Framework wie Genesis nutzt und Kindthemen-"
1109
+ "Formatvorlagen für die Anzeige benutzt."
1110
+
1111
+ #: includes/forms/parent-child.php:222
1112
+ msgid "Repair the header template in the child theme."
1113
+ msgstr "Den Header der Vorlage im Kindthema reparieren."
1114
+
1115
+ #: includes/forms/parent-child.php:223
1116
+ msgid ""
1117
+ "Let the Configurator (try to) resolve any stylesheet issues listed above. "
1118
+ "This can fix many, but not all, common problems."
1119
+ msgstr ""
1120
+ "Den Konfigurator die obigen Probleme mit Formatvorlagen selber lösen lassen. "
1121
+ "Dies kann viele, aber nicht alle der üblichen Probleme lösen."
1122
+
1123
+ #: includes/forms/parent-child.php:228
1124
+ msgid "Click to toggle form"
1125
+ msgstr "Klicken um Formular umzuschalten"
1126
+
1127
+ #: includes/forms/parent-child.php:229
1128
+ msgid "Customize the Child Theme Name, Description, Author, Version, etc.:"
1129
+ msgstr "Kindthema-Name, Beschreibung, Autor, Version etc. anpassen"
1130
+
1131
+ #: includes/forms/parent-child.php:230
1132
+ msgid "(Click to toggle form)"
1133
+ msgstr "(Klicken um Formular umzuschalten)"
1134
+
1135
+ #: includes/forms/parent-child.php:234
1136
+ msgid "Child Theme Name"
1137
+ msgstr "Name des Kindthemas"
1138
+
1139
+ #: includes/forms/parent-child.php:238
1140
+ msgid "Theme Name"
1141
+ msgstr "Themenname"
1142
+
1143
+ #: includes/forms/parent-child.php:243 includes/forms/parent-child.php:247
1144
+ msgid "Theme Website"
1145
+ msgstr "Themenwebseite"
1146
+
1147
+ #: includes/forms/parent-child.php:252 includes/forms/parent-child.php:256
1148
+ msgid "Author"
1149
+ msgstr "Autor"
1150
+
1151
+ #: includes/forms/parent-child.php:261 includes/forms/parent-child.php:265
1152
+ msgid "Author Website"
1153
+ msgstr "Autoren-Webseite"
1154
+
1155
+ #: includes/forms/parent-child.php:270
1156
+ msgid "Theme Description"
1157
+ msgstr "Themen-Beschreibung"
1158
+
1159
+ #: includes/forms/parent-child.php:273
1160
+ msgid "Description"
1161
+ msgstr "Beschreibung"
1162
+
1163
+ #: includes/forms/parent-child.php:278
1164
+ msgid "Theme Tags"
1165
+ msgstr "Themen-Schlagwörter"
1166
+
1167
+ #: includes/forms/parent-child.php:281
1168
+ msgid "Tags"
1169
+ msgstr "Schlagwörter"
1170
+
1171
+ #: includes/forms/parent-child.php:286 includes/forms/parent-child.php:290
1172
+ msgid "Version"
1173
+ msgstr "Version"
1174
+
1175
+ #: includes/forms/parent-child.php:299
1176
+ msgid ""
1177
+ "Copy Parent Theme Menus, Widgets and other Customizer Settings to Child "
1178
+ "Theme:"
1179
+ msgstr ""
1180
+ "Kopieren der Elternthema-Menüs, Widgets und anderer Einstellungen in das "
1181
+ "Kindthema:"
1182
+
1183
+ #: includes/forms/parent-child.php:309
1184
+ msgid "This will overwrite any child theme options you may have already set."
1185
+ msgstr ""
1186
+ "Dies überschreibt alle Werte des Kindthemas, die allenfalls schon gesetzt "
1187
+ "sind."
1188
+
1189
+ #: includes/forms/parent-child.php:316 includes/forms/parent-child.php:353
1190
+ msgid "Click to run the Configurator:"
1191
+ msgstr "Klicken, um den Konfigurator laufen zu lassen:"
1192
+
1193
+ #: includes/forms/parent-child.php:319
1194
+ msgid "Configure Child Theme"
1195
+ msgstr "Kindthema konfigurieren"
1196
+
1197
+ #: includes/forms/parent-child.php:337
1198
+ msgid "Parse Plugin stylesheets:"
1199
+ msgstr "Plugin-Formatvorlagen einlesen"
1200
+
1201
+ #: includes/forms/parent-child.php:341
1202
+ msgid "Select the plugin stylesheets you wish to customize below."
1203
+ msgstr "Plugin-Formatvorlagen zum Anpassen unten auswählen"
1204
+
1205
+ #: includes/forms/parent-child.php:356
1206
+ msgid "Configure Plugin Styles"
1207
+ msgstr "Plugin-Stile konfigurieren"
1208
+
1209
+ #: includes/forms/query-selector.php:13
1210
+ msgid "@media Query"
1211
+ msgstr "@media Query"
1212
+
1213
+ #: includes/forms/query-selector.php:14
1214
+ msgid "( or \"base\" )"
1215
+ msgstr "( oder \"base\" )"
1216
+
1217
+ #: includes/forms/query-selector.php:24
1218
+ msgid "Selector"
1219
+ msgstr "Selektor"
1220
+
1221
+ #: includes/forms/query-selector.php:37 includes/forms/rule-value.php:29
1222
+ msgid "Sample"
1223
+ msgstr "Muster"
1224
+
1225
+ #: includes/forms/query-selector.php:45
1226
+ msgid "Save Child Values"
1227
+ msgstr "Kindwerte schreiben"
1228
+
1229
+ #: includes/forms/query-selector.php:46
1230
+ msgid "Delete Child Values"
1231
+ msgstr "Kindwerte löschen"
1232
+
1233
+ #: includes/forms/query-selector.php:53 includes/forms/rule-value.php:13
1234
+ msgid "Property"
1235
+ msgstr "Eigenschaft"
1236
+
1237
+ #: includes/forms/query-selector.php:56
1238
+ msgid "Baseline Value"
1239
+ msgstr "Basiswert"
1240
+
1241
+ #: includes/forms/query-selector.php:59
1242
+ msgid "Child Value"
1243
+ msgstr "Kindwert"
1244
+
1245
+ #: includes/forms/query-selector.php:65
1246
+ msgid "New Property"
1247
+ msgstr "Neue Eigenschaft"
1248
+
1249
+ #: includes/forms/query-selector.php:75
1250
+ msgid "Order"
1251
+ msgstr "Reihenfolge"
1252
+
1253
+ #: includes/forms/query-selector.php:84
1254
+ msgid "Copy Selector"
1255
+ msgstr "Selektor kopieren"
1256
+
1257
+ #: includes/forms/query-selector.php:86 includes/forms/webfonts.php:15
1258
+ msgid "Save"
1259
+ msgstr "Sichern"
1260
+
1261
+ #: includes/forms/query-selector.php:89
1262
+ msgid "Raw CSS"
1263
+ msgstr "Rohes CSS"
1264
+
1265
+ #: includes/forms/query-selector.php:91
1266
+ msgid "Use to enter shorthand CSS or new @media queries and selectors."
1267
+ msgstr ""
1268
+ "Benutzen, um Shorthand-CSS oder neue @media-Queries und Selektoren "
1269
+ "einzugeben."
1270
+
1271
+ #: includes/forms/query-selector.php:91
1272
+ msgid ""
1273
+ "Values entered here are merged into existing child styles or added to the "
1274
+ "child stylesheet if they do not exist in the parent."
1275
+ msgstr ""
1276
+ "Hier eingegebene Werte werden in bestehende Kind-Stile eingefügt oder "
1277
+ "hinzugefügt, falls sie im Eltern-Stil nicht bestehen sollten."
1278
+
1279
+ #: includes/forms/related.php:1
1280
+ msgid "New user?"
1281
+ msgstr "Neuer Benutzer?"
1282
+
1283
+ #: includes/forms/related.php:1
1284
+ msgid "Click help"
1285
+ msgstr "Klicken Sie auf Hilfe"
1286
+
1287
+ #: includes/forms/related.php:1
1288
+ msgid "Get CTC Pro and other tools"
1289
+ msgstr "CTC Pro und andere Tools erhalten"
1290
+
1291
+ #: includes/forms/related.php:1
1292
+ msgid "Lilaea Media - Responsive Tools for a Mobile World"
1293
+ msgstr "Klicken um Formular umzuschalten"
1294
+
1295
+ #: includes/forms/rule-value.php:26
1296
+ msgid "Value"
1297
+ msgstr "Wert"
1298
+
1299
+ #: includes/forms/tabs.php:11
1300
+ msgid "Parent/Child"
1301
+ msgstr "Eltern/Kind"
1302
+
1303
+ #: includes/forms/tabs.php:14
1304
+ msgid "Query/Selector"
1305
+ msgstr "Abfrage/Selektor"
1306
+
1307
+ #: includes/forms/tabs.php:17
1308
+ msgid "Property/Value"
1309
+ msgstr "Eigenschaft/Wert"
1310
+
1311
+ #: includes/forms/tabs.php:20
1312
+ msgid "Web Fonts"
1313
+ msgstr "Webschriftarten"
1314
+
1315
+ #: includes/forms/tabs.php:23
1316
+ msgid "Baseline Styles"
1317
+ msgstr "Basis-Stile"
1318
+
1319
+ #: includes/forms/tabs.php:26
1320
+ msgid "Child Styles"
1321
+ msgstr "Kind-Stile"
1322
+
1323
+ #: includes/forms/tabs.php:30
1324
+ msgid "Files"
1325
+ msgstr "Dateien"
1326
+
1327
+ #: includes/forms/themepreview.php:12
1328
+ msgid "Version: "
1329
+ msgstr "Version: "
1330
+
1331
+ #: includes/forms/themepreview.php:14
1332
+ msgid "By: "
1333
+ msgstr "Von:"
1334
+
1335
+ #: includes/forms/themepreview.php:16
1336
+ msgid "Preview"
1337
+ msgstr "Vorschau"
1338
+
1339
+ #: includes/forms/themepreview.php:17
1340
+ msgid " in default Site"
1341
+ msgstr " in Standard-Seite"
1342
+
1343
+ #: includes/forms/themepreview.php:21
1344
+ msgid "Not Network Enabled"
1345
+ msgstr "Nicht netzwerk-aktiviert"
1346
+
1347
+ #: includes/forms/webfonts.php:18
1348
+ msgid "Linked Stylesheets"
1349
+ msgstr "Verknüpfte Formatvorlagen"
1350
+
1351
+ #: includes/forms/webfonts.php:20
1352
+ msgid ""
1353
+ "Use <code>@import url( [path] );</code> to link additional stylesheets. "
1354
+ "Child Theme Configurator uses the <code>@import</code> keyword to identify "
1355
+ "them and convert them to <code>&lt;link&gt;</code> tags. <strong>Example:</"
1356
+ "strong>"
1357
+ msgstr ""
1358
+ "Benutze <code>@import url( [path] );</code>, um zusätzliche Formatvorlagen "
1359
+ "zu verknüpfen. CTC benutzt das <code>@import</code> Schlüsselwort, um sie zu "
1360
+ "identifizieren und sie in <code>&lt;link&gt;</code> Tags zu konvertieren. "
1361
+ "<strong>Beispiel:</strong>"
1362
+
1363
+ #. Plugin URI of the plugin/theme
1364
+ msgid "http://www.childthemeconfigurator.com"
1365
+ msgstr "http://www.childthemeconfigurator.com"
1366
+
1367
+ #. Description of the plugin/theme
1368
+ msgid ""
1369
+ "Create child themes and customize styles, templates and functions. Enqueues "
1370
+ "stylesheets and web fonts. Handles rgba, vendor-prefixes and more."
1371
+ msgstr ""
1372
+ "Benutze Kindthemen und passe Stile, Vorlagen und Funktionen an. Behandelt "
1373
+ "Formatvorlagen und Webschriftarten sowie RGBA, Hersteller-Präfixe und mehr."
1374
+
1375
+ #. Author of the plugin/theme
1376
+ msgid "Lilaea Media"
1377
+ msgstr "Lilaea Media"
1378
+
1379
+ #. Author URI of the plugin/theme
1380
+ msgid "http://www.lilaeamedia.com"
1381
+ msgstr "http://www.lilaeamedia.com"
lang/{chld_thm_cfg-sr_RS.mo → child-theme-configurator-sr_RS.mo} RENAMED
File without changes
lang/{chld_thm_cfg-sr_RS.po → child-theme-configurator-sr_RS.po} RENAMED
File without changes
lang/{chld_thm_cfg.pot → child-theme-configurator.pot} RENAMED
@@ -1,270 +1,406 @@
1
- # Copyright (C) 2015 Child Theme Configurator
2
  # This file is distributed under the same license as the Child Theme Configurator package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Child Theme Configurator 1.7.8\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/child-theme-configurator\n"
7
- "POT-Creation-Date: 2015-09-24 00:16:38+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
- "PO-Revision-Date: 2015-MO-DA HO:MI+ZONE\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.8) #-#-#-#-#
16
- #. Plugin Name of the plugin/theme
17
- #: child-theme-configurator.php:78 child-theme-configurator.php:88
18
- #: includes/forms/main.php:23
19
- msgid "Child Theme Configurator"
20
  msgstr ""
21
 
22
- #: child-theme-configurator.php:79 child-theme-configurator.php:89
23
- #: child-theme-configurator.php:99
24
- msgid "Child Themes"
25
  msgstr ""
26
 
27
- #: child-theme-configurator.php:114
28
- msgid "Child Theme Configurator requires WordPress version %s or later."
 
 
 
 
 
 
 
 
29
  msgstr ""
30
 
31
- #: includes/class-ctc-ui.php:52
32
- msgid "A stylesheet link tag is hard-coded into the header template."
33
  msgstr ""
34
 
35
- #: includes/class-ctc-ui.php:53
36
- msgid "<code>wp_enqueue_style()</code> called from the header template."
37
  msgstr ""
38
 
39
- #: includes/class-ctc-ui.php:55
40
  msgid ""
41
- "Code exists between the <code>wp_head()</code> function and the closing "
42
- "<code>&lt;/head&gt;</code> tag."
43
  msgstr ""
44
 
45
- #: includes/class-ctc-ui.php:162
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  msgid "Child Theme files modified successfully."
47
  msgstr ""
48
 
49
- #: includes/class-ctc-ui.php:165
50
  msgid ""
51
- "Child Theme <strong>%s</strong> has been generated successfully.\n"
52
- " "
53
  msgstr ""
54
 
55
- #: includes/class-ctc-ui.php:168
 
 
 
 
56
  msgid "IMPORTANT:"
57
  msgstr ""
58
 
59
- #: includes/class-ctc-ui.php:170 includes/forms/themepreview.php:20
60
  msgid "Go to Themes"
61
  msgstr ""
62
 
63
- #: includes/class-ctc-ui.php:170
64
  msgid "Network enable"
65
  msgstr ""
66
 
67
- #: includes/class-ctc-ui.php:170
68
  msgid "your child theme."
69
  msgstr ""
70
 
71
- #: includes/class-ctc-ui.php:172 includes/forms/themepreview.php:18
72
  msgid "Live Preview"
73
  msgstr ""
74
 
75
- #: includes/class-ctc-ui.php:172
76
- msgid "Test your child theme"
77
  msgstr ""
78
 
79
- #: includes/class-ctc-ui.php:172
80
  msgid "before activating."
81
  msgstr ""
82
 
83
- #: includes/class-ctc.php:144
84
  msgid "URL/None"
85
  msgstr ""
86
 
87
- #: includes/class-ctc.php:145
88
  msgid "Origin"
89
  msgstr ""
90
 
91
- #: includes/class-ctc.php:146
92
  msgid "Color 1"
93
  msgstr ""
94
 
95
- #: includes/class-ctc.php:147
96
  msgid "Color 2"
97
  msgstr ""
98
 
99
- #: includes/class-ctc.php:148
100
  msgid "Width/None"
101
  msgstr ""
102
 
103
- #: includes/class-ctc.php:149
104
  msgid "Style"
105
  msgstr ""
106
 
107
- #: includes/class-ctc.php:150
108
  msgid "Color"
109
  msgstr ""
110
 
111
- #: includes/class-ctc.php:152
112
- msgid "Are you sure? This will replace your current settings."
 
 
113
  msgstr ""
114
 
115
- #: includes/class-ctc.php:153
116
  msgid "<span style=\"font-size:10px\">!</span>"
117
  msgstr ""
118
 
119
- #: includes/class-ctc.php:154 includes/forms/rule-value.php:32
120
  msgid "Selectors"
121
  msgstr ""
122
 
123
- #: includes/class-ctc.php:155
124
  msgid "Close"
125
  msgstr ""
126
 
127
- #: includes/class-ctc.php:156
128
  msgid "Edit Selector"
129
  msgstr ""
130
 
131
- #: includes/class-ctc.php:157
132
  msgid "Cancel"
133
  msgstr ""
134
 
135
- #: includes/class-ctc.php:158
136
  msgid "Rename"
137
  msgstr ""
138
 
139
- #: includes/class-ctc.php:159
140
  msgid "The stylesheet cannot be displayed."
141
  msgstr ""
142
 
143
- #: includes/class-ctc.php:160
144
  msgid "(Child Only)"
145
  msgstr ""
146
 
147
- #: includes/class-ctc.php:161
148
  msgid "Please enter a valid Child Theme."
149
  msgstr ""
150
 
151
- #: includes/class-ctc.php:162
152
  msgid "Please enter a valid Child Theme name."
153
  msgstr ""
154
 
155
- #: includes/class-ctc.php:163
156
  msgid "<strong>%s</strong> exists. Please enter a different Child Theme"
157
  msgstr ""
158
 
159
- #: includes/class-ctc.php:164
160
  msgid "The page could not be loaded correctly."
161
  msgstr ""
162
 
163
- #: includes/class-ctc.php:166
164
  msgid ""
165
  "Conflicting or out-of-date jQuery libraries were loaded by another plugin:"
166
  msgstr ""
167
 
168
- #: includes/class-ctc.php:168
169
  msgid "Deactivating or replacing plugins may resolve this issue."
170
  msgstr ""
171
 
172
- #: includes/class-ctc.php:169
173
  msgid "%sWhy am I seeing this?%s"
174
  msgstr ""
175
 
176
- #: includes/class-ctc.php:392
177
- msgid "Zip file creation failed."
178
  msgstr ""
179
 
180
- #: includes/class-ctc.php:428
181
- msgid "The Functions file is required and cannot be deleted."
182
  msgstr ""
183
 
184
- #: includes/class-ctc.php:510
185
- msgid "You do not have permission to configure child themes."
186
  msgstr ""
187
 
188
- #: includes/class-ctc.php:557
189
- msgid "%s does not exist. Please select a valid Parent Theme."
190
  msgstr ""
191
 
192
- #: includes/class-ctc.php:561
193
- msgid "Please select a valid Parent Theme."
194
  msgstr ""
195
 
196
- #: includes/class-ctc.php:564
197
- msgid "Please enter a valid Child Theme directory."
198
  msgstr ""
199
 
200
- #: includes/class-ctc.php:572 includes/class-ctc.php:587
201
- msgid "Please enter a valid Child Theme template name."
202
  msgstr ""
203
 
204
- #: includes/class-ctc.php:577 includes/class-ctc.php:591
205
  msgid ""
206
- "<strong>%s</strong> exists. Please enter a different Child Theme template "
207
- "name."
 
 
 
 
208
  msgstr ""
209
 
210
- #: includes/class-ctc.php:604
211
- msgid "Your theme directories are not writable."
212
  msgstr ""
213
 
214
- #: includes/class-ctc.php:682
215
- msgid "Your stylesheet is not writable."
216
  msgstr ""
217
 
218
- #: includes/class-ctc.php:959
219
  msgid ""
220
- "A closing PHP tag was detected in Child theme functions file so \"Parent "
221
- "Stylesheet Handling\" option was not configured. Closing PHP at the end of "
222
- "the file is discouraged as it can cause premature HTTP headers. Please edit "
223
- "<code>functions.php</code> to remove the final <code>?&gt;</code> tag and "
224
- "click \"Generate/Rebuild Child Theme Files\" again."
225
  msgstr ""
226
 
227
- #: includes/class-ctc.php:1060
228
- msgid "Could not delete file."
 
 
229
  msgstr ""
230
 
231
- #: includes/class-ctc.php:1139
232
- msgid "Could not set write permissions."
 
 
 
 
233
  msgstr ""
234
 
235
- #: includes/class-ctc.php:1240
236
- msgid "There were errors while resetting permissions."
237
  msgstr ""
238
 
239
- #: includes/class-ctc.php:1282
240
- msgid "Could not upload file."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
241
  msgstr ""
242
 
243
- #: includes/class-ctc.php:1365
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
244
  msgid ""
245
  "The child theme is in read-only mode and Child Theme Configurator cannot "
246
  "apply changes. Click to see options"
247
  msgstr ""
248
 
249
- #: includes/class-ctc.php:1368
250
  msgid ""
251
  "<li>Temporarily set write permissions by clicking the button below. When you "
252
  "are finished editing, revert to read-only by clicking \"Make read-only\" "
253
  "under the \"Files\" tab.</li>"
254
  msgstr ""
255
 
256
- #: includes/class-ctc.php:1371
257
  msgid "Make files writable"
258
  msgstr ""
259
 
260
- #: includes/class-ctc.php:1372
261
  msgid ""
262
  "<li><a target=\"_blank\" href=\"http://codex.wordpress.org/Editing_wp-"
263
  "config.php#WordPress_Upgrade_Constants\" title=\"Editin wp-config.php\">Add "
264
  "your FTP/SSH credentials to the WordPress config file</a>.</li>"
265
  msgstr ""
266
 
267
- #: includes/class-ctc.php:1374
268
  msgid ""
269
  "<li><a target=\"_blank\" href=\"http://technet.microsoft.com/en-us/library/"
270
  "cc771170\" title=\"Setting Application Pool Identity\">Assign WordPress to "
@@ -272,18 +408,18 @@ msgid ""
272
  "li>"
273
  msgstr ""
274
 
275
- #: includes/class-ctc.php:1375
276
  msgid ""
277
  "<li><a target=\"_blank\" href=\"http://codex.wordpress.org/"
278
  "Changing_File_Permissions\" title=\"Changing File Permissions\">Set write "
279
  "permissions on the server manually</a> (not recommended).</li>"
280
  msgstr ""
281
 
282
- #: includes/class-ctc.php:1377
283
  msgid "<li>Run PHP under Apache with suEXEC (contact your web host).</li>"
284
  msgstr ""
285
 
286
- #: includes/class-ctc.php:1388
287
  msgid ""
288
  "This Child Theme is not owned by your website account. It may have been "
289
  "created by a prior version of this plugin or by another program. Moving "
@@ -292,36 +428,48 @@ msgid ""
292
  "below."
293
  msgstr ""
294
 
295
- #: includes/class-ctc.php:1391
296
- msgid "Correct Child Theme Permissions"
297
- msgstr ""
298
-
299
- #: includes/class-ctc.php:1398
300
  msgid ""
301
- "Child Theme Configurator needs to update its interal data. Please set your "
302
  "preferences below and click \"Generate Child Theme Files\" to update your "
303
  "configuration."
304
  msgstr ""
305
 
306
- #: includes/class-ctc.php:1404
307
  msgid ""
308
  "<strong>However, some styles could not be parsed due to memory limits.</"
309
  "strong> Try deselecting \"Additional Stylesheets\" below and click "
310
  "\"Generate/Rebuild Child Theme Files\". %sWhy am I seeing this?%s"
311
  msgstr ""
312
 
313
- #: includes/class-ctc.php:1413
314
  msgid ""
315
  "Child Theme Configurator did not detect any configuration data because a "
316
  "previously configured Child Theme has been removed. Please set your "
317
  "preferences below and click \"Generate Child Theme Files\"."
318
  msgstr ""
319
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
320
  #: includes/forms/addl_css.php:7
321
  msgid "Parse additional stylesheets:"
322
  msgstr ""
323
 
324
- #: includes/forms/addl_css.php:11 includes/forms/parent-child.php:270
325
  msgid ""
326
  "Stylesheets that are currently being loaded by the parent theme are "
327
  "automatically selected below (except for Bootstrap stylesheets which add a "
@@ -376,7 +524,7 @@ msgid ""
376
  "experience."
377
  msgstr ""
378
 
379
- #: includes/forms/addl_panels.php:19 includes/help/help_en_US.php:215
380
  msgid "Learn more about CTC Pro"
381
  msgstr ""
382
 
@@ -416,7 +564,7 @@ msgid "Quick Preview"
416
  msgstr ""
417
 
418
  #: includes/forms/addl_panels.php:27
419
- msgid "Test your child theme with a single click."
420
  msgstr ""
421
 
422
  #: includes/forms/addl_panels.php:28
@@ -485,7 +633,7 @@ msgstr ""
485
  msgid "Backup"
486
  msgstr ""
487
 
488
- #: includes/forms/backups.php:10 includes/forms/parent-child.php:253
489
  msgid "Restore backup from"
490
  msgstr ""
491
 
@@ -507,7 +655,10 @@ msgid "Child Theme Files"
507
  msgstr ""
508
 
509
  #: includes/forms/fileform.php:28
510
- msgid "Copy PHP template files from the parent theme by selecting them here."
 
 
 
511
  msgstr ""
512
 
513
  #: includes/forms/fileform.php:31
@@ -601,246 +752,290 @@ msgstr ""
601
  msgid "Delete child theme images by selecting them here."
602
  msgstr ""
603
 
604
- #: includes/forms/main.php:23
605
- msgid "version"
606
  msgstr ""
607
 
608
- #: includes/forms/parent-child.php:17
609
- msgid "Parent Theme"
610
  msgstr ""
611
 
612
- #: includes/forms/parent-child.php:25
613
- msgid "Child Theme"
614
  msgstr ""
615
 
616
- #: includes/forms/parent-child.php:27
617
- msgid "(click to edit additional fields)"
618
  msgstr ""
619
 
620
- #: includes/forms/parent-child.php:34
621
- msgid "Create New Child Theme"
 
622
  msgstr ""
623
 
624
  #: includes/forms/parent-child.php:43
625
- msgid "Use Existing Child Theme"
626
  msgstr ""
627
 
628
- #: includes/forms/parent-child.php:48
629
- msgid "New Child Theme Slug"
 
 
630
  msgstr ""
631
 
632
- #: includes/forms/parent-child.php:59
633
- msgid "Child Theme Name"
634
  msgstr ""
635
 
636
- #: includes/forms/parent-child.php:63
637
- msgid "Theme Name"
 
 
 
638
  msgstr ""
639
 
640
- #: includes/forms/parent-child.php:66 includes/forms/parent-child.php:70
641
- msgid "Theme Website"
 
 
642
  msgstr ""
643
 
644
- #: includes/forms/parent-child.php:73 includes/forms/parent-child.php:77
645
- msgid "Author"
 
 
 
646
  msgstr ""
647
 
648
- #: includes/forms/parent-child.php:81 includes/forms/parent-child.php:85
649
- msgid "Author Website"
650
  msgstr ""
651
 
652
- #: includes/forms/parent-child.php:88
653
- msgid "Theme Description"
654
  msgstr ""
655
 
656
- #: includes/forms/parent-child.php:91
657
- msgid "Description"
 
 
658
  msgstr ""
659
 
660
- #: includes/forms/parent-child.php:94
661
- msgid "Theme Tags"
662
  msgstr ""
663
 
664
- #: includes/forms/parent-child.php:97
665
- msgid "Tags"
666
  msgstr ""
667
 
668
- #: includes/forms/parent-child.php:100 includes/forms/parent-child.php:104
669
- msgid "Version"
670
  msgstr ""
671
 
672
  #: includes/forms/parent-child.php:109
673
- msgid "Duplicate Existing Child Theme"
674
  msgstr ""
675
 
676
- #: includes/forms/parent-child.php:115
677
- msgid "Duplicate Theme Slug"
678
  msgstr ""
679
 
680
- #: includes/forms/parent-child.php:118 includes/forms/parent-child.php:212
681
- #: includes/forms/parent-child.php:227
682
- msgid "NOTE:"
 
683
  msgstr ""
684
 
685
- #: includes/forms/parent-child.php:120
686
- msgid "This will copy all child theme files and apply changes to new version."
687
  msgstr ""
688
 
689
- #: includes/forms/parent-child.php:126
690
- msgid "Debug"
 
 
691
  msgstr ""
692
 
693
- #: includes/forms/parent-child.php:134
694
- msgid "Check the box to enable debugging output."
695
  msgstr ""
696
 
697
- #: includes/forms/parent-child.php:141
698
- msgid "Stylesheet handling"
699
  msgstr ""
700
 
701
- #: includes/forms/parent-child.php:142
702
- msgid "(click to view options)"
703
  msgstr ""
704
 
705
- #: includes/forms/parent-child.php:144
706
  msgid ""
707
- "This theme may not apply child theme styles correctly with the current "
708
- "settings:"
 
709
  msgstr ""
710
 
711
- #: includes/forms/parent-child.php:146
712
- msgid "Don't show again."
713
  msgstr ""
714
 
715
- #: includes/forms/parent-child.php:146
716
- msgid "View options"
 
 
 
 
717
  msgstr ""
718
 
719
- #: includes/forms/parent-child.php:149
720
- msgid "Which option should I use?"
721
  msgstr ""
722
 
723
- #: includes/forms/parent-child.php:154
724
- msgid "None (handled by theme)"
725
  msgstr ""
726
 
727
- #: includes/forms/parent-child.php:158
728
  msgid ""
729
- "Select this option if all stylesheets are correctly enqueued for child "
730
- "themes. If you find that styles are not being applied correctly, use a "
731
- "different option."
732
  msgstr ""
733
 
734
- #: includes/forms/parent-child.php:165
735
- msgid "Enqueue parent stylesheet (default)"
736
  msgstr ""
737
 
738
- #: includes/forms/parent-child.php:168
739
  msgid ""
740
- "Select this option if the theme enqueues the active stylesheet but has no "
741
- "special handling for child themes. Start with this option if unsure."
742
  msgstr ""
743
 
744
- #: includes/forms/parent-child.php:175
745
- msgid "Enqueue child stylesheet"
746
  msgstr ""
747
 
748
- #: includes/forms/parent-child.php:178
749
  msgid ""
750
- "Select this option if the theme enqueues the parent stylesheet but does not "
751
- "enqueue the child stylesheet at all. This can happen if "
752
- "<code>get_template()</code> or <code>get_template_directory_uri()</code> is "
753
- "used to link the stylesheet."
754
  msgstr ""
755
 
756
- #: includes/forms/parent-child.php:181
757
- msgid "Recommended for this theme:"
758
  msgstr ""
759
 
760
- #: includes/forms/parent-child.php:187
761
- msgid "Enqueue both parent and child stylesheets"
762
  msgstr ""
763
 
764
- #: includes/forms/parent-child.php:190
765
  msgid ""
766
- "Select this option if stylesheet link tags are hard-coded into the header "
767
- "template (common in older themes). This enables the child stylesheet to "
768
- "override the parent stylesheet without using <code>@import</code>."
769
  msgstr ""
770
 
771
- #: includes/forms/parent-child.php:197
772
- msgid "<code>@import</code> parent stylesheet"
773
  msgstr ""
774
 
775
- #: includes/forms/parent-child.php:200
776
  msgid ""
777
- "This option imports the parent stylesheet from the child stylesheet. This "
778
- "enables the child stylesheet to override the parent stylesheet, but using "
779
- "<code>@import</code> is no longer recommended."
780
  msgstr ""
781
 
782
- #: includes/forms/parent-child.php:205
783
- msgid "Copy Parent Theme Menus, Widgets and other Customizer Options"
784
  msgstr ""
785
 
786
- #: includes/forms/parent-child.php:214
787
- msgid "This will overwrite child theme options you may have already set."
788
  msgstr ""
789
 
790
- #: includes/forms/parent-child.php:220
791
- msgid "Backup current stylesheet"
792
  msgstr ""
793
 
794
- #: includes/forms/parent-child.php:229
795
- msgid ""
796
- "This creates a copy of the current stylesheet before applying changes. You "
797
- "can remove old backup files using the Files tab."
798
  msgstr ""
799
 
800
- #: includes/forms/parent-child.php:234
801
- msgid "Reset/Restore from backup"
 
 
 
 
802
  msgstr ""
803
 
804
- #: includes/forms/parent-child.php:240
805
- msgid "Leave unchanged"
806
  msgstr ""
807
 
808
- #: includes/forms/parent-child.php:246
809
- msgid "Reset all"
810
  msgstr ""
811
 
812
- #: includes/forms/parent-child.php:266
813
- msgid "Parse additional stylesheets"
814
  msgstr ""
815
 
816
- #: includes/forms/parent-child.php:290
817
- msgid "Please read before you click:"
818
  msgstr ""
819
 
820
- #: includes/forms/parent-child.php:291
 
 
 
 
 
 
 
 
 
 
 
 
821
  msgid ""
822
- "This plugin makes significant modifications to your child theme, to include "
823
- "changing CSS, removing comments and adding php functions."
 
 
 
 
 
 
 
 
824
  msgstr ""
825
 
826
- #: includes/forms/parent-child.php:292
827
- msgid "If you are using an existing Child Theme,"
828
  msgstr ""
829
 
830
- #: includes/forms/parent-child.php:292
831
- msgid "please consider using the Duplicate Child Theme option"
832
  msgstr ""
833
 
834
- #: includes/forms/parent-child.php:292
835
- msgid "before proceeding."
836
  msgstr ""
837
 
838
- #: includes/forms/parent-child.php:298
839
- msgid "Generate/Rebuild Child Theme Files"
840
  msgstr ""
841
 
842
  #: includes/forms/query-selector.php:13
843
- msgid "Query"
 
 
 
 
844
  msgstr ""
845
 
846
  #: includes/forms/query-selector.php:24
@@ -864,7 +1059,7 @@ msgid "Property"
864
  msgstr ""
865
 
866
  #: includes/forms/query-selector.php:56
867
- msgid "Parent Value"
868
  msgstr ""
869
 
870
  #: includes/forms/query-selector.php:59
@@ -925,27 +1120,27 @@ msgstr ""
925
  msgid "Parent/Child"
926
  msgstr ""
927
 
928
- #: includes/forms/tabs.php:16
929
  msgid "Query/Selector"
930
  msgstr ""
931
 
932
- #: includes/forms/tabs.php:19
933
  msgid "Property/Value"
934
  msgstr ""
935
 
936
- #: includes/forms/tabs.php:22
937
  msgid "Web Fonts"
938
  msgstr ""
939
 
940
- #: includes/forms/tabs.php:25
941
- msgid "Child CSS"
942
  msgstr ""
943
 
944
- #: includes/forms/tabs.php:28
945
- msgid "Parent CSS"
946
  msgstr ""
947
 
948
- #: includes/forms/tabs.php:34
949
  msgid "Files"
950
  msgstr ""
951
 
1
+ # Copyright (C) 2016 Child Theme Configurator
2
  # This file is distributed under the same license as the Child Theme Configurator package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Child Theme Configurator 2.0.0\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/child-theme-configurator\n"
7
+ "POT-Creation-Date: 2016-03-20 16:30:57+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2016-MO-DA HO:MI+ZONE\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
15
+ #: includes/class-ctc-admin.php:337
16
+ msgid "Zip file creation failed."
 
 
 
17
  msgstr ""
18
 
19
+ #: includes/class-ctc-admin.php:373
20
+ msgid "The Functions file is required and cannot be deleted."
 
21
  msgstr ""
22
 
23
+ #: includes/class-ctc-admin.php:457
24
+ msgid "You do not have permission to configure child themes."
25
+ msgstr ""
26
+
27
+ #: includes/class-ctc-admin.php:486
28
+ msgid "%s does not exist. Please select a valid Parent Theme."
29
+ msgstr ""
30
+
31
+ #: includes/class-ctc-admin.php:489
32
+ msgid "Please select a valid Parent Theme."
33
  msgstr ""
34
 
35
+ #: includes/class-ctc-admin.php:494
36
+ msgid "Please select a valid Child Theme."
37
  msgstr ""
38
 
39
+ #: includes/class-ctc-admin.php:498
40
+ msgid "Please enter a valid Child Theme directory name."
41
  msgstr ""
42
 
43
+ #: includes/class-ctc-admin.php:503
44
  msgid ""
45
+ "<strong>%s</strong> exists. Please enter a different Child Theme template "
46
+ "name."
47
  msgstr ""
48
 
49
+ #: includes/class-ctc-admin.php:522
50
+ msgid "Your theme directories are not writable."
51
+ msgstr ""
52
+
53
+ #: includes/class-ctc-admin.php:676
54
+ msgid "Your stylesheet is not writable."
55
+ msgstr ""
56
+
57
+ #: includes/class-ctc-admin.php:1208
58
+ msgid "Could not set write permissions."
59
+ msgstr ""
60
+
61
+ #: includes/class-ctc-admin.php:1309
62
+ msgid "There were errors while resetting permissions."
63
+ msgstr ""
64
+
65
+ #: includes/class-ctc-admin.php:1351
66
+ msgid "Could not upload file."
67
+ msgstr ""
68
+
69
+ #: includes/class-ctc-admin.php:1716
70
+ msgid "Could not copy file"
71
+ msgstr ""
72
+
73
+ #: includes/class-ctc-ui.php:33
74
+ msgid "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
75
+ msgstr ""
76
+
77
+ #: includes/class-ctc-ui.php:159
78
  msgid "Child Theme files modified successfully."
79
  msgstr ""
80
 
81
+ #: includes/class-ctc-ui.php:161
82
  msgid ""
83
+ "Child Theme <strong>%s</strong> has been reset. Please configure it using "
84
+ "the settings below."
85
  msgstr ""
86
 
87
+ #: includes/class-ctc-ui.php:163
88
+ msgid "Child Theme <strong>%s</strong> has been generated successfully."
89
+ msgstr ""
90
+
91
+ #: includes/class-ctc-ui.php:165
92
  msgid "IMPORTANT:"
93
  msgstr ""
94
 
95
+ #: includes/class-ctc-ui.php:167 includes/forms/themepreview.php:20
96
  msgid "Go to Themes"
97
  msgstr ""
98
 
99
+ #: includes/class-ctc-ui.php:167
100
  msgid "Network enable"
101
  msgstr ""
102
 
103
+ #: includes/class-ctc-ui.php:167
104
  msgid "your child theme."
105
  msgstr ""
106
 
107
+ #: includes/class-ctc-ui.php:169 includes/forms/themepreview.php:18
108
  msgid "Live Preview"
109
  msgstr ""
110
 
111
+ #: includes/class-ctc-ui.php:169
112
+ msgid "Preview your child theme"
113
  msgstr ""
114
 
115
+ #: includes/class-ctc-ui.php:169
116
  msgid "before activating."
117
  msgstr ""
118
 
119
+ #: includes/class-ctc-ui.php:277
120
  msgid "URL/None"
121
  msgstr ""
122
 
123
+ #: includes/class-ctc-ui.php:278
124
  msgid "Origin"
125
  msgstr ""
126
 
127
+ #: includes/class-ctc-ui.php:279
128
  msgid "Color 1"
129
  msgstr ""
130
 
131
+ #: includes/class-ctc-ui.php:280
132
  msgid "Color 2"
133
  msgstr ""
134
 
135
+ #: includes/class-ctc-ui.php:281
136
  msgid "Width/None"
137
  msgstr ""
138
 
139
+ #: includes/class-ctc-ui.php:282
140
  msgid "Style"
141
  msgstr ""
142
 
143
+ #: includes/class-ctc-ui.php:283
144
  msgid "Color"
145
  msgstr ""
146
 
147
+ #: includes/class-ctc-ui.php:285
148
+ msgid ""
149
+ "Are you sure you wish to RESET? This will destroy any work you have done in "
150
+ "the Configurator."
151
  msgstr ""
152
 
153
+ #: includes/class-ctc-ui.php:286
154
  msgid "<span style=\"font-size:10px\">!</span>"
155
  msgstr ""
156
 
157
+ #: includes/class-ctc-ui.php:287 includes/forms/rule-value.php:32
158
  msgid "Selectors"
159
  msgstr ""
160
 
161
+ #: includes/class-ctc-ui.php:288
162
  msgid "Close"
163
  msgstr ""
164
 
165
+ #: includes/class-ctc-ui.php:289
166
  msgid "Edit Selector"
167
  msgstr ""
168
 
169
+ #: includes/class-ctc-ui.php:290
170
  msgid "Cancel"
171
  msgstr ""
172
 
173
+ #: includes/class-ctc-ui.php:291
174
  msgid "Rename"
175
  msgstr ""
176
 
177
+ #: includes/class-ctc-ui.php:292
178
  msgid "The stylesheet cannot be displayed."
179
  msgstr ""
180
 
181
+ #: includes/class-ctc-ui.php:293
182
  msgid "(Child Only)"
183
  msgstr ""
184
 
185
+ #: includes/class-ctc-ui.php:294
186
  msgid "Please enter a valid Child Theme."
187
  msgstr ""
188
 
189
+ #: includes/class-ctc-ui.php:295
190
  msgid "Please enter a valid Child Theme name."
191
  msgstr ""
192
 
193
+ #: includes/class-ctc-ui.php:296
194
  msgid "<strong>%s</strong> exists. Please enter a different Child Theme"
195
  msgstr ""
196
 
197
+ #: includes/class-ctc-ui.php:297
198
  msgid "The page could not be loaded correctly."
199
  msgstr ""
200
 
201
+ #: includes/class-ctc-ui.php:298
202
  msgid ""
203
  "Conflicting or out-of-date jQuery libraries were loaded by another plugin:"
204
  msgstr ""
205
 
206
+ #: includes/class-ctc-ui.php:299
207
  msgid "Deactivating or replacing plugins may resolve this issue."
208
  msgstr ""
209
 
210
+ #: includes/class-ctc-ui.php:300
211
  msgid "%sWhy am I seeing this?%s"
212
  msgstr ""
213
 
214
+ #: includes/class-ctc-ui.php:303
215
+ msgid "No Styles Available. Check Parent/Child settings."
216
  msgstr ""
217
 
218
+ #: includes/class-ctc-ui.php:304
219
+ msgid "Updating"
220
  msgstr ""
221
 
222
+ #: includes/class-ctc-ui.php:305
223
+ msgid "Checking"
224
  msgstr ""
225
 
226
+ #: includes/class-ctc-ui.php:306
227
+ msgid "The theme \"%s\" generated unexpected PHP debug output."
228
  msgstr ""
229
 
230
+ #: includes/class-ctc-ui.php:307
231
+ msgid "The theme \"%s\" could not be loaded."
232
  msgstr ""
233
 
234
+ #: includes/class-ctc-ui.php:308
235
+ msgid "<p>Please verify the theme has been installed correctly.</p>"
236
  msgstr ""
237
 
238
+ #: includes/class-ctc-ui.php:309
239
+ msgid "Show Debug Output"
240
  msgstr ""
241
 
242
+ #: includes/class-ctc-ui.php:310
243
  msgid ""
244
+ "<p>You may not be able to use this Theme as a Child Theme while these "
245
+ "conditions exist.</p><p>It is possible that this theme has specific "
246
+ "requirements to work correctly as a child theme. Check your theme's "
247
+ "documentation for more information.</p><p>Please make sure you are using the "
248
+ "latest version of this theme. If so, please contact this Theme's author and "
249
+ "report the error list above.</p>"
250
  msgstr ""
251
 
252
+ #: includes/class-ctc-ui.php:311
253
+ msgid "Do Not Activate \"%s\"! A PHP FATAL ERROR has been detected."
254
  msgstr ""
255
 
256
+ #: includes/class-ctc-ui.php:312
257
+ msgid "This theme loads stylesheets after the wp_styles queue."
258
  msgstr ""
259
 
260
+ #: includes/class-ctc-ui.php:313
261
  msgid ""
262
+ "<p>This makes it difficult for plugins to override these styles. You can try "
263
+ "to resolve this using the \"Repair header template\" option (Step 6, "
264
+ "\"Additional handling options\", below).</p>"
 
 
265
  msgstr ""
266
 
267
+ #: includes/class-ctc-ui.php:314
268
+ msgid ""
269
+ "This theme loads the parent theme's <code>style.css</code> file outside the "
270
+ "wp_styles queue."
271
  msgstr ""
272
 
273
+ #: includes/class-ctc-ui.php:315
274
+ msgid ""
275
+ "<p>This is common with older themes but requires the use of <code>@import</"
276
+ "code>, which is no longer recommended. You can try to resolve this using the "
277
+ "\"Repair header template\" option (see step 6, \"Additional handling options"
278
+ "\", below).</p>"
279
  msgstr ""
280
 
281
+ #: includes/class-ctc-ui.php:316
282
+ msgid "This child theme does not load a Configurator stylesheet."
283
  msgstr ""
284
 
285
+ #: includes/class-ctc-ui.php:317
286
+ msgid ""
287
+ "<p>If you want to customize styles using this plugin, please click "
288
+ "\"Configure Child Theme\" again to add this to the settings.</p>"
289
+ msgstr ""
290
+
291
+ #: includes/class-ctc-ui.php:318
292
+ msgid ""
293
+ "This child theme uses the parent stylesheet but does not load the parent "
294
+ "theme's <code>style.css</code> file."
295
+ msgstr ""
296
+
297
+ #: includes/class-ctc-ui.php:319
298
+ msgid ""
299
+ "<p>Please select a stylesheet handling method or check \"Ignore parent theme "
300
+ "stylesheets\" (see step 6, below).</p>"
301
+ msgstr ""
302
+
303
+ #: includes/class-ctc-ui.php:320
304
+ msgid "This child theme appears to be functioning correctly."
305
+ msgstr ""
306
+
307
+ #: includes/class-ctc-ui.php:321
308
+ msgid "This theme appears OK to use as a Child theme."
309
  msgstr ""
310
 
311
+ #: includes/class-ctc-ui.php:322
312
+ msgid "This Child Theme has not been configured for this plugin."
313
+ msgstr ""
314
+
315
+ #: includes/class-ctc-ui.php:323
316
+ msgid ""
317
+ "<p>The Configurator makes significant modifications to the child theme, "
318
+ "including stylesheet changes and additional php functions. Please consider "
319
+ "using the DUPLICATE child theme option (see step 1, above) and keeping the "
320
+ "original as a backup.</p>"
321
+ msgstr ""
322
+
323
+ #: includes/class-ctc-ui.php:324
324
+ msgid ""
325
+ "This child theme uses <code>@import</code> to load the parent theme's "
326
+ "<code>style.css</code> file."
327
+ msgstr ""
328
+
329
+ #: includes/class-ctc-ui.php:325
330
+ msgid ""
331
+ "<p>Please consider selecting \"Use the WordPress style queue\" for the "
332
+ "parent stylesheet handling option (see step 6, below).</p>"
333
+ msgstr ""
334
+
335
+ #: includes/class-ctc-ui.php:326
336
+ msgid ""
337
+ "This theme loads additional stylesheets after the <code>style.css</code> "
338
+ "file:"
339
+ msgstr ""
340
+
341
+ #: includes/class-ctc-ui.php:327
342
+ msgid ""
343
+ "<p>Consider saving new custom styles to a \"Separate stylesheet\" (see step "
344
+ "5, below) so that you can customize these styles.</p>"
345
+ msgstr ""
346
+
347
+ #: includes/class-ctc-ui.php:328
348
+ msgid ""
349
+ "The parent theme's <code>style.css</code> file is being loaded automatically."
350
+ msgstr ""
351
+
352
+ #: includes/class-ctc-ui.php:329
353
+ msgid ""
354
+ "<p>\"Do not add any parent stylesheet handling\" has been selected for "
355
+ "\"Parent stylesheet handling\" (see step 6, below).</p>"
356
+ msgstr ""
357
+
358
+ #: includes/class-ctc-ui.php:330
359
+ msgid ""
360
+ "This theme does not require the parent theme's <code>style.css</code> file "
361
+ "for its appearance."
362
+ msgstr ""
363
+
364
+ #: includes/class-ctc-ui.php:331
365
+ msgid "This Child Theme was configured with an earlier version."
366
+ msgstr ""
367
+
368
+ #: includes/class-ctc-ui.php:332
369
+ msgid ""
370
+ "<p>The selected stylesheet handling method is no longer used. Please update "
371
+ "the configuration using the \"Repair header template\" option (see step 6, "
372
+ "\"Additional handling options\", below).</p>"
373
+ msgstr ""
374
+
375
+ #: includes/class-ctc-ui.php:333
376
+ msgid "Show Analysis Object"
377
+ msgstr ""
378
+
379
+ #: includes/class-ctc-ui.php:353
380
  msgid ""
381
  "The child theme is in read-only mode and Child Theme Configurator cannot "
382
  "apply changes. Click to see options"
383
  msgstr ""
384
 
385
+ #: includes/class-ctc-ui.php:356
386
  msgid ""
387
  "<li>Temporarily set write permissions by clicking the button below. When you "
388
  "are finished editing, revert to read-only by clicking \"Make read-only\" "
389
  "under the \"Files\" tab.</li>"
390
  msgstr ""
391
 
392
+ #: includes/class-ctc-ui.php:359
393
  msgid "Make files writable"
394
  msgstr ""
395
 
396
+ #: includes/class-ctc-ui.php:360
397
  msgid ""
398
  "<li><a target=\"_blank\" href=\"http://codex.wordpress.org/Editing_wp-"
399
  "config.php#WordPress_Upgrade_Constants\" title=\"Editin wp-config.php\">Add "
400
  "your FTP/SSH credentials to the WordPress config file</a>.</li>"
401
  msgstr ""
402
 
403
+ #: includes/class-ctc-ui.php:362
404
  msgid ""
405
  "<li><a target=\"_blank\" href=\"http://technet.microsoft.com/en-us/library/"
406
  "cc771170\" title=\"Setting Application Pool Identity\">Assign WordPress to "
408
  "li>"
409
  msgstr ""
410
 
411
+ #: includes/class-ctc-ui.php:363
412
  msgid ""
413
  "<li><a target=\"_blank\" href=\"http://codex.wordpress.org/"
414
  "Changing_File_Permissions\" title=\"Changing File Permissions\">Set write "
415
  "permissions on the server manually</a> (not recommended).</li>"
416
  msgstr ""
417
 
418
+ #: includes/class-ctc-ui.php:365
419
  msgid "<li>Run PHP under Apache with suEXEC (contact your web host).</li>"
420
  msgstr ""
421
 
422
+ #: includes/class-ctc-ui.php:374
423
  msgid ""
424
  "This Child Theme is not owned by your website account. It may have been "
425
  "created by a prior version of this plugin or by another program. Moving "
428
  "below."
429
  msgstr ""
430
 
431
+ #: includes/class-ctc-ui.php:382
 
 
 
 
432
  msgid ""
433
+ "Child Theme Configurator needs to update its internal data. Please set your "
434
  "preferences below and click \"Generate Child Theme Files\" to update your "
435
  "configuration."
436
  msgstr ""
437
 
438
+ #: includes/class-ctc-ui.php:388
439
  msgid ""
440
  "<strong>However, some styles could not be parsed due to memory limits.</"
441
  "strong> Try deselecting \"Additional Stylesheets\" below and click "
442
  "\"Generate/Rebuild Child Theme Files\". %sWhy am I seeing this?%s"
443
  msgstr ""
444
 
445
+ #: includes/class-ctc-ui.php:396
446
  msgid ""
447
  "Child Theme Configurator did not detect any configuration data because a "
448
  "previously configured Child Theme has been removed. Please set your "
449
  "preferences below and click \"Generate Child Theme Files\"."
450
  msgstr ""
451
 
452
+ #. #-#-#-#-# child-theme-configurator.pot (Child Theme Configurator 2.0.0) #-#-#-#-#
453
+ #. Plugin Name of the plugin/theme
454
+ #: includes/class-ctc.php:49 includes/class-ctc.php:59
455
+ #: includes/forms/main.php:10
456
+ msgid "Child Theme Configurator"
457
+ msgstr ""
458
+
459
+ #: includes/class-ctc.php:50 includes/class-ctc.php:60
460
+ #: includes/class-ctc.php:70
461
+ msgid "Child Themes"
462
+ msgstr ""
463
+
464
+ #: includes/class-ctc.php:85
465
+ msgid "Child Theme Configurator requires WordPress version %s or later."
466
+ msgstr ""
467
+
468
  #: includes/forms/addl_css.php:7
469
  msgid "Parse additional stylesheets:"
470
  msgstr ""
471
 
472
+ #: includes/forms/addl_css.php:11
473
  msgid ""
474
  "Stylesheets that are currently being loaded by the parent theme are "
475
  "automatically selected below (except for Bootstrap stylesheets which add a "
524
  "experience."
525
  msgstr ""
526
 
527
+ #: includes/forms/addl_panels.php:19 includes/help/de_DE.php:214
528
  msgid "Learn more about CTC Pro"
529
  msgstr ""
530
 
564
  msgstr ""
565
 
566
  #: includes/forms/addl_panels.php:27
567
+ msgid "Preview your child theme with a single click."
568
  msgstr ""
569
 
570
  #: includes/forms/addl_panels.php:28
633
  msgid "Backup"
634
  msgstr ""
635
 
636
+ #: includes/forms/backups.php:10
637
  msgid "Restore backup from"
638
  msgstr ""
639
 
655
  msgstr ""
656
 
657
  #: includes/forms/fileform.php:28
658
+ msgid ""
659
+ "Copy PHP templates from the parent theme by selecting them here. The "
660
+ "Configurator defines a template as a Theme PHP file having no PHP functions "
661
+ "or classes. Other PHP files cannot be safely overridden by a child theme."
662
  msgstr ""
663
 
664
  #: includes/forms/fileform.php:31
752
  msgid "Delete child theme images by selecting them here."
753
  msgstr ""
754
 
755
+ #: includes/forms/main.php:14
756
+ msgid "Debug"
757
  msgstr ""
758
 
759
+ #: includes/forms/main.php:17
760
+ msgid "Currently Loaded"
761
  msgstr ""
762
 
763
+ #: includes/forms/parent-child.php:22
764
+ msgid "Select an action:"
765
  msgstr ""
766
 
767
+ #: includes/forms/parent-child.php:29
768
+ msgid "CREATE a new Child Theme"
769
  msgstr ""
770
 
771
+ #: includes/forms/parent-child.php:32
772
+ msgid ""
773
+ "Install a new customizable child theme using an installed theme as a parent."
774
  msgstr ""
775
 
776
  #: includes/forms/parent-child.php:43
777
+ msgid "CONFIGURE an existing Child Theme"
778
  msgstr ""
779
 
780
+ #: includes/forms/parent-child.php:46
781
+ msgid ""
782
+ "Set up a previously installed child theme for use with the Configurator or "
783
+ "to modify current settings."
784
  msgstr ""
785
 
786
+ #: includes/forms/parent-child.php:55
787
+ msgid "DUPLICATE an existing Child Theme"
788
  msgstr ""
789
 
790
+ #: includes/forms/parent-child.php:58
791
+ msgid ""
792
+ "Make a complete copy of an existing Child Theme in a new directory, "
793
+ "including any menus, widgets and other Customizer settings. The option to "
794
+ "copy the Parent Theme settings (step 8, below) is disabled with this action."
795
  msgstr ""
796
 
797
+ #: includes/forms/parent-child.php:67
798
+ msgid ""
799
+ "RESET an existing Child Theme (this will destroy any work you have done in "
800
+ "the Configurator)"
801
  msgstr ""
802
 
803
+ #: includes/forms/parent-child.php:70
804
+ msgid ""
805
+ "Revert the Child theme stylesheet and functions files to their state before "
806
+ "the initial configuration or last reset. Additional child theme files will "
807
+ "not be removed, but you can delete them under the Files tab."
808
  msgstr ""
809
 
810
+ #: includes/forms/parent-child.php:79
811
+ msgid "Select a Parent Theme:"
812
  msgstr ""
813
 
814
+ #: includes/forms/parent-child.php:83 includes/forms/parent-child.php:96
815
+ msgid "Analyze"
816
  msgstr ""
817
 
818
+ #: includes/forms/parent-child.php:85 includes/forms/parent-child.php:98
819
+ msgid ""
820
+ "Click \"Analyze\" to determine stylesheet dependencies and other potential "
821
+ "issues."
822
  msgstr ""
823
 
824
+ #: includes/forms/parent-child.php:92
825
+ msgid "Select a Child Theme:"
826
  msgstr ""
827
 
828
+ #: includes/forms/parent-child.php:98
829
+ msgid "Analyze Child Theme"
830
  msgstr ""
831
 
832
+ #: includes/forms/parent-child.php:106
833
+ msgid "Name the new theme directory:"
834
  msgstr ""
835
 
836
  #: includes/forms/parent-child.php:109
837
+ msgid "Directory Name"
838
  msgstr ""
839
 
840
+ #: includes/forms/parent-child.php:113 includes/forms/parent-child.php:307
841
+ msgid "NOTE:"
842
  msgstr ""
843
 
844
+ #: includes/forms/parent-child.php:115
845
+ msgid ""
846
+ "This is NOT the name of the Child Theme. You can customize the name, "
847
+ "description, etc. in step 7, below."
848
  msgstr ""
849
 
850
+ #: includes/forms/parent-child.php:119
851
+ msgid "Verify Child Theme directory:"
852
  msgstr ""
853
 
854
+ #: includes/forms/parent-child.php:125
855
+ msgid ""
856
+ "For verification only (you cannot modify the directory of an existing Child "
857
+ "Theme)."
858
  msgstr ""
859
 
860
+ #: includes/forms/parent-child.php:135 includes/forms/parent-child.php:165
861
+ msgid "Click to expand"
862
  msgstr ""
863
 
864
+ #: includes/forms/parent-child.php:136
865
+ msgid "Select where to save new styles:"
866
  msgstr ""
867
 
868
+ #: includes/forms/parent-child.php:143
869
+ msgid "Primary Stylesheet (style.css)"
870
  msgstr ""
871
 
872
+ #: includes/forms/parent-child.php:146
873
  msgid ""
874
+ "Save new custom styles directly to the Child Theme primary stylesheet, "
875
+ "replacing the existing values. The primary stylesheet will load in the order "
876
+ "set by the theme."
877
  msgstr ""
878
 
879
+ #: includes/forms/parent-child.php:156
880
+ msgid "Separate Stylesheet"
881
  msgstr ""
882
 
883
+ #: includes/forms/parent-child.php:159
884
+ msgid ""
885
+ "Save new custom styles to a separate stylesheet and use any existing child "
886
+ "theme styles as a baseline. Select this option if you want to preserve the "
887
+ "original child theme styles instead of overwriting them. This option also "
888
+ "allows you to customize stylesheets that load after the primary stylesheet."
889
  msgstr ""
890
 
891
+ #: includes/forms/parent-child.php:166
892
+ msgid "Select Parent Theme stylesheet handling:"
893
  msgstr ""
894
 
895
+ #: includes/forms/parent-child.php:179
896
+ msgid "Use the WordPress style queue."
897
  msgstr ""
898
 
899
+ #: includes/forms/parent-child.php:183
900
  msgid ""
901
+ "Let the Configurator determine the appropriate actions and dependencies and "
902
+ "update the functions file automatically."
 
903
  msgstr ""
904
 
905
+ #: includes/forms/parent-child.php:189
906
+ msgid "Use <code>@import</code> in the child theme stylesheet."
907
  msgstr ""
908
 
909
+ #: includes/forms/parent-child.php:193
910
  msgid ""
911
+ "Only use this option if the parent stylesheet cannot be loaded using the "
912
+ "WordPress style queue. Using <code>@import</code> is not recommended."
913
  msgstr ""
914
 
915
+ #: includes/forms/parent-child.php:199
916
+ msgid "Do not add any parent stylesheet handling."
917
  msgstr ""
918
 
919
+ #: includes/forms/parent-child.php:202
920
  msgid ""
921
+ "Select this option if this theme already handles the parent theme stylesheet "
922
+ "or if the parent theme's <code>style.css</code> file is not used for its "
923
+ "appearance."
 
924
  msgstr ""
925
 
926
+ #: includes/forms/parent-child.php:205
927
+ msgid "Additional handling options"
928
  msgstr ""
929
 
930
+ #: includes/forms/parent-child.php:212
931
+ msgid "Ignore parent theme stylesheets."
932
  msgstr ""
933
 
934
+ #: includes/forms/parent-child.php:213
935
  msgid ""
936
+ "Do not load or parse the parent theme styles. Only use this option if the "
937
+ "Child Theme uses a Framework like Genesis and only uses child theme "
938
+ "stylesheets for its appearance."
939
  msgstr ""
940
 
941
+ #: includes/forms/parent-child.php:222
942
+ msgid "Repair the header template in the child theme."
943
  msgstr ""
944
 
945
+ #: includes/forms/parent-child.php:223
946
  msgid ""
947
+ "Let the Configurator (try to) resolve any stylesheet issues listed above. "
948
+ "This can fix many, but not all, common problems."
 
949
  msgstr ""
950
 
951
+ #: includes/forms/parent-child.php:228
952
+ msgid "Click to toggle form"
953
  msgstr ""
954
 
955
+ #: includes/forms/parent-child.php:229
956
+ msgid "Customize the Child Theme Name, Description, Author, Version, etc.:"
957
  msgstr ""
958
 
959
+ #: includes/forms/parent-child.php:230
960
+ msgid "(Click to toggle form)"
961
  msgstr ""
962
 
963
+ #: includes/forms/parent-child.php:234
964
+ msgid "Child Theme Name"
 
 
965
  msgstr ""
966
 
967
+ #: includes/forms/parent-child.php:238
968
+ msgid "Theme Name"
969
+ msgstr ""
970
+
971
+ #: includes/forms/parent-child.php:243 includes/forms/parent-child.php:247
972
+ msgid "Theme Website"
973
  msgstr ""
974
 
975
+ #: includes/forms/parent-child.php:252 includes/forms/parent-child.php:256
976
+ msgid "Author"
977
  msgstr ""
978
 
979
+ #: includes/forms/parent-child.php:261 includes/forms/parent-child.php:265
980
+ msgid "Author Website"
981
  msgstr ""
982
 
983
+ #: includes/forms/parent-child.php:270
984
+ msgid "Theme Description"
985
  msgstr ""
986
 
987
+ #: includes/forms/parent-child.php:273
988
+ msgid "Description"
989
  msgstr ""
990
 
991
+ #: includes/forms/parent-child.php:278
992
+ msgid "Theme Tags"
993
+ msgstr ""
994
+
995
+ #: includes/forms/parent-child.php:281
996
+ msgid "Tags"
997
+ msgstr ""
998
+
999
+ #: includes/forms/parent-child.php:286 includes/forms/parent-child.php:290
1000
+ msgid "Version"
1001
+ msgstr ""
1002
+
1003
+ #: includes/forms/parent-child.php:299
1004
  msgid ""
1005
+ "Copy Parent Theme Menus, Widgets and other Customizer Settings to Child "
1006
+ "Theme:"
1007
+ msgstr ""
1008
+
1009
+ #: includes/forms/parent-child.php:309
1010
+ msgid "This will overwrite any child theme options you may have already set."
1011
+ msgstr ""
1012
+
1013
+ #: includes/forms/parent-child.php:316 includes/forms/parent-child.php:353
1014
+ msgid "Click to run the Configurator:"
1015
  msgstr ""
1016
 
1017
+ #: includes/forms/parent-child.php:319
1018
+ msgid "Configure Child Theme"
1019
  msgstr ""
1020
 
1021
+ #: includes/forms/parent-child.php:337
1022
+ msgid "Parse Plugin stylesheets:"
1023
  msgstr ""
1024
 
1025
+ #: includes/forms/parent-child.php:341
1026
+ msgid "Select the plugin stylesheets you wish to customize below."
1027
  msgstr ""
1028
 
1029
+ #: includes/forms/parent-child.php:356
1030
+ msgid "Configure Plugin Styles"
1031
  msgstr ""
1032
 
1033
  #: includes/forms/query-selector.php:13
1034
+ msgid "@media Query"
1035
+ msgstr ""
1036
+
1037
+ #: includes/forms/query-selector.php:14
1038
+ msgid "( or \"base\" )"
1039
  msgstr ""
1040
 
1041
  #: includes/forms/query-selector.php:24
1059
  msgstr ""
1060
 
1061
  #: includes/forms/query-selector.php:56
1062
+ msgid "Baseline Value"
1063
  msgstr ""
1064
 
1065
  #: includes/forms/query-selector.php:59
1120
  msgid "Parent/Child"
1121
  msgstr ""
1122
 
1123
+ #: includes/forms/tabs.php:14
1124
  msgid "Query/Selector"
1125
  msgstr ""
1126
 
1127
+ #: includes/forms/tabs.php:17
1128
  msgid "Property/Value"
1129
  msgstr ""
1130
 
1131
+ #: includes/forms/tabs.php:20
1132
  msgid "Web Fonts"
1133
  msgstr ""
1134
 
1135
+ #: includes/forms/tabs.php:23
1136
+ msgid "Baseline Styles"
1137
  msgstr ""
1138
 
1139
+ #: includes/forms/tabs.php:26
1140
+ msgid "Child Styles"
1141
  msgstr ""
1142
 
1143
+ #: includes/forms/tabs.php:30
1144
  msgid "Files"
1145
  msgstr ""
1146
 
readme.txt CHANGED
@@ -3,12 +3,12 @@ Contributors: lilaeamedia
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8QE5YJ8WE96AJ
4
  Tags: child theme, child themes, custom styles, customize styles, customize theme, CSS, responsive, css editor, child theme generator, child theme creator, style, stylesheet, customizer
5
  Requires at least: 3.9
6
- Tested up to: 4.4
7
- Stable tag: 1.7.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
- Create child themes and customize styles, templates and functions. Enqueues stylesheets and web fonts. Handles rgba, vendor-prefixes and more.
12
 
13
  == Description ==
14
 
@@ -16,33 +16,46 @@ Child Theme Configurator is a fast and easy to use CSS editor that allows you to
16
 
17
  = Take Control of Your Child Themes =
18
 
19
- https://www.youtube.com/watch?v=NQ1M-ZlRScY
20
-
21
  The Child Theme Configurator parses and indexes your stylesheets so that every CSS media query, selector, property and value are at your fingertips. Second, it shows you how each customization you make will look before you commit it to the child theme. Finally, it saves your work so that you can customize styles in your child themes without the risk of losing your edits.
22
 
23
  You can create any number of child themes from your existing Parent Themes. The Child Theme Configurator lets you choose from your installed themes (even existing child themes) and save the results in your Themes directory.
24
 
25
  When you are ready, just activate the Child Theme and your WordPress site takes on the custom styles automatically.
26
 
 
 
27
  = Why create child themes and customize styles using the Child Theme Configurator? =
28
 
29
- * Update themes without losing customizations
30
- * Enqueue (link) stylesheets instead of using @import
31
- * Customize @media queries for responsive design
32
- * Copy existing widgets, menus and other options to child theme
33
- * Select hex, RGBA (transparent) and named colors using Spectrum color picker
34
- * Add fallback styles (multiple values per property)
35
- * Resolve common child theme issues with almost any parent theme
36
- * Save hours of development time
37
- * Multisite compatible
38
- * Make modifications unavailable to the Customizer
39
- * Export child themes as Zip Archive
40
- * Use web fonts in your child theme
41
- * Identify and override exact selectors from the parent theme
42
- * Change specific colors, backgrounds, font styles, etc., without changing other elements
43
- * Automatically generate cross-browser and vendor-prefixed properties and CSS gradients
44
- * Preview custom styles before committing to them
45
- * Uses WP Filesystem API will not create files you cannot remove
 
 
 
 
 
 
 
 
 
 
 
 
 
46
 
47
  = Child Theme Configurator PRO =
48
 
@@ -85,36 +98,34 @@ Learn more at http://www.lilaeamedia.com/plugins/intelliwidget-responsive-menu
85
 
86
  4. Navigate to Tools > Child Themes (multisite users go to Network Admin > Themes > Child Themes).
87
 
88
- = 10 Easy Steps to Create a Child Theme =
89
 
90
- 1. Select the theme you want to configure from the "Parent Theme" menu.
 
 
 
 
91
 
92
- 2. Select "new" or "existing".
93
 
94
- 3. Optional: Enter a Name, Theme Website, Author, Author Website, Description, Tags and Version for the child theme.
95
 
96
- 4. Optional: Copy Parent Theme Menus, Widgets and other Options. NOTE: This will overwrite any child theme options you may have already set.
97
 
98
- 5. Choose stylesheet handling:
99
- * **None (handled by theme)**
100
- Select this option if all stylesheets are correctly enqueued for child themes. If you find that custom styles are not being applied correctly, use a different option.
101
- * **Enqueue parent stylesheet (default)**
102
- Select this option if the theme enqueues the active stylesheet but has no special handling for child themes. Start with this option if unsure.
103
- * **Enqueue child stylesheet**
104
- Select this option if the theme enqueues the parent theme stylesheet but does not enqueue the child theme stylesheet at all. This can happen if get_template() or get_template_directory_uri() is used to link the stylesheet.
105
- * **Enqueue both parent and child stylesheets**
106
- Select this option if stylesheet link tags are hard-coded into the header template (common in older themes). This enables the child theme stylesheet to override the parent theme stylesheet without using @import.
107
- * **@import parent stylesheet**
108
- This option imports the parent theme stylesheet from the child theme stylesheet. This enables the child theme stylesheet to override the parent theme stylesheet, but using @import is no longer recommended.
109
- * [See our website for more information about which option to use](http://www.childthemeconfigurator.com/how-to-use/#stylesheet_handling)
110
 
111
- 6. Optional: Save Backup
 
 
 
112
 
113
- 7. Optional: Reset/Restore from backup.
114
 
115
- 8. Optional: Choose additional stylesheets. Stylesheets that are currently used by the parent theme are automatically selected.
116
 
117
- 9. Click "Generate/Rebuild Child Theme Files."
118
 
119
  10. IMPORTANT: Always test child themes with Live Preview (theme customizer) before activating!
120
 
@@ -122,7 +133,7 @@ Select this option if all stylesheets are correctly enqueued for child themes. I
122
 
123
  = Is there a tutorial? =
124
 
125
- https://www.youtube.com/watch?v=NQ1M-ZlRScY
126
 
127
  = If the parent theme changes (e.g., upgrade), do I have to update the child theme? =
128
 
@@ -238,7 +249,7 @@ You can add queries and selectors using the "Raw CSS" textarea on the Query/Sele
238
 
239
  = How do I remove a style from the Parent Theme? =
240
 
241
- You shouldn't really "remove" a style from the Parent. You can, however, set the property to "inherit," "none," or zero (depending on the property). This will negate the Parent value. Some experimentation may be necessary.
242
 
243
  = How do I remove a style from the Child Theme? =
244
 
@@ -276,6 +287,23 @@ https://www.youtube.com/watch?v=iBiiAgsK4G4
276
  7. Files tab
277
 
278
  == Changelog ==
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
279
  = 1.7.8 =
280
  * Fix: disable autoload on configuration data options
281
  * Fix: normalize media query and add to menu when added via raw css
@@ -546,24 +574,22 @@ https://www.youtube.com/watch?v=iBiiAgsK4G4
546
  * Initial release.
547
 
548
  == Upgrade Notice ==
549
- 1.7.8 Disable autoload for configuration options. Display new media queries when added from the Raw CSS input.
550
-
551
- == Override Parent Styles ==
552
 
553
- There are two ways to identify and customize parent styles. The Child Theme Configurator lets you search styles by CSS selector and by property. If you wish to customize a specific CSS selector (e.g., h1), use the "Query/Selector" tab. If you have a specific CSS value you wish to customize site-wide (e.g., the color of the type), use the "Property/Value" tab.
554
-
555
- = Query/Selector Tab =
556
 
557
  The Query/Selector tab lets you find specific CSS selectors and edit them. First, find the query that contains the CSS selector you wish to edit by typing in the Query autoselect box. Select by clicking with the mouse or by pressing the "Enter" or "Tab" keys. CSS selectors are in the base query by default.
558
  Next, find the CSS selector by typing in the "Selector" autoselect box. Select by clicking with the mouse or by pressing the "Enter" or "Tab" keys.
559
 
560
- This will load all of the properties for that CSS selector with the Parent values on the left and the child theme values inputs on the right. Any existing child theme values will be automatically populated. There is also a Sample preview that displays the combination of Parent and Child overrides. Note that the border and background-image get special treatment.
561
 
562
  The "Order" field contains the original sequence of the CSS selector in the parent theme stylesheet. You can change the CSS selector order sequence by entering a lower or higher number in the "Order" field. You can also force style overrides (so called "!important" flag) by checking the "!" box next to each input. Please use judiciously.
563
 
564
  Click "Save" to update the child theme stylesheet and save your changes to the WordPress admin.
565
 
566
- == Adding New Styles ==
567
 
568
  If you wish to add additional properties to a given CSS selector, first load the selector using the Query/Selector tab. Then find the property you wish to override by typing in the New Property autoselect box. Select by clicking with the mouse or by pressing the "Enter" or "Tab" keys. This will add a new input row to the selector inputs.
569
 
@@ -571,7 +597,7 @@ If you wish to add completely new CSS selectors, or even new @media queries, you
571
 
572
  If you prefer to use shorthand syntax for properties and values instead of the inputs provided by the Child Theme Configurator, you can enter them here as well. The parser will convert your input into normalized CSS code automatically.
573
 
574
- = Property/Value Tab =
575
 
576
  The Property/Value tab lets you find specific values for a given property and then edit that value for individual CSS selectors that use that property/value combination. First, find the property you wish to override by typing in the Property autoselect box. Select by clicking with the mouse or by pressing the "Enter" or "Tab" keys.
577
 
@@ -585,7 +611,7 @@ If you want to edit all of the properties for the CSS selector you can click the
585
 
586
  == Web Fonts Tab ==
587
 
588
- You can add additional stylesheets and web fonts by typing @import rules into the textarea on the Web Fonts tab. **Important: do not import the parent theme stylesheet here.** Use the &quot;Parent stylesheet handling&quot; option from the Parent/Child tab.
589
 
590
  == Files Tab ==
591
 
@@ -628,11 +654,10 @@ Some themes (particularly commercial themes) do not correctly load parent templa
628
  == Caveats ==
629
 
630
  * Arbitrary comments are not supported. Providing a high level of flexibility for previewing and modifying custom styles requires a sophisticated parsing system. Maintaining comments that bound to any particular element in the stylesheet is prohibitively expensive compared to the value it would add. Although we are working to include this as an option in the future, currently all comments are stripped from the child theme stylesheet code.
631
- * Legacy gradient syntax is not supported. The Child Theme Configurator plugin does not support the MS filter gradient or legacy webkit gradient. These will continue to work if they are used in the parent theme, but will not be written to the child theme stylesheet. If there is a demand, we may add it in a future release, but most users should have upgraded by now.
632
  * 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.
633
- * 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.
634
- * Not all CSS properties are customizable. The Child Theme Configurator plugin works with the vast majority of vendor-specific properties, however we’ve left out some of the more obscure options. As with legacy gradients, they will work, but will not be automatically enhanced by the Configurator.
635
- * CSS properties are auto-discovered. The Child Theme Configurator plugin loads the properties that exist in the Parent stylesheet. You can always add new rules using the “Raw CSS” text area.
636
 
637
  == Documentation ==
638
 
@@ -640,4 +665,4 @@ Go to http://www.childthemeconfigurator.com/
640
 
641
  Serbo-Croatian translation courtesy of Borisa Djuraskovic borisad@webhostinghub.com http://www.webhostinghub.com
642
 
643
- Copyright: (C) 2014-2015 Lilaea Media
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8QE5YJ8WE96AJ
4
  Tags: child theme, child themes, custom styles, customize styles, customize theme, CSS, responsive, css editor, child theme generator, child theme creator, style, stylesheet, customizer
5
  Requires at least: 3.9
6
+ Tested up to: 4.5
7
+ Stable tag: 2.0.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
+ When using the Customizer is not enough - Create child themes and customize styles, templates, functions and more.
12
 
13
  == Description ==
14
 
16
 
17
  = Take Control of Your Child Themes =
18
 
 
 
19
  The Child Theme Configurator parses and indexes your stylesheets so that every CSS media query, selector, property and value are at your fingertips. Second, it shows you how each customization you make will look before you commit it to the child theme. Finally, it saves your work so that you can customize styles in your child themes without the risk of losing your edits.
20
 
21
  You can create any number of child themes from your existing Parent Themes. The Child Theme Configurator lets you choose from your installed themes (even existing child themes) and save the results in your Themes directory.
22
 
23
  When you are ready, just activate the Child Theme and your WordPress site takes on the custom styles automatically.
24
 
25
+ https://www.youtube.com/watch?v=xL0YmieF6d0
26
+
27
  = Why create child themes and customize styles using the Child Theme Configurator? =
28
 
29
+ 1. Some things cannot be changed using the Customizer.
30
+
31
+ 2. Unless you use a child theme, you will lose any changes you made to templates and stylesheets when you update.
32
+
33
+ 3. Child Theme Configurator automatically determines the correct way to set up a child theme based on the theme you are using.
34
+
35
+ 4. You can find the exact style selectors your theme uses and change properties quickly.
36
+
37
+ 5. You can locate, copy and edit theme templates from the admin.
38
+
39
+ 6. Much more:
40
+ * Update themes without losing customizations
41
+ * Smart Theme Analyzer determines correct settings to use
42
+ * Resolve common child theme issues with almost any parent theme
43
+ * Copy existing widgets, menus and Customizer options to child theme
44
+ * Use web fonts in your child theme
45
+ * Enqueue (link) stylesheets instead of using @import
46
+ * Quickly locate and edit theme CSS.
47
+ * Customize @media queries for responsive design
48
+ * Select hex, RGBA (transparent) and named colors using Spectrum color picker
49
+ * Add fallback styles (multiple values per property)
50
+ * Save hours of development time
51
+ * Multisite compatible
52
+ * Make modifications unavailable to the Customizer
53
+ * Export child themes as Zip Archive
54
+ * Identify and override exact selectors from the parent theme
55
+ * Change specific colors, backgrounds, font styles, etc., without changing other elements
56
+ * Automatically generate cross-browser and vendor-prefixed properties and CSS gradients
57
+ * Preview custom styles before committing to them
58
+ * Uses WP Filesystem API – will not create files you cannot remove
59
 
60
  = Child Theme Configurator PRO =
61
 
98
 
99
  4. Navigate to Tools > Child Themes (multisite users go to Network Admin > Themes > Child Themes).
100
 
101
+ = The Parent/Child Tab: 10 Easy Steps to Create a Child Theme =
102
 
103
+ 1. Select an action:
104
+ * CREATE a new Child Theme - Install a new customizable child theme using an installed theme as a parent.
105
+ * CONFIGURE an existing Child Theme - Set up a previously installed child theme for use with the Configurator or to modify current settings.
106
+ * DUPLICATE an existing Child Theme - Make a complete copy of an existing Child Theme in a new directory, including any menus, widgets and other Customizer settings. The option to copy the Parent Theme settings (step 8, below) is disabled with this action.
107
+ * RESET an existing Child Theme (this will destroy any work you have done in the Configurator) - Revert the Child theme stylesheet and functions files to their state before the initial configuration or last reset.
108
 
109
+ 2. Select a Parent Theme if creating a new Child Theme; select a Child Theme if configuring, duplicating or resetting.
110
 
111
+ 3. Analyze Child Theme - Click "Analyze" to determine stylesheet dependencies and other potential issues.
112
 
113
+ 4. If creating a new Child Theme, name the new theme directory; otherwise verify it the directory is correct. - This is NOT the name of the Child Theme. You can customize the name, description, etc. in step 7, below.
114
 
115
+ 5. Select where to save new styles:
116
+ * Primary Stylesheet (style.css) - Save new custom styles directly to the Child Theme primary stylesheet, replacing the existing values. The primary stylesheet will load in the order set by the theme.
117
+ * Separate Stylesheet - Save new custom styles to a separate stylesheet and use any existing child theme styles as a baseline. Select this option if you want to preserve the original child theme styles instead of overwriting them. This option also allows you to customize stylesheets that load after the primary stylesheet.
 
 
 
 
 
 
 
 
 
118
 
119
+ 6. Select Parent Theme stylesheet handling:
120
+ * Use the WordPress style queue. - Let the Configurator determine the appropriate actions and dependencies and update the functions file automatically.
121
+ * Use @import in the child theme stylesheet. - Only use this option if the parent stylesheet cannot be loaded using the WordPress style queue. Using @import is not recommended.
122
+ * Do not add any parent stylesheet handling. - Select this option if this theme already handles the parent theme stylesheet or if the parent theme's style.css file is not used for its appearance.
123
 
124
+ 7. Customize the Child Theme Name, Description, Author, Version, etc.: (Click to toggle form)
125
 
126
+ 8. Copy Parent Theme Menus, Widgets and other Customizer Settings to Child Theme: - NOTE: This will overwrite any child theme options you may have already set.
127
 
128
+ 9. Click the button to run the Configurator.
129
 
130
  10. IMPORTANT: Always test child themes with Live Preview (theme customizer) before activating!
131
 
133
 
134
  = Is there a tutorial? =
135
 
136
+ There are videos under the "Help" tab at the top right of the page. You can also view them at http://www.childthemeconfigurator.com/tutorial-videos
137
 
138
  = If the parent theme changes (e.g., upgrade), do I have to update the child theme? =
139
 
249
 
250
  = How do I remove a style from the Parent Theme? =
251
 
252
+ You shouldn't really "remove" a style from the Parent. You can, however, set the property to "inherit," "none," or zero (depending on the property). This will negate the Original value. Some experimentation may be necessary.
253
 
254
  = How do I remove a style from the Child Theme? =
255
 
287
  7. Files tab
288
 
289
  == Changelog ==
290
+ = 2.0.0 =
291
+ * New Theme Analyzer automatically checks for issues and determines correct settings
292
+ * Step by step setup of Parent/Child settings
293
+ * Simplified parent stylesheet handling options
294
+ * Option to write new child theme styles to a separate stylesheet
295
+ * Uses WordPress style dependencies to ensure correct child theme stylesheet load order
296
+ * Automatically repairs themes that use outdated stylesheet handling methods
297
+ * Parses parent theme files and only displays templates that can be be overridden by child themes
298
+ * Numerous minor bug fixes
299
+
300
+ = 1.7.9.1 =
301
+ * Fix: regression bug in 1.7.9 causing new property menu to fail
302
+
303
+ = 1.7.9 =
304
+ * Fix: use nonce when retrieving front-end html to parse default additional stylesheets
305
+ * Refactored classes to make Child Theme Configurator more lightweight on front end
306
+
307
  = 1.7.8 =
308
  * Fix: disable autoload on configuration data options
309
  * Fix: normalize media query and add to menu when added via raw css
574
  * Initial release.
575
 
576
  == Upgrade Notice ==
577
+ 2.0.0 is a major version release and some updates to your child themes may be required. Please watch the videos to learn about the new features.
578
+
579
+ == Query/Selector Tab ==
580
 
581
+ There are two ways to identify and customize baseline (parent) styles. The Child Theme Configurator lets you search styles by CSS selector and by property. If you wish to customize a specific CSS selector (e.g., h1), use the "Query/Selector" tab. If you have a specific CSS value you wish to customize site-wide (e.g., the color of the type), use the "Property/Value" tab.
 
 
582
 
583
  The Query/Selector tab lets you find specific CSS selectors and edit them. First, find the query that contains the CSS selector you wish to edit by typing in the Query autoselect box. Select by clicking with the mouse or by pressing the "Enter" or "Tab" keys. CSS selectors are in the base query by default.
584
  Next, find the CSS selector by typing in the "Selector" autoselect box. Select by clicking with the mouse or by pressing the "Enter" or "Tab" keys.
585
 
586
+ This will load all of the properties for that CSS selector with the Original values on the left and the child theme values inputs on the right. Any existing child theme values will be automatically populated. There is also a Sample preview that displays the combination of Parent and Child overrides. Note that the border and background-image get special treatment.
587
 
588
  The "Order" field contains the original sequence of the CSS selector in the parent theme stylesheet. You can change the CSS selector order sequence by entering a lower or higher number in the "Order" field. You can also force style overrides (so called "!important" flag) by checking the "!" box next to each input. Please use judiciously.
589
 
590
  Click "Save" to update the child theme stylesheet and save your changes to the WordPress admin.
591
 
592
+ == Adding Raw CSS ==
593
 
594
  If you wish to add additional properties to a given CSS selector, first load the selector using the Query/Selector tab. Then find the property you wish to override by typing in the New Property autoselect box. Select by clicking with the mouse or by pressing the "Enter" or "Tab" keys. This will add a new input row to the selector inputs.
595
 
597
 
598
  If you prefer to use shorthand syntax for properties and values instead of the inputs provided by the Child Theme Configurator, you can enter them here as well. The parser will convert your input into normalized CSS code automatically.
599
 
600
+ == Property/Value Tab ==
601
 
602
  The Property/Value tab lets you find specific values for a given property and then edit that value for individual CSS selectors that use that property/value combination. First, find the property you wish to override by typing in the Property autoselect box. Select by clicking with the mouse or by pressing the "Enter" or "Tab" keys.
603
 
611
 
612
  == Web Fonts Tab ==
613
 
614
+ You can add additional stylesheets and web fonts by typing @import rules into the textarea on the Web Fonts tab. **Important: do not import the parent theme stylesheet here.** Use the "Parent stylesheet handling" option from the Parent/Child tab.
615
 
616
  == Files Tab ==
617
 
654
  == Caveats ==
655
 
656
  * Arbitrary comments are not supported. Providing a high level of flexibility for previewing and modifying custom styles requires a sophisticated parsing system. Maintaining comments that bound to any particular element in the stylesheet is prohibitively expensive compared to the value it would add. Although we are working to include this as an option in the future, currently all comments are stripped from the child theme stylesheet code.
657
+ * No @keyframes or @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.
658
  * 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.
659
+ * CSS properties are auto-discovered. The Child Theme Configurator plugin loads the properties that exist in the Parent stylesheet. You can always add new properties using the “Raw CSS” text area.
660
+ * Legacy gradient syntax is not supported. The Child Theme Configurator plugin does not support the MS filter gradient or legacy webkit gradient. These will continue to work if they are used in the parent theme, but will not be written to the child theme stylesheet. If there is a demand, we may add it in a future release, but most users should have upgraded by now.
 
661
 
662
  == Documentation ==
663
 
665
 
666
  Serbo-Croatian translation courtesy of Borisa Djuraskovic borisad@webhostinghub.com http://www.webhostinghub.com
667
 
668
+ Copyright: (C) 2014-2016 Lilaea Media
screenshot-1.jpg CHANGED
Binary file
screenshot-2.jpg CHANGED
Binary file
screenshot-3.jpg CHANGED
Binary file
screenshot-4.jpg CHANGED
Binary file
screenshot-5.jpg CHANGED
Binary file
screenshot-6.jpg CHANGED
Binary file
screenshot-7.jpg CHANGED
Binary file