<?php

/* Theme setup section
-------------------------------------------------------------------- */
if (!function_exists('seohub_sc_br_theme_setup')) {
	add_action( 'seohub_action_before_init_theme', 'seohub_sc_br_theme_setup' );
	function seohub_sc_br_theme_setup() {
		add_action('seohub_action_shortcodes_list', 		'seohub_sc_br_reg_shortcodes');
		if (function_exists('seohub_exists_visual_composer') && seohub_exists_visual_composer())
			add_action('seohub_action_shortcodes_list_vc','seohub_sc_br_reg_shortcodes_vc');
	}
}



/* Shortcode implementation
-------------------------------------------------------------------- */

/*
[trx_br clear="left|right|both"]
*/

if (!function_exists('seohub_sc_br')) {	
	function seohub_sc_br($atts, $content = null) {
		if (seohub_in_shortcode_blogger()) return '';
		extract(seohub_html_decode(shortcode_atts(array(
			"clear" => ""
		), $atts)));
		$output = in_array($clear, array('left', 'right', 'both', 'all')) 
			? '<div class="clearfix" style="clear:' . str_replace('all', 'both', $clear) . '"></div>'
			: '<br />';
		return apply_filters('seohub_shortcode_output', $output, 'trx_br', $atts, $content);
	}
	seohub_require_shortcode("trx_br", "seohub_sc_br");
}



/* Add shortcode in the internal SC Builder
-------------------------------------------------------------------- */
if ( !function_exists( 'seohub_sc_br_reg_shortcodes' ) ) {
	//add_action('seohub_action_shortcodes_list', 'seohub_sc_br_reg_shortcodes');
	function seohub_sc_br_reg_shortcodes() {
		global $SEOHUB_GLOBALS;
	
		$SEOHUB_GLOBALS['shortcodes']["trx_br"] = array(
			"title" => esc_html__("Break", "seohub"),
			"desc" => wp_kses( __("Line break with clear floating (if need)", "seohub"), $SEOHUB_GLOBALS['allowed_tags'] ),
			"decorate" => false,
			"container" => false,
			"params" => array(
				"clear" => 	array(
					"title" => esc_html__("Clear floating", "seohub"),
					"desc" => wp_kses( __("Clear floating (if need)", "seohub"), $SEOHUB_GLOBALS['allowed_tags'] ),
					"value" => "",
					"type" => "checklist",
					"options" => array(
						'none' => esc_html__('None', 'seohub'),
						'left' => esc_html__('Left', 'seohub'),
						'right' => esc_html__('Right', 'seohub'),
						'both' => esc_html__('Both', 'seohub')
					)
				)
			)
		);
	}
}


/* Add shortcode in the VC Builder
-------------------------------------------------------------------- */
if ( !function_exists( 'seohub_sc_br_reg_shortcodes_vc' ) ) {
	//add_action('seohub_action_shortcodes_list_vc', 'seohub_sc_br_reg_shortcodes_vc');
	function seohub_sc_br_reg_shortcodes_vc() {
		global $SEOHUB_GLOBALS;
/*
		vc_map( array(
			"base" => "trx_br",
			"name" => esc_html__("Line break", "seohub"),
			"description" => wp_kses( __("Line break or Clear Floating", "seohub"), $SEOHUB_GLOBALS['allowed_tags'] ),
			"category" => esc_html__('Content', 'js_composer'),
			'icon' => 'icon_trx_br',
			"class" => "trx_sc_single trx_sc_br",
			"content_element" => true,
			"is_container" => false,
			"show_settings_on_create" => true,
			"params" => array(
				array(
					"param_name" => "clear",
					"heading" => esc_html__("Clear floating", "seohub"),
					"description" => wp_kses( __("Select clear side (if need)", "seohub"), $SEOHUB_GLOBALS['allowed_tags'] ),
					"class" => "",
					"value" => "",
					"value" => array(
						esc_html__('None', 'seohub') => 'none',
						esc_html__('Left', 'seohub') => 'left',
						esc_html__('Right', 'seohub') => 'right',
						esc_html__('Both', 'seohub') => 'both'
					),
					"type" => "dropdown"
				)
			)
		) );
		
		class WPBakeryShortCode_Trx_Br extends SEOHUB_VC_ShortCodeSingle {}
*/
	}
}
?>