public static function at_manufacturers($atts = null, $content = null) { if ($atts == 'generator') { return array("name" => __("Make", AT_ADMIN_TEXTDOMAIN), "base" => "at_manufacturers", 'icon' => "im-icon-spinner-4", "class" => "at-manufacturers-class", 'category' => __("Theme Short-Codes", AT_ADMIN_TEXTDOMAIN), "params" => array(array("type" => "textfield", "heading" => __("Title", AT_ADMIN_TEXTDOMAIN), "param_name" => "title", "value" => "", "description" => __("Enter shortcode title.", AT_ADMIN_TEXTDOMAIN), 'dependency' => array('element' => 'content_type', 'value' => array('custom_text'))), array("type" => "range", "heading" => __("Columns", AT_ADMIN_TEXTDOMAIN), "param_name" => "columns", "default" => "1", "min" => "1", "max" => "7", "step" => "1", "unit" => 'col', "description" => __("Select limit to display on this block", 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' => '', 'columns' => '1', 'el_class' => ''), $atts)); $car_model = AT_Loader::get_instance()->model('car_model'); $manufacturers = $car_model->get_manufacturers(); $output = ''; if (!empty($title)) { $output .= '<h2>' . $title . '</h2>'; } if ($columns > 1) { $output .= '<div class="auto-columns col-' . $columns . '">'; } $output .= '<ul>'; foreach ($manufacturers as $manufacturer) { $output .= '<li><a href="' . AT_Common::site_url('catalog/' . $manufacturer['alias']) . '">' . $manufacturer['name'] . '</a></li>'; } $output .= '</ul>'; if ($columns > 1) { $output .= '</div>'; } $output .= '<div class="clear"></div>'; return $output; }
public function __construct() { global $wpdb; $this->wpdb =& $wpdb; $this->_users_table = $wpdb->prefix . $this->_users_table; $this->_dealers_affiliates_table = $wpdb->prefix . $this->_dealers_affiliates_table; $this->_manufacturers_table = $wpdb->prefix . $this->_manufacturers_table; $this->_models_table = $wpdb->prefix . $this->_models_table; $this->_body_types_table = $wpdb->prefix . $this->_body_types_table; $this->_transmissions_table = $wpdb->prefix . $this->_transmissions_table; $this->_equipments_table = $wpdb->prefix . $this->_equipments_table; $this->_doors_table = $wpdb->prefix . $this->_doors_table; $this->_fuels_table = $wpdb->prefix . $this->_fuels_table; $this->_technical_conditions_table = $wpdb->prefix . $this->_technical_conditions_table; $this->_currencies_table = $wpdb->prefix . $this->_currencies_table; $this->_transport_types_table = $wpdb->prefix . $this->_transport_types_table; $this->_regions_table = $wpdb->prefix . $this->_regions_table; $this->_cities_table = $wpdb->prefix . $this->_cities_table; $this->_region_types_table = $wpdb->prefix . $this->_region_types_table; $this->_states_table = $wpdb->prefix . $this->_states_table; $this->_drive_table = $wpdb->prefix . $this->_drive_table; $this->_colors_table = $wpdb->prefix . $this->_colors_table; $this->_photos_table = $wpdb->prefix . $this->_photos_table; $this->_recovery_password_table = $wpdb->prefix . $this->_recovery_password_table; $this->_transactions_table = $wpdb->prefix . $this->_transactions_table; $this->load = AT_Loader::get_instance(); $this->core = AT_Core::get_instance(); $this->registry = AT_Registry::get_instance(); }
public static function get_instance() { if (is_null(self::$_instance)) { self::$_instance = new self(); } return self::$_instance; }
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 static function get_manufacturers() { $reference_model = AT_Loader::get_instance()->model('reference_model'); $return = array('Any' => 0); foreach ($reference_model->get_manufacturers() as $manufacturer) { $return[$manufacturer['name']] = $manufacturer['id']; } return $return; }
public function __construct() { $this->core = AT_Core::get_instance(); if (!$this->core->get_option('theme_is_activated', false) && isset($_GET['page']) && $_GET['page'] != 'at_theme_install') { wp_redirect('admin.php?page=at_theme_install'); } $this->load = AT_Loader::get_instance(); if (is_null($this->view)) { $this->view = $this->core->view; $this->uri = AT_Router::get_instance(); } }
public static function at_recent_dealers($atts = null, $content = null) { if ($atts == 'generator') { return array("name" => __("Recent Dealers", AT_ADMIN_TEXTDOMAIN), "base" => "at_recent_dealers", 'icon' => "im-icon-spinner-4", "class" => "at-resent-posts-class", 'category' => __("Theme Short-Codes", AT_ADMIN_TEXTDOMAIN), "params" => array(array("type" => "textfield", "heading" => __("Title", AT_ADMIN_TEXTDOMAIN), "param_name" => "title", "value" => "", "description" => __("Enter custom title.", 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" => __("Carousel", AT_ADMIN_TEXTDOMAIN), "param_name" => "carousel", "width" => 'carousel', "value" => array("Use carousel" => "carousel", "Static" => "static"), "description" => ''), array("type" => "range", "heading" => __("View post", AT_ADMIN_TEXTDOMAIN), "param_name" => "spans", "value" => "4", "min" => "0", "max" => "6", "step" => "1", "unit" => '', "description" => __("Select limit to display on one row", 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' => '', 'limit' => 3, 'trim' => 80, 'spans' => 4, 'disable' => '', 'carousel' => 'carousel', 'el_class' => '', 'width' => '1/1', 'post_type' => 'post'), $atts)); $style = ''; if ($carousel == 'static') { $style .= ' style="'; $style .= 'max-width:' . 100 / $spans . '%'; $style .= '"'; } $width = wpb_translateColumnWidthToSpan($width); $dealers = AT_Loader::get_instance()->model('user_model'); $results = $dealers->get_dealers(0, $limit); $total = $dealers->get_dealers_count(); $output = ''; if (count($results > 0)) { $c = 0; $class = "dealer-wrapper"; $output .= '<div class="' . $class . '">'; // $output .= '<a href="#" class="all">Show all...</a>'; $output .= '<div class="results"><span>' . sprintf(__('Total %s dealers', AT_TEXTDOMAIN), $total) . '</span></div>'; $output .= '<div class="clear"></div>'; $output .= '<div class="tabs_' . $carousel . '">'; foreach ($results as $dealer) { $c++; $url = AT_Common::site_url('dealer/info/' . trim($dealer['alias'] . '-' . $dealer['id'], '-') . '/'); if (!file_exists($dealer['photo']['photo_path'] . '138x138/' . $dealer['photo']['photo_name'])) { $photo = AT_URI . '/assets/images/default-dealer-small.jpg'; } else { $photo = $dealer['photo']['photo_url'] . '138x138/' . $dealer['photo']['photo_name']; } $output .= '<div class="slide"' . $style . '>'; $output .= '<a class="thumb img" href="' . $url . '"><img src="' . $photo . '" /></a>'; $output .= '<a class="title" href="' . $url . '">' . $dealer['name'] . '</a>'; $output .= '</div>'; } $output .= '</div>'; $output .= '</div>'; } $output .= '<div class="clear"></div>'; return $output; }
public function __construct() { $this->core = AT_Core::get_instance(); // if ( !$this->core->get_option( 'theme_is_activated', false ) && is_user_logged_in() ) { // AT_Notices::set_frontend_notice( // '<h3>'.__( 'New to AutoDealer?' , AT_TEXTDOMAIN ) . '</h3>' . // __( 'You almost ready to use full theme features. Please complete two last steps before move your website to production mode.' , AT_TEXTDOMAIN ) . // '<br />' . // sprintf(__( '<a href="%1$s">Click here to continue →</a>' , AT_TEXTDOMAIN ), get_admin_url() . 'admin.php?page=at_site_options_general'), // $class = 'notice' // ); // Header('Location: ' . get_admin_url() . 'admin.php?page=at_site_options_general'); // die(); // // exit( __( 'Theme is not activated' , AT_TEXTDOMAIN ) ); // } // SSL and ajax tricks // if ( ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] != rtrim( home_url(), '/' ) ) { // AT_Common::redirect( AT_Router::get_instance()->server('REQUEST_URI'), '301' ); // } $this->uri = AT_Router::get_instance(); if ($this->uri->get_method() != 'show_underconstruction' && $this->core->get_option('status_site', 'production') == 'underconstruction') { AT_Core::show_underconstruction(); } $this->view = $this->core->view; $this->load = AT_Loader::get_instance(); $this->session = AT_Session::get_instance(); $this->registry = AT_Registry::get_instance(); $this->load->library('breadcrumbs'); $this->breadcrumbs = AT_Breadcrumbs::get_instance(); $validation_rules = $this->load->helper('validation_rules', true); $this->validation = $this->load->library('form_validation', true, $validation_rules->rules); //$this->validation->set_rules(); if (AT_Common::is_user_logged() && $this->core->get_option('theme_is_activated', false)) { $user_model = $this->load->model('user_model'); $user_info = $user_model->get_user_by_id(AT_Common::get_logged_user_id()); $this->registry->set('user_info', $user_info); if ($this->core->get_option('confirm_email_enable', true) && !in_array($this->uri->segments(1), array('confirm_email', 'unlogged')) && (is_null($user_info['date_active']) || empty($user_info['date_active']))) { AT_Common::redirect('auth/confirm_email'); } } }
public static function cron_hourly_task() { $payments_model = AT_Loader::get_instance()->model('payments_model'); // var_dump($payments_model); }
public function email_exist($str) { $user_model = AT_Loader::get_instance()->model('user_model'); return !$user_model->is_email_exist($str); }
function show() { global $post; foreach ($this->_meta_box['fields'] as $key => &$item) { if (is_numeric($key)) { continue; } if (!empty($this->_group_name)) { $val = isset($this->_group_item_values[$key]) ? $this->_group_item_values[$key] : null; } else { $val = get_post_meta($post->ID, $key, true); } switch ($key) { case '_model_id': $manufacturer_id = $this->_meta_box['fields']['_manufacturer_id']['value']; if (!empty($manufacturer_id) && $manufacturer_id > 0) { $reference_model = AT_Loader::get_instance()->model('reference_model'); $item['items'] = $reference_model->get_data_for_options('get_models_by_manufacturer_id', $manufacturer_id); } unset($manufacturer_id); break; case '_state_id': $region_id = $this->_meta_box['fields']['_region_id']['value']; if (!empty($region_id) && $region_id > 0) { $reference_model = AT_Loader::get_instance()->model('reference_model'); $item['items'] = $reference_model->get_data_for_options('get_states_by_region_id', $region_id); } unset($region_id); break; case '_owner_id': if (!empty($val)) { $user_model = AT_Loader::get_instance()->model('user_model'); $user_info = $user_model->get_user_by_id($val); if ($user_info) { $item['title'] = $user_info['name']; $item['description'] = $user_info['email'] . '<br/>' . (!empty($user_info['phone']) ? $user_info['phone'] . '<br/>' : '') . (!empty($user_info['phone_2']) ? $user_info['phone_2'] . '<br/>' : ''); } } break; case '_affiliate_id': $owner_id = $this->_meta_box['fields']['_owner_id']['value']; if (!empty($owner_id) && $owner_id > 0) { $user_model = AT_Loader::get_instance()->model('user_model'); foreach ($user_model->get_dealer_affiliates($owner_id) as $key => $value) { $item['items'][$value['id']] = $value['name']; } } unset($owner_id); break; } $item['value'] = empty($val) ? isset($item['default']) && !empty($item['default']) ? $item['default'] : '' : $val; } $this->view->use_layout('content'); $this->_parse_fields($this->_meta_box['fields']); $out = $this->view->render()->display(true); # Use nonce for verification $out .= '<input type="hidden" name="' . $this->_meta_box['id'] . '_meta_box_nonce" value="' . wp_create_nonce(basename(__FILE__)) . '" />'; echo $out; }
public function add_widget($widget, $params = array(), $return = false) { $object = AT_Loader::get_instance()->widget($widget); $data = $object->render($params); if (!$return) { echo $data; } else { return $data; } }
public static function action_managing_car_custom_columns($column_name, $car_id) { switch ($column_name) { case 'image': if (has_post_thumbnail($car_id)) { the_post_thumbnail(array(50, 50)); } break; case 'views': $car_model = AT_Loader::get_instance()->model('car_model'); echo $car_model->get_car_views($car_id); break; case 'owner': $owner_id = get_post_meta($car_id, '_owner_id', true); $user_model = AT_Loader::get_instance()->model('user_model'); $user_info = $user_model->get_user_by_id($owner_id); if ($user_info) { echo $user_info['name'] . '<br/> ' . $user_info['email']; } else { echo __('Not set', AT_ADMIN_TEXTDOMAIN); } break; default: break; } }
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; }