public static function at_recent_cars($atts = null, $content = null)
    {
        if ($atts == 'generator') {
            return array("name" => __("Recent Listings", AT_ADMIN_TEXTDOMAIN), "base" => "at_recent_cars", 'icon' => "im-icon-spinner-4", "class" => "at-recent-cars-class", 'category' => __("Theme Short-Codes", AT_ADMIN_TEXTDOMAIN), "params" => array(array("type" => "textfield", "heading" => __("Title", AT_ADMIN_TEXTDOMAIN), "param_name" => "title", "value" => "", "description" => __("Description will appear below each chart.", AT_ADMIN_TEXTDOMAIN), 'dependency' => array('element' => 'content_type', 'value' => array('custom_text'))), array("type" => "range", "heading" => __("Limit", AT_ADMIN_TEXTDOMAIN), "param_name" => "limit", "value" => "12", "min" => "0", "max" => "20", "step" => "1", "unit" => '', "description" => __("Select limit to display on this block", AT_ADMIN_TEXTDOMAIN)), array("type" => "dropdown", "heading" => __("Make", AT_ADMIN_TEXTDOMAIN), "param_name" => "manufacturer_id", "width" => 200, "value" => AT_VC_Helper::get_manufacturers(), "description" => ''), array("type" => "dropdown", "heading" => __("Model", AT_ADMIN_TEXTDOMAIN), "param_name" => "model_id", "width" => 200, "value" => array("Any" => "0"), "description" => ''), array("type" => "dropdown", "heading" => __("Autoplay", AT_ADMIN_TEXTDOMAIN), "param_name" => "autoplay", "width" => 200, "value" => array("Yes" => "true", "No" => "false"), "description" => ''), array("type" => "textfield", "heading" => __("Pause", AT_ADMIN_TEXTDOMAIN), "param_name" => "pause", "value" => "4000", "description" => __("Specify slideshow timeout in ms.", AT_ADMIN_TEXTDOMAIN)), array("type" => "textfield", "heading" => __("Extra class name", AT_ADMIN_TEXTDOMAIN), "param_name" => "el_class", "value" => "", "description" => __("If you wish to style particular content element differently, then use this field to add a class name and then refer to it in Custom CSS Shortcode or Masterkey Custom CSS option.", AT_ADMIN_TEXTDOMAIN))));
        }
        $shortcode_id = self::_shortcode_id();
        extract(shortcode_atts(array('title' => '', 'manufacturer_id' => 0, 'model_id' => 0, 'limit' => 12, 'autoplay' => 'false', 'pause' => '4000', 'el_class' => '', 'width' => '1/1'), $atts));
        $width = wpb_translateColumnWidthToSpan($width);
        $car_model = AT_Loader::get_instance()->model('car_model');
        $cars = array();
        $params = array();
        if ($manufacturer_id > 0) {
            $params['manufacturer_id'] = $manufacturer_id;
            if ($model_id == 0) {
                $params['model_id'] = $model_id;
            }
        }
        $cars = $car_model->get_cars($params, $offset = 0, $limit);
        $output = '<div class="recent ' . $el_class . '">
					<h2>' . $title . '</h2>
					<div class="recent_carousel" data-settings=\'{
						"auto": ' . $autoplay . ',
						"pause": ' . $pause . ',
						"slideWidth": 220,
						"minSlides": 1,
						"infiniteLoop": 1,
						"maxSlides": 4,
						"slideMargin": 20,
						"controls" : true,
						"pager" : false,
						"infiniteLoop": true
					}\'>';
        foreach ($cars as $key => $car) {
            if (isset($car['photo']['photo_name']) && file_exists($car['photo']['photo_path'] . '213x164/' . $car['photo']['photo_name'])) {
                $static = $car['photo']['photo_url'] . '213x164/' . $car['photo']['photo_name'];
                $image = '<img src="' . AT_Common::static_url($static) . '" alt="' . $title . '"/>';
            } else {
                if (has_post_thumbnail()) {
                    $image = get_the_post_thumbnail($post_id = get_the_ID(), $size = array(213, 164));
                } else {
                    $image = '<img src="' . AT_Common::site_url(AT_URI_THEME . '/framework/assets/images/pics/noimage-small.jpg') . '" alt="' . $title . '"/>';
                }
            }
            // OLD WAY:
            // <img src="' . AT_Common::static_url( $car['photo']['photo_path'] . '213x164/' . $car['photo']['photo_name'] ) . '" alt="' . $car['options']['_manufacturer_id']['name'] . ' ' . $car['options']['_model_id']['name'] . '"/>
            $cost = AT_Common::show_full_price($value = $car['options']['_price'], $currency = $car['options']['_currency_id']);
            $output .= '<div class="slide">
							<a href="' . get_permalink($car['ID']) . '">
							' . $image . '
								<div class="description">
									Registration ' . $car['options']['_fabrication'] . '<br/>' . (!empty($car['options']['_cilindrics']) ? $car['options']['_cilindrics'] . ' cm³ ' : '') . (!empty($car['options']['_fuel_id']['name']) ? $car['options']['_fuel_id']['name'] . '<br/>' : '') . (!empty($car['options']['_engine_power']) ? $car['options']['_engine_power'] . ' HP<br/>' : '') . (!empty($car['options']['_body_type_id']['name']) ? 'Body ' . $car['options']['_body_type_id']['name'] . '<br/>' : '') . (!empty($car['options']['_mileage']) ? number_format((int) $car['options']['_mileage'], 0, '', ' ') . ' ' . AT_Common::car_mileage(0) : '') . '</div>
								<div class="title">' . $car['options']['_manufacturer_id']['name'] . ' ' . $car['options']['_model_id']['name'] . ' <span class="price">' . $cost . '</span></div>
							</a>
						</div>';
        }
        $output .= '</div>
				</div>';
        return $output;
    }
 public function filter()
 {
     $fields = array(array('type' => 'info', 'title' => __('Search Filters', AT_ADMIN_TEXTDOMAIN), 'description' => __('This option will help you create custom pattern for your search-filters. You may continue using your Short Code search filter but you will see additional option which allow you specify custom filter options. This options is available since Auto Dealer 1.5 release.', AT_ADMIN_TEXTDOMAIN)), 'shortcode_search_forms' => array('type' => 'group', 'title' => __('Shortcode Search Forms Options', AT_ADMIN_TEXTDOMAIN), 'description' => __('This options will allow you customize search filter query.', AT_ADMIN_TEXTDOMAIN), 'submit' => __("Add Shortcode", AT_ADMIN_TEXTDOMAIN), 'default' => array(), 'fields' => array('option' => array('type' => 'catalog_search_form', 'title' => __('Shortcode Search Form:', AT_ADMIN_TEXTDOMAIN), 'description' => __('You may adjust the display search form.', AT_ADMIN_TEXTDOMAIN), 'view_title' => false, 'default' => array(), 'sets' => array('title' => array('title' => __('Title Form', AT_ADMIN_TEXTDOMAIN)), 'transport_type' => array('title' => __('Transport type', AT_ADMIN_TEXTDOMAIN)), 'manufacturer_model' => array('title' => __('Make & Model', AT_ADMIN_TEXTDOMAIN)), 'body_type' => array('title' => __('Type Body', AT_ADMIN_TEXTDOMAIN)), 'fuel' => array('title' => __('Fuel', AT_ADMIN_TEXTDOMAIN)), 'cilindrics' => array('title' => __('Engine', AT_ADMIN_TEXTDOMAIN)), 'transmission' => array('title' => __('Transmision', AT_ADMIN_TEXTDOMAIN)), 'mileage' => array('title' => __('Mileage, ', AT_ADMIN_TEXTDOMAIN) . AT_Common::car_mileage()), 'doors' => array('title' => __('Doors', AT_ADMIN_TEXTDOMAIN)), 'price' => array('title' => __('Price, euro', AT_ADMIN_TEXTDOMAIN)), 'year' => array('title' => __('Year', AT_ADMIN_TEXTDOMAIN)), 'region' => array('title' => __('Region', AT_ADMIN_TEXTDOMAIN)), 'region_state' => array('title' => __('Country & State', AT_ADMIN_TEXTDOMAIN)), 'drive' => array('title' => __('Drive', AT_ADMIN_TEXTDOMAIN)), 'color' => array('title' => __('Color', AT_ADMIN_TEXTDOMAIN)), 'only_new_car' => array('title' => __('Only new cars', AT_ADMIN_TEXTDOMAIN)), 'submit' => array('title' => __('Submit', AT_ADMIN_TEXTDOMAIN)))))));
     if (!$this->_get_params) {
         $this->view->add_block('content', 'admin/site_options/content', array('title' => __('Search Filters', AT_ADMIN_TEXTDOMAIN), 'alias' => 'filter'));
     }
     return $fields;
 }
?>
				</select>
			</div>
			<div class="input_wrapper with_text">
				<label><span>* </span><strong><?php 
echo __('Mileage:', AT_TEXTDOMAIN);
?>
</strong></label>
				<input type="text" class="text" name="_mileage" id="_mileage" required value="<?php 
if (isset($car_info['options']['_mileage'])) {
    echo $car_info['options']['_mileage'];
}
?>
"/>
				<?php 
echo AT_Common::car_mileage(2);
?>
			</div>
			<div class="input_wrapper">
				<label><span> </span><strong><?php 
echo __('VIN / chassis number:', AT_TEXTDOMAIN);
?>
</strong></label>
				<input type="text" class="text" id="_vin" name="_vin" value="<?php 
if (!empty($car_info['options']['_vin'])) {
    echo $car_info['options']['_vin'];
}
?>
"/>
			</div>
		</div>
		<?php 
    foreach ($cars as $key => $car) {
        ?>
			<li<?php 
        if ($key == 3) {
            echo ' class="last"';
        }
        ?>
>
			<?php 
        $cost = AT_Common::show_full_price($value = $car['options']['_price'], $currency = $car['options']['_currency_id']);
        echo '
				<a href="' . get_permalink($car['ID']) . '">
					<img src="' . AT_Common::static_url($car['photo']['photo_url'] . '213x164/' . $car['photo']['photo_name']) . '" alt="' . $car['options']['_manufacturer_id']['name'] . ' ' . $car['options']['_model_id']['name'] . '"/>
					<div class="description">
						Registration ' . $car['options']['_fabrication'] . '<br/>' . (!empty($car['options']['_cilindrics']) ? $car['options']['_cilindrics'] . ' cm³ ' : '') . (!empty($car['options']['_fuel_id']['name']) ? $car['options']['_fuel_id']['name'] . '<br/>' : '') . (!empty($car['options']['_engine_power']) ? $car['options']['_engine_power'] . ' HP<br/>' : '') . (!empty($car['options']['_body_type_id']['name']) ? 'Body ' . $car['options']['_body_type_id']['name'] . '<br/>' : '') . (!empty($car['options']['_mileage']) ? number_format((int) $car['options']['_mileage'], 0, '', ' ') . ' ' . AT_Common::car_mileage(0) : '') . '</div>
					<div class="title">' . $car['options']['_manufacturer_id']['name'] . ' ' . $car['options']['_model_id']['name'] . ' <span class="price">' . $cost . '</span></div>
				</a>';
        ?>
			</li>
		<?php 
    }
    ?>
		<!-- <li class="last">
			<a href="#">
				<img src="<?php 
    echo AT_Common::static_url('/assets/images/pics/recent_1.jpg');
    ?>
" alt=""/>
				<div class="description">Registration 2010<br/>3.0 Diesel<br/>230 HP<br/>Body Coupe<br/>80 000 Miles</div>
				<div class="title">Mercedes-Benz <span class="price">$ 115 265</span></div>
									<input type="text" name="price_from" id="price_from" value="<?php 
                        echo $params['price_from'];
                        ?>
" class="txb"/>
									<input type="text" name="price_to" id="price_to" value="<?php 
                        echo $params['price_to'];
                        ?>
" class="txb"/>
									<div class="clear"></div>
								</div>
					<?php 
                        break;
                    case 'mileage':
                        ?>
								<label><strong><?php 
                        echo __('Mileage, ' . AT_Common::car_mileage(1) . ':', AT_TEXTDOMAIN);
                        ?>
</strong></label>
								<div class="select_box_2">
									<input type="text" name="mileage_from" placeholder="<?php 
                        echo __('From', AT_TEXTDOMAIN);
                        ?>
" id="mileage_from"  value="<?php 
                        echo $params['mileage_from'];
                        ?>
" class="txb"/>
									<input type="text" name="mileage_to" placeholder="<?php 
                        echo __('To', AT_TEXTDOMAIN);
                        ?>
" id="mileage_to" value="<?php 
                        echo $params['mileage_to'];
    ?>
</div>
			</div>
			<?php 
}
?>
			<?php 
if (!empty($car_info['options']['_mileage'])) {
    ?>
			<div class="line">
				<div class="left"><?php 
    echo __('Mileage', AT_TEXTDOMAIN);
    ?>
:</div>
				<div class="right"><?php 
    echo number_format((int) $car_info['options']['_mileage'], 0, '', ' ') . ' ' . AT_Common::car_mileage(0);
    ?>
</div>
			</div>
			<?php 
}
?>
		</div>
		<?php 
if ($car_info['post_status'] == 'publish' && isset($contacts_owner['add_offer']) && $contacts_owner['add_offer']) {
    ?>
		<?php 
    $this->add_script('jquery-ui-core');
    ?>
		<?php 
    $this->add_script('jquery-ui-dialog');
    public static function at_auto_gallery($atts = null, $content = null)
    {
        if ($atts == 'generator') {
            return array("name" => __("Slider: Auto Gallery", AT_ADMIN_TEXTDOMAIN), "base" => "at_auto_gallery", 'icon' => "im-icon-spinner-4", "class" => "at-auto-gallery-class", 'category' => __("Theme Short-Codes", AT_ADMIN_TEXTDOMAIN), "params" => array(array("type" => "range", "heading" => __("Limit", AT_ADMIN_TEXTDOMAIN), "param_name" => "limit", "value" => "5", "min" => "0", "max" => "12", "step" => "1", "unit" => '', "description" => __("Select limit to display on this block", AT_ADMIN_TEXTDOMAIN)), array("type" => "dropdown", "heading" => __("Display options", AT_ADMIN_TEXTDOMAIN), "param_name" => "display", "width" => 200, "value" => array("Show all item" => "all", "Only featured" => "featured"), "description" => ''), array("type" => "dropdown", "heading" => __("Make", AT_ADMIN_TEXTDOMAIN), "param_name" => "manufacturer_id", "width" => 200, "value" => AT_VC_Helper::get_manufacturers(), "description" => ''), array("type" => "dropdown", "heading" => __("Model", AT_ADMIN_TEXTDOMAIN), "param_name" => "model_id", "width" => 200, "value" => array_merge(array("Any" => "0"), AT_VC_Helper::get_manufacturers()), "description" => ''), array("type" => "dropdown", "heading" => __("Autoplay", AT_ADMIN_TEXTDOMAIN), "param_name" => "autoplay", "width" => 200, "value" => array("Yes" => "true", "No" => "false"), "description" => ''), array("type" => "textfield", "heading" => __("Pause", AT_ADMIN_TEXTDOMAIN), "param_name" => "pause", "value" => "4000", "description" => __("Specify slideshow timeout in ms.", AT_ADMIN_TEXTDOMAIN)), array("type" => "textfield", "heading" => __("Extra class name", AT_ADMIN_TEXTDOMAIN), "param_name" => "el_class", "value" => "", "description" => __("If you wish to style particular content element differently, then use this field to add a class name and then refer to it in Custom CSS Shortcode or Masterkey Custom CSS option.", AT_ADMIN_TEXTDOMAIN))));
        }
        $shortcode_id = self::_shortcode_id();
        extract(shortcode_atts(array('manufacturer_id' => 0, 'model_id' => 0, 'display' => 'all', 'limit' => 5, 'autoplay' => 'false', 'pause' => '4000', 'el_class' => '', 'width' => '1/1'), $atts));
        $width = wpb_translateColumnWidthToSpan($width);
        $car_model = AT_Loader::get_instance()->model('car_model');
        $cars = array();
        $params = array();
        if ($manufacturer_id > 0) {
            $params['manufacturer_id'] = $manufacturer_id;
            if ($model_id == 0) {
                $params['model_id'] = $model_id;
            }
        }
        if ($display == "featured") {
            $params['featured'] = true;
        }
        $cars = $car_model->get_cars($params, $offset = 0, $limit);
        if (count($cars) > 0) {
            $output = '<div class="home_slider ' . $el_class . '">
								<div class="slider slider_1" data-settings=\'{
									"auto": ' . $autoplay . ',
									"slideWidth": 940,
									"pause": ' . $pause . ',
									"minSlides": 1,
									"infiniteLoop" : true,
									"maxSlides": 1,
									"slideMargin": 0,
									"controls" : false}\'>';
            foreach ($cars as $key => $car) {
                $title = $car['options']['_manufacturer_id']['name'] . ' ' . $car['options']['_model_id']['name'];
                if (isset($car['photo']['photo_name']) && file_exists($car['photo']['photo_path'] . 'original/' . $car['photo']['photo_name'])) {
                    $static = $car['photo']['photo_url'] . 'original/' . $car['photo']['photo_name'];
                    $image = '<img src="' . AT_Common::static_url($static) . '" alt="' . $title . '"/>';
                } else {
                    if (has_post_thumbnail()) {
                        $image = get_the_post_thumbnail($post_id = $car['ID'], $size = array(640, 428));
                    } else {
                        $image = '<img src="' . AT_Common::site_url(AT_URI_THEME . '/framework/assets/images/pics/noimage-large.jpg') . '" alt="' . $title . '"/>';
                    }
                }
                $cost = AT_Common::show_full_price($value = $car['options']['_price'], $currency = $car['options']['_currency_id']);
                $output .= '<div class="slide" data-onclick="location.href=' . get_permalink($car['ID']) . '">
								<a title="' . $title . '" href="' . get_permalink($car['ID']) . '">' . $image . '</a>
								<div class="description">
									<a title="' . $title . '" href="' . get_permalink($car['ID']) . '"><h2 class="title">' . $car['options']['_fabrication'] . ' ' . $title . '</h2></a>
									<p class="desc">' . (!empty($car['options']['_mileage']) ? '<span><strong>' . AT_Common::car_mileage(0) . ': </strong>' . number_format((int) $car['options']['_mileage'], 0, '', ',') . '</span>' : '') . (!empty($car['options']['_cilindrics']) ? '<span><strong>' . __('Engine', AT_TEXTDOMAIN) . ': </strong>' . $car['options']['_cilindrics'] . ' ' . __('cm³', AT_TEXTDOMAIN) . '</span> ' : '') . '</p>
									<div class="price">' . $cost . '</div>
								</div>
							</div>';
            }
            $output .= '</div>
					</div>';
        } else {
            $output = '<div class="home_slider ' . $el_class . '">' . __('Login and add new vehicles.', AT_TEXTDOMAIN) . '</div>';
        }
        return $output;
    }