<?php

class Intense_Dropcap extends Intense_Shortcode {

	function __construct() {
        parent::__construct();

		global $intense_visions_options;

		$this->title = __( 'Dropcap', 'intense' );
		$this->description = __( 'Using the dropcap shortcode you can add extra style to your paragraphs. With the dropcap, the initial character runs several lines deep into the paragraph text.', 'intense' );
		$this->category = __( 'Typography', 'intense' );
		$this->show_preview = true;
		$this->preview_content = __( "D", 'intense' );
		$this->vc_map_content = 'textfield';
	}

	function shortcode( $atts, $content = null ) {
		extract( shortcode_atts( $this->get_shortcode_defaults( null, $atts ), $atts ) );

		$background_color = "";
		$color = intense_get_plugin_color( $color );
        $id = ( !empty ( $id ) ) ? ' id="' . $id . '"' : '';

		if ( !empty( $color ) ) {
			$background_color = "background: " . $color . ";";
		}

		$font_color = intense_get_plugin_color( $font_color );

		if ( $font_color == '' && $color != '' ) {
            $font_color = intense_get_contract_color( $color );
        }

		if ( $font_color == '' ) {
			$style = "";
		} else {
			$style = "color: " . $font_color . ";";
		}

		return "<span" . $id . " class='intense dropcap" . ( !empty( $class ) ? ' ' . $class : '' ) . ( is_rtl() ? " rtl" : "" ) . "' style='$background_color $style'>" . do_shortcode( $content ) . "</span>";
	}
}
