function weaveriip_save_disclaimer()
{
    if (isset($_POST['wvr_disclaimer'])) {
        $val = $_POST['wvr_disclaimer'];
        if ($val == '') {
            weaverii_pro_setopt('wvr_disclaimer', '');
        } else {
            weaverii_pro_setopt('wvr_disclaimer', weaverii_filter_textarea($_POST['wvr_disclaimer']));
        }
    }
    weaverii_pro_update_options('save_disclaimer');
    /* and let the user know something happened */
    echo '<div id="message" class="updated fade"><p><strong>Weaver II Pro Comment Disclaimer Text Saved</strong></p></div>';
}
function weaveriip_save_shortcoder()
{
    /* Save options from plus header: wvrx_plus_save_header */
    if (!weaverii_pro_isset('wvpsc_num_opts')) {
        weaveriip_header_init();
    }
    if (isset($_POST['wvpsc_num_opts'])) {
        weaverii_pro_setopt('wvpsc_num_opts', weaveriip_default_int($_POST['wvpsc_num_opts'], 1, 25, 2));
    }
    for ($i = 1; $i <= weaverii_pro_getopt('wvpsc_num_opts'); $i++) {
        $base = 'wvpsc_' . $i . '_';
        if (isset($_POST[$base . 'id'])) {
            $val = filter_var(strtolower(trim(weaverii_filter_textarea($_POST[$base . 'id']))), FILTER_SANITIZE_EMAIL);
            // close enough
            weaverii_pro_setopt($base . 'id', $val);
        }
        if (isset($_POST[$base . 'text'])) {
            weaverii_pro_setopt($base . 'text', weaverii_filter_textarea($_POST[$base . 'text']));
        }
    }
    weaverii_pro_update_options('shortcoder');
    /* and let the user know something happened */
    echo '<div id="message" class="updated fade"><p><strong>Weaver II Pro Shortcoder Options Saved</strong></p></div>';
}
Example #3
0
function weaverii_validate_all_options($in)
{
    /* validation for all options  */
    $err_msg = '';
    // no error message yet
    if (empty($in)) {
        wp_die(__('You attempted to save options, but something has gone wrong. Please be sure you are logged in and your host is correctly configured. See the "Weaver II Doesn\'t Save Settings" FAQ on weavertheme.com.', 'weaver-ii'));
    }
    if (!current_user_can('edit_theme_options')) {
        wp_die(__('You do not have sufficient permissions to manage options for this site.', 'weaver-ii'));
    }
    $wvr_last = '';
    foreach ($in as $key => $value) {
        switch ($key) {
            /* -------- integer -------- */
            case 'wii_excerpt_length':
                if (!empty($value) && (!is_numeric($value) || !is_int((int) $value))) {
                    $opt_id = str_replace('wii_', '', $key);
                    $opt_id = str_replace('_', ' ', $opt_id);
                    $err_msg .= weaverii_t_('Option must be an integer value: ') . '"' . $opt_id . '" = "' . $value . '".' . weaverii_t_(' Value has been cleared to blank value') . '<br />';
                    $in[$key] = '';
                }
                break;
            case 'wii_style_version':
                // auto-bumb whenever save options
                $vers = $value ? $value + 1 : 1;
                // bump or init
                $in[$key] = $vers;
                break;
                /* ---------- text ----------- */
            /* ---------- text ----------- */
            case 'wii_excerpt_more_msg':
            case 'wii_header_maxwidth':
                if (!empty($value)) {
                    $in[$key] = weaverii_filter_textarea($value);
                }
                break;
            case 'wii_themename':
                // can't be empty!
                if (empty($value)) {
                    $in[$key] = 'please-give-this-a-name';
                } else {
                    $in[$key] = weaverii_filter_textarea($value);
                }
                break;
                /* code */
            /* code */
            case '_wii_metainfo':
                // meta info for header
            // meta info for header
            case 'wii_theme_head_opts':
                // Predefined Theme CSS Rules
            // Predefined Theme CSS Rules
            case 'wii_menu_addhtml-left':
                // add html to left menu
            // add html to left menu
            case 'wii_menu_addhtml':
            case '_wii_copyright':
                // Alternate copyright
            // Alternate copyright
            case '_wii_css_rows':
            case 'ftp_hostname':
            case 'ftp_username':
            case '_wii_search_button_url':
                if (!empty($value)) {
                    $in[$key] = weaverii_filter_code($value);
                }
                break;
            case 'ftp_password':
                // special handling for password
                if (!empty($value)) {
                    $c_t = weaverii_encrypt(trim($value));
                    $in[$key] = $c_t;
                }
                break;
            case 'wii_perpagewidgets':
                // Add widget areas for per page - names must be lower case
                if (!empty($value)) {
                    $in[$key] = strtolower(str_ireplace(' ', '', weaverii_filter_code($value)));
                }
                break;
                /* must not have <style .... </style> */
            /* must not have <style .... </style> */
            case 'wii_add_css':
                // Add CSS Rules to Weaver II's style rules
                if (!empty($value)) {
                    $val = weaverii_filter_code($value);
                    $in[$key] = $val;
                    if (stripos($val, '<style') !== false || stripos($val, '</style') !== false) {
                        $err_msg .= weaverii_t_('"Add CSS Rules" option must not contain &lt;style&gt; tags!') . weaverii_t_(' Please correct your entry.') . '<br />';
                    }
                }
                break;
            case 'wii_last_option':
                // check for wii_last_option...
                if (!empty($value)) {
                    $wvr_last = $value;
                }
                break;
            case 'hide_advanced_btn':
                if (stripos($value, 'hide') === false) {
                    $in['hide_advanced'] = 'show';
                } else {
                    $in['hide_advanced'] = 'hide';
                }
                break;
            case 'hide_advanced':
                $val = $value;
                if (isset($in['hide_advanced_btn'])) {
                    if (stripos($in['hide_advanced_btn'], 'hide') === false) {
                        $val = 'show';
                    } else {
                        $val = 'hide';
                    }
                }
                $in[$key] = $val;
                break;
            case '_phpactions':
                if (!empty($value)) {
                    $in[$key] = stripslashes(wp_check_invalid_utf8(addslashes($value)));
                }
                break;
            default:
                /* to here, then colors, _css, or checkbox/selectors */
                $keylen = strlen($key);
                if (strrpos($key, '_css') == $keylen - 4) {
                    // all _css settings
                    if (!empty($value)) {
                        $val = weaverii_filter_code($value);
                        $in[$key] = $val;
                        if (strpos($val, '{') === false || strpos($val, '}') === false) {
                            $opt_id = str_replace('_css', '', $key);
                            // kill _css
                            $opt_id = str_replace('wii_', '', $opt_id);
                            $opt_id = str_replace('_', ' ', $opt_id);
                            $err_msg .= weaverii_t_('CSS options must be enclosed in {}\'s: ') . '"' . $opt_id . '" = "' . $value . '".' . weaverii_t_(' Please correct your entry.') . '<br />';
                        }
                    }
                    break;
                }
                // _css
                if (strrpos($key, '_insert') == $keylen - 7) {
                    // all _insert settings
                    if (!empty($value)) {
                        $val = weaverii_filter_code($value);
                        $in[$key] = $val;
                    }
                    break;
                }
                // _insert
                if (strrpos($key, '_url') == $keylen - 4) {
                    // all _url settings
                    if (!empty($value)) {
                        $val = weaverii_filter_code($value);
                        // can't use esc_url because that forces a leading html{background-image: url(%template_directory%images/addon_themes.png);}
                        $in[$key] = $val;
                    }
                    break;
                }
                // _insert
                if (strrpos($key, '_dec') == $keylen - 4) {
                    if (!empty($value) && !is_numeric($value)) {
                        $opt_id = str_replace('wii_', '', $key);
                        $opt_id = str_replace('_dec', '', $opt_id);
                        $opt_id = str_replace('_', ' ', $opt_id);
                        $err_msg .= weaverii_t_('Option must be a numeric value: ') . '"' . $opt_id . '" = "' . $value . '".' . weaverii_t_(' Value has been cleared to blank value.') . '<br />';
                        $in[$key] = '';
                    }
                    break;
                }
                if (strrpos($key, '_int') == $keylen - 4 || strrpos($key, '_X') == $keylen - 2 || strrpos($key, '_Y') == $keylen - 2 || strrpos($key, '_L') == $keylen - 2 || strrpos($key, '_R') == $keylen - 2 || strrpos($key, '_T') == $keylen - 2 || strrpos($key, '_B') == $keylen - 2) {
                    if (!empty($value) && (!is_numeric($value) || !is_int((int) $value))) {
                        $opt_id = str_replace('wii_', '', $key);
                        $opt_id = str_replace('_int', '', $opt_id);
                        $opt_id = str_replace('_', ' ', $opt_id);
                        $err_msg .= weaverii_t_('Option must be a numeric value: ') . '"' . $opt_id . '" = "' . $value . '".' . weaverii_t_(' Value has been cleared to blank value.') . '<br />';
                        $in[$key] = '';
                    }
                    break;
                }
                if (strrpos($key, 'color') == $keylen - 5) {
                    // _bgcolor and _color (order here important - after _css, etc.)
                    if (!empty($value)) {
                        $val = weaverii_filter_code($value);
                        if (preg_match('/^#?+[0-9a-f]{3}(?:[0-9a-f]{3})?$/i', $val)) {
                            // hex value
                            $val = strtoupper($val);
                            // force hex values to upper case, just to be tidy
                            if ($val[0] != '#') {
                                $val = '#' . $val;
                            }
                            $in[$key] = $val;
                        } else {
                            if (preg_match("/^([a-zA-Z])+\$/i", $val)) {
                                // name - all letters
                                $in[$key] = $val;
                            } else {
                                // only legal things left are rgb and rgba
                                $isrgb = strpos($val, 'rgb');
                                if ($isrgb === false || $isrgb != 0) {
                                    $in[$key] = '';
                                    $err_msg .= 'Color must be a valid # hex value, rgb value, or color name (a-z): ' . '"' . $key . '" = "' . $value . '".' . ' Value has been cleared to blank value.' . '<br />';
                                } else {
                                    $in[$key] = $val;
                                }
                            }
                        }
                    }
                    break;
                }
                if (!empty($value) && is_string($value) && !is_numeric($value)) {
                    $in[$key] = weaverii_filter_textarea($value);
                }
                break;
        }
    }
    /* if ($wvr_last != 'Weaver II') {
    		$err_msg .= 'Warning - your host may be configured to limit how many input var options you are allowed to pass via PHP.' .
    		' Unfortunately, this means your settings may not be saved correctly. See the "Weaver II Doesn\'t Save Settings" FAQ on weavertheme.com.<br />';
    
    	} */
    if (!empty($err_msg)) {
        add_settings_error('weaverii_settings', 'settings_error', $err_msg, 'error');
    } else {
        add_settings_error('weaverii_settings', 'settings_updated', weaverii_t_('Weaver II  Settings Saved.'), 'updated');
    }
    // $GLOBALS['wvrNoSettings'] = false;  // we've saved now
    return $in;
}
function weaveriip_save_slider()
{
    /* save options */
    global $weaveriip_slider_opts;
    if (!weaverii_pro_isset('slider_number_sliders')) {
        weaveriip_slider_init();
    }
    if (isset($_POST['slider_enable'])) {
        weaverii_pro_setopt('slider_enable', 'checked');
    } else {
        weaverii_pro_setopt('slider_enable', false);
    }
    if (isset($_POST['slider_number_sliders'])) {
        weaverii_pro_setopt('slider_number_sliders', weaveriip_default_int($_POST['slider_number_sliders'], 1, 10, 1));
    } else {
        weaverii_pro_setopt('slider_number_sliders', 1);
    }
    weaverii_pro_update_options('slider save slider2');
    // need the slider_number_sliders
    weaveriip_slider_init();
    // need to do this every time because might be increasing # of sliders
    $limit = weaverii_pro_getopt('slider_number_sliders');
    for ($i = 1; $i <= $limit; $i++) {
        // save opts for each slider
        $sname = 'slider' . $i;
        foreach ($weaveriip_slider_opts as $curopt) {
            if (isset($_POST[$sname . $curopt])) {
                // set to default values
                switch ($curopt) {
                    case '_number_images':
                        weaverii_pro_setopt($sname . $curopt, weaveriip_default_int($_POST[$sname . $curopt], 2, 8, 7));
                        break;
                    case '_noeffects':
                        weaverii_pro_setopt($sname . $curopt, 'checked');
                        break;
                    case '_vertical':
                        weaverii_pro_setopt($sname . $curopt, 'checked');
                        break;
                    case '_hidetext':
                        weaverii_pro_setopt($sname . $curopt, 'checked');
                        break;
                    case '_hidemobile':
                        weaverii_pro_setopt($sname . $curopt, 'checked');
                        break;
                    case '_hidemenu':
                        weaverii_pro_setopt($sname . $curopt, 'checked');
                        break;
                    case '_menu':
                        weaverii_pro_setopt($sname . $curopt, $_POST[$sname . $curopt]);
                        break;
                    case '_vert_compress':
                        weaverii_pro_setopt($sname . $curopt, weaveriip_default_int($_POST[$sname . $curopt], 10, 500, 50));
                        break;
                    case '_img_height':
                        weaverii_pro_setopt($sname . $curopt, weaveriip_default_int($_POST[$sname . $curopt], 32, 1024, 200));
                        break;
                    case '_img_width':
                        weaverii_pro_setopt($sname . $curopt, weaveriip_default_int($_POST[$sname . $curopt], 32, 1024, 320));
                        break;
                    case '_menu_width':
                        weaverii_pro_setopt($sname . $curopt, weaveriip_default_int($_POST[$sname . $curopt], 20, 2048, 940));
                        break;
                    case '_note':
                        weaverii_pro_setopt($sname . $curopt, weaverii_filter_textarea($_POST[$sname . $curopt]));
                        break;
                    case '_text_font':
                        weaverii_pro_setopt($sname . $curopt, weaverii_filter_textarea($_POST[$sname . $curopt]));
                        if (weaverii_pro_getopt($sname . $curopt) == '') {
                            weaverii_pro_setopt($sname . $curopt, WEAVERII_TEXT_FONT);
                        }
                        break;
                    case '_borders':
                        weaverii_pro_setopt($sname . $curopt, weaverii_filter_textarea($_POST[$sname . $curopt]));
                        if (weaverii_pro_getopt($sname . $curopt) == '') {
                            weaverii_pro_setopt($sname . $curopt, WEAVERII_BORDERS);
                        }
                        break;
                    default:
                        weaverii_pro_setopt($sname . $curopt, false);
                }
            } else {
                // for checkboxes
                switch ($curopt) {
                    case '_noeffects':
                        weaverii_pro_setopt($sname . $curopt, false);
                        break;
                    case '_vertical':
                        weaverii_pro_setopt($sname . $curopt, false);
                        break;
                    case '_hidetext':
                        weaverii_pro_setopt($sname . $curopt, false);
                        break;
                    case '_hidemobile':
                        weaverii_pro_setopt($sname . $curopt, false);
                        break;
                    case '_hidemenu':
                        weaverii_pro_setopt($sname . $curopt, false);
                        break;
                }
            }
        }
        for ($j = 1; $j <= 8; $j++) {
            if (isset($_POST[$sname . '_img' . $j])) {
                weaverii_pro_setopt($sname . '_img' . $j, weaverii_filter_textarea($_POST[$sname . '_img' . $j]));
            }
        }
    }
    weaverii_pro_update_options('slider 3');
    /* and let the user know something happened */
    echo '<div id="message" class="updated fade"><p><strong>Weaver Slider Options Saved</strong></p></div>';
}
function weaveriip_save_header()
{
    /* Save options from plus header: wvrx_plus_save_header */
    if (!weaverii_pro_isset('hdr_num_opts')) {
        weaveriip_header_init();
    }
    if (isset($_POST['hdr_num_opts'])) {
        weaverii_pro_setopt('hdr_num_opts', weaveriip_default_int($_POST['hdr_num_opts'], 1, 32, 2));
    }
    if (isset($_POST['hdr_use_for_header'])) {
        weaverii_pro_setopt('hdr_use_for_header', weaverii_filter_textarea($_POST['hdr_use_for_header']));
    }
    for ($i = 1; $i <= weaverii_pro_getopt('hdr_num_opts'); $i++) {
        $base = 'hdr_' . $i . '_';
        if (isset($_POST[$base . 'x'])) {
            weaverii_pro_setopt($base . 'x', weaveriip_default_dec($_POST[$base . 'x'], -2048, 33000, 0));
        }
        if (isset($_POST[$base . '_xunits'])) {
            weaverii_pro_setopt($base . '_xunits', $_POST[$base . '_xunits']);
        }
        if (isset($_POST[$base . 'y'])) {
            weaverii_pro_setopt($base . 'y', weaveriip_default_dec($_POST[$base . 'y'], -2048, 33000, 0));
        }
        if (isset($_POST[$base . '_yunits'])) {
            weaverii_pro_setopt($base . '_yunits', $_POST[$base . '_yunits']);
        }
        if (isset($_POST[$base . 'page'])) {
            weaverii_pro_setopt($base . 'page', weaverii_filter_textarea($_POST[$base . 'page']));
        }
        if (isset($_POST[$base . 'img'])) {
            weaverii_pro_setopt($base . 'img', esc_url(weaverii_filter_textarea($_POST[$base . 'img'])));
            if (weaverii_pro_getopt($base . 'img') == '' && $_POST[$base . 'img'] != '') {
                weaverii_pro_setopt($base . 'img', '#invalid_url_format_entered');
            }
        }
        if (isset($_POST[$base . 'imgalt'])) {
            weaverii_pro_setopt($base . 'imgalt', weaverii_filter_textarea($_POST[$base . 'imgalt']));
        }
        if (isset($_POST[$base . 'text'])) {
            weaverii_pro_setopt($base . 'text', weaverii_filter_textarea($_POST[$base . 'text']));
        }
        if (isset($_POST[$base . 'textstyle'])) {
            weaverii_pro_setopt($base . 'textstyle', weaverii_filter_textarea($_POST[$base . 'textstyle']));
        }
        if (isset($_POST[$base . 'link'])) {
            weaverii_pro_setopt($base . 'link', esc_url(weaverii_filter_textarea($_POST[$base . 'link'])));
            if (weaverii_pro_getopt($base . 'link') == '' && $_POST[$base . 'link'] != '') {
                weaverii_pro_setopt($base . 'link', '#invalid_url__format_entered');
            }
        }
        if (isset($_POST[$base . 'linkalt'])) {
            weaverii_pro_setopt($base . 'linkalt', weaverii_filter_textarea($_POST[$base . 'linkalt']));
        }
        if (isset($_POST[$base . 'hidemobile'])) {
            weaverii_pro_setopt($base . 'hidemobile', 'checked');
        } else {
            weaverii_pro_setopt($base . 'hidemobile', false);
        }
        if (isset($_POST[$base . 'hidetablet'])) {
            weaverii_pro_setopt($base . 'hidetablet', 'checked');
        } else {
            weaverii_pro_setopt($base . 'hidetablet', false);
        }
        if (isset($_POST[$base . 'newpage'])) {
            weaverii_pro_setopt($base . 'newpage', 'checked');
        } else {
            weaverii_pro_setopt($base . 'newpage', false);
        }
    }
    weaverii_pro_update_options('header2');
    /* and let the user know something happened */
    echo '<div id="message" class="updated fade"><p><strong>Weaver II Pro Header Options Saved</strong></p></div>';
}
function weaveriip_save_social()
{
    global $weaveriip_social_services;
    if (!weaverii_pro_isset('social')) {
        weaveriip_init_social();
    }
    if (isset($_POST['wvp_add_social_to_menu'])) {
        weaverii_pro_setopt('wvp_add_social_to_menu', weaveriip_default_int($_POST['wvp_add_social_to_menu'], 1, 34, ''));
    }
    $soc = weaverii_pro_getopt('social');
    foreach ($weaveriip_social_services as $service) {
        $id = $service['icon'];
        if (isset($_POST[$id . '_use'])) {
            $soc[$id . '_use'] = 'checked';
        } else {
            $soc[$id . '_use'] = false;
        }
        if (isset($_POST[$id . '_stay'])) {
            $soc[$id . '_stay'] = 'checked';
        } else {
            $soc[$id . '_stay'] = false;
        }
        if (isset($_POST[$id . '_order'])) {
            $soc[$id . '_order'] = weaveriip_default_int($_POST[$id . '_order'], 0, 10000, '');
        } else {
            $soc[$id . '_order'] = '';
        }
        if (isset($_POST[$id . '_hover']) && $_POST[$id . '_hover'] != '') {
            $soc[$id . '_hover'] = weaverii_filter_textarea($_POST[$id . '_hover']);
        } else {
            $soc[$id . '_hover'] = $service['blurb'];
        }
        if (isset($_POST[$id . '_url'])) {
            $soc[$id . '_url'] = weaverii_filter_textarea($_POST[$id . '_url']);
        } else {
            $soc[$id . '_url'] = '';
        }
        if (isset($_POST[$id . '_custom'])) {
            $soc[$id . '_custom'] = weaverii_filter_textarea($_POST[$id . '_custom']);
        } else {
            $soc[$id . '_custom'] = '';
        }
    }
    weaverii_pro_setopt('social', $soc);
    weaverii_pro_update_options('save_social');
}
function weaverii_save_post_fields($post_id)
{
    // for backward compatibility, we will retain the ttw prefix names so old sites will still work with per page options - mostly...
    $default_post_fields = array('ttw_category', 'ttw_tag', 'ttw_onepost', 'ttw_orderby', 'ttw_order', 'ttw_author', 'ttw_posts_per_page', 'hide_sidebar_primary', 'hide_sidebar_right', 'hide_sidebar_left', 'top-widget-area', 'bottom-widget-area', 'sitewide-top-widget-area', 'sitewide-bottom-widget-area', 'wvr_post_type', 'ttw-hide-page-title', 'ttw-hide-site-title', 'ttw-hide-menus', 'ttw-hide-header-image', 'ttw-hide-footer', 'ttw-hide-header', 'ttw_hide_sticky', 'ttw-force-post-full', 'ttw-force-post-excerpt', 'ttw-show-post-avatar', 'ttw-favorite-post', 'ttw_show_extra_areas', 'ttw_hide_sidebars', 'bodyclass', 'ttw_show_replace_primary', 'ttw_replace_right', 'ttw_replace_left', 'hide_top_post_meta', 'hide_bottom_post_meta', 'ttw-show-featured', 'ttw-hide-featured-header', 'ttw-stay-on-page', 'ttw-hide-on-menu', 'wvr_show_pp_featured_img', 'ttw_hide_pp_infotop', 'ttw_hide_pp_infobot', 'ttw_show_replace_alternative', 'ttw_per_post_style', 'hide_visual_editor', 'wvr_masonry_span2', 'hide_post_bubble', 'hide_post_title', 'post_add_link', 'hide_post_format_label', 'wvr_page_layout', 'wvr_pwp_type', 'wvr_pwp_cols', 'ttw-hide-header-widget', 'wvr-hide-page-infobar', 'pp_post_filter', 'wvr-hide-on-menu-logged-in', 'wvr-hide-on-menu-logged-out', 'wvr-hide-on-mobile', 'wvr_hide_n_posts', 'wvr_fullposts', 'replace_horiz_header', 'wvr_pwp_masonry', 'wvr_pwp_compact', 'wvr_pwp_compact_posts');
    if (weaverii_allow_multisite()) {
        array_push($default_post_fields, 'wvr_raw_html');
    }
    $all_post_fields = $default_post_fields;
    if (isset($_POST['wii_post_meta'])) {
        foreach ($all_post_fields as $post_field) {
            if (isset($_POST[$post_field])) {
                $data = stripslashes($_POST[$post_field]);
                if ($post_field == 'ttw_show_extra_areas' || $post_field == 'ttw_replace_right' || $post_field == 'ttw_replace_left') {
                    $data = strtolower($data);
                    // force to lower case
                }
                if (get_post_meta($post_id, $post_field) == '') {
                    add_post_meta($post_id, $post_field, weaverii_filter_textarea($data), true);
                } else {
                    if ($data != get_post_meta($post_id, $post_field, true)) {
                        update_post_meta($post_id, $post_field, weaverii_filter_textarea($data));
                    } else {
                        if ($data == '') {
                            delete_post_meta($post_id, $post_field, get_post_meta($post_id, $post_field, true));
                        }
                    }
                }
            } else {
                delete_post_meta($post_id, $post_field, get_post_meta($post_id, $post_field, true));
            }
        }
    }
}
Example #8
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 weaveriip_save_buttons()
{
    if (!weaverii_pro_isset('buttons')) {
        weaveriip_init_buttons();
    }
    $buttons = weaverii_pro_getopt('buttons');
    if (isset($_POST['maxbuttons']) && $_POST['maxbuttons'] != $buttons['maxbuttons']) {
        $buttons['maxbuttons'] = weaveriip_default_int($_POST['maxbuttons'], 1, 64, 8);
        weaverii_pro_setopt('buttons', $buttons);
        weaverii_pro_update_options('link buttons');
        // kind of convoluted when changing value...
        weaveriip_init_buttons();
        $buttons = weaverii_pro_getopt('buttons');
    }
    $maxbuttons = $buttons['maxbuttons'];
    for ($i = 0; $i < $maxbuttons; $i++) {
        $id = 'b' . $i;
        if (isset($_POST[$id . '_img_url'])) {
            $buttons[$id . '_img_url'] = weaverii_filter_textarea($_POST[$id . '_img_url']);
        }
        if (isset($_POST[$id . '_hover'])) {
            $buttons[$id . '_hover'] = weaverii_filter_textarea($_POST[$id . '_hover']);
        }
        if (isset($_POST[$id . '_link_url'])) {
            $buttons[$id . '_link_url'] = weaverii_filter_textarea($_POST[$id . '_link_url']);
        }
        if (isset($_POST[$id . '_blank'])) {
            $buttons[$id . '_blank'] = 'checked';
        } else {
            $buttons[$id . '_blank'] = false;
        }
    }
    weaverii_pro_setopt('buttons', $buttons);
    weaverii_pro_update_options('link buttons2');
}