<?php
class WPBakeryShortCode_Av_Pricing extends WPBakeryShortCodesContainer{
protected function content($atts, $content=NULL){
    extract(shortcode_atts(array(
		'title' => '',
		'price'	=> '',
		'submiturl'	=> '',
		'submitcaption'	=> '',
		'anim'=>'',
		'class'=>''
	), $atts));
	$GLOBALS['pcolumn_count'] = 0;
	$anim = empty($anim) ? '' : "animation $anim";
	$return = '';
	do_shortcode( $content );
	if( is_array( $GLOBALS['pcolumns'] ) ){
		foreach( $GLOBALS['pcolumns'] as $pcolumn ){
			$pcolumns[] = '<li class="bullet-item"><p>'.do_shortcode($pcolumn['content']).'</p></li>';
		}
		$return.= '<div class="pricing-section '.$anim.' '.$class.'">
		<ul class="pricing-table basic">
			<li class="title"><p>'.$title.'</p><span>'.$price.'</span></li>
			'.implode( "\n", $pcolumns ).'
			<li class="cta-button"><a class="btn-default" href="'.$submiturl.'">'.$submitcaption.'</a></li>
		</ul></div>';
		unset($GLOBALS['pcolumns']);
		
	}
	return $return;
}
}
add_shortcode('av_pricing', 'alc_pricing');
/*******************************************/
class WPBakeryShortCode_Av_Column extends WPBakeryShortCode {
    protected function content( $atts, $content = null){
	extract(shortcode_atts(array(
		'colcontent' => ''
	), $atts));
	
	$x = $GLOBALS['pcolumn_count'];
	$GLOBALS['pcolumns'][$x] = array('content' =>  $content );
	$GLOBALS['pcolumn_count']++;
	}
}
add_shortcode('av_column', 'alc_column');
/**********************************************************/
vc_map( array(
	"name" => __("Unik Pricing Table", "unik"),
	"show_settings_on_create" => true,
	'is_container' => true,
	"content_element" => true,
	"as_parent" => array('only' => 'av_column'),
	"base" => "av_pricing",
	"class" => "",
	"icon" => "icon-wpb-my_pricing",
	'admin_enqueue_css' => array(get_template_directory_uri() . '/vc_templates/shortcodes.css'),
	"category" => __('Content', "unik"),
	"params" => array(
		array(
         "type" => "dropdown",
         "class" => "",
         "heading" => __("Animation", "unik"),
         "param_name" => "anim",
         "value" => array( "None"=>"", "bounce"=>"bounce", "flash"=>"flash", "pulse"=>"pulse", "shake"=>"shake", "swing"=>"swing", "tada"=>"tada", "wobble"=>"wobble", "bounceIn"=>"bounceIn", "bounceInDown"=>"bounceInDown", "bounceInLeft"=>"bounceInLeft", "bounceInRight"=>"bounceInRight", "bounceInUp"=>"bounceInUp", "bounceOut"=>"bounceOut", "bounceOutDown"=>"bounceOutDown", "bounceOutLeft"=>"bounceOutLeft", "bounceOutRight"=>"bounceOutRight", "bounceOutUp"=>"bounceOutUp", "fadeIn"=>"fadeIn", "fadeInDown"=>"fadeInDown", "fadeInDownBig"=>"fadeInDownBig", "fadeInLeft"=>"fadeInLeft", "fadeInLeftBig"=>"fadeInLeftBig", "fadeInRight"=>"fadeInRight", "fadeInRightBig"=>"fadeInRightBig", "fadeInUp"=>"fadeInUp", "fadeInUpBig"=>"fadeInUpBig", "fadeOut"=>"fadeOut", "fadeOutDown"=>"fadeOutDown", "fadeOutDownBig"=>"fadeOutDownBig", "fadeOutLeft"=>"fadeOutLeft", "fadeOutLeftBig"=>"fadeOutLeftBig", "fadeOutRight"=>"fadeOutRight", "fadeOutRightBig"=>"fadeOutRightBig", "fadeOutUp"=>"fadeOutUp", "fadeOutUpBig"=>"fadeOutUpBig", "flip"=>"flip", "flipInX"=>"flipInX", "flipInY"=>"flipInY", "flipOutX"=>"flipOutX", "flipOutY"=>"flipOutY", "lightSpeedIn"=>"lightSpeedIn", "lightSpeedOut"=>"lightSpeedOut", "rotateIn"=>"rotateIn", "rotateInDownLeft"=>"rotateInDownLeft", "rotateInDownRight"=>"rotateInDownRight", "rotateInUpLeft"=>"rotateInUpLeft", "rotateInUpRight"=>"rotateInUpRight", "rotateOut"=>"rotateOut", "rotateOutDownLeft"=>"rotateOutDownLeft", "rotateOutDownRight"=>"rotateOutDownRight", "rotateOutUpLeft"=>"rotateOutUpLeft", "rotateOutUpRight"=>"rotateOutUpRight",  "hinge"=>"hinge", "rollIn"=>"rollIn", "rollOut"=>"rollOut", "zoomIn"=>"zoomIn","zoomInDown"=>"zoomInDown", "zoomInLeft"=>"zoomInLeft","zoomInRight"=>"zoomInRight","zoomInUp"=>"zoomInUp","zoomOut"=>"zoomOut", "zoomOutLeft"=>"zoomOutLeft", "zoomOutRight"=>"zoomOutRight","zoomOutUp"=>"zoomOutUp"),
         "description" => __(" Animation.", "unik")
      ),
		
		array(
		 "type" => "textfield",
		  "class" => "",
		  "heading" => __("Title", "unik"),
		  "param_name" => "title"
		 ),
		
		array(
		 "type" => "textfield",
		  "class" => "",
		  "heading" => __("Price", "unik"),
		  "param_name" => "price"
		 ),
		
		
		array(
         "type" => "textfield",
         "class" => "",
         "heading" => __("Button Text", "unik"),
         "param_name" => "submitcaption",
         "description" => __(" Write button text.", "unik")
      ),
		array(
         "type" => "textfield",    
         "class" => "",
         "heading" => __("Button Link", "unik"),
         "param_name" => "submiturl",
         "description" => __(" Link to.", "unik")
      ), 
        array(
         "type" => "textfield",
         "class" => "",
         "heading" => __("Extra class", "unik"),
         "param_name" => "class"
      ),
   ),
	"js_view" => 'VcColumnView'
) );
/**********************************************************/
vc_map( array(
	'name' => __( 'Pricing Column', 'unik' ),
	'base' => 'av_column',
	"icon" => "icon-wpb-ui-accordion",
	"as_child" => array('only' => 'av_pricing'),
	'content_element' => true,
	'params' => array(
		array(
		 "type" => "textfield",
		 "holder"=>"div",
		  "heading" => __("Column Content", "unik"),
		  "param_name" => "content"
		 ),		
		)
	))
?>