function weaverx_add_customizer_content($wp_customize) { // Failsafe is safe if (!isset($wp_customize)) { return; } weaverx_cz_cache_opts(); // we want to get the existing options before filtered. $path = trailingslashit(get_template_directory()) . 'admin/customizer/'; // Inlcude the Alpha Color Picker control file. require_once dirname(__FILE__) . '/alpha-color-picker/alpha-color-picker.php'; require_once dirname(__FILE__) . '/save-restore/save-restore.php'; require_once dirname(__FILE__) . '/lib-controls.php'; weaverx_customizer_add_panels($wp_customize); weaverx_customizer_add_sections($wp_customize); weaverx_customizer_set_transport($wp_customize); weaverx_clear_opt_cache('customizer'); }
function weaverx_save_opts($who = '', $bump = true) { // Save options // Here's the strategy. Using weaverx_getopt always loads the cache if it hasn't been. // Using weaverx_setopt will save the cache to the database by default // So we take advantage of this by bumping the style version, and using weaverx_setopt, // which saves to the database //$vers = weaverx_getopt('style_version'); if ($who == 'customizer') { // really need to refresh the cache weaverx_clear_opt_cache($who); $old = weaverx_getopt('style_date'); // and reload the cache } if ($bump) { //$vers = $vers ? $vers + 1 : 1; // bump or init // put the CSS into the DB require_once get_template_directory() . '/includes/generatecss.php'; unset($GLOBALS['wvrx_css_saved']); $GLOBALS['wvrx_css_saved'] = ''; weaverx_f_write('wvrx_css_saved', '/* -wvrx_css- */'); weaverx_output_style('wvrx_css_saved'); weaverx_setopt('wvrx_css_saved', $GLOBALS['wvrx_css_saved']); unset($GLOBALS['wvrx_css_saved']); } weaverx_setopt('style_date', date('Y-m-d-H:i:s'), $bump); //weaverx_setopt('style_version',$vers, $bump); // update options, style version if (weaverx_f_file_access_available()) { // and now is the time to update the style file require_once get_template_directory() . '/includes/generatecss.php'; weaverx_fwrite_current_css(); } }
function weaverx_init_opts($who = '') { // this sets either the current settings, or the default values. weaverx_clear_opt_cache('weaverx_init_opts'); $themename = weaverx_getopt('themename'); // load the theme from the db if there (weaverx_getopt loads the options if there) if ($themename === false) { require_once 'includes/get-default-settings.php'; // load a set of defaults weaverx_get_default_settings(); } //$mods = get_theme_mods(); //foreach ($mods as $name => $val) { // if ( strpos($name, 'wcz_', 0) !== false) { // add to settings, and if not in customizer, and then save settings // } //} do_action('weaverx_init_opts'); }