
­­­­­­­­­­­­­­­­­­
<!DOCTYPE html>
<html>
<?php
/**
 * Custom styling for footer & body rows
 *
 */		
 
// Custom button classes
add_filter( 'go_pricing_front_body_button_classes_yet', 'yet_button_classes', 10, 2 );
add_filter( 'go_pricing_front_footer_button_classes_yet', 'yet_button_classes', 10, 2 );

function yet_button_classes( $classes, $data ) {
	
	$col_index = !empty( $data['col_index'] ) ? $data['col_index'] : 0;
	$row_index = !empty( $data['row_index'] ) ? $data['row_index'] : 0;	
	$row_data = !empty( $data['row_data'] ) ? $data['row_data'] : '';
	$button_data = !empty( $row_data['button'] ) ? $row_data['button'] : '';
	if ( empty( $classes ) || !is_array( $classes ) ) $classes = array();
	
	if ( !empty( $button_data['fullwidth'] ) ) $classes[] = 'gw-go-btn-fullwidth';
	if ( !empty( $button_data['style'] ) ) $classes[] = sprintf( 'gw-go-btn-%s', $button_data['style'] );
	if ( !empty( $button_data['animation'] ) ) $classes[] = sprintf( 'gw-go-btn-%s', $button_data['animation'] );		
	
	return $classes;
	
}

/* Custom row styles */
add_filter( 'go_pricing_front_body_row_styles_yet', 'yet_body_row_styles', 10, 3 );
add_filter( 'go_pricing_front_footer_row_styles_yet', 'yet_body_row_styles', 10, 3 );

function yet_body_row_styles( $css, $data, $footer = false ) {
	
	$row_css = array();
	$col_index = !empty( $data['col_index'] ) ? $data['col_index'] : 0;
	$row_index = !empty( $data['row_index'] ) ? $data['row_index'] : 0;	
	$row_data = !empty( $data['row_data'] ) ? $data['row_data'] : array();	
	
	$selector = $footer === false ? sprintf( '.gw-go-body li[data-row-index="%s"]', $row_index ) : sprintf( '.gw-go-footer-row[data-row-index="%s"]', $row_index );

	// Padding
	if ( !empty( $row_data['padding'] ) ) {
		foreach ( $row_data['padding'] as $key => $radius ) {
			if ( (int)$radius != 0 ) { $row_data['padding'][$key] = $row_data['padding'][$key].'px'; }
		}
		$row_css['normal'][] = sprintf( 'padding:%s !important', implode( ' ', $row_data['padding'] ) );
	}
	
	// BG color
	if ( !empty( $row_data['bg-color'] ) ) $row_css['normal'][] = sprintf( 'background-color:%s', $row_data['bg-color'] );
	if ( !empty( $row_data['bg-color-hover'] ) ) $row_css['hover'][] = sprintf( 'background-color:%s', $row_data['bg-color-hover'] );		
	
	// Row border
	if ( !empty( $row_data['border'] ) && !empty( $row_data['border']['color'] ) && !empty( $row_data['border']['width'] ) && !empty( $row_data['border']['style'] ) ) {
		
		if ( $row_data['border']['style'] != 'none' ) {
			
			// Normal
			$row_css['normal_after'][] = sprintf( 'border-bottom:%1$s %2$s %3$s !important', 
				$row_data['border']['style'],
				(int)$row_data['border']['width'] . 'px',
				$row_data['border']['color']
			);
			
			if ( isset( $row_data['border']['margin']['left'] ) ) $row_css['normal_after'][] = sprintf( 'left:%s', (int)$row_data['border']['margin']['left'] . 'px' );
			if ( isset( $row_data['border']['margin']['right'] ) ) $row_css['normal_after'][] = sprintf( 'right:%s', (int)$row_data['border']['margin']['right'] . 'px' );

			// Hover
			if ( $row_data['border']['color-hover'] ) $row_css['hover_after'][] = sprintf( 'border-bottom-color:%s !important', $row_data['border']['color-hover'] );
							
		}

	}	
	
	
	// HTML row
	if ( !empty( $row_data['type'] ) && $row_data['type'] == 'html' ) {
		
		$row_html_data = !empty( $row_data['html'] )  ? $row_data['html']  : array() ;
		
		// Normal
		if ( !empty( $row_html_data['color'] ) ) $row_css['normal'][] = sprintf( 'color:%s', $row_html_data['color'] );
					
		// Hover 
		if ( !empty( $row_html_data['color-hover'] ) ) $row_css['hover'][] = sprintf( 'color:%s', $row_html_data['color-hover'] );		
	

	
	}
	
	// Button row
	if ( !empty( $row_data['type'] ) && $row_data['type'] == 'button' ) {
		
		$button_data = !empty( $row_data['button'] )  ? $row_data['button']  : array();

		// Border radius /* ide */
		if ( isset( $button_data['border-radius'] ) ) {
			$border_radius = (int)$button_data['border-radius'];
			if ( !empty( $border_radius ) ) {
				$row_css['button'][] = sprintf( 'border-radius:%spx', (int)$button_data['border-radius'] );
				if (  isset( $button_data['animation'] ) && $button_data['animation'] == 'fade' && !empty( $button_data['bg-color'] ) ) {
					if( $border_radius <= 10 ) $row_css['button_before'][] = sprintf( 'border-radius:%spx', $border_radius - 5 );
					if( $border_radius > 10 ) $row_css['button_before'][] = sprintf( 'border-radius:%spx', $border_radius - 10 );
				}
			}
		}

		// Normal
		if ( isset( $button_data['style'] ) && ( $button_data['style'] == 'fill-out' || $button_data['style'] == 'out-fill' ) && 
			!empty( $button_data['bg-color'] ) ) $row_css['button_before'][] = sprintf( 'background-color:%s', $button_data['bg-color'] );
		if ( isset( $button_data['style'] ) && $button_data['style'] == 'fill-out' && 
			isset( $button_data['animation'] ) && ( $button_data['animation'] == 'slide-ov' || $button_data['animation'] == 'slide-oh' ) && 
			!empty( $button_data['bg-color'] ) ) $row_css['button_after'][] = sprintf( 'background-color:%s', $button_data['bg-color'] );
		if ( isset( $button_data['style'] ) && $button_data['style'] == 'out-fill' && 
			isset( $button_data['animation'] ) && ( $button_data['animation'] == 'slide-iv' || $button_data['animation'] == 'slide-ih' ) && 
			!empty( $button_data['bg-color'] ) ) $row_css['button_after'][] = sprintf( 'background-color:%s', $button_data['bg-color'] );					
		if ( isset( $button_data['style'] ) && $button_data['style'] == 'fill-out' ) {
			if ( !empty( $button_data['color'] ) ) $row_css['button'][] = sprintf( 'color:%s', $button_data['color'] );	
			if ( !empty( $button_data['color2'] ) ) $row_css['button_hover'][] = sprintf( 'color:%s', $button_data['color2'] );				
		}
		if ( isset( $button_data['style'] ) && $button_data['style'] == 'out-fill' ) {
			if ( !empty( $button_data['color2'] ) ) $row_css['button'][] = sprintf( 'color:%s', $button_data['color2'] );	
			if ( !empty( $button_data['color'] ) ) $row_css['button_hover'][] = sprintf( 'color:%s', $button_data['color'] );				
		}
		if ( !empty( $button_data['border-color'] ) ) $row_css['button'][] = sprintf( 'border-color:%s', $button_data['border-color'] );
		
		// Hover
		if ( isset( $button_data['style'] ) && ( $button_data['style'] == 'fill-out' || $button_data['style'] == 'out-fill' ) && 
			!empty( $button_data['bg-color-hover'] ) ) $row_css['button_before-hover'][] = sprintf( 'background-color:%s', $button_data['bg-color-hover'] );	
		if ( isset( $button_data['style'] ) && $button_data['style'] == 'fill-out' && 
			isset( $button_data['animation'] ) && ( $button_data['animation'] == 'slide-ov' || $button_data['animation'] == 'slide-oh' ) && 			
			!empty( $button_data['bg-color-hover'] ) ) $row_css['button_after-hover'][] = sprintf( 'background-color:%s', $button_data['bg-color-hover'] );			
		if ( isset( $button_data['style'] ) && $button_data['style'] == 'out-fill' && 
			isset( $button_data['animation'] ) && ( $button_data['animation'] == 'slide-iv' || $button_data['animation'] == 'slide-ih' ) && 			
			!empty( $button_data['bg-color-hover'] ) ) $row_css['button_after-hover'][] = sprintf( 'background-color:%s', $button_data['bg-color-hover'] );
			
		if ( isset( $button_data['style'] ) && $button_data['style'] == 'fill-out' ) {
			if ( !empty( $button_data['color-hover'] ) ) $row_css['button-hover'][] = sprintf( 'color:%s', $button_data['color-hover'] );	
			if ( !empty( $button_data['color2-hover'] ) ) $row_css['button_hover-hover'][] = sprintf( 'color:%s', $button_data['color2-hover'] );				
		}
		if ( isset( $button_data['style'] ) && $button_data['style'] == 'out-fill' ) {
			if ( !empty( $button_data['color2-hover'] ) ) $row_css['button-hover'][] = sprintf( 'color:%s', $button_data['color2-hover'] );	
			if ( !empty( $button_data['color-hover'] ) ) $row_css['button_hover-hover'][] = sprintf( 'color:%s', $button_data['color-hover'] );				
		}
		if ( !empty( $button_data['border-color'] ) ) $row_css['button'][] = sprintf( 'border-color:%s', $button_data['border-color'] );

		if ( !empty( $button_data['border-color-hover'] ) ) $row_css['button-hover'][] = sprintf( 'border-color:%s', $button_data['border-color-hover'] );
			
	}
	
	// Normal row styles
	if ( !empty( $row_css['normal'] ) ) $css[] = sprintf( '.gw-go-col-wrap-%1$s %2$s { %3$s; }', 
		$col_index,
		$selector,
		!empty( $row_css['normal'] ) ? implode( '; ', $row_css['normal'] ) : ''
	);	
	
	// Hover row styles
	if ( !empty( $row_css['hover'] ) ) $css[] = sprintf( '.gw-go-hover.gw-go-col-wrap-%1$s %2$s { %3$s; }', 
		$col_index,
		$selector,
		!empty( $row_css['hover'] ) ? implode( '; ', $row_css['hover'] ) : ''
	);		

	// Normal row after styles
	if ( !empty( $row_css['normal_after'] ) ) $css[] = sprintf( '.gw-go-col-wrap-%1$s %2$s:after { %3$s; }', 
		$col_index,
		$selector,
		!empty( $row_css['normal_after'] ) ? implode( '; ', $row_css['normal_after'] ) : ''
	);
	
	// Hover row after styles
	if ( !empty( $row_css['hover_after'] ) ) $css[] = sprintf( '.gw-go-hover.gw-go-col-wrap-%1$s %2$s:after { %3$s; }', 
		$col_index,
		$selector,
		!empty( $row_css['hover_after'] ) ? implode( '; ', $row_css['hover_after'] ) : ''
	);
	
	// Column Idle & Button Idle
	if ( !empty( $row_css['button'] ) ) $css[] = sprintf( '.gw-go-col-wrap-%1$s %2$s .gw-go-btn { %3$s; }', 
		$col_index,
		$selector,
		!empty( $row_css['button'] ) ? implode( '; ', $row_css['button'] ) : ''
	);
	if ( !empty( $row_css['button_hover'] ) ) $css[] = sprintf( '.gw-go-col-wrap-%1$s %2$s .gw-go-btn:hover { %3$s; }', 
		$col_index,
		$selector,
		!empty( $row_css['button_hover'] ) ? implode( '; ', $row_css['button_hover'] ) : ''
	);	
	if ( !empty( $row_css['button_before'] ) ) $css[] = sprintf( '.gw-go-col-wrap-%1$s %2$s .gw-go-btn:before { %3$s; }', 
		$col_index,
		$selector,
		!empty( $row_css['button_before'] ) ? implode( '; ', $row_css['button_before'] ) : ''
	);	
	if ( !empty( $row_css['button_after'] ) ) $css[] = sprintf( '.gw-go-col-wrap-%1$s %2$s .gw-go-btn:after { %3$s; }', 
		$col_index,
		$selector,
		!empty( $row_css['button_after'] ) ? implode( '; ', $row_css['button_after'] ) : ''
	);					

	
	// Column Hover & Button Idle
	if ( !empty( $row_css['button-hover'] ) ) $css[] = sprintf( '.gw-go-hover.gw-go-col-wrap-%1$s %2$s .gw-go-btn { %3$s; }', 
		$col_index,
		$selector,
		!empty( $row_css['button-hover'] ) ? implode( '; ', $row_css['button-hover'] ) : ''
	);
	if ( !empty( $row_css['button_hover-hover'] ) ) $css[] = sprintf( '.gw-go-hover.gw-go-col-wrap-%1$s %2$s .gw-go-btn:hover { %3$s; }', 
		$col_index,
		$selector,
		!empty( $row_css['button_hover-hover'] ) ? implode( '; ', $row_css['button_hover-hover'] ) : ''
	);	
	if ( !empty( $row_css['button_before-hover'] ) ) $css[] = sprintf( '.gw-go-hover.gw-go-col-wrap-%1$s %2$s .gw-go-btn:before { %3$s; }', 
		$col_index,
		$selector,
		!empty( $row_css['button_before-hover'] ) ? implode( '; ', $row_css['button_before-hover'] ) : ''
	);
	if ( !empty( $row_css['button_after-hover'] ) ) $css[] = sprintf( '.gw-go-hover.gw-go-col-wrap-%1$s %2$s .gw-go-btn:after { %3$s; }', 
		$col_index,
		$selector,
		!empty( $row_css['button_after-hover'] ) ? implode( '; ', $row_css['button_after-hover'] ) : ''
	);	
		
	return $css;
		
}

?>