<?php

class Intense_Testimony extends Intense_Shortcode {

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

        global $intense_visions_options;

        $this->title = __( 'Testimony', 'intense' );
        $this->category = __( 'Layout', 'intense' );
        $this->show_preview = true;       
        $this->hidden = true;
        $this->parent = 'intense_testimonies';
        $this->vc_map_content = 'textarea';        
    }

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

        // deprecated method
        if ( !isset( $author ) && !isset( $company ) ) {
            return "<div class='testimony'>" . do_shortcode( $content ) . "</div>";
        } else {   
            global $intense_testimonies;

            if ( !empty( $atts['link'] ) && is_numeric( $atts['link'] ) ) {
                $atts['link'] = get_permalink( $atts['link'] );
            }           

            if ( empty( $atts['link_target'] ) ) $atts['link_target']  = '_blank';            

            $intense_testimonies[] = array_merge( array( 'content' => $content ), is_array( $atts ) ? $atts : array() );

            return '';
        }
    }
}