' . esc_html( $this->label ) . '';
if ( '' !== $this->description) {
echo '' . $this->description . '';
}
echo '';
echo ' ';
_e('Save all current core Weaver Xtreme Theme settings to file on your computer.
(Full settings backup, including those marked with ♦. Does NOT include Weaver Xtreme Plus settings.) File:', 'weaver-xtreme' /*adm*/); ?>
weaverx-backup-settings.wxb ';
_e('Note: The previous download settings will include Weaver Xtreme Plus settings values (if Weaver Xtreme Plus is installed) along with the free version settings.
The previous Save buttons do not include advanced Weaver Xtreme Plus options like shortcodes or SmartMenu settings.', 'weaver-xtreme' /*adm*/)
. ' ';
_e('Save ALL Settings - Basic Weaver Xtreme, X-Plus, X-Plus Shortcodes, including ♦, ☆, and ★.', 'weaver-xtreme' /*adm*/)?>
File: weaverx-settings-(timestamp).wxall ';
_e("You can also save and restore your settings to the Site's Host filesystem. Open the Appearance:Weaver Xtreme Admin:Save/Restore tab to see the options to Save/Restore settings to the host filesystem. (requires free Weaver Theme Support Plugin)" , 'weaver-xtreme');
}
}
static public function process_save( $wp_customize )
{
if ( current_user_can( 'edit_theme_options' ) ) {
if ( isset( $_REQUEST['wvrx_save'] ) ) {
self::_save_settings( $wp_customize, $_REQUEST['wvrx_save'], 'wxt' );
}
if ( isset( $_REQUEST['wvrx_save_all'] ) ) {
self::_save_settings( $wp_customize, $_REQUEST['wvrx_save_all'], 'wxb' );
}
if ( isset( $_REQUEST['wvrx_save_xplus'] ) ) {
self::_save_settings( $wp_customize, $_REQUEST['wvrx_save_xplus'], 'wxall' );
}
}
}
static private function _weaverx_filter_strip_default( $var ) {
if (!is_string($var) )
return true;
return strlen( $var ) && $var != 'default';
}
static private function _save_settings( $wp_customize, $request, $ext )
{
if (headers_sent()) {
@header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
wp_die(__('Headers Sent: The headers have been sent by another plugin - there may be a plugin conflict.', 'weaver-xtreme' /*adm*/));
}
if ( ! wp_verify_nonce( $request, 'wvrx-settings-saving' ) ) {
return;
}
if ( $ext == 'wxall') {
$time = date('Y-m-d-Hi');
$fn = 'weaverx-settings-' . $time . '.wxall';
$opt_func = WEAVER_GET_OPTION;
$weaverx_opts = $opt_func( apply_filters('weaverx_options',WEAVER_SETTINGS_NAME) ,array());
$weaverxplus_opts = $opt_func('weaverxplus_settings' ,array());
$weaverx_opts = array_filter( $weaverx_opts, 'self::_weaverx_filter_strip_default' );
$weaverxplus_opts = array_filter( $weaverxplus_opts, 'self::_weaverx_filter_strip_default' );
$save = array();
$save['header'] = 'WVRX-PLUS1'; // format
$save['ext'] = $ext; // the extension
$save['weaverx'] = $weaverx_opts;
$save['weaverxplus'] = $weaverxplus_opts;
$weaverx_settings = $save;
} else { // free version save
$base = 'weaverx-settings';
$a_pro = (function_exists('weaverxplus_plugin_installed')) ? '-plus' : '';
$fn = $base . $a_pro . '.' . $ext;
$opt_func = WEAVER_GET_OPTION;
$weaverx_opts = $opt_func( apply_filters('weaverx_options',WEAVER_SETTINGS_NAME) ,array());
$weaverx_header = '';
$weaverx_save = array();
// @@@@@@@ $weaverx_opts['style_version'] = '1';
$weaverx_opts = array_filter( $weaverx_opts, 'self::_weaverx_filter_strip_default' );
unset( $weaverx_opts['wvrx_css_saved'] );
$weaverx_save['weaverx_base'] = $weaverx_opts;
$a_pro = (function_exists('weaverxplus_plugin_installed')) ? '-plus' : '';
if ($ext == 'wxt') {
$weaverx_header .= 'WXT-V01.00';
$weaverx_fn = 'weaverx-theme-settings' . $a_pro . '.wxt';
foreach ($weaverx_opts as $opt => $val) {
if ($opt[0] == '_')
$weaverx_save['weaverx_base'][$opt] = false;
}
} else {
$weaverx_header .= 'WXB-V01.00'; /* Save all settings: 10 byte header */
$weaverx_fn = 'weaverx-backup-settings' . $a_pro . '.wxb';
}
$weaverx_settings = $weaverx_header . serialize($weaverx_save); /* serialize full set of options right now */
}
// Set the download headers.
header( 'Content-disposition: attachment; filename=' . $fn );
header( 'Content-Type: application/octet-stream; charset=utf-8');
// echo the export data.
echo $weaverx_settings;
// Start the download.
die();
}
static public function enqueue_scripts()
{
// Register
wp_register_style( 'wvrx-sr-css', get_template_directory_uri().'/admin/customizer/save-restore/save-restore'.WEAVERX_MINIFY.'.css', array(), WEAVERX_VERSION );
wp_register_script( 'wvrx-sr-js', get_template_directory_uri().'/admin/customizer/save-restore/save-restore'.WEAVERX_MINIFY.'.js', array( 'jquery' ), WEAVERX_VERSION, true );
// Localize
wp_localize_script( 'wvrx-sr-js', 'WVRXl10n', array(
'emptyImport' => __( 'Please choose a file to import.', 'weaver-xtreme' )
));
// Config
wp_localize_script( 'wvrx-sr-js', 'WVRXConfig', array(
'customizerURL' => admin_url( 'customize.php' ),
'exportNonce' => wp_create_nonce( 'wvrx-settings-saving' )
));
// Enqueue
wp_enqueue_style( 'wvrx-sr-css' );
wp_enqueue_script( 'wvrx-sr-js' );
}
}
endif;
if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'WeaverX_Restore_WX_Settings' ) ) :
class WeaverX_Restore_WX_Settings extends WP_Customize_Control {
public $description = '';
public $code;
static private $wvrx_error = '';
/**
*/
public function render_content() {
echo '' . esc_html( $this->label ) . '';
if ( '' !== $this->description) {
echo '' . $this->description . '';
}
?>
' . __('Weaver Xtreme Theme - Free version', 'weaver-xtreme') . '
Save only theme related current settings to file on your computer. File: ', 'weaver-xtreme'); ?>
weaverx-theme-settings.wxt
' . __('Weaver Xtreme Plus', 'weaver-xtreme') . WEAVERX_PLUS_ICON . '
";
_e('Save Settings to Site Host Filesystem', 'weaver-xtreme');
echo '
'; _e('Additional Weaver Xtreme Plus restore options area available on the Appearance → +Xtreme Plus menu.', 'weaver-xtreme'); echo '
'; } } static public function process_restore( $wp_customize ) { if ( current_user_can( 'edit_theme_options' ) ) { if ( isset( $_REQUEST['wvrx-settings-restore'] ) ) { self::_restore( $wp_customize ); } } } static private function _restore( $wp_customize ) { // Make sure we have a valid nonce. if ( ! wp_verify_nonce( $_REQUEST['wvrx-settings-restore'], 'wvrx_restore' ) ) { unset($_POST['wvrx-settings-restore']); unset($_REQUEST['wvrx-settings-restore']); return; } unset($_POST['wvrx-settings-restore']); unset($_REQUEST['wvrx-settings-restore']); // Make sure WordPress upload support is loaded. if ( ! function_exists( 'wp_handle_upload' ) ) { require_once( ABSPATH . 'wp-admin/includes/file.php' ); } // Setup global vars. global $wp_customize; // upload theme from users computer // they've supplied and uploaded a file $ok = true; // no errors so far if (isset($_FILES['wvrx-settings-restore-file']['name'])) $filename = $_FILES['wvrx-settings-restore-file']['name']; else $filename = ""; if (isset($_FILES['wvrx-settings-restore-file']['tmp_name'])) { $openname = $_FILES['wvrx-settings-restore-file']['tmp_name']; } else { $openname = ""; } //Check the file extension $check_file = strtolower($filename); $pat = '.'; // PHP version strict checking bug... $end = explode($pat, $check_file); $ext_check = end($end); if ($filename == "") { return; } if ($ok && $ext_check != 'wxt' && $ext_check != 'wxb' && $ext_check != 'wxall'){ self::$wvrx_error = __('Theme files must have .wxt, .wxb, or .wxall extension.', 'weaver-xtreme' /*adm*/) . 'Click "Set to Selected Subtheme" to pick new selected subtheme. Selecting a subtheme will reset all existing theme settings. Site settings (♦) will not be changed.
$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'); $opt_func = WEAVER_DELETE_OPTION; $opt_func(WEAVER_SETTINGS_NAME); $opt_func = WEAVER_UPDATE_OPTION; $opt_func(WEAVER_SETTINGS_NAME,$new_cache); $save_dir = weaverx_f_uploads_base_dir() . WEAVERX_SUBTHEMES_DIR; $usename = WEAVERX_STYLE_FILE; $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(); } do_action('weaverx_save_mcecss'); // theme support plugin saved editor css in file do_action('weaverx_save_gutenberg_css'); return true; } static public function enqueue_scripts() { // Register wp_register_style( 'wvrx-css', dirname( __FILE__ ) . 'save-restore.css', array(), WEAVERX_VERSION ); wp_register_script( 'wvrx-js', dirname( __FILE__ ) . 'save-restore.js', array( 'jquery' ), WEAVERX_VERSION, true ); // Localize wp_localize_script( 'wvrx-js', 'WVRXl10n', array( 'emptyImport' => __( 'Please choose a file to import.', 'weaver-xtreme' ) )); // Config wp_localize_script( 'wvrx-js', 'WVRXConfig', array( 'customizerURL' => admin_url( 'customize.php?return=%2Fwp-admin%2F' ), 'exportNonce' => wp_create_nonce( 'wvrx-settings-saving' ) )); // Enqueue wp_enqueue_style( 'wvrx-css' ); wp_enqueue_script( 'wvrx-js' ); } static public function controls_print_scripts() { if ( self::$wvrx_error ) { echo ''; } } } endif; if ( class_exists( 'WP_Customize_Control' ) && !class_exists( 'WeaverX_Set_Customizer_Level' ) ) : /** * Class WeaverX_Save_Settings * * Save Weaver Xtreme Settings * */ class WeaverX_Set_Customizer_Level extends WP_Customize_Control { public $description = ''; public $code; public function render_content() { $a_pro = (weaverx_cz_is_plus()) ? '-plus' : ''; echo '' . esc_html( $this->label ) . ''; if ( '' !== $this->description) { echo '' . $this->description . ''; } echo ''; echo '
'; $level = weaverx_options_level(); switch ($level) { case WEAVERX_LEVEL_INTERMEDIATE: echo ''; _e('Standard', 'weaver-xtreme'); break; case WEAVERX_LEVEL_ADVANCED: echo ''; _e('Full','weaver-xtreme'); break; case WEAVERX_LEVEL_BEGINNER: default: echo ''; _e('Basic', 'weaver-xtreme'); break; } echo ''; if ($level == 0) _e(' - Default. Please select one of the settings below.', 'weaver-xtreme'); ?>
' . __('Select Customizer Interface Level', 'weaver-xtreme') . ''; // customizer only?> Please click one of the button to set the Options Interface Level.
Only basic options. These options will be enough for many users.
More options than Basic. Adds Spacing, Style, all Typography, Visibility, all Layout, Images, Global Custom CSS to the Basic Level.
This level was the default in previous theme versions. It provides all options, including Added Content, full Custom CSS, and Admin.