<?php

if(!function_exists('mascot_core_educacion_sc_blockquote_vc_map_modifier')) {
	/**
	 * Shortcodes vc_map modifier
	 */
	function mascot_core_educacion_sc_blockquote_vc_map_modifier( $shortcode_base ) {
		//vc_remove_param( $shortcode_base, "display_type" );
		//vc_add_param( $shortcode_base, $attributes );
		//vc_add_params( $shortcode_base, $attributes );
	}
}



if(!function_exists('mascot_core_educacion_sc_blockquote_render')) {
	/**
	 * Renders shortcodes HTML
	 */
	function mascot_core_educacion_sc_blockquote_render( $attr, $content = null ) {

		$args = array(
			'custom_css_class' => '',
			'design_style' => '',

			'text' => '',
			'footer_cite' => '',


			'text_text_color' => '',
			'text_font_size' => '',
			'text_line_height' => '',
			'text_letter_spacing' => '',
			'text_font_style' => '',
			'text_font_weight' => '',
			'text_text_transform' => '',


			'footer_cite_text_color' => '',
			'footer_cite_font_size' => '',
			'footer_cite_line_height' => '',
			'footer_cite_letter_spacing' => '',
			'footer_cite_font_style' => '',
			'footer_cite_font_weight' => '',
			'footer_cite_text_transform' => '',


			'border_left_theme_colored' => '',
			'quote_icon_theme_colored' => '',
			'footer_cite_theme_colored' => '',

			'css' => '',

		);
		$params = shortcode_atts($args, $attr);
		$params['text_inline_css'] = educacion_mascot_get_inline_css( educacion_mascot_sc_blockquote_text_css( $params ) );
		$params['footer_cite_inline_css'] = educacion_mascot_get_inline_css( educacion_mascot_sc_blockquote_footer_cite_css( $params ) );

		//classes
		$classes = array();
		$classes[] = 'tm-sc tm-sc-blockquote';
		$classes[] = $params['design_style'];
		$classes[] = $params['custom_css_class'];

		if($params['border_left_theme_colored'] !== ''){
			$classes[] = 'border-left-theme-colored';
		}
		if($params['quote_icon_theme_colored'] !== ''){
			$classes[] = 'quote-icon-theme-colored';
		}
		if($params['footer_cite_theme_colored'] !== ''){
			$classes[] = 'footer-cite-theme-colored';
		}

		//css
		$classes[] = apply_filters( VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, vc_shortcode_custom_css_class( $params['css'], ' ' ) );

		$params['classes'] = $classes;

		//Produce HTML version by using the parameters (filename, variation, folder name, parameters, shortcode_ob_start)
		$html = educacion_mascot_get_shortcode_template_part( 'blockquote', null, 'blockquote/tpl', $params, true );
		
		return $html;
	}
}


if(!function_exists('educacion_mascot_sc_blockquote_text_css')) {
	/**
	 * Get Text Styles
	 */
	function educacion_mascot_sc_blockquote_text_css( $params ) {
		$css_array = array();

		if( $params['text_text_color'] != '' ) {
			$css_array[] = 'color: '.$params['text_text_color'];
		}
		if( $params['text_font_size'] != '' ) {
			$font_size = $params['text_font_size'];
			$css_array[] = 'font-size: '.educacion_mascot_if_numeric_add_suffix($font_size, 'px');
		}
		if( $params['text_line_height'] != '' ) {
			$font_size = $params['text_line_height'];
			$css_array[] = 'line-height: '.$font_size;
		}
		if( $params['text_letter_spacing'] != '' ) {
			$font_size = $params['text_letter_spacing'];
			$css_array[] = 'letter-spacing: '.$font_size;
		}
		if( $params['text_font_style'] != '' ) {
			$css_array[] = 'font-style: '.$params['text_font_style'];
		}
		if( $params['text_font_weight'] != '' ) {
			$css_array[] = 'font-weight: '.$params['text_font_weight'];
		}
		if( $params['text_text_transform'] != '' ) {
			$css_array[] = 'text-transform: '.$params['text_text_transform'];
		}

		return implode( '; ', $css_array );
	}
}


if(!function_exists('educacion_mascot_sc_blockquote_footer_cite_css')) {
	/**
	 * Get Footer Cite Styles
	 */
	function educacion_mascot_sc_blockquote_footer_cite_css( $params ) {
		$css_array = array();

		if( $params['footer_cite_text_color'] != '' ) {
			$css_array[] = 'color: '.$params['footer_cite_text_color'];
		}
		if( $params['footer_cite_font_size'] != '' ) {
			$font_size = $params['footer_cite_font_size'];
			$css_array[] = 'font-size: '.educacion_mascot_if_numeric_add_suffix($font_size, 'px');
		}
		if( $params['footer_cite_line_height'] != '' ) {
			$font_size = $params['footer_cite_line_height'];
			$css_array[] = 'line-height: '.$font_size;
		}
		if( $params['footer_cite_letter_spacing'] != '' ) {
			$font_size = $params['footer_cite_letter_spacing'];
			$css_array[] = 'letter-spacing: '.$font_size;
		}
		if( $params['footer_cite_font_style'] != '' ) {
			$css_array[] = 'font-style: '.$params['footer_cite_font_style'];
		}
		if( $params['footer_cite_font_weight'] != '' ) {
			$css_array[] = 'font-weight: '.$params['footer_cite_font_weight'];
		}
		if( $params['footer_cite_text_transform'] != '' ) {
			$css_array[] = 'text-transform: '.$params['footer_cite_text_transform'];
		}

		return implode( '; ', $css_array );
	}
}