<?php

class Intense_Row extends Intense_Shortcode {

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

		global $intense_visions_options;

		$this->title = __( 'Layout Row', 'intense' );
		$this->description = __( 'Organize your content into rows and columns for a clean visual look using the row shortcode. The columns can be any size from 1-12 (ex. two columns of size 6, 4 columns of size 3, 3 columns of size 4, etc.).
			<br><br>
			Each column can be customized to have different sizes for mobile devices. There are four different sizes which apply to different screen sizes:
			<ul>
			<li><strong>Standard</strong> – Large devices (large desktops, 1200px and up)</li>
			<li><strong>Medium</strong> – Medium devices (desktops, 992px and up)</li>
			<li><strong>Small</strong> – Small devices (tablets, 768px and up)</li>
			<li><strong>Extra Small</strong> – Extra small devices (phones, less than 768px)</li>
			</ul>
			The columns have gutters which add white space between columns. The gutters can be disabled if you want the columns to be right next to each other.', 'intense' );
		$this->category = __( 'Layout', 'intense' );
		$this->show_preview = false;
		$this->is_container = true;
	}

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

		if ( is_numeric( $padding_top ) && $padding_top != 0 ) $padding_top .= "px";
		if ( is_numeric( $padding_bottom ) && $padding_bottom != 0 ) $padding_bottom .= "px";
		if ( is_numeric( $margin_top ) && $margin_top != 0 ) $margin_top .= "px";
		if ( is_numeric( $margin_bottom ) && $margin_bottom != 0 ) $margin_bottom .= "px";

		$style = '';

		if ( isset( $padding_top ) ) {
			$style .= 'padding-top: ' . $padding_top . '; ';
		}

		if ( isset( $padding_bottom ) ) {
			$style .= 'padding-bottom: ' . $padding_bottom . '; ';
		}

		if ( isset( $margin_top ) ) {
			$style .= 'margin-top: ' . $margin_top . '; ';
		}

		if ( isset( $margin_bottom ) ) {
			$style .= 'margin-bottom: ' . $margin_bottom . '; ';
		}

		return "<div " . ( isset( $id ) ? "id='$id' " : "" ) . " class='intense row " .
			( is_rtl() ? "rtl " : "" ) .
			( $nogutter ? "nogutter " : "" ) .
			( !empty( $class ) ? $class . ' ' : '' ) .
			"' " . ( isset( $style ) ? "style='$style'" : "" ) . ">" . do_shortcode( $content ) . "</div>";
	}	
}

//TODO: add Responsive column reset shortcode see http://getbootstrap.com/css/#grid
