<?php

class Intense_Slide extends Intense_Shortcode {

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

        global $intense_visions_options;

        $this->title = __( 'Slide', 'intense' );
        $this->category = __( 'Elements', 'intense' );
        $this->show_preview = true;       
        $this->hidden = true;
        $this->parent = 'intense_slider';
        $this->is_container = true;        
    }

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

        global $intense_slider_type;

        $wrapper_start = "";
        $wrapper_end = "";

        switch ( $intense_slider_type ) {
            case 'owl-carousel':
                $wrapper_start = "<div>";
                $wrapper_end = "</div>";
                break;
            case 'flexslider':
                $wrapper_start = "<li>";
                $wrapper_end = "</li>";
                break;
            case 'basic':
                $wrapper_start = "<li>";
                $wrapper_end = "</li>";
                break;
            default:
                break;
        }

        if ( is_numeric( $link ) ) {
            $link = get_permalink( $link );
        }

        return $wrapper_start
            . ( isset( $link ) > 0 ? "<a href='$link'>" : "" )
            . do_shortcode( $content )
            . ( isset( $title )  ? "<p class='flex-caption'>$title</p>" : "" )
            . ( isset( $link ) ? "</a>" : "" ) . $wrapper_end;
    }
}
