function wpwii_request_handler()
{
    if (!function_exists('weaverii_submitted')) {
        return;
    }
    if (weaverii_submitted('resetm_weaverii')) {
        weaverii_maint_save_msg('Weaver II Settings Cleared');
        delete_option('weaverii_settings');
        delete_option('weaverii_pro');
        delete_option('weaverii_pro_backup');
        delete_option('weaverii_settings_backup');
        delete_option('weaverii_settings_mobile');
        if (weaverii_init_base()) {
            delete_option('theme_mods_weaver-ii-pro' . WEAVERII_PRO_SLUG);
        } else {
            delete_option('theme_mods_weaver-ii' . WEAVERII_PRO_SLUG);
        }
    }
    if (weaverii_submitted('reset_old_weaver')) {
        weaverii_maint_save_msg('OLD Weaver Settings Cleared');
        delete_option('ttw_options');
        delete_option('ttw_myoptions');
        delete_option('ttw_adminoptions');
        delete_option('weaver-settings');
        delete_option('widget_weaver_login');
        delete_option('widget_weaver_text');
        delete_option('widget_weaver_login');
        delete_option('weaver_advanced_settings');
        delete_option('weaver_main_settings');
    }
    if (weaverii_submitted('convertm_weaver')) {
        require_once dirname(__FILE__) . '/weaver-ii-convert-old-weaver.php';
        weaverii_convert_old_weaver();
    }
}
예제 #2
0
function weaverii_check_version($diag = false)
{
    $existing_vers = weaverii_getopt('wii_version_id');
    $version = WEAVERII_VERSION;
    if (!weaverii_submitted('reset_weaverii') && !weaverii_no_settings()) {
        //weaverii_save_msg('Current version:' . $version . ' DB version:' . $existing_vers);
        if ($version != $existing_vers) {
            weaverii_setopt('wii_version_id', $version);
            // update to latest...
            weaverii_save_opts('weaverii_check_version');
            weaverii_save_msg('The options settings have been updated for the current version of ' . WEAVERII_THEMENAME . '. (' . $version . ')');
        }
    }
    //if (weaverii_getopt('_wii_hide_updatemsg')) return;	// always ignore this now.
    if (WEAVERII_THEMENAME == 'Weaver II Pro') {
        $check_site = 'http://weaverthemepro.wordpress.com';
        $home_site = 'http://weavertheme.com';
        $msg = ') is available in the member downloads area at <a href="http://pro.weavertheme.com" target="_blank">pro.WeaverTheme.com</a>.<br />
        <ol><li>Login to <a href="http://pro.weavertheme.com" target="_blank">pro.WeaverTheme.com</a></li>
        <li>Open the "Members : Download : Download Weaver II Pro" menu</li>
        <li>Download the new version</li>
        <li>Use update option near the bottom of Save/Restore tab to update new version. (Requires Weaver II Theme Extras Plugin)</li>
        </ol>';
    } else {
        $check_site = 'http://weavertheme.wordpress.com';
        $home_site = 'http://weavertheme.com';
        $msg = ') is available in the downloads area at <a href="//weavertheme.com/download/" target="_blank">WeaverTheme.com/download/</a>.<br />
		<strong>Because of WordPress policy changes, updates will no longer be provided at <em>WordPress.org</em>!</strong><br />
		<strong>To update:</strong> Open the <em>Dashboard : Admin</em> panel. An option to update to the latest version should appear there.
		<br />Alternate update procedure:<br />
		<small>
        <ol><li>Go to <a href="//weavertheme.com/download/" target="_blank">weavertheme.com/download/</a></li>
        <li>Click on the "Weaver II" download link.</li>
        <li>Download the new version to your computer</li>
		<li>Install the <em>Weaver II Theme Extras</em> <a href="https://wordpress.org/plugins/weaver-ii-theme-extras/" target="_blank">plugin</a> from WordPress.org.</li>
        <li>Use update option near the bottom of Save/Restore tab to update to the new version. (Requires Weaver II Theme Extras Plugin)</li>
        </ol></small>';
    }
    $latest = weaverii_latest_version($check_site);
    // check if newer version is available
    if (stripos($latest, 'announcement') !== false) {
        weaverii_save_msg($latest . ' - Please check <a href="' . $home_site . '" target="_blank">' . $home_site . 'for an announcement.</a>.');
    } else {
        if ($latest != 'unavailable' && version_compare($version, $latest, '<')) {
            $saveme = 'Current ' . WEAVERII_THEMENAME . ' version is ' . $version . '. A newer version (' . $latest . $msg;
            if ($diag) {
                return $saveme;
            }
            weaverii_save_msg($saveme);
        } else {
            if ($diag) {
                return 'Current ' . WEAVERII_THEMENAME . ' version is ' . $version . '. You have the latest version.';
            }
        }
    }
    return '';
}
    function weaverii_child_process_options()
    {
        if (!defined('WEAVERII_EXTRAS_ADMIN_HELPERS')) {
            require_once dirname(__FILE__) . '/includes/wtx-admin-page.php';
        }
        // admin info
        if (weaverii_submitted('set_added_subtheme')) {
            // Set to selected addon - theme
            if (isset($_POST['wii_addon_name'])) {
                $name = $_POST['wii_addon_name'];
                $openname = weaverii_f_uploads_base_dir() . 'weaverii-subthemes/addon-subthemes/' . $name . '.w2t';
                $contents = file_get_contents($openname);
                if (!weaverii_ex_set_current_to_serialized_values($contents, 'weaverii_uploadit:' . $openname)) {
                    echo '<div id="message" class="updated fade"><p><strong><em style="color:red;">Sorry,
                there was a problem uploading your add on theme. The name you picked did not have a valid
                Weaver II theme file in  the /wevaerii-subthemes/addon-subthemes directory.</em></strong></p></div>';
                } else {
                    weaverii_save_msg('Weaver II theme options reset to ' . ucwords(str_replace('-', ' ', $name)) . ' add-on subtheme.');
                    weaverii_setopt('wii_addon_name', $name);
                }
            }
        } else {
            if (weaverii_submitted('delete_added_subtheme')) {
                // Delete selected addon theme
                if (isset($_POST['wii_addon_name'])) {
                    $name = $_POST['wii_addon_name'];
                    @unlink(weaverii_f_uploads_base_dir() . 'weaverii-subthemes/addon-subthemes/' . $name . '.w2t');
                    @unlink(weaverii_f_uploads_base_dir() . 'weaverii-subthemes/addon-subthemes/' . $name . '.jpg');
                    weaverii_save_msg('Deleted ' . ucwords(str_replace('-', ' ', $name)) . ' add-on subtheme.');
                }
            } else {
                if (weaverii_submitted('upload_addon') && isset($_POST['uploadaddon']) && $_POST['uploadaddon'] == 'yes') {
                    // upload theme from users computer
                    // they've supplied and uploaded a file
                    $ok = weaverii_unpackzip('uploaded_addon', weaverii_f_uploads_base_dir() . 'weaverii-subthemes/addon-subthemes/');
                } else {
                    if (weaverii_submitted('upload_theme')) {
                        // upload theme from users computer
                        // they've supplied and uploaded a file
                        if (isset($_FILES['uploaded_theme']['name'])) {
                            // uploaded_theme
                            $filename = $_FILES['uploaded_theme']['name'];
                        } else {
                            $filename = "";
                        }
                        $to = weaverii_f_themes_dir();
                        if (strpos($filename, 'weaver-ii-pro-') === false && strpos($filename, 'weaver-ii-') === false) {
                            ?>
            <div id="message" class="updated fade"><p><strong><em style="color:red;">ERROR</em></strong></p>
            <p>You did not select a Weaver II theme .zip file: "<?php 
                            echo $filename;
                            ?>
".
            The theme file name must start with 'weaver-ii-'
            or 'weaver-ii-pro-'. Please use a file you downloaded from WeaverTheme.com.</p>
            </div>
<?php 
                            return;
                        }
                        $ok = weaverii_unpackzip('uploaded_theme', $to);
                        if ($ok) {
                            weaverii_save_msg('Your Weaver II Theme has been successfully updated. Please click "Clear Messages"
            button right now to refresh the scrren and start using the updated version.');
                        }
                    }
                }
            }
        }
    }
예제 #4
0
function weaverii_process_options_admin_standard()
{
    if (weaverii_submitted('reset_weaverii')) {
        if (!current_user_can('edit_theme_options')) {
            return;
        }
        // delete everything!
        weaverii_save_msg(weaverii_t_('All Weaver II settings have been reset to the defaults.', 'weaver-ii'));
        delete_option(apply_filters('weaver_options', 'weaverii_settings'));
        global $weaverii_opts_cache;
        $weaverii_opts_cache = false;
        // clear the cache
        weaveriip_clear_opts();
        weaverii_init_opts('reset_weaverii');
        update_user_meta(get_current_user_id(), 'tgmpa_dismissed_notice', 0);
        // reset the dismiss on the plugin loader
    }
    if (weaverii_submitted('uploadtheme') && isset($_POST['uploadit']) && $_POST['uploadit'] == 'yes') {
        weaverii_uploadit();
    }
    if (weaverii_submitted('check_weaver')) {
        // perform weaver check
        require_once 'check-theme.php';
        // include check code now
        weaverii_perform_check();
    }
    if (weaverii_submitted('weaver_hideopts')) {
        weaverii_save_msg(weaverii_t_('Now showing more/fewer options.', 'weaver-ii'));
    }
}
예제 #5
0
function weaverii_pro_submits()
{
    /*
     Save option handler for all plus features
     Each form will use this convention:
    
        <input class="button-primary" type="submit" name="weaverii_pro_save_pro" value="Save Plus Specific Options"/>
        <input type="hidden" name="weaveriip_save_specific opts" value="save" />
        lt ? php weaverii_nonce_field('weaverii_pro_save_pro');
    
     The button value gives the action name, the hidden field gives the actual action, and using
     weaverii_pro_save_pro routes all settings through here. This allows unlimited addition of
     options without needing to mess with the loop in Weaver.
    */
    if (!weaverii_submitted('weaverii_pro_save_pro')) {
        // did they submit anything?
        return;
    }
    $actions = array('weaveriip_save_admin_opts', 'weaveriip_save_settings', 'weaveriip_restore_psettings', 'weaveriip_save_social', 'weaveriip_save_slider', 'weaveriip_save_header', 'weaveriip_save_moreopts', 'weaveriip_save_totalcss', 'weaveriip_save_fonts', 'weaveriip_generate_fonts', 'weaveriip_add_to_google_list', 'weaveriip_save_buttons', 'weaveriip_save_menuopts', 'weaveriip_save_searchopts', 'weaveriip_save_disclaimer', 'weaveriip_save_shortcoder');
    foreach ($actions as $functionName) {
        if (isset($_POST[$functionName])) {
            if (function_exists($functionName)) {
                $functionName();
            }
        }
    }
}
예제 #6
0
function weaverii_check_version($force = false)
{
    $existing_vers = weaverii_getopt('wii_version_id');
    $version = WEAVERII_VERSION;
    if (!weaverii_submitted('reset_weaverii') && !weaverii_no_settings()) {
        //weaverii_save_msg('Current version:' . $version . ' DB version:' . $existing_vers);
        if ($version != $existing_vers) {
            weaverii_setopt('wii_version_id', $version);
            // update to latest...
            weaverii_save_opts('weaverii_check_version');
            weaverii_save_msg('The options settings have been updated for the current version of ' . WEAVERII_THEMENAME . '. (' . $version . ')');
        }
    }
    if (weaverii_getopt('_wii_hide_updatemsg')) {
        return;
    }
    if (WEAVERII_THEMENAME == 'Weaver II Pro') {
        $check_site = 'http://weaverthemepro.wordpress.com';
        $home_site = 'http://weavertheme.com';
        $msg = ') is available in the member downloads area at <a href="http://pro.weavertheme.com" target="_blank">pro.WeaverTheme.com</a>.<br />
        <ol><li>Login to <a href="http://pro.weavertheme.com" target="_blank">pro.WeaverTheme.com</a></li>
        <li>Open the "Members : Download : Download Weaver II Pro" menu</li>
        <li>Download the new version</li>
        <li>Use update option near the bottom of Save/Restore tab to update new version. (Requires Weaver II Theme Extras Plugin)</li>
        </ol>';
    } else {
        $check_site = 'http://weavertheme.wordpress.com';
        $home_site = 'http://weavertheme.com';
        $msg = ') is available available now or very soon from WordPress.org.<br /> The latest version is always available at <a href="http://weavertheme.com" target="_blank">WeaverTheme.com</a>.';
    }
    if (WEAVERII_THEMENAME == 'Weaver II Pro' || $force) {
        $latest = weaverii_latest_version($check_site);
        // check if newer version is available
        if (stripos($latest, 'announcement') !== false) {
            weaverii_save_msg($latest . ' - Please check <a href="' . $home_site . '" target="_blank">' . $home_site . 'for an announcement.</a>.');
        } else {
            if ($latest != 'unavailable' && version_compare($version, $latest, '<')) {
                $saveme = 'Current ' . WEAVERII_THEMENAME . ' version is ' . $version . '. A newer version (' . $latest . $msg;
                if ($force) {
                    return $saveme;
                }
                weaverii_save_msg($saveme);
            } else {
                if ($force) {
                    return 'Current ' . WEAVERII_THEMENAME . ' version is ' . $version . '. You have the latest version.';
                }
            }
        }
    }
    return '';
}
예제 #7
0
function weaverii_process_options_themes()
{
    if (weaverii_submitted('set_subtheme')) {
        // invoked from Weaver II Subhemes tab (this file)
        if (isset($_POST['wii_theme_picked'])) {
            $theme = weaverii_filter_textarea($_POST['wii_theme_picked']);
            if (weaverii_activate_subtheme($theme)) {
                weaverii_save_msg(weaverii_t_("Subtheme Selected: ") . $theme);
            } else {
                weaverii_save_msg(weaverii_t_("Invalid Subtheme file detected. Your installation of Weaver II may be broken."));
            }
        } else {
            weaverii_save_msg(weaverii_t_("Please select a subtheme."));
        }
    }
    if (weaverii_submitted('save_mytheme')) {
        // invoked from Save/Restore tab
        weaverii_save_msg(weaverii_t_("Current settings saved in WordPress database."));
        weaverii_settings_db_backup();
        return;
    }
    if (weaverii_submitted('restore_mytheme')) {
        // invoked from Save/Restore tab
        weaverii_settings_db_restore();
        weaverii_save_msg(weaverii_t_("Current settings restored from WordPress database."));
        return;
    }
    if (weaverii_submitted('hide_thumbs')) {
        $hide = weaverii_getopt('_wii_hide_theme_thumbs');
        weaverii_setopt('_wii_hide_theme_thumbs', !$hide);
    }
    if (weaverii_submitted('save_options')) {
        echo '@@@@@@ SAVE OPTIONS @@@@@';
    }
}
function weaverii_process_options_admin_pro()
{
    if (weaverii_submitted('backup_settings')) {
        $name = weaverii_savebackup();
        if ($name !== false) {
            weaverii_save_msg(weaverii_t_('All current main and advanced options backed up in:') . ' "' . $name . '.w2b"');
        } else {
            weaverii_save_msg(weaverii_t_('ERROR: Saving backup failed.'));
        }
    }
    if (weaverii_submitted('filesavetheme')) {
        $base = sanitize_file_name($_POST['savethemename']);
        if (weaverii_dev_mode()) {
            weaverii_setopt('wii_hide_old_weaver', 0);
        }
        $temp_url = weaverii_write_current_theme($base);
        if ($temp_url == '') {
            weaverii_save_msg(weaverii_t_('Invalid name supplied to save theme to file.'));
        } else {
            weaverii_save_msg(weaverii_t_("All current main and advanced options saved in ") . $temp_url);
        }
    }
    if (weaverii_submitted('restoretheme')) {
        $base = $_POST['wii_restorename'];
        $valid = validate_file($base);
        // make sure an ok file name
        $fn = weaverii_f_uploads_base_dir() . 'weaverii-subthemes/' . $base;
        if ($valid < 1 && weaverii_upload_theme($fn)) {
            $t = weaverii_getopt('wii_themename');
            if ($t == '') {
                $t = weaverii_getopt('wii_subtheme');
            }
            if ($t == '') {
                $t = 'Antique Ivory';
            }
            /* did we save a theme? */
            weaverii_setopt('wii_theme_filename', 'custom');
            // we have a custom theme now...
            weaverii_save_msg(weaverii_t_("Weaver II theme restored from file: ") . $t);
        } else {
            weaverii_save_msg('<em style="color:red;">' . weaverii_t_('INVALID FILE NAME PROVIDED - Try Again') . "({$fn})" . '</em>');
        }
    }
    if (weaverii_submitted('save_mobiletheme')) {
        weaverii_save_msg(weaverii_t_("Current settings saved in alternate Mobile View database entry."));
        $weaverii_opts = get_option(apply_filters('weaver_options', 'weaverii_settings'), array());
        $weaverii_opts['_wii_mobile_alt_theme'] = 'saved_mobile';
        // force  these two
        $weaverii_opts['_wii_sim_mobile'] = false;
        $weaverii_opts['_wii_inline_style'] = 'on';
        weaverii_wpupdate_option('weaverii_settings_mobile', $weaverii_opts, 'save_mobiletheme');
        $weaverii_pro_opts = get_option(apply_filters('weaver_options', 'weaverii_pro'), array());
        weaverii_wpupdate_option('weaverii_pro_mobile', $weaverii_pro_opts, 'save_mobile_theme');
    }
    if (weaverii_submitted('renametheme')) {
        $name = isset($_POST['wii_themename']) ? $_POST['wii_themename'] : '';
        $desc = isset($_POST['wii_theme_description']) ? $_POST['wii_theme_description'] : '';
        if ($name) {
            weaverii_setopt('wii_themename', $name);
        }
        if ($desc) {
            weaverii_setopt('wii_theme_description', $desc);
        }
    }
    if (weaverii_submitted('deletetheme')) {
        $myFile = isset($_POST['selectName']) ? $_POST['selectName'] : '';
        $valid = validate_file($myFile);
        if ($valid < 1 && $myFile != "None") {
            weaverii_f_delete(weaverii_f_uploads_base_dir() . 'weaverii-subthemes/' . $myFile);
            echo '<div style="background-color: rgb(255, 251, 204);" id="message" class="updated fade"><p>File: <strong>' . $myFile . '</strong> has been deleted.</p></div>';
        } else {
            echo '<div style="background-color: rgb(255, 251, 204);" id="message" class="updated fade"><p>File: <strong>' . $myFile . '</strong> invalid file name, not deleted.</p></div>';
        }
    }
}