<?php
function magnews_banner( $banner , $before= false , $after = false){
	if(magnews_get_option( $banner )):
		echo $before;
		?>
		<?php
		if(magnews_get_option( $banner.'_img' )):
			$target="";
			if( magnews_get_option( $banner.'_tab' )) $target='target="_blank"'; ?>
			
			<a href="<?php echo magnews_get_option( $banner.'_url' ) ?>" title="<?php echo magnews_get_option( $banner.'_alt') ?>" <?php echo $target ?>>
				<img src="<?php echo magnews_get_option( $banner.'_img' ) ?>" alt="<?php echo magnews_get_option( $banner.'_alt') ?>" />
			</a>
			
		<?php elseif(magnews_get_option( $banner.'_adsense' )): ?>
			<?php echo do_shortcode(htmlspecialchars_decode(magnews_get_option( $banner.'_adsense' ))) ?>
		<?php	
		endif;
		?>
		
		<?php
		echo $after;
	endif;
}
?>