<?php

/* ------------------------------------------------
   Theme Shortcodes
---------------------------------------------------
 
   
 TABLE OF CONTENTS
 
     0.0 - Shotcode Setup
     1.0 - CSS Columns 
   
   
------------------------------------------------ */



/* ------------------------------------------------
  0.0 Setup WP For Shortcodes
------------------------------------------------ */

function MCL_shortcode_formatter($content) {
	$new_content = '';
	$pattern_full = '{(\[raw\].*?\[/raw\])}is';
	$pattern_contents = '{\[raw\](.*?)\[/raw\]}is';
	$pieces = preg_split($pattern_full, $content, -1, PREG_SPLIT_DELIM_CAPTURE);

	foreach ($pieces as $piece) {
		if (preg_match($pattern_contents, $piece, $matches)) {
			$new_content .= $matches[1];
		} else {
			$new_content .= wptexturize(wpautop($piece));
		}
	}

	return $new_content;
}

remove_filter('the_content', 'wpautop');
remove_filter('the_content','wptexturize');

add_filter('the_content', 'MCL_shortcode_formatter', 99);



/* ------------------------------------------------
  1.0 CSS Columns
------------------------------------------------ */

function MCL_one_third( $atts, $content = null ) {
	return '<div class="one_third">' . do_shortcode($content) . '</div>';
	}
add_shortcode('one_third', 'MCL_one_third');


function MCL_one_third_last( $atts, $content = null ) {
	return '<div class="one_third last">' . do_shortcode($content) . '</div><div class="clear"></div>';
	}
add_shortcode('one_third_last', 'MCL_one_third_last');


function MCL_two_third( $atts, $content = null ) {
	return '<div class="two_third">' . do_shortcode($content) . '</div>';
	}
add_shortcode('two_third', 'MCL_two_third');


function MCL_two_third_last( $atts, $content = null ) {
	return '<div class="two_third last">' . do_shortcode($content) . '</div><div class="clear"></div>';
	}
add_shortcode('two_third_last', 'MCL_two_third_last');


function MCL_one_half( $atts, $content = null ) {
	return '<div class="one_half">' . do_shortcode($content) . '</div>';
	}
add_shortcode('one_half', 'MCL_one_half');


function MCL_one_half_last( $atts, $content = null ) {
	return '<div class="one_half last">' . do_shortcode($content) . '</div><div class="clear"></div>';
	}
add_shortcode('one_half_last', 'MCL_one_half_last');


function MCL_one_fourth( $atts, $content = null ) {
	return '<div class="one_fourth">' . do_shortcode($content) . '</div>';
	}
add_shortcode('one_fourth', 'MCL_one_fourth');


function MCL_one_fourth_last( $atts, $content = null ) {
	return '<div class="one_fourth last">' . do_shortcode($content) . '</div><div class="clear"></div>';
	}
add_shortcode('one_fourth_last', 'MCL_one_fourth_last');


function MCL_three_fourth( $atts, $content = null ) {
	return '<div class="three_fourth">' . do_shortcode($content) . '</div>';
	}
add_shortcode('three_fourth', 'MCL_three_fourth');


function MCL_three_fourth_last( $atts, $content = null ) {
	return '<div class="three_fourth last">' . do_shortcode($content) . '</div><div class="clear"></div>';
	}
add_shortcode('three_fourth_last', 'MCL_three_fourth_last');


function MCL_one_fifth( $atts, $content = null ) {
	return '<div class="one_fifth">' . do_shortcode($content) . '</div>';
	}
add_shortcode('one_fifth', 'MCL_one_fifth');


function MCL_one_fifth_last( $atts, $content = null ) {
	return '<div class="one_fifth last">' . do_shortcode($content) . '</div><div class="clear"></div>';
	}
add_shortcode('one_fifth_last', 'MCL_one_fifth_last');


function MCL_two_fifth( $atts, $content = null ) {
	return '<div class="two_fifth">' . do_shortcode($content) . '</div>';
	}
add_shortcode('two_fifth', 'MCL_two_fifth');


function MCL_two_fifth_last( $atts, $content = null ) {
	return '<div class="two_fifth last">' . do_shortcode($content) . '</div><div class="clear"></div>';
	}
add_shortcode('two_fifth_last', 'MCL_two_fifth_last');


function MCL_three_fifth( $atts, $content = null ) {
	return '<div class="three_fifth">' . do_shortcode($content) . '</div>';
	}
add_shortcode('three_fifth', 'MCL_three_fifth');


function MCL_three_fifth_last( $atts, $content = null ) {
	return '<div class="three_fifth last">' . do_shortcode($content) . '</div><div class="clear"></div>';
	}
add_shortcode('three_fifth_last', 'MCL_three_fifth_last');


function MCL_four_fifth( $atts, $content = null ) {
	return '<div class="four_fifth">' . do_shortcode($content) . '</div>';
	}
add_shortcode('four_fifth', 'MCL_four_fifth');


function MCL_four_fifth_last( $atts, $content = null ) {
	return '<div class="four_fifth last">' . do_shortcode($content) . '</div><div class="clear"></div>';
	}
add_shortcode('four_fifth_last', 'MCL_four_fifth_last');


function MCL_one_sixth( $atts, $content = null ) {
	return '<div class="one_sixth">' . do_shortcode($content) . '</div>';
	}
add_shortcode('one_sixth', 'MCL_one_sixth');


function MCL_one_sixth_last( $atts, $content = null ) {
	return '<div class="one_sixth last">' . do_shortcode($content) . '</div><div class="clear"></div>';
	}
add_shortcode('one_sixth_last', 'MCL_one_sixth_last');


function MCL_five_sixth( $atts, $content = null ) {
	return '<div class="five_sixth">' . do_shortcode($content) . '</div>';
	}
add_shortcode('five_sixth', 'MCL_five_sixth');


function MCL_five_sixth_last( $atts, $content = null ) {
	return '<div class="five_sixth last">' . do_shortcode($content) . '</div><div class="clear"></div>';
	}
add_shortcode('five_sixth_last', 'MCL_five_sixth_last');


?>