/** * Front end listing view template selection. * * This function adds a drop down in front end listing page for selecting view template. Ex: list view, 2 column grid view, etc. * * @since 1.0.0 * @package GeoDirectory */ function geodir_list_view_select() { ?> <script type="text/javascript"> function geodir_list_view_select(list) { //alert(listval); val = list.value; if (!val) { return; } //var listSel = jQuery(list).closest('.geodir_category_list_view'); var listSel = jQuery(list).parent().parent().next('.geodir_category_list_view'); if (val != 1) { jQuery(listSel).children('li').addClass('geodir-gridview'); jQuery(listSel).children('li').removeClass('geodir-listview'); } else { jQuery(listSel).children('li').addClass('geodir-listview'); } if (val == 1) { jQuery(listSel).children('li').removeClass('geodir-gridview gridview_onehalf gridview_onethird gridview_onefourth gridview_onefifth'); } else if (val == 2) { jQuery(listSel).children('li').switchClass('gridview_onethird gridview_onefourth gridview_onefifth', 'gridview_onehalf', 600); } else if (val == 3) { jQuery(listSel).children('li').switchClass('gridview_onehalf gridview_onefourth gridview_onefifth', 'gridview_onethird', 600); } else if (val == 4) { jQuery(listSel).children('li').switchClass('gridview_onehalf gridview_onethird gridview_onefifth', 'gridview_onefourth', 600); } else if (val == 5) { jQuery(listSel).children('li').switchClass('gridview_onehalf gridview_onethird gridview_onefourth', 'gridview_onefifth', 600); } jQuery.post("<?php echo geodir_get_ajax_url(); ?> &gd_listing_view=" + val, function (data) { //alert(data ); }); } </script> <div class="geodir-list-view-select"> <select name="gd_list_view" id="gd_list_view" onchange="geodir_list_view_select(this);"> <?php if (isset($_SESSION['gd_listing_view']) && $_SESSION['gd_listing_view'] != '') { $sel = $_SESSION['gd_listing_view']; } else { $sel = ''; } ?> <option value=""><?php _e('View:', 'geodirectory'); ?> </option> <option value="1" <?php if ($sel == '1') { echo 'selected="selected"'; } ?> ><?php _e('View: List', 'geodirectory'); ?> </option> <option value="2" <?php if ($sel == '2') { echo 'selected="selected"'; } ?> ><?php _e('View: Grid 2', 'geodirectory'); ?> </option> <option value="3" <?php if ($sel == '3') { echo 'selected="selected"'; } ?> ><?php _e('View: Grid 3', 'geodirectory'); ?> </option> <option value="4" <?php if ($sel == '4') { echo 'selected="selected"'; } ?> ><?php _e('View: Grid 4', 'geodirectory'); ?> </option> <option value="5" <?php if ($sel == '5') { echo 'selected="selected"'; } ?> ><?php _e('View: Grid 5', 'geodirectory'); ?> </option> </select> </div> <?php }
/** * Custom taxonomy walker function. * * @since 1.0.0 * @package GeoDirectory * @global object $post WordPress Post object. * @param string $cat_taxonomy The taxonomy name. * @param string $cat_limit Number of categories to display. */ function geodir_custom_taxonomy_walker2($cat_taxonomy, $cat_limit = '') { $post_category = ''; $post_category_str = ''; global $exclude_cats; $cat_exclude = ''; if (is_array($exclude_cats) && !empty($exclude_cats)) { $cat_exclude = serialize($exclude_cats); } if (isset($_REQUEST['backandedit'])) { $post = (object) unserialize($_SESSION['listing']); if (!is_array($post->post_category[$cat_taxonomy])) { $post_category = $post->post_category[$cat_taxonomy]; } $post_categories = $post->post_category_str; if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) { $post_category_str = $post_categories[$cat_taxonomy]; } } elseif (geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' || is_admin()) { global $post; $post_category = geodir_get_post_meta($post->ID, $cat_taxonomy, true); if (empty($post_category) && isset($post->{$cat_taxonomy})) { $post_category = $post->{$cat_taxonomy}; } $post_categories = get_post_meta($post->ID, 'post_categories', true); if (empty($post_category) && !empty($post_categories) && !empty($post_categories[$cat_taxonomy])) { foreach (explode(",", $post_categories[$cat_taxonomy]) as $cat_part) { if (is_numeric($cat_part)) { $cat_part_arr[] = $cat_part; } } if (is_array($cat_part_arr)) { $post_category = implode(',', $cat_part_arr); } } if (!empty($post_category)) { $cat1 = array_filter(explode(',', $post_category)); $post_category = ',' . implode(',', $cat1) . ','; } if ($post_category != '' && is_array($exclude_cats) && !empty($exclude_cats)) { $post_category_upd = explode(',', $post_category); $post_category_change = ''; foreach ($post_category_upd as $cat) { if (!in_array($cat, $exclude_cats) && $cat != '') { $post_category_change .= ',' . $cat; } } $post_category = $post_category_change; } if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) { $post_category_str = $post_categories[$cat_taxonomy]; } } echo '<input type="hidden" id="cat_limit" value="' . $cat_limit . '" name="cat_limit[' . $cat_taxonomy . ']" />'; echo '<input type="hidden" id="post_category" value="' . $post_category . '" name="post_category[' . $cat_taxonomy . ']" />'; echo '<input type="hidden" id="post_category_str" value="' . $post_category_str . '" name="post_category_str[' . $cat_taxonomy . ']" />'; ?> <div class="cat_sublist"> <?php $post_id = isset($post->ID) ? $post->ID : ''; if ((geodir_is_page('add-listing') || is_admin()) && !empty($post_categories[$cat_taxonomy])) { geodir_editpost_categories_html($cat_taxonomy, $post_id, $post_categories); } ?> </div> <script type="text/javascript"> function show_subcatlist(main_cat, catObj) { if (main_cat != '') { var url = '<?php echo geodir_get_ajax_url(); ?> '; var cat_taxonomy = '<?php echo $cat_taxonomy; ?> '; var cat_exclude = '<?php echo base64_encode($cat_exclude); ?> '; var cat_limit = jQuery('#' + cat_taxonomy).find('#cat_limit').val(); <?php if ((int) $cat_limit > 0) { ?> var selected = parseInt(jQuery('#' + cat_taxonomy).find('.cat_sublist > div.post_catlist_item').length); if (cat_limit != '' && selected > 0 && selected >= cat_limit && cat_limit != 0) { alert("<?php echo esc_attr(wp_sprintf(__('You have reached category limit of %d categories.', 'geodirectory'), (int) $cat_limit)); ?> "); return false; } <?php } ?> jQuery.post(url, { geodir_ajax: 'category_ajax', cat_tax: cat_taxonomy, main_catid: main_cat, exclude: cat_exclude }, function (data) { if (data != '') { jQuery('#' + cat_taxonomy).find('.cat_sublist').append(data); setTimeout(function () { jQuery('#' + cat_taxonomy).find('.cat_sublist').find('.chosen_select').chosen(); }, 200); } maincat_obj = jQuery('#' + cat_taxonomy).find('.main_cat_list'); if (cat_limit != '' && jQuery('#' + cat_taxonomy).find('.cat_sublist .chosen_select').length >= cat_limit) { maincat_obj.find('.chosen_select').chosen('destroy'); maincat_obj.hide(); } else { maincat_obj.show(); maincat_obj.find('.chosen_select').chosen('destroy'); maincat_obj.find('.chosen_select').prop('selectedIndex', 0); maincat_obj.find('.chosen_select').chosen(); } update_listing_cat(); }); } update_listing_cat(); } function update_listing_cat(el) { var cat_taxonomy = '<?php echo $cat_taxonomy; ?> '; var cat_ids = ''; var main_cat = ''; var sub_cat = ''; var post_cat_str = ''; var cat_limit = jQuery('#' + cat_taxonomy).find('#cat_limit').val(); var delEl = jQuery(el).closest('.post_catlist_item').find('input.listing_main_cat'); if (typeof el != 'undefined' && jQuery(delEl).val()) { jQuery('.geodir_taxonomy_field').find('select > option[_hc="f"][value="'+jQuery(delEl).val()+'"]').attr('disabled', false); } jQuery('.geodir_taxonomy_field').find('input.listing_main_cat:checked').each(function() { var cV = jQuery(this).val(); if (parseInt(cV) > 0) { jQuery('.geodir_taxonomy_field').find('select > option[_hc="f"][value="'+cV+'"]').attr('disabled', true); } }); jQuery('#' + cat_taxonomy).find('.cat_sublist > div').each(function () { main_cat = jQuery(this).find('.listing_main_cat').val(); if (jQuery(this).find('.chosen_select').length > 0) sub_cat = jQuery(this).find('.chosen_select').val() if (post_cat_str != '') post_cat_str = post_cat_str + '#'; post_cat_str = post_cat_str + main_cat; if (jQuery(this).find('.listing_main_cat').is(':checked')) { cat_ids = cat_ids + ',' + main_cat; post_cat_str = post_cat_str + ',y'; if (jQuery(this).find('.post_default_category input').is(':checked')) post_cat_str = post_cat_str + ',d'; } else { post_cat_str = post_cat_str + ',n'; } if (sub_cat != '' && sub_cat) { cat_ids = cat_ids + ',' + sub_cat; post_cat_str = post_cat_str + ':' + sub_cat; } else { post_cat_str = post_cat_str + ':'; } }); maincat_obj = jQuery('#' + cat_taxonomy).find('.main_cat_list'); if (cat_limit != '' && jQuery('#' + cat_taxonomy).find('.cat_sublist > div.post_catlist_item').length >= cat_limit && cat_limit != 0) { maincat_obj.find('.chosen_select').chosen('destroy'); maincat_obj.hide(); } else { maincat_obj.show(); maincat_obj.find('.chosen_select').chosen('destroy'); maincat_obj.find('.chosen_select').prop('selectedIndex', 0); maincat_obj.find('.chosen_select').chosen(); } maincat_obj.find('.chosen_select').trigger("chosen:updated"); jQuery('#' + cat_taxonomy).find('#post_category').val(cat_ids); jQuery('#' + cat_taxonomy).find('#post_category_str').val(post_cat_str); } jQuery(function () { update_listing_cat(); }) </script> <?php if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) { $post_cat_str = $post_categories[$cat_taxonomy]; $post_cat_array = explode("#", $post_cat_str); if (count($post_cat_array) >= $cat_limit && $cat_limit != 0) { $style = "display:none;"; } } ?> <div class="main_cat_list" style=" <?php if (isset($style)) { echo $style; } ?> "> <?php geodir_get_catlist($cat_taxonomy, 0); // print main categories list ?> </div> <?php }
/** * Handles loading of all geodirectory javascripts and its dependencies. * * @since 1.0.0 * @package GeoDirectory */ function geodir_templates_scripts() { $is_detail_page = false; if (is_single() && geodir_is_geodir_page() || is_page() && geodir_is_page('preview')) { $is_detail_page = true; } wp_enqueue_script('jquery'); wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js#asyncload', array(), GEODIRECTORY_VERSION); wp_enqueue_script('geodirectory-script'); $geodir_vars_data = array('siteurl' => get_option('siteurl'), 'geodir_plugin_url' => geodir_plugin_url(), 'geodir_ajax_url' => geodir_get_ajax_url(), 'geodir_gd_modal' => (int) get_option('geodir_disable_gb_modal'), 'is_rtl' => is_rtl() ? 1 : 0); /** * Filter the `geodir_var` data array that outputs the wp_localize_script() translations and variables. * * This is used by addons to add JS translatable variables. * * @since 1.4.4 * @param array $geodir_vars_data { * geodir var data used by addons to add JS translatable variables. * * @type string $siteurl Site url. * @type string $geodir_plugin_url Geodirectory core plugin url. * @type string $geodir_ajax_url Geodirectory plugin ajax url. * @type int $geodir_gd_modal Disable GD modal that displays slideshow images in popup?. * @type int $is_rtl Checks if current locale is RTL. * * } */ $geodir_vars_data = apply_filters('geodir_vars_data', $geodir_vars_data); wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data); wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION, true); if ($is_detail_page) { wp_enqueue_script('geodirectory-jquery-flexslider-js'); } wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION, true); wp_enqueue_script('geodirectory-lightbox-jquery'); wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION, true); if ($is_detail_page) { wp_enqueue_script('geodirectory-jquery-simplemodal'); } //if( get_option('geodir_enqueue_google_api_script')==1) $map_lang = "&language=" . geodir_get_map_default_language(); /** * Filter the variables that are added to the end of the google maps script call. * * This i used to change things like google maps language etc. * * @since 1.0.0 * @param string $var The string to filter, default is empty string. */ $map_extra = apply_filters('geodir_googlemap_script_extra', ''); wp_enqueue_script('geodirectory-googlemap-script', '//maps.google.com/maps/api/js?' . $map_lang . $map_extra, '', NULL); /* { wp_register_script( 'geodirectory-googlemap-script', "//maps.google.com/maps/api/js?sensor=false&language=en" ); wp_enqueue_script( 'geodirectory-googlemap-script' ); } */ wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true); wp_enqueue_script('geodirectory-goMap-script'); wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION); wp_enqueue_script('chosen'); wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION); wp_enqueue_script('geodirectory-choose-ajax'); wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.min.js#asyncload', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true); if (is_page() && geodir_is_page('add-listing')) { // SCRIPT FOR UPLOAD wp_enqueue_script('plupload-all'); wp_enqueue_script('jquery-ui-sortable'); wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); wp_enqueue_script('geodirectory-plupload-script'); // SCRIPT FOR UPLOAD END // check_ajax_referer function is used to make sure no files are uplaoded remotly but it will fail if used between https and non https so we do the check below of the urls if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) { $ajax_url = admin_url('admin-ajax.php'); } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) { $ajax_url = admin_url('admin-ajax.php'); } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) { $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php')); } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) { $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php')); } // place js config array for plupload $plupload_init = array('runtimes' => 'html5,silverlight,flash,browserplus,gears,html4', 'browse_button' => 'plupload-browse-button', 'container' => 'plupload-upload-ui', 'drop_element' => 'dropbox', 'file_data_name' => 'async-upload', 'multiple_queues' => true, 'max_file_size' => geodir_max_upload_size(), 'url' => $ajax_url, 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), 'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')), 'multipart' => true, 'urlstream_upload' => true, 'multi_selection' => false, 'multipart_params' => array('_ajax_nonce' => "", 'action' => 'plupload_action', 'imgid' => 0)); $base_plupload_config = json_encode($plupload_init); $gd_plupload_init = array('base_plupload_config' => $base_plupload_config, 'upload_img_size' => geodir_max_upload_size()); wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init); wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload'); } // End if for add place page wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); if ($is_detail_page) { wp_enqueue_script('geodirectory-post-custom-js'); } wp_register_script('geodir-jRating-js', geodir_plugin_url() . '/geodirectory-assets/js/jRating.jquery.min.js', array(), GEODIRECTORY_VERSION, true); wp_enqueue_script('geodir-jRating-js'); wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.js#asyncload', array(), GEODIRECTORY_VERSION, true); wp_enqueue_script('geodir-on-document-load'); wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); wp_enqueue_script('google-geometa'); }
public function form($instance) { $instance = wp_parse_args((array) $instance, array('title' => '', 'hood_post_type' => '', 'hood_category' => '', 'category_title' => '', 'list_sort' => '', 'list_order' => '', 'post_number' => '5', 'layout' => 'gridview_onehalf', 'add_location_filter' => '1', 'character_count' => '20')); $title = strip_tags($instance['title']); $hood_post_type = strip_tags($instance['hood_post_type']); $hood_category = strip_tags($instance['hood_category']); $category_title = strip_tags($instance['category_title']); $list_sort = strip_tags($instance['list_sort']); $list_order = strip_tags($instance['list_order']); $post_number = strip_tags($instance['post_number']); $layout = strip_tags($instance['layout']); $add_location_filter = strip_tags($instance['add_location_filter']); $character_count = $instance['character_count']; ?> <p> <label for="<?php echo $this->get_field_id('title'); ?> "><?php _e('Title:', GEODIRLOCATION_TEXTDOMAIN); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?> " name="<?php echo $this->get_field_name('title'); ?> " type="text" value="<?php echo esc_attr($title); ?> " /> </label> </p> <p> <label for="<?php echo $this->get_field_id('hood_post_type'); ?> "><?php _e('Post Type:', GEODIRLOCATION_TEXTDOMAIN); ?> <?php $postypes = geodir_get_posttypes(); ?> <select class="widefat" id="<?php echo $this->get_field_id('hood_post_type'); ?> " name="<?php echo $this->get_field_name('hood_post_type'); ?> " onchange="geodir_change_hood_category_list(this)"> <?php foreach ($postypes as $postypes_obj) { ?> <option <?php if ($hood_post_type == $postypes_obj) { echo 'selected="selected"'; } ?> value="<?php echo $postypes_obj; ?> "><?php $extvalue = explode('_', $postypes_obj); echo ucfirst($extvalue[1]); ?> </option> <?php } ?> </select> </label> </p> <p id="hood_post_categories"> <label for="<?php echo $this->get_field_id('hood_category'); ?> "><?php _e('Post Category:', GEODIRLOCATION_TEXTDOMAIN); ?> <?php $hood_post_type = $hood_post_type != '' ? $hood_post_type : 'gd_place'; $category_taxonomy = geodir_get_taxonomies($hood_post_type); $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC')); ?> <select class="widefat" id="<?php echo $this->get_field_id('hood_category'); ?> " name="<?php echo $this->get_field_name('hood_category'); ?> " onchange="jQuery('#<?php echo $this->get_field_id('category_title'); ?> ').val(jQuery('#<?php echo $this->get_field_id('hood_category'); ?> option:selected').text());" > <option <?php if ($hood_category == '0') { echo 'selected="selected"'; } ?> value="0"><?php _e('All', GEODIRLOCATION_TEXTDOMAIN); ?> </option> <?php foreach ($categories as $category_obj) { ?> <option <?php if ($hood_category == $category_obj->term_id) { echo 'selected="selected"'; } ?> value="<?php echo $category_obj->term_id; ?> "><?php echo ucfirst($category_obj->name); ?> </option> <?php } ?> </select> <input type="hidden" name="<?php echo $this->get_field_name('category_title'); ?> " id="<?php echo $this->get_field_id('category_title'); ?> " value="<?php if ($category_title != '') { echo $category_title; } else { echo __('All', GEODIRLOCATION_TEXTDOMAIN); } ?> " /> </label> </p> <p> <label for="<?php echo $this->get_field_id('list_sort'); ?> "><?php _e('Sort by:', GEODIRLOCATION_TEXTDOMAIN); ?> <select class="widefat" id="<?php echo $this->get_field_id('list_sort'); ?> " name="<?php echo $this->get_field_name('list_sort'); ?> "> <option <?php if ($list_sort == 'latest') { echo 'selected="selected"'; } ?> value="latest"><?php _e('Latest', GEODIRLOCATION_TEXTDOMAIN); ?> </option> <option <?php if ($list_sort == 'featured') { echo 'selected="selected"'; } ?> value="featured"><?php _e('Featured', GEODIRLOCATION_TEXTDOMAIN); ?> </option> <option <?php if ($list_sort == 'high_review') { echo 'selected="selected"'; } ?> value="high_review"><?php _e('Review', GEODIRLOCATION_TEXTDOMAIN); ?> </option> <option <?php if ($list_sort == 'high_rating') { echo 'selected="selected"'; } ?> value="high_rating"><?php _e('Rating', GEODIRLOCATION_TEXTDOMAIN); ?> </option> </select> </label> </p> <p> <label for="<?php echo $this->get_field_id('post_number'); ?> "><?php _e('Number of posts:', GEODIRLOCATION_TEXTDOMAIN); ?> <input class="widefat" id="<?php echo $this->get_field_id('post_number'); ?> " name="<?php echo $this->get_field_name('post_number'); ?> " type="text" value="<?php echo esc_attr($post_number); ?> " /> </label> </p> <p> <label for="<?php echo $this->get_field_id('layout'); ?> "> <?php _e('Layout:', GEODIRLOCATION_TEXTDOMAIN); ?> <select class="widefat" id="<?php echo $this->get_field_id('layout'); ?> " name="<?php echo $this->get_field_name('layout'); ?> "> <option <?php if ($layout == 'gridview_onehalf') { echo 'selected="selected"'; } ?> value="gridview_onehalf"><?php _e('Grid View (Two Columns)', GEODIRLOCATION_TEXTDOMAIN); ?> </option> <option <?php if ($layout == 'gridview_onethird') { echo 'selected="selected"'; } ?> value="gridview_onethird"><?php _e('Grid View (Three Columns)', GEODIRLOCATION_TEXTDOMAIN); ?> </option> <option <?php if ($layout == 'gridview_onefourth') { echo 'selected="selected"'; } ?> value="gridview_onefourth"><?php _e('Grid View (Four Columns)', GEODIRLOCATION_TEXTDOMAIN); ?> </option> <option <?php if ($layout == 'gridview_onefifth') { echo 'selected="selected"'; } ?> value="gridview_onefifth"><?php _e('Grid View (Five Columns)', GEODIRLOCATION_TEXTDOMAIN); ?> </option> <option <?php if ($layout == 'list') { echo 'selected="selected"'; } ?> value="list"><?php _e('List view', GEODIRLOCATION_TEXTDOMAIN); ?> </option> </select> </label> </p> <p> <label for="<?php echo $this->get_field_id('character_count'); ?> "><?php _e('Post Content excerpt character count :', GEODIRLOCATION_TEXTDOMAIN); ?> <input class="widefat" id="<?php echo $this->get_field_id('character_count'); ?> " name="<?php echo $this->get_field_name('character_count'); ?> " type="text" value="<?php echo esc_attr($character_count); ?> " /> </label> </p> <p style="display:none;"> <label for="<?php echo $this->get_field_id('add_location_filter'); ?> "> <?php _e('Enable Location Filter:', GEODIRLOCATION_TEXTDOMAIN); ?> <input type="checkbox" id="<?php echo $this->get_field_id('add_location_filter'); ?> " name="<?php echo $this->get_field_name('add_location_filter'); ?> " <?php if ($add_location_filter) { echo 'checked="checked"'; } ?> value="1" /> </label> </p> <script type="text/javascript"> function geodir_change_hood_category_list(obj,selected){ var ajax_url = '<?php echo geodir_get_ajax_url(); ?> ' var hood_post_type = obj.value; var myurl = ajax_url+"&geodir_ajax=admin_ajax&ajax_action=get_cat_dl&post_type="+hood_post_type+"&selected="+selected; jQuery.ajax({ type: "GET", url: myurl, success: function(data){ jQuery(obj).closest('form').find('#hood_post_categories select').html(data); } }); } <?php if (is_active_widget(false, false, $this->id_base, true)) { ?> var hood_post_type = jQuery('#<?php echo $this->get_field_id('hood_post_type'); ?> ').val(); <?php } ?> </script> <?php }
?> </a> <?php } geodir_favourite_html($post->post_author, $post->ID); /** * Called after printing favorite html. * * @since 1.0.0 */ do_action('geodir_after_favorite_html', $post->ID, 'widget'); if ($post->post_author == get_current_user_id()) { $addplacelink = get_permalink(geodir_add_listing_page_id()); $editlink = geodir_getlink($addplacelink, array('pid' => $post->ID), false); $upgradelink = geodir_getlink($editlink, array('upgrade' => '1'), false); $ajaxlink = geodir_get_ajax_url(); $deletelink = geodir_getlink($ajaxlink, array('geodir_ajax' => 'add_listing', 'ajax_action' => 'delete', 'pid' => $post->ID), false); ?> <span class="geodir-authorlink clearfix"> <?php if (isset($_REQUEST['geodir_dashbord']) && $_REQUEST['geodir_dashbord']) { /** This action is documented in geodirectory-templates/listing-listview.php */ do_action('geodir_before_edit_post_link_on_listing'); ?> <a href="<?php echo $editlink; ?> " class="geodir-edit" title="<?php _e('Edit Listing', 'geodirectory'); ?>
/** * Back-end listing slider widget settings form. * * @since 1.0.0 * @since 1.5.1 Declare function public. * * @param array $instance Previously saved values from database. */ public function form($instance) { //widgetform in backend $instance = wp_parse_args((array) $instance, array('title' => '', 'post_type' => '', 'category' => '', 'post_number' => '5', 'max_show' => '1', 'slide_width' => '', 'show_title' => '', 'slideshow' => '', 'animationLoop' => '', 'directionNav' => '', 'slideshowSpeed' => 5000, 'animationSpeed' => 600, 'animation' => '', 'list_sort' => 'latest', 'show_featured_only' => '')); $title = strip_tags($instance['title']); $post_type = strip_tags($instance['post_type']); $category = strip_tags($instance['category']); $post_number = strip_tags($instance['post_number']); $max_show = strip_tags($instance['max_show']); $slide_width = strip_tags($instance['slide_width']); $show_title = $instance['show_title']; $slideshow = $instance['slideshow']; $animationLoop = $instance['animationLoop']; $directionNav = $instance['directionNav']; $slideshowSpeed = $instance['slideshowSpeed']; $animationSpeed = $instance['animationSpeed']; $animation = $instance['animation']; $list_sort = $instance['list_sort']; $show_featured_only = isset($instance['show_featured_only']) && $instance['show_featured_only'] ? true : false; $sort_fields = array(); $sort_fields[] = array('field' => 'latest', 'label' => __('Latest', 'geodirectory')); $sort_fields[] = array('field' => 'featured', 'label' => __('Featured', 'geodirectory')); $sort_fields[] = array('field' => 'high_review', 'label' => __('Review', 'geodirectory')); $sort_fields[] = array('field' => 'high_rating', 'label' => __('Rating', 'geodirectory')); $sort_fields[] = array('field' => 'random', 'label' => __('Random', 'geodirectory')); ?> <p> <label for="<?php echo $this->get_field_id('title'); ?> "><?php _e('Title:', 'geodirectory'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?> " name="<?php echo $this->get_field_name('title'); ?> " type="text" value="<?php echo esc_attr($title); ?> "/> </label> </p> <p> <label for="<?php echo $this->get_field_id('post_type'); ?> "><?php _e('Post Type:', 'geodirectory'); ?> <?php $postypes = geodir_get_posttypes(); ?> <select class="widefat" id="<?php echo $this->get_field_id('post_type'); ?> " name="<?php echo $this->get_field_name('post_type'); ?> " onchange="geodir_change_category_list(this.value)"> <?php foreach ($postypes as $postypes_obj) { ?> <option <?php if ($post_type == $postypes_obj) { echo 'selected="selected"'; } ?> value="<?php echo $postypes_obj; ?> "><?php $extvalue = explode('_', $postypes_obj); echo ucfirst($extvalue[1]); ?> </option> <?php } ?> </select> </label> </p> <p> <label for="<?php echo $this->get_field_id('category'); ?> "><?php _e('Post Category:', 'geodirectory'); ?> <?php $category_taxonomy = geodir_get_taxonomies('gd_place'); $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC')); ?> <select class="widefat" id="<?php echo $this->get_field_id('category'); ?> " name="<?php echo $this->get_field_name('category'); ?> "> <option <?php if ($category == '0') { echo 'selected="selected"'; } ?> value="0"><?php _e('All', 'geodirectory'); ?> </option> <?php foreach ($categories as $category_obj) { ?> <option <?php if ($category == $category_obj->term_id) { echo 'selected="selected"'; } ?> value="<?php echo $category_obj->term_id; ?> "><?php echo ucfirst($category_obj->name); ?> </option> <?php } ?> </select> </label> </p> <p> <label for="<?php echo $this->get_field_id('list_sort'); ?> "><?php _e('Sort by:', 'geodirectory'); ?> </label> <select class="widefat" id="<?php echo $this->get_field_id('list_sort'); ?> " name="<?php echo $this->get_field_name('list_sort'); ?> "> <?php foreach ($sort_fields as $sort_field) { ?> <option value="<?php echo $sort_field['field']; ?> " <?php echo $list_sort == $sort_field['field'] ? 'selected="selected"' : ''; ?> ><?php echo $sort_field['label']; ?> </option> <?php } ?> </select> </p> <p> <label for="<?php echo $this->get_field_id('post_number'); ?> "><?php _e('Number of posts(total):', 'geodirectory'); ?> <input class="widefat" id="<?php echo $this->get_field_id('post_number'); ?> " name="<?php echo $this->get_field_name('post_number'); ?> " type="text" value="<?php echo esc_attr($post_number); ?> "/> </label> </p> <p> <label for="<?php echo $this->get_field_id('max_show'); ?> "><?php _e('Number of posts(shown at one time, requires a slide width to be set):', 'geodirectory'); ?> <input class="widefat" id="<?php echo $this->get_field_id('max_show'); ?> " name="<?php echo $this->get_field_name('max_show'); ?> " type="text" value="<?php echo esc_attr($max_show); ?> "/> </label> </p> <p> <label for="<?php echo $this->get_field_id('slide_width'); ?> "><?php _e('Slide width(leave blank unless showing more than one slide at a time, ex: 210):', 'geodirectory'); ?> <input class="widefat" id="<?php echo $this->get_field_id('slide_width'); ?> " name="<?php echo $this->get_field_name('slide_width'); ?> " type="text" value="<?php echo esc_attr($slide_width); ?> "/> </label> </p> <p> <label for="<?php echo $this->get_field_id('animation'); ?> "><?php _e('Animation:', 'geodirectory'); ?> <select class="widefat" id="<?php echo $this->get_field_id('animation'); ?> " name="<?php echo $this->get_field_name('animation'); ?> "> <option <?php if ($animation == 'slide') { echo 'selected="selected"'; } ?> value="slide">Slide </option> <option <?php if ($animation == 'fade') { echo 'selected="selected"'; } ?> value="fade">Fade </option> </select> </label> </p> <p> <label for="<?php echo $this->get_field_id('slideshowSpeed'); ?> "><?php _e('Slide Show Speed: (milliseconds)', 'geodirectory'); ?> <input class="widefat" id="<?php echo $this->get_field_id('slideshowSpeed'); ?> " name="<?php echo $this->get_field_name('slideshowSpeed'); ?> " type="text" value="<?php echo esc_attr($slideshowSpeed); ?> "/> </label> </p> <p> <label for="<?php echo $this->get_field_id('animationSpeed'); ?> "><?php _e('Animation Speed: (milliseconds)', 'geodirectory'); ?> <input class="widefat" id="<?php echo $this->get_field_id('animationSpeed'); ?> " name="<?php echo $this->get_field_name('animationSpeed'); ?> " type="text" value="<?php echo esc_attr($animationSpeed); ?> "/> </label> </p> <p> <label for="<?php echo $this->get_field_id('slideshow'); ?> "><?php _e('SlideShow:', 'geodirectory'); ?> <input type="checkbox" <?php if ($slideshow) { echo 'checked="checked"'; } ?> id="<?php echo $this->get_field_id('slideshow'); ?> " value="1" name="<?php echo $this->get_field_name('slideshow'); ?> "/> </label> </p> <p> <label for="<?php echo $this->get_field_id('animationLoop'); ?> "><?php _e('AnimationLoop:', 'geodirectory'); ?> <input type="checkbox" <?php if ($animationLoop) { echo 'checked="checked"'; } ?> id="<?php echo $this->get_field_id('animationLoop'); ?> " value="1" name="<?php echo $this->get_field_name('animationLoop'); ?> "/> </label> </p> <p> <label for="<?php echo $this->get_field_id('directionNav'); ?> "><?php _e('DirectionNav:', 'geodirectory'); ?> <input type="checkbox" <?php if ($directionNav) { echo 'checked="checked"'; } ?> id="<?php echo $this->get_field_id('directionNav'); ?> " value="1" name="<?php echo $this->get_field_name('directionNav'); ?> "/> </label> </p> <p> <label for="<?php echo $this->get_field_id('show_title'); ?> "><?php _e('Show Title:', 'geodirectory'); ?> <input type="checkbox" <?php if ($show_title) { echo 'checked="checked"'; } ?> id="<?php echo $this->get_field_id('show_title'); ?> " value="1" name="<?php echo $this->get_field_name('show_title'); ?> "/> </label> </p> <p> <label for="<?php echo $this->get_field_id('show_featured_only'); ?> "><?php _e('Show only featured listings:', 'geodirectory'); ?> <input type="checkbox" id="<?php echo $this->get_field_id('show_featured_only'); ?> " name="<?php echo $this->get_field_name('show_featured_only'); ?> " <?php if ($show_featured_only) { echo 'checked="checked"'; } ?> value="1"/> </label> </p> <script type="text/javascript"> function geodir_change_category_list(post_type, selected) { var ajax_url = '<?php echo geodir_get_ajax_url(); ?> ' var myurl = ajax_url + "&geodir_ajax=admin_ajax&ajax_action=get_cat_dl&post_type=" + post_type + "&selected=" + selected; jQuery.ajax({ type: "GET", url: myurl, success: function (data) { jQuery('#<?php echo $this->get_field_id('category'); ?> ').html(data); } }); } <?php if (is_active_widget(false, false, $this->id_base, true)) { ?> var post_type = jQuery('#<?php echo $this->get_field_id('post_type'); ?> ').val(); geodir_change_category_list(post_type, '<?php echo $category; ?> '); <?php } ?> </script> <?php }
/** * The geodirectory listing map shortcode. * * This implements the functionality of the shortcode for displaying listing map. * * @since 1.0.0 * @since 1.5.2 Added TERRAIN for $maptype attribute. * @package GeoDirectory * @global object $post The current post object. * @param array $atts { * Attributes of the shortcode. * * @type string $width Map width in pixels. Default 294. * @type string $height Map height in pixels. Default 370. * @type string $maptype Map type. Default ROADMAP. Can be ROADMAP | SATELLITE | HYBRID | TERRAIN. * @type string $zoom The zoom level of the map. Between 1-19. Default 13. * @type string $autozoom True if the map should autozoom, false if not. * @type bool $sticky True if should be sticky, false if not * @type string $showall Show all listings on map? (not just page list). Default 0. * @type string $child_collapse True if the map should collapse the categories, false if not. * @type string $scrollwheel True to allow scroll wheel to scroll map or false if not. * @type bool $marker_cluster Enable marker cluster? Default: false. * * } * @return string Map HTML. */ function geodir_sc_listing_map($atts) { ob_start(); add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array add_action('the_post', 'create_list_jsondata'); // Add marker in json array add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers $defaults = array('width' => '294', 'height' => '370', 'zoom' => '13', 'autozoom' => '', 'sticky' => '', 'showall' => '0', 'scrollwheel' => '0', 'maptype' => 'ROADMAP', 'child_collapse' => 0, 'marker_cluster' => false); $params = shortcode_atts($defaults, $atts); $params = gdsc_validate_map_args($params); $map_args = array('map_canvas_name' => 'gd_listing_map', 'width' => $params['width'], 'height' => $params['height'], 'zoom' => $params['zoom'], 'autozoom' => $params['autozoom'], 'sticky' => $params['sticky'], 'showall' => $params['showall'], 'scrollwheel' => $params['scrollwheel'], 'child_collapse' => 0, 'enable_cat_filters' => false, 'enable_text_search' => false, 'enable_post_type_filters' => false, 'enable_location_filters' => false, 'enable_jason_on_load' => true); if (is_single()) { global $post; $map_default_lat = $address_latitude = $post->post_latitude; $map_default_lng = $address_longitude = $post->post_longitude; $mapview = $post->post_mapview; $map_args['zoom'] = $post->post_mapzoom; $map_args['map_class_name'] = 'geodir-map-listing-page-single'; } else { $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_args['map_class_name'] = 'geodir-map-listing-page'; } if (empty($mapview)) { $mapview = 'ROADMAP'; } // Set default map options $map_args['ajax_url'] = geodir_get_ajax_url(); $map_args['latitude'] = $map_default_lat; $map_args['longitude'] = $map_default_lng; $map_args['streetViewControl'] = true; $map_args['maptype'] = $mapview; $map_args['showPreview'] = '0'; $map_args['maxZoom'] = 21; $map_args['bubble_size'] = 'small'; // Add marker cluster if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) { $map_args['enable_marker_cluster'] = true; } else { $map_args['enable_marker_cluster'] = false; } geodir_draw_map($map_args); $output = ob_get_contents(); ob_end_clean(); return $output; }
function geodir_publish_payment_listing_form_before_msg() { global $post, $wpdb; $post_type = $post->listing_type; if (isset($_REQUEST['package_id']) && $_REQUEST['package_id'] != '') { $package_price_info = geodir_get_post_package_info($_REQUEST['package_id']); } else { if (!empty($post) && isset($post->package_id)) { $package_price_info = geodir_get_post_package_info($post->package_id); } } $package_id = isset($package_price_info['pid']) ? $package_price_info['pid'] : ''; $payable_amount = isset($package_price_info['amount']) ? $package_price_info['amount'] : 0; $alive_days = isset($package_price_info['days']) ? $package_price_info['days'] : 0; $type_title = isset($package_price_info['title']) ? $package_price_info['title'] : ''; $sub_active = isset($package_price_info['sub_active']) ? $package_price_info['sub_active'] : ''; if ($sub_active) { $sub_units_num_var = $package_price_info['sub_units_num']; $sub_units_var = $package_price_info['sub_units']; $alive_days = geodir_payment_get_units_to_days($sub_units_num_var, $sub_units_var); // paypal free trial $sub_num_trial_days_var = $package_price_info['sub_num_trial_days']; $sub_num_trial_units_var = $package_price_info['sub_num_trial_units']; if ($sub_num_trial_days_var > 0) { $alive_days = geodir_payment_get_units_to_days($sub_num_trial_days_var, $sub_num_trial_units_var); } } $org_payable_amount = $payable_amount; /* -------- START LISTING FORM MESSAGE*/ ob_start(); if (isset($_REQUEST['coupon_code']) && $_REQUEST['coupon_code'] != '') { if (geodir_is_valid_coupon($post_type, $_REQUEST['coupon_code'])) { $payable_amount = geodir_get_payable_amount_with_coupon($payable_amount, $_REQUEST['coupon_code']); } else { echo '<p class="error_msg_fix">' . WRONG_COUPON_MSG . '</p>'; } } if ($payable_amount > 0) { if ($alive_days == 0) { $alive_days = UNLIMITED; } echo '<h5 class="geodir_information">'; printf(GOING_TO_PAY_MSG, geodir_get_currency_sym() . $payable_amount, $alive_days, $type_title); echo '</h5>'; } else { if ($alive_days == 0) { $alive_days = UNLIMITED; } echo '<h5 class="geodir_information">'; if (!isset($_REQUEST['pid']) || $_REQUEST['pid'] == '') { printf(GOING_TO_FREE_MSG, $type_title, $alive_days); } else { printf(GOING_TO_UPDATE_MSG, geodir_get_currency_sym() . $payable_amount, $alive_days, $type_title); } echo '</h5>'; } echo $form_message = ob_get_clean(); /* -------- END LISTING FORM MESSAGE*/ /* -------- START LISTING FORM PAYMENT OPTIONS*/ ob_start(); ?> <input type="hidden" name="price_select" value="<?php if (isset($package_id)) { echo $package_id; } ?> " /> <input type="hidden" name="coupon_code" value="<?php if (isset($_REQUEST['coupon_code'])) { echo $_REQUEST['coupon_code']; } ?> " /> <?php if ($payable_amount > 0) { if ($sub_active) { $sub_m_arr = apply_filters('geodir_subscription_methods', array('payment_method_paypal')); $method_names = implode(',', array_fill(0, count($sub_m_arr), '%s')); $paymentsql = $wpdb->prepare("select * from {$wpdb->options} where option_name in ({$method_names}) order by option_id", $sub_m_arr); } else { $paymentsql = $wpdb->prepare("select * from {$wpdb->options} where option_name like %s order by option_id", array('payment_method_%')); } $paymentinfo = $wpdb->get_results($paymentsql); if ($paymentinfo) { ?> <h5 class="geodir_payment_head"> <?php echo SELECT_PAY_MEHTOD_TEXT; ?> </h5> <ul class="geodir_payment_method"> <?php $paymentOptionArray = array(); $paymethodKeyarray = array(); foreach ($paymentinfo as $paymentinfoObj) { $paymentInfo = unserialize($paymentinfoObj->option_value); if ($paymentInfo['isactive']) { $paymethodKeyarray[] = $paymentInfo['key']; $paymentOptionArray[$paymentInfo['display_order']][] = $paymentInfo; } } ksort($paymentOptionArray); if ($paymentOptionArray) { $poa = 0; foreach ($paymentOptionArray as $key => $paymentInfoval) { $poa++; for ($i = 0; $i < count($paymentInfoval); $i++) { $paymentInfo = $paymentInfoval[$i]; $jsfunction = 'onclick="showoptions(this.value);"'; $chked = ''; if ($poa == 1) { $chked = 'checked="checked"'; } ?> <li id="<?php echo $paymentInfo['key']; ?> "> <input <?php echo $jsfunction; ?> type="radio" value="<?php echo $paymentInfo['key']; ?> " id="<?php echo $paymentInfo['key']; ?> _id" name="paymentmethod" <?php echo $chked; ?> /> <?php echo $paymentInfo['name']; ?> <?php if (file_exists(GEODIR_PAYMENT_MANAGER_PATH . $paymentInfo['key'] . '/' . $paymentInfo['key'] . '.php')) { include_once GEODIR_PAYMENT_MANAGER_PATH . $paymentInfo['key'] . '/' . $paymentInfo['key'] . '.php'; } ?> </li><?php } } if (isset($paymethodKeyarray)) { ?> <script type="application/x-javascript"> jQuery(document).ready(function($){ var submit_button = $('#publish_listing .geodir_publish_button'); submit_button.on('click', function(event){ var payment_method = $('#publish_listing input[name="paymentmethod"]:checked').val(); if( payment_method === 'authorizenet' ) { if($('#cardholder_name').val()==''){ alert('<?php _e('Please enter Cardholder name', GEODIRPAYMENT_TEXTDOMAIN); ?> ');return false; } if($('#cc_number').val()==''){ alert('<?php _e('Please enter card number', GEODIRPAYMENT_TEXTDOMAIN); ?> ');return false; } if($('#cc_month').val()=='' || $('#cc_year').val()=='' ){ alert('<?php _e('Please enter expire date', GEODIRPAYMENT_TEXTDOMAIN); ?> ');return false; } return true; }else { return true; } }); }); function showoptions(paymethod){ <?php for ($i = 0; $i < count($paymethodKeyarray); $i++) { ?> showoptvar = '<?php echo $paymethodKeyarray[$i]; ?> options'; if(eval(document.getElementById(showoptvar))) { document.getElementById(showoptvar).style.display = 'none'; if(paymethod=='<?php echo $paymethodKeyarray[$i]; ?> ') { document.getElementById(showoptvar).style.display = ''; } } <?php } ?> } <?php for ($i = 0; $i < count($paymethodKeyarray); $i++) { ?> if(document.getElementById('<?php echo $paymethodKeyarray[$i]; ?> _id').checked) { showoptions(document.getElementById('<?php echo $paymethodKeyarray[$i]; ?> _id').value);} <?php } ?> </script> <?php } } else { ?> <li><?php echo NO_PAYMENT_METHOD_MSG; ?> </li> <?php } ?> </ul> <?php } } echo $html = ob_get_clean(); /* -------- END LISTING FORM PAYMENT OPTIONS*/ /* -------- START LISTING FORM BUTTON*/ ob_start(); if ((!isset($_REQUEST['pid']) || $_REQUEST['pid'] == '') && $payable_amount == 0) { ?> <input type="submit" name="Submit and Pay" value="<?php echo PRO_SUBMIT_BUTTON; ?> " class="geodir_button geodir_publish_button" /><?php } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && $payable_amount == 0) { ?> <input type="submit" name="Submit and Pay" value="<?php echo PRO_UPDATE_BUTTON; ?> " class="geodir_button geodir_publish_button" /><?php } elseif (isset($_REQUEST['package_id']) && $_REQUEST['package_id'] != '' && $payable_amount > 0 && (!isset($_REQUEST['pid']) || $_REQUEST['pid'] == '')) { ?> <input type="submit" name="Submit and Pay" value="<?php echo PRO_SUBMIT_PAY_BUTTON; ?> " class=" geodir_button geodir_publish_button" /><?php } elseif (isset($_REQUEST['package_id']) && $_REQUEST['package_id'] != '' && $org_payable_amount > 0 && (isset($_REQUEST['pid']) || $_REQUEST['pid'] != '')) { $post_status = get_post_status($_REQUEST['pid']); if ($post_status == 'draft') { ?> <input type="submit" name="Submit and Pay" value="<?php echo PRO_RENEW_BUTTON; ?> " class="geodir_button geodir_publish_button" /><?php } else { ?> <input type="submit" name="Submit and Pay" value="<?php echo PRO_UPGRADE_BUTTON; ?> " class="geodir_button geodir_publish_button" /><?php } } echo $listing_form_button = ob_get_clean(); /* -------- END LISTING FORM BUTTON*/ /* -------- START LISTING GO BACK LINK*/ $post_id = ''; if (isset($post->pid)) { $post_id = $post->pid; } elseif (isset($_REQUEST['pid'])) { $post_id = $_REQUEST['pid']; } if (isset($_REQUEST['add_listing_page_id'])) { $page_id = $_REQUEST['add_listing_page_id']; } else { $page_id = get_option('geodir_add_listing_page'); } //$postlink = get_permalink( $page_id ); $postlink = get_permalink(geodir_add_listing_page_id()); $postlink = geodir_getlink($postlink, array('pid' => $post_id, 'backandedit' => '1', 'listing_type' => $post_type), false); if (isset($_REQUEST['package_id']) && $_REQUEST['package_id'] != '') { $postlink = geodir_getlink($postlink, array('package_id' => $_REQUEST['package_id']), false); } ob_start(); ?> <a href="<?php echo $postlink; ?> " class="geodir_goback" ><?php echo PRO_BACK_AND_EDIT_TEXT; ?> </a> <input type="button" name="Cancel" value="<?php echo PRO_CANCEL_BUTTON; ?> " class="geodir_button cancle_button" onclick="window.location.href='<?php echo geodir_get_ajax_url() . '&geodir_ajax=add_listing&ajax_action=cancel&pid=' . $post_id . '&listing_type=' . $post_type; ?> '" /> <?php echo $listing_form_go_back = ob_get_clean(); }
/** * Front-end display content for listing page map widget. * * @since 1.0.0 * @since 1.5.1 Declare function public. * * @global object $post The current post object. * * @param array $args Widget arguments. * @param array $instance Saved values from database. */ public function widget($args, $instance) { if (geodir_is_page('listing') || geodir_is_page('author') || geodir_is_page('search') || geodir_is_page('detail')) { extract($args, EXTR_SKIP); /** This action is documented in geodirectory_shortcodes.php */ $width = empty($instance['width']) ? '294' : apply_filters('widget_width', $instance['width']); /** This action is documented in geodirectory_shortcodes.php */ $height = empty($instance['heigh']) ? '370' : apply_filters('widget_heigh', $instance['heigh']); /** This action is documented in geodirectory_shortcodes.php */ $maptype = empty($instance['maptype']) ? 'ROADMAP' : apply_filters('widget_maptype', $instance['maptype']); /** This action is documented in geodirectory_shortcodes.php */ $zoom = empty($instance['zoom']) ? '13' : apply_filters('widget_zoom', $instance['zoom']); /** This action is documented in geodirectory_shortcodes.php */ $autozoom = empty($instance['autozoom']) ? '' : apply_filters('widget_autozoom', $instance['autozoom']); /** * Filter the listing map value widget_sticky, to set if the map should be sticky or not (scroll with page). * * @since 1.0.0 * @param bool $sticky True if should be sticky, false if not */ $sticky = empty($instance['sticky']) ? '' : apply_filters('widget_sticky', $instance['sticky']); /** This action is documented in geodirectory_shortcodes.php */ $scrollwheel = empty($instance['scrollwheel']) ? '0' : apply_filters('widget_scrollwheel', $instance['scrollwheel']); $showall = empty($instance['showall']) ? '0' : apply_filters('widget_showall', $instance['showall']); /** * Filter the listing map should to be displayed or not. * * @since 1.4.6 * * @param bool $display true if map should be displayed, false if not. */ $show_map = apply_filters('geodir_show_map_listing', $display = true); if (!$show_map) { return; } $map_args = array(); $map_args['map_canvas_name'] = str_replace('-', '_', $args['widget_id']); $map_args['width'] = $width; $map_args['height'] = $height; $map_args['scrollwheel'] = $scrollwheel; $map_args['showall'] = $showall; $map_args['child_collapse'] = '0'; $map_args['sticky'] = $sticky; $map_args['enable_cat_filters'] = false; $map_args['enable_text_search'] = false; $map_args['enable_post_type_filters'] = false; $map_args['enable_location_filters'] = false; $map_args['enable_jason_on_load'] = true; if (is_single()) { global $post; $map_default_lat = $address_latitude = $post->post_latitude; $map_default_lng = $address_longitude = $post->post_longitude; $mapview = $post->post_mapview; $mapzoom = $post->post_mapzoom; $map_args['map_class_name'] = 'geodir-map-listing-page-single'; } else { $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_args['map_class_name'] = 'geodir-map-listing-page'; $mapview = $maptype; } if (empty($mapview)) { $mapview = 'ROADMAP'; } if (empty($mapzoom)) { $mapzoom = $zoom; } // Set default map options $map_args['ajax_url'] = geodir_get_ajax_url(); $map_args['latitude'] = $map_default_lat; $map_args['longitude'] = $map_default_lng; $map_args['zoom'] = $zoom; //$map_args['scrollwheel'] = true; $map_args['scrollwheel'] = $scrollwheel; $map_args['showall'] = $showall; $map_args['streetViewControl'] = true; $map_args['maptype'] = $mapview; $map_args['showPreview'] = '0'; $map_args['maxZoom'] = 21; $map_args['autozoom'] = $autozoom; $map_args['bubble_size'] = 'small'; echo $before_widget; geodir_draw_map($map_args); echo $after_widget; } }
/** * Function to insert csv post data. * * @since 1.0.0 * @package GeoDirectory * @global object $wpdb WordPress Database object. * @global string $plugin_prefix Geodirectory plugin table prefix. */ function geodir_insert_csv_post_data() { global $wpdb, $plugin_prefix; $svalue = ''; ?> <script type="text/javascript"> jQuery(document).ready(function () { jQuery("#import_data").click(function () { var geodir_import_data = jQuery('.geodir_import_data').val(); var csv_filename = jQuery('.csv_filename').val(); if (csv_filename != '') { jQuery.post('<?php echo geodir_get_ajax_url(); ?> &geodir_import_data=' + geodir_import_data + '&filename=' + csv_filename, function (data) { //alert(data); window.location.href = data; }); } else { alert('<?php echo PLZ_SELECT_CSV_FILE; ?> '); } }); jQuery(".uploadcsv_button").click(function () { setInterval(function () { var checkvalue = jQuery('.csv_filename').val(); if (checkvalue != '') { jQuery('.csv_button_div').show(); } }, 1000); }); }); jQuery(document).ready(function () { jQuery(".gd_uploadcsv_button").click(function () { setInterval(function () { var checkvalue = jQuery('.gd_csv_filename').val(); if (checkvalue != '') { jQuery('.gd_csv_button_div').show(); } }, 1000); }); }); </script> <?php if (isset($_REQUEST['active_tab']) && $_REQUEST['active_tab'] == 'csv_upload_settings') { if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'success') { $rowcount = $_REQUEST['rowcount']; $uploads = wp_upload_dir(); ?> <div class="updated fade below-h2" id="message" style="background-color: rgb(255, 251, 204); margin-left:0px; margin-top:0px; margin-bottom:10px;"> <?php if ($_REQUEST['invalidcount'] == 0 && $_REQUEST['blank_address'] == 0 && $_REQUEST['invalid_post_type'] == 0 && $_REQUEST['invalid_title'] == 0) { echo '<p>' . CSV_INSERT_DATA . '</p>'; } echo '<p>'; printf(CSV_TOTAL_RECORD, $rowcount); echo '</p>'; if (isset($_REQUEST['invalidcount']) && $_REQUEST['invalidcount'] > 0) { echo '<p>'; printf(CSV_INVALID_DEFUALT_ADDRESS, $_REQUEST['invalidcount'], $_REQUEST['total_records']); echo '</p>'; } if (isset($_REQUEST['blank_address']) && $_REQUEST['blank_address'] > 0) { echo '<p>'; printf(CSV_INVALID_TOTAL_RECORD, $_REQUEST['blank_address'], $_REQUEST['total_records']); echo '</p>'; } if (isset($_REQUEST['invalid_post_type']) && $_REQUEST['invalid_post_type'] > 0) { echo '<p>'; printf(CSV_INVALID_POST_TYPE, $_REQUEST['invalid_post_type'], $_REQUEST['total_records']); echo '</p>'; } if (isset($_REQUEST['invalid_title']) && $_REQUEST['invalid_title'] > 0) { echo '<p>'; printf(CSV_BLANK_POST_TITLE, $_REQUEST['invalid_title'], $_REQUEST['total_records']); echo '</p>'; } if (isset($_REQUEST['upload_files']) && $_REQUEST['upload_files'] > 0) { echo '<p>'; printf(CSV_TRANSFER_IMG_FOLDER, $uploads['subdir']); echo '</p>'; } ?> </div> <?php } ?> <?php if (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'wrong') { ?> <div class="updated fade below-h2" id="message" style="background-color: rgb(255, 251, 204); margin-left:0px; margin-top:0px; margin-bottom:10px; color:#FF0000;"> <p><?php echo CSV_INVAILD_FILE; ?> </p> </div> <?php } ?> <?php if (isset($_REQUEST['emsg']) == 'csvonly') { ?> <div class="updated fade below-h2" id="message" style="background-color: rgb(255, 251, 204); margin-left:0px; margin-top:0px; margin-bottom:10px; color:#FF0000;"> <p><?php echo CSV_UPLOAD_ONLY; ?> </p> </div> <?php } } ?> <?php /* ?> <table class="form-table"> <tbody> <tr valign="top" class="single_select_page"> <th class="titledesc" scope="row"><?php echo SELECT_CSV_FILE;?></th> <td class="forminp"> <?php $id = "import_image"; $multiple = false; // allow multiple files upload ?> <div class="gtd-formfeild"> <div class="gtd-form_row clearfix" id="<?php echo $id; ?>dropbox"> <div class="plupload-upload-uic hide-if-no-js" id="<?php echo $id; ?>plupload-upload-ui"> <input type="text" readonly="readonly" name="<?php echo $id; ?>" class="csv_filename" id="<?php echo $id; ?>" value="<?php echo $svalue; ?>" /><input id="<?php echo $id; ?>plupload-browse-button" type="button" value="<?php echo SELECT_UPLOAD_CSV; ?>" class="uploadcsv_button" /><br /> <a href="<?php echo geodir_plugin_url() . '/geodirectory-assets/place_listing.csv'?>" ><?php _e("Download sample csv", GEODIRECTORY_TEXTDOMAIN)?></a> <?php do_action('geodir_sample_csv_download_link'); ?> <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce($id . 'pluploadan'); ?>"></span><br /><br /> <div class="filelist"></div> </div> </div> </div> <span id="upload-error" style="display:none"></span> <span class="description"></span><br /> <div class="csv_button_div" style="display:none;"> <input type="hidden" class="geodir_import_data" name="geodir_import_data" value="save" /> <input type="button" value="<?php echo CSV_IMPORT_DATA; ?>" id="import_data" class="button-primary" name="save"> </div> </td> </tr> </tbody> </table> <?php */ ?> <?php $id = "gd_import_csv"; $multiple = false; // allow multiple files upload $uploads = wp_upload_dir(); ?> <style> .gd-csv-form-table .filelist div.file:last-child { display: block !important; opacity: 1 !important } .gd-import-progress { margin-top: 10px } .gd-import-file { background: #ececec; border: 1px solid #ccc; clear: both; margin-bottom: 4px; padding: 5px; } .gd-fileprogress { background: #b7c53d; height: 5px; width: 0; margin-top: 3px } .gd-csv-form-table .fileprogress { margin-top: 3px } #gd-import-msg { padding-top: 12px } #gd-import-msg #message { background-color: rgb(255, 251, 204); } </style> <script type="text/javascript"> var timout; function gdPrepareImport() { jQuery('#gd-import-msg').hide(); var gd_prepared = jQuery('#gd_prepared').val(); var uploadedFile = jQuery('#gd_import_csv').val(); if (gd_prepared == uploadedFile) { gdContinueImport(); jQuery('#gd_import_data').attr('disabled', 'disabled'); } else { var gddata = new Array(); gddata = { 'uploadedFile': uploadedFile, } jQuery.ajax({ type: 'POST', url: ajaxurl, dataType: 'json', data: { 'action': 'gdImportCsv', 'gddata': gddata, 'task': 'prepare' }, success: function (data) { if (typeof data == 'object') { if (data.error) { jQuery('#gd-import-msg').find('#message').removeClass('updated').addClass('error').html('<p>' + data.error + '</p>'); jQuery('#gd-import-msg').show(); } else { jQuery('#gd_tmpcount').val('0'); jQuery('#gd_tot_records').val(data.rows); jQuery('#gd_checktotal').val(data.rows); jQuery('#gd_prepared').val(uploadedFile); jQuery('#gd_rowcount').val('0'); jQuery('#gd_invalidcount').val('0'); jQuery('#gd_blank_address').val('0'); jQuery('#gd_upload_files').val('0'); jQuery('#gd_invalid_post_type').val('0'); jQuery('#gd_invalid_title').val('0'); jQuery('#gd_total_records').val('0'); gdStartImport(); } } }, error: function (errorThrown) { console.log(errorThrown); } }); } } function gdTerminateImport() { console.log('gdTerminateImport()'); jQuery('#gd_terminateaction').val('terminate'); jQuery('#gd_import_data').hide(); jQuery('#gd_stop_import').hide(); jQuery('#gd_process_data').hide(); jQuery('#gd_continue_data').show(); } function gdContinueImport() { var tmpCnt = jQuery('#gd_tmpcount').val(); var tot_no_of_records = jQuery('#gd_tot_records').val(); if (parseInt(tmpCnt) > parseInt(tot_no_of_records)) { jQuery('#gd_stop_import').hide(); } else { jQuery('#gd_stop_import').show(); } jQuery('#gd_import_data').show(); jQuery('#gd_import_data').attr('disabled', 'disabled'); jQuery('#gd_process_data').css({ 'display': 'inline-block' }); jQuery('#gd_continue_data').hide(); jQuery('#gd_terminateaction').val('continue'); clearTimeout(timout); timout = setTimeout(function () { gdStartImport(); }, 0); } function gdStartImport(siteurl) { var importlimit = 1; var get_requested_count = importlimit; var tot_no_of_records = jQuery('#gd_checktotal').val(); var uploadedFile = jQuery('#gd_import_csv').val(); var tmpCnt = jQuery('#gd_tmpcount').val(); var no_of_tot_records = jQuery('#gd_tot_records').val(); if (!uploadedFile) { jQuery('#gd_import_data').removeAttr('disabled'); jQuery('#gd_import_data').show(); jQuery('#gd_stop_import').hide(); jQuery('#gd_process_data').hide(); jQuery('#gd-import-progress').hide(); jQuery('.gd-fileprogress').width(0); jQuery('#gd-import-done').text('0'); jQuery('#gd-import-total').text('0'); jQuery('#gd-import-perc').text('0%'); jQuery('.gd-csv-form-table .filelist .file').remove(); jQuery('#gd-import-msg').find('#message').removeClass('updated').addClass('error').html("<p><?php echo esc_attr(PLZ_SELECT_CSV_FILE); ?> </p>"); jQuery('#gd-import-msg').show(); return false; } jQuery('#gd-import-total').text(tot_no_of_records); jQuery('#gd_stop_import').show(); jQuery('#gd_process_data').css({ 'display': 'inline-block' }); jQuery('#gd-import-progress').show(); if ((parseInt(no_of_tot_records) / 100) > 0) { importlimit = parseInt(parseInt(no_of_tot_records) / 100); } if (importlimit == 1) { if (parseInt(no_of_tot_records) > 50) { importlimit = 5; } else if (parseInt(no_of_tot_records) > 10 && parseInt(no_of_tot_records) < 51) { importlimit = 2; } } if (importlimit > 10) { importlimit = 10; } if (importlimit < 1) { importlimit = 1; } get_requested_count = importlimit; var tempCount = parseInt(tmpCnt); var totalCount = parseInt(tot_no_of_records); if (tempCount >= totalCount) { jQuery('#gd_import_data').removeAttr('disabled'); jQuery('#gd_import_data').show(); jQuery('#gd_stop_import').hide(); jQuery('#gd_process_data').hide(); gd_showStatusMsg(); jQuery('#gd_import_csv').val(''); jQuery('#gd_prepared').val(''); return false; } jQuery('#gd-import-msg').hide(); var gddata = new Array(); gddata = { 'importlimit': importlimit, 'totRecords': tot_no_of_records, 'uploadedFile': uploadedFile, 'tmpcount': tmpCnt, } var tmpLoc = jQuery('#tmpLoc').val(); var gd_rowcount = parseInt(jQuery('#gd_rowcount').val()); var gd_invalidcount = parseInt(jQuery('#gd_invalidcount').val()); var gd_blank_address = parseInt(jQuery('#gd_blank_address').val()); var gd_upload_files = parseInt(jQuery('#gd_upload_files').val()); var gd_invalid_post_type = parseInt(jQuery('#gd_invalid_post_type').val()); var gd_invalid_title = parseInt(jQuery('#gd_invalid_title').val()); var gd_total_records = parseInt(jQuery('#gd_total_records').val()); jQuery.ajax({ type: 'POST', url: ajaxurl, dataType: 'json', data: { 'action': 'gdImportCsv', 'gddata': gddata, 'siteurl': siteurl, }, success: function (data) { if (typeof data == 'object') { if (data.error) { jQuery('#gd_import_data').removeAttr('disabled'); jQuery('#gd_import_data').show(); jQuery('#gd_stop_import').hide(); jQuery('#gd_process_data').hide(); jQuery('#gd-import-msg').find('#message').removeClass('updated').addClass('error').html('<p>' + data.error + '</p>'); jQuery('#gd-import-msg').show(); } else { gd_rowcount = gd_rowcount + parseInt(data.rowcount); gd_invalidcount = gd_invalidcount + parseInt(data.invalidcount); gd_blank_address = gd_blank_address + parseInt(data.blank_address); gd_upload_files = gd_upload_files + parseInt(data.upload_files); gd_invalid_post_type = gd_invalid_post_type + parseInt(data.invalid_post_type); gd_invalid_title = gd_invalid_title + parseInt(data.invalid_title); gd_total_records = gd_total_records + parseInt(data.total_records); jQuery('#gd_rowcount').val(gd_rowcount); jQuery('#gd_invalidcount').val(gd_invalidcount); jQuery('#gd_blank_address').val(gd_blank_address); jQuery('#gd_upload_files').val(gd_upload_files); jQuery('#gd_invalid_post_type').val(gd_invalid_post_type); jQuery('#gd_invalid_title').val(gd_invalid_title); jQuery('#gd_total_records').val(gd_total_records); if (parseInt(tmpCnt) == parseInt(tot_no_of_records)) { jQuery('#gd-import-done').text(tot_no_of_records); jQuery('#gd-import-perc').text('100%'); jQuery('.gd-fileprogress').css({ 'width': '100%' }); jQuery('#gd_import_csv').val(''); jQuery('#gd_prepared').val(''); gd_showStatusMsg(); jQuery('#gd_stop_import').hide(); } if (parseInt(tmpCnt) < parseInt(tot_no_of_records)) { var terminate_action = jQuery('#gd_terminateaction').val(); if (terminate_action == 'continue') { //console.log('Limit: ' + importlimit + ', Total: ' + tot_no_of_records); var nTmpCnt = parseInt(tmpCnt) + parseInt(importlimit); nTmpCnt = nTmpCnt > tot_no_of_records ? tot_no_of_records : nTmpCnt; jQuery('#gd_tmpcount').val(nTmpCnt); jQuery('#gd-import-done').text(nTmpCnt); if (parseInt(tot_no_of_records) > 0) { var percentage = ((parseInt(nTmpCnt) / parseInt(tot_no_of_records)) * 100); percentage = percentage > 100 ? 100 : percentage; jQuery('#gd-import-perc').text(parseInt(percentage) + '%'); jQuery('.gd-fileprogress').css({ 'width': percentage + '%' }); } clearTimeout(timout); timout = setTimeout(function () { gdStartImport(); }, 0); } else { jQuery('#gd_import_data').hide(); jQuery('#gd_stop_import').hide(); jQuery('#gd_process_data').hide(); jQuery('#gd_continue_data').show(); return false; } } else { jQuery('#gd_import_data').removeAttr('disabled'); jQuery('#gd_import_data').show(); jQuery('#gd_stop_import').hide(); jQuery('#gd_process_data').hide(); return false; } } } }, error: function (errorThrown) { jQuery('#gd_import_data').removeAttr('disabled'); jQuery('#gd_import_data').show(); jQuery('#gd_stop_import').hide(); jQuery('#gd_process_data').hide(); console.log(errorThrown); } }); } function gd_showStatusMsg() { var gd_rowcount = parseInt(jQuery('#gd_rowcount').val()); var gd_invalidcount = parseInt(jQuery('#gd_invalidcount').val()); var gd_blank_address = parseInt(jQuery('#gd_blank_address').val()); var gd_upload_files = parseInt(jQuery('#gd_upload_files').val()); var gd_invalid_post_type = parseInt(jQuery('#gd_invalid_post_type').val()); var gd_invalid_title = parseInt(jQuery('#gd_invalid_title').val()); var gd_total_records = parseInt(jQuery('#gd_total_records').val()); var gdMsg = '<p></p>'; if (gd_invalidcount == 0 && gd_blank_address == 0 && gd_invalid_post_type == 0 && gd_invalid_title == 0) { gdMsg += "<p><?php echo esc_attr(CSV_INSERT_DATA); ?> </p>"; } var msgParse = '<p><?php echo addslashes(CSV_TOTAL_RECORD); ?> </p>'; gdMsg += msgParse.replace("%s", gd_rowcount); if (gd_invalidcount > 0) { msgParse = msgParse = '<p><?php echo sprintf(CSV_INVALID_DEFUALT_ADDRESS, '%s', '%d'); ?> </p>'; msgParse = msgParse.replace("%s", gd_invalidcount); msgParse = msgParse.replace("%d", gd_total_records); gdMsg += msgParse; } if (gd_blank_address > 0) { msgParse = '<p><?php echo addslashes(sprintf(CSV_INVALID_TOTAL_RECORD, '%s', '%d')); ?> </p>'; msgParse = msgParse.replace("%s", gd_blank_address); msgParse = msgParse.replace("%d", gd_total_records); gdMsg += msgParse; } if (gd_invalid_post_type > 0) { msgParse = '<p><?php echo addslashes(sprintf(CSV_INVALID_POST_TYPE, '%s', '%d')); ?> </p>'; msgParse = msgParse.replace("%s", gd_invalid_post_type); msgParse = msgParse.replace("%d", gd_total_records); gdMsg += msgParse; } if (gd_invalid_title > 0) { msgParse = '<p><?php echo addslashes(sprintf(CSV_BLANK_POST_TITLE, '%s', '%d')); ?> </p>'; msgParse = msgParse.replace("%s", gd_invalid_title); msgParse = msgParse.replace("%d", gd_total_records); gdMsg += msgParse; } if (gd_upload_files > 0) { gdMsg += '<p><?php echo addslashes(sprintf(CSV_TRANSFER_IMG_FOLDER, $uploads['subdir'])); ?> </p>'; } gdMsg += '<p></p>'; jQuery('#gd-import-msg').find('#message').removeClass('error').addClass('updated').html(gdMsg); jQuery('#gd-import-msg').show(); } </script> <table class="form-table gd-csv-form-table"> <tbody> <tr valign="top" class="single_select_page"> <th class="titledesc" scope="row"><?php echo SELECT_CSV_FILE; ?> </th> <td class="forminp"> <div class="gtd-formfeild"> <div class="gtd-form_row clearfix" id="<?php echo $id; ?> dropbox"> <div class="plupload-upload-uic hide-if-no-js" id="<?php echo $id; ?> plupload-upload-ui"> <input type="text" readonly="readonly" name="<?php echo $id; ?> " class="gd_csv_filename" id="<?php echo $id; ?> " value="<?php echo $svalue; ?> "/> <input id="<?php echo $id; ?> plupload-browse-button" type="button" value="<?php echo SELECT_UPLOAD_CSV; ?> " class="gd_uploadcsv_button"/> <br/> <a href="<?php echo geodir_plugin_url() . '/geodirectory-assets/place_listing.csv'; ?> "><?php _e("Download sample csv", GEODIRECTORY_TEXTDOMAIN); ?> </a> <?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($id . 'pluploadan'); ?> "></span><br/> <br/> <div class="filelist"></div> </div> </div> </div> <span id="<?php echo $id; ?> upload-error" style="display:none"></span> <span class="description"></span><br/> <div class="gd_csv_button_div" style="display:none;"> <input type="hidden" class="geodir_import_file" name="geodir_import_file" value="save"/> <input onclick="gdPrepareImport()" type="button" value="<?php echo CSV_IMPORT_DATA; ?> " id="gd_import_data" class="button-primary" name="save"> <input onclick="gdContinueImport()" type="button" value="Continue Import Data" 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="gdTerminateImport()"/> <div id="gd_process_data" style="display:none"><span class="spinner" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", GEODIRECTORY_TEXTDOMAIN); ?> </div> </div> <div id="gd_importer" style="display:none"> <input type="hidden" id="gd_tmpcount" value="0"/> <input type="hidden" id="gd_tot_records" value="100"/> <input type="hidden" id="gd_checktotal" value="100"/> <input type="hidden" id="gd_terminateaction" value="continue"/> <input type="hidden" id="gd_prepared" value="continue"/> <input type="hidden" id="gd_rowcount" value="0"/> <input type="hidden" id="gd_invalidcount" value="0"/> <input type="hidden" id="gd_blank_address" value="0"/> <input type="hidden" id="gd_upload_files" value="0"/> <input type="hidden" id="gd_invalid_post_type" value="0"/> <input type="hidden" id="gd_invalid_title" value="0"/> <input type="hidden" id="gd_total_records" value="0"/> </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> ( <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> </td> </tr> </tbody> </table> <?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 }
/** * Back-end popular posts widget settings form. * * @since 1.0.0 * @since 1.5.1 Declare function public. * * @param array $instance Previously saved values from database. */ public function form($instance) { //widgetform in backend $instance = wp_parse_args((array) $instance, array('title' => '', 'post_type' => '', 'category' => array(), 'category_title' => '', 'list_sort' => '', 'list_order' => '', 'post_number' => '5', 'layout' => 'gridview_onehalf', 'listing_width' => '', 'add_location_filter' => '1', 'character_count' => '20', 'show_featured_only' => '', 'show_special_only' => '', 'with_pics_only' => '', 'with_videos_only' => '', 'use_viewing_post_type' => '')); $title = strip_tags($instance['title']); $post_type = strip_tags($instance['post_type']); $category = $instance['category']; $category_title = strip_tags($instance['category_title']); $list_sort = strip_tags($instance['list_sort']); $list_order = strip_tags($instance['list_order']); $post_number = strip_tags($instance['post_number']); $layout = strip_tags($instance['layout']); $listing_width = strip_tags($instance['listing_width']); $add_location_filter = strip_tags($instance['add_location_filter']); $character_count = $instance['character_count']; $show_featured_only = isset($instance['show_featured_only']) && $instance['show_featured_only'] ? true : false; $show_special_only = isset($instance['show_special_only']) && $instance['show_special_only'] ? true : false; $with_pics_only = isset($instance['with_pics_only']) && $instance['with_pics_only'] ? true : false; $with_videos_only = isset($instance['with_videos_only']) && $instance['with_videos_only'] ? true : false; $use_viewing_post_type = isset($instance['use_viewing_post_type']) && $instance['use_viewing_post_type'] ? true : false; ?> <p> <label for="<?php echo $this->get_field_id('title'); ?> "><?php _e('Title:', 'geodirectory'); ?> <small>(%posttype_singular_label% , %posttype_plural_label% <?php _e('can be used', 'geodirectory'); ?> ) </small> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?> " name="<?php echo $this->get_field_name('title'); ?> " type="text" value="<?php echo esc_attr($title); ?> "/> </label> </p> <p> <label for="<?php echo $this->get_field_id('post_type'); ?> "><?php _e('Post Type:', 'geodirectory'); ?> <?php $postypes = geodir_get_posttypes(); /** * Filter the post types to display in widget. * * @since 1.0.0 * * @param array $postypes Post types array. */ $postypes = apply_filters('geodir_post_type_list_in_p_widget', $postypes); ?> <select class="widefat" id="<?php echo $this->get_field_id('post_type'); ?> " name="<?php echo $this->get_field_name('post_type'); ?> " onchange="geodir_change_category_list(this)"> <?php foreach ($postypes as $postypes_obj) { ?> <option <?php if ($post_type == $postypes_obj) { echo 'selected="selected"'; } ?> value="<?php echo $postypes_obj; ?> "><?php $extvalue = explode('_', $postypes_obj); echo ucfirst($extvalue[1]); ?> </option> <?php } ?> </select> </label> </p> <p id="post_type_cats"> <label for="<?php echo $this->get_field_id('category'); ?> "><?php _e('Post Category:', 'geodirectory'); ?> <?php $post_type = $post_type != '' ? $post_type : 'gd_place'; $all_postypes = geodir_get_posttypes(); if (!in_array($post_type, $all_postypes)) { $post_type = 'gd_place'; } $category_taxonomy = geodir_get_taxonomies($post_type); $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC')); ?> <select multiple="multiple" class="widefat" name="<?php echo $this->get_field_name('category'); ?> []" onchange="geodir_popular_widget_cat_title(this)"> <option <?php if (!is_array($category) || is_array($category) && in_array('0', $category)) { echo 'selected="selected"'; } ?> value="0"><?php _e('All', 'geodirectory'); ?> </option> <?php foreach ($categories as $category_obj) { $selected = ''; if (is_array($category) && in_array($category_obj->term_id, $category)) { echo $selected = 'selected="selected"'; } ?> <option <?php echo $selected; ?> value="<?php echo $category_obj->term_id; ?> "><?php echo ucfirst($category_obj->name); ?> </option> <?php } ?> </select> <input type="hidden" name="<?php echo $this->get_field_name('category_title'); ?> " id="<?php echo $this->get_field_id('category_title'); ?> " value="<?php if ($category_title != '') { echo $category_title; } else { echo __('All', 'geodirectory'); } ?> "/> </label> </p> <p> <label for="<?php echo $this->get_field_id('list_sort'); ?> "><?php _e('Sort by:', 'geodirectory'); ?> <select class="widefat" id="<?php echo $this->get_field_id('list_sort'); ?> " name="<?php echo $this->get_field_name('list_sort'); ?> "> <option <?php if ($list_sort == 'az') { echo 'selected="selected"'; } ?> value="az"><?php _e('A-Z', 'geodirectory'); ?> </option> <option <?php if ($list_sort == 'latest') { echo 'selected="selected"'; } ?> value="latest"><?php _e('Latest', 'geodirectory'); ?> </option> <option <?php if ($list_sort == 'featured') { echo 'selected="selected"'; } ?> value="featured"><?php _e('Featured', 'geodirectory'); ?> </option> <option <?php if ($list_sort == 'high_review') { echo 'selected="selected"'; } ?> value="high_review"><?php _e('Review', 'geodirectory'); ?> </option> <option <?php if ($list_sort == 'high_rating') { echo 'selected="selected"'; } ?> value="high_rating"><?php _e('Rating', 'geodirectory'); ?> </option> <option <?php if ($list_sort == 'random') { echo 'selected="selected"'; } ?> value="random"><?php _e('Random', 'geodirectory'); ?> </option> </select> </label> </p> <p> <label for="<?php echo $this->get_field_id('post_number'); ?> "><?php _e('Number of posts:', 'geodirectory'); ?> <input class="widefat" id="<?php echo $this->get_field_id('post_number'); ?> " name="<?php echo $this->get_field_name('post_number'); ?> " type="text" value="<?php echo esc_attr($post_number); ?> "/> </label> </p> <p> <label for="<?php echo $this->get_field_id('layout'); ?> "> <?php _e('Layout:', 'geodirectory'); ?> <select class="widefat" id="<?php echo $this->get_field_id('layout'); ?> " name="<?php echo $this->get_field_name('layout'); ?> "> <option <?php if ($layout == 'gridview_onehalf') { echo 'selected="selected"'; } ?> value="gridview_onehalf"><?php _e('Grid View (Two Columns)', 'geodirectory'); ?> </option> <option <?php if ($layout == 'gridview_onethird') { echo 'selected="selected"'; } ?> value="gridview_onethird"><?php _e('Grid View (Three Columns)', 'geodirectory'); ?> </option> <option <?php if ($layout == 'gridview_onefourth') { echo 'selected="selected"'; } ?> value="gridview_onefourth"><?php _e('Grid View (Four Columns)', 'geodirectory'); ?> </option> <option <?php if ($layout == 'gridview_onefifth') { echo 'selected="selected"'; } ?> value="gridview_onefifth"><?php _e('Grid View (Five Columns)', 'geodirectory'); ?> </option> <option <?php if ($layout == 'list') { echo 'selected="selected"'; } ?> value="list"><?php _e('List view', 'geodirectory'); ?> </option> </select> </label> </p> <p> <label for="<?php echo $this->get_field_id('listing_width'); ?> "><?php _e('Listing width:', 'geodirectory'); ?> <input class="widefat" id="<?php echo $this->get_field_id('listing_width'); ?> " name="<?php echo $this->get_field_name('listing_width'); ?> " type="text" value="<?php echo esc_attr($listing_width); ?> "/> </label> </p> <p> <label for="<?php echo $this->get_field_id('character_count'); ?> "><?php _e('Post Content excerpt character count :', 'geodirectory'); ?> <input class="widefat" id="<?php echo $this->get_field_id('character_count'); ?> " name="<?php echo $this->get_field_name('character_count'); ?> " type="text" value="<?php echo esc_attr($character_count); ?> "/> </label> </p> <p> <label for="<?php echo $this->get_field_id('add_location_filter'); ?> "> <?php _e('Enable Location Filter:', 'geodirectory'); ?> <input type="checkbox" id="<?php echo $this->get_field_id('add_location_filter'); ?> " name="<?php echo $this->get_field_name('add_location_filter'); ?> " <?php if ($add_location_filter) { echo 'checked="checked"'; } ?> value="1"/> </label> </p> <p> <label for="<?php echo $this->get_field_id('show_featured_only'); ?> "> <?php _e('Show only featured listings:', 'geodirectory'); ?> <input type="checkbox" id="<?php echo $this->get_field_id('show_featured_only'); ?> " name="<?php echo $this->get_field_name('show_featured_only'); ?> " <?php if ($show_featured_only) { echo 'checked="checked"'; } ?> value="1"/> </label> </p> <p> <label for="<?php echo $this->get_field_id('show_special_only'); ?> "> <?php _e('Show only listings with special offers:', 'geodirectory'); ?> <input type="checkbox" id="<?php echo $this->get_field_id('show_special_only'); ?> " name="<?php echo $this->get_field_name('show_special_only'); ?> " <?php if ($show_special_only) { echo 'checked="checked"'; } ?> value="1"/> </label> </p> <p> <label for="<?php echo $this->get_field_id('with_pics_only'); ?> "> <?php _e('Show only listings with pics:', 'geodirectory'); ?> <input type="checkbox" id="<?php echo $this->get_field_id('with_pics_only'); ?> " name="<?php echo $this->get_field_name('with_pics_only'); ?> " <?php if ($with_pics_only) { echo 'checked="checked"'; } ?> value="1"/> </label> </p> <p> <label for="<?php echo $this->get_field_id('with_videos_only'); ?> "> <?php _e('Show only listings with videos:', 'geodirectory'); ?> <input type="checkbox" id="<?php echo $this->get_field_id('with_videos_only'); ?> " name="<?php echo $this->get_field_name('with_videos_only'); ?> " <?php if ($with_videos_only) { echo 'checked="checked"'; } ?> value="1"/> </label> </p> <p> <label for="<?php echo $this->get_field_id('use_viewing_post_type'); ?> "><?php _e('Use current viewing post type:', 'geodirectory'); ?> <input type="checkbox" id="<?php echo $this->get_field_id('use_viewing_post_type'); ?> " name="<?php echo $this->get_field_name('use_viewing_post_type'); ?> " <?php if ($use_viewing_post_type) { echo 'checked="checked"'; } ?> value="1"/> </label> </p> <script type="text/javascript"> function geodir_popular_widget_cat_title(val) { jQuery(val).find("option:selected").each(function (i) { if (i == 0) jQuery(val).closest('form').find('#post_type_cats input').val(jQuery(this).html()); }); } function geodir_change_category_list(obj, selected) { var post_type = obj.value; var ajax_url = '<?php echo geodir_get_ajax_url(); ?> ' var myurl = ajax_url + "&geodir_ajax=admin_ajax&ajax_action=get_cat_dl&post_type=" + post_type + "&selected=" + selected; jQuery.ajax({ type: "GET", url: myurl, success: function (data) { jQuery(obj).closest('form').find('#post_type_cats select').html(data); } }); } <?php if (is_active_widget(false, false, $this->id_base, true)) { ?> var post_type = jQuery('#<?php echo $this->get_field_id('post_type'); ?> ').val(); <?php } ?> </script> <?php }
/** * Front end listing view template selection. * * This function adds a drop down in front end listing page for selecting view template. Ex: list view, 2 column grid view, etc. * * @since 1.0.0 * @package GeoDirectory */ function geodir_list_view_select() { ?> <script type="text/javascript"> function geodir_list_view_select(list) { //alert(listval); val = list.value; if (!val) { return; } //var listSel = jQuery(list).closest('.geodir_category_list_view'); var listSel = jQuery(list).parent().parent().next('.geodir_category_list_view'); if (val != 1) { jQuery(listSel).children('li').addClass('geodir-gridview'); jQuery(listSel).children('li').removeClass('geodir-listview'); } else { jQuery(listSel).children('li').addClass('geodir-listview'); } if (val == 1) { jQuery(listSel).children('li').removeClass('geodir-gridview gridview_onehalf gridview_onethird gridview_onefourth gridview_onefifth'); } else if (val == 2) { jQuery(listSel).children('li').switchClass('gridview_onethird gridview_onefourth gridview_onefifth', 'gridview_onehalf', 600); } else if (val == 3) { jQuery(listSel).children('li').switchClass('gridview_onehalf gridview_onefourth gridview_onefifth', 'gridview_onethird', 600); } else if (val == 4) { jQuery(listSel).children('li').switchClass('gridview_onehalf gridview_onethird gridview_onefifth', 'gridview_onefourth', 600); } else if (val == 5) { jQuery(listSel).children('li').switchClass('gridview_onehalf gridview_onethird gridview_onefourth', 'gridview_onefifth', 600); } jQuery.post("<?php echo geodir_get_ajax_url(); ?> &gd_listing_view=" + val, function (data) { //alert(data ); }); } </script> <div class="geodir-list-view-select"> <select id="dynamic_select"> <option value="" selected>เลือกจงหวัด</option> <option value="สุโขทัย-ร้านอาหาร/">สุโขทัย</option> <option value="กำแพงเพชร-ร้านอาหาร/">กำแพงเพชร</option> <option value="เชียงใหม่-ร้านอาหาร/">เชียงใหม่</option> <option value="อุตรดิตถ์-ร้านอาหาร/">อุตรดิตถ์</option> <option value="พิษณุโลก-ร้านอาหาร/">พิษณุโลก</option> <option value="แม่ฮ่องสอน-ร้านอาหาร/">แม่ฮ่องสอน</option> <option value="เชียงราย-ร้านอาหาร/">เชียงราย</option> <option value="เพชรบูรณ์/">เพชรบูรณ์</option> <option value="พะเยา-ร้านอาหาร/">พะเยา</option> <option value="แพร่-ร้านอาหาร/">แพร่</option> <option value="ตาก-ร้านอาหาร/">ตาก</option> <option value="ลำพูน-ร้านอาหาร/">ลำพูน</option> <option value="น่าน-ร้านอาหาร/">น่าน</option> <option value="ลำปาง/">ลำปาง</option> </select> <script> // bind change event to select jQuery('#dynamic_select').change(function () { var url = jQuery(this).val(); // get selected value if (url) { // require a URL window.location = window.location.href+url; // redirect } }); </script> </div> <div class="geodir-list-view-select"> <select id="dynamic_select2"> <option value="" selected>เลือกจงหวัด</option> <option value="สุโขทัย/">สุโขทัย</option> <option value="กำแพงเพชร/">กำแพงเพชร</option> <option value="เชียงใหม่/">เชียงใหม่</option> <option value="อุตรดิตถ์/">อุตรดิตถ์</option> <option value="พิษณุโลก/">พิษณุโลก</option> <option value="แม่ฮ่องสอน/">แม่ฮ่องสอน</option> <option value="เชียงราย/">เชียงราย</option> <option value="เพชรบูรณ์/">เพชรบูรณ์</option> <option value="พะเยา/">พะเยา</option> <option value="แพร่/">แพร่</option> <option value="ตาก/">ตาก</option> <option value="ลำพูน/">ลำพูน</option> <option value="น่าน">น่าน</option> <option value="ลำปาง/">ลำปาง</option> </select> <script> // bind change event to select jQuery('#dynamic_select2').change(function () { var url = jQuery(this).val(); // get selected value if (url) { // require a URL window.location = window.location.href+url; // redirect } }); </script> </div> <?php }
// start go back and edit / cancel buffering ?> <a href="<?php echo $postlink; ?> " class="geodir_goback"><?php echo PRO_BACK_AND_EDIT_TEXT; ?> </a> <input type="button" name="Cancel" value="<?php echo PRO_CANCEL_BUTTON; ?> " class="geodir_button geodir_cancle_button" onclick="window.location.href='<?php echo geodir_get_ajax_url() . '&geodir_ajax=add_listing&ajax_action=cancel&pid=' . $post_id . '&listing_type=' . $post_type; ?> '"/> <?php $publish_listing_form_go_back = ob_get_clean(); /** * Filter the cancel and go back and edit HTML on the preview page. * * @since 1.0.0 * @param string $publish_listing_form_go_back The HTML for the cancel and go back and edit button/link. */ $publish_listing_form_go_back = apply_filters('geodir_publish_listing_form_go_back', $publish_listing_form_go_back); echo $publish_listing_form_go_back; ?> </div> </form>