<?php

///////////////////////////////////////////////////////////////////////////////////////////
/////// register shortcodes
///////////////////////////////////////////////////////////////////////////////////////////

function wpestate_shortcodes(){
    wpestate_register_shortcodes();
    wpestate_tiny_short_codes_register();
    add_filter('widget_text', 'do_shortcode');
}

///////////////////////////////////////////////////////////////////////////////////////////
// register tiny plugins functions
///////////////////////////////////////////////////////////////////////////////////////////

function wpestate_tiny_short_codes_register() {
    if (!current_user_can('edit_posts') && !current_user_can('edit_pages')) {
        return;
    }
    
    if (get_user_option('rich_editing') == 'true') {
        add_filter('mce_external_plugins', 'wpestate_add_plugin');
        add_filter('mce_buttons_3', 'wpestate_register_button');    
    }

}

/////////////////////////////////////////////////////////////////////////////////////////
/////// push the code into Tiny buttons array
///////////////////////////////////////////////////////////////////////////////////////////

function wpestate_register_button($buttons) {
    array_push($buttons, "|", "slider_recent_items");     
    array_push($buttons, "|", "testimonials");
    array_push($buttons, "|", "testimonial_slider");
    array_push($buttons, "|", "recent_items");  
    array_push($buttons, "|", "featured_agent"); 
    array_push($buttons, "|", "featured_article");
    array_push($buttons, "|", "featured_property");
    array_push($buttons, "|", "list_items_by_id"); 
    array_push($buttons, "|", "login_form"); 
    array_push($buttons, "|", "register_form");
    array_push($buttons, "|", "advanced_search");
    array_push($buttons, "|", "font_awesome");
    array_push($buttons, "|", "spacer"); 
    array_push($buttons, "|", "icon_container");
    array_push($buttons, "|", "list_agents");
    array_push($buttons, "|", "places_list");
    array_push($buttons, "|", "listings_per_agent");
    array_push($buttons, "|", "property_page_map");
   
    return $buttons;
}



///////////////////////////////////////////////////////////////////////////////////////////
/////// poins to the right js 
///////////////////////////////////////////////////////////////////////////////////////////

function wpestate_add_plugin($plugin_array) {   
    $plugin_array['slider_recent_items']        = get_template_directory_uri() . '/js/shortcodes.js';
    $plugin_array['testimonials']               = get_template_directory_uri() . '/js/shortcodes.js';
    $plugin_array['testimonial_slider']         = get_template_directory_uri() . '/js/shortcodes.js';
    $plugin_array['recent_items']               = get_template_directory_uri() . '/js/shortcodes.js';
    $plugin_array['featured_agent']             = get_template_directory_uri() . '/js/shortcodes.js';
    $plugin_array['featured_article']           = get_template_directory_uri() . '/js/shortcodes.js';
    $plugin_array['featured_property']          = get_template_directory_uri() . '/js/shortcodes.js';
    $plugin_array['login_form']                 = get_template_directory_uri() . '/js/shortcodes.js';
    $plugin_array['register_form']              = get_template_directory_uri() . '/js/shortcodes.js';
    $plugin_array['list_items_by_id']           = get_template_directory_uri() . '/js/shortcodes.js';
    $plugin_array['advanced_search']            = get_template_directory_uri() . '/js/shortcodes.js';
    $plugin_array['font_awesome']               = get_template_directory_uri() . '/js/shortcodes.js';
    $plugin_array['spacer']                     = get_template_directory_uri() . '/js/shortcodes.js';
    $plugin_array['icon_container']             = get_template_directory_uri() . '/js/shortcodes.js';
    $plugin_array['list_agents']                = get_template_directory_uri() . '/js/shortcodes.js';
    $plugin_array['places_list']                = get_template_directory_uri() . '/js/shortcodes.js';
    $plugin_array['listings_per_agent']         = get_template_directory_uri() . '/js/shortcodes.js';
    $plugin_array['property_page_map']          = get_template_directory_uri() . '/js/shortcodes.js';

    return $plugin_array;
}

///////////////////////////////////////////////////////////////////////////////////////////
/////// register shortcodes
///////////////////////////////////////////////////////////////////////////////////////////


function wpestate_register_shortcodes() {
    add_shortcode('slider_recent_items', 'wpestate_slider_recent_posts_pictures');      
    add_shortcode('spacer', 'wpestate_spacer_shortcode_function');
    add_shortcode('recent-posts', 'wpestate_recent_posts_function');
    add_shortcode('testimonial', 'wpestate_testimonial_function');
    add_shortcode('testimonial_slider', 'wpestate_testimonial_slider_function');
    add_shortcode('recent_items', 'wpestate_recent_posts_pictures');
    add_shortcode('featured_agent', 'wpestate_featured_agent');
    add_shortcode('featured_article', 'wpestate_featured_article');
    add_shortcode('featured_property', 'wpestate_featured_property');
    add_shortcode('login_form', 'wpestate_login_form_function');
    add_shortcode('register_form', 'wpestate_register_form_function');
    add_shortcode('list_items_by_id', 'wpestate_list_items_by_id_function');
    add_shortcode('advanced_search', 'wpestate_advanced_search_function');
    add_shortcode('font_awesome', 'wpestate_font_awesome_function');
    add_shortcode('icon_container', 'wpestate_icon_container_function');
    add_shortcode('list_agents','wpestate_list_agents_function');
    add_shortcode('places_list', 'wpestate_places_list_function');
    add_shortcode('listings_per_agent', 'wpestate_wplistingsperagent_shortcode_function' );
    add_shortcode('property_page_map', 'wpestate_property_page_map_function' );
  
}



////////////////////////////////////////////////////////////////////////////////
// add shortcodes to visual composer
////////////////////////////////////////////////////////////////////////////////




if( function_exists('vc_map') ):
    

    
    vc_map(
    array(
        "name" => esc_html__("Google Map with Property Marker","wpestate"),//done
        "base" => "property_page_map",
        "class" => "",
        "category" => esc_html__('Content','wpestatetheme-core'),
        'admin_enqueue_js' => array(get_template_directory_uri().'/vc_extend/bartag.js'),
        'admin_enqueue_css' => array(get_template_directory_uri().'/vc_extend/bartag.css'),
        'weight'=>100,
        'icon'   =>'wpestate_vc_logo',
        'description'=>esc_html__('Google Map with Property Marker','wpestatetheme-core'),

        "params" => array(

            array(
                "type" => "textfield",
                "holder" => "div",
                "class" => "",
                "heading" => esc_html__("Property ID","wpestate"),
                "param_name" => "propertyid",
                "value" => "",
                "description" => esc_html__("The Id of the property you want to show","wpestate")
            ),

        ) 

       )

    );




vc_map(
    array(
        "name" => esc_html__("Listings per agent","wpestate"),//done
        "base" => "listings_per_agent",
        "class" => "",
        "category" => esc_html__('Content','wpestatetheme-core'),
        'admin_enqueue_js' => array(get_template_directory_uri().'/vc_extend/bartag.js'),
        'admin_enqueue_css' => array(get_template_directory_uri().'/vc_extend/bartag.css'),
        'weight'=>100,
        'icon'   =>'wpestate_vc_logo',
        'description'=>esc_html__('Listings per agent','wpestatetheme-core'),

        "params" => array(

           array(
                "type" => "textfield",
                "holder" => "div",
                "class" => "",
                "heading" => esc_html__("Agent ID","wpestate"),
                "param_name" => "agentid",
                "value" => "",
                "description" => esc_html__("Agent ID to show the listings of a particular agent","wpestate")
            ),

         

            array(
                "type" => "textfield",
                "holder" => "div",
                "class" => "",
                "heading" => esc_html__("Number of Listings","wpestate"),
                "param_name" => "nooflisting",
                "value" => "",
                 "description" => esc_html__("Number of Listings to display","wpestate")

            ),

        ) 

       )
     );
    


  
     $list_cities_or_areas=array(1,2);
     vc_map( array(
        "name" => esc_html__( "List Cities or Areas","wpestate"),//done
        "base" => "places_list",
        "class" => "",
        "category" => esc_html__( 'Content','wpestatetheme-core'),
        'admin_enqueue_js' => array(get_template_directory_uri().'/vc_extend/bartag.js'),
        'admin_enqueue_css' => array(get_template_directory_uri().'/vc_extend/bartag.css'),
        'weight'=>100,
        'icon'   =>'wpestate_vc_logo',
        'description'=>esc_html__( 'List Cities or Areas','wpestatetheme-core'),  
        "params" => array(
            array(
                "type" => "textfield",
                "holder" => "div",
                "class" => "",
                "heading" => esc_html__( "Cities or Areas IDs, separated by comma","wpestate"),
                "param_name" => "place_list",
                "value" => "",
                "description" => esc_html__( "Cities or Areas IDs, separated by comma","wpestate")
            )  ,
            array(
                "type" => "textfield",
                "holder" => "div",
                "class" => "",
                "heading" => esc_html__( "Places per row","wpestate"),
                "param_name" => "place_per_row",
                "value" => "4",
                "description" => esc_html__( "How many items listed per row? For type 2 use only 1.","wpestate")
            ),
            array(
                "type" => "dropdown",
                "holder" => "div",
                "class" => "",
                "heading" => esc_html__( "Type","wpestate"),
                "param_name" => "place_type",
                "value" => $list_cities_or_areas,
                "description" => esc_html__( "Select Item Type 1/2?","wpestate")
            ),
            
            array(
                "type" => "textfield",
                "holder" => "div",
                "class" => "",
                "heading" => esc_html__( "Extra Class Name","wpestate"),
                "param_name" => "extra_class_name",
                "value" => "",
                "description" => esc_html__( "Extra Class Name","wpestate")
            )
        )    
    ) 
    );    
    $random_pick=array('no','yes');
    vc_map(
    array(
       "name" => esc_html__("List Agents","wpestate"),//done
       "base" => "list_agents",
       "class" => "",
       "category" => esc_html__('Content','wpestatetheme-core'),
       'admin_enqueue_js' => array(get_template_directory_uri().'/vc_extend/bartag.js'),
       'admin_enqueue_css' => array(get_template_directory_uri().'/vc_extend/bartag.css'),
       'weight'=>100,
       'icon'   =>'wpestate_vc_logo',
       'description'=>esc_html__('Agent Lists','wpestatetheme-core'),
       "params" => array(
           array(
             "type" => "textfield",
             "holder" => "div",
             "class" => "",
             "heading" => esc_html__("Title","wpestate"),
             "param_name" => "title",
             "value" => "",
             "description" => esc_html__("Section Title","wpestate")
          ),
         
           array(
             "type" => "textfield",
             "holder" => "div",
             "class" => "",
             "heading" => esc_html__("Category Id's","wpestate"),
             "param_name" => "category_ids",
             "value" => "",
             "description" => esc_html__("list of agent category id's sepearated by comma","wpestate")
          ),
             array(
             "type" => "textfield",
             "holder" => "div",
             "class" => "",
             "heading" => esc_html__("Action Id's","wpestate"),
             "param_name" => "action_ids",
             "value" => "",
             "description" => esc_html__("list of agent action ids separated by comma ","wpestate")
          ), 
           array(
             "type" => "textfield",
             "holder" => "div",
             "class" => "",
             "heading" => esc_html__("City Id's ","wpestate"),
             "param_name" => "city_ids",
             "value" => "",
             "description" => esc_html__("list of agent city ids separated by comma","wpestate")
          ),
            array(
             "type" => "textfield",
             "holder" => "div",
             "class" => "",
             "heading" => esc_html__("Area Id's","wpestate"),
             "param_name" => "area_ids",
             "value" => "",
             "description" => esc_html__("list of agent area ids separated by comma ","wpestate")
          ),
           array(
             "type" => "textfield",
             "holder" => "div",
             "class" => "",
             "heading" => esc_html__("No of items","wpestate"),
             "param_name" => "number",
             "value" => 4,
             "description" => esc_html__("how many items","wpestate")
          ) , 
           array(
             "type" => "textfield",
             "holder" => "div",
             "class" => "",
             "heading" => esc_html__("No of items per row","wpestate"),
             "param_name" => "rownumber",
             "value" => 4,
             "description" => esc_html__("The number of items per row","wpestate")
          ),
           array(
             "type" => "textfield",
             "holder" => "div",
             "class" => "",
             "heading" => esc_html__("Link to global listing","wpestate"),
             "param_name" => "link",
             "value" => "",
             "description" => esc_html__("link to global listing","wpestate")
          ) ,array(
             "type" => "dropdown",
             "holder" => "div",
             "class" => "",
             "heading" => esc_html__("Random Pick (yes/no) ","wpestate"),
             "param_name" => "random_pick",
             "value" => $random_pick,
             "description" => esc_html__("Choose if agents should display randomly on page refresh. ","wpestate")
          ) 
       )
    )
    );
    $featured_listings=array('no','yes');
    $items_type=array('properties','articles');
    $slider_type=array("1","2");
    vc_map(
    array(
        "name" => esc_html__("Recent Items Slider","wpestate"),//done
        "base" => "slider_recent_items",
        "class" => "",
        "category" => esc_html__('Content','wpestatetheme-core'),
        'admin_enqueue_js' => array(get_template_directory_uri().'/vc_extend/bartag.js'),
        'admin_enqueue_css' => array(get_template_directory_uri().'/vc_extend/bartag.css'),
        'weight'=>100,
        'icon'   =>'wpestate_vc_logo',
        'description'=>esc_html__('Recent Items Slider Shortcode','wpestatetheme-core'),
        "params" => array(
            array(
                "type" => "textfield",
                "holder" => "div",
                "class" => "",
                "heading" => esc_html__("Title","wpestate"),
                "param_name" => "title",
                "value" => "",
                "description" => esc_html__("Section Title","wpestate")
           ),
            array(
                "type" => "dropdown",
                "holder" => "div",
                "class" => "",
                "heading" => esc_html__("What type of items","wpestate"),
                "param_name" => "type",
                "value" => $items_type,
                "description" => esc_html__("list properties or articles","wpestate")
            ),
            array(
                "type" => "textfield",
                "holder" => "div",
                "class" => "",
                "heading" => esc_html__("Category Id's","wpestate"),
                "param_name" => "category_ids",
                "value" => "",
                "description" => esc_html__("list of category id's sepearated by comma (*only for properties)","wpestate")
            ),
            array(
                "type" => "textfield",
                "holder" => "div",
                "class" => "",
                "heading" => esc_html__("Action Id's","wpestate"),
                "param_name" => "action_ids",
                "value" => "",
                "description" => esc_html__("list of action ids separated by comma (*only for properties)","wpestate")
            ), 
            array(
                "type" => "textfield",
                "holder" => "div",
                "class" => "",
                "heading" => esc_html__("City Id's ","wpestate"),
                "param_name" => "city_ids",
                "value" => "",
                "description" => esc_html__("list of city ids separated by comma (*only for properties)","wpestate")
            ),
            array(
               "type" => "textfield",
               "holder" => "div",
               "class" => "",
               "heading" => esc_html__("Area Id's","wpestate"),
               "param_name" => "area_ids",
               "value" => "",
               "description" => esc_html__("list of area ids separated by comma (*only for properties)","wpestate")
            ),
            array(
               "type" => "textfield",
               "holder" => "div",
               "class" => "",
               "heading" => esc_html__("County/State Id's","wpestate"),
               "param_name" => "state_ids",
               "value" => "",
               "description" => esc_html__("list of county/State ids separated by comma (*only for properties)","wpestate")
            ),
            array(
               "type" => "textfield",
               "holder" => "div",
               "class" => "",
               "heading" => esc_html__("No of items","wpestate"),
               "param_name" => "number",
               "value" => 4,
               "description" => esc_html__("how many items","wpestate")
            ), 
            
            array(
               "type" => "dropdown",
               "holder" => "div",
               "class" => "",
               "heading" => esc_html__("Show featured listings only?","wpestate"),
               "param_name" => "show_featured_only",
               "value" => $featured_listings,
               "description" => esc_html__("Show featured listings only? (yes/no)","wpestate")
            ),
            array(
               "type" => "textfield",
               "holder" => "div",
               "class" => "",
               "heading" => esc_html__("Auto scroll period","wpestate"),
               "param_name" => "autoscroll",
               "value" => "0",
               "description" => esc_html__("Auto scroll period in seconds - 0 for manual scroll, 1000 for 1 second, 2000 for 2 seconds and so on.","wpestate")
            ) 
            ,array(
                "type" => "dropdown",
                "holder" => "div",
                "class" => "",
                "heading" => esc_html__("Show Featured Listings First (yes/no)","wpestate"),
                "param_name" => "featured_first",
                "value" => $random_pick,
                "description" => esc_html__("If 'yes'  featured properties will be displayed first, and the rest by ID(adding date).If 'no' all will be order by  ID(adding date) ","wpestate")
            )
            ,array(
                "type" => "dropdown",
                "holder" => "div",
                "class"         => "",
                "heading"       => esc_html__("Slider Type","wpestate"),
                "param_name"    => "slider_type",
                "value"         => $slider_type,
                "description"   => esc_html__("Slider Type","wpestate")
            )  
        )
    )
    );







      $image_efect=array('yes','no');
      vc_map( array(
       "name" => esc_html__("Icon content box","wpestate"),//done
       "base" => "icon_container",
       "class" => "",
       "category" => esc_html__('Content','wpestatetheme-core'),
       'admin_enqueue_js' => array(get_template_directory_uri().'/vc_extend/bartag.js'),
       'admin_enqueue_css' => array(get_template_directory_uri().'/vc_extend/bartag.css'),
       'weight'=>100,
        'icon'   =>'wpestate_vc_logo',
        'description'=>esc_html__('Icon Content Box Shortcode','wpestatetheme-core'),  
       "params" => array(
          array(
             "type" => "textfield",
             "holder" => "div",
             "class" => "",
             "heading" => esc_html__("Box Title","wpestate"),
             "param_name" => "title",
             "value" => "Title",
             "description" => esc_html__("Box Title goes here","wpestate")
          ),
           array(
             "type" => "textfield",
             "holder" => "div",
             "class" => "",
             "heading" => esc_html__("Image url","wpestate"),
             "param_name" => "image",
             "value" => "",
             "description" => esc_html__("Image or Icon url","wpestate")
          ),
           array(
             "type" => "textfield",
             "holder" => "div",
             "class" => "",
             "heading" => esc_html__("Content of the box","wpestate"),
             "param_name" => "content_box",
             "value" => "Content of the box goes here",
             "description" => esc_html__("Content of the box goes here","wpestate")
          )
          ,
        
           array(
             "type" => "textfield",
             "holder" => "div",
             "class" => "",
             "heading" => esc_html__("Link","wpestate"),
             "param_name" => "link",
             "value" => "",
             "description" => esc_html__("The link with http:// in front","wpestate")
          )
          
       )
    ) );    




      vc_map(
           array(
           "name" => esc_html__("Spacer","wpestate"),
           "base" => "spacer",
           "class" => "",
           "category" => esc_html__('Content','wpestatetheme-core'),
           'admin_enqueue_js' => array(get_template_directory_uri().'/vc_extend/bartag.js'),
           'admin_enqueue_css' => array(get_template_directory_uri().'/vc_extend/bartag.css'),
           'weight'=>102,
            'icon'   =>'wpestate_vc_logo',
            'description'=>esc_html__('Spacer Shortcode','wpestatetheme-core'),
           "params" => array(
               array(
                 "type" => "textfield",
                 "holder" => "div",
                 "class" => "",
                 "heading" => esc_html__("Spacer Type","wpestate"),
                 "param_name" => "type",
                 "value" => "1",
                 "description" => esc_html__("Space Type : 1 with no middle line, 2 with middle line","wpestate")
              )   ,
               array(
                 "type" => "textfield",
                 "holder" => "div",
                 "class" => "",
                 "heading" => esc_html__("Space height","wpestate"),
                 "param_name" => "height",
                 "value" => "40",
                 "description" => esc_html__("Space height in px","wpestate")
              )   
           )
        )   
    );


    $alignment_type=array('vertical','horizontal');
    vc_map( array(
       "name" => esc_html__("List items by ID","wpestate"),//done
       "base" => "list_items_by_id",
       "class" => "",
       "category" => esc_html__('Content','wpestatetheme-core'),
       'admin_enqueue_js' => array(get_template_directory_uri().'/vc_extend/bartag.js'),
       'admin_enqueue_css' => array(get_template_directory_uri().'/vc_extend/bartag.css'),
       'weight'=>100,
        'icon'   =>'wpestate_vc_logo',
        'description'=>esc_html__('List Items by ID Shortcode','wpestatetheme-core'),
       "params" => array(
            array(
             "type" => "textfield",
             "holder" => "div",
             "class" => "",
             "heading" => esc_html__("Title","wpestate"),
             "param_name" => "title",
             "value" => "",
             "description" => esc_html__("Section Title","wpestate")
          ),
          array(
             "type" => "dropdown",
             "holder" => "div",
             "class" => "",
             "heading" => esc_html__("What type of items","wpestate"),
             "param_name" => "type",
             "value" => $items_type,
             "description" => esc_html__("List properties or articles","wpestate")
          ),
           array(
             "type" => "textfield",
             "holder" => "div",
             "class" => "",
             "heading" => esc_html__("Items IDs","wpestate"),
             "param_name" => "ids",
             "value" => "",
             "description" => esc_html__("List of IDs separated by comma","wpestate")
          ),
           array(
             "type" => "textfield",
             "holder" => "div",
             "class" => "",
             "heading" => esc_html__("No of items","wpestate"),
             "param_name" => "number",
             "value" => "3",
             "description" => esc_html__("How many items do you want to show ?","wpestate")
          ) ,
            
           array(
             "type" => "textfield",
             "holder" => "div",
             "class" => "",
             "heading" => esc_html__("No of items per row","wpestate"),
             "param_name" => "rownumber",
             "value" => 4,
             "description" => esc_html__("The number of items per row","wpestate")
          ) , 
           array(
             "type" => "dropdown",
             "holder" => "div",
             "class" => "",
             "heading" => esc_html__("Vertical or horizontal ?","wpestate"),
             "param_name" => "align",
             "value" => $alignment_type,
             "description" => esc_html__("What type of alignment (vertical or horizontal) ?","wpestate")
          ),
           array(
             "type" => "textfield",
             "holder" => "div",
             "class" => "",
             "heading" => esc_html__("Link to global listing","wpestate"),
             "param_name" => "link",
             "value" => "#",
             "description" => esc_html__("link to global listing with http","wpestate")
          )
       )
    ) );    

   
    $testimonials_type=array(1,2,3);
    vc_map(
        array(
            'name'              =>  esc_html__("Testimonial",'wpestatetheme-core'),
            'base'              =>  "testimonial",
            'class'             =>  "",
            'category'          =>  esc_html__('Content','wpestatetheme-core'),
            'admin_enqueue_js'  =>  array(get_template_directory_uri().'/vc_extend/bartag.js'),
            'admin_enqueue_css' =>  array(get_template_directory_uri().'/vc_extend/bartag.css'),
            'weight'            =>  102,
            'icon'              =>  'wpestate_vc_logo',
            'description'       =>  esc_html__('Testiomonial Shortcode','wpestatetheme-core'),
            'params'            =>  array(
                array(
                    "type" => "textfield",
                    "holder" => "div",
                    "class" => "",
                    "heading" => esc_html__("Client Name","wpestate"),
                    "param_name" => "client_name",
                    "value" => "Name Here",
                    "description" => esc_html__("Client name here","wpestate")
                ),
                array(
                    "type" => "textfield",
                    "holder" => "div",
                    "class" => "",
                    "heading" => esc_html__("Title Client","wpestate"),
                    "param_name" => "title_client",
                    "value" => "happy client",
                    "description" => esc_html__("title or client postion ","wpestate")
                ),
                array(
                    "type" => "textfield",
                    "holder" => "div",
                    "class" => "",
                    "heading" => esc_html__("Image","wpestate"),
                    "param_name" => "imagelinks",
                    "value" => "",
                    "description" => esc_html__("Path to client picture, (best size 120px  x 120px for type 1 and 2, 350px x 350px for type 3) ","wpestate")
                ) ,
                array(
                    "type" => "textarea",
                    "holder" => "div",
                    "class" => "",
                    "heading" => esc_html__("Testimonial Text Here.","wpestate"),
                    "param_name" => "testimonial_text",
                    "value" => "",
                    "description" => esc_html__("Testimonial Text Here. ","wpestate")
                ) ,
                 array(
                    "type" => "textfield",
                    "holder" => "div",
                    "class" => "",
                    "heading" => esc_html__("Testimonial Background Color for Type 3","wpestate"),
                    "param_name" => "testimonial_back_color",
                    "value" => "#ffffff",
                    "description" => esc_html__("Testimonial Background Color For Type 3 ","wpestate")
                ) ,
                array(
                    "type" => "dropdown",
                    "holder" => "div",
                    "class" => "",
                    "heading" => esc_html__("Testimonial Type","wpestate"),
                    "param_name" => "testimonial_type",
                    "value" => $testimonials_type,
                    "description" => esc_html__("Select 1, 2 or 3","wpestate")
                )
            )
        )   
    );
    $featured_listings=array('no','yes');
    vc_map(
    array(
       "name" => esc_html__("Recent Items","wpestate"),//done
       "base" => "recent_items",
       "class" => "",
       "category" => esc_html__('Content','wpestatetheme-core'),
       'admin_enqueue_js' => array(get_template_directory_uri().'/vc_extend/bartag.js'),
       'admin_enqueue_css' => array(get_template_directory_uri().'/vc_extend/bartag.css'),
       'weight'=>100,
       'icon'   =>'wpestate_vc_logo',
       'description'=>esc_html__('Recent Items Shortcode','wpestatetheme-core'),
       "params" => array(
           array(
             "type" => "textfield",
             "holder" => "div",
             "class" => "",
             "heading" => esc_html__("Title","wpestate"),
             "param_name" => "title",
             "value" => "",
             "description" => esc_html__("Section Title","wpestate")
          ),
          array(
             "type" => "dropdown",
             "holder" => "div",
             "class" => "",
             "heading" => esc_html__("What type of items","wpestate"),
             "param_name" => "type",
             "value" => $items_type,
             "description" => esc_html__("list properties or articles","wpestate")
          ),
           array(
             "type" => "textfield",
             "holder" => "div",
             "class" => "",
             "heading" => esc_html__("Category Id's","wpestate"),
             "param_name" => "category_ids",
             "value" => "",
             "description" => esc_html__("list of category id's sepearated by comma","wpestate")
          ),
             array(
             "type" => "textfield",
             "holder" => "div",
             "class" => "",
             "heading" => esc_html__("Action Id's","wpestate"),
             "param_name" => "action_ids",
             "value" => "",
             "description" => esc_html__("list of action ids separated by comma (*only for properties)","wpestate")
          ), 
           array(
             "type" => "textfield",
             "holder" => "div",
             "class" => "",
             "heading" => esc_html__("City Id's ","wpestate"),
             "param_name" => "city_ids",
             "value" => "",
             "description" => esc_html__("list of city ids separated by comma (*only for properties)","wpestate")
          ),
            array(
             "type" => "textfield",
             "holder" => "div",
             "class" => "",
             "heading" => esc_html__("Area Id's","wpestate"),
             "param_name" => "area_ids",
             "value" => "",
             "description" => esc_html__("list of area ids separated by comma (*only for properties)","wpestate")
          ),
            array(
               "type" => "textfield",
               "holder" => "div",
               "class" => "",
               "heading" => esc_html__("County/State Id's","wpestate"),
               "param_name" => "state_ids",
               "value" => "",
               "description" => esc_html__("list of county/State ids separated by comma (*only for properties)","wpestate")
            ),
           array(
             "type" => "textfield",
             "holder" => "div",
             "class" => "",
             "heading" => esc_html__("No of items","wpestate"),
             "param_name" => "number",
             "value" => 4,
             "description" => esc_html__("how many items","wpestate")
          ) , 
           array(
             "type" => "textfield",
             "holder" => "div",
             "class" => "",
             "heading" => esc_html__("No of items per row","wpestate"),
             "param_name" => "rownumber",
             "value" => 4,
             "description" => esc_html__("The number of items per row","wpestate")
          ) , 
           array(
             "type" => "dropdown",
             "holder" => "div",
             "class" => "",
             "heading" => esc_html__("Vertical or horizontal ?","wpestate"),
             "param_name" => "align",
             "value" => $alignment_type,
             "description" => esc_html__("What type of alignment (vertical or horizontal) ?","wpestate")
          ),
           array(
             "type" => "textfield",
             "holder" => "div",
             "class" => "",
             "heading" => esc_html__("Link to global listing","wpestate"),
             "param_name" => "link",
             "value" => "",
             "description" => esc_html__("link to global listing","wpestate")
          ),array(
             "type" => "dropdown",
             "holder" => "div",
             "class" => "",
             "heading" => esc_html__("Show featured listings only?","wpestate"),
             "param_name" => "show_featured_only",
             "value" => $featured_listings,
             "description" => esc_html__("Show featured listings only? (yes/no)","wpestate")
          ) ,array(
             "type" => "dropdown",
             "holder" => "div",
             "class" => "",
             "heading" => esc_html__("Random Pick (yes/no) ","wpestate"),
             "param_name" => "random_pick",
             "value" => $random_pick,
             "description" => esc_html__("Choose if properties should display randomly on page refresh. (*only for properties)","wpestate")
          ) ,array(
             "type" => "dropdown",
             "holder" => "div",
             "class" => "",
             "heading" => esc_html__("Show Featured Listings First (yes/no)","wpestate"),
             "param_name" => "featured_first",
             "value" => $random_pick,
             "description" => esc_html__("If 'yes'  featured properties will be displayed first, and the rest by ID(adding date).If 'no' all will be order by  ID(adding date) ","wpestate")
          ) 
       )
    )
    );

  
    
    vc_map(
    array(
       "name" => esc_html__("Featured Agent","wpestate"),
       "base" => "featured_agent",
       "class" => "",
       "category" => esc_html__('Content','wpestatetheme-core'),
       'admin_enqueue_js' => array(get_template_directory_uri().'/vc_extend/bartag.js'),
       'admin_enqueue_css' => array(get_template_directory_uri().'/vc_extend/bartag.css'),
       'weight'=>100,
       'icon'   =>'wpestate_vc_logo',
       'description'=>esc_html__('Featured Agent Shortcode','wpestatetheme-core'),
       "params" => array(
          array(
             "type" => "textfield",
             "holder" => "div",
             "class" => "",
             "heading" => esc_html__("Agent Id","wpestate"),
             "param_name" => "id",
             "value" => "0",
             "description" => esc_html__("Agent Id","wpestate")
          )
       )
    )
    );
    
    vc_map(
       array(
       "name" => esc_html__("Featured Article","wpestate"),
       "base" => "featured_article",
       "class" => "",
       "category" => esc_html__('Content','wpestatetheme-core'),
       'admin_enqueue_js' => array(get_template_directory_uri().'/vc_extend/bartag.js'),
       'admin_enqueue_css' => array(get_template_directory_uri().'/vc_extend/bartag.css'),
       'weight'=>100,
       'icon'   =>'wpestate_vc_logo',
       'description'=>esc_html__('Featured Article Shortcode','wpestatetheme-core'),
       "params" => array(
          array(
             "type" => "textfield",
             "holder" => "div",
             "class" => "",
             "heading" => esc_html__("Id of the article","wpestate"),
             "param_name" => "id",
             "value" => "",
             "description" => esc_html__("The id of the article","wpestate")
          ),
//           array(
//             "type" => "textfield",
//             "holder" => "div",
//             "class" => "",
//             "heading" => esc_html__("Featured text","wpestate"),
//             "param_name" => "second_line",
//             "value" => "",
//             "description" => esc_html__("featured text","wpestate")
//          )
       )
    )
    );
    $featured_prop_type=array(1,2,3,4,5,6);
    vc_map(
    array(
       "name" => esc_html__("Featured Property","wpestate"),
       "base" => "featured_property",
       "class" => "",
       "category" => esc_html__('Content','wpestatetheme-core'),
       'admin_enqueue_js' => array(get_template_directory_uri().'/vc_extend/bartag.js'),
       'admin_enqueue_css' => array(get_template_directory_uri().'/vc_extend/bartag.css'),
       'weight'=>100,
       'icon'   =>'wpestate_vc_logo',
       'description'=>esc_html__('Featured Property Shortcode','wpestatetheme-core'),
       "params" => array(
          array(
             "type" => "textfield",
             "holder" => "div",
             "class" => "",
             "heading" => esc_html__("Property id","wpestate"),
             "param_name" => "id",
             "value" => "",
             "description" => esc_html__("Property id","wpestate")
          ),
           array(
             "type" => "textfield",
             "holder" => "div",
             "class" => "",
             "heading" => esc_html__("Second Line","wpestate"),
             "param_name" => "sale_line",
             "value" => "",
             "description" => esc_html__("Second line text for design type 1","wpestate")
          )  ,
            array(
             "type" => "dropdown",
             "holder" => "div",
             "class" => "",
             "heading" => esc_html__("Design Type","wpestate"),
             "param_name" => "design_type",
             "value" =>  $featured_prop_type,
             "description" => esc_html__("type 1, 2, 3, 4, 5 or 6","wpestate")
          )    
       )
    )
    );

    
    vc_map(array(
       "name" => esc_html__("Login Form","wpestate"),
       "base" => "login_form",
       "class" => "",
       "category" => esc_html__('Content','wpestatetheme-core'),
       'admin_enqueue_js' => array(get_template_directory_uri().'/vc_extend/bartag.js'),
       'admin_enqueue_css' => array(get_template_directory_uri().'/vc_extend/bartag.css'),
       'weight'=>100,
       'icon'   =>'wpestate_vc_logo',
       'description'=>esc_html__('Login Form Shortcode','wpestatetheme-core'),  
       "params" => array( array(
             "type" => "textfield",
             "holder" => "div",
             "class" => "",
             "heading" => esc_html__("Register link text","wpestate"),
             "param_name" => "register_label",
             "value" => "",
             "description" => esc_html__("Register link text","wpestate")
            )     , 
            array(
             "type" => "textfield",
             "holder" => "div",
             "class" => "",
             "heading" => esc_html__("Register page url","wpestate"),
             "param_name" => "register_url",
             "value" => "",
             "description" => esc_html__("Register page url","wpestate")
          )      )
    )
    );
    
    
    vc_map(
     array(
       "name" => esc_html__("Register Form","wpestate"),
       "base" => "register_form",
       "class" => "",
       "category" => esc_html__('Content','wpestatetheme-core'),
       'admin_enqueue_js' => array(get_template_directory_uri().'/vc_extend/bartag.js'),
       'admin_enqueue_css' => array(get_template_directory_uri().'/vc_extend/bartag.css'),
       'weight'=>100,
       'icon'   =>'wpestate_vc_logo',
       'description'=>esc_html__('Register Form Shortcode','wpestatetheme-core'),    
       "params" => array()
    )
            
    );
    
    
    
    
    vc_map(
        array(
       "name" => esc_html__("Advanced Search","wpestate"),
       "base" => "advanced_search",
       "class" => "",
       "category" => esc_html__('Content','wpestatetheme-core'),
       'admin_enqueue_js' => array(get_template_directory_uri().'/vc_extend/bartag.js'),
       'admin_enqueue_css' => array(get_template_directory_uri().'/vc_extend/bartag.css'),
       'weight'=>100,
       'icon'   =>'wpestate_vc_logo',
       'description'=>esc_html__('Advanced Search Shortcode','wpestatetheme-core'),     
       "params" => array(
           array(
             "type" => "textfield",
             "holder" => "div",
             "class" => "",
             "heading" => esc_html__("Title","wpestate"),
             "param_name" => "title",
             "value" => "",
             "description" => esc_html__("Section Title","wpestate")
          ))
    )
           
            
    );
    
        
    
    vc_map(
        array(
        "name" => esc_html__("Testimonial Slider","wpestate"),
        "base" => "testimonial_slider",
        "as_parent" => array('only' => 'testimonial'),
        "content_element" => true,
        "is_container" => true,
        "class" => "",
        "category" => esc_html__('Content','wpestatetheme-core'),
        'admin_enqueue_js' => array(get_template_directory_uri().'/vc_extend/bartag.js'),
        'admin_enqueue_css' => array(get_template_directory_uri().'/vc_extend/bartag.css'),
        'weight'=>100,
        'icon'   =>'wpestate_vc_logo',
        'description'=>esc_html__('Testimonial Slider','wpestatetheme-core'),     
        "params" => array(
            array(
                "type" => "textfield",
                "holder" => "div",
                "class" => "",
                "heading" => esc_html__("Title","wpestate"),
                "param_name" => "title",
                "value" => "",
                "description" => esc_html__("Section Title","wpestate")
            ))
        )
           
            
    );
    
    if ( class_exists( 'WPBakeryShortCodesContainer' ) ) {
    class WPBakeryShortCode_testimonial_slider extends WPBakeryShortCodesContainer {
    }
}
if ( class_exists( 'WPBakeryShortCode' ) ) {
    class WPBakeryShortCode_testimonial extends WPBakeryShortCode {
    }
}
    
endif;



function wpestate_custom_css($class_string, $tag) {
  if ($tag =='vc_tabs' || $tag=='vc_tta_tabs' ) {
    $class_string .= ' wpestate_tabs'; 
  }

  if ($tag =='vc_tour' || $tag=='vc_tta_tour') {
    $class_string .= ' wpestate_tour'; 
  }
  
  if ($tag =='vc_accordion'|| $tag=='vc_tta_accordion' ) {
    $class_string .= ' wpestate_accordion'; 
  }
  
  if ($tag =='vc_accordion_tab' ) {
    $class_string .= ' wpestate_accordion_tab'; 
  }
  
  if ($tag =='vc_carousel' ) {
    $class_string .= ' wpestate_carousel'; 
  }

  if ($tag =='vc_progress_bar' ) {
    $class_string .= ' wpestate_progress_bar'; 
  }

  if ($tag =='vc_toggle' ) {
    $class_string .= ' wpestate_toggle'; 
  }
  
  if ($tag =='vc_message' ) {
    $class_string .= ' wpestate_message'; 
  }
  
  if ($tag =='vc_posts_grid' ) {
    $class_string .= ' wpestate_posts_grid'; 
  }
  
  if ($tag =='vc_cta_button' ) {
    $class_string .= ' wpestate_cta_button '; 
  }
  
  if ($tag =='vc_cta_button2' ) {
    $class_string .= ' wpestate_cta_button2 '; 
  }
  
  
  
  return $class_string.' '.$tag;
}


// Filter to Replace default css class for vc_row shortcode and vc_column
add_filter('vc_shortcodes_css_class', 'wpestate_custom_css', 10,2)

?>