$javo_this_filter_taxoomies[] = 'item_category'; } if ($javo_tso->get('map_wide_hide_location', 'on') != 'off') { $javo_this_filter_taxoomies[] = 'item_location'; } $mail_alert_msg = array('to_null_msg' => __('Please, insert recipient`s email address.', 'javo_fr'), 'from_null_msg' => __('Please, insert sender`s email address.', 'javo_fr'), 'subject_null_msg' => __('Please, insert your name.', 'javo_fr'), 'content_null_msg' => __('Please, insert message content.', 'javo_fr'), 'failMsg' => __('Sorry, your message could not be sent.', 'javo_fr'), 'successMsg' => __('Successfully sent!', 'javo_fr'), 'confirmMsg' => __('Do you want to send this message?', 'javo_fr')); // Setup Agrumnets $javo_this_posts_args = array('post_status' => 'publish', 'post_type' => 'item', 'posts_per_page' => -1, 'suppress_filters ' => false); // Return Variables $javo_this_return = array(); // Queries Loop $javo_this_posts = get_posts($javo_this_posts_args); foreach ($javo_this_posts as $post) { setup_postdata($post); $javo_meta_query = new javo_get_meta($post->ID); $javo_latlng = @unserialize($javo_meta_query->_get('latlng', array())); $javo_latlng = new javo_ARRAY($javo_latlng); $javo_set_icon = ''; $javo_marker_term_id = wp_get_post_terms($post->ID, 'item_category'); if (!empty($javo_marker_term_id)) { $javo_set_icon = get_option('javo_item_category_' . $javo_marker_term_id[0]->term_id . '_marker', ''); if ($javo_set_icon == '') { $javo_set_icon = $javo_tso->get('map_marker', ''); } } $javo_this_return[$post->ID] = array('post_title' => $post->post_title, 'contents' => javo_str_cut($post->content, 300), 'thumbnail' => get_the_post_thumbnail($post->ID, array(50, 50)), 'permalink' => get_permalink($post->ID), 'category' => $javo_meta_query->cat('item_category', __('No Category', 'javo_fr')), 'location' => $javo_meta_query->cat('item_location', __('No Location', 'javo_fr')), 'lat' => $javo_latlng->get('lat'), 'lng' => $javo_latlng->get('lng'), 'icon' => $javo_set_icon, 'phone' => $javo_meta_query->get('phone'), 'address' => $javo_meta_query->get('address'), 'mobile' => $javo_meta_query->get('mobile'), 'website' => $javo_meta_query->get('website'), 'email' => $javo_meta_query->get('email'), 'rating' => $javo_meta_query->get_child_count('ratings'), 'review' => $javo_meta_query->get_child_count('review')); } wp_reset_postdata(); ?> <!-- Javo Map Options -->
static function javo_map_callback() { // Get Theme Settings global $javo_tso, $javo_tso_map, $javo_favorite; // Get Parameter of Queries $javo_query = new javo_array($_POST); // Setup Agrumnets $javo_this_posts_args = array('post_status' => 'publish', 'post_type' => $javo_query->get('post_type', 'post'), 'posts_per_page' => $javo_query->get('ppp', 10), 'paged' => (int) $javo_query->get('current', 1), 'order' => $javo_query->get('order', 'DESC')); // WPML if ($javo_query->get('lang', null) != null) { global $sitepress; if (!empty($sitepress)) { $sitepress->switch_lang($javo_query->get('lang'), true); } } // Apply Filter if ($javo_query->get('filter', null) != null) { if (is_Array($javo_query->get('filter'))) { foreach ($javo_query->get('filter') as $taxonomy => $terms) { if (!empty($terms)) { $javo_this_posts_args['tax_query']['relation'] = 'AND'; $javo_this_posts_args['tax_query'][] = array('taxonomy' => $taxonomy, 'field' => 'term_id', 'terms' => $terms); } } } } // Set Keyword if ($javo_query->get('keyword', null) != null) { $javo_this_posts_args['s'] = $javo_query->get('keyword'); } switch ($javo_query->get('panel', 'list')) { case 'featured': $javo_this_posts_args['meta_query']['relation'] = 'AND'; $javo_this_posts_args['meta_query'][] = array('key' => 'javo_this_featured_item', 'compare' => '=', 'value' => 'use'); break; case 'favorite': $javo_this_posts_args = array('post_type' => $javo_query->get('post_type', 'post')); $javo_this_user_favorite = (array) get_user_meta(get_current_user_id(), 'favorites', true); $javo_this_user_favorite_posts = array('0'); if (!empty($javo_this_user_favorite)) { foreach ($javo_this_user_favorite as $favorite) { if (!empty($favorite['post_id'])) { $javo_this_user_favorite_posts[] = $favorite['post_id']; } } // End foreach } // End if $javo_this_posts_args['post__in'] = (array) $javo_this_user_favorite_posts; break; case 'list': default: } // Set Read More if ($javo_query->get('offset', null) != null) { $javo_this_posts_args['offset'] = $javo_query->get('offset'); } // Return Variables $javo_this_return = array(); // Queries Loop $javo_this_posts = new WP_Query($javo_this_posts_args); if ($javo_this_posts->have_posts()) { while ($javo_this_posts->have_posts()) { $javo_this_posts->the_post(); $javo_meta_query = new javo_get_meta(get_the_ID()); $javo_rating = new javo_RATING(get_the_ID()); $javo_latlng = @unserialize($javo_meta_query->_get('latlng', array())); $javo_latlng = new javo_ARRAY($javo_latlng); $javo_set_icon = ''; $javo_marker_term_id = wp_get_post_terms(get_the_ID(), 'item_category'); if (!empty($javo_marker_term_id)) { $javo_set_icon = get_option('javo_item_category_' . $javo_marker_term_id[0]->term_id . '_marker', ''); if ($javo_set_icon == '') { $javo_set_icon = $javo_tso->get('map_marker', ''); } } $javo_this_thumbnail = get_the_post_thumbnail(get_the_ID(), array(50, 50)); $javo_this_thumbnail = $javo_this_thumbnail != '' ? $javo_this_thumbnail : sprintf('<img src="%s" class="img-responsive wp-post-image" style="width:50px; height:50px;">', $javo_tso->get('no_image', JAVO_IMG_DIR . '/no-image.png')); $javo_this_thumbnail_large = get_the_post_thumbnail(get_the_ID(), 'javo-box-v', array('class' => 'group list-group-image item-thumbs')); $javo_this_thumbnail_large = $javo_this_thumbnail_large != '' ? $javo_this_thumbnail_large : sprintf('<img src="%s" style="width:100%%; height:219px;">', $javo_tso->get('no_image', JAVO_IMG_DIR . '/no-image.png')); $javo_this_author_avatar_id = get_the_author_meta('avatar'); $javo_this_author_avatar = wp_get_attachment_image($javo_this_author_avatar_id, 'javo-tiny', true, array('class' => 'img-circle', 'style' => 'width:50px; height:50px;')); $javo_this_return[get_the_ID()] = array('post_title' => get_the_title(), 'contents' => javo_str_cut(strip_shortcodes(get_the_excerpt()), 300), 'thumbnail' => $javo_this_thumbnail, 'thumbnail_large' => $javo_this_thumbnail_large, 'avatar' => $javo_this_author_avatar, 'author_name' => get_the_author_meta('display_name'), 'permalink' => get_permalink(), 'category' => $javo_meta_query->cat('item_category', __('No Category', 'javo_fr')), 'location' => $javo_meta_query->cat('item_location', __('No Location', 'javo_fr')), 'favorite' => $javo_favorite->on(get_the_ID(), ' saved'), 'lat' => $javo_latlng->get('lat'), 'lng' => $javo_latlng->get('lng'), 'icon' => $javo_set_icon, 'phone' => $javo_meta_query->get('phone'), 'mobile' => $javo_meta_query->get('mobile'), 'website' => $javo_meta_query->get('website'), 'email' => $javo_meta_query->get('email'), 'address' => $javo_meta_query->get('address'), 'rating' => $javo_rating->parent_rating_average, 'rating_count' => $javo_meta_query->get_child_count('ratings'), 'review_count' => $javo_meta_query->get_child_count('review')); } } wp_reset_query(); $javo_this_pagination = ''; if ($javo_query->get('pagination') == 'read_more') { $javo_this_pagination = sprintf('<a class="btn btn-primary btn-block javo-wide-map-read-more">%s</a>', __('Read More', 'javo_fr')); } else { $javo_this_pagination = sprintf('<div class="javo_pagination">%s</div>', paginate_links(array('base' => "%_%", 'format' => '?%#%', 'current' => (int) $javo_query->get('current', 1), 'total' => $javo_this_posts->max_num_pages))); } echo json_encode(array('state' => 'success', 'result' => $javo_this_return, 'pagination' => $javo_this_pagination)); exit; }
public static function javo_item_option_box($post) { global $javo_tso; $javo_ts_map = new javo_ARRAY((array) $javo_tso->get('map', array())); $javo_meta = new javo_get_meta($post->ID); $javo_latLng = new javo_ARRAY(@unserialize($javo_meta->_get('latlng'))); ob_start(); ?> <table class="form-table"> <tr> <th colspan="2"><?php _e('Additional Item Information', 'javo_fr'); ?> </th> </tr> <tr> <th><?php _e('Address', 'javo_fr'); ?> </th> <td><input name="javo_pt[meta][address]" value="<?php echo $javo_meta->get('address'); ?> "></td> </tr> <tr> <th><?php _e('Telephone', 'javo_fr'); ?> </th> <td><input name="javo_pt[meta][phone]" value="<?php echo $javo_meta->get('phone'); ?> "></td> </tr> <tr> <th><?php _e('Email Address', 'javo_fr'); ?> </th> <td><input name="javo_pt[meta][email]" value="<?php echo $javo_meta->get('email'); ?> "></td> </tr> <tr> <th><?php _e('Website Address', 'javo_fr'); ?> </th> <td><input name="javo_pt[meta][website]" value="<?php echo $javo_meta->get('website'); ?> "></td> </tr> <tr> <th><?php _e('Video', 'javo_fr'); ?> </th> <td> <?php $javo_video_portals = array('youtube', 'vimeo', 'dailymotion', 'yahoo', 'bliptv', 'veoh', 'viddler'); $javo_get_video_meta = (array) get_post_meta($post->ID, 'video', true); $javo_video_meta = new javo_ARRAY($javo_get_video_meta); $javo_get_video = array("portal" => $javo_video_meta->get('portal', NULL), "video_id" => $javo_video_meta->get('video_id', NULL)); $javo_this_selbox_options = array(__('With slider (first)', 'javo_fr') => 'slide', __('Header ( only "Youtube", "vimeo")', 'javo_fr') => 'header', __('After Description Section', 'javo_fr') => 'descript', __('After Contact Section', 'javo_fr') => 'contact', __('Hide / Disable', 'javo_fr') => 'disabled'); ?> <select name="javo_video[portal]"> <option value=""><?php _e('None', 'javo_fr'); ?> </option> <?php foreach ($javo_video_portals as $portal) { printf('<option value="%s"%s>%s</option>', $portal, $portal == $javo_get_video['portal'] ? ' selected' : '', $portal); } ?> </select> <input name="javo_video[video_id]" value="<?php echo $javo_get_video['video_id']; ?> "> <div class="javo_iclbox_wrap"> <br> <h4><?php _e('Video Location', 'javo_fr'); ?> </h4> <div> <select name="javo_video[single_position]"> <?php foreach ($javo_this_selbox_options as $text => $value) { printf('<option value="%s"%s>%s</option>', $value, $javo_video_meta->get('single_position', '') == $value ? ' selected' : '', $text); } ?> </select> </div> </div> </td> </tr> <tr> <th><?php _e('Item Location', 'javo_fr'); ?> </th> <td> <input class="javo_txt_find_address" type="text"><a class="button javo_btn_find_address"><?php _e('Find', 'javo_fr'); ?> </a> <div class="javo-item-map-container"></div> <?php echo "Latitude : <input name='javo_pt[map][lat]' value='{$javo_latLng->get('lat')}' type='text' class='only-number'>" . ', '; echo "Longitude : <input name='javo_pt[map][lng]' value='{$javo_latLng->get('lng')}' type='text' class='only-number'>"; ?> </td> </tr> <tr> <th><?php _e('StreetView', 'javo_fr'); ?> </th> <td> <label> <input type="checkbox" name="javo_pt[map][street_visible]" value="1" <?php checked(1 == $javo_latLng->get('street_visible', 0)); ?> > <?php _e("Use StreetView", 'javo_fr'); ?> </labeL> <div class="javo-item-streetview-container<?php echo $javo_latLng->get('street_visible', 0) == 0 ? ' hidden' : ''; ?> "></div> <fieldset class="hidden"> <?php echo "Latitude : <input name='javo_pt[map][street_lat]' value='{$javo_latLng->get('street_lat', 0)}' type='text'>"; echo "Longitude : <input name='javo_pt[map][street_lng]' value='{$javo_latLng->get('street_lng', 0)}' type='text'>"; echo "Heading : <input name='javo_pt[map][street_heading]' value='{$javo_latLng->get('street_heading', 0)}' type='text'>"; echo "pitch: <input name='javo_pt[map][street_pitch]' value='{$javo_latLng->get('street_pitch', 0)}' type='text'>"; echo "zoom : <input name='javo_pt[map][street_zoom]' value='{$javo_latLng->get('street_zoom', 0)}' type='text'>"; ?> </fieldset> </td> </tr> <tr> <th><?php _e('Description Images', 'javo_fr'); ?> </th> <td> <div class=""> <a href="javascript:" class="button button-primary javo_pt_detail_add"><?php _e('Add Images', 'javo_fr'); ?> </a> </div> <div class="javo_pt_images"> <?php $images = @unserialize(get_post_meta($post->ID, "detail_images", true)); if (is_Array($images)) { foreach ($images as $iamge => $src) { $url = wp_get_attachment_image_src($src, 'thumbnail'); printf("\r\n\t\t\t\t\t\t\t\t<div class='javo_pt_field' style='float:left;'>\r\n\t\t\t\t\t\t\t\t\t<img src='%s'><input name='javo_pt_detail[]' value='%s' type='hidden'>\r\n\t\t\t\t\t\t\t\t\t<div class='' align='center'>\r\n\t\t\t\t\t\t\t\t\t\t<input class='javo_pt_detail_del button' type='button' value='Delete'>\r\n\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t", $url[0], $src); } } ?> </div> </td> </tr> <tr> <th><?php _e('Custom Field Information', 'javo_fr'); ?> </th> <td> <?php global $javo_custom_field, $edit; $edit = $post; echo $javo_custom_field->form(); ?> </td> </tr> </table> <?php ob_end_flush(); }