<?php 
function widget_sideAds() { 
	$options = get_option("widget_sideAds");
?>
    <h3><?php echo $options['title']; ?></h3>
    <div class="sideads">
        <?php if(theme_option('sidebar_ad')) { echo stripslashes(theme_option('sidebar_ad')); } else { ?>
            <a href="#"><img src="<?php echo THEME_URL; ?>/images/adspot.png" alt="" class="four" /></a>
            <a href="#"><img src="<?php echo THEME_URL; ?>/images/adspot.png" alt="" class="four" /></a>
            <a href="#"><img src="<?php echo THEME_URL; ?>/images/adspot.png" alt="" class="four" /></a>
            <a href="#"><img src="<?php echo THEME_URL; ?>/images/adspot.png" alt="" class="four" /></a>
        <?php } ?>
    </div>
<?php
}

function widget_mySideads($args) {
	extract($args); 
	echo $before_widget;
	widget_sideAds();
	echo $after_widget; 
}

function mySideads_control() {
	$options = get_option("widget_sideAds");

	if (!is_array( $options )) {
		$options = array(
			'title' => 'Advertisements'
		);
	}      

	if ($_POST['sideAds-Submit']) {
		$options['title'] = htmlspecialchars($_POST['sideAds-WidgetTitle']);
		update_option("widget_sideAds", $options);
	}
?>
  <p>
    <label for="sideFeature-WidgetTitle"><?php _e('Title: ', "moderno"); ?></label><br />
    <input class="widefat" type="text" id="sideAds-WidgetTitle" name="sideAds-WidgetTitle" value="<?php echo $options['title'];?>" />
    <br />
    <input type="hidden" id="sideAds-Submit" name="sideAds-Submit" value="1" />
	<p><small><em><?php _e('(Note: Enter ad code under <strong>'.THEME_NAME.'</strong> Theme Options)', "moderno"); ?></em></small></p>
  </p>

<?php
}

wp_register_sidebar_widget( 'sideads', __('Mod - Sidebar Ads', "moderno"), 'widget_mySideads', array('description' => __('Ad space', "moderno")) );
wp_register_widget_control( 'sideads', __('Mod - Sidebar Ads', "moderno"), 'mySideads_control');

?>