<?php
function theme_shortcode_divider($atts, $content = null) {
	extract(shortcode_atts(array(
		'padding'=> 25,
	), $atts));
	return '<div class="divider" style="padding-top:'.$padding.'px"></div>';
}
add_shortcode('divider', 'theme_shortcode_divider');

function theme_shortcode_divider_top() {
	return '<div class="divider top"><a href="#">'.__('Top',THEME_FRONT_DOMAIN).'</a></div>';
}
add_shortcode('divider_top', 'theme_shortcode_divider_top');

function theme_shortcode_divider_padding($atts, $content = null) {
	extract(shortcode_atts(array(
		'padding'=> 25,
	), $atts));
	return '<div class="divider_padding" style="padding-top:'.$padding.'px"></div>';
}
add_shortcode('divider_padding', 'theme_shortcode_divider_padding');

function theme_shortcode_divider_line() {
	return '<div class="divider_line"></div>';
}
add_shortcode('divider_line', 'theme_shortcode_divider_line');

function theme_shortcode_clearboth() {
   return '<div class="clear"></div>';
}
add_shortcode('clearboth', 'theme_shortcode_clearboth');


function theme_shortcode_advanced_divider($atts) {
	extract(shortcode_atts(array(
		'color' => '',
		'paddingtop' => 'false',
		'paddingbottom'=> 'false',
		'thickness'=> 'false',
		'width' => 'false',
		'top' => 'false',
	), $atts));
	$styles = array();
	if($color !== 'false'){
		$styles[] = 'border-color:'.$color;
	}
	if($paddingtop!== 'false'){
		$styles[] = 'padding-top:'.$paddingtop.'px';
	}
	if($paddingbottom!== 'false'){
		$styles[] = 'margin-bottom:'.$paddingbottom.'px';
	}
	if($thickness!== 'false'){
		$styles[] = 'border-bottom-width:'.$thickness.'px';
	}
	if($width!== 'false'){
		$styles[] = 'margin-right:auto; margin-left:auto; width:'.$width;
	}
	if(!empty($styles)){
		$style = ' style="'.implode(';', $styles).'"';
	}else{
		$style = '';
	}
	if($top !== 'false'){
		$top = ' top';
		$top_text = '<a href="#">'.__('Top','striking_front').'</a>';
	}else{
		$top = '';
		$top_text = '';
	}
	return '<div class="divider'.$top.'"'.$style.'>'.$top_text.'</div>';
}
add_shortcode('divider_advanced', 'theme_shortcode_advanced_divider');

