function weaverx_customize_preview_js() { // @@@ possibly add Loading message.... WeaverX_Restore_WX_Settings::controls_print_scripts(); $cur_vers = weaverx_wp_version(); if (version_compare($cur_vers, '4.4', '<')) { $msgpost = __('The Site Preview window will refresh <em>much</em> faster after you update to WordPress 4.4.', 'weaver-xtreme'); $content = "<script>jQuery('#customize-info').append('<div style=\"text-align: center;border-bottom: solid 1px #eee;display: block; font-size: 100%;padding: 9px 0;color: white;background: #298cba;\"> {$msgpost}</div>');</script>"; echo $content; } }
public static function reset_options($contents, $ext) { if ($ext == 'wxall') { $version = weaverx_getopt('weaverx_version_id'); // get something to force load opts_cache weaverx_delete_all_options(); $restore = array(); $restore = unserialize($contents); $opts = $restore['weaverx']; // fetch base opts //if (isset($opts['fonts_added']) ) { // $opts['fonts_added'] = serialize($opts['fonts_added']); //} foreach ($opts as $key => $val) { weaverx_setopt($key, $val, false); // overwrite with saved values } weaverx_setopt('weaverx_version_id', $version); // keep version, force save of db weaverx_setopt('wvrx_css_saved', ''); weaverx_setopt('last_option', 'Weaver Xtreme'); weaverxplus_clear_opts(); $opts = $restore['weaverxplus']; // fetch plus opts foreach ($opts as $key => $val) { weaverxplus_setopt($key, $val, false); // overwrite with saved values } weaverxplus_update_opts(); weaverx_save_opts('xplus', true); } else { if (substr($contents, 0, 10) == 'WXT-V01.00') { $type = 'theme'; } else { if (substr($contents, 0, 10) == 'WXB-V01.00') { $type = 'backup'; } else { $val = substr($contents, 0, 10); self::$wvrx_error = __("Wrong theme file format version", 'weaver-xtreme') . ':' . $val; return false; /* simple check for one of ours */ } } $restore = array(); $restore = unserialize(substr($contents, 10)); if (!$restore) { self::$wvrx_error = __("Unserialize failed", 'weaver-xtreme'); return false; } $version = weaverx_getopt('weaverx_version_id'); // get something to force load $new_cache = array(); global $weaverx_opts_cache; if ($type == 'theme') { // need to clear some settings // first, pickup the per-site settings that aren't theme related... foreach ($weaverx_opts_cache as $key => $val) { if (isset($key[0]) && $key[0] == '_') { // these are non-theme specific settings $new_cache[$key] = $val; } // keep } $opts = $restore['weaverx_base']; // fetch base opts foreach ($opts as $key => $val) { if (isset($key[0]) && $key[0] != '_') { $new_cache[$key] = $val; } // and add rest from restore } } else { if ($type == 'backup') { $opts = $restore['weaverx_base']; // fetch base opts foreach ($opts as $key => $val) { $new_cache[$key] = $val; // overwrite with saved values } } } $new_cache['weaverx_version_id'] = $version; $new_cache['wvrx_css_saved'] = ''; $new_cache['last_option'] = 'Weaver Xtreme'; $new_cache['style_date'] = date('Y-m-d-H:i:s'); delete_option('weaverx_settings'); update_option('weaverx_settings', $new_cache); $save_dir = weaverx_f_uploads_base_dir() . 'weaverx-subthemes'; $usename = 'style-weaverxt.css'; $filename = $save_dir . '/' . $usename; @unlink($filename); $weaverx_opts_cache = $new_cache; 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(); } } return true; }