Пример #1
0
                $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);
                ?>
                                    <li class="item">
                                        <div class="vehicle-block format-standard">
                                        <?php 
                if (has_post_thumbnail()) {
                    ?>
                                            <a href="<?php 
                    echo esc_url(get_permalink());
                    ?>
" class="media-box"><?php 
                    the_post_thumbnail('210x210');
                    ?>
</a><?php 
                }
                ?>
Пример #2
0
Файл: cars.php Проект: 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'];
    }
Пример #3
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;
}
Пример #4
0
</td>
                                            </tr>
                                        </thead>
                                        <tbody>
                                        <?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 -->
Пример #5
0
    function imic_matched_results()
    {
        $vals = isset($_POST['values']) ? $_POST['values'] : '';
        $ids = isset($_POST['ids']) ? $_POST['ids'] : '';
        $posts_page = -1;
        //echo "sai";
        array_pop($vals);
        global $imic_options;
        $arrays = array();
        if (is_array($ids) && is_array($vals)) {
            $data = array_combine($ids, $vals);
            //print_r($data);
            if (!empty($data)) {
                $count = 1;
                foreach ($data as $key => $value) {
                    if (strpos($key, 'int') !== false) {
                        $arrays[$count] = array('key' => $key, 'value' => $value, 'compare' => '<=', 'type' => 'numeric');
                    } else {
                        $arrays[$count] = array('key' => 'feat_data', 'value' => $value, 'compare' => 'LIKE');
                    }
                    $count++;
                }
                //}
                $arrays[$count + 1] = array('key' => 'imic_plugin_ad_payment_status', 'value' => '1', 'compare' => '=');
            }
            $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();
            }
            if ($specification_type == 0) {
                $detailed_specs = $imic_options['specification_list'];
            } else {
                $detailed_specs = array();
            }
            $highlighted_specs = $imic_options['highlighted_specs'];
            $args_cars = array('post_type' => 'yachts', 'meta_query' => $arrays, 'posts_per_page' => -1, 'post_status' => 'publish');
            $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);
                    }
                    $specifications = get_post_meta(get_the_ID(), 'feat_data', true);
                    $details_value = imic_vehicle_all_specs(get_the_ID(), $detailed_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 == '' ? get_the_title(get_the_ID()) : $highlight_value;
                    ?>
                <!-- Result Item -->
                <div class="search-find-results">
                <h5><?php 
                    echo esc_attr($highlight_value);
                    ?>
</h5>
                <ul class="inline">
                <?php 
                    foreach ($details_value as $detail) {
                        echo '<li>' . $detail . '</li>';
                    }
                    ?>
                </ul>
                <button id="matched-<?php 
                    echo get_the_ID() + 2648;
                    ?>
" class="btn btn-info btn-sm save-searched-value">Select &amp; continue</button>
                </div><?php 
                }
            } else {
                ?>
        <div class="search-find-results">
        <h5><?php 
                _e('No Match Found', 'framework');
                ?>
</h5>
        </ul>
        <a data-toggle="tab" href="#addcustom"><?php 
                _e('Continue with Custom Details', 'framework');
                ?>
</a>
        </div>
    <?php 
            }
            wp_reset_postdata();
        } else {
            ?>
        <div class="search-find-results">
        <h5><?php 
            _e('No Match Found', 'framework');
            ?>
</h5>
        </ul>
        <a data-toggle="tab" href="#addcustom"><?php 
            _e('Continue with Custom Details', 'framework');
            ?>
</a>
        </div>
<?php 
        }
        die;
    }