<?php

class Intense_Spacer extends Intense_Shortcode {

	function __construct() {
        parent::__construct();

		global $intense_visions_options;

		$this->title = __( 'Spacer', 'intense' );
		$this->description = __( 'Add a spacer of a specified height in your WordPress pages and posts. The spacer shortcode can be used to fix floated elements (ie. clear left, right, both). If your theme doesn’t define a clearfix CSS class, the spacer can be used instead. Clearfix is used to clear the floats of any element.', 'intense' );
		$this->category = __( 'Layout', 'intense' );
		$this->show_preview = true;		
	}

	function shortcode( $atts, $content = null ) {
		global $intense_visions_options;
		extract( shortcode_atts( $this->get_shortcode_defaults( null, $atts ), $atts ) );

		$style = '';
		$class = '';

		if ( !isset( $type ) ) $type = 'block';

		switch( $type ) {
			case 'block':
				switch ( $clear ) {
				case 'right':
					$style = 'clear: right;';
					break;
				case 'left':
					$style = 'clear: left;';
					break;
				case 'both':
					$class = 'clearfix';
					break;
				}

				return "<div class='intense spacer $class' style='height: " . $height . "px; $style'></div>";
				break;
			case 'inline':
				return '<br>';
				break;
		}		
	}
}
