Example #1
0
File: cars.php Project: zruiz/NG
    function widget($args, $instance)
    {
        extract($args);
        // these are the widget options
        $post_title = apply_filters('widget_title', $instance['title']);
        $post_title = $post_title == '' ? __('Latest Added', 'imic-framework-admin') : $post_title;
        $category = apply_filters('widget-category', empty($instance['category']) ? '' : $instance['category'], $instance, $this->id_base);
        $number = apply_filters('widget-number', $instance['number']);
        echo $args['before_widget'];
        global $imic_options;
        if (!empty($instance['title'])) {
            echo $args['before_title'];
            echo apply_filters('widget_title', $post_title, $instance, $this->id_base);
            echo $args['after_title'];
        }
        if (isset($imic_options['enable_rtl']) && $imic_options['enable_rtl'] == 1) {
            $DIR = 'data-rtl="rtl"';
        } else {
            $DIR = 'data-rtl="ltr"';
        }
        echo '
                            <div class="carousel-wrapper">
                                <div class="row">
                                    <ul class="owl-carousel single-carousel" id="vehicle-slider" data-columns="1" data-autoplay="" data-pagination="no" data-arrows="no" data-single-item="no" data-items-desktop="1" data-items-desktop-small="1" data-items-tablet="2" data-items-mobile="1" ' . $DIR . '>';
        $badges_type = isset($imic_options['badges_type']) ? $imic_options['badges_type'] : '0';
        $specification_type = isset($imic_options['short_specifications']) ? $imic_options['short_specifications'] : '0';
        if ($badges_type == "0") {
            $badge_ids = $imic_options['badge_specs'];
        } else {
            $badge_ids = array();
        }
        $img_src = '';
        if ($specification_type == 0) {
            $detailed_specs = isset($imic_options['specification_list']) ? $imic_options['specification_list'] : array();
        } else {
            $detailed_specs = array();
        }
        $additional_specs = isset($imic_options['additional_specs']) ? $imic_options['additional_specs'] : '';
        //$detailed_specs = $imic_options['vehicle_specs'];
        $additional_specs_all = get_post_meta($additional_specs, 'specifications_value', true);
        $highlighted_specs = isset($imic_options['highlighted_specs']) ? $imic_options['highlighted_specs'] : '';
        $unique_specs = $imic_options['unique_specs'];
        $listing_page_url = imic_get_template_url('template-listing.php');
        $args_cars = array('post_type' => 'cars', 'posts_per_page' => $number, 'post_status' => 'publish', 'meta_query' => array(array('key' => 'imic_plugin_ad_payment_status', 'value' => $category, 'compare' => '=')));
        $cars_listing = new WP_Query($args_cars);
        if ($cars_listing->have_posts()) {
            while ($cars_listing->have_posts()) {
                $cars_listing->the_post();
                if (is_plugin_active("imi-classifieds/imi-classified.php")) {
                    $badge_ids = imic_classified_badge_specs(get_the_ID(), $badge_ids);
                    $detailed_specs = imic_classified_short_specs(get_the_ID(), $detailed_specs);
                }
                $post_author_id = get_post_field('post_author', get_the_ID());
                $user_info_id = get_user_meta($post_author_id, 'imic_user_info_id', true);
                $author_role = get_option('blogname');
                if (!empty($user_info_id)) {
                    $term_list = wp_get_post_terms($user_info_id, 'user-role', array("fields" => "names"));
                    if (!empty($term_list)) {
                        $author_role = $term_list[0];
                    } else {
                        $author_role = get_option('blogname');
                    }
                }
                $specifications = get_post_meta(get_the_ID(), 'feat_data', true);
                $unique_value = imic_vehicle_price(get_the_ID(), $unique_specs, $specifications);
                $new_highlighted_specs = imic_filter_lang_specs_admin($highlighted_specs, get_the_ID());
                $highlighted_specs = $new_highlighted_specs;
                $highlight_value = imic_vehicle_title(get_the_ID(), $highlighted_specs, $specifications);
                $highlight_value = $highlight_value != '' ? $highlight_value : get_the_title();
                $details_value = imic_vehicle_all_specs(get_the_ID(), $detailed_specs, $specifications);
                if (!empty($additional_specs)) {
                    if ($imic_options['specification_fields_type'] == "0") {
                        $image_key = array_search($additional_specs, $specifications['sch_title']);
                        $additional_specs_value = $specifications['start_time'][$image_key];
                    } else {
                        $img_char = imic_the_slug($additional_specs);
                        $additional_specs_value = get_post_meta(get_the_ID(), 'char_' . $img_char, true);
                    }
                    $this_key = find_car_with_position($additional_specs_all, $additional_specs_value);
                    $img_src = $additional_specs_all[$this_key]['imic_plugin_spec_image'];
                }
                ?>
                                    <li class="item">
                                        <div class="vehicle-block format-standard">
                                        <?php 
                if (has_post_thumbnail()) {
                    if ($category == 1) {
                        ?>
                                            <a href="<?php 
                        echo esc_url(get_permalink());
                        ?>
" class="media-box"><?php 
                        the_post_thumbnail('600x400');
                        ?>
</a><?php 
                    } else {
                        ?>
<a href="javascript:void(0);" class="media-box"><?php 
                        the_post_thumbnail('600x400');
                        ?>
</a><?php 
                    }
                }
                ?>
                                            <div class="vehicle-block-content">
                                            <?php 
                if ($category == 1) {
                    ?>
                                                <h5 class="vehicle-title"><a href="<?php 
                    echo esc_url(get_permalink());
                    ?>
"><?php 
                    echo esc_attr($highlight_value);
                    ?>
</a></h5><?php 
                } else {
                    ?>
                                                <h5 class="vehicle-title"><?php 
                    echo esc_attr($highlight_value);
                    ?>
</h5><?php 
                }
                ?>
<span class="vehicle-meta"><?php 
                if (!empty($details_value)) {
                    foreach ($details_value as $value) {
                        echo esc_attr($value) . ', ';
                    }
                }
                echo esc_attr_e(' by ', 'framework');
                ?>
<abbr class="user-type" title="<?php 
                echo esc_attr_e('Listed by', 'framework');
                echo esc_attr($author_role);
                ?>
"><?php 
                echo esc_attr($author_role);
                ?>
</abbr></span>
                                                <?php 
                if ($img_src != '') {
                    ?>
                                                <a href="<?php 
                    echo esc_url($listing_page_url);
                    ?>
" title="<?php 
                    echo esc_attr_e('View all ', 'framework');
                    echo esc_attr($additional_specs_all[$this_key]['imic_plugin_specification_values']);
                    ?>
" class="vehicle-body-type"><img src="<?php 
                    echo esc_url($additional_specs_all[$this_key]['imic_plugin_spec_image']);
                    ?>
" alt=""></a><?php 
                }
                ?>
                                                <span class="vehicle-cost"><?php 
                echo esc_attr($unique_value);
                ?>
</span>
                                            </div>
                                        </div>
                                    </li>
                                    <?php 
            }
        }
        wp_reset_postdata();
        echo '</ul>
                                </div>
                            </div>';
        echo $args['after_widget'];
    }
Example #2
0
 $badge_ids = imic_filter_lang_specs($badge_ids);
 $car_author = get_post_field('post_author', get_the_ID());
 $user_info_id = get_user_meta($car_author, 'imic_user_info_id', true);
 $author_role = get_option('blogname');
 if (!empty($user_info_id)) {
     $term_list = wp_get_post_terms($user_info_id, 'user-role', array("fields" => "names"));
     if (!empty($term_list)) {
         $author_role = $term_list[0];
     } else {
         $author_role = get_option('blogname');
     }
 }
 $specifications = get_post_meta(get_the_ID(), 'feat_data', true);
 $new_highlighted_specs = imic_filter_lang_specs_admin($highlighted_specs, get_the_ID());
 $highlighted_specs = $new_highlighted_specs;
 $unique_value = imic_vehicle_price(get_the_ID(), $unique_specs, $specifications);
 $highlight_value = imic_vehicle_title(get_the_ID(), $highlighted_specs, $specifications);
 $details_value = imic_vehicle_all_specs(get_the_ID(), $detailed_specs, $specifications);
 if (!empty($additional_specs)) {
     if ($imic_options['specification_fields_type'] == "0") {
         $image_key = array_search($additional_specs, $specifications['sch_title']);
         $additional_specs_value = $specifications['start_time'][$image_key];
     } else {
         $img_char = imic_the_slug($additional_specs);
         $additional_specs_value = get_post_meta(get_the_ID(), 'char_' . $img_char, true);
     }
     $this_key = find_car_with_position($additional_specs_all, $additional_specs_value);
     $img_src = $additional_specs_all[$this_key]['imic_plugin_spec_image'];
 }
 $badges = imic_vehicle_all_specs(get_the_ID(), $badge_ids, $specifications);
 ?>
Example #3
0
			<?php 
    if (!empty($compare)) {
        ?>
            	<!-- Vehicle Comparision -->
                <div class="comparision-table-resp">
                <div class="col3 comparision-table">
                	<div class="tsticky thead-sticky comp-table-row">
                    	<div class="comp-table-col">&nbsp;</div>
                        <?php 
        foreach ($compare as $comp) {
            $completed = get_post_meta($comp, 'imic_plugin_ad_payment_status', true);
            $specifications = get_post_meta($comp, 'feat_data', true);
            $new_highlighted_specs = imic_filter_lang_specs_admin($highlighted_specs, $comp);
            $highlighted_specs = $new_highlighted_specs;
            $highlighted_specs_val = imic_vehicle_title($comp, $highlighted_specs, $specifications);
            $unique_value = imic_vehicle_price($comp, $unique_specs, $specifications);
            if ($completed == 1) {
                ?>
                        <div class="comp-table-col">
                        	<strong><?php 
                echo esc_attr($highlighted_specs_val);
                ?>
</strong>
                            <span class="price"><?php 
                echo esc_attr($unique_value);
                ?>
</span>
                        </div><?php 
            } else {
                ?>
						<div class="comp-table-col">
Example #4
0
                                        <?php 
                $additional_specs = $imic_options['unique_specs'];
                if ($specification_type == 0) {
                    $detailed_specs = isset($imic_options['vehicle_specs']) ? $imic_options['vehicle_specs'] : array();
                } else {
                    $detailed_specs = array();
                }
                $detailed_title = $imic_options['highlighted_specs'];
                $saved_four = 1;
                foreach ($saved_cars as $save) {
                    $specifications = get_post_meta($save[0], 'feat_data', true);
                    $details_value = imic_vehicle_all_specs($save[0], $detailed_specs, $specifications);
                    if (is_plugin_active("imi-classifieds/imi-classified.php")) {
                        $details_value = imic_classified_short_specs($save, $details_value);
                    }
                    $price = imic_vehicle_price($save[0], $additional_specs, $specifications);
                    $new_highlighted_specs = imic_filter_lang_specs_admin($detailed_title, $save[0]);
                    $detailed_title = $new_highlighted_specs;
                    $title = imic_vehicle_title($save[0], $detailed_title, $specifications);
                    ?>
                                            <tr>
                                                <td valign="middle" class="checkb"><input id="saved-<?php 
                    echo esc_attr($save[0]);
                    ?>
" value="1" class="remove-saved compare-check" type="checkbox"></td>
                                                <td>
                                                    <!-- Result -->
                                                    <a href="<?php 
                    echo esc_url(get_permalink($save[0]));
                    ?>
" class="car-image"><?php 
Example #5
0
function imic_mostviewed($atts, $content = null)
{
    extract(shortcode_atts(array("title" => "", "number" => "5", "view" => '1'), $atts));
    $output = '';
    $starts = 1;
    $most_viewed = array();
    global $imic_options;
    if ($view == 1 || $view == 3) {
        $logged_user_pin = '';
        $user_id = get_current_user_id();
        $logged_user = get_user_meta($user_id, 'imic_user_info_id', true);
        $logged_user_pin = get_post_meta($logged_user, 'imic_user_zip_code', true);
        if ($imic_options['badges_type'] == "0") {
            $badge_ids = isset($imic_options['badge_specs']) ? $imic_options['badge_specs'] : array();
        } else {
            $badge_ids = array();
        }
        $args_cats = array('orderby' => 'name', 'order' => 'ASC', 'fields' => 'all');
        $classifieds_data = get_option('imic_classifieds');
        $img_src = '';
        $additional_specs = isset($imic_options['additional_specs']) ? $imic_options['additional_specs'] : '';
        $additional_spec_slug = imic_the_slug($additional_specs);
        if ($imic_options['short_specifications'] == 0) {
            $detailed_specs = isset($imic_options['specification_list']) ? $imic_options['specification_list'] : array();
        } else {
            $detailed_specs = array();
        }
        $category_rail = isset($imic_options['category_rail']) ? $imic_options['category_rail'] : '0';
        $browse_listing = imic_get_template_url("template-listing.php");
        $additional_specs_all = get_post_meta($additional_specs, 'specifications_value', true);
        $highlighted_specs = isset($imic_options['highlighted_specs']) ? $imic_options['highlighted_specs'] : array();
        $unique_specs = isset($imic_options['unique_specs']) ? $imic_options['unique_specs'] : '';
        if ($view == 1) {
            $most_viewed = get_option('imic_most_viewed');
            $most_viewed = !empty($most_viewed) ? $most_viewed : array();
        } elseif ($view == 3) {
            $args_cars = array('post_type' => 'yachts', 'orderby' => 'meta_value', 'meta_query' => array('relation' => 'AND', array('key' => 'imic_plugin_ad_payment_status', 'value' => '1', 'compare' => '='), array('key' => 'imic_plugin_listing_end_dt', 'value' => date('Y-m-d'), 'compare' => '>=')), 'meta_key' => 'imic_most_visited', 'order' => 'DESC', 'posts_per_page' => $number);
            $cars_listing = new WP_Query($args_cars);
            if ($cars_listing->have_posts()) {
                while ($cars_listing->have_posts()) {
                    $cars_listing->the_post();
                    $most_viewed[] = get_the_ID();
                }
            }
            wp_reset_postdata();
        }
        if (!empty($most_viewed)) {
            $output .= '<section class="listing-block recent-vehicles">
                	<div class="listing-header">
                    	<h3>' . esc_attr($title) . '</h3>
                    </div>
                    <div class="listing-container">
                        <div class="carousel-wrapper">
                            <div class="row">
                                <ul class="owl-carousel carousel-fw" id="vehicle-slider" data-columns="4" data-autoplay="5000" data-pagination="yes" data-arrows="no" data-single-item="no" data-items-desktop="4" data-items-desktop-small="3" data-items-tablet="2" data-items-mobile="1">';
            foreach ($most_viewed as $most) {
                $listing_status = get_post_status($most);
                if ($listing_status == "publish") {
                    if (is_plugin_active("imi-classifieds/imi-classified.php")) {
                        $badge_ids = imic_classified_badge_specs($most, $badge_ids);
                        $detailed_specs = imic_classified_short_specs($most, $detailed_specs);
                    }
                    $post_author_id = get_post_field('post_author', $most);
                    $user_info_id = get_user_meta($post_author_id, 'imic_user_info_id', true);
                    $author_role = get_option('blogname');
                    if (!empty($user_info_id)) {
                        $term_list = wp_get_post_terms($user_info_id, 'user-role', array("fields" => "names"));
                        if (!empty($term_list)) {
                            $author_role = $term_list[0];
                        } else {
                            $author_role = get_option('blogname');
                        }
                    }
                    $specifications = get_post_meta($most, 'feat_data', true);
                    $unique_value = imic_vehicle_price($most, $unique_specs, $specifications);
                    $new_highlighted_specs = imic_filter_lang_specs_admin($highlighted_specs, $most);
                    $highlighted_specs = $new_highlighted_specs;
                    $highlight_value = imic_vehicle_title($most, $highlighted_specs, $specifications);
                    $highlight_value = $highlight_value != '' ? $highlight_value : get_the_title(get_the_ID());
                    $details_value = imic_vehicle_all_specs($most, $detailed_specs, $specifications);
                    if (!empty($additional_specs)) {
                        $image_key = array_search($additional_specs, $specifications['sch_title']);
                        $additional_specs_value = $specifications['start_time'][$image_key];
                        $this_key = find_car_with_position($additional_specs_all, $additional_specs_value);
                        $img_src = $additional_specs_all[$this_key]['imic_plugin_spec_image'];
                    }
                    $badges = imic_vehicle_all_specs($most, $badge_ids, $specifications);
                    $output .= '<li class="item">
            	<div class="vehicle-block format-standard">';
                    if (has_post_thumbnail($most)) {
                        $output .= '<a href="' . esc_url(get_permalink($most)) . '" class="media-box">' . get_the_post_thumbnail($most) . '</a>';
                    }
                    $output .= '<div class="vehicle-block-content">';
                    $start = 1;
                    $badge_position = array('vehicle-age', 'premium-listing', 'third-listing', 'fourth-listing');
                    foreach ($badges as $badge) {
                        $badge_class = $start == 1 ? 'default' : 'success';
                        $output .= '<span class="label label-' . esc_attr($badge_class) . ' ' . esc_attr($badge_position[$start - 1]) . '">' . esc_attr($badge) . '</span>';
                        $start++;
                        if ($start == 4) {
                            break;
                        }
                    }
                    if (!empty($highlight_value)) {
                        $output .= '<h5 class="vehicle-title"><a href="' . esc_url(get_permalink($most)) . '">' . esc_attr($highlight_value) . '</a></h5>';
                    }
                    $output .= '<span class="vehicle-meta">';
                    $total = 1;
                    if (!empty($details_value)) {
                        foreach ($details_value as $value) {
                            $output .= esc_attr($value) . ', ';
                            if ($total++ == 4) {
                                break;
                            }
                        }
                    }
                    $output .= __('by', 'framework') . '
				<abbr class="user-type" title="' . __('Listed by ', 'framework') . esc_attr($author_role) . '">' . esc_attr($author_role) . '</abbr></span>';
                    if ($img_src != '') {
                        $output .= '<a href="' . esc_url(add_query_arg($additional_spec_slug, $additional_specs_all[$this_key]['imic_plugin_specification_values'], $browse_listing)) . '" title="' . __('View all', 'framework') . esc_attr($additional_specs_all[$this_key]['imic_plugin_specification_values']) . '" class="vehicle-body-type"><img src="' . esc_url($additional_specs_all[$this_key]['imic_plugin_spec_image']) . '" alt=""></a>';
                    }
                    $output .= '<span class="vehicle-cost">' . esc_attr($unique_value) . '</span>';
                    if ($category_rail == "1" && is_plugin_active("imi-classifieds/imi-classified.php")) {
                        $output .= imic_get_cats_list($most, "list");
                    }
                    $output .= '</div>
        		</div>
        		</li>';
                    if ($starts == $number) {
                        break;
                    }
                    $starts++;
                }
            }
            $output .= '</ul>
                            </div>
                        </div>
                    </div>
                </section>';
        }
    }
    return $output;
}
Example #6
0
</a>
                                                <span class="price"><?php 
    echo esc_attr($unique_value);
    ?>
</span>
                                           	</div>
                                            <div id="eight" class="delete session-save-car"><a href="#"><i class="icon-delete"></i></a></div>
                                        </li><?php 
}
if (!empty($_SESSION['viewed_vehicle_id3'])) {
    $highlighted_specs = $imic_options['highlighted_specs'];
    $new_highlighted_specs = imic_filter_lang_specs_admin($highlighted_specs, $_SESSION['viewed_vehicle_id3']);
    $highlighted_specs = $new_highlighted_specs;
    $unique_specs = $imic_options['unique_specs'];
    $specifications = get_post_meta($_SESSION['viewed_vehicle_id3'], 'feat_data', true);
    $unique_value = imic_vehicle_price($_SESSION['viewed_vehicle_id3'], $unique_specs, $specifications);
    $highlight_value = imic_vehicle_title($_SESSION['viewed_vehicle_id3'], $highlighted_specs, $specifications);
    ?>
                                        <li>
                                        	<div class="checkb"><input value="0" id="view-<?php 
    echo esc_attr($_SESSION["viewed_vehicle_id3"]);
    ?>
" class="compare-viewed" type="checkbox"></div>
                                            <div class="imageb"><a href="<?php 
    echo esc_url(get_permalink($_SESSION['viewed_vehicle_id3']));
    ?>
"><?php 
    echo get_the_post_thumbnail($_SESSION['viewed_vehicle_id3']);
    ?>
</a></div>
                                            <div class="textb">
Example #7
0
 function imic_price_guide()
 {
     //echo "sai";
     global $imic_options;
     $get_id = $_POST['id'];
     $match_speci = isset($imic_options['price_guide_specifications']) ? $imic_options['price_guide_specifications'] : array();
     $find_vals = isset($imic_options['find_guide_specifications']) ? $imic_options['find_guide_specifications'] : '';
     $specification = get_post_meta($get_id, 'feat_data', true);
     $query = array();
     if (!empty($match_speci)) {
         foreach ($match_speci as $match) {
             $integer = get_post_meta($match, 'imic_plugin_spec_char_type', true);
             $value_label = get_post_meta($match, 'imic_plugin_value_label', true);
             $detailed_spec_key = array_search($match, $specification['sch_title']);
             $second_key = array_search($match * 111, $specification['sch_title']);
             $slug = imic_the_slug($match);
             if ($integer == 1) {
                 $query[] = "int_" . $slug;
             } else {
                 $query[] = $slug;
                 if (is_int($second_key)) {
                     $query[] = $value_label;
                 }
             }
         }
         $query_vars = imic_search_match($get_id, $match_speci, $specification);
         $query_val = array_combine($query, $query_vars);
         $count = 1;
         $arrays = array();
         //print_r($query_val);
         if (!empty($query_val)) {
             foreach ($query_val as $key => $value) {
                 if (!get_query_var($key)) {
                     if (strpos($key, 'int') !== false) {
                         $arrays[$count] = array('key' => $key, 'value' => $value, 'compare' => '<=', 'type' => 'numeric');
                     } else {
                         $arrays[$count] = array('key' => 'feat_data', 'value' => urldecode($value), 'compare' => 'LIKE');
                     }
                 }
                 $count++;
             }
         }
         $arr = array();
         $args_cars = array('post_type' => 'yahcts', 'meta_query' => $arrays, 'posts_per_page' => 10, 'post_status' => 'publish');
         $cars_listing = new WP_Query($args_cars);
         if ($cars_listing->have_posts()) {
             while ($cars_listing->have_posts()) {
                 $cars_listing->the_post();
                 $specifications = get_post_meta(get_the_ID(), 'feat_data', true);
                 $arr[] = imic_vehicle_price(get_the_ID(), $find_vals, $specifications);
             }
         } else {
             echo __('Sorry, No Idea for this listing', 'framework');
         }
         wp_reset_postdata();
         if (!empty($arr)) {
             if (count($arr) > 1) {
                 $min = min($arr);
                 $max = max($arr);
                 echo __('between ', 'framework') . $min . ' - ' . $max;
             } else {
                 echo __('Appx ', 'framework') . $arr[0];
             }
         }
     } else {
         echo __('Sorry, No Idea for this listing', 'framework');
     }
     die;
 }