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>';
}
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 weaveriip_slider_sform($i)
{
    global $weaveriip_slider_opts;
    $sname = 'slider' . $i;
    if ($i & 1) {
        echo "<div style=\"width:99%;background:#eee;padding:4px;border-right:2px solid #eee;\">\n";
    } else {
        echo "<div style=\"width:99%;padding:4px;border:1px solid #ddd;\">\n";
    }
    $menus = get_terms('nav_menu', array('hide_empty' => false));
    // get defined custom menus
    $menu_selected = weaverii_pro_isset($sname . '_menu') ? weaverii_pro_getopt($sname . '_menu') : '';
    ?>
	<div><span style="color:blue;font-weight:bold;font-size:120%;">Slider <?php 
    echo $i;
    ?>
</span>
		&nbsp;&nbsp;<em>Shortcode:</em> <strong><code>[weaver_slider id=<?php 
    echo $i;
    ?>
]</code></strong>
		| <em>Note (where used, for example):</em>
		<input name="<?php 
    echo $sname;
    ?>
_note" id="<?php 
    echo $sname;
    ?>
_note" type="text" style="width:250px;height:22px;" class="regular-text" value="<?php 
    weaverii_esc_textarea(weaverii_pro_getopt($sname . '_note'));
    ?>
" />
	</div>
	<br />
	<table class="optiontable">
		<tr>
			<th scope="row" align="right" style="width:20%;">Select Menu:&nbsp;</th>
			<td>
<?php 
    // If no irect the user to go and create some.
    if (!$menus) {
        echo sprintf('No menus have been created yet. Please use <a href="$s">Appearance&rarr;Menus</a> to create some.', admin_url('nav-menus.php'));
    } else {
        ?>
					<select id="<?php 
        echo $sname . '_menu';
        ?>
" name="<?php 
        echo $sname . '_menu';
        ?>
">
<?php 
        foreach ($menus as $menu) {
            $selected = $menu_selected == $menu->term_id ? ' selected="selected"' : '';
            echo '<option' . $selected . ' value="' . $menu->term_id . '">' . $menu->name . '</option>' . "\n";
        }
    }
    ?>
					</select>
			</td>
			<td style="padding-left: 10px"><small>Select a custom menu to use for this slider. Sub-menus are not supported!.</small></td>

		</tr>
		<tr>
			<th scope="row" align="right" style="width:20%;">Hide Menu Text:&nbsp;</th>
			<td>
			<input type="checkbox" name="<?php 
    echo $sname;
    ?>
_hidetext" id="<?php 
    echo $sname;
    ?>
_hidetext" <?php 
    echo weaverii_pro_getopt($sname . '_hidetext') ? "checked" : "";
    ?>
 />
			</td>
			<td style="padding-left: 10px"><small>Hide standard Menu names over each image. Useful if your image
			contains the Menu name.</small></td>
		</tr>
		<tr>
			<th scope="row" align="right" style="width:20%;">Hide on Mobile View:&nbsp;</th>
			<td>
			<input type="checkbox" name="<?php 
    echo $sname;
    ?>
_hidemobile" id="<?php 
    echo $sname;
    ?>
_hidemobile" <?php 
    echo weaverii_pro_getopt($sname . '_hidemobile') ? "checked" : "";
    ?>
 />
			</td>
			<td style="padding-left: 10px"><small>Hide this slider on all mobile devices. Useful in combination with Main Options:
			Header: Hide Header Image on Normal View to show alternate header on mobile devices.</small></td>
		</tr>

		<tr>
			<th scope="row" align="right" style="width:20%;">Auto-Hide Primary Menu:&nbsp;</th>
			<td>
			<input type="checkbox" name="<?php 
    echo $sname;
    ?>
_hidemenu" id="<?php 
    echo $sname;
    ?>
_hidemenu" <?php 
    echo weaverii_pro_getopt($sname . '_hidemenu') ? "checked" : "";
    ?>
 />
			</td>
			<td style="padding-left: 10px"><small>Automatically hide Primary Menu on desktop or wide displays (slider on desktops,
			regular menu on mobile).</small></td>
		</tr>

		<tr>
			<th scope="row" align="right">Number of Images in Menu:&nbsp;</th>
			<td>
				<input name="<?php 
    echo $sname;
    ?>
_number_images" id="<?php 
    echo $sname;
    ?>
_number_images" type="text" style="width:60px;height:22px;" class="regular-text" value="<?php 
    weaverii_esc_textarea(weaverii_pro_getopt($sname . '_number_images'));
    ?>
" />
			<td style="padding-left: 10px"><small>Number of Images in Menu (must be between 2 and 8). Default is 7.</small></td>
			</td>
		</tr>
		<tr>
		<th scope="row" align="right">Menu Width:&nbsp;</th>
			<td>
				<input name="<?php 
    echo $sname;
    ?>
_menu_width" id="<?php 
    echo $sname;
    ?>
_menu_width" type="text" style="width:60px;height:22px;" class="regular-text" value="<?php 
    weaverii_esc_textarea(weaverii_pro_getopt($sname . '_menu_width'));
    ?>
" />
			<td style="padding-left: 10px"><small>Overall width of Slider Menu (in px). <em>(Typically matches image width for vertical menus, theme width for horizontal menus.)</em></small></td>
			</td>
		</tr>
		<tr>
			<th scope="row" align="right">Width of each image:&nbsp;</th>
			<td>
				<input name="<?php 
    echo $sname;
    ?>
_img_width" id="<?php 
    echo $sname;
    ?>
_img_width" type="text" style="width:60px;height:22px;" class="regular-text" value="<?php 
    weaverii_esc_textarea(weaverii_pro_getopt($sname . '_img_width'));
    ?>
" />
			<td style="padding-left: 10px"><small>Enter the width of each image (in px). For horizontal sliders, this will affect the exact look of the slider effect.
			The default 320 works well with 7 horizontal images. For vertical sliders, this will be the width of the slider. <em>Use 210 width for
			slider in text widget with default sidebar. (130 is good matching height.)</em></small></td>
			</td>
		</tr>
		<tr>
			<th scope="row" align="right">Height of each image:&nbsp;</th>
			<td>
				<input name="<?php 
    echo $sname;
    ?>
_img_height" id="<?php 
    echo $sname;
    ?>
_img_height" type="text" style="width:60px;height:22px;" class="regular-text" value="<?php 
    weaverii_esc_textarea(weaverii_pro_getopt($sname . '_img_height'));
    ?>
" />
			<td style="padding-left: 10px"><small>Enter the height of each image (in px). This will determine the height of your slider menu. Default is 200. Limits are 25 and 1000.</small></td>
			</td>
		</tr>
		<tr>
			<th scope="row" align="right" style="width:20%;">Vertical Menu:&nbsp;</th>
			<td>
			<input type="checkbox" name="<?php 
    echo $sname;
    ?>
_vertical" id="<?php 
    echo $sname;
    ?>
_vertical" <?php 
    echo weaverii_pro_getopt($sname . '_vertical') ? "checked" : "";
    ?>
 />
			</td>
			<td style="padding-left: 10px"><small>Check for vertical menu.</small> <strong>|</strong> Compressed height for each image:&nbsp;
			<input name="<?php 
    echo $sname;
    ?>
_vert_compress" id="<?php 
    echo $sname;
    ?>
_vert_compress" type="text" style="width:40px;height:20px;" class="regular-text" value="<?php 
    weaverii_esc_textarea(weaverii_pro_getopt($sname . '_vert_compress'));
    ?>
" />
			&nbsp;<small>This value, image height, and number of images interact to determine total height of vertical menu. Not used for horizontal menus.</small>
			</td>
		</tr>
		<tr>
			<th scope="row" align="right" style="width:20%;">Images Only, No Sliding:&nbsp;</th>
			<td>
			<input type="checkbox" name="<?php 
    echo $sname;
    ?>
_noeffects" id="<?php 
    echo $sname;
    ?>
_noeffects" <?php 
    echo weaverii_pro_getopt($sname . '_noeffects') ? "checked" : "";
    ?>
 />
			</td>
			<td style="padding-left: 10px"><small>Disable sliding effects. You will get an image menu only. You will have to adjust image sizes to fit.</small>
			</td>
		</tr>
		<tr>
			<th scope="row" align="right">CSS for Menu Text:&nbsp;</th>
			<td>&nbsp;</td>
			<td>
				<span style="padding-left: 10px"><small>You can control the font characteristics of the Slider Menu Text
				by editing this CSS. (Clear to blank to restore defaults.)</small></span>
				<br />
				<textarea name="<?php 
    echo $sname;
    ?>
_text_font" rows=2 style="width: 95%"><?php 
    weaverii_esc_textarea(weaverii_pro_getopt($sname . '_text_font'));
    ?>
</textarea>
				</td>
			</td>
		</tr>
		<tr>
			<th scope="row" align="right">Slider Menu CSS:&nbsp;</th>
			<td>&nbsp;</td>
			<td>
				<span style="padding-left: 10px"><small>Edit this CSS to change menu margins, etc. Use <code>border:0;</code> for no borders. Clear to blank to restore default.</small></span>
				<br />
				<textarea name="<?php 
    echo $sname;
    ?>
_borders" rows=1 style="width: 95%"><?php 
    weaverii_esc_textarea(weaverii_pro_getopt($sname . '_borders'));
    ?>
</textarea>
				</td>
			</td>
		</tr>
		</table>
		<h3>Slider Image Locations</h3>
		<p>
		Specify URLs for images for the menu. Each image should be
		<?php 
    echo weaveriip_default_int(weaverii_pro_getopt($sname . '_img_height'), 25, 1024, 200);
    ?>
px high and
		<?php 
    echo weaveriip_default_int(weaverii_pro_getopt($sname . '_img_width'), 25, 1024, 320);
    ?>
px wide. The most reliable place to
		keep your Slider images is in your Media Library. Click the small image icon to open the Medial Library selection dialog. Click "Insert into Post" to add URL. You can also enter any URL directly into the URL box below. If you have < 8 images, just leave the excess image links blank.</p>

		<table class="optiontable" style="padding-left:3%; padding-right:3%;">
		<tr>
			<td>
				1. Enter URL: <input type="text" name="<?php 
    echo $sname;
    ?>
_img1" id="<?php 
    echo $sname;
    ?>
_img1" size="55" value="<?php 
    weaverii_esc_textarea(weaverii_pro_getopt($sname . '_img1'));
    ?>
" /><?php 
    weaverii_media_lib_button($sname . '_img1');
    ?>
&nbsp;
			</td>
			<td>
				2. Enter URL: <input type="text" name="<?php 
    echo $sname;
    ?>
_img2" id="<?php 
    echo $sname;
    ?>
_img2" size="55" value="<?php 
    weaverii_esc_textarea(weaverii_pro_getopt($sname . '_img2'));
    ?>
" /><?php 
    weaverii_media_lib_button($sname . '_img2');
    ?>
			</td>
		</tr>
		<tr>
			<td>
				3. Enter URL: <input type="text" name="<?php 
    echo $sname;
    ?>
_img3" id="<?php 
    echo $sname;
    ?>
_img3" size="55" value="<?php 
    weaverii_esc_textarea(weaverii_pro_getopt($sname . '_img3'));
    ?>
" /><?php 
    weaverii_media_lib_button($sname . '_img3');
    ?>
&nbsp;
			</td>
			<td>
				4. Enter URL: <input type="text" name="<?php 
    echo $sname;
    ?>
_img4" id="<?php 
    echo $sname;
    ?>
_img4" size="55" value="<?php 
    weaverii_esc_textarea(weaverii_pro_getopt($sname . '_img4'));
    ?>
" /><?php 
    weaverii_media_lib_button($sname . '_img4');
    ?>
			</td>
		</tr>
		<tr>
			<td>
				5. Enter URL: <input type="text" name="<?php 
    echo $sname;
    ?>
_img5" id="<?php 
    echo $sname;
    ?>
_img5" size="55" value="<?php 
    weaverii_esc_textarea(weaverii_pro_getopt($sname . '_img5'));
    ?>
" /><?php 
    weaverii_media_lib_button($sname . '_img5');
    ?>
&nbsp;
			</td>
			<td>
				6. Enter URL: <input type="text" name="<?php 
    echo $sname;
    ?>
_img6" id="<?php 
    echo $sname;
    ?>
_img6" size="55" value="<?php 
    weaverii_esc_textarea(weaverii_pro_getopt($sname . '_img6'));
    ?>
" /><?php 
    weaverii_media_lib_button($sname . '_img6');
    ?>
			</td>
		</tr>
		<tr>
			<td>
				7. Enter URL: <input type="text" name="<?php 
    echo $sname;
    ?>
_img7" id="<?php 
    echo $sname;
    ?>
_img7" size="55" value="<?php 
    weaverii_esc_textarea(weaverii_pro_getopt($sname . '_img7'));
    ?>
" /><?php 
    weaverii_media_lib_button($sname . '_img7');
    ?>
&nbsp;
			</td>
			<td>
				8. Enter URL: <input type="text" name="<?php 
    echo $sname;
    ?>
_img8" id="<?php 
    echo $sname;
    ?>
_img8" size="55" value="<?php 
    weaverii_esc_textarea(weaverii_pro_getopt($sname . '_img8'));
    ?>
" /><?php 
    weaverii_media_lib_button($sname . '_img8');
    ?>
			</td>
		</tr>

		</table>
		<input class="button-primary" type="submit" name="weaverii_pro_save_pro" value="Save Slider Options"/>
</div>
<?php 
}
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');
}