Example #1
0
    ?>
',
                                imageBtnNext: '<?php 
    echo geodir_plugin_url() . '/geodirectory-assets/images/lightbox-btn-next.gif';
    ?>
',
                                imageBtnPrev: '<?php 
    echo geodir_plugin_url() . '/geodirectory-assets/images/lightbox-btn-prev.gif';
    ?>
',
                                imageBtnClose: '<?php 
    echo geodir_plugin_url() . '/geodirectory-assets/images/lightbox-btn-close.gif';
    ?>
',
                                imageBlank: '<?php 
    echo geodir_plugin_url() . '/geodirectory-assets/images/lightbox-blank.gif';
    ?>
'
                            });
                        });
                    </script>
                <?php 
}
?>
                <!-- Post info tabs start -->
                <?php 
geodir_show_detail_page_tabs();
?>
                <?php 
/**
 * Called after the tabs section on the add listing preview template.
/**
 * Returns the recent reviews.
 *
 * @since 1.0.0
 * @package GeoDirectory
 * @param int $g_size Optional. Avatar size in pixels. Default 60.
 * @param int $no_comments Optional. Number of reviews you want to display. Default: 10.
 * @param int $comment_lenth Optional. Maximum number of characters you want to display. After that read more link will appear.
 * @param bool $show_pass_post Optional. Not yet implemented.
 * @global object $wpdb WordPress Database object.
 * @return string Returns the recent reviews html.
 */
function geodir_get_recent_reviews($g_size = 60, $no_comments = 10, $comment_lenth = 60, $show_pass_post = false)
{
    global $wpdb, $tablecomments, $tableposts, $rating_table_name;
    $tablecomments = $wpdb->comments;
    $tableposts = $wpdb->posts;
    $comments_echo = '';
    //print_r($_SESSION);
    $city_filter = '';
    $region_filter = '';
    $country_filter = '';
    if (isset($_SESSION['gd_multi_location'])) {
        if (isset($_SESSION['gd_country']) && $_SESSION['gd_country']) {
            $country_filter = $wpdb->prepare(" AND r.post_country=%s ", str_replace("-", " ", $_SESSION['gd_country']));
        }
        if (isset($_SESSION['gd_region']) && $_SESSION['gd_region']) {
            $region_filter = $wpdb->prepare(" AND r.post_region=%s ", str_replace("-", " ", $_SESSION['gd_region']));
        }
        if (isset($_SESSION['gd_city']) && $_SESSION['gd_city']) {
            $city_filter = $wpdb->prepare(" AND r.post_city=%s ", str_replace("-", " ", $_SESSION['gd_city']));
        }
    }
    /*if(isset($_SESSION['all_near_me'])){
    
            $mylat = $_SESSION['user_lat'];
            $mylon = $_SESSION['user_lon'];
    
            if(isset($_SESSION['near_me_range']) && is_numeric($_SESSION['near_me_range'])){$dist =$_SESSION['near_me_range']; }
            elseif(get_option('geodir_near_me_dist')!=''){$dist = get_option('geodir_near_me_dist');}
            else{ $dist = '200';  }
    
            $lon1 = $mylon- $dist/abs(cos(deg2rad($mylat))*69);
            $lon2 = $mylon+$dist/abs(cos(deg2rad($mylat))*69);
            $lat1 = $mylat-($dist/69);
            $lat2 = $mylat+($dist/69);
    
            $rlon1 = is_numeric(min($lon1,$lon2)) ? min($lon1,$lon2) : '';
            $rlon2 = is_numeric(max($lon1,$lon2)) ? max($lon1,$lon2) : '';
            $rlat1 = is_numeric(min($lat1,$lat2)) ? min($lat1,$lat2) : '';
            $rlat2 = is_numeric(max($lat1,$lat2)) ? max($lat1,$lat2) : '';
    
            $country_filter ='';
            $region_filter = '';
            $city_filter = " AND post_latitude between $rlat1 and $rlat2
            AND post_longitude between $rlon1 and $rlon2 ";
    
            $join =
    
        }*/
    $review_table = GEODIR_REVIEW_TABLE;
    $request = "SELECT r.id as ID, r.post_type, r.comment_id as comment_ID, r.post_date as comment_date,r.overall_rating, r.user_id, r.post_id FROM {$review_table} as r WHERE r.post_status = 1 AND r.status =1 AND r.overall_rating>=1 {$country_filter} {$region_filter} {$city_filter} ORDER BY r.post_date DESC, r.id DESC LIMIT {$no_comments}";
    //$request = "SELECT r.*,c.* FROM $review_table r JOIN $wpdb->comments c ON r.comment_ID=c.comment_ID WHERE r.post_status = 1 AND r.status =1 $country_filter $region_filter $city_filter ORDER BY r.post_date DESC, r.id DESC LIMIT $no_comments";
    //echo $request;
    $comments = $wpdb->get_results($request);
    foreach ($comments as $comment) {
        // Set the extra comment info needed.
        $comment_extra = $wpdb->get_row("SELECT * FROM {$wpdb->comments} WHERE comment_ID ={$comment->comment_ID}");
        //echo "SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID";
        $comment->comment_content = $comment_extra->comment_content;
        $comment->comment_author = $comment_extra->comment_author;
        $comment->comment_author_email = $comment_extra->comment_author_email;
        $comment_id = '';
        $comment_id = $comment->comment_ID;
        $comment_content = strip_tags($comment->comment_content);
        $comment_content = preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content);
        $permalink = get_permalink($comment->ID) . "#comment-" . $comment->comment_ID;
        $comment_author_email = $comment->comment_author_email;
        $comment_post_ID = $comment->post_id;
        $na = true;
        if (function_exists('icl_object_id') && icl_object_id($comment_post_ID, $comment->post_type, true)) {
            $comment_post_ID2 = icl_object_id($comment_post_ID, $comment->post_type, false);
            if ($comment_post_ID == $comment_post_ID2) {
            } else {
                $na = false;
            }
        }
        $post_title = get_the_title($comment_post_ID);
        $permalink = get_permalink($comment_post_ID);
        $comment_permalink = $permalink . "#comment-" . $comment->comment_ID;
        $read_more = '<a class="comment_excerpt" href="' . $comment_permalink . '">' . __('Read more', 'geodirectory') . '</a>';
        $comment_content_length = strlen($comment_content);
        if ($comment_content_length > $comment_lenth) {
            $comment_excerpt = mb_substr($comment_content, 0, $comment_lenth) . '... ' . $read_more;
        } else {
            $comment_excerpt = $comment_content;
        }
        if ($comment->user_id) {
            $user_profile_url = get_author_posts_url($comment->user_id);
        } else {
            $user_profile_url = '';
        }
        if ($comment_id && $na) {
            $comments_echo .= '<li class="clearfix">';
            $comments_echo .= "<span class=\"li" . $comment_id . " geodir_reviewer_image\">";
            if (function_exists('get_avatar')) {
                if (!isset($comment->comment_type)) {
                    if ($user_profile_url) {
                        $comments_echo .= '<a href="' . $user_profile_url . '">';
                    }
                    $comments_echo .= get_avatar($comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png');
                    if ($user_profile_url) {
                        $comments_echo .= '</a>';
                    }
                } elseif (isset($comment->comment_type) && $comment->comment_type == 'trackback' || isset($comment->comment_type) && $comment->comment_type == 'pingback') {
                    if ($user_profile_url) {
                        $comments_echo .= '<a href="' . $user_profile_url . '">';
                    }
                    $comments_echo .= get_avatar($comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png');
                }
            } elseif (function_exists('gravatar')) {
                if ($user_profile_url) {
                    $comments_echo .= '<a href="' . $user_profile_url . '">';
                }
                $comments_echo .= "<img src=\"";
                if ('' == $comment->comment_type) {
                    $comments_echo .= gravatar($comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png');
                    if ($user_profile_url) {
                        $comments_echo .= '</a>';
                    }
                } elseif ('trackback' == $comment->comment_type || 'pingback' == $comment->comment_type) {
                    if ($user_profile_url) {
                        $comments_echo .= '<a href="' . $user_profile_url . '">';
                    }
                    $comments_echo .= gravatar($comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png');
                    if ($user_profile_url) {
                        $comments_echo .= '</a>';
                    }
                }
                $comments_echo .= "\" alt=\"\" class=\"avatar\" />";
            }
            $comments_echo .= "</span>\n";
            $comments_echo .= '<span class="geodir_reviewer_content">';
            if ($comment->user_id) {
                $comments_echo .= '<a href="' . get_author_posts_url($comment->user_id) . '">';
            }
            $comments_echo .= '<span class="geodir_reviewer_author">' . $comment->comment_author . '</span> ';
            if ($comment->user_id) {
                $comments_echo .= '</a>';
            }
            $comments_echo .= '<span class="geodir_reviewer_reviewed">' . __('reviewed', 'geodirectory') . '</span> ';
            $comments_echo .= '<a href="' . $permalink . '" class="geodir_reviewer_title">' . $post_title . '</a>';
            $comments_echo .= geodir_get_rating_stars($comment->overall_rating, $comment_post_ID);
            $comments_echo .= '<p class="geodir_reviewer_text">' . $comment_excerpt . '';
            //echo preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_excerpt);
            $comments_echo .= '</p>';
            $comments_echo .= "</span>\n";
            $comments_echo .= '</li>';
        }
    }
    return $comments_echo;
}
/**
 * Update default rating star icon.
 *
 * @since 1.0.0
 * @package GeoDirectory
 */
function geodir_default_rating_star_icon()
{
    if (!get_option('geodir_default_rating_star_icon')) {
        update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
    }
}
/**
 * Register default custom Post Types and Taxonomies.
 *
 * @since 1.0.0
 * @package GeoDirectory
 * @global object $wpdb WordPress Database object.
 */
function geodir_register_defaults()
{
    global $wpdb;
    $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico';
    if (!($listing_slug = get_option('geodir_listing_prefix'))) {
        $listing_slug = 'places';
    }
    $gd_placetags = array();
    $gd_placetags['object_type'] = 'gd_place';
    $gd_placetags['listing_slug'] = $listing_slug . '/tags';
    $gd_placetags['args'] = array('public' => true, 'hierarchical' => false, 'rewrite' => array('slug' => $listing_slug . '/tags', 'with_front' => false, 'hierarchical' => true), 'query_var' => true, 'labels' => array('name' => __('Place Tags', 'geodirectory'), 'singular_name' => __('Place Tag', 'geodirectory'), 'search_items' => __('Search Place Tags', 'geodirectory'), 'popular_items' => __('Popular Place Tags', 'geodirectory'), 'all_items' => __('All Place Tags', 'geodirectory'), 'edit_item' => __('Edit Place Tag', 'geodirectory'), 'update_item' => __('Update Place Tag', 'geodirectory'), 'add_new_item' => __('Add New Place Tag', 'geodirectory'), 'new_item_name' => __('New Place Tag Name', 'geodirectory'), 'add_or_remove_items' => __('Add or remove Place tags', 'geodirectory'), 'choose_from_most_used' => __('Choose from the most used Place tags', 'geodirectory'), 'separate_items_with_commas' => __('Separate Place tags with commas', 'geodirectory')));
    $geodir_taxonomies = get_option('geodir_taxonomies');
    $geodir_taxonomies['gd_place_tags'] = $gd_placetags;
    update_option('geodir_taxonomies', $geodir_taxonomies);
    // Update post types and delete tmp options
    flush_rewrite_rules();
    $gd_placecategory = array();
    $gd_placecategory['object_type'] = 'gd_place';
    $gd_placecategory['listing_slug'] = $listing_slug;
    $gd_placecategory['args'] = array('public' => true, 'hierarchical' => true, 'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true), 'query_var' => true, 'labels' => array('name' => __('Place Categories', 'geodirectory'), 'singular_name' => __('Place Category', 'geodirectory'), 'search_items' => __('Search Place Categories', 'geodirectory'), 'popular_items' => __('Popular Place Categories', 'geodirectory'), 'all_items' => __('All Place Categories', 'geodirectory'), 'edit_item' => __('Edit Place Category', 'geodirectory'), 'update_item' => __('Update Place Category', 'geodirectory'), 'add_new_item' => __('Add New Place Category', 'geodirectory'), 'new_item_name' => __('New Place Category', 'geodirectory'), 'add_or_remove_items' => __('Add or remove Place categories', 'geodirectory')));
    $geodir_taxonomies = get_option('geodir_taxonomies');
    $geodir_taxonomies['gd_placecategory'] = $gd_placecategory;
    update_option('geodir_taxonomies', $geodir_taxonomies);
    flush_rewrite_rules();
    $labels = array('name' => __('Places', 'geodirectory'), 'singular_name' => __('Place', 'geodirectory'), 'add_new' => __('Add New', 'geodirectory'), 'add_new_item' => __('Add New Place', 'geodirectory'), 'edit_item' => __('Edit Place', 'geodirectory'), 'new_item' => __('New Place', 'geodirectory'), 'view_item' => __('View Place', 'geodirectory'), 'search_items' => __('Search Places', 'geodirectory'), 'not_found' => __('No Place Found', 'geodirectory'), 'not_found_in_trash' => __('No Place Found In Trash', 'geodirectory'));
    $place_default = array('labels' => $labels, 'can_export' => true, 'capability_type' => 'post', 'description' => 'Place post type.', 'has_archive' => $listing_slug, 'hierarchical' => false, 'map_meta_cap' => true, 'menu_icon' => $menu_icon, 'public' => true, 'query_var' => true, 'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true), 'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments'), 'taxonomies' => array('gd_placecategory', 'gd_place_tags'));
    //Update custom post types
    $geodir_post_types = get_option('geodir_post_types');
    $geodir_post_types['gd_place'] = $place_default;
    update_option('geodir_post_types', $geodir_post_types);
    // Update post types and delete tmp options
    flush_rewrite_rules();
    geodir_register_taxonomies();
    geodir_register_post_types();
    //die;
}
/**
 * Handles loading of all geodirectory stylesheets and its dependencies.
 *
 * @since 1.0.0
 * @package GeoDirectory
 */
function geodir_templates_styles()
{
    if (get_option('geodir_scss_core')) {
        wp_register_style('geodirectory-frontend-style', geodir_plugin_url() . '/geodirectory-assets/css/style.css', array(), GEODIRECTORY_VERSION);
        wp_enqueue_style('geodirectory-frontend-style');
        wp_register_style('geodirectory-media-style', geodir_plugin_url() . '/geodirectory-assets/css/media.css', array(), GEODIRECTORY_VERSION);
        wp_enqueue_style('geodirectory-media-style');
        wp_register_style('geodirectory-jquery-ui-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery-ui.css', array(), GEODIRECTORY_VERSION);
        wp_enqueue_style('geodirectory-jquery-ui-css');
        wp_register_style('geodirectory-jquery-ui-timepicker-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery.ui.timepicker.css', array(), GEODIRECTORY_VERSION);
        wp_enqueue_style('geodirectory-jquery-ui-timepicker-css');
        wp_register_style('geodirectory-flexslider-css', geodir_plugin_url() . '/geodirectory-assets/css/flexslider.css', array(), GEODIRECTORY_VERSION);
        wp_enqueue_style('geodirectory-flexslider-css');
        wp_register_style('geodirectory-thic-box-css', geodir_plugin_url() . '/geodirectory-assets/css/thic-box.css', array(), GEODIRECTORY_VERSION);
        wp_enqueue_style('geodirectory-thic-box-css');
        wp_register_style('geodirectory-pluplodar-css', geodir_plugin_url() . '/geodirectory-assets/css/pluploader.css', array(), GEODIRECTORY_VERSION);
        wp_enqueue_style('geodirectory-pluplodar-css');
        wp_register_style('geodirectory-lightbox-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery.lightbox-0.5.css', array(), GEODIRECTORY_VERSION);
        wp_enqueue_style('geodirectory-lightbox-css');
        wp_register_style('geodir-rating-style', geodir_plugin_url() . '/geodirectory-assets/css/jRating.jquery.css', array(), GEODIRECTORY_VERSION);
        wp_enqueue_style('geodir-rating-style');
        wp_register_style('geodir-chosen-style', geodir_plugin_url() . '/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION);
        wp_enqueue_style('geodir-chosen-style');
    } else {
        wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION);
        wp_enqueue_style('geodir-core-scss');
        wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION);
    }
    if (is_rtl()) {
        wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION);
        wp_enqueue_style('geodirectory-frontend-rtl-style');
    }
    wp_register_style('geodirectory-font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION);
    wp_enqueue_style('geodirectory-font-awesome');
}
function geodir_localize_all_share_location_js_msg()
{
    global $geodir_addon_list, $wpdb;
    $default_near_text = NEAR_TEXT;
    if ($default_near_text = get_option('geodir_near_field_default_text')) {
    }
    $arr_alert_msg = array('geodir_advanced_search_plugin_url' => GEODIRADVANCESEARCH_PLUGIN_URL, 'geodir_plugin_url' => geodir_plugin_url(), 'geodir_admin_ajax_url' => admin_url('admin-ajax.php'), 'request_param' => geodir_get_request_param(), 'msg_Near' => __("Near:", GEODIRADVANCESEARCH_TEXTDOMAIN), 'default_Near' => $default_near_text, 'msg_Me' => __("Me", GEODIRADVANCESEARCH_TEXTDOMAIN), 'unom_dist' => get_option('geodir_search_dist_1') == 'km' ? __("km", GEODIRADVANCESEARCH_TEXTDOMAIN) : __("miles", GEODIRADVANCESEARCH_TEXTDOMAIN), 'autocomplete_field_name' => get_option('geodir_autocompleter_matches_label'), 'geodir_enable_autocompleter_near' => get_option('geodir_enable_autocompleter_near'), 'geodir_enable_autocompleter' => get_option('geodir_enable_autocompleter'), 'geodir_autocompleter_autosubmit_near' => get_option('geodir_autocompleter_autosubmit_near'), 'geodir_autocompleter_autosubmit' => get_option('geodir_autocompleter_autosubmit'), 'geodir_location_manager_active' => isset($geodir_addon_list['geodir_location_manager']) ? '1' : '0', 'msg_User_defined' => __("User defined", GEODIRADVANCESEARCH_TEXTDOMAIN), 'ask_for_share_location' => apply_filters('geodir_ask_for_share_location', false), 'geodir_autolocate_disable' => get_option('geodir_autolocate_disable'), 'geodir_autolocate_ask' => get_option('geodir_autolocate_ask'), 'geodir_autolocate_ask_msg' => __('Do you wish to be geolocated to listings near you?', GEODIRADVANCESEARCH_TEXTDOMAIN), 'UNKNOWN_ERROR' => __('Unable to find your location.', GEODIRADVANCESEARCH_TEXTDOMAIN), 'PERMISSION_DENINED' => __('Permission denied in finding your location.', GEODIRADVANCESEARCH_TEXTDOMAIN), 'POSITION_UNAVAILABLE' => __('Your location is currently unknown.', GEODIRADVANCESEARCH_TEXTDOMAIN), 'BREAK' => __('Attempt to find location took too long.', GEODIRADVANCESEARCH_TEXTDOMAIN), 'DEFAUTL_ERROR' => __('Browser unable to find your location.', GEODIRADVANCESEARCH_TEXTDOMAIN), 'text_more' => __('More', GEODIRADVANCESEARCH_TEXTDOMAIN), 'text_less' => __('Less', GEODIRADVANCESEARCH_TEXTDOMAIN), 'msg_In' => __('In:', GEODIRADVANCESEARCH_TEXTDOMAIN));
    foreach ($arr_alert_msg as $key => $value) {
        if (!is_scalar($value)) {
            continue;
        }
        $arr_alert_msg[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8');
    }
    $script = "var geodir_advanced_search_js_msg = " . json_encode($arr_alert_msg) . ';';
    echo '<script>';
    echo $script;
    echo '</script>';
}
Example #7
0
/**
 * Generates listing slider HTML.
 *
 * @since 1.0.0
 * @package GeoDirectory
 * @global object $post The current post object.
 * @param array|string $args Display arguments including before_title, after_title, before_widget, and after_widget.
 * @param array|string $instance The settings for the particular instance of the widget.
 */
function geodir_listing_slider_widget_output($args = '', $instance = '')
{
    // prints the widget
    extract($args, EXTR_SKIP);
    echo $before_widget;
    /** This filter is documented in geodirectory_widgets.php */
    $title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
    /**
     * Filter the widget post type.
     *
     * @since 1.0.0
     * @param string $instance['post_type'] Post type of listing.
     */
    $post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']);
    /**
     * Filter the widget's term.
     *
     * @since 1.0.0
     * @param string $instance['category'] Filter by term. Can be any valid term.
     */
    $category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']);
    /**
     * Filter the widget listings limit.
     *
     * @since 1.0.0
     * @param string $instance['post_number'] Number of listings to display.
     */
    $post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']);
    /**
     * Filter the widget listings limit shown at one time.
     *
     * @since 1.5.0
     * @param string $instance['max_show'] Number of listings to display on screen.
     */
    $max_show = empty($instance['max_show']) ? '1' : apply_filters('widget_max_show', $instance['max_show']);
    /**
     * Filter the widget slide width.
     *
     * @since 1.5.0
     * @param string $instance['slide_width'] Width of the slides shown.
     */
    $slide_width = empty($instance['slide_width']) ? '' : apply_filters('widget_slide_width', $instance['slide_width']);
    /**
     * Filter widget's "show title" value.
     *
     * @since 1.0.0
     * @param string|bool $instance['show_title'] Do you want to display title? Can be 1 or 0.
     */
    $show_title = empty($instance['show_title']) ? '' : apply_filters('widget_show_title', $instance['show_title']);
    /**
     * Filter widget's "slideshow" value.
     *
     * @since 1.0.0
     * @param int $instance['slideshow'] Setup a slideshow for the slider to animate automatically.
     */
    $slideshow = empty($instance['slideshow']) ? 0 : apply_filters('widget_slideshow', $instance['slideshow']);
    /**
     * Filter widget's "animationLoop" value.
     *
     * @since 1.0.0
     * @param int $instance['animationLoop'] Gives the slider a seamless infinite loop.
     */
    $animationLoop = empty($instance['animationLoop']) ? 0 : apply_filters('widget_animationLoop', $instance['animationLoop']);
    /**
     * Filter widget's "directionNav" value.
     *
     * @since 1.0.0
     * @param int $instance['directionNav'] Enable previous/next arrow navigation?. Can be 1 or 0.
     */
    $directionNav = empty($instance['directionNav']) ? 0 : apply_filters('widget_directionNav', $instance['directionNav']);
    /**
     * Filter widget's "slideshowSpeed" value.
     *
     * @since 1.0.0
     * @param int $instance['slideshowSpeed'] Set the speed of the slideshow cycling, in milliseconds.
     */
    $slideshowSpeed = empty($instance['slideshowSpeed']) ? 5000 : apply_filters('widget_slideshowSpeed', $instance['slideshowSpeed']);
    /**
     * Filter widget's "animationSpeed" value.
     *
     * @since 1.0.0
     * @param int $instance['animationSpeed'] Set the speed of animations, in milliseconds.
     */
    $animationSpeed = empty($instance['animationSpeed']) ? 600 : apply_filters('widget_animationSpeed', $instance['animationSpeed']);
    /**
     * Filter widget's "animation" value.
     *
     * @since 1.0.0
     * @param string $instance['animation'] Controls the animation type, "fade" or "slide".
     */
    $animation = empty($instance['animation']) ? 'slide' : apply_filters('widget_animation', $instance['animation']);
    /**
     * Filter widget's "list_sort" type.
     *
     * @since 1.0.0
     * @param string $instance['list_sort'] Listing sort by type.
     */
    $list_sort = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']);
    $show_featured_only = !empty($instance['show_featured_only']) ? 1 : NULL;
    wp_enqueue_script('geodirectory-jquery-flexslider-js');
    ?>
    <script type="text/javascript">
        jQuery(window).load(function () {
            jQuery('#geodir_widget_carousel').flexslider({
                animation: "slide",
                selector: ".geodir-slides > li",
                namespace: "geodir-",
                controlNav: false,
                directionNav: false,
                animationLoop: false,
                slideshow: false,
                itemWidth: 75,
                itemMargin: 5,
                asNavFor: '#geodir_widget_slider',
                rtl: <?php 
    echo is_rtl() ? 'true' : 'false';
    /* fix rtl issue */
    ?>
            });

            jQuery('#geodir_widget_slider').flexslider({
                animation: "<?php 
    echo $animation;
    ?>
",
                selector: ".geodir-slides > li",
                namespace: "geodir-",
                controlNav: true,
                animationLoop: <?php 
    echo $animationLoop;
    ?>
,
                slideshow: <?php 
    echo $slideshow;
    ?>
,
                slideshowSpeed: <?php 
    echo $slideshowSpeed;
    ?>
,
                animationSpeed: <?php 
    echo $animationSpeed;
    ?>
,
                directionNav: <?php 
    echo $directionNav;
    ?>
,
                maxItems: <?php 
    echo $max_show;
    ?>
,
                <?php 
    if ($slide_width) {
        echo "itemWidth: " . $slide_width . ",";
    }
    ?>
                sync: "#geodir_widget_carousel",
                start: function (slider) {
                    jQuery('.geodir-listing-flex-loader').hide();
                    jQuery('#geodir_widget_slider').css({'visibility': 'visible'});
                    jQuery('#geodir_widget_carousel').css({'visibility': 'visible'});
                },
                rtl: <?php 
    echo is_rtl() ? 'true' : 'false';
    /* fix rtl issue */
    ?>
            });
        });
    </script>
    <?php 
    $query_args = array('posts_per_page' => $post_number, 'is_geodir_loop' => true, 'post_type' => $post_type, 'order_by' => $list_sort);
    if ($show_featured_only) {
        $query_args['show_featured_only'] = 1;
    }
    if ($category != 0 || $category != '') {
        $category_taxonomy = geodir_get_taxonomies($post_type);
        $tax_query = array('taxonomy' => $category_taxonomy[0], 'field' => 'id', 'terms' => $category);
        $query_args['tax_query'] = array($tax_query);
    }
    // we want listings with featured image only
    $query_args['featured_image_only'] = 1;
    if ($post_type == 'gd_event') {
        $query_args['gedir_event_listing_filter'] = 'upcoming';
    }
    // show only upcomming events
    $widget_listings = geodir_get_widget_listings($query_args);
    if (!empty($widget_listings) || isset($with_no_results) && $with_no_results) {
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        global $post;
        $current_post = $post;
        // keep current post info
        $widget_main_slides = '';
        $nav_slides = '';
        $widget_slides = 0;
        foreach ($widget_listings as $widget_listing) {
            global $gd_widget_listing_type;
            $post = $widget_listing;
            $widget_image = geodir_get_featured_image($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
            if (!empty($widget_image)) {
                if ($widget_image->height >= 200) {
                    $widget_spacer_height = 0;
                } else {
                    $widget_spacer_height = (200 - $widget_image->height) / 2;
                }
                $widget_main_slides .= '<li class="geodir-listing-slider-widget"><img class="geodir-listing-slider-spacer" src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:' . $widget_spacer_height . 'px !important;margin:0 auto;" width="100" />';
                $title = '';
                if ($show_title) {
                    $title = '<div class="geodir-slider-title"><a href="' . get_permalink($post->ID) . '">' . get_the_title($post->ID) . '</a></div>';
                }
                $widget_main_slides .= $title . '<img src="' . $widget_image->src . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:200px;margin:0 auto;" /></li>';
                $nav_slides .= '<li><img src="' . $widget_image->src . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
                $widget_slides++;
            }
        }
        ?>
        <div class="flex-container" style="min-height:200px;">
            <div class="geodir-listing-flex-loader"><i class="fa fa-refresh fa-spin"></i></div>
            <div id="geodir_widget_slider" class="geodir_flexslider">
                <ul class="geodir-slides clearfix"><?php 
        echo $widget_main_slides;
        ?>
</ul>
            </div>
            <?php 
        if ($widget_slides > 1) {
            ?>
                <div id="geodir_widget_carousel" class="geodir_flexslider">
                    <ul class="geodir-slides clearfix"><?php 
            echo $nav_slides;
            ?>
</ul>
                </div>
            <?php 
        }
        ?>
        </div>
        <?php 
        $GLOBALS['post'] = $current_post;
        setup_postdata($current_post);
    }
    echo $after_widget;
}
/**
 * Output the details page slider HTML.
 *
 * @since 1.0.0
 * @package GeoDirectory
 * @global bool $preview True of on a preview page. False if not.
 * @global object $post The current post object.
 */
function geodir_action_details_slider()
{
    global $preview, $post;
    $is_backend_preview = is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p']) && is_super_admin() ? true : false;
    // preview from backend
    if ($is_backend_preview && !empty($post) && !empty($post->ID) && !isset($post->post_images)) {
        $preview_get_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
        $preview_post_images = array();
        if ($preview_get_images) {
            foreach ($preview_get_images as $row) {
                $preview_post_images[] = $row->src;
            }
        }
        if (!empty($preview_post_images)) {
            $post->post_images = implode(',', $preview_post_images);
        }
    }
    if ($preview) {
        if (isset($post->post_images) && !empty($post->post_images)) {
            $post->post_images = trim($post->post_images, ",");
            $post_images = explode(",", $post->post_images);
        }
        $main_slides = '';
        $nav_slides = '';
        $slides = 0;
        if (empty($post_images)) {
            $default_img = '';
            $default_cat = '';
            if (isset($post->post_default_category)) {
                $default_cat = $post->post_default_category;
            }
            if ($default_catimg = geodir_get_default_catimage($default_cat, $post->listing_type)) {
                $default_img = $default_catimg['src'];
            } else {
                if ($no_images = get_option('geodir_listing_no_img')) {
                    $default_img = $no_images;
                }
            }
            if (!empty($default_img)) {
                $post_images[] = $default_img;
            }
        }
        if (!empty($post_images)) {
            foreach ($post_images as $image) {
                if (!empty($image)) {
                    @(list($width, $height) = getimagesize(trim($image)));
                    if ($image && $width && $height) {
                        $image = (object) array('src' => $image, 'width' => $width, 'height' => $height);
                    }
                    if (isset($image->src)) {
                        if ($image->height >= 400) {
                            $spacer_height = 0;
                        } else {
                            $spacer_height = (400 - $image->height) / 2;
                        }
                        $image_title = isset($image->title) ? $image->title : '';
                        $main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />';
                        $main_slides .= '<img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:400px;margin:0 auto;" /></li>';
                        $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:48px;margin:0 auto;" /></li>';
                        $slides++;
                    }
                }
            }
            // endfore
        }
        //end if
    } else {
        $main_slides = '';
        $nav_slides = '';
        $post_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
        $slides = 0;
        if (empty($post_images) && get_option('geodir_listing_no_img')) {
            $post_images = (object) array((object) array('src' => get_option('geodir_listing_no_img')));
        }
        if (!empty($post_images)) {
            foreach ($post_images as $image) {
                if ($image->height >= 400) {
                    $spacer_height = 0;
                } else {
                    $spacer_height = (400 - $image->height) / 2;
                }
                $main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />';
                $main_slides .= '<img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:400px;margin:0 auto;" itemprop="image"/></li>';
                $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
                $slides++;
            }
        }
        // endfore
    }
    if (!empty($post_images)) {
        ?>
        <div class="geodir_flex-container">
            <div class="geodir_flex-loader"><i class="fa fa-refresh fa-spin"></i></div>
            <div id="geodir_slider" class="geodir_flexslider ">
                <ul class="geodir-slides clearfix"><?php 
        echo $main_slides;
        ?>
</ul>
            </div>
            <?php 
        if ($slides > 1) {
            ?>
                <div id="geodir_carousel" class="geodir_flexslider">
                    <ul class="geodir-slides clearfix"><?php 
            echo $nav_slides;
            ?>
</ul>
                </div>
            <?php 
        }
        ?>
        </div>
    <?php 
    }
}
Example #9
0
<?php

/**
 * GD Dummy data.
 *
 * @since 1.0.0
 * @package GeoDirectory
 */
global $dummy_post_index, $city_bound_lat1, $city_bound_lng1, $city_bound_lat2, $city_bound_lng2;
$post_info = array();
$image_array = array();
$post_meta = array();
if (geodir_dummy_folder_exists()) {
    $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy";
} else {
    $dummy_image_url = 'http://www.wpgeodirectory.com/dummy';
}
switch ($dummy_post_index) {
    case 1:
        $image_array[] = "{$dummy_image_url}/a1.jpg";
        $image_array[] = "{$dummy_image_url}/a2.jpg";
        $image_array[] = "{$dummy_image_url}/a3.jpg";
        $image_array[] = "{$dummy_image_url}/a4.jpg";
        $image_array[] = "{$dummy_image_url}/a5.jpg";
        $image_array[] = "{$dummy_image_url}/a6.jpg";
        $image_array[] = "{$dummy_image_url}/a7.jpg";
        $image_array[] = "{$dummy_image_url}/a8.jpg";
        $image_array[] = "{$dummy_image_url}/a9.jpg";
        $image_array[] = "{$dummy_image_url}/a10.jpg";
        $image_array[] = "{$dummy_image_url}/a11.jpg";
        $post_info[] = array("listing_type" => 'gd_place', "post_title" => 'Franklin Square', "post_desc" => ' <h3> Location </h3>
function geodir_manage_claim_listing()
{
    global $wpdb, $plugin_prefix, $path_url;
    ?>
	<div class="gd-content-heading">      
	<h3><?php 
    echo CLAIM_GEODIR_CLAIMS_LISTING;
    ?>
</h3>   
                     
	<table style="width:100%" cellpadding="5" class="widefat post fixed" >
			<thead>
					<tr>
							<th width="150" align="left"><strong><?php 
    echo CLAIM_LISTING_TITLE;
    ?>
</strong></th>
							<th width="330" align="left"><strong><?php 
    echo CLAIM_USER_INFO;
    ?>
</strong></th>
							<th width="100" align="left"><strong><?php 
    echo CLAIM_STATUS;
    ?>
</strong></th>
							<th width="100" align="left"><strong><?php 
    echo CLAIM_DETAILS;
    ?>
</strong></th>
							<th width="70" align="left"><strong><?php 
    echo CLAIM_ACTION;
    ?>
</strong></th>
							<th align="left">&nbsp;</th>
					</tr>
			<?php 
    $claimsql = "select * from " . GEODIR_CLAIM_TABLE . "  ORDER BY status ASC";
    $claiminfo = $wpdb->get_results($claimsql);
    if ($claiminfo) {
        foreach ($claiminfo as $claiminfoObj) {
            $nonce = wp_create_nonce('claim_action_' . $claiminfoObj->pid);
            ?>
			<tr <?php 
            if ($claiminfoObj->status == 1) {
                echo 'style="background-color:#99FFCC"';
            } elseif ($claiminfoObj->status == 2) {
                echo 'style="background-color:#FFAEAE"';
            }
            ?>
>
					<td><?php 
            echo $claiminfoObj->list_title;
            ?>
</td>
					
					<td>
						<strong><?php 
            echo CLAIM_USER;
            ?>
:&nbsp;</strong><?php 
            echo stripslashes($claiminfoObj->user_name);
            ?>
<br />
						<strong><?php 
            echo CLAIM_FULLNAME;
            ?>
:&nbsp;</strong><?php 
            echo stripslashes($claiminfoObj->user_fullname);
            ?>
<br />
						<strong><?php 
            echo CLAIM_POSITION;
            ?>
:&nbsp;</strong><?php 
            echo stripslashes($claiminfoObj->user_position);
            ?>
<br />
						<strong><?php 
            echo CLAIM_PHONE;
            ?>
:&nbsp;</strong><?php 
            echo stripslashes($claiminfoObj->user_number);
            ?>
					</td>
					
					<td><?php 
            if ($claiminfoObj->status == 1) {
                echo CLAIM_APPROVED_TEXT;
            } elseif ($claiminfoObj->status == 2) {
                echo CLAIM_REJECTED_TEXT;
            } else {
                echo CLAIM_NO_DECISION;
            }
            ?>
</td>
					<td><a href="<?php 
            echo admin_url() . 'admin.php?page=geodirectory&tab=claimlisting_fields&subtab=manage_geodir_claim_listing&pagetype=addedit&id=' . $claiminfoObj->pid;
            ?>
"><?php 
            echo CLAIM_FULL_DETAILS;
            ?>
</a> </td>
					<td>
					<?php 
            if ($claiminfoObj->status == '' || $claiminfoObj->status == '0') {
                ?>
					<a href="javascript:void(0);" onClick="return approve_rec('<?php 
                echo $claiminfoObj->pid;
                ?>
', '<?php 
                echo $nonce;
                ?>
');"><img src="<?php 
                echo $path_url;
                ?>
/images/tick.png" alt="Approve" title="Approve"/></a>
					<a href="javascript:void(0);" onClick="return reject_rec('<?php 
                echo $claiminfoObj->pid;
                ?>
', '<?php 
                echo $nonce;
                ?>
');"><img src="<?php 
                echo $path_url;
                ?>
/images/reject.png" alt="Reject" title="Reject"/></a>
					<a href="javascript:void(0);" onClick="return delete_rec('<?php 
                echo $claiminfoObj->pid;
                ?>
', '<?php 
                echo $nonce;
                ?>
');"><img src="<?php 
                echo geodir_plugin_url();
                ?>
/geodirectory-assets/images/delete.png" alt="Delete" title="Delete"/></a>
					<?php 
            }
            ?>
					<?php 
            if ($claiminfoObj->status == '1') {
                ?>
					<a href="javascript:void(0);" onClick="return undo_rec('<?php 
                echo $claiminfoObj->pid;
                ?>
', '<?php 
                echo $nonce;
                ?>
');"><img src="<?php 
                echo $path_url;
                ?>
/images/undo.png" alt="Undo" title="Undo" /></a>
					<a href="javascript:void(0);" onClick="return delete_rec('<?php 
                echo $claiminfoObj->pid;
                ?>
', '<?php 
                echo $nonce;
                ?>
');"><img src="<?php 
                echo geodir_plugin_url();
                ?>
/geodirectory-assets/images/delete.png" alt="Delete" title="Delete"/></a>
					<?php 
            }
            ?>
					<?php 
            if ($claiminfoObj->status == '2') {
                ?>
					<a href="javascript:void(0);" onClick="return approve_rec('<?php 
                echo $claiminfoObj->pid;
                ?>
', '<?php 
                echo $nonce;
                ?>
');"><img src="<?php 
                echo $path_url;
                ?>
/images/tick.png" alt="Approve" title="Approve" /></a>
					<a href="javascript:void(0);" onClick="return delete_rec('<?php 
                echo $claiminfoObj->pid;
                ?>
', '<?php 
                echo $nonce;
                ?>
');"><img src="<?php 
                echo geodir_plugin_url();
                ?>
/geodirectory-assets/images/delete.png" alt="Delete" title="Delete" /></a>
					<?php 
            }
            ?>
					</td>
					<td>&nbsp;</td>
			</tr>
			<?php 
        }
    }
    ?>
			</thead>
	</table></div><?php 
}
    /**
     * GeoDirectory Backend Admin Panel.
     *
     * Handles the display of the main GeoDirectory admin panel.
     *
     * @since 1.0.0
     * @package GeoDirectory
     * @global string $current_tab Current tab in geodirectory settings.
     * @global object $geodirectory GeoDirectory plugin object.
     */
    function geodir_admin_panel()
    {
        global $geodirectory;
        global $current_tab;
        ?>

        <div id="gd-wrapper-main" class="wrap geodirectory">
            <?php 
        /**
         * Called just after the opening wrapper div for the GD settings page in the admin area.
         *
         * @since 1.0.0
         */
        do_action('geodir_before_admin_panel');
        ?>

            <div class="gd-wrapper gd-wrapper-vr clearfix">

                <div class="gd-left-nav">
                    <img src="<?php 
        echo geodir_plugin_url();
        ?>
/geodirectory-assets/images/geo-logo.png" alt="geo-logo"
                         class="geo-logo"/>
                    <img src="<?php 
        echo geodir_plugin_url();
        ?>
/geodirectory-assets/images/geo-logoalter.png"
                         alt="geo-logo" class="geo-logoalter"/>
                    <ul>
                        <?php 
        $tabs = array();
        /**
         * Filter the GD admin settings tabs on the left of the admin menu.
         *
         * @since 1.0.0
         * @param array $tabs The array of tabs to display.
         */
        $tabs = apply_filters('geodir_settings_tabs_array', $tabs);
        update_option('geodir_tabs', $tabs);
        // Important to show settings menu dropdown
        foreach ($tabs as $name => $args) {
            $label = $args['label'];
            $query_string = '';
            if (isset($args['subtabs']) && !empty($args['subtabs'])) {
                $subtabs = $args['subtabs'];
                $query_string = '&subtab=' . $subtabs[0]['subtab'];
            }
            $tab_link = admin_url('admin.php?page=geodirectory&tab=' . $name . $query_string);
            if (isset($args['url']) && $args['url'] != '') {
                $tab_link = $args['url'];
            }
            if (!empty($args['request'])) {
                $tab_link = geodir_getlink($tab_link, $args['request']);
            }
            if (isset($args['target']) && $args['target'] != '') {
                $tab_target = " target='" . $args['target'] . "' ";
            } else {
                $tab_target = '';
            }
            $tab_active = '';
            if ($current_tab == $name) {
                $tab_active = ' class="tab-active" ';
            }
            /**
             * Called before the individual settings tabs are output.
             *
             * @since 1.0.0
             * @param string $name The name of the settings tab.
             * @see 'geodir_after_settings_tabs'
             */
            do_action('geodir_before_settings_tabs', $name);
            echo '<li ' . $tab_active . ' ><a href="' . $tab_link . '"  ' . $tab_target . ' >' . $label . '</a></li>';
            /**
             * Called after the individual settings tabs are output.
             *
             * @since 1.0.0
             * @param string $name The name of the settings tab.
             * @see 'geodir_before_settings_tabs'
             */
            do_action('geodir_after_settings_tabs', $name);
        }
        /**
         * Called after the GD settings tabs have been output.
         *
         * Called before the closing `ul` so can be used to add new settings tab links.
         *
         * @since 1.0.0
         */
        do_action('geodir_settings_tabs');
        ?>
                    </ul>
                </div>
                <!--gd-left-nav ends here-->


                <div class="gd-content-wrapper">
                    <div class="gd-tabs-main">

                        <?php 
        unset($subtabs);
        if (isset($tabs[$current_tab]['subtabs'])) {
            $subtabs = $tabs[$current_tab]['subtabs'];
        }
        $form_action = '';
        if (!empty($subtabs)) {
            ?>

                            <dl class="gd-tab-head">
                                <?php 
            foreach ($subtabs as $sub) {
                $subtab_active = '';
                if (isset($_REQUEST['subtab']) && $sub['subtab'] == $_REQUEST['subtab']) {
                    $subtab_active = 'class="gd-tab-active"';
                    $form_action = isset($sub['form_action']) ? $sub['form_action'] : '';
                }
                $sub_tabs_link = admin_url() . 'admin.php?page=geodirectory&tab=' . $current_tab . '&subtab=' . $sub['subtab'];
                if (isset($sub['request']) && is_array($sub['request']) && !empty($sub['request'])) {
                    $sub_tabs_link = geodir_getlink($sub_tabs_link, $sub['request']);
                }
                echo '<dd ' . $subtab_active . ' id="claim_listing"><a href="' . $sub_tabs_link . '" >' . $sub['label'] . '</a></dd>';
            }
            ?>
                            </dl>

                        <?php 
        }
        ?>

                        <div class="gd-tab-content <?php 
        if (empty($subtabs)) {
            echo "inner_contet_tabs";
        }
        ?>
">
                            <form method="post" id="mainform"
                                  class="geodir_optionform <?php 
        echo $current_tab . ' ';
        if (isset($sub['subtab'])) {
            echo $sub['subtab'];
        }
        ?>
" action="<?php 
        echo $form_action;
        ?>
" enctype="multipart/form-data">
                                <input type="hidden" class="active_tab" name="active_tab"
                                       value="<?php 
        if (isset($_REQUEST['active_tab'])) {
            echo $_REQUEST['active_tab'];
        }
        ?>
"/>
                                <?php 
        wp_nonce_field('geodir-settings', '_wpnonce', true, true);
        ?>
                                <?php 
        wp_nonce_field('geodir-settings-' . $current_tab, '_wpnonce-' . $current_tab, true, true);
        ?>
                                <?php 
        /**
         * Used to call the content of each GD settings tab page.
         *
         * @since 1.0.0
         */
        do_action('geodir_admin_option_form', $current_tab);
        ?>
                            </form>
                        </div>

                    </div>
                </div>

            </div>
        </div>
        <script type="text/javascript">
            jQuery(window).load(function () {

                // Subsubsub tabs
                jQuery('ul.subsubsub li a:eq(0)').addClass('current');
                jQuery('.subsubsub_section .section:gt(0)').hide();

                jQuery('ul.subsubsub li a').click(function () {
                    /*jQuery('a', jQuery(this).closest('ul.subsubsub')).removeClass('current');
                     jQuery(this).addClass('current');
                     jQuery('.section', jQuery(this).closest('.subsubsub_section')).hide();
                     jQuery( jQuery(this).attr('href') ).show();
                     jQuery('#last_tab').val( jQuery(this).attr('href') );
                     return false;*/
                });

                <?php 
        if (isset($_GET['subtab']) && $_GET['subtab']) {
            echo 'jQuery("ul.subsubsub li a[href=#' . $_GET['subtab'] . ']").click();';
        }
        ?>

                // Countries
                jQuery('select#geodirectory_allowed_countries').change(function () {
                    if (jQuery(this).val() == "specific") {
                        jQuery(this).parent().parent().next('tr').show();
                    } else {
                        jQuery(this).parent().parent().next('tr').hide();
                    }
                }).change();

                // Color picker
                jQuery('.colorpick').each(function () {
                    jQuery('.colorpickdiv', jQuery(this).parent()).farbtastic(this);
                    jQuery(this).click(function () {
                        if (jQuery(this).val() == "") jQuery(this).val('#');
                        jQuery('.colorpickdiv', jQuery(this).parent()).show();
                    });
                });
                jQuery(document).mousedown(function () {
                    jQuery('.colorpickdiv').hide();
                });

                // Edit prompt
                jQuery(function () {
                    var changed = false;

                    jQuery('input, textarea, select, checkbox').change(function () {
                        changed = true;
                    });

                    jQuery('.geodirectory-nav-tab-wrapper a').click(function () {
                        if (changed) {
                            window.onbeforeunload = function () {
                                return '<?php 
        echo __('The changes you made will be lost if you navigate away from this page.', 'geodirectory');
        ?>
';
                            }
                        } else {
                            window.onbeforeunload = '';
                        }
                    });

                    jQuery('.submit input').click(function () {
                        window.onbeforeunload = '';
                    });
                });

                // Sorting
                jQuery('table.wd_gateways tbody').sortable({
                    items: 'tr',
                    cursor: 'move',
                    axis: 'y',
                    handle: 'td',
                    scrollSensitivity: 40,
                    helper: function (e, ui) {
                        ui.children().each(function () {
                            jQuery(this).width(jQuery(this).width());
                        });
                        ui.css('left', '0');
                        return ui;
                    },
                    start: function (event, ui) {
                        ui.item.css('background-color', '#f6f6f6');
                    },
                    stop: function (event, ui) {
                        ui.item.removeAttr('style');
                    }
                });

                // Chosen selects
                jQuery("select.chosen_select").chosen();

                jQuery("select.chosen_select_nostd").chosen({
                    allow_single_deselect: 'true'
                });

            });
        </script>
    <?php 
    }
    return $post_type_arr;
}
/**
 * function for theme location settings.
 *
 * @since 1.0.0
 * @package GeoDirectory
 */
function geodir_theme_location_setting_fun()
{
    $post_type_arr = array();
    $geodir_all_nav_locations = get_registered_nav_menus();
    $geodir_active_nav_locations = get_nav_menu_locations();
    if (!empty($geodir_active_nav_locations) && is_array($geodir_active_nav_locations)) {
        foreach ($geodir_active_nav_locations as $key => $theme_location) {
            if (!empty($geodir_all_nav_locations) && is_array($geodir_all_nav_locations) && array_key_exists($key, $geodir_all_nav_locations)) {
                $post_type_arr[$key] = $geodir_all_nav_locations[$key];
            }
        }
    }
    return $post_type_arr;
}
/**
 * Filter GD design settings array.
 *
 * @since 1.0.0
 * @package GeoDirectory
 */
$geodir_settings['design_settings'] = apply_filters('geodir_design_settings', array(array('name' => __('Home', GEODIRECTORY_TEXTDOMAIN), 'type' => 'title', 'desc' => 'Setting to set home page layout', 'id' => 'home_page_settings '), array('name' => __('Home Top Section Settings', GEODIRECTORY_TEXTDOMAIN), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_home_top_section'), array('name' => __('Geodirectory home page', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Set geodirectory home page as your home', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_set_as_home', 'type' => 'checkbox', 'std' => '0'), array('name' => __('Home top section', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Show the top section of home page', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_show_home_top_section', 'type' => 'checkbox', 'std' => '1'), array('type' => 'sectionend', 'id' => 'geodir_home_top_section'), array('name' => __('Home Page Layout Settings', GEODIRECTORY_TEXTDOMAIN), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_home_layout'), array('name' => __('Home right section', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Show the right section of home page', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_show_home_right_section', 'type' => 'checkbox', 'std' => '1'), array('name' => __('Width of home right section', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Enter the width of right section of home page in %', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_width_home_right_section', 'type' => 'text', 'css' => 'min-width:300px;', 'std' => '30'), array('name' => __('Home content section', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Show the content section of home page', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_show_home_contant_section', 'type' => 'checkbox', 'std' => '1'), array('name' => __('Width of home content section', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Enter the width of content section of home page in %', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_width_home_contant_section', 'type' => 'text', 'css' => 'min-width:300px;', 'std' => '63'), array('name' => __('Home left section', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Show the left section of home page', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_show_home_left_section', 'type' => 'checkbox', 'std' => '0'), array('name' => __('Width of home left section', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Enter the width of left section of home page in %', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_width_home_left_section', 'type' => 'text', 'css' => 'min-width:300px;', 'std' => '30'), array('name' => __('Home bottom section', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Show the bottom section of home page', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_show_home_bottom_section', 'type' => 'checkbox', 'std' => '0'), array('name' => __('Resize image large size', GEODIRECTORY_TEXTDOMAIN), 'desc' => sprintf(__('Use default wordpress media image large size ( %s ) for featured image upload. If unchecked then default geodirectory image large size ( 800x800 ) will be used.', GEODIRECTORY_TEXTDOMAIN), get_option('large_size_w') . 'x' . get_option('large_size_h')), 'id' => 'geodir_use_wp_media_large_size', 'type' => 'checkbox', 'std' => '0'), array('type' => 'sectionend', 'id' => 'geodir_home_layout'), array('name' => __('Listings', GEODIRECTORY_TEXTDOMAIN), 'type' => 'title', 'desc' => '', 'id' => 'geodir_listing_settings '), array('name' => __('Listing Page Layout Settings', GEODIRECTORY_TEXTDOMAIN), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_listing_layout'), array('name' => __('Listing top section', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Show the top section of listing page', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_show_listing_top_section', 'type' => 'checkbox', 'std' => '1'), array('name' => __('Listing right section', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Show the right section of listing page', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_show_listing_right_section', 'type' => 'checkbox', 'std' => '1'), array('name' => __('Width of listing right section', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Enter the width of right section of listing page in %', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_width_listing_right_section', 'type' => 'text', 'css' => 'min-width:300px;', 'std' => '30'), array('name' => __('Listing content section view', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Set the listing view of listing page', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_listing_view', 'css' => 'min-width:300px;', 'std' => 'gridview_onehalf', 'type' => 'select', 'class' => 'chosen_select', 'options' => array_unique(array('gridview_onehalf' => __('Grid View (Two Columns)', GEODIRECTORY_TEXTDOMAIN), 'gridview_onethird' => __('Grid View (Three Columns)', GEODIRECTORY_TEXTDOMAIN), 'gridview_onefourth' => __('Grid View (Four Columns)', GEODIRECTORY_TEXTDOMAIN), 'gridview_onefifth' => __('Grid View (Five Columns)', GEODIRECTORY_TEXTDOMAIN), 'listview' => __('List view', GEODIRECTORY_TEXTDOMAIN)))), array('name' => __('Width of listing content section', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Enter the width of content section of listing page in %', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_width_listing_contant_section', 'type' => 'text', 'css' => 'min-width:300px;', 'std' => '63'), array('name' => __('Listing left section', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Show the left section of listing page', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_show_listing_left_section', 'type' => 'checkbox', 'std' => '0'), array('name' => __('Width of listing left section', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Enter the width of left section of listing in %', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_width_listing_left_section', 'type' => 'text', 'css' => 'min-width:300px;', 'std' => '30'), array('name' => __('Listing bottom section', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Show the bottom section of listing page', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_show_listing_bottom_section', 'type' => 'checkbox', 'std' => '0'), array('name' => __('Upload listing no image', GEODIRECTORY_TEXTDOMAIN), 'desc' => '', 'id' => 'geodir_listing_no_img', 'type' => 'file', 'std' => '0'), array('name' => __('Description word limit', GEODIRECTORY_TEXTDOMAIN), 'desc' => '', 'id' => 'geodir_desc_word_limit', 'type' => 'text', 'css' => 'min-width:300px;', 'std' => '50'), array('type' => 'sectionend', 'id' => 'geodir_listing_layout'), array('name' => __('Listing General Settings', GEODIRECTORY_TEXTDOMAIN), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_listing_gen_settings '), array('name' => __('New listing default status', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Select new listing default status.', GEODIRECTORY_TEXTDOMAIN), 'tip' => '', 'id' => 'geodir_new_post_default_status', 'css' => 'min-width:300px;', 'std' => 'publish', 'type' => 'select', 'class' => 'chosen_select', 'options' => array_unique(array('publish' => __('publish', GEODIRECTORY_TEXTDOMAIN), 'draft' => __('draft', GEODIRECTORY_TEXTDOMAIN)))), array('name' => __('New listings settings', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Enter number of days a listing will appear new.(enter 0 to disable feature)', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_listing_new_days', 'type' => 'text', 'css' => 'min-width:300px;', 'std' => '30'), array('type' => 'sectionend', 'id' => 'geodir_listing_gen_settings'), array('name' => __('Add Listing Form Settings', GEODIRECTORY_TEXTDOMAIN), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_add_listing_gen_settings'), array('name' => __('Enable "Accept Terms and Conditions"', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Show the "Accept Terms and Conditions" field on add listing.', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_accept_term_condition', 'type' => 'checkbox', 'std' => '1'), array('name' => __('Show description field as editor', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Select post types to show advanced editor on add listing page.', GEODIRECTORY_TEXTDOMAIN), 'tip' => '', 'id' => 'geodir_tiny_editor_on_add_listing', 'css' => 'min-width:300px;', 'std' => array(), 'type' => 'multiselect', 'placeholder_text' => __('Select post types', GEODIRECTORY_TEXTDOMAIN), 'class' => 'chosen_select', 'options' => array_unique(geodir_post_type_setting_fun())), array('type' => 'sectionend', 'id' => 'geodir_add_listing_gen_settings'), array('name' => __('Search', GEODIRECTORY_TEXTDOMAIN), 'type' => 'title', 'desc' => '', 'id' => 'geodir_search_settings '), array('name' => __('Search Page Layout Settings', GEODIRECTORY_TEXTDOMAIN), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_search_layout'), array('name' => __('Search top section', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Show the top section of search page', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_show_search_top_section', 'type' => 'checkbox', 'std' => '1'), array('name' => __('Search right section', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Show the right section of search page', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_show_search_right_section', 'type' => 'checkbox', 'std' => '1'), array('name' => __('Width of search right section', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Enter the width of right section of search page in %', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_width_search_right_section', 'type' => 'text', 'css' => 'min-width:300px;', 'std' => '30'), array('name' => __('Search content section view', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Set the listing view of search page', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_search_view', 'css' => 'min-width:300px;', 'std' => 'gridview_onehalf', 'type' => 'select', 'class' => 'chosen_select', 'options' => array_unique(array('gridview_onehalf' => __('Grid View (Two Columns)', GEODIRECTORY_TEXTDOMAIN), 'gridview_onethird' => __('Grid View (Three Columns)', GEODIRECTORY_TEXTDOMAIN), 'gridview_onefourth' => __('Grid View (Four Columns)', GEODIRECTORY_TEXTDOMAIN), 'gridview_onefifth' => __('Grid View (Five Columns)', GEODIRECTORY_TEXTDOMAIN), 'listview' => __('List view', GEODIRECTORY_TEXTDOMAIN)))), array('name' => __('Width of search content section', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Enter the width of content section of search page in %', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_width_search_contant_section', 'type' => 'text', 'css' => 'min-width:300px;', 'std' => '63'), array('name' => __('Search left section', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Show the left section of search page', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_show_search_left_section', 'type' => 'checkbox', 'std' => '0'), array('name' => __('Width of search left section', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Enter the width of left section of search in %', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_width_search_left_section', 'type' => 'text', 'css' => 'min-width:300px;', 'std' => '30'), array('name' => __('Search bottom section', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Show the bottom section of search page', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_show_search_bottom_section', 'type' => 'checkbox', 'std' => '0'), array('name' => __('Show advanced pagination details', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('This will add extra pagination info like "Showing listings x-y of z" aftre/before pagination.', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_pagination_advance_info', 'css' => 'min-width:300px;', 'std' => '', 'type' => 'select', 'class' => 'chosen_select', 'options' => array('' => __('Never Display', GEODIRECTORY_TEXTDOMAIN), 'after' => __('After Pagination', GEODIRECTORY_TEXTDOMAIN), 'before' => __('Before Pagination', GEODIRECTORY_TEXTDOMAIN))), array('type' => 'sectionend', 'id' => 'geodir_search_layout'), array('name' => __('Search form default text settings', GEODIRECTORY_TEXTDOMAIN), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_search_form_default_text_settings'), array('name' => __('Search field default value', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Show the search text box \'placeholder\' value on search form.', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_search_field_default_text', 'type' => 'text', 'css' => 'min-width:300px;', 'std' => 'Search for'), array('name' => __('Near field default value', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Show the near text box \'placeholder\' value on search form.', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_near_field_default_text', 'type' => 'text', 'css' => 'min-width:300px;', 'std' => 'Near'), array('name' => __('Search button label', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Show the search button label on search form.', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_search_button_label', 'type' => 'text', 'css' => 'min-width:300px;', 'std' => 'Search'), array('type' => 'sectionend', 'id' => 'geodir_search_form_default_text_settings'), array('name' => __('Detail', GEODIRECTORY_TEXTDOMAIN), 'type' => 'title', 'desc' => '', 'id' => 'geodir_detail_settings '), array('name' => __('Detail/Single Page Settings', GEODIRECTORY_TEXTDOMAIN), 'type' => 'sectionstart', 'desc' => '', 'id' => 'detail_page_settings '), array('name' => __('Detail top section', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Show the top section of listing page', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_show_detail_top_section', 'type' => 'checkbox', 'std' => '1'), array('name' => __('Detail bottom section', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Show the bottom section of listing page', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_show_detail_bottom_section', 'type' => 'checkbox', 'std' => '1'), array('name' => __('Detail sidebar section on left side', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Display detail sidebar section on left side of the detail page', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_detail_sidebar_left_section', 'type' => 'checkbox', 'std' => '0'), array('name' => __('Disable GD modal', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Disable GD modal that displays slideshow images in popup', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_disable_gb_modal', 'type' => 'checkbox', 'std' => '0'), array('name' => __('Disable Tweet, Fb Like, Google+ buttons section', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Disable Tweet, Fb Like, Google+ buttons section that displays on Detail page sidebar', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_disable_tfg_buttons_section', 'type' => 'checkbox', 'std' => '0'), array('name' => __('Disable share this button section', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Disable share this button section that displays on Detail page sidebar', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_disable_sharethis_button_section', 'type' => 'checkbox', 'std' => '0'), array('name' => __('Disable Google Analytics section', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Disable Google Analytics section that displays on Detail page sidebar', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_disable_google_analytics_section', 'type' => 'checkbox', 'std' => '0'), array('name' => __('Disable User Links section', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Disable User Links section (Edit post, Favorite etc..) that displays on Detail page sidebar', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_disable_user_links_section', 'type' => 'checkbox', 'std' => '0'), array('name' => __('Disable Rating Info section', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Disable Rating Info section that displays on Detail page sidebar', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_disable_rating_info_section', 'type' => 'checkbox', 'std' => '0'), array('name' => __('Disable Listing Info section', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Disable Listing Info section that displays on Detail page sidebar', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_disable_listing_info_section', 'type' => 'checkbox', 'std' => '0'), array('type' => 'sectionend', 'id' => 'detail_page_settings'), array('name' => __('Detail Page Tab Settings', GEODIRECTORY_TEXTDOMAIN), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_detail_page_tab_settings '), array('name' => __('Exclude selected tabs from detail page', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Select tabs to exclude from the list of all appearing tabs on detail page.', GEODIRECTORY_TEXTDOMAIN), 'tip' => '', 'id' => 'geodir_detail_page_tabs_excluded', 'css' => 'min-width:300px;', 'std' => geodir_get_posttypes(), 'type' => 'multiselect', 'placeholder_text' => __('Select tabs', GEODIRECTORY_TEXTDOMAIN), 'class' => 'chosen_select', 'options' => array_unique(geodir_detail_page_tabs_key_value_array())), array('type' => 'sectionend', 'id' => 'geodir_detail_page_tab_settings'), array('name' => __('Default Rating Settings', GEODIRECTORY_TEXTDOMAIN), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_rating_settings '), array('name' => __('Upload default rating star icon', GEODIRECTORY_TEXTDOMAIN), 'desc' => '', 'id' => 'geodir_default_rating_star_icon', 'type' => 'file', 'std' => '0', 'value' => geodir_plugin_url() . '/geodirectory-assets/images/stars.png'), array('type' => 'sectionend', 'id' => 'geodir_detail_page_tab_settings'), array('name' => __('Related Post Settings', GEODIRECTORY_TEXTDOMAIN), 'type' => 'sectionstart', 'desc' => '', 'id' => 'detail_page_related_post_settings '), array('name' => __('Show related post listing on', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Select the post types to display related listing on detail page.', GEODIRECTORY_TEXTDOMAIN), 'tip' => '', 'id' => 'geodir_add_related_listing_posttypes', 'css' => 'min-width:300px;', 'std' => geodir_get_posttypes(), 'type' => 'multiselect', 'placeholder_text' => __('Select post types', GEODIRECTORY_TEXTDOMAIN), 'class' => 'chosen_select', 'options' => array_unique(geodir_post_type_setting_fun())), array('name' => __('Relate to', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Set the relation between current post to related posts.', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_related_post_relate_to', 'css' => 'min-width:300px;', 'std' => 'category', 'type' => 'select', 'class' => 'chosen_select', 'options' => array_unique(array('category' => __('Categories', GEODIRECTORY_TEXTDOMAIN), 'tags' => __('Tags', GEODIRECTORY_TEXTDOMAIN)))), array('name' => __('Layout', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Set the listing view of relate post on detail page', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_related_post_listing_view', 'css' => 'min-width:300px;', 'std' => 'gridview_onehalf', 'type' => 'select', 'class' => 'chosen_select', 'options' => array_unique(array('gridview_onehalf' => __('Grid View (Two Columns)', GEODIRECTORY_TEXTDOMAIN), 'gridview_onethird' => __('Grid View (Three Columns)', GEODIRECTORY_TEXTDOMAIN), 'gridview_onefourth' => __('Grid View (Four Columns)', GEODIRECTORY_TEXTDOMAIN), 'gridview_onefifth' => __('Grid View (Five Columns)', GEODIRECTORY_TEXTDOMAIN), 'listview' => __('List view', GEODIRECTORY_TEXTDOMAIN)))), array('name' => __('Sort by', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Set the related post listing sort by view', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_related_post_sortby', 'css' => 'min-width:300px;', 'std' => 'latest', 'type' => 'select', 'class' => 'chosen_select', 'options' => array_unique(array('latest' => __('Latest', GEODIRECTORY_TEXTDOMAIN), 'featured' => __('Featured', GEODIRECTORY_TEXTDOMAIN), 'high_review' => __('Review', GEODIRECTORY_TEXTDOMAIN), 'high_rating' => __('Rating', GEODIRECTORY_TEXTDOMAIN), 'random' => __('Random', GEODIRECTORY_TEXTDOMAIN)))), array('name' => __('Number of posts:', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Enter number of posts to display on related posts listing', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_related_post_count', 'type' => 'text', 'css' => 'min-width:300px;', 'std' => '5'), array('name' => __('Post excerpt', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Post content excerpt character count', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_related_post_excerpt', 'type' => 'text', 'css' => 'min-width:300px;', 'std' => '20'), array('type' => 'sectionend', 'id' => 'detail_page_related_post_settings'), array('name' => __('Author', GEODIRECTORY_TEXTDOMAIN), 'type' => 'title', 'desc' => '', 'id' => 'geodir_author_settings '), array('name' => __('Author Page Layout Settings', GEODIRECTORY_TEXTDOMAIN), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_author_layout'), array('name' => __('Author top section', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Show the top section of author page', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_show_author_top_section', 'type' => 'checkbox', 'std' => '1'), array('name' => __('Author right section', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Show the right section of author page', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_show_author_right_section', 'type' => 'checkbox', 'std' => '1'), array('name' => __('Width of author right section', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Enter the width of right section of author page in %', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_width_author_right_section', 'type' => 'text', 'css' => 'min-width:300px;', 'std' => '30'), array('name' => __('Author content section view', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Set the listing view of author page', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_author_view', 'css' => 'min-width:300px;', 'std' => 'gridview_onehalf', 'type' => 'select', 'class' => 'chosen_select', 'options' => array_unique(array('gridview_onehalf' => __('Grid View (Two Columns)', GEODIRECTORY_TEXTDOMAIN), 'gridview_onethird' => __('Grid View (Three Columns)', GEODIRECTORY_TEXTDOMAIN), 'gridview_onefourth' => __('Grid View (Four Columns)', GEODIRECTORY_TEXTDOMAIN), 'gridview_onefifth' => __('Grid View (Five Columns)', GEODIRECTORY_TEXTDOMAIN), 'listview' => __('List view', GEODIRECTORY_TEXTDOMAIN)))), array('name' => __('Width of author content section', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Enter the width of content section of author page in %', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_width_author_contant_section', 'type' => 'text', 'css' => 'min-width:300px;', 'std' => '63'), array('name' => __('Author left section', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Show the left section of author page', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_show_author_left_section', 'type' => 'checkbox', 'std' => '0'), array('name' => __('Width of author left section', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Enter the width of left section of home page in %', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_width_author_left_section', 'type' => 'text', 'css' => 'min-width:300px;', 'std' => '30'), array('name' => __('Author bottom section', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Show the bottom section of author page', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_show_author_bottom_section', 'type' => 'checkbox', 'std' => '0'), array('name' => __('Description word limit', GEODIRECTORY_TEXTDOMAIN), 'desc' => '', 'id' => 'geodir_author_desc_word_limit', 'type' => 'text', 'css' => 'min-width:300px;', 'std' => '50'), array('type' => 'sectionend', 'id' => 'geodir_author_layout'), array('name' => __('Navigation', GEODIRECTORY_TEXTDOMAIN), 'type' => 'title', 'desc' => '', 'id' => 'geodir_navigation_settings'), array('name' => __('Navigation Locations', GEODIRECTORY_TEXTDOMAIN), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_navigation_locations'), array('name' => __('Show geodirectory navigation in selected menu locations', GEODIRECTORY_TEXTDOMAIN), 'desc' => '', 'tip' => '', 'id' => 'geodir_theme_location_nav', 'css' => 'min-width:300px;', 'std' => array(), 'type' => 'multiselect', 'placeholder_text' => __('Select menu locations', GEODIRECTORY_TEXTDOMAIN), 'class' => 'chosen_select', 'options' => array_unique(geodir_theme_location_setting_fun())), array('type' => 'sectionend', 'id' => 'geodir_navigation_options'), array('name' => __('Navigation Settings', GEODIRECTORY_TEXTDOMAIN), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_navigation_options'), array('name' => __('Show add listing navigation in menu', GEODIRECTORY_TEXTDOMAIN), 'desc' => sprintf(__('Show add listing navigation in main menu? (untick to disable) If you disable this option, none of the add listing link will appear in main navigation.', GEODIRECTORY_TEXTDOMAIN)), 'id' => 'geodir_show_addlisting_nav', 'std' => '1', 'type' => 'checkbox'), array('name' => __('Show listings navigation in menu', GEODIRECTORY_TEXTDOMAIN), 'desc' => sprintf(__('Show listing navigation in main menu? (untick to disable) If you disable this option, none of the listing link will appear in main navigation.', GEODIRECTORY_TEXTDOMAIN)), 'id' => 'geodir_show_listing_nav', 'std' => '1', 'type' => 'checkbox'), array('type' => 'sectionend', 'id' => 'geodir_navigation_options'), array('name' => __('Post Type Navigation Settings', GEODIRECTORY_TEXTDOMAIN), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_post_type_navigation_layout'), array('name' => __('Show listing link in main navigation', GEODIRECTORY_TEXTDOMAIN), 'desc' => '', 'tip' => '', 'id' => 'geodir_add_posttype_in_main_nav', 'css' => 'min-width:300px;', 'std' => array(), 'type' => 'multiselect', 'placeholder_text' => __('Select post types', GEODIRECTORY_TEXTDOMAIN), 'class' => 'chosen_select', 'options' => array_unique(geodir_post_type_setting_fun())), array('name' => __('Show listing link in listing navigation', GEODIRECTORY_TEXTDOMAIN), 'desc' => '', 'tip' => '', 'id' => 'geodir_add_posttype_in_listing_nav', 'css' => 'min-width:300px;', 'std' => geodir_get_posttypes(), 'type' => 'multiselect', 'placeholder_text' => __('Select post types', GEODIRECTORY_TEXTDOMAIN), 'class' => 'chosen_select', 'options' => array_unique(geodir_post_type_setting_fun())), array('name' => __('Allow post type to add from frontend', GEODIRECTORY_TEXTDOMAIN), 'desc' => '', 'tip' => '', 'id' => 'geodir_allow_posttype_frontend', 'css' => 'min-width:300px;', 'std' => geodir_get_posttypes(), 'type' => 'multiselect', 'placeholder_text' => __('Select post types', GEODIRECTORY_TEXTDOMAIN), 'class' => 'chosen_select', 'options' => array_unique(geodir_post_type_setting_fun())), array('name' => __('Show add listing link in main navigation', GEODIRECTORY_TEXTDOMAIN), 'desc' => '', 'tip' => '', 'id' => 'geodir_add_listing_link_main_nav', 'css' => 'min-width:300px;', 'std' => array(), 'type' => 'multiselect', 'placeholder_text' => __('Select post types', GEODIRECTORY_TEXTDOMAIN), 'class' => 'chosen_select', 'options' => array_unique(geodir_post_type_setting_fun())), array('name' => __('Show add listing link in add listing navigation', GEODIRECTORY_TEXTDOMAIN), 'desc' => '', 'tip' => '', 'id' => 'geodir_add_listing_link_add_listing_nav', 'css' => 'min-width:300px;', 'std' => geodir_get_posttypes(), 'type' => 'multiselect', 'class' => 'chosen_select', 'options' => array_unique(geodir_post_type_setting_fun())), array('type' => 'sectionend', 'id' => 'geodir_post_type_navigation_layout'), array('name' => __('User Dashboard Post Type Navigation Settings', GEODIRECTORY_TEXTDOMAIN), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_user_dashboard_post_type '), array('name' => __('Show add listing link in user dashboard', GEODIRECTORY_TEXTDOMAIN), 'desc' => '', 'tip' => '', 'id' => 'geodir_add_listing_link_user_dashboard', 'css' => 'min-width:300px;', 'std' => geodir_get_posttypes(), 'type' => 'multiselect', 'placeholder_text' => __('Select post types', GEODIRECTORY_TEXTDOMAIN), 'class' => 'chosen_select', 'options' => array_unique(geodir_post_type_setting_fun())), array('name' => __('Show favorite link in user dashboard', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Option will not appear if user does not have a favorite of that post type', GEODIRECTORY_TEXTDOMAIN), 'tip' => '', 'id' => 'geodir_favorite_link_user_dashboard', 'css' => 'min-width:300px;', 'std' => geodir_get_posttypes(), 'type' => 'multiselect', 'placeholder_text' => __('Select post types', GEODIRECTORY_TEXTDOMAIN), 'class' => 'chosen_select', 'options' => array_unique(geodir_post_type_setting_fun())), array('name' => __('Show listing link in user dashboard', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Option will not appear if user does not have his/her own listing of that post type', GEODIRECTORY_TEXTDOMAIN), 'tip' => '', 'id' => 'geodir_listing_link_user_dashboard', 'css' => 'min-width:300px;', 'std' => geodir_get_posttypes(), 'type' => 'multiselect', 'placeholder_text' => __('Select post types', GEODIRECTORY_TEXTDOMAIN), 'class' => 'chosen_select', 'options' => array_unique(geodir_post_type_setting_fun())), array('type' => 'sectionend', 'id' => 'geodir_user_dashboard_post_type'), array('name' => __('Scripts', GEODIRECTORY_TEXTDOMAIN), 'type' => 'title', 'desc' => '', 'id' => 'geodir_script_settings '), array('name' => __('SCSS Settings (CSS combine and minify)', GEODIRECTORY_TEXTDOMAIN), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_scss_settings'), array('name' => __('Disable Core SCSS', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Stops the CSS files being minified and output as one.', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_scss_core', 'type' => 'checkbox', 'std' => '0'), array('type' => 'sectionend', 'id' => 'geodir_scss_settings'), array('name' => __('Script Settings', GEODIRECTORY_TEXTDOMAIN), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_script_settings'), array('name' => __('Custom style css code', GEODIRECTORY_TEXTDOMAIN), 'desc' => '', 'id' => 'geodir_coustem_css', 'type' => 'textarea', 'css' => 'min-width:300px;', 'std' => ''), array('name' => __('Header script code', GEODIRECTORY_TEXTDOMAIN), 'desc' => '', 'id' => 'geodir_header_scripts', 'type' => 'textarea', 'css' => 'min-width:300px;', 'std' => ''), array('name' => __('Footer script code', GEODIRECTORY_TEXTDOMAIN), 'desc' => '', 'id' => 'geodir_footer_scripts', 'type' => 'textarea', 'css' => 'min-width:300px;', 'std' => ''), array('type' => 'sectionend', 'id' => 'geodir_script_settings'), array('name' => __('Map', GEODIRECTORY_TEXTDOMAIN), 'type' => 'title', 'desc' => '', 'id' => 'geodir_map_settings '), array('name' => __('Home Map Settings', GEODIRECTORY_TEXTDOMAIN), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_home_map_section'), array('name' => __('Select category to untick by default on map', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Select category to untick by default on the home map.', GEODIRECTORY_TEXTDOMAIN), 'tip' => '', 'id' => 'geodir_home_map_untick', 'css' => 'min-width:300px;', 'std' => '', 'type' => 'multiselect', 'placeholder_text' => __('Select category', GEODIRECTORY_TEXTDOMAIN), 'class' => 'chosen_select', 'options' => geodir_home_map_cats_key_value_array()), array('type' => 'sectionend', 'id' => 'geodir_home_map_section'), array('name' => __('Add Listing Map Settings', GEODIRECTORY_TEXTDOMAIN), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_add_listing_map_section'), array('name' => __('Disable mouse scroll', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('Stops the mouse scroll zooming the map', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_add_listing_mouse_scroll', 'type' => 'checkbox', 'std' => '0'), array('type' => 'sectionend', 'id' => 'geodir_add_listing_map_section'), array('name' => __('Default map settings', GEODIRECTORY_TEXTDOMAIN), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_map_default_settings'), array('name' => '', 'desc' => '', 'id' => 'map_default_settings', 'type' => 'map_default_settings', 'css' => 'min-width:300px;', 'std' => ''), array('name' => __('Upload map default marker icon', GEODIRECTORY_TEXTDOMAIN), 'desc' => '', 'id' => 'geodir_default_marker_icon', 'type' => 'file', 'std' => '0', 'value' => geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png'), array('name' => __('Show button control on map to enable/disable dragging', GEODIRECTORY_TEXTDOMAIN), 'desc' => __('If checked, it displays button control to enable/disable dragging on google maps for phone devices', GEODIRECTORY_TEXTDOMAIN), 'id' => 'geodir_map_onoff_dragging', 'type' => 'checkbox', 'std' => '0'), array('type' => 'sectionend', 'id' => 'geodir_map_default_settings'), array('name' => __('Show / hide post type and category on map', GEODIRECTORY_TEXTDOMAIN), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_map_settings'), array('name' => __('Select Map Category', GEODIRECTORY_TEXTDOMAIN), 'desc' => '', 'id' => 'geodir_map_settings', 'type' => 'map', 'css' => 'min-width:300px;', 'std' => ''), array('type' => 'sectionend', 'id' => 'geodir_map_settings')));
// End Design settings
//$_SESSION['geodir_settings']['design_settings'] = $geodir_settings['design_settings'] ;
/**
 * Display the page to manage import/export categories/listings.
 *
 * @since 1.4.6
 * @package GeoDirectory
 *
 * @return string Html content.
 */
function geodir_import_export_page()
{
    $nonce = wp_create_nonce('geodir_import_export_nonce');
    $gd_cats_sample_csv = geodir_plugin_url() . '/geodirectory-assets/gd_sample_categories.csv';
    /**
     * Filter sample category data csv file url.
     *
     * @since 1.0.0
     * @package GeoDirectory
     *
     * @param string $gd_cats_sample_csv Sample category data csv file url.
     */
    $gd_cats_sample_csv = apply_filters('geodir_export_cats_sample_csv', $gd_cats_sample_csv);
    $gd_posts_sample_csv = geodir_plugin_url() . '/geodirectory-assets/place_listing.csv';
    /**
     * Filter sample post data csv file url.
     *
     * @since 1.0.0
     * @package GeoDirectory
     *
     * @param string $gd_posts_sample_csv Sample post data csv file url.
     */
    $gd_posts_sample_csv = apply_filters('geodir_export_posts_sample_csv', $gd_posts_sample_csv);
    $gd_posttypes = geodir_get_posttypes('array');
    $gd_posttypes_option = '';
    foreach ($gd_posttypes as $gd_posttype => $row) {
        $gd_posttypes_option .= '<option value="' . $gd_posttype . '">' . __($row['labels']['name'], GEODIRECTORY_TEXTDOMAIN) . '</option>';
    }
    wp_enqueue_script('jquery-ui-progressbar');
    $uploads = wp_upload_dir();
    ?>
</form>
<div class="inner_content_tab_main gd-import-export">
  <h3><?php 
    _e('GD Import & Export CSV', GEODIRECTORY_TEXTDOMAIN);
    ?>
</h3>
  <span class="description"><?php 
    _e('Import & export csv for GD listings & categories.', GEODIRECTORY_TEXTDOMAIN);
    ?>
</span>
  <div class="gd-content-heading">

  <?php 
    ini_set('max_execution_time', 999999);
    $ini_max_execution_time_check = @ini_get('max_execution_time');
    ini_restore('max_execution_time');
    if ($ini_max_execution_time_check != 999999) {
        // only show these setting to the user if we can't change the ini setting
        ?>
	<div id="gd_ie_reqs" class="metabox-holder">
      <div class="meta-box-sortables ui-sortable">
        <div class="postbox">
          <h3 class="hndle"><span style='vertical-align:top;'><?php 
        echo __('PHP Requirements for GD Import & Export CSV', GEODIRECTORY_TEXTDOMAIN);
        ?>
</span></h3>
          <div class="inside">
            <span class="description"><?php 
        echo __('Note: In case GD import & export csv not working for larger data then please check and configure following php settings.', GEODIRECTORY_TEXTDOMAIN);
        ?>
</span>
			<table class="form-table">
				<thead>
				  <tr>
				  	<th><?php 
        _e('PHP Settings', GEODIRECTORY_TEXTDOMAIN);
        ?>
</th><th><?php 
        _e('Current Value', GEODIRECTORY_TEXTDOMAIN);
        ?>
</th><th><?php 
        _e('Recommended Value', GEODIRECTORY_TEXTDOMAIN);
        ?>
</th>
				  </tr>
				</thead>
				<tbody>
				  <tr>
				  	<td>max_input_time</td><td><?php 
        echo @ini_get('max_input_time');
        ?>
</td><td>3000</td>
				  </tr>
				  <tr>
				  	<td>max_execution_time</td><td><?php 
        echo @ini_get('max_execution_time');
        ?>
</td><td>3000</td>
				  </tr>
				  <tr>
				  	<td>memory_limit</td><td><?php 
        echo @ini_get('memory_limit');
        ?>
</td><td>256M</td>
				  </tr>
				</tbody>
		    </table>
		  </div>
		</div>
	  </div>
	</div>
	<?php 
    }
    ?>
	<div id="gd_ie_imposts" class="metabox-holder">
      <div class="meta-box-sortables ui-sortable">
        <div id="gd_ie_im_posts" class="postbox">
          <h3 class="hndle"><span style='vertical-align:top;'><?php 
    echo __('GD Listings: Import CSV', GEODIRECTORY_TEXTDOMAIN);
    ?>
</span></h3>
          <div class="inside">
            <table class="form-table">
				<tbody>
				  <tr>
					<td class="gd-imex-box">
						<div class="gd-im-choices">
						<p><input type="radio" value="update" name="gd_im_choicepost" id="gd_im_pchoice_u" /><label for="gd_im_pchoice_u"><?php 
    _e('Update listing if post with post_id already exists.', GEODIRECTORY_TEXTDOMAIN);
    ?>
</label></p>
						<p><input type="radio" checked="checked" value="skip" name="gd_im_choicepost" id="gd_im_pchoice_s" /><label for="gd_im_pchoice_s"><?php 
    _e('Ignore listing if post with post_id already exists.', GEODIRECTORY_TEXTDOMAIN);
    ?>
</label></p>
						</div>
						<div class="plupload-upload-uic hide-if-no-js" id="gd_im_postplupload-upload-ui">
							<input type="text" readonly="readonly" name="gd_im_post_file" class="gd-imex-file gd_im_post_file" id="gd_im_post" onclick="jQuery('#gd_im_postplupload-browse-button').trigger('click');" />
							<input id="gd_im_postplupload-browse-button" type="button" value="<?php 
    echo SELECT_UPLOAD_CSV;
    ?>
" class="gd-imex-pupload button-primary" /><input type="button" value="<?php 
    echo esc_attr(__('Download Sample CSV', GEODIRECTORY_TEXTDOMAIN));
    ?>
" class="button-secondary" name="gd_ie_imposts_sample" id="gd_ie_imposts_sample">
						<input type="hidden" id="gd_ie_imposts_csv" value="<?php 
    echo $gd_posts_sample_csv;
    ?>
" />
							<?php 
    /**
     * Called just after the sample CSV download link.
     *
     * @since 1.0.0
     */
    do_action('geodir_sample_csv_download_link');
    ?>
							<span class="ajaxnonceplu" id="ajaxnonceplu<?php 
    echo wp_create_nonce('gd_im_postpluploadan');
    ?>
"></span>
							<div class="filelist"></div>
						</div>
						<span id="gd_im_catupload-error" style="display:none"></span>
						<span class="description"></span>
						<div id="gd_importer" style="display:none">
							<input type="hidden" id="gd_total" value="0"/>
							<input type="hidden" id="gd_prepared" value="continue"/>
							<input type="hidden" id="gd_processed" value="0"/>
							<input type="hidden" id="gd_created" value="0"/>
							<input type="hidden" id="gd_updated" value="0"/>
							<input type="hidden" id="gd_skipped" value="0"/>
							<input type="hidden" id="gd_invalid" value="0"/>
							<input type="hidden" id="gd_invalid_addr" value="0"/>
							<input type="hidden" id="gd_images" value="0"/>
							<input type="hidden" id="gd_terminateaction" value="continue"/>
						</div>
						<div class="gd-import-progress" id="gd-import-progress" style="display:none">
							<div class="gd-import-file"><b><?php 
    _e("Import Data Status :", GEODIRECTORY_TEXTDOMAIN);
    ?>
 </b><font
									id="gd-import-done">0</font> / <font id="gd-import-total">0</font>&nbsp;( <font
									id="gd-import-perc">0%</font> )
								<div class="gd-fileprogress"></div>
							</div>
						</div>
						<div class="gd-import-msg" id="gd-import-msg" style="display:none">
							<div id="message" class="message fade"></div>
						</div>
                    	<div class="gd-imex-btns" style="display:none;">
                        	<input type="hidden" class="geodir_import_file" name="geodir_import_file" value="save"/>
                        	<input onclick="gd_imex_PrepareImport(this, 'post')" type="button" value="<?php 
    echo CSV_IMPORT_DATA;
    ?>
" id="gd_import_data" class="button-primary" />
                        	<input onclick="gd_imex_ContinueImport(this, 'post')" type="button" value="<?php 
    _e("Continue Import Data", GEODIRECTORY_TEXTDOMAIN);
    ?>
" id="gd_continue_data" class="button-primary" style="display:none"/>
                        	<input type="button" value="<?php 
    _e("Terminate Import Data", GEODIRECTORY_TEXTDOMAIN);
    ?>
" id="gd_stop_import" class="button-primary" name="gd_stop_import" style="display:none" onclick="gd_imex_TerminateImport(this, 'post')"/>
							<div id="gd_process_data" style="display:none">
								<span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php 
    _e("Wait, processing import data...", GEODIRECTORY_TEXTDOMAIN);
    ?>
							</div>
						</div>
					</td>
				  </tr>
				</tbody>
			</table>
          </div>
        </div>
      </div>
    </div>
	<div id="gd_ie_excategs" class="metabox-holder">
	  <div class="meta-box-sortables ui-sortable">
		<div id="gd_ie_ex_posts" class="postbox">
		  <h3 class="hndle"><span style='vertical-align:top;'><?php 
    echo __('GD Listings: Export CSV', GEODIRECTORY_TEXTDOMAIN);
    ?>
</span></h3>
		  <div class="inside">
			<table class="form-table">
			  <tbody>
				<tr>
				  <td class="fld"><label for="gd_post_type">
					<?php 
    _e('Post Type:', GEODIRECTORY_TEXTDOMAIN);
    ?>
					</label></td>
				  <td><select name="gd_post_type" id="gd_post_type" style="min-width:140px">
					  <?php 
    echo $gd_posttypes_option;
    ?>
					</select></td>
				</tr>
				<tr>
				  <td class="fld" style="vertical-align: top"><label>
					<?php 
    _e('Progress:', GEODIRECTORY_TEXTDOMAIN);
    ?>
					</label></td>
				  <td><div id='gd_progressbar_box'>
					  <div id="gd_progressbar" class="gd_progressbar">
						<div class="gd-progress-label"></div>
					  </div>
					</div>
					<p style="display:inline-block">
					  <?php 
    _e('Elapsed Time:', GEODIRECTORY_TEXTDOMAIN);
    ?>
					</p>
					  
					<p id="gd_timer" class="gd_timer">00:00:00</p></td>
				</tr>
				<tr>
				  <td colspan="2"><input type="submit" value="<?php 
    echo esc_attr(__('Export CSV', GEODIRECTORY_TEXTDOMAIN));
    ?>
" class="button-primary" name="gd_ie_exposts_submit" id="gd_ie_exposts_submit">
				  </td>
				</tr>
			  </tbody>
			</table>
		  </div>
		</div>
	  </div>
	</div>
	<div id="gd_ie_imcategs" class="metabox-holder">
      <div class="meta-box-sortables ui-sortable">
        <div id="gd_ie_imcats" class="postbox">
          <h3 class="hndle"><span style='vertical-align:top;'><?php 
    echo __('GD Categories: Import CSV', GEODIRECTORY_TEXTDOMAIN);
    ?>
</span></h3>
          <div class="inside">
            <table class="form-table">
				<tbody>
				  <tr>
					<td class="gd-imex-box">
						<div class="gd-im-choices">
						<p><input type="radio" value="update" name="gd_im_choicecat" id="gd_im_cchoice_u" /><label for="gd_im_cchoice_u"><?php 
    _e('Update item if item with cat_id/cat_slug already exists.', GEODIRECTORY_TEXTDOMAIN);
    ?>
</label></p>
						<p><input type="radio" checked="checked" value="skip" name="gd_im_choicecat" id="gd_im_cchoice_s" /><label for="gd_im_cchoice_s"><?php 
    _e('Ignore item if item with cat_id/cat_slug already exists.', GEODIRECTORY_TEXTDOMAIN);
    ?>
</label></p>
						</div>
						<div class="plupload-upload-uic hide-if-no-js" id="gd_im_catplupload-upload-ui">
							<input type="text" readonly="readonly" name="gd_im_cat_file" class="gd-imex-file gd_im_cat_file" id="gd_im_cat" onclick="jQuery('#gd_im_catplupload-browse-button').trigger('click');" />
							<input id="gd_im_catplupload-browse-button" type="button" value="<?php 
    echo SELECT_UPLOAD_CSV;
    ?>
" class="gd-imex-cupload button-primary" /><input type="button" value="<?php 
    echo esc_attr(__('Download Sample CSV', GEODIRECTORY_TEXTDOMAIN));
    ?>
" class="button-secondary" name="gd_ie_imcats_sample" id="gd_ie_imcats_sample">
						<input type="hidden" id="gd_ie_imcats_csv" value="<?php 
    echo $gd_cats_sample_csv;
    ?>
" />
						<?php 
    /**
     * Called just after the sample CSV download link.
     *
     * @since 1.0.0
     * @package GeoDirectory
     */
    do_action('geodir_sample_cats_csv_download_link');
    ?>
							<span class="ajaxnonceplu" id="ajaxnonceplu<?php 
    echo wp_create_nonce('gd_im_catpluploadan');
    ?>
"></span>
							<div class="filelist"></div>
						</div>
						<span id="gd_im_catupload-error" style="display:none"></span>
						<span class="description"></span>
						<div id="gd_importer" style="display:none">
							<input type="hidden" id="gd_total" value="0"/>
							<input type="hidden" id="gd_prepared" value="continue"/>
							<input type="hidden" id="gd_processed" value="0"/>
							<input type="hidden" id="gd_created" value="0"/>
							<input type="hidden" id="gd_updated" value="0"/>
							<input type="hidden" id="gd_skipped" value="0"/>
							<input type="hidden" id="gd_invalid" value="0"/>
							<input type="hidden" id="gd_images" value="0"/>
							<input type="hidden" id="gd_terminateaction" value="continue"/>
						</div>
						<div class="gd-import-progress" id="gd-import-progress" style="display:none">
							<div class="gd-import-file"><b><?php 
    _e("Import Data Status :", GEODIRECTORY_TEXTDOMAIN);
    ?>
 </b><font
									id="gd-import-done">0</font> / <font id="gd-import-total">0</font>&nbsp;( <font
									id="gd-import-perc">0%</font> )
								<div class="gd-fileprogress"></div>
							</div>
						</div>
						<div class="gd-import-msg" id="gd-import-msg" style="display:none">
							<div id="message" class="message fade"></div>
						</div>
                    	<div class="gd-imex-btns" style="display:none;">
                        	<input type="hidden" class="geodir_import_file" name="geodir_import_file" value="save"/>
                        	<input onclick="gd_imex_PrepareImport(this, 'cat')" type="button" value="<?php 
    echo CSV_IMPORT_DATA;
    ?>
" id="gd_import_data" class="button-primary" />
                        	<input onclick="gd_imex_ContinueImport(this, 'cat')" type="button" value="<?php 
    _e("Continue Import Data", GEODIRECTORY_TEXTDOMAIN);
    ?>
" id="gd_continue_data" class="button-primary" style="display:none"/>
                        	<input type="button" value="<?php 
    _e("Terminate Import Data", GEODIRECTORY_TEXTDOMAIN);
    ?>
" id="gd_stop_import" class="button-primary" name="gd_stop_import" style="display:none" onclick="gd_imex_TerminateImport(this, 'cat')"/>
							<div id="gd_process_data" style="display:none">
								<span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php 
    _e("Wait, processing import data...", GEODIRECTORY_TEXTDOMAIN);
    ?>
							</div>
						</div>
					</td>
				  </tr>
				</tbody>
			</table>
          </div>
        </div>
      </div>
    </div>
	<div id="gd_ie_excategs" class="metabox-holder">
      <div class="meta-box-sortables ui-sortable">
        <div id="gd_ie_ex_cats" class="postbox">
          <h3 class="hndle"><span style='vertical-align:top;'><?php 
    echo __('GD Categories: Export CSV', GEODIRECTORY_TEXTDOMAIN);
    ?>
</span></h3>
          <div class="inside">
            <table class="form-table">
				<tbody>
				  <tr>
					<td class="fld"><label for="gd_post_type"><?php 
    _e('Post Type:', GEODIRECTORY_TEXTDOMAIN);
    ?>
</label></td>
					<td><select name="gd_post_type" id="gd_post_type" style="min-width:140px"><?php 
    echo $gd_posttypes_option;
    ?>
</select></td>
				  </tr>
				  <tr>
					<td class="fld" style="vertical-align: top"><label><?php 
    _e('Progress:', GEODIRECTORY_TEXTDOMAIN);
    ?>
</label></td>
					<td><div id='gd_progressbar_box'><div id="gd_progressbar" class="gd_progressbar"><div class="gd-progress-label"></div></div></div><p style="display:inline-block"><?php 
    _e('Elapsed Time:', GEODIRECTORY_TEXTDOMAIN);
    ?>
</p>&nbsp;&nbsp;<p id="gd_timer" class="gd_timer">00:00:00</p></td>
				  </tr>
				  <tr>
					<td colspan="2">
						<input type="submit" value="<?php 
    echo esc_attr(__('Export CSV', GEODIRECTORY_TEXTDOMAIN));
    ?>
" class="button-primary" name="gd_ie_excats_submit" id="gd_ie_excats_submit">
					</td>
				  </tr>
				</tbody>
			</table>
          </div>
        </div>
      </div>
    </div>
	<?php 
    /**
     * Allows you to add more setting to the GD > Import & Export page.
     *
     * Called after the last setting on the GD > Import & Export page.
     * @since 1.4.6
     * @package GeoDirectory
     */
    do_action('geodir_import_export');
    ?>
  </div>
</div>
<script type="text/javascript">
var timoutC, timoutP;

function gd_imex_PrepareImport(el, type) {
	var cont = jQuery(el).closest('.gd-imex-box');
	var gd_prepared = jQuery('#gd_prepared', cont).val();
	var uploadedFile = jQuery('#gd_im_' + type, cont).val();
	jQuery('gd-import-msg', cont).hide();
	if(gd_prepared == uploadedFile) {
		gd_imex_ContinueImport(el, type);
		jQuery('#gd_import_data', cont).attr('disabled', 'disabled');
	} else {
		jQuery.ajax({
			url: ajaxurl,
			type: "POST",
			data: 'action=geodir_import_export&task=prepare_import&_pt=' + type + '&_file=' + uploadedFile + '&_nonce=<?php 
    echo $nonce;
    ?>
',
			dataType: 'json',
			cache: false,
			success: function(data) {
				if(typeof data == 'object') {
					if(data.error) {
						jQuery('#gd-import-msg', cont).find('#message').removeClass('updated').addClass('error').html('<p>' + data.error + '</p>');
						jQuery('#gd-import-msg', cont).show();
					} else if(!data.error && typeof data.rows != 'undefined') {
						jQuery('#gd_total', cont).val(data.rows);
						jQuery('#gd_prepared', cont).val(uploadedFile);
						jQuery('#gd_processed', cont).val('0');
						jQuery('#gd_created', cont).val('0');
						jQuery('#gd_updated', cont).val('0');
						jQuery('#gd_skipped', cont).val('0');
						jQuery('#gd_invalid', cont).val('0');
						jQuery('#gd_images', cont).val('0');
						if(type == 'post') {
							jQuery('#gd_invalid_addr', cont).val('0');
						}
						gd_imex_StartImport(el, type);
					}
				}
			},
			error: function(errorThrown) {
				console.log(errorThrown);
			}
		});
	}
}

function gd_imex_StartImport(el, type) {	
	var cont = jQuery(el).closest('.gd-imex-box');
	
	var limit = 1;
	var total = parseInt(jQuery('#gd_total', cont).val());
	var total_processed = parseInt(jQuery('#gd_processed', cont).val());
	var uploadedFile = jQuery('#gd_im_' + type, cont).val();
	var choice = jQuery('input[name="gd_im_choice'+ type +'"]:checked', cont).val();

	if (!uploadedFile) {
		jQuery('#gd_import_data', cont).removeAttr('disabled').show();
		jQuery('#gd_stop_import', cont).hide();
		jQuery('#gd_process_data', cont).hide();
		jQuery('#gd-import-progress', cont).hide();
		jQuery('.gd-fileprogress', cont).width(0);
		jQuery('#gd-import-done', cont).text('0');
		jQuery('#gd-import-total', cont).text('0');
		jQuery('#gd-import-perc', cont).text('0%');

		jQuery(cont).find('.filelist .file').remove();
		
		jQuery('#gd-import-msg', cont).find('#message').removeClass('updated').addClass('error').html("<p><?php 
    echo esc_attr(PLZ_SELECT_CSV_FILE);
    ?>
</p>");
		jQuery('#gd-import-msg', cont).show();
		
		return false;
	}

	jQuery('#gd-import-total', cont).text(total);
	jQuery('#gd_stop_import', cont).show();
	jQuery('#gd_process_data', cont).css({
		'display': 'inline-block'
	});
	jQuery('#gd-import-progress', cont).show();
	if ((parseInt(total) / 100) > 0) {
		limit = parseInt(parseInt(total) / 100);
	}
	if (limit == 1) {
		if (parseInt(total) > 50) {
			limit = 5;
		} else if (parseInt(total) > 10 && parseInt(total) < 51) {
			limit = 2;
		}
	}
	if (limit > 10) {
		limit = 10;
	}
	if (limit < 1) {
		limit = 1;
	}

	if ( parseInt(limit) > parseInt(total) )
		limit = parseInt(total);
	if (total_processed >= total) {
		jQuery('#gd_import_data', cont).removeAttr('disabled').show();
		jQuery('#gd_stop_import', cont).hide();
		jQuery('#gd_process_data', cont).hide();
		
		gd_imex_showStatusMsg(el, type);
		
		jQuery('#gd_im_' + type, cont).val('');
		jQuery('#gd_prepared', cont).val('');

		return false;
	}
	jQuery('#gd-import-msg', cont).hide();
		
	var gd_processed = parseInt(jQuery('#gd_processed', cont).val());
	var gd_created = parseInt(jQuery('#gd_created', cont).val());
	var gd_updated = parseInt(jQuery('#gd_updated', cont).val());
	var gd_skipped = parseInt(jQuery('#gd_skipped', cont).val());
	var gd_invalid = parseInt(jQuery('#gd_invalid', cont).val());
	var gd_images = parseInt(jQuery('#gd_images', cont).val());
	if (type=='post') {
		var gd_invalid_addr = parseInt(jQuery('#gd_invalid_addr', cont).val());
	}
	
	var gddata = '&limit=' + limit + '&processed=' + gd_processed;
	jQuery.ajax({
		url: ajaxurl,
		type: "POST",
		data: 'action=geodir_import_export&task=import_' + type + '&_pt=' + type + '&_file=' + uploadedFile + gddata + '&_ch=' + choice + '&_nonce=<?php 
    echo $nonce;
    ?>
',
		dataType : 'json',
		cache: false,
		success: function (data) {
			if (typeof data == 'object') {
				if (data.error) {
					jQuery('#gd_import_data', cont).removeAttr('disabled').show();
					jQuery('#gd_stop_import', cont).hide();
					jQuery('#gd_process_data', cont).hide();
					jQuery('#gd-import-msg', cont).find('#message').removeClass('updated').addClass('error').html('<p>' + data.error + '</p>');
					jQuery('#gd-import-msg', cont).show();
				} else {
					gd_processed = gd_processed + parseInt(data.processed);
					gd_created = gd_created + parseInt(data.created);
					gd_updated = gd_updated + parseInt(data.updated);
					gd_skipped = gd_skipped + parseInt(data.skipped);
					gd_invalid = gd_invalid + parseInt(data.invalid);
					gd_images = gd_images + parseInt(data.images);
					if (type=='post' && typeof data.invalid_addr != 'undefined') {
						gd_invalid_addr = gd_invalid_addr + parseInt(data.invalid_addr);
					}

					jQuery('#gd_processed', cont).val(gd_processed);
					jQuery('#gd_created', cont).val(gd_created);
					jQuery('#gd_updated', cont).val(gd_updated);
					jQuery('#gd_skipped', cont).val(gd_skipped);
					jQuery('#gd_invalid', cont).val(gd_invalid);
					jQuery('#gd_images', cont).val(gd_images);
					if (type=='post') {
						jQuery('#gd_invalid_addr', cont).val(gd_invalid_addr);
					}

					if (parseInt(gd_processed) == parseInt(total)) {
						jQuery('#gd-import-done', cont).text(total);
						jQuery('#gd-import-perc', cont).text('100%');
						jQuery('.gd-fileprogress', cont).css({
							'width': '100%'
						});
						jQuery('#gd_im_' + type, cont).val('');
						jQuery('#gd_prepared', cont).val('');
						
						gd_imex_showStatusMsg(el, type);
						
						jQuery('#gd_stop_import', cont).hide();
					}
					if (parseInt(gd_processed) < parseInt(total)) {
						var terminate_action = jQuery('#gd_terminateaction', cont).val();
						if (terminate_action == 'continue') {
							var nTmpCnt = parseInt(total_processed) + parseInt(limit);
							nTmpCnt = nTmpCnt > total ? total : nTmpCnt;

							jQuery('#gd_processed', cont).val(nTmpCnt);

							jQuery('#gd-import-done', cont).text(nTmpCnt);
							if (parseInt(total) > 0) {
								var percentage = ((parseInt(nTmpCnt) / parseInt(total)) * 100);
								percentage = percentage > 100 ? 100 : percentage;
								jQuery('#gd-import-perc', cont).text(parseInt(percentage) + '%');
								jQuery('.gd-fileprogress', cont).css({
									'width': percentage + '%'
								});
							}
							
							if (type=='cat') {
								clearTimeout(timoutC);
								timoutC = setTimeout(function () {
									gd_imex_StartImport(el, type);
								}, 0);
							}
							if (type=='post') {
								clearTimeout(timoutP);
								timoutP = setTimeout(function () {
									gd_imex_StartImport(el, type);
								}, 0);
							}
						} else {
							jQuery('#gd_import_data', cont).hide();
							jQuery('#gd_stop_import', cont).hide();
							jQuery('#gd_process_data', cont).hide();
							jQuery('#gd_continue_data', cont).show();
							return false;
						}
					} else {
						jQuery('#gd_import_data', cont).removeAttr('disabled').show();
						jQuery('#gd_stop_import', cont).hide();
						jQuery('#gd_process_data', cont).hide();
						return false;
					}
				}
			} else {
				jQuery('#gd_import_data', cont).removeAttr('disabled').show();
				jQuery('#gd_stop_import', cont).hide();
				jQuery('#gd_process_data', cont).hide();
			}
		},
		error: function (errorThrown) {
			jQuery('#gd_import_data', cont).removeAttr('disabled').show();
			jQuery('#gd_stop_import', cont).hide();
			jQuery('#gd_process_data', cont).hide();
			console.log(errorThrown);
		}
	});
}

function gd_imex_TerminateImport(el, type) {	
	var cont = jQuery(el).closest('.gd-imex-box');
	jQuery('#gd_terminateaction', cont).val('terminate');
	jQuery('#gd_import_data', cont).hide();
	jQuery('#gd_stop_import', cont).hide();
	jQuery('#gd_process_data', cont).hide();
	jQuery('#gd_continue_data', cont).show();
}

function gd_imex_ContinueImport(el, type) {	
	var cont = jQuery(el).closest('.gd-imex-box');
	var processed = jQuery('#gd_processed', cont).val();
	var total = jQuery('#gd_total', cont).val();
	if (parseInt(processed) > parseInt(total)) {
		jQuery('#gd_stop_import', cont).hide();
	} else {
		jQuery('#gd_stop_import', cont).show();
	}
	jQuery('#gd_import_data', cont).show();
	jQuery('#gd_import_data', cont).attr('disabled', 'disabled');
	jQuery('#gd_process_data', cont).css({
		'display': 'inline-block'
	});
	jQuery('#gd_continue_data', cont).hide();
	jQuery('#gd_terminateaction', cont).val('continue');
	
	if (type=='cat') {
		clearTimeout(timoutC);
		timoutC = setTimeout(function () {
			gd_imex_StartImport(el, type);
		}, 0);
	}
	
	if (type=='post') {
		clearTimeout(timoutP);
		timoutP = setTimeout(function () {
			gd_imex_StartImport(el, type);
		}, 0);
	}
}

function gd_imex_showStatusMsg(el, type) {
	var cont = jQuery(el).closest('.gd-imex-box');
	
	var total = parseInt(jQuery('#gd_total', cont).val());
	var processed = parseInt(jQuery('#gd_processed', cont).val());
	var created = parseInt(jQuery('#gd_created', cont).val());
	var updated = parseInt(jQuery('#gd_updated', cont).val());
	var skipped = parseInt(jQuery('#gd_skipped', cont).val());
	var invalid = parseInt(jQuery('#gd_invalid', cont).val());
	var images = parseInt(jQuery('#gd_images', cont).val());
	if (type=='post') {
		var invalid_addr = parseInt(jQuery('#gd_invalid_addr', cont).val());
	}
	
	var gdMsg = '<p></p>';
	if ( processed > 0 ) {
		var msgParse = '<p><?php 
    echo addslashes(sprintf(__('Total %s item(s) found.', GEODIRECTORY_TEXTDOMAIN), '%s'));
    ?>
</p>';
		msgParse = msgParse.replace("%s", processed);
		gdMsg += msgParse;
	}
	
	if ( updated > 0 ) {
		var msgParse = '<p><?php 
    echo addslashes(sprintf(__('%s / %s item(s) updated.', GEODIRECTORY_TEXTDOMAIN), '%s', '%d'));
    ?>
</p>';
		msgParse = msgParse.replace("%s", updated);
		msgParse = msgParse.replace("%d", processed);
		gdMsg += msgParse;
	}
	
	if ( created > 0 ) {
		var msgParse = '<p><?php 
    echo addslashes(sprintf(__('%s / %s item(s) added.', GEODIRECTORY_TEXTDOMAIN), '%s', '%d'));
    ?>
</p>';
		msgParse = msgParse.replace("%s", created);
		msgParse = msgParse.replace("%d", processed);
		gdMsg += msgParse;
	}
	
	if ( skipped > 0 ) {
		var msgParse = '<p><?php 
    echo addslashes(sprintf(__('%s / %s item(s) ignored due to already exists.', GEODIRECTORY_TEXTDOMAIN), '%s', '%d'));
    ?>
</p>';
		msgParse = msgParse.replace("%s", skipped);
		msgParse = msgParse.replace("%d", processed);
		gdMsg += msgParse;
	}
	
	if (type=='post' && invalid_addr > 0) {
		var msgParse = '<p><?php 
    echo addslashes(sprintf(__('%s / %s item(s) could not be added due to blank/invalid address(city, region, country, latitude, longitude).', GEODIRECTORY_TEXTDOMAIN), '%s', '%d'));
    ?>
</p>';
		msgParse = msgParse.replace("%s", invalid_addr);
		msgParse = msgParse.replace("%d", total);
		gdMsg += msgParse;
	}
	
	if (invalid > 0) {
		var msgParse = '<p><?php 
    echo addslashes(sprintf(__('%s / %s item(s) could not be added due to blank title/invalid post type.', GEODIRECTORY_TEXTDOMAIN), '%s', '%d'));
    ?>
</p>';
		msgParse = msgParse.replace("%s", invalid);
		msgParse = msgParse.replace("%d", total);
		gdMsg += msgParse;
	}
	
	if (images > 0) {
		gdMsg += '<p><?php 
    echo addslashes(sprintf(CSV_TRANSFER_IMG_FOLDER, $uploads['subdir']));
    ?>
</p>';
	}
	gdMsg += '<p></p>';
	jQuery('#gd-import-msg', cont).find('#message').removeClass('error').addClass('updated').html(gdMsg);
	jQuery('#gd-import-msg', cont).show();
	return;
}

function gd_progressbar(el, value, label) {
	var value = parseFloat(value);
	if ( value <= 100 ) {
		jQuery(el).find('#gd_progressbar').progressbar("value",value);
		if (typeof label != 'undefined') {
			jQuery(el).find('#gd_progressbar .gd-progress-label').text(label);
		}
	}
}
			
jQuery(function(){
	var intIp;
	var intIc;
	
	jQuery(".gd-imex-pupload").click(function () {
		var $this = this;
		var $cont = jQuery($this).closest('.gd-imex-box');
		clearInterval(intIp);
		intIp = setInterval(function () {
			if (jQuery($cont).find('.gd-imex-file').val()) {
				jQuery($cont).find('.gd-imex-btns').show();
			}
		}, 1000);
	});
	
	jQuery(".gd-imex-cupload").click(function () {
		var $this = this;
		var $cont = jQuery($this).closest('.gd-imex-box');
		clearInterval(intIc);
		intIc = setInterval(function () {
			if (jQuery($cont).find('.gd-imex-file').val()) {
				jQuery($cont).find('.gd-imex-btns').show();
			}
		}, 1000);
	});
				
	jQuery('#gd_ie_imposts_sample').click(function(){
		if (jQuery('#gd_ie_imposts_csv').val() != '') {
			window.location.href = jQuery('#gd_ie_imposts_csv').val();
			return false;
		}
	});
	
	jQuery('#gd_ie_imcats_sample').click(function(){
		if (jQuery('#gd_ie_imcats_csv').val() != '') {
			window.location.href = jQuery('#gd_ie_imcats_csv').val();
			return false;
		}
	});
	
	jQuery('.gd-import-export .geodir_event_csv_download a').addClass('button-secondary');
	
	jQuery( '.gd_progressbar' ).each(function(){
		jQuery(this).progressbar({value:0});
	});
	
	var timer_posts;
	var pseconds;
	var stat_posts;
	jQuery('#gd_ie_exposts_submit').click(function(){
		pseconds = 1;
		
		var el = jQuery(this).closest('.postbox');
		var post_type = jQuery(el).find('#gd_post_type').val();
		if ( !post_type ) {
			jQuery(el).find('#gd_post_type').focus();
			return false;
		}
		window.clearInterval(timer_posts);
		
		jQuery(this).prop('disabled', true);
		
		timer_posts = window.setInterval( function() {
			jQuery(el).find(".gd_timer").gdposts_timer();
		}, 1000);
		
		gd_process_export_posts(el, post_type);
	});
	
	jQuery.fn.gdposts_timer = function() {
		pseconds++;		
		jQuery(this).text( pseconds.toString().toHMS() );
	}
	
	var timer_cats;
	var cseconds;
	var stat_cats;
	jQuery('#gd_ie_excats_submit').click(function(){
		cseconds = 1;
		
		var el = jQuery(this).closest('.postbox');
		var post_type = jQuery(el).find('#gd_post_type').val();
		if ( !post_type ) {
			jQuery(el).find('#gd_post_type').focus();
			return false;
		}
		window.clearInterval(timer_cats);
		
		jQuery(this).prop('disabled', true);
		
		timer_cats = window.setInterval( function() {
			jQuery(el).find(".gd_timer").gdcats_timer();
		}, 1000);
		
		gd_process_export_cats(el, post_type);
	});
	
	jQuery.fn.gdcats_timer = function() {
		cseconds++;		
		jQuery(this).text( cseconds.toString().toHMS() );
	}
	
	String.prototype.toHMS = function () {
		var sec_num = parseInt(this, 10); // don't forget the second param
		var hours   = Math.floor(sec_num / 3600);
		var minutes = Math.floor((sec_num - (hours * 3600)) / 60);
		var seconds = sec_num - (hours * 3600) - (minutes * 60);

		if (hours   < 10) {hours   = "0"+hours;}
		if (minutes < 10) {minutes = "0"+minutes;}
		if (seconds < 10) {seconds = "0"+seconds;}
		var time    = hours+':'+minutes+':'+seconds;
		return time;
	}
		
	function gd_process_export_posts(el, post_type) {
		gd_progressbar(el, 0, "<?php 
    echo esc_attr(__('Exporting...', GEODIRECTORY_TEXTDOMAIN));
    ?>
");
		jQuery(el).find('#gd_timer').text('00:00:00');

		jQuery.ajax({
			url: ajaxurl,
			type: "POST",
			data: 'action=geodir_import_export&task=export_posts&_pt=' + post_type + '&_nonce=<?php 
    echo $nonce;
    ?>
',
			dataType : 'json',
			cache: false,
			beforeSend: function (jqXHR, settings) {
				jQuery(el).find('#gd_timer').text('00:00:01');
				
				window.clearInterval(stat_posts);
				stat_posts = window.setInterval( function() {
					gd_process_stats( el, 'export_posts', post_type );
				}, 2500);
			},
			success: function( data ) {
				window.clearInterval(stat_posts);
				window.clearInterval(timer_posts);
				
				jQuery(el).find('input[type="submit"]').prop('disabled', false);
				
				if (typeof data == 'object') {
					if (typeof data.error != 'undefined' && data.error) {
						gd_progressbar(el, 0, data.error);
					} else {
						if (typeof data.total != 'undefined' && parseInt(data.total) > 0) {
							gd_progressbar(el, 100, "<?php 
    echo esc_attr(__('Complete!', GEODIRECTORY_TEXTDOMAIN));
    ?>
");
						}
						if (typeof data.csv_file != 'undefined' && data.csv_file != '' ) {
							window.location.href = data.csv_file;
							return true;
						}
					}
				}
			},
			error: function( data ) {
				window.clearInterval(stat_posts);
				window.clearInterval(timer_posts);
				return;
			}
		});
	}
	
	function gd_process_export_cats(el, post_type) {
		gd_progressbar(el, 0, "<?php 
    echo esc_attr(__('Exporting...', GEODIRECTORY_TEXTDOMAIN));
    ?>
");
		jQuery(el).find('#gd_timer').text('00:00:00');

		jQuery.ajax({
			url: ajaxurl,
			type: "POST",
			data: 'action=geodir_import_export&task=export_cats&_pt=' + post_type + '&_nonce=<?php 
    echo $nonce;
    ?>
',
			dataType : 'json',
			cache: false,
			beforeSend: function (jqXHR, settings) {
				jQuery(el).find('#gd_timer').text('00:00:01');
				
				window.clearInterval(stat_cats);
				
				stat_cats = window.setInterval( function() {
					gd_process_stats( el, 'export_cats', post_type );
				}, 2500);
			},
			success: function( data ) {
				if (typeof data == 'object') {
					if (typeof data.error != 'undefined' && data.error) {
						gd_progressbar(el, 0, data.error);
					} else {
						if (typeof data.total != 'undefined' && parseInt(data.total) > 0) {
							gd_progressbar(el, 100, "<?php 
    echo esc_attr(__('Complete!', GEODIRECTORY_TEXTDOMAIN));
    ?>
");
						}
						if (typeof data.csv_file != 'undefined' && data.csv_file != '' ) {
							window.location.href = data.csv_file;
							return true;
						}
					}
				}
			},
			error: function( data ) {
			},
			complete: function( jqXHR, textStatus  ) {
				window.clearInterval(stat_cats);
				window.clearInterval(timer_cats);
				
				jQuery(el).find('input[type="submit"]').prop('disabled', false);
			}
		});
	}
	
	function gd_process_stats(el, task, post_type) {
		jQuery.ajax({
			url: ajaxurl,
			type: "POST",
			data: 'action=geodir_import_export&task='+ task +'&_pt=' + post_type + '&_st=true&_nonce=<?php 
    echo $nonce;
    ?>
',
			dataType : 'json',
			cache: false,
			timeout: 2490,
			success: function(data) {
				if (typeof data == 'object' && parseFloat(data.percentage) > 0) {
					gd_progressbar(el, parseFloat(data.percentage));
				}
				return true;
			},
			error: function( data ) {
				if (data.statusText != 'timeout' && data.status != 200) {
					if (task == 'export_posts') {
						window.clearInterval(stat_posts);
					} else if (task == 'export_cats') {
						window.clearInterval(stat_cats);
					}
				}
				return false;
			}
		});
		return true;
	}
});
</script>
<?php 
}
/**
 * Display the google map html.
 *
 * @since 1.0.0
 *
 * @global array $map_canvas_arr Array of map canvas data.
 *
 * @param array $map_args {
 *    Array of map arguments to use in map options.
 *
 *    @type string $width Map width.
 *    @type string $height Map height.
 *    @type string $child_collapse Collapse filter div?.
 *    @type string $sticky Todo: desc needed.
 *    @type bool $enable_map_resize_button Do you want to enable map resize button?.
 *    @type bool $enable_cat_filters Do you want to enable category filters?.
 *    @type bool $enable_text_search Do you want to enable text search?.
 *    @type bool $enable_post_type_filters Do you want to enable post type filters?.
 *    @type bool $enable_location_filters Do you want to enable location filters?.
 *    @type bool $enable_jason_on_load Do you want to enable json on load?.
 *    @type bool $enable_map_direction Do you want to enable map directions?.
 *    @type bool $enable_marker_cluster Do you want to enable marker cluster?.
 *    @type string $ajax_url Map ajax url.
 *    @type string $map_canvas_name Map canvas name.
 *    @type string $inputText Text search placeholder.
 *    @type string $latitude Map default latitude.
 *    @type string $longitude Map default longitude.
 *    @type string $zoom Map default zoom.
 *    @type string $scrollwheel Map default scroll wheel level.
 *    @type bool $streetViewControl Display street view control?.
 *    @type string $maptype Map type.
 *    @type string $showPreview Show preview?.
 *    @type int $maxZoom Map maximum zoom level.
 *    @type int $autozoom Map auto zoom level.
 *    @type string $bubble_size Map bubble size.
 *    @type string $token Map token.
 *    @type array $navigationControlOptions {
 *        Options of navigation control.
 *
 *        @type string $position Navigation position.
 *        @type string $style Navigation style.
 *
 *    }
 *    @type string $map_class_name Map class name.
 *    @type bool $is_geodir_home_map_widget Is this a home page map? True if the current page is home.
 *
 * }
 * @return string|void Html content for google map.
 */
function geodir_draw_map($map_args = array())
{
    global $map_canvas_arr;
    $map_canvas_name = !empty($map_args) && $map_args['map_canvas_name'] != '' ? $map_args['map_canvas_name'] : 'home_map_canvas';
    $map_class_name = !empty($map_args) && isset($map_args['map_class_name']) ? $map_args['map_class_name'] : '';
    $default_location = geodir_get_default_location();
    $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
    $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
    $map_default_zoom = 12;
    // map options default values
    $width = 950;
    $height = 450;
    $child_collapse = '0';
    $sticky = '';
    $enable_cat_filters = false;
    $enable_text_search = false;
    $enable_post_type_filters = false;
    $enable_location_filters = false;
    $enable_jason_on_load = false;
    $enable_map_direction = false;
    $enable_marker_cluster = false;
    $enable_map_resize_button = false;
    $maptype = 'ROADMAP';
    $geodir_map_options = array('width' => $width, 'height' => $height, 'child_collapse' => $child_collapse, 'sticky' => $sticky, 'enable_map_resize_button' => $enable_map_resize_button, 'enable_cat_filters' => $enable_cat_filters, 'enable_text_search' => $enable_text_search, 'enable_post_type_filters' => $enable_post_type_filters, 'enable_location_filters' => $enable_location_filters, 'enable_jason_on_load' => $enable_jason_on_load, 'enable_map_direction' => $enable_map_direction, 'enable_marker_cluster' => $enable_marker_cluster, 'ajax_url' => geodir_get_ajax_url(), 'map_canvas_name' => $map_canvas_name, 'inputText' => __('Title or Keyword', 'geodirectory'), 'latitude' => $map_default_lat, 'longitude' => $map_default_lng, 'zoom' => $map_default_zoom, 'scrollwheel' => true, 'streetViewControl' => true, 'maptype' => $maptype, 'showPreview' => '0', 'maxZoom' => 21, 'autozoom' => true, 'bubble_size' => 'small', 'token' => '68f48005e256696074e1da9bf9f67f06', 'navigationControlOptions' => array('position' => 'TOP_LEFT', 'style' => 'ZOOM_PAN'));
    if (!empty($map_args)) {
        foreach ($map_args as $map_option_key => $map_option_value) {
            $geodir_map_options[$map_option_key] = $map_option_value;
        }
    }
    if (strpos($geodir_map_options['height'], '%') !== false || strpos($geodir_map_options['height'], 'px') !== false || strpos($geodir_map_options['height'], 'vh') !== false) {
    } else {
        $geodir_map_options['height'] = $geodir_map_options['height'] . 'px';
    }
    if (strpos($geodir_map_options['width'], '%') !== false || strpos($geodir_map_options['width'], 'px') !== false) {
    } else {
        $geodir_map_options['width'] = $geodir_map_options['width'] . 'px';
    }
    /**
     * Filter the options to use in google map.
     *
     * @since 1.0.0
     *
     * @param array $geodir_map_options {@see geodir_draw_map()} docblock.
     */
    $geodir_map_options = apply_filters("geodir_map_options_{$map_canvas_name}", $geodir_map_options);
    $map_canvas_arr[$map_canvas_name] = array();
    /**
     * Filter the post types to display data on map.
     *
     * @since 1.0.0
     *
     * @param object $object Objects of post types.
     */
    $post_types = apply_filters("geodir_map_post_type_list_{$map_canvas_name}", geodir_get_posttypes('object'));
    /**
     * Filter the post types to exclude to display data on map.
     *
     * @since 1.0.0
     *
     * @param array Array of post types to exclude to display data on map.
     */
    $exclude_post_types = apply_filters("geodir_exclude_post_type_on_map_{$map_canvas_name}", get_option('geodir_exclude_post_type_on_map'));
    if (count((array) $post_types) != count($exclude_post_types) || $enable_jason_on_load) {
        // Set default map options
        wp_enqueue_script('geodir-map-widget', geodir_plugin_url() . '/geodirectory-functions/map-functions/js/map.min.js');
        wp_localize_script('geodir-map-widget', $map_canvas_name, $geodir_map_options);
        if ($map_canvas_name == 'detail_page_map_canvas' || $map_canvas_name == 'preview_map_canvas') {
            $map_width = '100%';
        } else {
            $map_width = $geodir_map_options['width'];
        }
        /**
         * Filter the width of map.
         *
         * @since 1.0.0
         *
         * @param int $map_width Width of map box, eg: gd_place.
         */
        $map_width = apply_filters('geodir_change_map_width', $map_width);
        ?>
        <div id="catcher_<?php 
        echo $map_canvas_name;
        ?>
"></div>
        <div class="stick_trigger_container">
            <div class="trigger_sticky triggeroff_sticky"></div>
            <div class="top_banner_section geodir_map_container <?php 
        echo $map_class_name;
        ?>
"
                 id="sticky_map_<?php 
        echo $map_canvas_name;
        ?>
"
                 style="min-height:<?php 
        echo $geodir_map_options['height'];
        ?>
;width:<?php 
        echo $map_width;
        ?>
;">

                <div class="map_background">
                    <div class="top_banner_section_in clearfix">
                        <div class="<?php 
        echo $map_canvas_name;
        ?>
_TopLeft TopLeft"><span class="triggermap" id="<?php 
        echo $map_canvas_name;
        ?>
_triggermap" <?php 
        if (!$geodir_map_options['enable_map_resize_button']) {
            ?>
 <?php 
        }
        ?>
><i class="fa fa-arrows-alt"></i></span></div>
                        <div class="<?php 
        echo $map_canvas_name;
        ?>
_TopRight TopRight"></div>
                        <div id="<?php 
        echo $map_canvas_name;
        ?>
_wrapper" class="main_map_wrapper"
                             style="height:<?php 
        echo $geodir_map_options['height'];
        ?>
;width:<?php 
        echo $map_width;
        ?>
;">
                            <!-- new map start -->
                            <div class="iprelative">
                                <div class="geodir_marker_cluster" id="<?php 
        echo $map_canvas_name;
        ?>
"
                                     style="height:<?php 
        echo $geodir_map_options['height'];
        ?>
;width:<?php 
        echo $map_width;
        ?>
;"></div>
                                <div id="<?php 
        echo $map_canvas_name;
        ?>
_loading_div" class="loading_div"
                                     style=" height:<?php 
        echo $geodir_map_options['height'];
        ?>
;width:<?php 
        echo $map_width;
        ?>
;"></div>
                                <!--<div id="home_map_counter"></div>        -->
                                <div id="<?php 
        echo $map_canvas_name;
        ?>
_map_nofound"
                                     class="advmap_nofound"><?php 
        echo MAP_NO_RESULTS;
        ?>
</div>
                            </div>
                            <!-- new map end -->
                        </div>
                        <div class="<?php 
        echo $map_canvas_name;
        ?>
_BottomLeft BottomLeft"></div>
                    </div>
                </div>
                <?php 
        if ($geodir_map_options['enable_jason_on_load']) {
            ?>
                    <input type="hidden" id="<?php 
            echo $map_canvas_name;
            ?>
_jason_enabled" value="1"/>
                <?php 
        } else {
            ?>
                    <input type="hidden" id="<?php 
            echo $map_canvas_name;
            ?>
_jason_enabled" value="0"/>
                <?php 
        }
        if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters']) {
            $show_entire_cat_panel = "none";
        } else {
            $show_entire_cat_panel = "''";
        }
        ?>

                <?php 
        if ($geodir_map_options['enable_map_direction']) {
            ?>

                    <input type="text" id="<?php 
            echo $map_canvas_name;
            ?>
_fromAddress" name="from" class="textfield"
                           value="<?php 
            echo ENTER_LOCATION_TEXT;
            ?>
"
                           onblur="if (this.value == '') {this.value = '<?php 
            echo ENTER_LOCATION_TEXT;
            ?>
';}"
                           onfocus="if (this.value == '<?php 
            echo ENTER_LOCATION_TEXT;
            ?>
') {this.value = '';}"/>
                    <input type="button" value="<?php 
            _e('Get Directions', 'geodirectory');
            ?>
"
                           class="<?php 
            echo $map_canvas_name;
            ?>
_getdirection" id="directions"
                           onclick="calcRoute('<?php 
            echo $map_canvas_name;
            ?>
')"/>

                    <script>
                        <?php 
            if (geodir_is_page('detail')) {
                ?>
                        jQuery(function () {
                            gd_initialize_ac();
                        });
                        <?php 
            }
            ?>

                        function gd_initialize_ac() {
                            // Create the autocomplete object, restricting the search
                            // to geographical location types.
                            autocomplete = new google.maps.places.Autocomplete(
                                /** @type {HTMLInputElement} */(document.getElementById('<?php 
            echo $map_canvas_name;
            ?>
_fromAddress')),
                                {types: ['geocode']});
                            // When the user selects an address from the dropdown,
                            // populate the address fields in the form.
                            google.maps.event.addListener(autocomplete, 'place_changed', function () {
                                gd_fillInAddress_ac();
                            });
                        }

                        function gd_fillInAddress_ac() {
                            //submit the form
                            jQuery('#directions').trigger('click');
                        }

                    </script>


                    <div id='directions-options' class="hidden">
                        <select id="travel-mode" onchange="calcRoute('<?php 
            echo $map_canvas_name;
            ?>
')">
                            <option value="driving"><?php 
            _e('Driving', 'geodirectory');
            ?>
</option>
                            <option value="walking"><?php 
            _e('Walking', 'geodirectory');
            ?>
</option>
                            <option value="bicycling"><?php 
            _e('Bicycling', 'geodirectory');
            ?>
</option>
                            <option value="transit"><?php 
            _e('Public Transport', 'geodirectory');
            ?>
</option>
                        </select>

                        <select id="travel-units" onchange="calcRoute('<?php 
            echo $map_canvas_name;
            ?>
')">
                            <option value="miles"><?php 
            _e('Miles', 'geodirectory');
            ?>
</option>
                            <option <?php 
            if (get_option('geodir_search_dist_1') == 'km') {
                echo 'selected="selected"';
            }
            ?>
 value="kilometers"><?php 
            _e('Kilometers', 'geodirectory');
            ?>
</option>
                        </select>
                    </div>

                    <div id="<?php 
            echo $map_canvas_name;
            ?>
_directionsPanel" style="width:auto;"></div>
                <?php 
        }
        $geodir_default_map_search_pt = get_option('geodir_default_map_search_pt');
        if (empty($geodir_default_map_search_pt)) {
            $geodir_default_map_search_pt = 'gd_place';
        }
        /**
         * Filter the post type to retrive data for map
         *
         * @since 1.0.0
         *
         * @param string $geodir_default_map_search_pt Post type, eg: gd_place.
         */
        $map_search_pt = apply_filters('geodir_default_map_search_pt', $geodir_default_map_search_pt);
        ?>
                <div class="map-category-listing-main" style="display:<?php 
        echo $show_entire_cat_panel;
        ?>
">
                    <?php 
        $exclude_post_types = get_option('geodir_exclude_post_type_on_map');
        $geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types);
        $map_cat_class = '';
        if ($geodir_map_options['enable_post_type_filters']) {
            $map_cat_class = $geodir_available_pt_on_map > 1 ? ' map-cat-ptypes' : ' map-cat-floor';
        }
        ?>
                    <div
                        class="map-category-listing<?php 
        echo $map_cat_class;
        ?>
">
                        <div class="trigger triggeroff"><i class="fa fa-compress"></i><i class="fa fa-expand"></i></div>
                        <div id="<?php 
        echo $map_canvas_name;
        ?>
_cat"
                             class="<?php 
        echo $map_canvas_name;
        ?>
_map_category  map_category"
                             <?php 
        if ($child_collapse) {
            ?>
checked="checked" <?php 
        }
        ?>
                             style="max-height:<?php 
        echo $geodir_map_options['height'];
        ?>
;">
                            <input
                                onkeydown="if(event.keyCode == 13){build_map_ajax_search_param('<?php 
        echo $map_canvas_name;
        ?>
', false)}"
                                type="text"
                                class="inputbox <?php 
        echo $geodir_map_options['enable_text_search'] ? '' : 'geodir-hide';
        ?>
"
                                id="<?php 
        echo $map_canvas_name;
        ?>
_search_string" name="search"
                                placeholder="<?php 
        _e('Title', 'geodirectory');
        ?>
"/>
                            <?php 
        if ($geodir_map_options['enable_cat_filters']) {
            ?>
                                <?php 
            if ($geodir_map_options['child_collapse']) {
                $child_collapse = "1";
                ?>
                                    <input type="hidden" id="<?php 
                echo $map_canvas_name;
                ?>
_child_collapse" value="1"/>
                                <?php 
            } else {
                $child_collapse = "0";
                ?>
                                    <input type="hidden" id="<?php 
                echo $map_canvas_name;
                ?>
_child_collapse" value="0"/>
                                <?php 
            }
            ?>
                                <input type="hidden" id="<?php 
            echo $map_canvas_name;
            ?>
_cat_enabled" value="1"/>
                                <div class="toggle">
                                    <?php 
            echo home_map_taxonomy_walker(array($map_search_pt . 'category'), 0, true, 0, $map_canvas_name, $child_collapse, true);
            ?>
                                    <script>jQuery( document ).ready(function() {
                                            geodir_show_sub_cat_collapse_button();
                                        });</script>
                                </div>
                            <?php 
        } else {
            // end of cat filter
            ?>
                                <input type="hidden" id="<?php 
            echo $map_canvas_name;
            ?>
_cat_enabled" value="0"/>
                                <input type="hidden" id="<?php 
            echo $map_canvas_name;
            ?>
_child_collapse" value="0"/>
                            <?php 
        }
        ?>
                            <div class="BottomRight"></div>
                            <br/>

                        </div>
                    </div>
                </div>
                <!-- map-category-listings-->

                <?php 
        if ($geodir_map_options['enable_location_filters']) {
            $country = get_query_var('gd_country');
            $region = get_query_var('gd_region');
            $city = get_query_var('gd_city');
            //fix for location/me page
            $country = $country != 'me' ? $country : '';
            $region = $region != 'me' ? $region : '';
            $city = $country != 'me' ? $city : '';
            ?>
                    <input type="hidden" id="<?php 
            echo $map_canvas_name;
            ?>
_location_enabled" value="1"/>
                    <input type="hidden" id="<?php 
            echo $map_canvas_name;
            ?>
_country" name="gd_country"
                           value="<?php 
            echo $country;
            ?>
"/>
                    <input type="hidden" id="<?php 
            echo $map_canvas_name;
            ?>
_region" name="gd_region"
                           value="<?php 
            echo $region;
            ?>
"/>
                    <input type="hidden" id="<?php 
            echo $map_canvas_name;
            ?>
_city" name="gd_city"
                           value="<?php 
            echo $city;
            ?>
"/>
                    <input type="hidden" id="<?php 
            echo $map_canvas_name;
            ?>
_neighbourhood" name="gd_neighbourhood"
                           value="<?php 
            if (isset($_REQUEST['gd_neighbourhood'])) {
                echo $_REQUEST['gd_neighbourhood'];
            }
            ?>
"/>
                <?php 
        } else {
            //end of location filter
            ?>
                    <input type="hidden" id="<?php 
            echo $map_canvas_name;
            ?>
_location_enabled" value="0"/>
                <?php 
        }
        ?>

                <input type="hidden" id="<?php 
        echo $map_canvas_name;
        ?>
_posttype" name="gd_posttype" value="<?php 
        echo $map_search_pt;
        ?>
"/>

                <input type="hidden" name="limitstart" value=""/>



                <?php 
        if ($geodir_map_options['enable_post_type_filters']) {
            $post_types = geodir_get_posttypes('object');
            if (count((array) $post_types) > 1) {
                ?>
                        <div class="map-places-listing" id="<?php 
                echo $map_canvas_name;
                ?>
_posttype_menu"
                             style="max-width:<?php 
                echo $map_width;
                ?>
!important;">

                            <?php 
                if (isset($geodir_map_options['is_geodir_home_map_widget']) && $map_args['is_geodir_home_map_widget']) {
                    ?>
                            <div class="geodir-map-posttype-list"><?php 
                }
                ?>
                                <ul class="clearfix place-list">
                                    <?php 
                $exclude_post_types = get_option('geodir_exclude_post_type_on_map');
                foreach ($post_types as $post_type => $args) {
                    if (!in_array($post_type, $exclude_post_types)) {
                        $class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : '';
                        echo '<li id="' . $post_type . '" ' . $class . '><a href="javascript:void(0);" onclick="jQuery(\'#' . $map_canvas_name . '_posttype\').val(\'' . $post_type . '\');build_map_ajax_search_param(\'' . $map_canvas_name . '\', true)">' . __(ucfirst($args->labels->name), 'geodirectory') . '</a></li>';
                    }
                }
                ?>
                                </ul>
                                <?php 
                if (isset($geodir_map_options['is_geodir_home_map_widget']) && $map_args['is_geodir_home_map_widget']) {
                    ?>
                            </div><?php 
                }
                ?>
                            <div class="geodir-map-navigation">
                                <ul>
                                    <li class="geodir-leftarrow"><a href="#"><i class="fa fa-chevron-left"></i></a></li>
                                    <li class="geodir-rightarrow"><a href="#"><i class="fa fa-chevron-right"></i></a>
                                    </li>
                                </ul>
                            </div>

                        </div> <!-- map-places-listings-->
                    <?php 
            }
        }
        // end of post type filter if
        ?>

            </div>
        </div> <!--end of stick trigger container-->
        <script type="text/javascript">

            jQuery(document).ready(function () {
                //initMap('<?php 
        echo $map_canvas_name;
        ?>
'); // depreciated, no need to load this twice
                build_map_ajax_search_param('<?php 
        echo $map_canvas_name;
        ?>
', false);
                map_sticky('<?php 
        echo $map_canvas_name;
        ?>
');
            });

        </script>
        <?php 
        if (strpos($geodir_map_options['height'], 'vh')) {
            ?>
            <script>
                (function () {
                    var screenH = jQuery(window).height();
                    var heightVH = "<?php 
            echo str_replace("vh", "", $geodir_map_options['height']);
            ?>
";

                    var ptypeH = '';
                    if (jQuery("#<?php 
            echo $map_canvas_name;
            ?>
_posttype_menu").length) {
                        ptypeH = jQuery("#<?php 
            echo $map_canvas_name;
            ?>
_posttype_menu").outerHeight();
                    }

                    jQuery("#sticky_map_<?php 
            echo $map_canvas_name;
            ?>
").css("min-height", screenH * (heightVH / 100) + 'px');
                    jQuery("#<?php 
            echo $map_canvas_name;
            ?>
_wrapper").height(screenH * (heightVH / 100) + 'px');
                    jQuery("#<?php 
            echo $map_canvas_name;
            ?>
").height(screenH * (heightVH / 100) + 'px');
                    jQuery("#<?php 
            echo $map_canvas_name;
            ?>
_loading_div").height(screenH * (heightVH / 100) + 'px');
                    jQuery("#<?php 
            echo $map_canvas_name;
            ?>
_cat").css("max-height", (screenH * (heightVH / 100)) - ptypeH + 'px');

                }());
            </script>

        <?php 
        } elseif (strpos($geodir_map_options['height'], 'px')) {
            ?>
            <script>
                (function () {
                    var screenH = jQuery(window).height();
                    var heightVH = "<?php 
            echo str_replace("px", "", $geodir_map_options['height']);
            ?>
";
                    var ptypeH = '';
                    if (jQuery("#<?php 
            echo $map_canvas_name;
            ?>
_posttype_menu").length) {
                        ptypeH = jQuery("#<?php 
            echo $map_canvas_name;
            ?>
_posttype_menu").outerHeight();
                    }

                    jQuery("#<?php 
            echo $map_canvas_name;
            ?>
_cat").css("max-height", heightVH - ptypeH + 'px');

                }());
            </script>
        <?php 
        }
        /**
         * Action that runs after all the map code has been output;
         *
         * @since 1.5.3
         *
         * @param array $geodir_map_options Array of map settings.
         * @param string $map_canvas_name The canvas name and ID for the map.
         */
        do_action('geodir_map_after_render', $geodir_map_options, $map_canvas_name);
    }
    // Exclude posttypes if end
}
function mhk_geodir_action_details_slider()
{
    global $preview, $post;
    if ($preview) {
        //print_r($post);
        if (isset($post->post_images)) {
            $post->post_images = trim($post->post_images, ",");
        }
        if (isset($post->post_images) && !empty($post->post_images)) {
            $post_images = explode(",", $post->post_images);
        }
        $main_slides = '';
        $nav_slides = '';
        $slides = 0;
        if (!empty($post_images)) {
            foreach ($post_images as $image) {
                if (!empty($image)) {
                    @(list($width, $height) = getimagesize(trim($image)));
                    if ($image && $width && $height) {
                        $image = (object) array('src' => $image, 'width' => $width, 'height' => $height);
                    }
                    if (isset($image->src)) {
                        if ($image->height >= 400) {
                            $spacer_height = 0;
                        } else {
                            $spacer_height = (400 - $image->height) / 2;
                        }
                        $image_title = isset($image->title) ? $image->title : '';
                        $main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '"  alt="' . $image_title . '" title="' . $image_title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />';
                        $main_slides .= '<img src="' . $image->src . '"  alt="' . $image_title . '" title="' . $image_title . '" style="max-height:400px;margin:0 auto;" /></li>';
                        $nav_slides .= '<li><img src="' . $image->src . '"  alt="' . $image_title . '" title="' . $image_title . '" style="max-height:48px;margin:0 auto;" /></li>';
                        $slides++;
                    }
                }
            }
            // endfore
        }
        //end if
    } else {
        global $post;
        // Get images attached to geopost
        $post_images = geodir_get_images($post->ID, 'thumbnail');
        //$default_image = get_option('geodir_listing_no_img');
        //echo $default_image;
        // if(get_option('geodir_listing_no_img')){
        //     $post_images = '';
        // }
    }
    echo ' <div class="slider-info-container">';
    if ($preview) {
        if (!empty($post_images)) {
            ?>

            <div class="geodir_flex-container" >    
                <div class="geodir_flex-loader"><i class="fa fa-refresh fa-spin"></i></div> 
               
                <div id="geodir_slider" class="geodir_flexslider ">
                  <ul class="geodir-slides clearfix">
                        <?php 
            echo $main_slides;
            ?>
                  </ul>
                </div>
                <?php 
            if ($slides > 1) {
                ?>
                    <div id="geodir_carousel" class="geodir_flexslider">
                      <ul class="geodir-slides clearfix">
                            <?php 
                echo $nav_slides;
                ?>
                      </ul>
                    </div>
                <?php 
            }
            ?>
                    
            </div>
               <?php 
        }
    } else {
        // Count Slides and work out whether to display thubnails or not
        $slides = 0;
        if (!empty($post_images)) {
            foreach ($post_images as $image) {
                $slides++;
            }
            // endfore
        }
        //end if
        $display_thumb = 'true';
        if ($slides <= 1) {
            $display_thumb = 'false';
        }
        // Output Soliloquy Slider if images.
        if (!empty($post_images)) {
            ?>
            <div class="mhk-soliloquy-container">


            	<?php 
            soliloquy_dynamic(array('id' => $post->ID, 'thumbnails' => $display_thumb));
            ?>
            </div>

           <?php 
        }
    }
}
							
							<tr class="geodir_distance_sort_options" <?php 
    echo $show_sort_fields;
    ?>
>
							<td>Select Farthest</td>
								<td>
								 <input type="checkbox"  name="search_desc" id="search_desc"  value="1" <?php 
    if (isset($search_desc) && $search_desc == '1') {
        echo 'checked="checked"';
    }
    ?>
/>
								
								 <img src="<?php 
    echo geodir_plugin_url();
    ?>
/geodirectory-assets/images/down-arrow18x11.png" class="field_sort_icon"/>
								 <input type="text" name="search_desc_title" id="search_desc_title" value="<?php 
    if (isset($search_desc_title)) {
        echo esc_attr($search_desc_title);
    }
    ?>
" style="width:75%;" placeholder="<?php 
    esc_attr_e('Descending title', GEODIRADVANCESEARCH_TEXTDOMAIN);
    ?>
" />
								 <br />
									<span><?php 
    _e('Select if you want to show option in distance sort.', GEODIRADVANCESEARCH_TEXTDOMAIN);
    ?>