@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function geodir_core_dequeue_script() |
24 | 24 | { |
25 | - wp_dequeue_script('flexslider'); |
|
25 | + wp_dequeue_script('flexslider'); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | add_action('wp_print_scripts', 'geodir_core_dequeue_script', 100); |
@@ -35,175 +35,175 @@ discard block |
||
35 | 35 | */ |
36 | 36 | function geodir_templates_scripts() |
37 | 37 | { |
38 | - $is_detail_page = false; |
|
39 | - $geodir_map_name = geodir_map_name(); |
|
38 | + $is_detail_page = false; |
|
39 | + $geodir_map_name = geodir_map_name(); |
|
40 | 40 | |
41 | - if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) { |
|
42 | - $is_detail_page = true; |
|
43 | - } |
|
44 | - |
|
45 | - wp_enqueue_script('jquery'); |
|
46 | - |
|
47 | - wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js', array(), GEODIRECTORY_VERSION); |
|
48 | - wp_enqueue_script('geodirectory-script'); |
|
49 | - |
|
50 | - $geodir_vars_data = array( |
|
51 | - 'siteurl' => get_option('siteurl'), |
|
52 | - 'geodir_plugin_url' => geodir_plugin_url(), |
|
53 | - 'geodir_lazy_load' => get_option('geodir_lazy_load',1), |
|
54 | - 'geodir_ajax_url' => geodir_get_ajax_url(), |
|
55 | - 'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'), |
|
56 | - 'is_rtl' => is_rtl() ? 1 : 0 // fix rtl issue |
|
57 | - ); |
|
58 | - |
|
59 | - /** |
|
60 | - * Filter the `geodir_var` data array that outputs the wp_localize_script() translations and variables. |
|
61 | - * |
|
62 | - * This is used by addons to add JS translatable variables. |
|
63 | - * |
|
64 | - * @since 1.4.4 |
|
65 | - * @param array $geodir_vars_data { |
|
66 | - * geodir var data used by addons to add JS translatable variables. |
|
67 | - * |
|
68 | - * @type string $siteurl Site url. |
|
69 | - * @type string $geodir_plugin_url Geodirectory core plugin url. |
|
70 | - * @type string $geodir_ajax_url Geodirectory plugin ajax url. |
|
71 | - * @type int $geodir_gd_modal Disable GD modal that displays slideshow images in popup?. |
|
72 | - * @type int $is_rtl Checks if current locale is RTL. |
|
73 | - * |
|
74 | - * } |
|
75 | - */ |
|
76 | - $geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data); |
|
77 | - |
|
78 | - wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data); |
|
79 | - |
|
80 | - wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true); |
|
81 | - if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');} |
|
82 | - |
|
83 | - wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true); |
|
84 | - wp_enqueue_script('geodirectory-lightbox-jquery'); |
|
41 | + if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) { |
|
42 | + $is_detail_page = true; |
|
43 | + } |
|
85 | 44 | |
86 | - wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true); |
|
87 | - if ($is_detail_page) { |
|
88 | - wp_enqueue_script('geodirectory-jquery-simplemodal'); |
|
89 | - } |
|
45 | + wp_enqueue_script('jquery'); |
|
46 | + |
|
47 | + wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js', array(), GEODIRECTORY_VERSION); |
|
48 | + wp_enqueue_script('geodirectory-script'); |
|
49 | + |
|
50 | + $geodir_vars_data = array( |
|
51 | + 'siteurl' => get_option('siteurl'), |
|
52 | + 'geodir_plugin_url' => geodir_plugin_url(), |
|
53 | + 'geodir_lazy_load' => get_option('geodir_lazy_load',1), |
|
54 | + 'geodir_ajax_url' => geodir_get_ajax_url(), |
|
55 | + 'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'), |
|
56 | + 'is_rtl' => is_rtl() ? 1 : 0 // fix rtl issue |
|
57 | + ); |
|
58 | + |
|
59 | + /** |
|
60 | + * Filter the `geodir_var` data array that outputs the wp_localize_script() translations and variables. |
|
61 | + * |
|
62 | + * This is used by addons to add JS translatable variables. |
|
63 | + * |
|
64 | + * @since 1.4.4 |
|
65 | + * @param array $geodir_vars_data { |
|
66 | + * geodir var data used by addons to add JS translatable variables. |
|
67 | + * |
|
68 | + * @type string $siteurl Site url. |
|
69 | + * @type string $geodir_plugin_url Geodirectory core plugin url. |
|
70 | + * @type string $geodir_ajax_url Geodirectory plugin ajax url. |
|
71 | + * @type int $geodir_gd_modal Disable GD modal that displays slideshow images in popup?. |
|
72 | + * @type int $is_rtl Checks if current locale is RTL. |
|
73 | + * |
|
74 | + * } |
|
75 | + */ |
|
76 | + $geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data); |
|
77 | + |
|
78 | + wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data); |
|
79 | + |
|
80 | + wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true); |
|
81 | + if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');} |
|
82 | + |
|
83 | + wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true); |
|
84 | + wp_enqueue_script('geodirectory-lightbox-jquery'); |
|
85 | + |
|
86 | + wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true); |
|
87 | + if ($is_detail_page) { |
|
88 | + wp_enqueue_script('geodirectory-jquery-simplemodal'); |
|
89 | + } |
|
90 | 90 | |
91 | - if (in_array($geodir_map_name, array('auto', 'google'))) { |
|
92 | - $map_lang = "&language=" . geodir_get_map_default_language(); |
|
93 | - $map_key = "&key=" . geodir_get_map_api_key(); |
|
94 | - /** |
|
95 | - * Filter the variables that are added to the end of the google maps script call. |
|
96 | - * |
|
97 | - * This i used to change things like google maps language etc. |
|
98 | - * |
|
99 | - * @since 1.0.0 |
|
100 | - * @param string $var The string to filter, default is empty string. |
|
101 | - */ |
|
102 | - $map_extra = apply_filters('geodir_googlemap_script_extra', ''); |
|
103 | - wp_enqueue_script('geodirectory-googlemap-script', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra , '', NULL); |
|
91 | + if (in_array($geodir_map_name, array('auto', 'google'))) { |
|
92 | + $map_lang = "&language=" . geodir_get_map_default_language(); |
|
93 | + $map_key = "&key=" . geodir_get_map_api_key(); |
|
94 | + /** |
|
95 | + * Filter the variables that are added to the end of the google maps script call. |
|
96 | + * |
|
97 | + * This i used to change things like google maps language etc. |
|
98 | + * |
|
99 | + * @since 1.0.0 |
|
100 | + * @param string $var The string to filter, default is empty string. |
|
101 | + */ |
|
102 | + $map_extra = apply_filters('geodir_googlemap_script_extra', ''); |
|
103 | + wp_enqueue_script('geodirectory-googlemap-script', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra , '', NULL); |
|
104 | 104 | |
105 | - // Overlapping Marker Spiderfier |
|
106 | - wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION); |
|
107 | - wp_enqueue_script('geodirectory-g-overlappingmarker-script'); |
|
108 | - } |
|
105 | + // Overlapping Marker Spiderfier |
|
106 | + wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION); |
|
107 | + wp_enqueue_script('geodirectory-g-overlappingmarker-script'); |
|
108 | + } |
|
109 | 109 | |
110 | - if ($geodir_map_name == 'osm') { |
|
111 | - // Leaflet OpenStreetMap |
|
112 | - wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION); |
|
113 | - wp_enqueue_style('geodirectory-leaflet-style'); |
|
110 | + if ($geodir_map_name == 'osm') { |
|
111 | + // Leaflet OpenStreetMap |
|
112 | + wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION); |
|
113 | + wp_enqueue_style('geodirectory-leaflet-style'); |
|
114 | 114 | |
115 | - wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION); |
|
116 | - wp_enqueue_script('geodirectory-leaflet-script'); |
|
115 | + wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION); |
|
116 | + wp_enqueue_script('geodirectory-leaflet-script'); |
|
117 | 117 | |
118 | - wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.min.js', array(), GEODIRECTORY_VERSION); |
|
119 | - wp_enqueue_script('geodirectory-leaflet-geo-script'); |
|
118 | + wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.min.js', array(), GEODIRECTORY_VERSION); |
|
119 | + wp_enqueue_script('geodirectory-leaflet-geo-script'); |
|
120 | 120 | |
121 | - if ($is_detail_page) { |
|
122 | - wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION); |
|
123 | - wp_enqueue_style('geodirectory-leaflet-routing-style'); |
|
121 | + if ($is_detail_page) { |
|
122 | + wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION); |
|
123 | + wp_enqueue_style('geodirectory-leaflet-routing-style'); |
|
124 | 124 | |
125 | - wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.min.js', array(), GEODIRECTORY_VERSION); |
|
126 | - wp_enqueue_script('geodirectory-leaflet-routing-script'); |
|
127 | - } |
|
125 | + wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.min.js', array(), GEODIRECTORY_VERSION); |
|
126 | + wp_enqueue_script('geodirectory-leaflet-routing-script'); |
|
127 | + } |
|
128 | 128 | |
129 | - // Overlapping Marker Spiderfier Leaflet |
|
130 | - wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION); |
|
131 | - wp_enqueue_script('geodirectory-o-overlappingmarker-script'); |
|
132 | - } |
|
133 | - wp_enqueue_script( 'jquery-ui-autocomplete' ); |
|
129 | + // Overlapping Marker Spiderfier Leaflet |
|
130 | + wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION); |
|
131 | + wp_enqueue_script('geodirectory-o-overlappingmarker-script'); |
|
132 | + } |
|
133 | + wp_enqueue_script( 'jquery-ui-autocomplete' ); |
|
134 | 134 | |
135 | - wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true); |
|
136 | - wp_enqueue_script('geodirectory-goMap-script'); |
|
137 | - |
|
138 | - wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION); |
|
139 | - wp_enqueue_script('chosen'); |
|
140 | - |
|
141 | - wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION); |
|
142 | - wp_enqueue_script('geodirectory-choose-ajax'); |
|
143 | - |
|
144 | - wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.min.js', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true); |
|
145 | - |
|
146 | - if (is_page() && geodir_is_page('add-listing')) { |
|
147 | - // SCRIPT FOR UPLOAD |
|
148 | - wp_enqueue_script('plupload-all'); |
|
149 | - wp_enqueue_script('jquery-ui-sortable'); |
|
150 | - |
|
151 | - wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true); |
|
152 | - wp_enqueue_script('geodirectory-plupload-script'); |
|
153 | - // SCRIPT FOR UPLOAD END |
|
154 | - |
|
155 | - // 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 |
|
156 | - if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) { |
|
157 | - $ajax_url = admin_url('admin-ajax.php'); |
|
158 | - } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) { |
|
159 | - $ajax_url = admin_url('admin-ajax.php'); |
|
160 | - } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) { |
|
161 | - $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php')); |
|
162 | - } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) { |
|
163 | - $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php')); |
|
164 | - } else { |
|
165 | - $ajax_url = admin_url('admin-ajax.php'); |
|
166 | - } |
|
135 | + wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true); |
|
136 | + wp_enqueue_script('geodirectory-goMap-script'); |
|
137 | + |
|
138 | + wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION); |
|
139 | + wp_enqueue_script('chosen'); |
|
140 | + |
|
141 | + wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION); |
|
142 | + wp_enqueue_script('geodirectory-choose-ajax'); |
|
143 | + |
|
144 | + wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.min.js', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true); |
|
145 | + |
|
146 | + if (is_page() && geodir_is_page('add-listing')) { |
|
147 | + // SCRIPT FOR UPLOAD |
|
148 | + wp_enqueue_script('plupload-all'); |
|
149 | + wp_enqueue_script('jquery-ui-sortable'); |
|
150 | + |
|
151 | + wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true); |
|
152 | + wp_enqueue_script('geodirectory-plupload-script'); |
|
153 | + // SCRIPT FOR UPLOAD END |
|
154 | + |
|
155 | + // 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 |
|
156 | + if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) { |
|
157 | + $ajax_url = admin_url('admin-ajax.php'); |
|
158 | + } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) { |
|
159 | + $ajax_url = admin_url('admin-ajax.php'); |
|
160 | + } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) { |
|
161 | + $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php')); |
|
162 | + } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) { |
|
163 | + $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php')); |
|
164 | + } else { |
|
165 | + $ajax_url = admin_url('admin-ajax.php'); |
|
166 | + } |
|
167 | 167 | |
168 | - // place js config array for plupload |
|
169 | - $plupload_init = array( |
|
170 | - 'runtimes' => 'html5,silverlight,flash,browserplus,gears,html4', |
|
171 | - 'browse_button' => 'plupload-browse-button', // will be adjusted per uploader |
|
172 | - 'container' => 'plupload-upload-ui', // will be adjusted per uploader |
|
173 | - 'drop_element' => 'dropbox', // will be adjusted per uploader |
|
174 | - 'file_data_name' => 'async-upload', // will be adjusted per uploader |
|
175 | - 'multiple_queues' => true, |
|
176 | - 'max_file_size' => geodir_max_upload_size(), |
|
177 | - 'url' => $ajax_url, |
|
178 | - 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), |
|
179 | - 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), |
|
180 | - 'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')), |
|
181 | - 'multipart' => true, |
|
182 | - 'urlstream_upload' => true, |
|
183 | - 'multi_selection' => false, // will be added per uploader |
|
184 | - // additional post data to send to our ajax hook |
|
185 | - 'multipart_params' => array( |
|
186 | - '_ajax_nonce' => "", // will be added per uploader |
|
187 | - 'action' => 'plupload_action', // the ajax action name |
|
188 | - 'imgid' => 0 // will be added per uploader |
|
189 | - ) |
|
190 | - ); |
|
191 | - $base_plupload_config = json_encode($plupload_init); |
|
192 | - |
|
193 | - $gd_plupload_init = array('base_plupload_config' => $base_plupload_config, |
|
194 | - 'upload_img_size' => geodir_max_upload_size()); |
|
195 | - |
|
196 | - wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init); |
|
197 | - |
|
198 | - wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload'); |
|
199 | - } // End if for add place page |
|
200 | - |
|
201 | - wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
202 | - if ($is_detail_page) { |
|
168 | + // place js config array for plupload |
|
169 | + $plupload_init = array( |
|
170 | + 'runtimes' => 'html5,silverlight,flash,browserplus,gears,html4', |
|
171 | + 'browse_button' => 'plupload-browse-button', // will be adjusted per uploader |
|
172 | + 'container' => 'plupload-upload-ui', // will be adjusted per uploader |
|
173 | + 'drop_element' => 'dropbox', // will be adjusted per uploader |
|
174 | + 'file_data_name' => 'async-upload', // will be adjusted per uploader |
|
175 | + 'multiple_queues' => true, |
|
176 | + 'max_file_size' => geodir_max_upload_size(), |
|
177 | + 'url' => $ajax_url, |
|
178 | + 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), |
|
179 | + 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), |
|
180 | + 'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')), |
|
181 | + 'multipart' => true, |
|
182 | + 'urlstream_upload' => true, |
|
183 | + 'multi_selection' => false, // will be added per uploader |
|
184 | + // additional post data to send to our ajax hook |
|
185 | + 'multipart_params' => array( |
|
186 | + '_ajax_nonce' => "", // will be added per uploader |
|
187 | + 'action' => 'plupload_action', // the ajax action name |
|
188 | + 'imgid' => 0 // will be added per uploader |
|
189 | + ) |
|
190 | + ); |
|
191 | + $base_plupload_config = json_encode($plupload_init); |
|
192 | + |
|
193 | + $gd_plupload_init = array('base_plupload_config' => $base_plupload_config, |
|
194 | + 'upload_img_size' => geodir_max_upload_size()); |
|
195 | + |
|
196 | + wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init); |
|
197 | + |
|
198 | + wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload'); |
|
199 | + } // End if for add place page |
|
200 | + |
|
201 | + wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
202 | + if ($is_detail_page) { |
|
203 | 203 | wp_enqueue_script('geodirectory-post-custom-js'); |
204 | 204 | } |
205 | 205 | |
206 | - // font awesome rating script |
|
206 | + // font awesome rating script |
|
207 | 207 | if (get_option('geodir_reviewrating_enable_font_awesome')) { |
208 | 208 | wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION, true); |
209 | 209 | wp_enqueue_script('geodir-barrating-js'); |
@@ -212,11 +212,11 @@ discard block |
||
212 | 212 | wp_enqueue_script('geodir-jRating-js'); |
213 | 213 | } |
214 | 214 | |
215 | - wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
216 | - wp_enqueue_script('geodir-on-document-load'); |
|
215 | + wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
216 | + wp_enqueue_script('geodir-on-document-load'); |
|
217 | 217 | |
218 | - wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
219 | - wp_enqueue_script('google-geometa'); |
|
218 | + wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
219 | + wp_enqueue_script('google-geometa'); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | /** |
@@ -230,8 +230,8 @@ discard block |
||
230 | 230 | */ |
231 | 231 | function geodir_header_scripts() |
232 | 232 | { |
233 | - echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>'; |
|
234 | - echo stripslashes(get_option('geodir_header_scripts')); |
|
233 | + echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>'; |
|
234 | + echo stripslashes(get_option('geodir_header_scripts')); |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | /** |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | */ |
245 | 245 | function geodir_google_analytics_tracking_code() |
246 | 246 | { |
247 | - if(get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')){?> |
|
247 | + if(get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')){?> |
|
248 | 248 | |
249 | 249 | <script> |
250 | 250 | (function(i,s,o,g,r,a,m){ i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ |
@@ -259,9 +259,9 @@ discard block |
||
259 | 259 | </script> |
260 | 260 | |
261 | 261 | <?php |
262 | - }elseif(get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){ |
|
263 | - echo stripslashes(get_option('geodir_ga_tracking_code')); |
|
264 | - } |
|
262 | + }elseif(get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){ |
|
263 | + echo stripslashes(get_option('geodir_ga_tracking_code')); |
|
264 | + } |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | /** |
@@ -275,16 +275,16 @@ discard block |
||
275 | 275 | function geodir_footer_scripts() |
276 | 276 | { |
277 | 277 | |
278 | - echo stripslashes(get_option('geodir_footer_scripts')); |
|
278 | + echo stripslashes(get_option('geodir_footer_scripts')); |
|
279 | 279 | |
280 | - /* |
|
280 | + /* |
|
281 | 281 | * Apple suck and can't/won't fix bugs: https://bugs.webkit.org/show_bug.cgi?id=136041 |
282 | 282 | * |
283 | 283 | * Flexbox wont wrap on ios for search form items |
284 | 284 | */ |
285 | - if ( !empty( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
286 | - echo "<style>body .geodir-listing-search.gd-search-bar-style .geodir-loc-bar .clearfix.geodir-loc-bar-in .geodir-search .gd-search-input-wrapper{flex:50 1 auto !important;min-width: initial !important;width:auto !important;}.geodir-filter-container .geodir-filter-cat{width:auto !important;}</style>"; |
|
287 | - } |
|
285 | + if ( !empty( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
286 | + echo "<style>body .geodir-listing-search.gd-search-bar-style .geodir-loc-bar .clearfix.geodir-loc-bar-in .geodir-search .gd-search-input-wrapper{flex:50 1 auto !important;min-width: initial !important;width:auto !important;}.geodir-filter-container .geodir-filter-cat{width:auto !important;}</style>"; |
|
287 | + } |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | |
@@ -298,12 +298,12 @@ discard block |
||
298 | 298 | */ |
299 | 299 | function geodir_add_async_forscript($url) |
300 | 300 | { |
301 | - if (strpos($url, '#asyncload')===false) |
|
302 | - return $url; |
|
303 | - else if (is_admin()) |
|
304 | - return str_replace('#asyncload', '', $url); |
|
305 | - else |
|
306 | - return str_replace('#asyncload', '', $url)."' async='async"; |
|
301 | + if (strpos($url, '#asyncload')===false) |
|
302 | + return $url; |
|
303 | + else if (is_admin()) |
|
304 | + return str_replace('#asyncload', '', $url); |
|
305 | + else |
|
306 | + return str_replace('#asyncload', '', $url)."' async='async"; |
|
307 | 307 | } |
308 | 308 | add_filter('clean_url', 'geodir_add_async_forscript', 11, 1); |
309 | 309 | |
@@ -316,17 +316,17 @@ discard block |
||
316 | 316 | function geodir_templates_styles() |
317 | 317 | { |
318 | 318 | |
319 | - wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION); |
|
320 | - wp_enqueue_style('geodir-core-scss'); |
|
321 | - wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION); |
|
319 | + wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION); |
|
320 | + wp_enqueue_style('geodir-core-scss'); |
|
321 | + wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION); |
|
322 | 322 | |
323 | - if(is_rtl()){ |
|
324 | - wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION); |
|
325 | - wp_enqueue_style('geodirectory-frontend-rtl-style'); |
|
326 | - } |
|
323 | + if(is_rtl()){ |
|
324 | + wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION); |
|
325 | + wp_enqueue_style('geodirectory-frontend-rtl-style'); |
|
326 | + } |
|
327 | 327 | |
328 | - wp_register_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION); |
|
329 | - wp_enqueue_style('font-awesome'); |
|
328 | + wp_register_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION); |
|
329 | + wp_enqueue_style('font-awesome'); |
|
330 | 330 | |
331 | 331 | |
332 | 332 | } |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | */ |
341 | 341 | function geodir_get_sidebar() |
342 | 342 | { |
343 | - get_sidebar('geodirectory'); |
|
343 | + get_sidebar('geodirectory'); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | /** |
@@ -359,122 +359,122 @@ discard block |
||
359 | 359 | * @param bool $always_show Do you want to show the pagination always? Default: false. |
360 | 360 | */ |
361 | 361 | function geodir_pagination($before = '', $after = '', $prelabel = '', $nxtlabel = '', $pages_to_show = 5, $always_show = false) { |
362 | - global $wp_query, $posts_per_page, $wpdb, $paged, $blog_id; |
|
362 | + global $wp_query, $posts_per_page, $wpdb, $paged, $blog_id; |
|
363 | 363 | |
364 | - if (empty($prelabel)) { |
|
365 | - $prelabel = '<strong><</strong>'; |
|
366 | - } |
|
364 | + if (empty($prelabel)) { |
|
365 | + $prelabel = '<strong><</strong>'; |
|
366 | + } |
|
367 | 367 | |
368 | - if (empty($nxtlabel)) { |
|
369 | - $nxtlabel = '<strong>></strong>'; |
|
370 | - } |
|
368 | + if (empty($nxtlabel)) { |
|
369 | + $nxtlabel = '<strong>></strong>'; |
|
370 | + } |
|
371 | 371 | |
372 | - $half_pages_to_show = round($pages_to_show / 2); |
|
372 | + $half_pages_to_show = round($pages_to_show / 2); |
|
373 | 373 | |
374 | - if (geodir_is_page('home')) // dont apply default pagination for geodirectory home page. |
|
375 | - return; |
|
374 | + if (geodir_is_page('home')) // dont apply default pagination for geodirectory home page. |
|
375 | + return; |
|
376 | 376 | |
377 | - if (!is_single()) { |
|
378 | - if (function_exists('geodir_location_geo_home_link')) { |
|
379 | - remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
380 | - } |
|
381 | - $numposts = $wp_query->found_posts; |
|
377 | + if (!is_single()) { |
|
378 | + if (function_exists('geodir_location_geo_home_link')) { |
|
379 | + remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
380 | + } |
|
381 | + $numposts = $wp_query->found_posts; |
|
382 | 382 | |
383 | - $max_page = ceil($numposts / $posts_per_page); |
|
383 | + $max_page = ceil($numposts / $posts_per_page); |
|
384 | 384 | |
385 | - if (empty($paged)) { |
|
386 | - $paged = 1; |
|
387 | - } |
|
385 | + if (empty($paged)) { |
|
386 | + $paged = 1; |
|
387 | + } |
|
388 | 388 | |
389 | - $post_type = geodir_get_current_posttype(); |
|
390 | - $listing_type_name = get_post_type_plural_label($post_type); |
|
391 | - if (geodir_is_page('listing') || geodir_is_page('search')) { |
|
392 | - $term = array(); |
|
389 | + $post_type = geodir_get_current_posttype(); |
|
390 | + $listing_type_name = get_post_type_plural_label($post_type); |
|
391 | + if (geodir_is_page('listing') || geodir_is_page('search')) { |
|
392 | + $term = array(); |
|
393 | 393 | |
394 | - if (is_tax()) { |
|
395 | - $term_id = get_queried_object_id(); |
|
396 | - $taxonomy = get_query_var('taxonomy'); |
|
394 | + if (is_tax()) { |
|
395 | + $term_id = get_queried_object_id(); |
|
396 | + $taxonomy = get_query_var('taxonomy'); |
|
397 | 397 | |
398 | - if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) { |
|
399 | - $term = get_term($term_id, $post_type . 'category'); |
|
400 | - } |
|
401 | - } |
|
398 | + if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) { |
|
399 | + $term = get_term($term_id, $post_type . 'category'); |
|
400 | + } |
|
401 | + } |
|
402 | 402 | |
403 | - if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) { |
|
404 | - $taxonomy_search = $_REQUEST['s' . $post_type . 'category']; |
|
403 | + if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) { |
|
404 | + $taxonomy_search = $_REQUEST['s' . $post_type . 'category']; |
|
405 | 405 | |
406 | - if (!is_array($taxonomy_search)) { |
|
407 | - $term = get_term((int)$taxonomy_search, $post_type . 'category'); |
|
408 | - } else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search |
|
409 | - $term = get_term((int)$taxonomy_search[0], $post_type . 'category'); |
|
410 | - } |
|
411 | - } |
|
406 | + if (!is_array($taxonomy_search)) { |
|
407 | + $term = get_term((int)$taxonomy_search, $post_type . 'category'); |
|
408 | + } else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search |
|
409 | + $term = get_term((int)$taxonomy_search[0], $post_type . 'category'); |
|
410 | + } |
|
411 | + } |
|
412 | 412 | |
413 | - if (!empty($term) && !is_wp_error($term)) { |
|
414 | - $listing_type_name = $term->name; |
|
415 | - } |
|
416 | - } |
|
413 | + if (!empty($term) && !is_wp_error($term)) { |
|
414 | + $listing_type_name = $term->name; |
|
415 | + } |
|
416 | + } |
|
417 | 417 | |
418 | - if ($max_page > 1 || $always_show) { |
|
419 | - // Extra pagination info |
|
420 | - $geodir_pagination_more_info = get_option('geodir_pagination_advance_info'); |
|
421 | - $start_no = ( $paged - 1 ) * $posts_per_page + 1; |
|
422 | - $end_no = min($paged * $posts_per_page, $numposts); |
|
418 | + if ($max_page > 1 || $always_show) { |
|
419 | + // Extra pagination info |
|
420 | + $geodir_pagination_more_info = get_option('geodir_pagination_advance_info'); |
|
421 | + $start_no = ( $paged - 1 ) * $posts_per_page + 1; |
|
422 | + $end_no = min($paged * $posts_per_page, $numposts); |
|
423 | 423 | |
424 | - if ($geodir_pagination_more_info != '') { |
|
425 | - if ($listing_type_name) { |
|
426 | - $listing_type_name = __($listing_type_name, 'geodirectory'); |
|
427 | - $pegination_desc = wp_sprintf(__('Showing %s %d-%d of %d', 'geodirectory'), $listing_type_name, $start_no, $end_no, $numposts); |
|
428 | - } else { |
|
429 | - $pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts); |
|
430 | - } |
|
431 | - $pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>'; |
|
432 | - /** |
|
433 | - * Adds an extra pagination info above/under pagination. |
|
434 | - * |
|
435 | - * @since 1.5.9 |
|
436 | - * |
|
437 | - * @param string $pagination_info Extra pagination info content. |
|
438 | - * @param string $listing_type_name Listing results type. |
|
439 | - * @param string $start_no First result number. |
|
440 | - * @param string $end_no Last result number. |
|
441 | - * @param string $numposts Total number of listings. |
|
442 | - * @param string $post_type The post type. |
|
443 | - */ |
|
444 | - $pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type); |
|
424 | + if ($geodir_pagination_more_info != '') { |
|
425 | + if ($listing_type_name) { |
|
426 | + $listing_type_name = __($listing_type_name, 'geodirectory'); |
|
427 | + $pegination_desc = wp_sprintf(__('Showing %s %d-%d of %d', 'geodirectory'), $listing_type_name, $start_no, $end_no, $numposts); |
|
428 | + } else { |
|
429 | + $pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts); |
|
430 | + } |
|
431 | + $pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>'; |
|
432 | + /** |
|
433 | + * Adds an extra pagination info above/under pagination. |
|
434 | + * |
|
435 | + * @since 1.5.9 |
|
436 | + * |
|
437 | + * @param string $pagination_info Extra pagination info content. |
|
438 | + * @param string $listing_type_name Listing results type. |
|
439 | + * @param string $start_no First result number. |
|
440 | + * @param string $end_no Last result number. |
|
441 | + * @param string $numposts Total number of listings. |
|
442 | + * @param string $post_type The post type. |
|
443 | + */ |
|
444 | + $pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type); |
|
445 | 445 | |
446 | - if ($geodir_pagination_more_info == 'before') { |
|
447 | - $before = $before . $pagination_info; |
|
448 | - } else if ($geodir_pagination_more_info == 'after') { |
|
449 | - $after = $pagination_info . $after; |
|
450 | - } |
|
451 | - } |
|
446 | + if ($geodir_pagination_more_info == 'before') { |
|
447 | + $before = $before . $pagination_info; |
|
448 | + } else if ($geodir_pagination_more_info == 'after') { |
|
449 | + $after = $pagination_info . $after; |
|
450 | + } |
|
451 | + } |
|
452 | 452 | |
453 | - echo "$before <div class='Navi gd-navi'>"; |
|
454 | - if ($paged >= ($pages_to_show - 1)) { |
|
455 | - echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link()) . '">«</a>'; |
|
456 | - } |
|
457 | - previous_posts_link($prelabel); |
|
458 | - for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) { |
|
459 | - if ($i >= 1 && $i <= $max_page) { |
|
460 | - if ($i == $paged) { |
|
461 | - echo "<strong class='on'>$i</strong>"; |
|
462 | - } else { |
|
463 | - echo ' <a href="' . str_replace('&paged', '&paged', get_pagenum_link($i)) . '">' . $i . '</a> '; |
|
464 | - } |
|
465 | - } |
|
466 | - } |
|
467 | - next_posts_link($nxtlabel, $max_page); |
|
468 | - if (($paged + $half_pages_to_show) < ($max_page)) { |
|
469 | - echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link($max_page)) . '">»</a>'; |
|
470 | - } |
|
471 | - echo "</div> $after"; |
|
472 | - } |
|
453 | + echo "$before <div class='Navi gd-navi'>"; |
|
454 | + if ($paged >= ($pages_to_show - 1)) { |
|
455 | + echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link()) . '">«</a>'; |
|
456 | + } |
|
457 | + previous_posts_link($prelabel); |
|
458 | + for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) { |
|
459 | + if ($i >= 1 && $i <= $max_page) { |
|
460 | + if ($i == $paged) { |
|
461 | + echo "<strong class='on'>$i</strong>"; |
|
462 | + } else { |
|
463 | + echo ' <a href="' . str_replace('&paged', '&paged', get_pagenum_link($i)) . '">' . $i . '</a> '; |
|
464 | + } |
|
465 | + } |
|
466 | + } |
|
467 | + next_posts_link($nxtlabel, $max_page); |
|
468 | + if (($paged + $half_pages_to_show) < ($max_page)) { |
|
469 | + echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link($max_page)) . '">»</a>'; |
|
470 | + } |
|
471 | + echo "</div> $after"; |
|
472 | + } |
|
473 | 473 | |
474 | - if (function_exists('geodir_location_geo_home_link')) { |
|
475 | - add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
476 | - } |
|
477 | - } |
|
474 | + if (function_exists('geodir_location_geo_home_link')) { |
|
475 | + add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
476 | + } |
|
477 | + } |
|
478 | 478 | } |
479 | 479 | |
480 | 480 | /** |
@@ -485,20 +485,20 @@ discard block |
||
485 | 485 | */ |
486 | 486 | function geodir_listingsearch_scripts() |
487 | 487 | { |
488 | - if (get_option('gd_search_dist') != '') { |
|
489 | - $dist = get_option('gd_search_dist'); |
|
490 | - } else { |
|
491 | - $dist = 500; |
|
492 | - } |
|
493 | - $dist_dif = 1000; |
|
494 | - |
|
495 | - if ($dist <= 5000) $dist_dif = 500; |
|
496 | - if ($dist <= 1000) $dist_dif = 100; |
|
497 | - if ($dist <= 500) $dist_dif = 50; |
|
498 | - if ($dist <= 100) $dist_dif = 10; |
|
499 | - if ($dist <= 50) $dist_dif = 5; |
|
500 | - |
|
501 | - ?> |
|
488 | + if (get_option('gd_search_dist') != '') { |
|
489 | + $dist = get_option('gd_search_dist'); |
|
490 | + } else { |
|
491 | + $dist = 500; |
|
492 | + } |
|
493 | + $dist_dif = 1000; |
|
494 | + |
|
495 | + if ($dist <= 5000) $dist_dif = 500; |
|
496 | + if ($dist <= 1000) $dist_dif = 100; |
|
497 | + if ($dist <= 500) $dist_dif = 50; |
|
498 | + if ($dist <= 100) $dist_dif = 10; |
|
499 | + if ($dist <= 50) $dist_dif = 5; |
|
500 | + |
|
501 | + ?> |
|
502 | 502 | <script type="text/javascript"> |
503 | 503 | |
504 | 504 | jQuery(function ($) { |
@@ -556,20 +556,20 @@ discard block |
||
556 | 556 | * @package GeoDirectory |
557 | 557 | */ |
558 | 558 | function geodir_add_sharelocation_scripts() { |
559 | - $default_search_for_text = SEARCH_FOR_TEXT; |
|
560 | - if (get_option('geodir_search_field_default_text')) |
|
561 | - $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory'); |
|
559 | + $default_search_for_text = SEARCH_FOR_TEXT; |
|
560 | + if (get_option('geodir_search_field_default_text')) |
|
561 | + $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory'); |
|
562 | 562 | |
563 | - $default_near_text = NEAR_TEXT; |
|
564 | - if (get_option('geodir_near_field_default_text')) |
|
565 | - $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory'); |
|
563 | + $default_near_text = NEAR_TEXT; |
|
564 | + if (get_option('geodir_near_field_default_text')) |
|
565 | + $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory'); |
|
566 | 566 | |
567 | - $search_location = geodir_get_default_location(); |
|
567 | + $search_location = geodir_get_default_location(); |
|
568 | 568 | |
569 | - $default_search_for_text = addslashes(stripslashes($default_search_for_text)); |
|
570 | - $default_near_text = addslashes(stripslashes($default_near_text)); |
|
571 | - $city = !empty($search_location) ? addslashes(stripslashes($search_location->city)) : ''; |
|
572 | - ?> |
|
569 | + $default_search_for_text = addslashes(stripslashes($default_search_for_text)); |
|
570 | + $default_near_text = addslashes(stripslashes($default_near_text)); |
|
571 | + $city = !empty($search_location) ? addslashes(stripslashes($search_location->city)) : ''; |
|
572 | + ?> |
|
573 | 573 | <script type="text/javascript"> |
574 | 574 | var default_location = '<?php echo $city ;?>'; |
575 | 575 | var latlng; |
@@ -650,14 +650,14 @@ discard block |
||
650 | 650 | initialise2(); |
651 | 651 | } else { |
652 | 652 | <?php |
653 | - $near_add = get_option('geodir_search_near_addition'); |
|
654 | - /** |
|
655 | - * Adds any extra info to the near search box query when trying to geolocate it via google api. |
|
656 | - * |
|
657 | - * @since 1.0.0 |
|
658 | - */ |
|
659 | - $near_add2 = apply_filters('geodir_search_near_addition', ''); |
|
660 | - ?> |
|
653 | + $near_add = get_option('geodir_search_near_addition'); |
|
654 | + /** |
|
655 | + * Adds any extra info to the near search box query when trying to geolocate it via google api. |
|
656 | + * |
|
657 | + * @since 1.0.0 |
|
658 | + */ |
|
659 | + $near_add2 = apply_filters('geodir_search_near_addition', ''); |
|
660 | + ?> |
|
661 | 661 | if (window.gdMaps === 'google') { |
662 | 662 | Sgeocoder.geocode({'address': address<?php echo ($near_add ? '+", ' . $near_add . '"' : '') . $near_add2;?>}, |
663 | 663 | function (results, status) { |
@@ -771,30 +771,30 @@ discard block |
||
771 | 771 | */ |
772 | 772 | function geodir_show_badges_on_image($which, $post, $link) |
773 | 773 | { |
774 | - $return = ''; |
|
775 | - switch ($which) { |
|
776 | - case 'featured': |
|
777 | - /** |
|
778 | - * Filter the featured image badge html that appears in the listings pages over the thumbnail. |
|
779 | - * |
|
780 | - * @since 1.0.0 |
|
781 | - * @param object $post The post object. |
|
782 | - * @param string $link The link to the post. |
|
783 | - */ |
|
784 | - $return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img"> </span></a>',$post,$link); |
|
785 | - break; |
|
786 | - case 'new' : |
|
787 | - /** |
|
788 | - * Filter the new image badge html that appears in the listings pages over the thumbnail. |
|
789 | - * |
|
790 | - * @since 1.0.0 |
|
791 | - * @param object $post The post object. |
|
792 | - * @param string $link The link to the post. |
|
793 | - */ |
|
794 | - $return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing"> </span></a>',$post,$link); |
|
795 | - break; |
|
796 | - |
|
797 | - } |
|
774 | + $return = ''; |
|
775 | + switch ($which) { |
|
776 | + case 'featured': |
|
777 | + /** |
|
778 | + * Filter the featured image badge html that appears in the listings pages over the thumbnail. |
|
779 | + * |
|
780 | + * @since 1.0.0 |
|
781 | + * @param object $post The post object. |
|
782 | + * @param string $link The link to the post. |
|
783 | + */ |
|
784 | + $return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img"> </span></a>',$post,$link); |
|
785 | + break; |
|
786 | + case 'new' : |
|
787 | + /** |
|
788 | + * Filter the new image badge html that appears in the listings pages over the thumbnail. |
|
789 | + * |
|
790 | + * @since 1.0.0 |
|
791 | + * @param object $post The post object. |
|
792 | + * @param string $link The link to the post. |
|
793 | + */ |
|
794 | + $return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing"> </span></a>',$post,$link); |
|
795 | + break; |
|
796 | + |
|
797 | + } |
|
798 | 798 | |
799 | - return $return; |
|
799 | + return $return; |
|
800 | 800 | } |
@@ -9,10 +9,10 @@ discard block |
||
9 | 9 | */ |
10 | 10 | function geodir_get_current_city_lat() |
11 | 11 | { |
12 | - $location = geodir_get_default_location(); |
|
13 | - $lat = isset($location_result->city_latitude) ? $location_result->city_latitude : '39.952484'; |
|
12 | + $location = geodir_get_default_location(); |
|
13 | + $lat = isset($location_result->city_latitude) ? $location_result->city_latitude : '39.952484'; |
|
14 | 14 | |
15 | - return $lat; |
|
15 | + return $lat; |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | /** |
@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | */ |
26 | 26 | function geodir_get_current_city_lng() |
27 | 27 | { |
28 | - $location = geodir_get_default_location(); |
|
29 | - $lng = isset($location_result->city_longitude) ? $location_result->city_longitude : '-75.163786'; |
|
30 | - return $lng; |
|
28 | + $location = geodir_get_default_location(); |
|
29 | + $lng = isset($location_result->city_longitude) ? $location_result->city_longitude : '-75.163786'; |
|
30 | + return $lng; |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | |
@@ -40,15 +40,15 @@ discard block |
||
40 | 40 | */ |
41 | 41 | function geodir_get_default_location() |
42 | 42 | { |
43 | - /** |
|
44 | - * Filter the default location. |
|
45 | - * |
|
46 | - * @since 1.0.0 |
|
47 | - * @package GeoDirectory |
|
48 | - * |
|
49 | - * @param string $location_result The default location object. |
|
50 | - */ |
|
51 | - return $location_result = apply_filters('geodir_get_default_location', get_option('geodir_default_location')); |
|
43 | + /** |
|
44 | + * Filter the default location. |
|
45 | + * |
|
46 | + * @since 1.0.0 |
|
47 | + * @package GeoDirectory |
|
48 | + * |
|
49 | + * @param string $location_result The default location object. |
|
50 | + */ |
|
51 | + return $location_result = apply_filters('geodir_get_default_location', get_option('geodir_default_location')); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -60,11 +60,11 @@ discard block |
||
60 | 60 | */ |
61 | 61 | function geodir_is_default_location_set() |
62 | 62 | { |
63 | - $default_location = geodir_get_default_location(); |
|
64 | - if (!empty($default_location)) |
|
65 | - return true; |
|
66 | - else |
|
67 | - return false; |
|
63 | + $default_location = geodir_get_default_location(); |
|
64 | + if (!empty($default_location)) |
|
65 | + return true; |
|
66 | + else |
|
67 | + return false; |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
@@ -78,15 +78,15 @@ discard block |
||
78 | 78 | function create_location_slug($location_string) |
79 | 79 | { |
80 | 80 | |
81 | - /** |
|
82 | - * Filter the location slug. |
|
83 | - * |
|
84 | - * @since 1.0.0 |
|
85 | - * @package GeoDirectory |
|
86 | - * |
|
87 | - * @param string $location_string Sanitized location string. |
|
88 | - */ |
|
89 | - return urldecode(apply_filters('geodir_location_slug_check', sanitize_title($location_string))); |
|
81 | + /** |
|
82 | + * Filter the location slug. |
|
83 | + * |
|
84 | + * @since 1.0.0 |
|
85 | + * @package GeoDirectory |
|
86 | + * |
|
87 | + * @param string $location_string Sanitized location string. |
|
88 | + */ |
|
89 | + return urldecode(apply_filters('geodir_location_slug_check', sanitize_title($location_string))); |
|
90 | 90 | |
91 | 91 | } |
92 | 92 | |
@@ -100,15 +100,15 @@ discard block |
||
100 | 100 | */ |
101 | 101 | function geodir_get_location($id = '') |
102 | 102 | { |
103 | - /** |
|
104 | - * Filter the location information. |
|
105 | - * |
|
106 | - * @since 1.0.0 |
|
107 | - * @package GeoDirectory |
|
108 | - * |
|
109 | - * @param string $id The location ID. |
|
110 | - */ |
|
111 | - return $location_result = apply_filters('geodir_get_location_by_id', get_option('geodir_default_location'), $id); |
|
103 | + /** |
|
104 | + * Filter the location information. |
|
105 | + * |
|
106 | + * @since 1.0.0 |
|
107 | + * @package GeoDirectory |
|
108 | + * |
|
109 | + * @param string $id The location ID. |
|
110 | + */ |
|
111 | + return $location_result = apply_filters('geodir_get_location_by_id', get_option('geodir_default_location'), $id); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
@@ -122,28 +122,28 @@ discard block |
||
122 | 122 | */ |
123 | 123 | function geodir_get_country_dl($post_country = '', $prefix = '') |
124 | 124 | { |
125 | - global $wpdb; |
|
125 | + global $wpdb; |
|
126 | 126 | |
127 | - $rows = $wpdb->get_results("SELECT Country,ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " ORDER BY Country ASC"); |
|
127 | + $rows = $wpdb->get_results("SELECT Country,ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " ORDER BY Country ASC"); |
|
128 | 128 | |
129 | - $ISO2 = array(); |
|
130 | - $countries = array(); |
|
129 | + $ISO2 = array(); |
|
130 | + $countries = array(); |
|
131 | 131 | |
132 | - foreach ($rows as $row) { |
|
133 | - $ISO2[$row->Country] = $row->ISO2; |
|
134 | - $countries[$row->Country] = __($row->Country, 'geodirectory'); |
|
135 | - } |
|
132 | + foreach ($rows as $row) { |
|
133 | + $ISO2[$row->Country] = $row->ISO2; |
|
134 | + $countries[$row->Country] = __($row->Country, 'geodirectory'); |
|
135 | + } |
|
136 | 136 | |
137 | - asort($countries); |
|
137 | + asort($countries); |
|
138 | 138 | |
139 | - $out_put = '<option ' . selected('', $post_country, false) . ' value="">' . __('Select Country', 'geodirectory') . '</option>'; |
|
140 | - foreach ($countries as $country => $name) { |
|
141 | - $ccode = $ISO2[$country]; |
|
139 | + $out_put = '<option ' . selected('', $post_country, false) . ' value="">' . __('Select Country', 'geodirectory') . '</option>'; |
|
140 | + foreach ($countries as $country => $name) { |
|
141 | + $ccode = $ISO2[$country]; |
|
142 | 142 | |
143 | - $out_put .= '<option ' . selected($post_country, $country, false) . ' value="' . esc_attr($country) . '" data-country_code="' . $ccode . '">' . $name . '</option>'; |
|
144 | - } |
|
143 | + $out_put .= '<option ' . selected($post_country, $country, false) . ' value="' . esc_attr($country) . '" data-country_code="' . $ccode . '">' . $name . '</option>'; |
|
144 | + } |
|
145 | 145 | |
146 | - echo $out_put; |
|
146 | + echo $out_put; |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | |
@@ -158,40 +158,40 @@ discard block |
||
158 | 158 | function geodir_location_form_submit() |
159 | 159 | { |
160 | 160 | |
161 | - global $wpdb, $plugin_prefix; |
|
162 | - if (isset($_REQUEST['add_location'])) { |
|
161 | + global $wpdb, $plugin_prefix; |
|
162 | + if (isset($_REQUEST['add_location'])) { |
|
163 | 163 | |
164 | - $location_info = array( |
|
165 | - 'city' => $_REQUEST['city'], |
|
166 | - 'region' => $_REQUEST['region'], |
|
167 | - 'country' => $_REQUEST['country'], |
|
168 | - 'geo_lat' => $_REQUEST['latitude'], |
|
169 | - 'geo_lng' => $_REQUEST['longitude'], |
|
170 | - 'is_default' => $_REQUEST['is_default'], |
|
171 | - 'update_city' => $_REQUEST['update_city'] |
|
172 | - ); |
|
164 | + $location_info = array( |
|
165 | + 'city' => $_REQUEST['city'], |
|
166 | + 'region' => $_REQUEST['region'], |
|
167 | + 'country' => $_REQUEST['country'], |
|
168 | + 'geo_lat' => $_REQUEST['latitude'], |
|
169 | + 'geo_lng' => $_REQUEST['longitude'], |
|
170 | + 'is_default' => $_REQUEST['is_default'], |
|
171 | + 'update_city' => $_REQUEST['update_city'] |
|
172 | + ); |
|
173 | 173 | |
174 | - $old_location = geodir_get_default_location(); |
|
174 | + $old_location = geodir_get_default_location(); |
|
175 | 175 | |
176 | - $locationid = geodir_add_new_location($location_info); |
|
176 | + $locationid = geodir_add_new_location($location_info); |
|
177 | 177 | |
178 | - $default_location = geodir_get_location($locationid); |
|
178 | + $default_location = geodir_get_location($locationid); |
|
179 | 179 | |
180 | - //UPDATE AND DELETE LISTING |
|
181 | - $posttype = geodir_get_posttypes(); |
|
182 | - if (isset($_REQUEST['listing_action']) && $_REQUEST['listing_action'] == 'delete') { |
|
180 | + //UPDATE AND DELETE LISTING |
|
181 | + $posttype = geodir_get_posttypes(); |
|
182 | + if (isset($_REQUEST['listing_action']) && $_REQUEST['listing_action'] == 'delete') { |
|
183 | 183 | |
184 | - foreach ($posttype as $posttypeobj) { |
|
185 | - $post_locations = '[' . $default_location->city_slug . '],[' . $default_location->region_slug . '],[' . $default_location->country_slug . ']'; // set all overall post location |
|
184 | + foreach ($posttype as $posttypeobj) { |
|
185 | + $post_locations = '[' . $default_location->city_slug . '],[' . $default_location->region_slug . '],[' . $default_location->country_slug . ']'; // set all overall post location |
|
186 | 186 | |
187 | - $sql = $wpdb->prepare( |
|
188 | - "UPDATE " . $plugin_prefix . $posttypeobj . "_detail SET post_city=%s, post_region=%s, post_country=%s, post_locations=%s WHERE post_location_id=%d AND ( post_city!=%s OR post_region!=%s OR post_country!=%s OR post_locations!=%s OR post_locations IS NULL)", |
|
189 | - array($_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations, $locationid, $_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations) |
|
190 | - ); |
|
191 | - $wpdb->query($sql); |
|
192 | - } |
|
193 | - } |
|
194 | - } |
|
187 | + $sql = $wpdb->prepare( |
|
188 | + "UPDATE " . $plugin_prefix . $posttypeobj . "_detail SET post_city=%s, post_region=%s, post_country=%s, post_locations=%s WHERE post_location_id=%d AND ( post_city!=%s OR post_region!=%s OR post_country!=%s OR post_locations!=%s OR post_locations IS NULL)", |
|
189 | + array($_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations, $locationid, $_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations) |
|
190 | + ); |
|
191 | + $wpdb->query($sql); |
|
192 | + } |
|
193 | + } |
|
194 | + } |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | /** |
@@ -215,37 +215,37 @@ discard block |
||
215 | 215 | */ |
216 | 216 | function geodir_add_new_location($location_info = array()) |
217 | 217 | { |
218 | - global $wpdb; |
|
219 | - |
|
220 | - if (!empty($location_info)) { |
|
221 | - $location_city = ($location_info['city'] != '') ? $location_info['city'] : 'all'; |
|
222 | - $location_region = ($location_info['region'] != '') ? $location_info['region'] : 'all'; |
|
223 | - $location_country = ($location_info['country'] != '') ? geodir_get_normal_country($location_info['country']) : 'all'; |
|
224 | - $location_lat = ($location_info['geo_lat'] != '') ? $location_info['geo_lat'] : ''; |
|
225 | - $location_lng = ($location_info['geo_lng'] != '') ? $location_info['geo_lng'] : ''; |
|
226 | - $is_default = isset($location_info['is_default']) ? $location_info['is_default'] : ''; |
|
227 | - $country_slug = create_location_slug(__($location_country, 'geodirectory')); |
|
228 | - $region_slug = create_location_slug($location_region); |
|
229 | - $city_slug = create_location_slug($location_city); |
|
218 | + global $wpdb; |
|
219 | + |
|
220 | + if (!empty($location_info)) { |
|
221 | + $location_city = ($location_info['city'] != '') ? $location_info['city'] : 'all'; |
|
222 | + $location_region = ($location_info['region'] != '') ? $location_info['region'] : 'all'; |
|
223 | + $location_country = ($location_info['country'] != '') ? geodir_get_normal_country($location_info['country']) : 'all'; |
|
224 | + $location_lat = ($location_info['geo_lat'] != '') ? $location_info['geo_lat'] : ''; |
|
225 | + $location_lng = ($location_info['geo_lng'] != '') ? $location_info['geo_lng'] : ''; |
|
226 | + $is_default = isset($location_info['is_default']) ? $location_info['is_default'] : ''; |
|
227 | + $country_slug = create_location_slug(__($location_country, 'geodirectory')); |
|
228 | + $region_slug = create_location_slug($location_region); |
|
229 | + $city_slug = create_location_slug($location_city); |
|
230 | 230 | |
231 | - /** |
|
232 | - * Filter add new location data. |
|
233 | - * |
|
234 | - * @since 1.0.0 |
|
235 | - */ |
|
236 | - $geodir_location = (object)apply_filters('geodir_add_new_location', array('location_id' => 0, |
|
237 | - 'country' => $location_country, |
|
238 | - 'region' => $location_region, |
|
239 | - 'city' => $location_city, |
|
240 | - 'country_slug' => $country_slug, |
|
241 | - 'region_slug' => $region_slug, |
|
242 | - 'city_slug' => $city_slug, |
|
243 | - 'city_latitude' => $location_lat, |
|
244 | - 'city_longitude' => $location_lng, |
|
245 | - 'is_default' => $is_default |
|
246 | - )); |
|
247 | - |
|
248 | - /* // Not allowed to create country in DB : 2016-12-09 |
|
231 | + /** |
|
232 | + * Filter add new location data. |
|
233 | + * |
|
234 | + * @since 1.0.0 |
|
235 | + */ |
|
236 | + $geodir_location = (object)apply_filters('geodir_add_new_location', array('location_id' => 0, |
|
237 | + 'country' => $location_country, |
|
238 | + 'region' => $location_region, |
|
239 | + 'city' => $location_city, |
|
240 | + 'country_slug' => $country_slug, |
|
241 | + 'region_slug' => $region_slug, |
|
242 | + 'city_slug' => $city_slug, |
|
243 | + 'city_latitude' => $location_lat, |
|
244 | + 'city_longitude' => $location_lng, |
|
245 | + 'is_default' => $is_default |
|
246 | + )); |
|
247 | + |
|
248 | + /* // Not allowed to create country in DB : 2016-12-09 |
|
249 | 249 | if ($geodir_location->country) { |
250 | 250 | |
251 | 251 | $get_country = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country=%s", array($geodir_location->country))); |
@@ -259,14 +259,14 @@ discard block |
||
259 | 259 | } |
260 | 260 | */ |
261 | 261 | |
262 | - if ($geodir_location->is_default) |
|
263 | - update_option('geodir_default_location', $geodir_location); |
|
262 | + if ($geodir_location->is_default) |
|
263 | + update_option('geodir_default_location', $geodir_location); |
|
264 | 264 | |
265 | - return $geodir_location->location_id; |
|
265 | + return $geodir_location->location_id; |
|
266 | 266 | |
267 | - } else { |
|
268 | - return false; |
|
269 | - } |
|
267 | + } else { |
|
268 | + return false; |
|
269 | + } |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | /** |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | */ |
281 | 281 | function geodir_random_float($min = 0, $max = 1) |
282 | 282 | { |
283 | - return $min + mt_rand() / mt_getrandmax() * ($max - $min); |
|
283 | + return $min + mt_rand() / mt_getrandmax() * ($max - $min); |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | /** |
@@ -294,22 +294,22 @@ discard block |
||
294 | 294 | */ |
295 | 295 | function geodir_get_address_by_lat_lan($lat, $lng) |
296 | 296 | { |
297 | - $url = 'https://maps.googleapis.com/maps/api/geocode/json?latlng=' . trim($lat) . ',' . trim($lng) ; |
|
298 | - |
|
299 | - $ch = curl_init(); |
|
300 | - curl_setopt($ch, CURLOPT_URL, $url); |
|
301 | - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
|
302 | - curl_setopt($ch, CURLOPT_PROXYPORT, 3128); |
|
303 | - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); |
|
304 | - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); |
|
305 | - $response = curl_exec($ch); |
|
306 | - curl_close($ch); |
|
307 | - $data = json_decode($response); |
|
308 | - $status = $data->status; |
|
309 | - if ($status == "OK") { |
|
310 | - return $data->results[0]->address_components; |
|
311 | - } else |
|
312 | - return false; |
|
297 | + $url = 'https://maps.googleapis.com/maps/api/geocode/json?latlng=' . trim($lat) . ',' . trim($lng) ; |
|
298 | + |
|
299 | + $ch = curl_init(); |
|
300 | + curl_setopt($ch, CURLOPT_URL, $url); |
|
301 | + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
|
302 | + curl_setopt($ch, CURLOPT_PROXYPORT, 3128); |
|
303 | + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); |
|
304 | + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); |
|
305 | + $response = curl_exec($ch); |
|
306 | + curl_close($ch); |
|
307 | + $data = json_decode($response); |
|
308 | + $status = $data->status; |
|
309 | + if ($status == "OK") { |
|
310 | + return $data->results[0]->address_components; |
|
311 | + } else |
|
312 | + return false; |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | /** |
@@ -326,71 +326,71 @@ discard block |
||
326 | 326 | */ |
327 | 327 | function geodir_get_current_location_terms($location_array_from = 'session', $gd_post_type = '') |
328 | 328 | { |
329 | - global $wp, $gd_session; |
|
330 | - $location_array = array(); |
|
331 | - if ($location_array_from == 'session') { |
|
332 | - if ($gd_session->get('gd_country') == 'me' || $gd_session->get('gd_region') == 'me' || $gd_session->get('gd_city') == 'me') { |
|
333 | - return $location_array; |
|
334 | - } |
|
329 | + global $wp, $gd_session; |
|
330 | + $location_array = array(); |
|
331 | + if ($location_array_from == 'session') { |
|
332 | + if ($gd_session->get('gd_country') == 'me' || $gd_session->get('gd_region') == 'me' || $gd_session->get('gd_city') == 'me') { |
|
333 | + return $location_array; |
|
334 | + } |
|
335 | 335 | |
336 | - $country = isset($_REQUEST['gd_country']) ? $_REQUEST['gd_country'] : $gd_session->get('gd_country'); |
|
337 | - if ($country != '' && $country) |
|
338 | - $location_array['gd_country'] = urldecode($country); |
|
336 | + $country = isset($_REQUEST['gd_country']) ? $_REQUEST['gd_country'] : $gd_session->get('gd_country'); |
|
337 | + if ($country != '' && $country) |
|
338 | + $location_array['gd_country'] = urldecode($country); |
|
339 | 339 | |
340 | - $region = isset($_REQUEST['gd_region']) ? $_REQUEST['gd_region'] : $gd_session->get('gd_region'); |
|
341 | - if ($region != '' && $region) |
|
342 | - $location_array['gd_region'] = urldecode($region); |
|
340 | + $region = isset($_REQUEST['gd_region']) ? $_REQUEST['gd_region'] : $gd_session->get('gd_region'); |
|
341 | + if ($region != '' && $region) |
|
342 | + $location_array['gd_region'] = urldecode($region); |
|
343 | 343 | |
344 | - $city = isset($_REQUEST['gd_city']) ? $_REQUEST['gd_city'] : $gd_session->get('gd_city'); |
|
345 | - if ($city != '' && $city) |
|
346 | - $location_array['gd_city'] = urldecode($city); |
|
347 | - } else { |
|
348 | - if ((isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] == 'me') || (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] == 'me') || (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] == 'me')) { |
|
349 | - return $location_array; |
|
350 | - } |
|
344 | + $city = isset($_REQUEST['gd_city']) ? $_REQUEST['gd_city'] : $gd_session->get('gd_city'); |
|
345 | + if ($city != '' && $city) |
|
346 | + $location_array['gd_city'] = urldecode($city); |
|
347 | + } else { |
|
348 | + if ((isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] == 'me') || (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] == 'me') || (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] == 'me')) { |
|
349 | + return $location_array; |
|
350 | + } |
|
351 | 351 | |
352 | - $country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : ''; |
|
352 | + $country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : ''; |
|
353 | 353 | |
354 | - $region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : ''; |
|
354 | + $region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : ''; |
|
355 | 355 | |
356 | - $city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : ''; |
|
356 | + $city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : ''; |
|
357 | 357 | |
358 | - if ($country != '') |
|
359 | - $location_array['gd_country'] = urldecode($country); |
|
358 | + if ($country != '') |
|
359 | + $location_array['gd_country'] = urldecode($country); |
|
360 | 360 | |
361 | - if ($region != '') |
|
362 | - $location_array['gd_region'] = urldecode($region); |
|
361 | + if ($region != '') |
|
362 | + $location_array['gd_region'] = urldecode($region); |
|
363 | 363 | |
364 | - if ($city != '') |
|
365 | - $location_array['gd_city'] = urldecode($city); |
|
364 | + if ($city != '') |
|
365 | + $location_array['gd_city'] = urldecode($city); |
|
366 | 366 | |
367 | 367 | // Fix category link in ajax popular category widget on change post type |
368 | 368 | if (empty($location_array) && defined('DOING_AJAX') && DOING_AJAX) { |
369 | 369 | $location_array = geodir_get_current_location_terms('session'); |
370 | 370 | } |
371 | - } |
|
371 | + } |
|
372 | 372 | |
373 | 373 | |
374 | 374 | /** |
375 | 375 | * Filter the location terms. |
376 | 376 | * |
377 | 377 | * @since 1.4.6 |
378 | - * @package GeoDirectory |
|
378 | + * @package GeoDirectory |
|
379 | + * |
|
380 | + * @param array $location_array { |
|
381 | + * Attributes of the location_array. |
|
382 | + * |
|
383 | + * @type string $gd_country The country slug. |
|
384 | + * @type string $gd_region The region slug. |
|
385 | + * @type string $gd_city The city slug. |
|
379 | 386 | * |
380 | - * @param array $location_array { |
|
381 | - * Attributes of the location_array. |
|
382 | - * |
|
383 | - * @type string $gd_country The country slug. |
|
384 | - * @type string $gd_region The region slug. |
|
385 | - * @type string $gd_city The city slug. |
|
386 | - * |
|
387 | - * } |
|
387 | + * } |
|
388 | 388 | * @param string $location_array_from Source type of location terms. Default session. |
389 | 389 | * @param string $gd_post_type WP post type. |
390 | 390 | */ |
391 | 391 | $location_array = apply_filters( 'geodir_current_location_terms', $location_array, $location_array_from, $gd_post_type ); |
392 | 392 | |
393 | - return $location_array; |
|
393 | + return $location_array; |
|
394 | 394 | |
395 | 395 | } |
396 | 396 | |
@@ -403,24 +403,24 @@ discard block |
||
403 | 403 | * @return bool|string |
404 | 404 | */ |
405 | 405 | function geodir_get_location_link($which_location = 'current') { |
406 | - $location_link = get_permalink(geodir_location_page_id()); |
|
407 | - |
|
408 | - if ($which_location == 'base') { |
|
409 | - return $location_link; |
|
410 | - } else { |
|
411 | - $location_terms = geodir_get_current_location_terms(); |
|
412 | - |
|
413 | - if (!empty($location_terms)) { |
|
414 | - if (get_option('permalink_structure') != '') { |
|
415 | - $location_terms = implode("/", $location_terms); |
|
416 | - $location_terms = rtrim($location_terms, '/'); |
|
417 | - $location_link .= $location_terms; |
|
418 | - } else { |
|
419 | - $location_link = geodir_getlink($location_link, $location_terms); |
|
420 | - } |
|
421 | - } |
|
422 | - } |
|
423 | - return $location_link; |
|
406 | + $location_link = get_permalink(geodir_location_page_id()); |
|
407 | + |
|
408 | + if ($which_location == 'base') { |
|
409 | + return $location_link; |
|
410 | + } else { |
|
411 | + $location_terms = geodir_get_current_location_terms(); |
|
412 | + |
|
413 | + if (!empty($location_terms)) { |
|
414 | + if (get_option('permalink_structure') != '') { |
|
415 | + $location_terms = implode("/", $location_terms); |
|
416 | + $location_terms = rtrim($location_terms, '/'); |
|
417 | + $location_link .= $location_terms; |
|
418 | + } else { |
|
419 | + $location_link = geodir_getlink($location_link, $location_terms); |
|
420 | + } |
|
421 | + } |
|
422 | + } |
|
423 | + return $location_link; |
|
424 | 424 | } |
425 | 425 | |
426 | 426 | /** |
@@ -433,34 +433,34 @@ discard block |
||
433 | 433 | * @return array|bool Returns address on success. |
434 | 434 | */ |
435 | 435 | function geodir_get_osm_address_by_lat_lan($lat, $lng) { |
436 | - $url = is_ssl() ? 'https:' : 'http:'; |
|
437 | - $url .= '//nominatim.openstreetmap.org/reverse?format=json&lat=' . trim($lat) . '&lon=' . trim($lng) . '&zoom=16&addressdetails=1&email=' . get_option('admin_email'); |
|
438 | - |
|
439 | - $ch = curl_init(); |
|
440 | - curl_setopt($ch, CURLOPT_URL, $url); |
|
441 | - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
|
442 | - curl_setopt($ch, CURLOPT_PROXYPORT, 3128); |
|
443 | - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); |
|
444 | - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); |
|
445 | - $response = curl_exec($ch); |
|
446 | - curl_close($ch); |
|
447 | - $data = json_decode($response); |
|
436 | + $url = is_ssl() ? 'https:' : 'http:'; |
|
437 | + $url .= '//nominatim.openstreetmap.org/reverse?format=json&lat=' . trim($lat) . '&lon=' . trim($lng) . '&zoom=16&addressdetails=1&email=' . get_option('admin_email'); |
|
438 | + |
|
439 | + $ch = curl_init(); |
|
440 | + curl_setopt($ch, CURLOPT_URL, $url); |
|
441 | + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
|
442 | + curl_setopt($ch, CURLOPT_PROXYPORT, 3128); |
|
443 | + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); |
|
444 | + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); |
|
445 | + $response = curl_exec($ch); |
|
446 | + curl_close($ch); |
|
447 | + $data = json_decode($response); |
|
448 | 448 | |
449 | - if (!empty($data) && !empty($data->address)) { |
|
450 | - $address_fields = array('public_building', 'house', 'house_number', 'bakery', 'footway', 'street', 'road', 'village', 'attraction', 'pedestrian', 'neighbourhood', 'suburb'); |
|
451 | - $formatted_address = (array)$data->address; |
|
449 | + if (!empty($data) && !empty($data->address)) { |
|
450 | + $address_fields = array('public_building', 'house', 'house_number', 'bakery', 'footway', 'street', 'road', 'village', 'attraction', 'pedestrian', 'neighbourhood', 'suburb'); |
|
451 | + $formatted_address = (array)$data->address; |
|
452 | 452 | |
453 | - foreach ( $data->address as $key => $value ) { |
|
454 | - if (!in_array($key, $address_fields)) { |
|
455 | - unset($formatted_address[$key]); |
|
456 | - } |
|
457 | - } |
|
458 | - $data->formatted_address = !empty($formatted_address) ? implode(', ', $formatted_address) : ''; |
|
453 | + foreach ( $data->address as $key => $value ) { |
|
454 | + if (!in_array($key, $address_fields)) { |
|
455 | + unset($formatted_address[$key]); |
|
456 | + } |
|
457 | + } |
|
458 | + $data->formatted_address = !empty($formatted_address) ? implode(', ', $formatted_address) : ''; |
|
459 | 459 | |
460 | - return $data; |
|
461 | - } else { |
|
462 | - return false; |
|
463 | - } |
|
460 | + return $data; |
|
461 | + } else { |
|
462 | + return false; |
|
463 | + } |
|
464 | 464 | } |
465 | 465 | |
466 | 466 | /** |
@@ -472,47 +472,47 @@ discard block |
||
472 | 472 | * @return string Returns the country. |
473 | 473 | */ |
474 | 474 | function geodir_get_normal_country($country) { |
475 | - global $wpdb; |
|
476 | - if ($result = geodir_get_country_by_name($country)) { |
|
477 | - return $result; |
|
478 | - } |
|
475 | + global $wpdb; |
|
476 | + if ($result = geodir_get_country_by_name($country)) { |
|
477 | + return $result; |
|
478 | + } |
|
479 | 479 | |
480 | - if (defined('POST_LOCATION_TABLE')) { |
|
481 | - $rows = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country NOT LIKE %s ORDER BY location_id ASC", $country)); |
|
482 | - if (!empty($rows)) { |
|
483 | - foreach ($rows as $row) { |
|
484 | - $translated = __($row->country, 'geodirectory'); |
|
485 | - if (geodir_strtolower($translated) == geodir_strtolower($country) && $result = geodir_get_country_by_name($row->country)) { |
|
486 | - return $result; |
|
487 | - } |
|
488 | - } |
|
489 | - } |
|
480 | + if (defined('POST_LOCATION_TABLE')) { |
|
481 | + $rows = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country NOT LIKE %s ORDER BY location_id ASC", $country)); |
|
482 | + if (!empty($rows)) { |
|
483 | + foreach ($rows as $row) { |
|
484 | + $translated = __($row->country, 'geodirectory'); |
|
485 | + if (geodir_strtolower($translated) == geodir_strtolower($country) && $result = geodir_get_country_by_name($row->country)) { |
|
486 | + return $result; |
|
487 | + } |
|
488 | + } |
|
489 | + } |
|
490 | 490 | |
491 | - $rows = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country_slug LIKE %s AND country NOT LIKE %s ORDER BY location_id", $country, $country ) ); |
|
492 | - if (!empty($rows)) { |
|
493 | - foreach ($rows as $row) { |
|
494 | - $translated = __($row->country, 'geodirectory'); |
|
495 | - if (geodir_strtolower($translated) == geodir_strtolower($country) && $result = geodir_get_country_by_name($row->country)) { |
|
496 | - return $result; |
|
497 | - } |
|
498 | - } |
|
499 | - } |
|
500 | - } |
|
491 | + $rows = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country_slug LIKE %s AND country NOT LIKE %s ORDER BY location_id", $country, $country ) ); |
|
492 | + if (!empty($rows)) { |
|
493 | + foreach ($rows as $row) { |
|
494 | + $translated = __($row->country, 'geodirectory'); |
|
495 | + if (geodir_strtolower($translated) == geodir_strtolower($country) && $result = geodir_get_country_by_name($row->country)) { |
|
496 | + return $result; |
|
497 | + } |
|
498 | + } |
|
499 | + } |
|
500 | + } |
|
501 | 501 | |
502 | - $default_location = geodir_get_default_location(); |
|
503 | - if (!empty($default_location->country) && $result = geodir_get_country_by_name($default_location->country)) { |
|
504 | - return $result; |
|
505 | - } |
|
502 | + $default_location = geodir_get_default_location(); |
|
503 | + if (!empty($default_location->country) && $result = geodir_get_country_by_name($default_location->country)) { |
|
504 | + return $result; |
|
505 | + } |
|
506 | 506 | |
507 | - if (!empty($default_location->country_slug) && $result = geodir_get_country_by_name($default_location->country_slug)) { |
|
508 | - return $result; |
|
509 | - } |
|
507 | + if (!empty($default_location->country_slug) && $result = geodir_get_country_by_name($default_location->country_slug)) { |
|
508 | + return $result; |
|
509 | + } |
|
510 | 510 | |
511 | - if (!empty($default_location->country_ISO2) && $result = geodir_get_country_by_name($default_location->country_ISO2, true)) { |
|
512 | - return $result; |
|
513 | - } |
|
511 | + if (!empty($default_location->country_ISO2) && $result = geodir_get_country_by_name($default_location->country_ISO2, true)) { |
|
512 | + return $result; |
|
513 | + } |
|
514 | 514 | |
515 | - return $country; |
|
515 | + return $country; |
|
516 | 516 | } |
517 | 517 | |
518 | 518 | /** |
@@ -524,16 +524,16 @@ discard block |
||
524 | 524 | * @return string Country ISO2 code. |
525 | 525 | */ |
526 | 526 | function geodir_get_country_iso2($country) { |
527 | - global $wpdb; |
|
527 | + global $wpdb; |
|
528 | 528 | |
529 | - if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) { |
|
530 | - return $result; |
|
531 | - } |
|
532 | - if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", geodir_get_normal_country($country)))) { |
|
533 | - return $result; |
|
534 | - } |
|
529 | + if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) { |
|
530 | + return $result; |
|
531 | + } |
|
532 | + if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", geodir_get_normal_country($country)))) { |
|
533 | + return $result; |
|
534 | + } |
|
535 | 535 | |
536 | - return $country; |
|
536 | + return $country; |
|
537 | 537 | } |
538 | 538 | |
539 | 539 | /** |
@@ -546,16 +546,16 @@ discard block |
||
546 | 546 | * @return string|null Country ISO2 code. |
547 | 547 | */ |
548 | 548 | function geodir_get_country_by_name($country, $iso2 = false) { |
549 | - global $wpdb; |
|
549 | + global $wpdb; |
|
550 | 550 | |
551 | - if ($result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) { |
|
552 | - return $result; |
|
553 | - } |
|
554 | - if ($iso2 && $result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE ISO2 LIKE %s", $country))) { |
|
555 | - return $result; |
|
556 | - } |
|
551 | + if ($result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) { |
|
552 | + return $result; |
|
553 | + } |
|
554 | + if ($iso2 && $result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE ISO2 LIKE %s", $country))) { |
|
555 | + return $result; |
|
556 | + } |
|
557 | 557 | |
558 | - return NULL; |
|
558 | + return NULL; |
|
559 | 559 | } |
560 | 560 | |
561 | 561 | |
@@ -575,130 +575,130 @@ discard block |
||
575 | 575 | */ |
576 | 576 | function geodir_replace_location_variables($content, $location_array = array(), $sep = NULL, $gd_page = '') { |
577 | 577 | |
578 | - if (empty($content)) { |
|
579 | - return $content; |
|
580 | - } |
|
578 | + if (empty($content)) { |
|
579 | + return $content; |
|
580 | + } |
|
581 | 581 | |
582 | 582 | |
583 | - $location_replace_vars = geodir_location_replace_vars($location_array, $sep, $gd_page); |
|
583 | + $location_replace_vars = geodir_location_replace_vars($location_array, $sep, $gd_page); |
|
584 | 584 | |
585 | - if (!empty($location_replace_vars)) { |
|
586 | - foreach ($location_replace_vars as $search => $replace) { |
|
587 | - if (!empty($search) && strpos($content, $search) !== false) { |
|
588 | - $content = str_replace($search, $replace, $content); |
|
589 | - } |
|
590 | - } |
|
591 | - } |
|
585 | + if (!empty($location_replace_vars)) { |
|
586 | + foreach ($location_replace_vars as $search => $replace) { |
|
587 | + if (!empty($search) && strpos($content, $search) !== false) { |
|
588 | + $content = str_replace($search, $replace, $content); |
|
589 | + } |
|
590 | + } |
|
591 | + } |
|
592 | 592 | |
593 | - return $content; |
|
593 | + return $content; |
|
594 | 594 | } |
595 | 595 | add_filter('geodir_replace_location_variables', 'geodir_replace_location_variables'); |
596 | 596 | |
597 | 597 | |
598 | 598 | function geodir_location_replace_vars($location_array = array(), $sep = NULL, $gd_page = ''){ |
599 | 599 | |
600 | - global $wp; |
|
600 | + global $wp; |
|
601 | 601 | |
602 | - $location_manager = defined('GEODIRLOCATION_VERSION') ? true : false; |
|
603 | - |
|
604 | - if (empty($location_array)) { |
|
605 | - $location_array = geodir_get_current_location_terms('query_vars'); |
|
606 | - } |
|
607 | - |
|
608 | - $location_terms = array(); |
|
609 | - $location_terms['gd_neighbourhood'] = !empty($wp->query_vars['gd_neighbourhood']) ? $wp->query_vars['gd_neighbourhood'] : ''; |
|
610 | - $location_terms['gd_city'] = !empty($wp->query_vars['gd_city']) ? $wp->query_vars['gd_city'] : ''; |
|
611 | - $location_terms['gd_region'] = !empty($wp->query_vars['gd_region']) ? $wp->query_vars['gd_region'] : ''; |
|
612 | - $location_terms['gd_country'] = !empty($wp->query_vars['gd_country']) ? $wp->query_vars['gd_country'] : ''; |
|
613 | - |
|
614 | - $location_names = array(); |
|
615 | - foreach ($location_terms as $type => $location) { |
|
616 | - $location_name = $location; |
|
617 | - |
|
618 | - if (!empty($location_name)) { |
|
619 | - if ($location_manager) { |
|
620 | - $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type; |
|
621 | - $location_name = get_actual_location_name($location_type, $location, true); |
|
622 | - } else { |
|
623 | - $location_name = preg_replace( '/-(\d+)$/', '', $location_name); |
|
624 | - $location_name = preg_replace( '/[_-]/', ' ', $location_name ); |
|
625 | - $location_name = __(geodir_ucwords($location_name), 'geodirectory'); |
|
626 | - } |
|
627 | - } |
|
602 | + $location_manager = defined('GEODIRLOCATION_VERSION') ? true : false; |
|
603 | + |
|
604 | + if (empty($location_array)) { |
|
605 | + $location_array = geodir_get_current_location_terms('query_vars'); |
|
606 | + } |
|
607 | + |
|
608 | + $location_terms = array(); |
|
609 | + $location_terms['gd_neighbourhood'] = !empty($wp->query_vars['gd_neighbourhood']) ? $wp->query_vars['gd_neighbourhood'] : ''; |
|
610 | + $location_terms['gd_city'] = !empty($wp->query_vars['gd_city']) ? $wp->query_vars['gd_city'] : ''; |
|
611 | + $location_terms['gd_region'] = !empty($wp->query_vars['gd_region']) ? $wp->query_vars['gd_region'] : ''; |
|
612 | + $location_terms['gd_country'] = !empty($wp->query_vars['gd_country']) ? $wp->query_vars['gd_country'] : ''; |
|
613 | + |
|
614 | + $location_names = array(); |
|
615 | + foreach ($location_terms as $type => $location) { |
|
616 | + $location_name = $location; |
|
617 | + |
|
618 | + if (!empty($location_name)) { |
|
619 | + if ($location_manager) { |
|
620 | + $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type; |
|
621 | + $location_name = get_actual_location_name($location_type, $location, true); |
|
622 | + } else { |
|
623 | + $location_name = preg_replace( '/-(\d+)$/', '', $location_name); |
|
624 | + $location_name = preg_replace( '/[_-]/', ' ', $location_name ); |
|
625 | + $location_name = __(geodir_ucwords($location_name), 'geodirectory'); |
|
626 | + } |
|
627 | + } |
|
628 | 628 | |
629 | - $location_names[$type] = $location_name; |
|
630 | - } |
|
631 | - |
|
632 | - $location_single = ''; |
|
633 | - foreach ($location_terms as $type => $location) { |
|
634 | - if (!empty($location)) { |
|
635 | - if (!empty($location_names[$type])) { |
|
636 | - $location_single = $location_names[$type]; |
|
637 | - } else { |
|
638 | - if ($location_manager) { |
|
639 | - $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type; |
|
640 | - $location_single = get_actual_location_name($location_type, $location, true); |
|
641 | - } else { |
|
642 | - $location_name = preg_replace( '/-(\d+)$/', '', $location); |
|
643 | - $location_name = preg_replace( '/[_-]/', ' ', $location_name ); |
|
644 | - $location_single = __(geodir_ucwords($location_name), 'geodirectory'); |
|
645 | - } |
|
646 | - } |
|
647 | - break; |
|
648 | - } |
|
649 | - } |
|
650 | - |
|
651 | - $full_location = array(); |
|
652 | - if (!empty($location_array)) { |
|
653 | - $location_array = array_reverse($location_array); |
|
654 | - |
|
655 | - foreach ($location_array as $type => $location) { |
|
656 | - if (!empty($location_names[$type])) { |
|
657 | - $location_name = $location_names[$type]; |
|
658 | - } else { |
|
659 | - if ($location_manager) { |
|
660 | - $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type; |
|
661 | - $location_name = get_actual_location_name($location_type, $location, true); |
|
662 | - } else { |
|
663 | - $location_name = preg_replace( '/-(\d+)$/', '', $location); |
|
664 | - $location_name = preg_replace( '/[_-]/', ' ', $location_name ); |
|
665 | - $location_name = __(geodir_ucwords($location_name), 'geodirectory'); |
|
666 | - } |
|
667 | - } |
|
629 | + $location_names[$type] = $location_name; |
|
630 | + } |
|
631 | + |
|
632 | + $location_single = ''; |
|
633 | + foreach ($location_terms as $type => $location) { |
|
634 | + if (!empty($location)) { |
|
635 | + if (!empty($location_names[$type])) { |
|
636 | + $location_single = $location_names[$type]; |
|
637 | + } else { |
|
638 | + if ($location_manager) { |
|
639 | + $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type; |
|
640 | + $location_single = get_actual_location_name($location_type, $location, true); |
|
641 | + } else { |
|
642 | + $location_name = preg_replace( '/-(\d+)$/', '', $location); |
|
643 | + $location_name = preg_replace( '/[_-]/', ' ', $location_name ); |
|
644 | + $location_single = __(geodir_ucwords($location_name), 'geodirectory'); |
|
645 | + } |
|
646 | + } |
|
647 | + break; |
|
648 | + } |
|
649 | + } |
|
650 | + |
|
651 | + $full_location = array(); |
|
652 | + if (!empty($location_array)) { |
|
653 | + $location_array = array_reverse($location_array); |
|
654 | + |
|
655 | + foreach ($location_array as $type => $location) { |
|
656 | + if (!empty($location_names[$type])) { |
|
657 | + $location_name = $location_names[$type]; |
|
658 | + } else { |
|
659 | + if ($location_manager) { |
|
660 | + $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type; |
|
661 | + $location_name = get_actual_location_name($location_type, $location, true); |
|
662 | + } else { |
|
663 | + $location_name = preg_replace( '/-(\d+)$/', '', $location); |
|
664 | + $location_name = preg_replace( '/[_-]/', ' ', $location_name ); |
|
665 | + $location_name = __(geodir_ucwords($location_name), 'geodirectory'); |
|
666 | + } |
|
667 | + } |
|
668 | + |
|
669 | + $full_location[] = $location_name; |
|
670 | + } |
|
668 | 671 | |
669 | - $full_location[] = $location_name; |
|
670 | - } |
|
672 | + if (!empty($full_location)) { |
|
673 | + $full_location = array_unique($full_location); |
|
674 | + } |
|
675 | + } |
|
676 | + $full_location = !empty($full_location) ? implode(', ', $full_location): ''; |
|
671 | 677 | |
672 | - if (!empty($full_location)) { |
|
673 | - $full_location = array_unique($full_location); |
|
674 | - } |
|
675 | - } |
|
676 | - $full_location = !empty($full_location) ? implode(', ', $full_location): ''; |
|
677 | - |
|
678 | - $location_replace_vars = array(); |
|
679 | - $location_replace_vars['%%location_sep%%'] = $sep !== NULL ? $sep : '|'; |
|
680 | - $location_replace_vars['%%location%%'] = $full_location; |
|
681 | - $location_replace_vars['%%in_location%%'] = $full_location != '' ? __( 'in', 'geodirectory' ) . ' ' . $full_location : ''; |
|
682 | - $location_replace_vars['%%location_single%%'] = $location_single; |
|
683 | - $location_replace_vars['%%in_location_single%%'] = $location_single != '' ? __( 'in', 'geodirectory' ) . ' ' . $location_single : ''; |
|
684 | - |
|
685 | - foreach ($location_names as $type => $name) { |
|
686 | - $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type; |
|
687 | - |
|
688 | - $location_replace_vars['%%location_' . $location_type . '%%'] = $name; |
|
689 | - $location_replace_vars['%%in_location_' . $location_type . '%%'] = !empty($name) ? __( 'in', 'geodirectory' ) . ' ' . $name : ''; |
|
690 | - } |
|
691 | - |
|
692 | - /** |
|
693 | - * Filter the location terms variables to search & replace. |
|
694 | - * |
|
695 | - * @since 1.6.16 |
|
696 | - * @package GeoDirectory |
|
697 | - * |
|
698 | - * @param array $location_replace_vars The array of search & replace variables. |
|
699 | - * @param array $location_array The array of location variables. |
|
700 | - * @param string $gd_page The page being filtered. |
|
701 | - * @param string $sep The separator. |
|
702 | - */ |
|
703 | - return apply_filters( 'geodir_filter_location_replace_variables', $location_replace_vars, $location_array, $gd_page, $sep ); |
|
678 | + $location_replace_vars = array(); |
|
679 | + $location_replace_vars['%%location_sep%%'] = $sep !== NULL ? $sep : '|'; |
|
680 | + $location_replace_vars['%%location%%'] = $full_location; |
|
681 | + $location_replace_vars['%%in_location%%'] = $full_location != '' ? __( 'in', 'geodirectory' ) . ' ' . $full_location : ''; |
|
682 | + $location_replace_vars['%%location_single%%'] = $location_single; |
|
683 | + $location_replace_vars['%%in_location_single%%'] = $location_single != '' ? __( 'in', 'geodirectory' ) . ' ' . $location_single : ''; |
|
684 | + |
|
685 | + foreach ($location_names as $type => $name) { |
|
686 | + $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type; |
|
687 | + |
|
688 | + $location_replace_vars['%%location_' . $location_type . '%%'] = $name; |
|
689 | + $location_replace_vars['%%in_location_' . $location_type . '%%'] = !empty($name) ? __( 'in', 'geodirectory' ) . ' ' . $name : ''; |
|
690 | + } |
|
691 | + |
|
692 | + /** |
|
693 | + * Filter the location terms variables to search & replace. |
|
694 | + * |
|
695 | + * @since 1.6.16 |
|
696 | + * @package GeoDirectory |
|
697 | + * |
|
698 | + * @param array $location_replace_vars The array of search & replace variables. |
|
699 | + * @param array $location_array The array of location variables. |
|
700 | + * @param string $gd_page The page being filtered. |
|
701 | + * @param string $sep The separator. |
|
702 | + */ |
|
703 | + return apply_filters( 'geodir_filter_location_replace_variables', $location_replace_vars, $location_array, $gd_page, $sep ); |
|
704 | 704 | } |
705 | 705 | \ No newline at end of file |
@@ -61,11 +61,12 @@ discard block |
||
61 | 61 | function geodir_is_default_location_set() |
62 | 62 | { |
63 | 63 | $default_location = geodir_get_default_location(); |
64 | - if (!empty($default_location)) |
|
65 | - return true; |
|
66 | - else |
|
67 | - return false; |
|
68 | -} |
|
64 | + if (!empty($default_location)) { |
|
65 | + return true; |
|
66 | + } else { |
|
67 | + return false; |
|
68 | + } |
|
69 | + } |
|
69 | 70 | |
70 | 71 | /** |
71 | 72 | * Returns location slug using location string. |
@@ -259,8 +260,9 @@ discard block |
||
259 | 260 | } |
260 | 261 | */ |
261 | 262 | |
262 | - if ($geodir_location->is_default) |
|
263 | - update_option('geodir_default_location', $geodir_location); |
|
263 | + if ($geodir_location->is_default) { |
|
264 | + update_option('geodir_default_location', $geodir_location); |
|
265 | + } |
|
264 | 266 | |
265 | 267 | return $geodir_location->location_id; |
266 | 268 | |
@@ -308,9 +310,10 @@ discard block |
||
308 | 310 | $status = $data->status; |
309 | 311 | if ($status == "OK") { |
310 | 312 | return $data->results[0]->address_components; |
311 | - } else |
|
312 | - return false; |
|
313 | -} |
|
313 | + } else { |
|
314 | + return false; |
|
315 | + } |
|
316 | + } |
|
314 | 317 | |
315 | 318 | /** |
316 | 319 | * Returns current location terms. |
@@ -334,16 +337,19 @@ discard block |
||
334 | 337 | } |
335 | 338 | |
336 | 339 | $country = isset($_REQUEST['gd_country']) ? $_REQUEST['gd_country'] : $gd_session->get('gd_country'); |
337 | - if ($country != '' && $country) |
|
338 | - $location_array['gd_country'] = urldecode($country); |
|
340 | + if ($country != '' && $country) { |
|
341 | + $location_array['gd_country'] = urldecode($country); |
|
342 | + } |
|
339 | 343 | |
340 | 344 | $region = isset($_REQUEST['gd_region']) ? $_REQUEST['gd_region'] : $gd_session->get('gd_region'); |
341 | - if ($region != '' && $region) |
|
342 | - $location_array['gd_region'] = urldecode($region); |
|
345 | + if ($region != '' && $region) { |
|
346 | + $location_array['gd_region'] = urldecode($region); |
|
347 | + } |
|
343 | 348 | |
344 | 349 | $city = isset($_REQUEST['gd_city']) ? $_REQUEST['gd_city'] : $gd_session->get('gd_city'); |
345 | - if ($city != '' && $city) |
|
346 | - $location_array['gd_city'] = urldecode($city); |
|
350 | + if ($city != '' && $city) { |
|
351 | + $location_array['gd_city'] = urldecode($city); |
|
352 | + } |
|
347 | 353 | } else { |
348 | 354 | if ((isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] == 'me') || (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] == 'me') || (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] == 'me')) { |
349 | 355 | return $location_array; |
@@ -355,14 +361,17 @@ discard block |
||
355 | 361 | |
356 | 362 | $city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : ''; |
357 | 363 | |
358 | - if ($country != '') |
|
359 | - $location_array['gd_country'] = urldecode($country); |
|
364 | + if ($country != '') { |
|
365 | + $location_array['gd_country'] = urldecode($country); |
|
366 | + } |
|
360 | 367 | |
361 | - if ($region != '') |
|
362 | - $location_array['gd_region'] = urldecode($region); |
|
368 | + if ($region != '') { |
|
369 | + $location_array['gd_region'] = urldecode($region); |
|
370 | + } |
|
363 | 371 | |
364 | - if ($city != '') |
|
365 | - $location_array['gd_city'] = urldecode($city); |
|
372 | + if ($city != '') { |
|
373 | + $location_array['gd_city'] = urldecode($city); |
|
374 | + } |
|
366 | 375 | |
367 | 376 | // Fix category link in ajax popular category widget on change post type |
368 | 377 | if (empty($location_array) && defined('DOING_AJAX') && DOING_AJAX) { |
@@ -7,61 +7,61 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'homemap_catlist') { |
10 | - global $gd_session; |
|
11 | - $gd_post_type = sanitize_text_field($_REQUEST['post_type']); |
|
12 | - $gd_session->set('homemap_catlist_ptype', $gd_post_type); |
|
13 | - $post_taxonomy = geodir_get_taxonomies($gd_post_type); |
|
14 | - $map_canvas_name = sanitize_text_field($_REQUEST['map_canvas']); |
|
15 | - $child_collapse = (bool)$_REQUEST['child_collapse']; |
|
16 | - echo home_map_taxonomy_walker($post_taxonomy, 0, true, 0, $map_canvas_name, $child_collapse, true); |
|
17 | - die; |
|
10 | + global $gd_session; |
|
11 | + $gd_post_type = sanitize_text_field($_REQUEST['post_type']); |
|
12 | + $gd_session->set('homemap_catlist_ptype', $gd_post_type); |
|
13 | + $post_taxonomy = geodir_get_taxonomies($gd_post_type); |
|
14 | + $map_canvas_name = sanitize_text_field($_REQUEST['map_canvas']); |
|
15 | + $child_collapse = (bool)$_REQUEST['child_collapse']; |
|
16 | + echo home_map_taxonomy_walker($post_taxonomy, 0, true, 0, $map_canvas_name, $child_collapse, true); |
|
17 | + die; |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | // Send the content-type header with correct encoding |
21 | 21 | header("Content-type: text/javascript; charset=utf-8"); |
22 | 22 | |
23 | 23 | if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'cat') { // Retrives markers data for categories |
24 | - echo get_markers(); |
|
25 | - exit; |
|
24 | + echo get_markers(); |
|
25 | + exit; |
|
26 | 26 | } else if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'info') { // Retrives marker info window html |
27 | - /** |
|
28 | - * @global object $wpdb WordPress Database object. |
|
29 | - * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
30 | - * @global object $gd_session GeoDirectory Session object. |
|
31 | - */ |
|
32 | - global $wpdb, $plugin_prefix, $gd_session; |
|
33 | - |
|
34 | - if ($_REQUEST['m_id'] != '') { |
|
35 | - $pid = (int)$_REQUEST['m_id']; |
|
36 | - } else { |
|
37 | - echo __('No marker data found', 'geodirectory'); |
|
38 | - exit; |
|
39 | - } |
|
40 | - |
|
41 | - if (isset($_REQUEST['post_preview']) && $_REQUEST['post_preview'] != '' && $gd_ses_listing = $gd_session->get('listing')) { |
|
42 | - $post = (object)$gd_ses_listing; |
|
43 | - echo geodir_get_infowindow_html($post, $_REQUEST['post_preview']); |
|
44 | - } else { |
|
45 | - $geodir_post_type = get_post_type($pid); |
|
46 | - |
|
47 | - $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
48 | - |
|
49 | - $sql = $wpdb->prepare("SELECT * FROM " . $table . " WHERE post_id = %d", array($pid)); |
|
50 | - |
|
51 | - $postinfo = $wpdb->get_results($sql); |
|
52 | - |
|
53 | - $data_arr = array(); |
|
54 | - |
|
55 | - if ($postinfo) { |
|
56 | - $srcharr = array("'", "/", "-", '"', '\\'); |
|
57 | - $replarr = array("′", "⁄", "–", "“", ''); |
|
58 | - |
|
59 | - foreach ($postinfo as $postinfo_obj) { |
|
60 | - echo geodir_get_infowindow_html($postinfo_obj); |
|
61 | - } |
|
62 | - } |
|
63 | - } |
|
64 | - exit; |
|
27 | + /** |
|
28 | + * @global object $wpdb WordPress Database object. |
|
29 | + * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
30 | + * @global object $gd_session GeoDirectory Session object. |
|
31 | + */ |
|
32 | + global $wpdb, $plugin_prefix, $gd_session; |
|
33 | + |
|
34 | + if ($_REQUEST['m_id'] != '') { |
|
35 | + $pid = (int)$_REQUEST['m_id']; |
|
36 | + } else { |
|
37 | + echo __('No marker data found', 'geodirectory'); |
|
38 | + exit; |
|
39 | + } |
|
40 | + |
|
41 | + if (isset($_REQUEST['post_preview']) && $_REQUEST['post_preview'] != '' && $gd_ses_listing = $gd_session->get('listing')) { |
|
42 | + $post = (object)$gd_ses_listing; |
|
43 | + echo geodir_get_infowindow_html($post, $_REQUEST['post_preview']); |
|
44 | + } else { |
|
45 | + $geodir_post_type = get_post_type($pid); |
|
46 | + |
|
47 | + $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
48 | + |
|
49 | + $sql = $wpdb->prepare("SELECT * FROM " . $table . " WHERE post_id = %d", array($pid)); |
|
50 | + |
|
51 | + $postinfo = $wpdb->get_results($sql); |
|
52 | + |
|
53 | + $data_arr = array(); |
|
54 | + |
|
55 | + if ($postinfo) { |
|
56 | + $srcharr = array("'", "/", "-", '"', '\\'); |
|
57 | + $replarr = array("′", "⁄", "–", "“", ''); |
|
58 | + |
|
59 | + foreach ($postinfo as $postinfo_obj) { |
|
60 | + echo geodir_get_infowindow_html($postinfo_obj); |
|
61 | + } |
|
62 | + } |
|
63 | + } |
|
64 | + exit; |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
@@ -80,82 +80,82 @@ discard block |
||
80 | 80 | */ |
81 | 81 | function get_markers() { |
82 | 82 | |
83 | - //echo '[{"totalcount":"10","id":"6059","t": "18335","lt": "52.7139785767","ln": "-1.69130477431","mk_id":"6059_104","i":"https://www.truckepedia.com/wp-content/uploads/2017/01/general-haulage.png","w":"43","h":"51","cs":"18335_55.650954_-4.681534_50.529296_1.109871"},{"id":"24114","t": "2652","lt": "51.6379485035","ln": "0.599360766384","mk_id":"24114_104","i":"https://www.truckepedia.com/wp-content/uploads/2017/01/general-haulage.png","w":"43","h":"51","cs":"2652_53.960419_-0.48788_50.770208_1.759608"},{"id":"24119","t": "808","lt": "50.8208508417","ln": "-4.30273646592","mk_id":"24119_104","i":"https://www.truckepedia.com/wp-content/uploads/2017/01/general-haulage.png","w":"43","h":"51","cs":"808_54.757832_-5.683993_50.021626_-3.237784"},{"id":"6057","t": "2271","lt": "55.9425655051","ln": "-3.83133282962","mk_id":"6057_104","i":"https://www.truckepedia.com/wp-content/uploads/2017/01/general-haulage.png","w":"43","h":"51","cs":"2271_58.579678_-6.426404_54.261694_-1.58541"},{"id":"25600","t": "72","lt": "57.7003471019","ln": "-6.39443254995","mk_id":"25600_104","i":"https://www.truckepedia.com/wp-content/uploads/2017/01/general-haulage.png","w":"43","h":"51","cs":"72_58.478417_-7.516021_56.499631_-4.996007"},{"id":"24375","t": "248","lt": "57.6961345261","ln": "-2.35379110539","mk_id":"24375_104","i":"https://www.truckepedia.com/wp-content/uploads/2017/01/general-haulage.png","w":"43","h":"51","cs":"248_59.911187_-3.538058_57.04293_-1.299399"},{"id":"25510","t": "53","lt": "54.2218681006","ln": "-0.370797127234","mk_id":"25510_104","i":"https://www.truckepedia.com/wp-content/uploads/2017/01/general-haulage.png","w":"43","h":"51","cs":"53_54.489245_-0.665796_54.060042_-0.103771"},{"id":"26684","t": "255","lt": "54.5596821814","ln": "-6.48202954098","mk_id":"26684_104","i":"https://www.truckepedia.com/wp-content/uploads/2017/01/general-haulage.png","w":"43","h":"51","cs":"255_55.180487_-7.724275_54.048565_-5.780338"},{"id":"25868","t": "28","lt": "60.2101681187","ln": "-1.2049511432","mk_id":"25868_104","i":"https://www.truckepedia.com/wp-content/uploads/2017/01/general-haulage.png","w":"43","h":"51","cs":"28_60.764963_-1.56514_59.977335_-0.843611"},{"id":"40534","t": "22","lt": "50.8225719704","ln": "-0.550250505173","mk_id":"40534_104","i":"https://www.truckepedia.com/wp-content/uploads/2017/01/general-haulage.png","w":"43","h":"51","cs":"22_50.852477_-0.632184_50.794882_-0.484234"}]';exit; |
|
83 | + //echo '[{"totalcount":"10","id":"6059","t": "18335","lt": "52.7139785767","ln": "-1.69130477431","mk_id":"6059_104","i":"https://www.truckepedia.com/wp-content/uploads/2017/01/general-haulage.png","w":"43","h":"51","cs":"18335_55.650954_-4.681534_50.529296_1.109871"},{"id":"24114","t": "2652","lt": "51.6379485035","ln": "0.599360766384","mk_id":"24114_104","i":"https://www.truckepedia.com/wp-content/uploads/2017/01/general-haulage.png","w":"43","h":"51","cs":"2652_53.960419_-0.48788_50.770208_1.759608"},{"id":"24119","t": "808","lt": "50.8208508417","ln": "-4.30273646592","mk_id":"24119_104","i":"https://www.truckepedia.com/wp-content/uploads/2017/01/general-haulage.png","w":"43","h":"51","cs":"808_54.757832_-5.683993_50.021626_-3.237784"},{"id":"6057","t": "2271","lt": "55.9425655051","ln": "-3.83133282962","mk_id":"6057_104","i":"https://www.truckepedia.com/wp-content/uploads/2017/01/general-haulage.png","w":"43","h":"51","cs":"2271_58.579678_-6.426404_54.261694_-1.58541"},{"id":"25600","t": "72","lt": "57.7003471019","ln": "-6.39443254995","mk_id":"25600_104","i":"https://www.truckepedia.com/wp-content/uploads/2017/01/general-haulage.png","w":"43","h":"51","cs":"72_58.478417_-7.516021_56.499631_-4.996007"},{"id":"24375","t": "248","lt": "57.6961345261","ln": "-2.35379110539","mk_id":"24375_104","i":"https://www.truckepedia.com/wp-content/uploads/2017/01/general-haulage.png","w":"43","h":"51","cs":"248_59.911187_-3.538058_57.04293_-1.299399"},{"id":"25510","t": "53","lt": "54.2218681006","ln": "-0.370797127234","mk_id":"25510_104","i":"https://www.truckepedia.com/wp-content/uploads/2017/01/general-haulage.png","w":"43","h":"51","cs":"53_54.489245_-0.665796_54.060042_-0.103771"},{"id":"26684","t": "255","lt": "54.5596821814","ln": "-6.48202954098","mk_id":"26684_104","i":"https://www.truckepedia.com/wp-content/uploads/2017/01/general-haulage.png","w":"43","h":"51","cs":"255_55.180487_-7.724275_54.048565_-5.780338"},{"id":"25868","t": "28","lt": "60.2101681187","ln": "-1.2049511432","mk_id":"25868_104","i":"https://www.truckepedia.com/wp-content/uploads/2017/01/general-haulage.png","w":"43","h":"51","cs":"28_60.764963_-1.56514_59.977335_-0.843611"},{"id":"40534","t": "22","lt": "50.8225719704","ln": "-0.550250505173","mk_id":"40534_104","i":"https://www.truckepedia.com/wp-content/uploads/2017/01/general-haulage.png","w":"43","h":"51","cs":"22_50.852477_-0.632184_50.794882_-0.484234"}]';exit; |
|
84 | 84 | |
85 | - global $wpdb, $plugin_prefix, $geodir_cat_icons, $gd_marker_sizes,$gd_session; |
|
85 | + global $wpdb, $plugin_prefix, $geodir_cat_icons, $gd_marker_sizes,$gd_session; |
|
86 | 86 | |
87 | - $search = ''; |
|
88 | - $main_query_array; |
|
87 | + $search = ''; |
|
88 | + $main_query_array; |
|
89 | 89 | |
90 | - $srcharr = array("'", "/", "-", '"', '\\', '''); |
|
91 | - $replarr = array("′", "⁄", "–", "“", '', "′"); |
|
90 | + $srcharr = array("'", "/", "-", '"', '\\', '''); |
|
91 | + $replarr = array("′", "⁄", "–", "“", '', "′"); |
|
92 | 92 | |
93 | - $post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place'; |
|
93 | + $post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place'; |
|
94 | 94 | |
95 | - $map_cat_ids_array = array('0'); |
|
96 | - $cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)"); |
|
95 | + $map_cat_ids_array = array('0'); |
|
96 | + $cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)"); |
|
97 | 97 | |
98 | 98 | |
99 | - $field_default_cat = ''; |
|
100 | - if (isset($_REQUEST['cat_id']) && $_REQUEST['cat_id'] != '') { |
|
101 | - $map_cat_arr = trim($_REQUEST['cat_id'], ','); |
|
99 | + $field_default_cat = ''; |
|
100 | + if (isset($_REQUEST['cat_id']) && $_REQUEST['cat_id'] != '') { |
|
101 | + $map_cat_arr = trim($_REQUEST['cat_id'], ','); |
|
102 | 102 | |
103 | - if (!empty($map_cat_arr)) { |
|
104 | - $field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category "; |
|
103 | + if (!empty($map_cat_arr)) { |
|
104 | + $field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category "; |
|
105 | 105 | |
106 | - $map_cat_ids_array = explode(',', $map_cat_arr); |
|
107 | - $cat_find_array = array(); |
|
108 | - foreach ($map_cat_ids_array as $cat_id) { |
|
109 | - $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id "; |
|
110 | - $cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)"; |
|
111 | - $main_query_array[] = $cat_id; |
|
112 | - } |
|
106 | + $map_cat_ids_array = explode(',', $map_cat_arr); |
|
107 | + $cat_find_array = array(); |
|
108 | + foreach ($map_cat_ids_array as $cat_id) { |
|
109 | + $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id "; |
|
110 | + $cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)"; |
|
111 | + $main_query_array[] = $cat_id; |
|
112 | + } |
|
113 | 113 | |
114 | - } |
|
115 | - } |
|
114 | + } |
|
115 | + } |
|
116 | 116 | |
117 | - if (!empty($field_default_cat)) |
|
118 | - $field_default_cat = ''; |
|
117 | + if (!empty($field_default_cat)) |
|
118 | + $field_default_cat = ''; |
|
119 | 119 | |
120 | - if (!empty($cat_find_array)) |
|
121 | - $search .= "AND (" . implode(' OR ', $cat_find_array) . ")"; |
|
120 | + if (!empty($cat_find_array)) |
|
121 | + $search .= "AND (" . implode(' OR ', $cat_find_array) . ")"; |
|
122 | 122 | |
123 | - $main_query_array = $map_cat_ids_array; |
|
123 | + $main_query_array = $map_cat_ids_array; |
|
124 | 124 | |
125 | - if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) { |
|
126 | - $search .= " AND p.post_title LIKE %s"; |
|
127 | - $main_query_array[] = "%" . $_REQUEST['search'] . "%"; |
|
128 | - } |
|
129 | - |
|
130 | - /** |
|
131 | - * Filter the marker query search SQL, values are replaces with %s or %d. |
|
132 | - * |
|
133 | - * @since 1.5.3 |
|
134 | - * |
|
135 | - * @param string $search The SQL query for search/where. |
|
136 | - */ |
|
137 | - $search = apply_filters('geodir_marker_search', $search); |
|
138 | - /** |
|
139 | - * Filter the marker query search SQL values %s and %d, this is an array of values. |
|
140 | - * |
|
141 | - * @since 1.5.3 |
|
142 | - * |
|
143 | - * @param array $main_query_array The SQL query values for search/where. |
|
144 | - */ |
|
145 | - $main_query_array = apply_filters('geodir_marker_main_query_array', $main_query_array); |
|
146 | - |
|
147 | - $gd_posttype = ''; |
|
148 | - if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') { |
|
149 | - $table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail'; |
|
150 | - $gd_posttype = " AND p.post_type = %s"; |
|
151 | - $main_query_array[] = $_REQUEST['gd_posttype']; |
|
152 | - |
|
153 | - } else |
|
154 | - $table = $plugin_prefix . 'gd_place_detail'; |
|
155 | - |
|
156 | - $join = ", " . $table . " AS pd "; |
|
157 | - |
|
158 | - /** |
|
125 | + if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) { |
|
126 | + $search .= " AND p.post_title LIKE %s"; |
|
127 | + $main_query_array[] = "%" . $_REQUEST['search'] . "%"; |
|
128 | + } |
|
129 | + |
|
130 | + /** |
|
131 | + * Filter the marker query search SQL, values are replaces with %s or %d. |
|
132 | + * |
|
133 | + * @since 1.5.3 |
|
134 | + * |
|
135 | + * @param string $search The SQL query for search/where. |
|
136 | + */ |
|
137 | + $search = apply_filters('geodir_marker_search', $search); |
|
138 | + /** |
|
139 | + * Filter the marker query search SQL values %s and %d, this is an array of values. |
|
140 | + * |
|
141 | + * @since 1.5.3 |
|
142 | + * |
|
143 | + * @param array $main_query_array The SQL query values for search/where. |
|
144 | + */ |
|
145 | + $main_query_array = apply_filters('geodir_marker_main_query_array', $main_query_array); |
|
146 | + |
|
147 | + $gd_posttype = ''; |
|
148 | + if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') { |
|
149 | + $table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail'; |
|
150 | + $gd_posttype = " AND p.post_type = %s"; |
|
151 | + $main_query_array[] = $_REQUEST['gd_posttype']; |
|
152 | + |
|
153 | + } else |
|
154 | + $table = $plugin_prefix . 'gd_place_detail'; |
|
155 | + |
|
156 | + $join = ", " . $table . " AS pd "; |
|
157 | + |
|
158 | + /** |
|
159 | 159 | * Filter the SQL JOIN clause for the markers data |
160 | 160 | * |
161 | 161 | * @since 1.0.0 |
@@ -172,16 +172,16 @@ discard block |
||
172 | 172 | * @param string $search Row of searched fields to use in WHERE clause. |
173 | 173 | */ |
174 | 174 | $search = apply_filters('geodir_home_map_listing_where', $search); |
175 | - $search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search); |
|
176 | - $cat_type = $post_type . 'category'; |
|
177 | - if ($post_type == 'gd_event') { |
|
178 | - $event_select = ", pd.recurring_dates, pd.is_recurring"; |
|
179 | - } else { |
|
180 | - $event_select = ""; |
|
181 | - } |
|
182 | - |
|
183 | - $sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select; |
|
184 | - /** |
|
175 | + $search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search); |
|
176 | + $cat_type = $post_type . 'category'; |
|
177 | + if ($post_type == 'gd_event') { |
|
178 | + $event_select = ", pd.recurring_dates, pd.is_recurring"; |
|
179 | + } else { |
|
180 | + $event_select = ""; |
|
181 | + } |
|
182 | + |
|
183 | + $sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select; |
|
184 | + /** |
|
185 | 185 | * Filter the SQL SELECT clause to retrive fields data |
186 | 186 | * |
187 | 187 | * @since 1.0.0 |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | */ |
201 | 201 | $groupby = apply_filters('geodir_home_map_listing_groupby', $groupby); |
202 | 202 | |
203 | - $catsql = $wpdb->prepare("$select $field_default_cat FROM " . $wpdb->posts . " as p" . $join . " WHERE p.ID = pd.post_id AND p.post_status = 'publish' " . $search . $gd_posttype . $groupby , $main_query_array); |
|
203 | + $catsql = $wpdb->prepare("$select $field_default_cat FROM " . $wpdb->posts . " as p" . $join . " WHERE p.ID = pd.post_id AND p.post_status = 'publish' " . $search . $gd_posttype . $groupby , $main_query_array); |
|
204 | 204 | |
205 | 205 | /** |
206 | 206 | * Filter the SQL query to retrive markers data |
@@ -216,265 +216,265 @@ discard block |
||
216 | 216 | // print_r($gd_session); |
217 | 217 | // print_r($_SESSION); |
218 | 218 | |
219 | - $catinfo = $wpdb->get_results($catsql); |
|
219 | + $catinfo = $wpdb->get_results($catsql); |
|
220 | 220 | |
221 | - $cat_content_info = array(); |
|
222 | - $content_data = array(); |
|
223 | - $post_ids = array(); |
|
224 | - |
|
225 | - /** |
|
226 | - * Called before marker data is processed into JSON. |
|
227 | - * |
|
228 | - * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
229 | - * |
|
230 | - * @since 1.5.3 |
|
231 | - * @param object $catinfo The posts object containing all marker data. |
|
232 | - * @see 'geodir_after_marker_post_process' |
|
233 | - */ |
|
234 | - $catinfo = apply_filters('geodir_before_marker_post_process', $catinfo); |
|
235 | - |
|
236 | - /** |
|
237 | - * Called before marker data is processed into JSON. |
|
238 | - * |
|
239 | - * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
240 | - * |
|
241 | - * @since 1.4.9 |
|
242 | - * @param object $catinfo The posts object containing all marker data. |
|
243 | - * @see 'geodir_after_marker_post_process' |
|
244 | - */ |
|
245 | - do_action('geodir_before_marker_post_process_action', $catinfo); |
|
246 | - |
|
247 | - // Sort any posts into a ajax array |
|
248 | - if (!empty($catinfo)) { |
|
249 | - $geodir_cat_icons = geodir_get_term_icon(); |
|
250 | - global $geodir_date_time_format, $geodir_date_format, $geodir_time_format; |
|
251 | - |
|
252 | - $today = strtotime(date_i18n('Y-m-d')); |
|
253 | - $show_dates = $post_type == 'gd_event' ? (int)get_option('geodir_event_infowindow_dates_count', 1) : 0; |
|
221 | + $cat_content_info = array(); |
|
222 | + $content_data = array(); |
|
223 | + $post_ids = array(); |
|
224 | + |
|
225 | + /** |
|
226 | + * Called before marker data is processed into JSON. |
|
227 | + * |
|
228 | + * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
229 | + * |
|
230 | + * @since 1.5.3 |
|
231 | + * @param object $catinfo The posts object containing all marker data. |
|
232 | + * @see 'geodir_after_marker_post_process' |
|
233 | + */ |
|
234 | + $catinfo = apply_filters('geodir_before_marker_post_process', $catinfo); |
|
235 | + |
|
236 | + /** |
|
237 | + * Called before marker data is processed into JSON. |
|
238 | + * |
|
239 | + * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
240 | + * |
|
241 | + * @since 1.4.9 |
|
242 | + * @param object $catinfo The posts object containing all marker data. |
|
243 | + * @see 'geodir_after_marker_post_process' |
|
244 | + */ |
|
245 | + do_action('geodir_before_marker_post_process_action', $catinfo); |
|
246 | + |
|
247 | + // Sort any posts into a ajax array |
|
248 | + if (!empty($catinfo)) { |
|
249 | + $geodir_cat_icons = geodir_get_term_icon(); |
|
250 | + global $geodir_date_time_format, $geodir_date_format, $geodir_time_format; |
|
251 | + |
|
252 | + $today = strtotime(date_i18n('Y-m-d')); |
|
253 | + $show_dates = $post_type == 'gd_event' ? (int)get_option('geodir_event_infowindow_dates_count', 1) : 0; |
|
254 | 254 | |
255 | - foreach ($catinfo as $catinfo_obj) { |
|
256 | - $post_title = $catinfo_obj->post_title; |
|
255 | + foreach ($catinfo as $catinfo_obj) { |
|
256 | + $post_title = $catinfo_obj->post_title; |
|
257 | 257 | |
258 | - if ($post_type == 'gd_event' && !empty($catinfo_obj->recurring_dates) && $show_dates > 0) { |
|
259 | - $event_dates = ''; |
|
260 | - $recurring_data = isset($catinfo_obj->recurring_dates) ? maybe_unserialize($catinfo_obj->recurring_dates) : array(); |
|
258 | + if ($post_type == 'gd_event' && !empty($catinfo_obj->recurring_dates) && $show_dates > 0) { |
|
259 | + $event_dates = ''; |
|
260 | + $recurring_data = isset($catinfo_obj->recurring_dates) ? maybe_unserialize($catinfo_obj->recurring_dates) : array(); |
|
261 | 261 | |
262 | - $post_info = geodir_get_post_info($catinfo_obj->post_id); |
|
262 | + $post_info = geodir_get_post_info($catinfo_obj->post_id); |
|
263 | 263 | |
264 | - if (!empty($catinfo_obj->is_recurring) && !empty($recurring_data) && !empty($recurring_data['is_recurring']) && geodir_event_recurring_pkg($post_info)) { |
|
265 | - $starttimes = ''; |
|
266 | - $endtimes = ''; |
|
267 | - $astarttimes = array(); |
|
268 | - $aendtimes = array(); |
|
269 | - if ( !isset( $recurring_data['repeat_type'] ) ) { |
|
270 | - $recurring_data['repeat_type'] = 'custom'; |
|
271 | - } |
|
272 | - $repeat_type = isset( $recurring_data['repeat_type'] ) && in_array( $recurring_data['repeat_type'], array( 'day', 'week', 'month', 'year', 'custom' ) ) ? $recurring_data['repeat_type'] : 'year'; // day, week, month, year, custom |
|
273 | - $different_times = isset( $recurring_data['different_times'] ) && !empty( $recurring_data['different_times'] ) ? true : false; |
|
264 | + if (!empty($catinfo_obj->is_recurring) && !empty($recurring_data) && !empty($recurring_data['is_recurring']) && geodir_event_recurring_pkg($post_info)) { |
|
265 | + $starttimes = ''; |
|
266 | + $endtimes = ''; |
|
267 | + $astarttimes = array(); |
|
268 | + $aendtimes = array(); |
|
269 | + if ( !isset( $recurring_data['repeat_type'] ) ) { |
|
270 | + $recurring_data['repeat_type'] = 'custom'; |
|
271 | + } |
|
272 | + $repeat_type = isset( $recurring_data['repeat_type'] ) && in_array( $recurring_data['repeat_type'], array( 'day', 'week', 'month', 'year', 'custom' ) ) ? $recurring_data['repeat_type'] : 'year'; // day, week, month, year, custom |
|
273 | + $different_times = isset( $recurring_data['different_times'] ) && !empty( $recurring_data['different_times'] ) ? true : false; |
|
274 | 274 | |
275 | - $recurring_dates = explode(',', $recurring_data['event_recurring_dates']); |
|
275 | + $recurring_dates = explode(',', $recurring_data['event_recurring_dates']); |
|
276 | 276 | |
277 | - if ( !empty( $recurring_dates ) ) { |
|
278 | - if ( empty( $recurring_data['all_day'] ) ) { |
|
279 | - if ( $repeat_type == 'custom' && $different_times ) { |
|
280 | - $astarttimes = isset( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array(); |
|
281 | - $aendtimes = isset( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array(); |
|
282 | - } else { |
|
283 | - $starttimes = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : ''; |
|
284 | - $endtimes = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : ''; |
|
285 | - } |
|
286 | - } |
|
277 | + if ( !empty( $recurring_dates ) ) { |
|
278 | + if ( empty( $recurring_data['all_day'] ) ) { |
|
279 | + if ( $repeat_type == 'custom' && $different_times ) { |
|
280 | + $astarttimes = isset( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array(); |
|
281 | + $aendtimes = isset( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array(); |
|
282 | + } else { |
|
283 | + $starttimes = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : ''; |
|
284 | + $endtimes = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : ''; |
|
285 | + } |
|
286 | + } |
|
287 | 287 | |
288 | - $e = 0; |
|
289 | - foreach( $recurring_dates as $key => $date ) { |
|
290 | - if ( $repeat_type == 'custom' && $different_times ) { |
|
291 | - if ( !empty( $astarttimes ) && isset( $astarttimes[$key] ) ) { |
|
292 | - $starttimes = $astarttimes[$key]; |
|
293 | - $endtimes = $aendtimes[$key]; |
|
294 | - } else { |
|
295 | - $starttimes = ''; |
|
296 | - $endtimes = ''; |
|
297 | - } |
|
298 | - } |
|
288 | + $e = 0; |
|
289 | + foreach( $recurring_dates as $key => $date ) { |
|
290 | + if ( $repeat_type == 'custom' && $different_times ) { |
|
291 | + if ( !empty( $astarttimes ) && isset( $astarttimes[$key] ) ) { |
|
292 | + $starttimes = $astarttimes[$key]; |
|
293 | + $endtimes = $aendtimes[$key]; |
|
294 | + } else { |
|
295 | + $starttimes = ''; |
|
296 | + $endtimes = ''; |
|
297 | + } |
|
298 | + } |
|
299 | 299 | |
300 | - $duration = isset( $recurring_data['duration_x'] ) && (int)$recurring_data['duration_x'] > 0 ? (int)$recurring_data['duration_x'] : 1; |
|
301 | - $duration--; |
|
302 | - $enddate = date_i18n( 'Y-m-d', strtotime( $date . ' + ' . $duration . ' day' ) ); |
|
300 | + $duration = isset( $recurring_data['duration_x'] ) && (int)$recurring_data['duration_x'] > 0 ? (int)$recurring_data['duration_x'] : 1; |
|
301 | + $duration--; |
|
302 | + $enddate = date_i18n( 'Y-m-d', strtotime( $date . ' + ' . $duration . ' day' ) ); |
|
303 | 303 | |
304 | - // Hide past dates |
|
305 | - if ( strtotime( $enddate ) < $today ) { |
|
306 | - continue; |
|
307 | - } |
|
304 | + // Hide past dates |
|
305 | + if ( strtotime( $enddate ) < $today ) { |
|
306 | + continue; |
|
307 | + } |
|
308 | 308 | |
309 | - $sdate = strtotime( $date . ' ' . $starttimes ); |
|
310 | - $edate = strtotime( $enddate . ' ' . $endtimes ); |
|
309 | + $sdate = strtotime( $date . ' ' . $starttimes ); |
|
310 | + $edate = strtotime( $enddate . ' ' . $endtimes ); |
|
311 | 311 | |
312 | - $start_date = date_i18n( $geodir_date_time_format, $sdate ); |
|
313 | - $end_date = date_i18n( $geodir_date_time_format, $edate ); |
|
312 | + $start_date = date_i18n( $geodir_date_time_format, $sdate ); |
|
313 | + $end_date = date_i18n( $geodir_date_time_format, $edate ); |
|
314 | 314 | |
315 | - $same_day = false; |
|
316 | - $full_day = false; |
|
317 | - $same_datetime = false; |
|
315 | + $same_day = false; |
|
316 | + $full_day = false; |
|
317 | + $same_datetime = false; |
|
318 | 318 | |
319 | - if ( $starttimes == $endtimes && ( $starttimes == '' || $starttimes == '00:00:00' || $starttimes == '00:00' ) ) { |
|
320 | - $full_day = true; |
|
321 | - } |
|
319 | + if ( $starttimes == $endtimes && ( $starttimes == '' || $starttimes == '00:00:00' || $starttimes == '00:00' ) ) { |
|
320 | + $full_day = true; |
|
321 | + } |
|
322 | 322 | |
323 | - if ( $start_date == $end_date && $full_day ) { |
|
324 | - $same_datetime = true; |
|
325 | - } |
|
326 | - |
|
327 | - $link_date = date_i18n( 'Y-m-d', $sdate ); |
|
328 | - $title_date = date_i18n( $geodir_date_format, $sdate ); |
|
329 | - if ( $full_day ) { |
|
330 | - $start_date = $title_date; |
|
331 | - $end_date = date_i18n( $geodir_date_format, $edate ); |
|
332 | - } |
|
323 | + if ( $start_date == $end_date && $full_day ) { |
|
324 | + $same_datetime = true; |
|
325 | + } |
|
326 | + |
|
327 | + $link_date = date_i18n( 'Y-m-d', $sdate ); |
|
328 | + $title_date = date_i18n( $geodir_date_format, $sdate ); |
|
329 | + if ( $full_day ) { |
|
330 | + $start_date = $title_date; |
|
331 | + $end_date = date_i18n( $geodir_date_format, $edate ); |
|
332 | + } |
|
333 | 333 | |
334 | - if ( !$same_datetime && !$full_day && date_i18n( 'Y-m-d', $sdate ) == date_i18n( 'Y-m-d', $edate ) ) { |
|
335 | - $same_day = true; |
|
334 | + if ( !$same_datetime && !$full_day && date_i18n( 'Y-m-d', $sdate ) == date_i18n( 'Y-m-d', $edate ) ) { |
|
335 | + $same_day = true; |
|
336 | 336 | |
337 | - $start_date .= ' - ' . date_i18n( $geodir_time_format, $edate ); |
|
338 | - } |
|
337 | + $start_date .= ' - ' . date_i18n( $geodir_time_format, $edate ); |
|
338 | + } |
|
339 | 339 | |
340 | - $event_dates .= ' :: ' . $start_date; |
|
340 | + $event_dates .= ' :: ' . $start_date; |
|
341 | 341 | |
342 | - if ( !$same_day && !$same_datetime ) { |
|
343 | - $event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date; |
|
344 | - } |
|
342 | + if ( !$same_day && !$same_datetime ) { |
|
343 | + $event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date; |
|
344 | + } |
|
345 | 345 | |
346 | - $e++; |
|
346 | + $e++; |
|
347 | 347 | |
348 | - if ($show_dates > 0 && $e == $show_dates) { // only show 3 event dates |
|
349 | - break; |
|
350 | - } |
|
351 | - } |
|
352 | - } |
|
353 | - } else { |
|
354 | - $start_date = isset( $recurring_data['event_start'] ) ? $recurring_data['event_start'] : ''; |
|
355 | - $end_date = isset( $recurring_data['event_end'] ) ? $recurring_data['event_end'] : $start_date; |
|
356 | - $all_day = isset( $recurring_data['all_day'] ) && !empty( $recurring_data['all_day'] ) ? true : false; |
|
357 | - $starttime = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : ''; |
|
358 | - $endtime = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : ''; |
|
348 | + if ($show_dates > 0 && $e == $show_dates) { // only show 3 event dates |
|
349 | + break; |
|
350 | + } |
|
351 | + } |
|
352 | + } |
|
353 | + } else { |
|
354 | + $start_date = isset( $recurring_data['event_start'] ) ? $recurring_data['event_start'] : ''; |
|
355 | + $end_date = isset( $recurring_data['event_end'] ) ? $recurring_data['event_end'] : $start_date; |
|
356 | + $all_day = isset( $recurring_data['all_day'] ) && !empty( $recurring_data['all_day'] ) ? true : false; |
|
357 | + $starttime = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : ''; |
|
358 | + $endtime = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : ''; |
|
359 | 359 | |
360 | - $event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] ); |
|
361 | - $starttimes = isset( $recurring_data['starttimes'] ) && !empty( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array(); |
|
362 | - $endtimes = isset( $recurring_data['endtimes'] ) && !empty( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array(); |
|
360 | + $event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] ); |
|
361 | + $starttimes = isset( $recurring_data['starttimes'] ) && !empty( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array(); |
|
362 | + $endtimes = isset( $recurring_data['endtimes'] ) && !empty( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array(); |
|
363 | 363 | |
364 | - if ( !geodir_event_is_date( $start_date ) && !empty( $event_recurring_dates ) ) { |
|
365 | - $start_date = $event_recurring_dates[0]; |
|
366 | - } |
|
364 | + if ( !geodir_event_is_date( $start_date ) && !empty( $event_recurring_dates ) ) { |
|
365 | + $start_date = $event_recurring_dates[0]; |
|
366 | + } |
|
367 | 367 | |
368 | - if ( strtotime( $end_date ) < strtotime( $start_date ) ) { |
|
369 | - $end_date = $start_date; |
|
370 | - } |
|
368 | + if ( strtotime( $end_date ) < strtotime( $start_date ) ) { |
|
369 | + $end_date = $start_date; |
|
370 | + } |
|
371 | 371 | |
372 | - if ($end_date != '' && strtotime($end_date) >= $today) { |
|
373 | - if ( $starttime == '' && !empty( $starttimes ) ) { |
|
374 | - $starttime = $starttimes[0]; |
|
375 | - $endtime = $endtimes[0]; |
|
376 | - } |
|
372 | + if ($end_date != '' && strtotime($end_date) >= $today) { |
|
373 | + if ( $starttime == '' && !empty( $starttimes ) ) { |
|
374 | + $starttime = $starttimes[0]; |
|
375 | + $endtime = $endtimes[0]; |
|
376 | + } |
|
377 | 377 | |
378 | - $same_day = false; |
|
379 | - $one_day = false; |
|
380 | - if ( $start_date == $end_date && $all_day ) { |
|
381 | - $one_day = true; |
|
382 | - } |
|
383 | - |
|
384 | - if ( $all_day ) { |
|
385 | - $start_datetime = strtotime( $start_date ); |
|
386 | - $end_datetime = strtotime( $end_date ); |
|
378 | + $same_day = false; |
|
379 | + $one_day = false; |
|
380 | + if ( $start_date == $end_date && $all_day ) { |
|
381 | + $one_day = true; |
|
382 | + } |
|
383 | + |
|
384 | + if ( $all_day ) { |
|
385 | + $start_datetime = strtotime( $start_date ); |
|
386 | + $end_datetime = strtotime( $end_date ); |
|
387 | 387 | |
388 | - $start_date = date_i18n( $geodir_date_format, $start_datetime ); |
|
389 | - $end_date = date_i18n( $geodir_date_format, $end_datetime ); |
|
390 | - if ( $start_date == $end_date ) { |
|
391 | - $one_day = true; |
|
392 | - } |
|
393 | - } else { |
|
394 | - if ( $start_date == $end_date && $starttime == $endtime ) { |
|
395 | - $end_date = date_i18n( 'Y-m-d', strtotime( $start_date . ' ' . $starttime . ' +1 day' ) ); |
|
396 | - $one_day = false; |
|
397 | - } |
|
398 | - $start_datetime = strtotime( $start_date . ' ' . $starttime ); |
|
399 | - $end_datetime = strtotime( $end_date . ' ' . $endtime ); |
|
388 | + $start_date = date_i18n( $geodir_date_format, $start_datetime ); |
|
389 | + $end_date = date_i18n( $geodir_date_format, $end_datetime ); |
|
390 | + if ( $start_date == $end_date ) { |
|
391 | + $one_day = true; |
|
392 | + } |
|
393 | + } else { |
|
394 | + if ( $start_date == $end_date && $starttime == $endtime ) { |
|
395 | + $end_date = date_i18n( 'Y-m-d', strtotime( $start_date . ' ' . $starttime . ' +1 day' ) ); |
|
396 | + $one_day = false; |
|
397 | + } |
|
398 | + $start_datetime = strtotime( $start_date . ' ' . $starttime ); |
|
399 | + $end_datetime = strtotime( $end_date . ' ' . $endtime ); |
|
400 | 400 | |
401 | - $start_date = date_i18n( $geodir_date_time_format, $start_datetime ); |
|
402 | - $end_date = date_i18n( $geodir_date_time_format, $end_datetime ); |
|
403 | - } |
|
401 | + $start_date = date_i18n( $geodir_date_time_format, $start_datetime ); |
|
402 | + $end_date = date_i18n( $geodir_date_time_format, $end_datetime ); |
|
403 | + } |
|
404 | 404 | |
405 | - if ( !$one_day && date_i18n( 'Y-m-d', $start_datetime ) == date_i18n( 'Y-m-d', $end_datetime ) ) { |
|
406 | - $same_day = true; |
|
405 | + if ( !$one_day && date_i18n( 'Y-m-d', $start_datetime ) == date_i18n( 'Y-m-d', $end_datetime ) ) { |
|
406 | + $same_day = true; |
|
407 | 407 | |
408 | - $start_date .= ' - ' . date_i18n( $geodir_time_format, $end_datetime ); |
|
409 | - } |
|
408 | + $start_date .= ' - ' . date_i18n( $geodir_time_format, $end_datetime ); |
|
409 | + } |
|
410 | 410 | |
411 | - $event_dates .= ' :: ' . $start_date; |
|
411 | + $event_dates .= ' :: ' . $start_date; |
|
412 | 412 | |
413 | - if ( !$same_day && !$one_day ) { |
|
414 | - $event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date; |
|
415 | - } |
|
416 | - } |
|
417 | - } |
|
418 | - |
|
419 | - if (empty($event_dates)) { |
|
420 | - continue; |
|
421 | - } |
|
413 | + if ( !$same_day && !$one_day ) { |
|
414 | + $event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date; |
|
415 | + } |
|
416 | + } |
|
417 | + } |
|
418 | + |
|
419 | + if (empty($event_dates)) { |
|
420 | + continue; |
|
421 | + } |
|
422 | 422 | |
423 | - $post_title .= $event_dates; |
|
424 | - } |
|
423 | + $post_title .= $event_dates; |
|
424 | + } |
|
425 | 425 | |
426 | - $map_cat_ids_array; |
|
427 | - $default_cat = isset($catinfo_obj->default_category) ? $catinfo_obj->default_category : ''; |
|
426 | + $map_cat_ids_array; |
|
427 | + $default_cat = isset($catinfo_obj->default_category) ? $catinfo_obj->default_category : ''; |
|
428 | 428 | |
429 | - // if single cat lets just show that icon |
|
430 | - if(is_array($map_cat_ids_array) && count($map_cat_ids_array)==1){ |
|
431 | - $default_cat = (int)$map_cat_ids_array[0]; |
|
432 | - } |
|
429 | + // if single cat lets just show that icon |
|
430 | + if(is_array($map_cat_ids_array) && count($map_cat_ids_array)==1){ |
|
431 | + $default_cat = (int)$map_cat_ids_array[0]; |
|
432 | + } |
|
433 | 433 | |
434 | - $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$default_cat]) ? $geodir_cat_icons[$default_cat] : ''; |
|
435 | - $mark_extra = (isset($catinfo_obj->marker_extra)) ? $catinfo_obj->marker_extra : ''; |
|
436 | - $title = str_replace($srcharr, $replarr, $post_title); |
|
434 | + $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$default_cat]) ? $geodir_cat_icons[$default_cat] : ''; |
|
435 | + $mark_extra = (isset($catinfo_obj->marker_extra)) ? $catinfo_obj->marker_extra : ''; |
|
436 | + $title = str_replace($srcharr, $replarr, $post_title); |
|
437 | 437 | |
438 | - if ($icon != '') { |
|
439 | - $gd_marker_sizes = empty($gd_marker_sizes) ? array() : $gd_marker_sizes; |
|
438 | + if ($icon != '') { |
|
439 | + $gd_marker_sizes = empty($gd_marker_sizes) ? array() : $gd_marker_sizes; |
|
440 | 440 | |
441 | - if (isset($gd_marker_sizes[$icon])) { |
|
442 | - $icon_size = $gd_marker_sizes[$icon]; |
|
443 | - } else { |
|
444 | - $icon_size = geodir_get_marker_size($icon); |
|
445 | - $gd_marker_sizes[$icon] = $icon_size; |
|
446 | - } |
|
447 | - } else { |
|
448 | - $icon_size = array('w' => 36, 'h' => 45); |
|
449 | - } |
|
450 | - |
|
451 | - $content_data[] = '{"id":"' . $catinfo_obj->post_id . '","t": "' . $title . '","lt": "' . $catinfo_obj->post_latitude . '","ln": "' . $catinfo_obj->post_longitude . '","mk_id":"' . $catinfo_obj->post_id . '_' . $default_cat . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"'.$mark_extra.'}'; |
|
452 | - $post_ids[] = $catinfo_obj->post_id; |
|
453 | - } |
|
454 | - } |
|
455 | - |
|
456 | - /** |
|
457 | - * Called after marker data is processed into JSON. |
|
458 | - * |
|
459 | - * Called after marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
460 | - * |
|
461 | - * @since 1.4.9 |
|
462 | - * @param array $content_data The array containing all markers in JSON format. |
|
463 | - * @param object $catinfo The posts object containing all marker data. |
|
464 | - * @see 'geodir_before_marker_post_process' |
|
465 | - */ |
|
466 | - do_action('geodir_after_marker_post_process', $content_data, $catinfo); |
|
467 | - |
|
468 | - if (!empty($content_data)) { |
|
469 | - $cat_content_info[] = implode(',', $content_data); |
|
470 | - } |
|
471 | - |
|
472 | - $totalcount = count(array_unique($post_ids)); |
|
473 | - |
|
474 | - if (!empty($cat_content_info)) { |
|
475 | - return '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']'; |
|
476 | - } |
|
477 | - else { |
|
478 | - return '[{"totalcount":"0"}]'; |
|
479 | - } |
|
441 | + if (isset($gd_marker_sizes[$icon])) { |
|
442 | + $icon_size = $gd_marker_sizes[$icon]; |
|
443 | + } else { |
|
444 | + $icon_size = geodir_get_marker_size($icon); |
|
445 | + $gd_marker_sizes[$icon] = $icon_size; |
|
446 | + } |
|
447 | + } else { |
|
448 | + $icon_size = array('w' => 36, 'h' => 45); |
|
449 | + } |
|
450 | + |
|
451 | + $content_data[] = '{"id":"' . $catinfo_obj->post_id . '","t": "' . $title . '","lt": "' . $catinfo_obj->post_latitude . '","ln": "' . $catinfo_obj->post_longitude . '","mk_id":"' . $catinfo_obj->post_id . '_' . $default_cat . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"'.$mark_extra.'}'; |
|
452 | + $post_ids[] = $catinfo_obj->post_id; |
|
453 | + } |
|
454 | + } |
|
455 | + |
|
456 | + /** |
|
457 | + * Called after marker data is processed into JSON. |
|
458 | + * |
|
459 | + * Called after marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
460 | + * |
|
461 | + * @since 1.4.9 |
|
462 | + * @param array $content_data The array containing all markers in JSON format. |
|
463 | + * @param object $catinfo The posts object containing all marker data. |
|
464 | + * @see 'geodir_before_marker_post_process' |
|
465 | + */ |
|
466 | + do_action('geodir_after_marker_post_process', $content_data, $catinfo); |
|
467 | + |
|
468 | + if (!empty($content_data)) { |
|
469 | + $cat_content_info[] = implode(',', $content_data); |
|
470 | + } |
|
471 | + |
|
472 | + $totalcount = count(array_unique($post_ids)); |
|
473 | + |
|
474 | + if (!empty($cat_content_info)) { |
|
475 | + return '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']'; |
|
476 | + } |
|
477 | + else { |
|
478 | + return '[{"totalcount":"0"}]'; |
|
479 | + } |
|
480 | 480 | } |
481 | 481 | \ No newline at end of file |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | $gd_session->set('homemap_catlist_ptype', $gd_post_type); |
13 | 13 | $post_taxonomy = geodir_get_taxonomies($gd_post_type); |
14 | 14 | $map_canvas_name = sanitize_text_field($_REQUEST['map_canvas']); |
15 | - $child_collapse = (bool)$_REQUEST['child_collapse']; |
|
15 | + $child_collapse = (bool) $_REQUEST['child_collapse']; |
|
16 | 16 | echo home_map_taxonomy_walker($post_taxonomy, 0, true, 0, $map_canvas_name, $child_collapse, true); |
17 | 17 | die; |
18 | 18 | } |
@@ -32,21 +32,21 @@ discard block |
||
32 | 32 | global $wpdb, $plugin_prefix, $gd_session; |
33 | 33 | |
34 | 34 | if ($_REQUEST['m_id'] != '') { |
35 | - $pid = (int)$_REQUEST['m_id']; |
|
35 | + $pid = (int) $_REQUEST['m_id']; |
|
36 | 36 | } else { |
37 | 37 | echo __('No marker data found', 'geodirectory'); |
38 | 38 | exit; |
39 | 39 | } |
40 | 40 | |
41 | 41 | if (isset($_REQUEST['post_preview']) && $_REQUEST['post_preview'] != '' && $gd_ses_listing = $gd_session->get('listing')) { |
42 | - $post = (object)$gd_ses_listing; |
|
42 | + $post = (object) $gd_ses_listing; |
|
43 | 43 | echo geodir_get_infowindow_html($post, $_REQUEST['post_preview']); |
44 | 44 | } else { |
45 | 45 | $geodir_post_type = get_post_type($pid); |
46 | 46 | |
47 | - $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
47 | + $table = $plugin_prefix.$geodir_post_type.'_detail'; |
|
48 | 48 | |
49 | - $sql = $wpdb->prepare("SELECT * FROM " . $table . " WHERE post_id = %d", array($pid)); |
|
49 | + $sql = $wpdb->prepare("SELECT * FROM ".$table." WHERE post_id = %d", array($pid)); |
|
50 | 50 | |
51 | 51 | $postinfo = $wpdb->get_results($sql); |
52 | 52 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | //echo '[{"totalcount":"10","id":"6059","t": "18335","lt": "52.7139785767","ln": "-1.69130477431","mk_id":"6059_104","i":"https://www.truckepedia.com/wp-content/uploads/2017/01/general-haulage.png","w":"43","h":"51","cs":"18335_55.650954_-4.681534_50.529296_1.109871"},{"id":"24114","t": "2652","lt": "51.6379485035","ln": "0.599360766384","mk_id":"24114_104","i":"https://www.truckepedia.com/wp-content/uploads/2017/01/general-haulage.png","w":"43","h":"51","cs":"2652_53.960419_-0.48788_50.770208_1.759608"},{"id":"24119","t": "808","lt": "50.8208508417","ln": "-4.30273646592","mk_id":"24119_104","i":"https://www.truckepedia.com/wp-content/uploads/2017/01/general-haulage.png","w":"43","h":"51","cs":"808_54.757832_-5.683993_50.021626_-3.237784"},{"id":"6057","t": "2271","lt": "55.9425655051","ln": "-3.83133282962","mk_id":"6057_104","i":"https://www.truckepedia.com/wp-content/uploads/2017/01/general-haulage.png","w":"43","h":"51","cs":"2271_58.579678_-6.426404_54.261694_-1.58541"},{"id":"25600","t": "72","lt": "57.7003471019","ln": "-6.39443254995","mk_id":"25600_104","i":"https://www.truckepedia.com/wp-content/uploads/2017/01/general-haulage.png","w":"43","h":"51","cs":"72_58.478417_-7.516021_56.499631_-4.996007"},{"id":"24375","t": "248","lt": "57.6961345261","ln": "-2.35379110539","mk_id":"24375_104","i":"https://www.truckepedia.com/wp-content/uploads/2017/01/general-haulage.png","w":"43","h":"51","cs":"248_59.911187_-3.538058_57.04293_-1.299399"},{"id":"25510","t": "53","lt": "54.2218681006","ln": "-0.370797127234","mk_id":"25510_104","i":"https://www.truckepedia.com/wp-content/uploads/2017/01/general-haulage.png","w":"43","h":"51","cs":"53_54.489245_-0.665796_54.060042_-0.103771"},{"id":"26684","t": "255","lt": "54.5596821814","ln": "-6.48202954098","mk_id":"26684_104","i":"https://www.truckepedia.com/wp-content/uploads/2017/01/general-haulage.png","w":"43","h":"51","cs":"255_55.180487_-7.724275_54.048565_-5.780338"},{"id":"25868","t": "28","lt": "60.2101681187","ln": "-1.2049511432","mk_id":"25868_104","i":"https://www.truckepedia.com/wp-content/uploads/2017/01/general-haulage.png","w":"43","h":"51","cs":"28_60.764963_-1.56514_59.977335_-0.843611"},{"id":"40534","t": "22","lt": "50.8225719704","ln": "-0.550250505173","mk_id":"40534_104","i":"https://www.truckepedia.com/wp-content/uploads/2017/01/general-haulage.png","w":"43","h":"51","cs":"22_50.852477_-0.632184_50.794882_-0.484234"}]';exit; |
84 | 84 | |
85 | - global $wpdb, $plugin_prefix, $geodir_cat_icons, $gd_marker_sizes,$gd_session; |
|
85 | + global $wpdb, $plugin_prefix, $geodir_cat_icons, $gd_marker_sizes, $gd_session; |
|
86 | 86 | |
87 | 87 | $search = ''; |
88 | 88 | $main_query_array; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | $post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place'; |
94 | 94 | |
95 | 95 | $map_cat_ids_array = array('0'); |
96 | - $cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)"); |
|
96 | + $cat_find_array = array(" FIND_IN_SET(%d, pd.".$post_type."category)"); |
|
97 | 97 | |
98 | 98 | |
99 | 99 | $field_default_cat = ''; |
@@ -101,13 +101,13 @@ discard block |
||
101 | 101 | $map_cat_arr = trim($_REQUEST['cat_id'], ','); |
102 | 102 | |
103 | 103 | if (!empty($map_cat_arr)) { |
104 | - $field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category "; |
|
104 | + $field_default_cat .= "WHEN (default_category IN (".$map_cat_arr.")) THEN default_category "; |
|
105 | 105 | |
106 | 106 | $map_cat_ids_array = explode(',', $map_cat_arr); |
107 | 107 | $cat_find_array = array(); |
108 | 108 | foreach ($map_cat_ids_array as $cat_id) { |
109 | - $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id "; |
|
110 | - $cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)"; |
|
109 | + $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `".$post_type."category`) > 0) THEN $cat_id "; |
|
110 | + $cat_find_array[] = " FIND_IN_SET(%d, pd.".$post_type."category)"; |
|
111 | 111 | $main_query_array[] = $cat_id; |
112 | 112 | } |
113 | 113 | |
@@ -118,13 +118,13 @@ discard block |
||
118 | 118 | $field_default_cat = ''; |
119 | 119 | |
120 | 120 | if (!empty($cat_find_array)) |
121 | - $search .= "AND (" . implode(' OR ', $cat_find_array) . ")"; |
|
121 | + $search .= "AND (".implode(' OR ', $cat_find_array).")"; |
|
122 | 122 | |
123 | 123 | $main_query_array = $map_cat_ids_array; |
124 | 124 | |
125 | 125 | if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) { |
126 | 126 | $search .= " AND p.post_title LIKE %s"; |
127 | - $main_query_array[] = "%" . $_REQUEST['search'] . "%"; |
|
127 | + $main_query_array[] = "%".$_REQUEST['search']."%"; |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
@@ -146,14 +146,14 @@ discard block |
||
146 | 146 | |
147 | 147 | $gd_posttype = ''; |
148 | 148 | if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') { |
149 | - $table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail'; |
|
149 | + $table = $plugin_prefix.$_REQUEST['gd_posttype'].'_detail'; |
|
150 | 150 | $gd_posttype = " AND p.post_type = %s"; |
151 | 151 | $main_query_array[] = $_REQUEST['gd_posttype']; |
152 | 152 | |
153 | 153 | } else |
154 | - $table = $plugin_prefix . 'gd_place_detail'; |
|
154 | + $table = $plugin_prefix.'gd_place_detail'; |
|
155 | 155 | |
156 | - $join = ", " . $table . " AS pd "; |
|
156 | + $join = ", ".$table." AS pd "; |
|
157 | 157 | |
158 | 158 | /** |
159 | 159 | * Filter the SQL JOIN clause for the markers data |
@@ -173,14 +173,14 @@ discard block |
||
173 | 173 | */ |
174 | 174 | $search = apply_filters('geodir_home_map_listing_where', $search); |
175 | 175 | $search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search); |
176 | - $cat_type = $post_type . 'category'; |
|
176 | + $cat_type = $post_type.'category'; |
|
177 | 177 | if ($post_type == 'gd_event') { |
178 | 178 | $event_select = ", pd.recurring_dates, pd.is_recurring"; |
179 | 179 | } else { |
180 | 180 | $event_select = ""; |
181 | 181 | } |
182 | 182 | |
183 | - $sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select; |
|
183 | + $sql_select = 'SELECT pd.default_category, pd.'.$cat_type.', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude'.$event_select; |
|
184 | 184 | /** |
185 | 185 | * Filter the SQL SELECT clause to retrive fields data |
186 | 186 | * |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | */ |
201 | 201 | $groupby = apply_filters('geodir_home_map_listing_groupby', $groupby); |
202 | 202 | |
203 | - $catsql = $wpdb->prepare("$select $field_default_cat FROM " . $wpdb->posts . " as p" . $join . " WHERE p.ID = pd.post_id AND p.post_status = 'publish' " . $search . $gd_posttype . $groupby , $main_query_array); |
|
203 | + $catsql = $wpdb->prepare("$select $field_default_cat FROM ".$wpdb->posts." as p".$join." WHERE p.ID = pd.post_id AND p.post_status = 'publish' ".$search.$gd_posttype.$groupby, $main_query_array); |
|
204 | 204 | |
205 | 205 | /** |
206 | 206 | * Filter the SQL query to retrive markers data |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | global $geodir_date_time_format, $geodir_date_format, $geodir_time_format; |
251 | 251 | |
252 | 252 | $today = strtotime(date_i18n('Y-m-d')); |
253 | - $show_dates = $post_type == 'gd_event' ? (int)get_option('geodir_event_infowindow_dates_count', 1) : 0; |
|
253 | + $show_dates = $post_type == 'gd_event' ? (int) get_option('geodir_event_infowindow_dates_count', 1) : 0; |
|
254 | 254 | |
255 | 255 | foreach ($catinfo as $catinfo_obj) { |
256 | 256 | $post_title = $catinfo_obj->post_title; |
@@ -266,29 +266,29 @@ discard block |
||
266 | 266 | $endtimes = ''; |
267 | 267 | $astarttimes = array(); |
268 | 268 | $aendtimes = array(); |
269 | - if ( !isset( $recurring_data['repeat_type'] ) ) { |
|
269 | + if (!isset($recurring_data['repeat_type'])) { |
|
270 | 270 | $recurring_data['repeat_type'] = 'custom'; |
271 | 271 | } |
272 | - $repeat_type = isset( $recurring_data['repeat_type'] ) && in_array( $recurring_data['repeat_type'], array( 'day', 'week', 'month', 'year', 'custom' ) ) ? $recurring_data['repeat_type'] : 'year'; // day, week, month, year, custom |
|
273 | - $different_times = isset( $recurring_data['different_times'] ) && !empty( $recurring_data['different_times'] ) ? true : false; |
|
272 | + $repeat_type = isset($recurring_data['repeat_type']) && in_array($recurring_data['repeat_type'], array('day', 'week', 'month', 'year', 'custom')) ? $recurring_data['repeat_type'] : 'year'; // day, week, month, year, custom |
|
273 | + $different_times = isset($recurring_data['different_times']) && !empty($recurring_data['different_times']) ? true : false; |
|
274 | 274 | |
275 | 275 | $recurring_dates = explode(',', $recurring_data['event_recurring_dates']); |
276 | 276 | |
277 | - if ( !empty( $recurring_dates ) ) { |
|
278 | - if ( empty( $recurring_data['all_day'] ) ) { |
|
279 | - if ( $repeat_type == 'custom' && $different_times ) { |
|
280 | - $astarttimes = isset( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array(); |
|
281 | - $aendtimes = isset( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array(); |
|
277 | + if (!empty($recurring_dates)) { |
|
278 | + if (empty($recurring_data['all_day'])) { |
|
279 | + if ($repeat_type == 'custom' && $different_times) { |
|
280 | + $astarttimes = isset($recurring_data['starttimes']) ? $recurring_data['starttimes'] : array(); |
|
281 | + $aendtimes = isset($recurring_data['endtimes']) ? $recurring_data['endtimes'] : array(); |
|
282 | 282 | } else { |
283 | - $starttimes = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : ''; |
|
284 | - $endtimes = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : ''; |
|
283 | + $starttimes = isset($recurring_data['starttime']) ? $recurring_data['starttime'] : ''; |
|
284 | + $endtimes = isset($recurring_data['endtime']) ? $recurring_data['endtime'] : ''; |
|
285 | 285 | } |
286 | 286 | } |
287 | 287 | |
288 | 288 | $e = 0; |
289 | - foreach( $recurring_dates as $key => $date ) { |
|
290 | - if ( $repeat_type == 'custom' && $different_times ) { |
|
291 | - if ( !empty( $astarttimes ) && isset( $astarttimes[$key] ) ) { |
|
289 | + foreach ($recurring_dates as $key => $date) { |
|
290 | + if ($repeat_type == 'custom' && $different_times) { |
|
291 | + if (!empty($astarttimes) && isset($astarttimes[$key])) { |
|
292 | 292 | $starttimes = $astarttimes[$key]; |
293 | 293 | $endtimes = $aendtimes[$key]; |
294 | 294 | } else { |
@@ -297,50 +297,50 @@ discard block |
||
297 | 297 | } |
298 | 298 | } |
299 | 299 | |
300 | - $duration = isset( $recurring_data['duration_x'] ) && (int)$recurring_data['duration_x'] > 0 ? (int)$recurring_data['duration_x'] : 1; |
|
300 | + $duration = isset($recurring_data['duration_x']) && (int) $recurring_data['duration_x'] > 0 ? (int) $recurring_data['duration_x'] : 1; |
|
301 | 301 | $duration--; |
302 | - $enddate = date_i18n( 'Y-m-d', strtotime( $date . ' + ' . $duration . ' day' ) ); |
|
302 | + $enddate = date_i18n('Y-m-d', strtotime($date.' + '.$duration.' day')); |
|
303 | 303 | |
304 | 304 | // Hide past dates |
305 | - if ( strtotime( $enddate ) < $today ) { |
|
305 | + if (strtotime($enddate) < $today) { |
|
306 | 306 | continue; |
307 | 307 | } |
308 | 308 | |
309 | - $sdate = strtotime( $date . ' ' . $starttimes ); |
|
310 | - $edate = strtotime( $enddate . ' ' . $endtimes ); |
|
309 | + $sdate = strtotime($date.' '.$starttimes); |
|
310 | + $edate = strtotime($enddate.' '.$endtimes); |
|
311 | 311 | |
312 | - $start_date = date_i18n( $geodir_date_time_format, $sdate ); |
|
313 | - $end_date = date_i18n( $geodir_date_time_format, $edate ); |
|
312 | + $start_date = date_i18n($geodir_date_time_format, $sdate); |
|
313 | + $end_date = date_i18n($geodir_date_time_format, $edate); |
|
314 | 314 | |
315 | 315 | $same_day = false; |
316 | 316 | $full_day = false; |
317 | 317 | $same_datetime = false; |
318 | 318 | |
319 | - if ( $starttimes == $endtimes && ( $starttimes == '' || $starttimes == '00:00:00' || $starttimes == '00:00' ) ) { |
|
319 | + if ($starttimes == $endtimes && ($starttimes == '' || $starttimes == '00:00:00' || $starttimes == '00:00')) { |
|
320 | 320 | $full_day = true; |
321 | 321 | } |
322 | 322 | |
323 | - if ( $start_date == $end_date && $full_day ) { |
|
323 | + if ($start_date == $end_date && $full_day) { |
|
324 | 324 | $same_datetime = true; |
325 | 325 | } |
326 | 326 | |
327 | - $link_date = date_i18n( 'Y-m-d', $sdate ); |
|
328 | - $title_date = date_i18n( $geodir_date_format, $sdate ); |
|
329 | - if ( $full_day ) { |
|
327 | + $link_date = date_i18n('Y-m-d', $sdate); |
|
328 | + $title_date = date_i18n($geodir_date_format, $sdate); |
|
329 | + if ($full_day) { |
|
330 | 330 | $start_date = $title_date; |
331 | - $end_date = date_i18n( $geodir_date_format, $edate ); |
|
331 | + $end_date = date_i18n($geodir_date_format, $edate); |
|
332 | 332 | } |
333 | 333 | |
334 | - if ( !$same_datetime && !$full_day && date_i18n( 'Y-m-d', $sdate ) == date_i18n( 'Y-m-d', $edate ) ) { |
|
334 | + if (!$same_datetime && !$full_day && date_i18n('Y-m-d', $sdate) == date_i18n('Y-m-d', $edate)) { |
|
335 | 335 | $same_day = true; |
336 | 336 | |
337 | - $start_date .= ' - ' . date_i18n( $geodir_time_format, $edate ); |
|
337 | + $start_date .= ' - '.date_i18n($geodir_time_format, $edate); |
|
338 | 338 | } |
339 | 339 | |
340 | - $event_dates .= ' :: ' . $start_date; |
|
340 | + $event_dates .= ' :: '.$start_date; |
|
341 | 341 | |
342 | - if ( !$same_day && !$same_datetime ) { |
|
343 | - $event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date; |
|
342 | + if (!$same_day && !$same_datetime) { |
|
343 | + $event_dates .= ' '.__('to', 'geodirectory').' '.$end_date; |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | $e++; |
@@ -351,67 +351,67 @@ discard block |
||
351 | 351 | } |
352 | 352 | } |
353 | 353 | } else { |
354 | - $start_date = isset( $recurring_data['event_start'] ) ? $recurring_data['event_start'] : ''; |
|
355 | - $end_date = isset( $recurring_data['event_end'] ) ? $recurring_data['event_end'] : $start_date; |
|
356 | - $all_day = isset( $recurring_data['all_day'] ) && !empty( $recurring_data['all_day'] ) ? true : false; |
|
357 | - $starttime = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : ''; |
|
358 | - $endtime = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : ''; |
|
354 | + $start_date = isset($recurring_data['event_start']) ? $recurring_data['event_start'] : ''; |
|
355 | + $end_date = isset($recurring_data['event_end']) ? $recurring_data['event_end'] : $start_date; |
|
356 | + $all_day = isset($recurring_data['all_day']) && !empty($recurring_data['all_day']) ? true : false; |
|
357 | + $starttime = isset($recurring_data['starttime']) ? $recurring_data['starttime'] : ''; |
|
358 | + $endtime = isset($recurring_data['endtime']) ? $recurring_data['endtime'] : ''; |
|
359 | 359 | |
360 | - $event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] ); |
|
361 | - $starttimes = isset( $recurring_data['starttimes'] ) && !empty( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array(); |
|
362 | - $endtimes = isset( $recurring_data['endtimes'] ) && !empty( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array(); |
|
360 | + $event_recurring_dates = explode(',', $recurring_data['event_recurring_dates']); |
|
361 | + $starttimes = isset($recurring_data['starttimes']) && !empty($recurring_data['starttimes']) ? $recurring_data['starttimes'] : array(); |
|
362 | + $endtimes = isset($recurring_data['endtimes']) && !empty($recurring_data['endtimes']) ? $recurring_data['endtimes'] : array(); |
|
363 | 363 | |
364 | - if ( !geodir_event_is_date( $start_date ) && !empty( $event_recurring_dates ) ) { |
|
364 | + if (!geodir_event_is_date($start_date) && !empty($event_recurring_dates)) { |
|
365 | 365 | $start_date = $event_recurring_dates[0]; |
366 | 366 | } |
367 | 367 | |
368 | - if ( strtotime( $end_date ) < strtotime( $start_date ) ) { |
|
368 | + if (strtotime($end_date) < strtotime($start_date)) { |
|
369 | 369 | $end_date = $start_date; |
370 | 370 | } |
371 | 371 | |
372 | 372 | if ($end_date != '' && strtotime($end_date) >= $today) { |
373 | - if ( $starttime == '' && !empty( $starttimes ) ) { |
|
373 | + if ($starttime == '' && !empty($starttimes)) { |
|
374 | 374 | $starttime = $starttimes[0]; |
375 | 375 | $endtime = $endtimes[0]; |
376 | 376 | } |
377 | 377 | |
378 | 378 | $same_day = false; |
379 | 379 | $one_day = false; |
380 | - if ( $start_date == $end_date && $all_day ) { |
|
380 | + if ($start_date == $end_date && $all_day) { |
|
381 | 381 | $one_day = true; |
382 | 382 | } |
383 | 383 | |
384 | - if ( $all_day ) { |
|
385 | - $start_datetime = strtotime( $start_date ); |
|
386 | - $end_datetime = strtotime( $end_date ); |
|
384 | + if ($all_day) { |
|
385 | + $start_datetime = strtotime($start_date); |
|
386 | + $end_datetime = strtotime($end_date); |
|
387 | 387 | |
388 | - $start_date = date_i18n( $geodir_date_format, $start_datetime ); |
|
389 | - $end_date = date_i18n( $geodir_date_format, $end_datetime ); |
|
390 | - if ( $start_date == $end_date ) { |
|
388 | + $start_date = date_i18n($geodir_date_format, $start_datetime); |
|
389 | + $end_date = date_i18n($geodir_date_format, $end_datetime); |
|
390 | + if ($start_date == $end_date) { |
|
391 | 391 | $one_day = true; |
392 | 392 | } |
393 | 393 | } else { |
394 | - if ( $start_date == $end_date && $starttime == $endtime ) { |
|
395 | - $end_date = date_i18n( 'Y-m-d', strtotime( $start_date . ' ' . $starttime . ' +1 day' ) ); |
|
394 | + if ($start_date == $end_date && $starttime == $endtime) { |
|
395 | + $end_date = date_i18n('Y-m-d', strtotime($start_date.' '.$starttime.' +1 day')); |
|
396 | 396 | $one_day = false; |
397 | 397 | } |
398 | - $start_datetime = strtotime( $start_date . ' ' . $starttime ); |
|
399 | - $end_datetime = strtotime( $end_date . ' ' . $endtime ); |
|
398 | + $start_datetime = strtotime($start_date.' '.$starttime); |
|
399 | + $end_datetime = strtotime($end_date.' '.$endtime); |
|
400 | 400 | |
401 | - $start_date = date_i18n( $geodir_date_time_format, $start_datetime ); |
|
402 | - $end_date = date_i18n( $geodir_date_time_format, $end_datetime ); |
|
401 | + $start_date = date_i18n($geodir_date_time_format, $start_datetime); |
|
402 | + $end_date = date_i18n($geodir_date_time_format, $end_datetime); |
|
403 | 403 | } |
404 | 404 | |
405 | - if ( !$one_day && date_i18n( 'Y-m-d', $start_datetime ) == date_i18n( 'Y-m-d', $end_datetime ) ) { |
|
405 | + if (!$one_day && date_i18n('Y-m-d', $start_datetime) == date_i18n('Y-m-d', $end_datetime)) { |
|
406 | 406 | $same_day = true; |
407 | 407 | |
408 | - $start_date .= ' - ' . date_i18n( $geodir_time_format, $end_datetime ); |
|
408 | + $start_date .= ' - '.date_i18n($geodir_time_format, $end_datetime); |
|
409 | 409 | } |
410 | 410 | |
411 | - $event_dates .= ' :: ' . $start_date; |
|
411 | + $event_dates .= ' :: '.$start_date; |
|
412 | 412 | |
413 | - if ( !$same_day && !$one_day ) { |
|
414 | - $event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date; |
|
413 | + if (!$same_day && !$one_day) { |
|
414 | + $event_dates .= ' '.__('to', 'geodirectory').' '.$end_date; |
|
415 | 415 | } |
416 | 416 | } |
417 | 417 | } |
@@ -427,8 +427,8 @@ discard block |
||
427 | 427 | $default_cat = isset($catinfo_obj->default_category) ? $catinfo_obj->default_category : ''; |
428 | 428 | |
429 | 429 | // if single cat lets just show that icon |
430 | - if(is_array($map_cat_ids_array) && count($map_cat_ids_array)==1){ |
|
431 | - $default_cat = (int)$map_cat_ids_array[0]; |
|
430 | + if (is_array($map_cat_ids_array) && count($map_cat_ids_array) == 1) { |
|
431 | + $default_cat = (int) $map_cat_ids_array[0]; |
|
432 | 432 | } |
433 | 433 | |
434 | 434 | $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$default_cat]) ? $geodir_cat_icons[$default_cat] : ''; |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | $icon_size = array('w' => 36, 'h' => 45); |
449 | 449 | } |
450 | 450 | |
451 | - $content_data[] = '{"id":"' . $catinfo_obj->post_id . '","t": "' . $title . '","lt": "' . $catinfo_obj->post_latitude . '","ln": "' . $catinfo_obj->post_longitude . '","mk_id":"' . $catinfo_obj->post_id . '_' . $default_cat . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"'.$mark_extra.'}'; |
|
451 | + $content_data[] = '{"id":"'.$catinfo_obj->post_id.'","t": "'.$title.'","lt": "'.$catinfo_obj->post_latitude.'","ln": "'.$catinfo_obj->post_longitude.'","mk_id":"'.$catinfo_obj->post_id.'_'.$default_cat.'","i":"'.$icon.'","w":"'.$icon_size['w'].'","h":"'.$icon_size['h'].'"'.$mark_extra.'}'; |
|
452 | 452 | $post_ids[] = $catinfo_obj->post_id; |
453 | 453 | } |
454 | 454 | } |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | $totalcount = count(array_unique($post_ids)); |
473 | 473 | |
474 | 474 | if (!empty($cat_content_info)) { |
475 | - return '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']'; |
|
475 | + return '[{"totalcount":"'.$totalcount.'",'.substr(implode(',', $cat_content_info), 1).']'; |
|
476 | 476 | } |
477 | 477 | else { |
478 | 478 | return '[{"totalcount":"0"}]'; |
@@ -67,77 +67,77 @@ discard block |
||
67 | 67 | */ |
68 | 68 | function geodir_draw_map($map_args = array()) |
69 | 69 | { |
70 | - global $map_canvas_arr; |
|
71 | - $map_canvas_name = (!empty($map_args) && $map_args['map_canvas_name'] != '') ? $map_args['map_canvas_name'] : 'home_map_canvas'; |
|
72 | - $map_class_name = (!empty($map_args) && isset($map_args['map_class_name'])) ? $map_args['map_class_name'] : ''; |
|
73 | - |
|
74 | - $default_location = geodir_get_default_location(); |
|
75 | - |
|
76 | - $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
77 | - $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
78 | - $map_default_zoom = 12; |
|
79 | - // map options default values |
|
80 | - $width = 950; |
|
81 | - $height = 450; |
|
82 | - $child_collapse = '0'; |
|
83 | - $sticky = ''; |
|
84 | - $enable_cat_filters = false; |
|
85 | - $enable_text_search = false; |
|
86 | - $enable_post_type_filters = false; |
|
87 | - $enable_location_filters = false; |
|
88 | - $enable_jason_on_load = false; |
|
89 | - $enable_map_direction = false; |
|
90 | - $enable_marker_cluster = false; |
|
91 | - $enable_map_resize_button = false; |
|
92 | - $maptype = 'ROADMAP'; |
|
93 | - |
|
94 | - $geodir_map_options = array( |
|
95 | - 'width' => $width, |
|
96 | - 'height' => $height, |
|
97 | - 'child_collapse' => $child_collapse, |
|
98 | - 'sticky' => $sticky, |
|
99 | - 'enable_map_resize_button' => $enable_map_resize_button, |
|
100 | - 'enable_cat_filters' => $enable_cat_filters, |
|
101 | - 'enable_text_search' => $enable_text_search, |
|
102 | - 'enable_post_type_filters' => $enable_post_type_filters, |
|
103 | - 'enable_location_filters' => $enable_location_filters, |
|
104 | - 'enable_jason_on_load' => $enable_jason_on_load, |
|
105 | - 'enable_map_direction' => $enable_map_direction, |
|
106 | - 'enable_marker_cluster' => $enable_marker_cluster, |
|
107 | - 'ajax_url' => geodir_get_ajax_url(), |
|
108 | - 'map_canvas_name' => $map_canvas_name, |
|
109 | - 'inputText' => __('Title or Keyword', 'geodirectory'), |
|
110 | - 'latitude' => $map_default_lat, |
|
111 | - 'longitude' => $map_default_lng, |
|
112 | - 'zoom' => $map_default_zoom, |
|
113 | - 'scrollwheel' => true, |
|
114 | - 'streetViewControl' => true, |
|
115 | - 'maptype' => $maptype, |
|
116 | - 'showPreview' => '0', |
|
117 | - 'maxZoom' => 21, |
|
118 | - 'autozoom' => true, |
|
119 | - 'bubble_size' => 'small', |
|
120 | - 'token' => '68f48005e256696074e1da9bf9f67f06', |
|
121 | - 'navigationControlOptions' => array('position' => 'TOP_LEFT', 'style' => 'ZOOM_PAN') |
|
122 | - ); |
|
123 | - |
|
124 | - if (!empty($map_args)) { |
|
125 | - foreach ($map_args as $map_option_key => $map_option_value) { |
|
126 | - $geodir_map_options[$map_option_key] = $map_option_value; |
|
127 | - } |
|
128 | - } |
|
129 | - |
|
130 | - if (strpos($geodir_map_options['height'], '%') !== false || strpos($geodir_map_options['height'], 'px') !== false || strpos($geodir_map_options['height'], 'vh') !== false) { |
|
131 | - } else { |
|
132 | - $geodir_map_options['height'] = $geodir_map_options['height'] . 'px'; |
|
133 | - } |
|
134 | - |
|
135 | - if (strpos($geodir_map_options['width'], '%') !== false || strpos($geodir_map_options['width'], 'px') !== false) { |
|
136 | - } else { |
|
137 | - $geodir_map_options['width'] = $geodir_map_options['width'] . 'px'; |
|
138 | - } |
|
139 | - |
|
140 | - /** |
|
70 | + global $map_canvas_arr; |
|
71 | + $map_canvas_name = (!empty($map_args) && $map_args['map_canvas_name'] != '') ? $map_args['map_canvas_name'] : 'home_map_canvas'; |
|
72 | + $map_class_name = (!empty($map_args) && isset($map_args['map_class_name'])) ? $map_args['map_class_name'] : ''; |
|
73 | + |
|
74 | + $default_location = geodir_get_default_location(); |
|
75 | + |
|
76 | + $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
77 | + $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
78 | + $map_default_zoom = 12; |
|
79 | + // map options default values |
|
80 | + $width = 950; |
|
81 | + $height = 450; |
|
82 | + $child_collapse = '0'; |
|
83 | + $sticky = ''; |
|
84 | + $enable_cat_filters = false; |
|
85 | + $enable_text_search = false; |
|
86 | + $enable_post_type_filters = false; |
|
87 | + $enable_location_filters = false; |
|
88 | + $enable_jason_on_load = false; |
|
89 | + $enable_map_direction = false; |
|
90 | + $enable_marker_cluster = false; |
|
91 | + $enable_map_resize_button = false; |
|
92 | + $maptype = 'ROADMAP'; |
|
93 | + |
|
94 | + $geodir_map_options = array( |
|
95 | + 'width' => $width, |
|
96 | + 'height' => $height, |
|
97 | + 'child_collapse' => $child_collapse, |
|
98 | + 'sticky' => $sticky, |
|
99 | + 'enable_map_resize_button' => $enable_map_resize_button, |
|
100 | + 'enable_cat_filters' => $enable_cat_filters, |
|
101 | + 'enable_text_search' => $enable_text_search, |
|
102 | + 'enable_post_type_filters' => $enable_post_type_filters, |
|
103 | + 'enable_location_filters' => $enable_location_filters, |
|
104 | + 'enable_jason_on_load' => $enable_jason_on_load, |
|
105 | + 'enable_map_direction' => $enable_map_direction, |
|
106 | + 'enable_marker_cluster' => $enable_marker_cluster, |
|
107 | + 'ajax_url' => geodir_get_ajax_url(), |
|
108 | + 'map_canvas_name' => $map_canvas_name, |
|
109 | + 'inputText' => __('Title or Keyword', 'geodirectory'), |
|
110 | + 'latitude' => $map_default_lat, |
|
111 | + 'longitude' => $map_default_lng, |
|
112 | + 'zoom' => $map_default_zoom, |
|
113 | + 'scrollwheel' => true, |
|
114 | + 'streetViewControl' => true, |
|
115 | + 'maptype' => $maptype, |
|
116 | + 'showPreview' => '0', |
|
117 | + 'maxZoom' => 21, |
|
118 | + 'autozoom' => true, |
|
119 | + 'bubble_size' => 'small', |
|
120 | + 'token' => '68f48005e256696074e1da9bf9f67f06', |
|
121 | + 'navigationControlOptions' => array('position' => 'TOP_LEFT', 'style' => 'ZOOM_PAN') |
|
122 | + ); |
|
123 | + |
|
124 | + if (!empty($map_args)) { |
|
125 | + foreach ($map_args as $map_option_key => $map_option_value) { |
|
126 | + $geodir_map_options[$map_option_key] = $map_option_value; |
|
127 | + } |
|
128 | + } |
|
129 | + |
|
130 | + if (strpos($geodir_map_options['height'], '%') !== false || strpos($geodir_map_options['height'], 'px') !== false || strpos($geodir_map_options['height'], 'vh') !== false) { |
|
131 | + } else { |
|
132 | + $geodir_map_options['height'] = $geodir_map_options['height'] . 'px'; |
|
133 | + } |
|
134 | + |
|
135 | + if (strpos($geodir_map_options['width'], '%') !== false || strpos($geodir_map_options['width'], 'px') !== false) { |
|
136 | + } else { |
|
137 | + $geodir_map_options['width'] = $geodir_map_options['width'] . 'px'; |
|
138 | + } |
|
139 | + |
|
140 | + /** |
|
141 | 141 | * Filter the options to use in google map. |
142 | 142 | * |
143 | 143 | * @since 1.0.0 |
@@ -146,9 +146,9 @@ discard block |
||
146 | 146 | */ |
147 | 147 | $geodir_map_options = apply_filters("geodir_map_options_{$map_canvas_name}", $geodir_map_options); |
148 | 148 | |
149 | - $map_canvas_arr[$map_canvas_name] = array(); |
|
149 | + $map_canvas_arr[$map_canvas_name] = array(); |
|
150 | 150 | |
151 | - /** |
|
151 | + /** |
|
152 | 152 | * Filter the post types to display data on map. |
153 | 153 | * |
154 | 154 | * @since 1.0.0 |
@@ -166,20 +166,20 @@ discard block |
||
166 | 166 | */ |
167 | 167 | $exclude_post_types = apply_filters("geodir_exclude_post_type_on_map_{$map_canvas_name}", get_option('geodir_exclude_post_type_on_map')); |
168 | 168 | |
169 | - if (count((array)$post_types) != count($exclude_post_types) || ($enable_jason_on_load)): |
|
170 | - // Set default map options |
|
169 | + if (count((array)$post_types) != count($exclude_post_types) || ($enable_jason_on_load)): |
|
170 | + // Set default map options |
|
171 | 171 | |
172 | - wp_enqueue_script('geodir-map-widget', geodir_plugin_url() . '/geodirectory-functions/map-functions/js/map.min.js',array(),false,true); |
|
172 | + wp_enqueue_script('geodir-map-widget', geodir_plugin_url() . '/geodirectory-functions/map-functions/js/map.min.js',array(),false,true); |
|
173 | 173 | |
174 | - wp_localize_script('geodir-map-widget', $map_canvas_name, $geodir_map_options); |
|
174 | + wp_localize_script('geodir-map-widget', $map_canvas_name, $geodir_map_options); |
|
175 | 175 | |
176 | - if ($map_canvas_name == 'detail_page_map_canvas' || $map_canvas_name == 'preview_map_canvas') { |
|
177 | - $map_width = '100%'; |
|
178 | - } else { |
|
179 | - $map_width = $geodir_map_options['width']; |
|
180 | - } |
|
176 | + if ($map_canvas_name == 'detail_page_map_canvas' || $map_canvas_name == 'preview_map_canvas') { |
|
177 | + $map_width = '100%'; |
|
178 | + } else { |
|
179 | + $map_width = $geodir_map_options['width']; |
|
180 | + } |
|
181 | 181 | |
182 | - /** |
|
182 | + /** |
|
183 | 183 | * Filter the width of map. |
184 | 184 | * |
185 | 185 | * @since 1.0.0 |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | * @param int $map_width Width of map box, eg: gd_place. |
188 | 188 | */ |
189 | 189 | $map_width = apply_filters('geodir_change_map_width', $map_width); |
190 | - ?> |
|
190 | + ?> |
|
191 | 191 | <div id="catcher_<?php echo $map_canvas_name;?>"></div> |
192 | 192 | <div class="stick_trigger_container"> |
193 | 193 | <div class="trigger_sticky triggeroff_sticky"></div> |
@@ -221,15 +221,15 @@ discard block |
||
221 | 221 | <?php if ($geodir_map_options['enable_jason_on_load']) { ?> |
222 | 222 | <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="1"/> |
223 | 223 | <?php } else { |
224 | - ?> |
|
224 | + ?> |
|
225 | 225 | <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="0"/> |
226 | 226 | <?php } |
227 | 227 | |
228 | - if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters']) |
|
229 | - $show_entire_cat_panel = "none"; |
|
230 | - else |
|
231 | - $show_entire_cat_panel = "''"; |
|
232 | - ?> |
|
228 | + if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters']) |
|
229 | + $show_entire_cat_panel = "none"; |
|
230 | + else |
|
231 | + $show_entire_cat_panel = "''"; |
|
232 | + ?> |
|
233 | 233 | |
234 | 234 | <?php if ($geodir_map_options['enable_map_direction']) { ?> |
235 | 235 | <div class="gd-input-group gd-get-directions"> |
@@ -292,8 +292,8 @@ discard block |
||
292 | 292 | <select id="travel-units" onchange="calcRoute('<?php echo $map_canvas_name; ?>')"> |
293 | 293 | <option value="miles"><?php _e('Miles', 'geodirectory'); ?></option> |
294 | 294 | <option <?php if (get_option('geodir_search_dist_1') == 'km') { |
295 | - echo 'selected="selected"'; |
|
296 | - } ?> value="kilometers"><?php _e('Kilometers', 'geodirectory'); ?></option> |
|
295 | + echo 'selected="selected"'; |
|
296 | + } ?> value="kilometers"><?php _e('Kilometers', 'geodirectory'); ?></option> |
|
297 | 297 | </select> |
298 | 298 | </div> |
299 | 299 | |
@@ -305,12 +305,12 @@ discard block |
||
305 | 305 | if (empty($geodir_default_map_search_pt)) |
306 | 306 | $geodir_default_map_search_pt = 'gd_place'; |
307 | 307 | |
308 | - global $gd_session; |
|
309 | - $homemap_catlist_ptype = $gd_session->get('homemap_catlist_ptype'); |
|
308 | + global $gd_session; |
|
309 | + $homemap_catlist_ptype = $gd_session->get('homemap_catlist_ptype'); |
|
310 | 310 | |
311 | - if ($homemap_catlist_ptype) { |
|
312 | - $geodir_default_map_search_pt = $homemap_catlist_ptype; |
|
313 | - } |
|
311 | + if ($homemap_catlist_ptype) { |
|
312 | + $geodir_default_map_search_pt = $homemap_catlist_ptype; |
|
313 | + } |
|
314 | 314 | |
315 | 315 | /** |
316 | 316 | * Filter the post type to retrieve data for map |
@@ -323,13 +323,13 @@ discard block |
||
323 | 323 | ?> |
324 | 324 | <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel;?>"> |
325 | 325 | <?php |
326 | - $exclude_post_types = get_option('geodir_exclude_post_type_on_map'); |
|
327 | - $geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types); |
|
326 | + $exclude_post_types = get_option('geodir_exclude_post_type_on_map'); |
|
327 | + $geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types); |
|
328 | 328 | $map_cat_class = ''; |
329 | 329 | if ($geodir_map_options['enable_post_type_filters']) { |
330 | 330 | $map_cat_class = $geodir_available_pt_on_map > 1 ? ' map-cat-ptypes' : ' map-cat-floor'; |
331 | 331 | } |
332 | - ?> |
|
332 | + ?> |
|
333 | 333 | <div |
334 | 334 | class="map-category-listing<?php echo $map_cat_class;?>"> |
335 | 335 | <div class="gd-trigger gd-triggeroff"><i class="fa fa-compress"></i><i class="fa fa-expand"></i></div> |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | <?php if ($geodir_map_options['child_collapse']) { $child_collapse = "1"; ?> |
348 | 348 | <input type="hidden" id="<?php echo $map_canvas_name; ?>_child_collapse" value="1"/> |
349 | 349 | <?php } else {$child_collapse = "0"; |
350 | - ?> |
|
350 | + ?> |
|
351 | 351 | <input type="hidden" id="<?php echo $map_canvas_name;?>_child_collapse" value="0"/> |
352 | 352 | <?php } ?> |
353 | 353 | <input type="hidden" id="<?php echo $map_canvas_name; ?>_cat_enabled" value="1"/> |
@@ -369,18 +369,18 @@ discard block |
||
369 | 369 | <!-- map-category-listings--> |
370 | 370 | |
371 | 371 | <?php |
372 | - if ($geodir_map_options['enable_location_filters']) { |
|
373 | - $country = get_query_var('gd_country'); |
|
372 | + if ($geodir_map_options['enable_location_filters']) { |
|
373 | + $country = get_query_var('gd_country'); |
|
374 | 374 | $region = get_query_var('gd_region'); |
375 | 375 | $city = get_query_var('gd_city'); |
376 | - $gd_neighbourhood = get_query_var('gd_neighbourhood'); |
|
376 | + $gd_neighbourhood = get_query_var('gd_neighbourhood'); |
|
377 | 377 | |
378 | - //fix for location/me page |
|
379 | - $country = $country != 'me' ? $country : ''; |
|
378 | + //fix for location/me page |
|
379 | + $country = $country != 'me' ? $country : ''; |
|
380 | 380 | $region = $region != 'me' ? $region : ''; |
381 | 381 | $city = $country != 'me' ? $city : ''; |
382 | - $gd_neighbourhood = $country != 'me' ? $gd_neighbourhood : ''; |
|
383 | - ?> |
|
382 | + $gd_neighbourhood = $country != 'me' ? $gd_neighbourhood : ''; |
|
383 | + ?> |
|
384 | 384 | <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="1"/> |
385 | 385 | <input type="hidden" id="<?php echo $map_canvas_name;?>_country" name="gd_country" |
386 | 386 | value="<?php echo $country;?>"/> |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | <input type="hidden" id="<?php echo $map_canvas_name;?>_neighbourhood" name="gd_neighbourhood" |
392 | 392 | value="<?php echo $gd_neighbourhood;?>"/> |
393 | 393 | <?php } else { //end of location filter |
394 | - ?> |
|
394 | + ?> |
|
395 | 395 | <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="0"/> |
396 | 396 | <?php }?> |
397 | 397 | |
@@ -402,16 +402,16 @@ discard block |
||
402 | 402 | |
403 | 403 | |
404 | 404 | <?php if ($geodir_map_options['enable_post_type_filters']) { |
405 | - $post_types = geodir_get_posttypes('object'); |
|
406 | - $all_post_types = geodir_get_posttypes('names'); |
|
407 | - $exclude_post_types = get_option('geodir_exclude_post_type_on_map'); |
|
408 | - if (is_array($exclude_post_types)) { |
|
409 | - $map_post_types = array_diff($all_post_types, $exclude_post_types); |
|
410 | - } else { |
|
411 | - $map_post_types = $all_post_types; |
|
412 | - } |
|
413 | - if (count($map_post_types) > 1) { |
|
414 | - ?> |
|
405 | + $post_types = geodir_get_posttypes('object'); |
|
406 | + $all_post_types = geodir_get_posttypes('names'); |
|
407 | + $exclude_post_types = get_option('geodir_exclude_post_type_on_map'); |
|
408 | + if (is_array($exclude_post_types)) { |
|
409 | + $map_post_types = array_diff($all_post_types, $exclude_post_types); |
|
410 | + } else { |
|
411 | + $map_post_types = $all_post_types; |
|
412 | + } |
|
413 | + if (count($map_post_types) > 1) { |
|
414 | + ?> |
|
415 | 415 | <div class="map-places-listing" id="<?php echo $map_canvas_name;?>_posttype_menu" |
416 | 416 | style="max-width:<?php echo $map_width;?>!important;"> |
417 | 417 | |
@@ -421,13 +421,13 @@ discard block |
||
421 | 421 | <?php |
422 | 422 | |
423 | 423 | |
424 | - foreach ($post_types as $post_type => $args) { |
|
425 | - if (!in_array($post_type, $exclude_post_types)) { |
|
426 | - $class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : ''; |
|
424 | + foreach ($post_types as $post_type => $args) { |
|
425 | + if (!in_array($post_type, $exclude_post_types)) { |
|
426 | + $class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : ''; |
|
427 | 427 | 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)">' . __($args->labels->name, 'geodirectory') . '</a></li>'; |
428 | - } |
|
429 | - } |
|
430 | - ?> |
|
428 | + } |
|
429 | + } |
|
430 | + ?> |
|
431 | 431 | </ul> |
432 | 432 | <?php if (isset($geodir_map_options['is_geodir_home_map_widget']) && $map_args['is_geodir_home_map_widget']) { ?> |
433 | 433 | </div><?php } ?> |
@@ -441,8 +441,8 @@ discard block |
||
441 | 441 | |
442 | 442 | </div> <!-- map-places-listings--> |
443 | 443 | <?php } |
444 | - } // end of post type filter if |
|
445 | - ?> |
|
444 | + } // end of post type filter if |
|
445 | + ?> |
|
446 | 446 | |
447 | 447 | </div> |
448 | 448 | </div> <!--end of stick trigger container--> |
@@ -457,8 +457,8 @@ discard block |
||
457 | 457 | </script> |
458 | 458 | <?php |
459 | 459 | |
460 | - if (strpos($geodir_map_options['height'], 'vh')) { |
|
461 | - ?> |
|
460 | + if (strpos($geodir_map_options['height'], 'vh')) { |
|
461 | + ?> |
|
462 | 462 | <script> |
463 | 463 | (function () { |
464 | 464 | var screenH = jQuery(window).height(); |
@@ -480,8 +480,8 @@ discard block |
||
480 | 480 | |
481 | 481 | <?php |
482 | 482 | |
483 | - } elseif (strpos($geodir_map_options['height'], 'px')) { |
|
484 | - ?> |
|
483 | + } elseif (strpos($geodir_map_options['height'], 'px')) { |
|
484 | + ?> |
|
485 | 485 | <script> |
486 | 486 | (function () { |
487 | 487 | var screenH = jQuery(window).height(); |
@@ -496,20 +496,20 @@ discard block |
||
496 | 496 | }()); |
497 | 497 | </script> |
498 | 498 | <?php |
499 | - } |
|
499 | + } |
|
500 | 500 | |
501 | - /** |
|
502 | - * Action that runs after all the map code has been output; |
|
503 | - * |
|
504 | - * @since 1.5.3 |
|
505 | - * |
|
506 | - * @param array $geodir_map_options Array of map settings. |
|
507 | - * @param string $map_canvas_name The canvas name and ID for the map. |
|
508 | - */ |
|
509 | - do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name); |
|
501 | + /** |
|
502 | + * Action that runs after all the map code has been output; |
|
503 | + * |
|
504 | + * @since 1.5.3 |
|
505 | + * |
|
506 | + * @param array $geodir_map_options Array of map settings. |
|
507 | + * @param string $map_canvas_name The canvas name and ID for the map. |
|
508 | + */ |
|
509 | + do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name); |
|
510 | 510 | |
511 | 511 | |
512 | - endif; // Exclude posttypes if end |
|
512 | + endif; // Exclude posttypes if end |
|
513 | 513 | } |
514 | 514 | |
515 | 515 | /** |
@@ -129,12 +129,12 @@ discard block |
||
129 | 129 | |
130 | 130 | if (strpos($geodir_map_options['height'], '%') !== false || strpos($geodir_map_options['height'], 'px') !== false || strpos($geodir_map_options['height'], 'vh') !== false) { |
131 | 131 | } else { |
132 | - $geodir_map_options['height'] = $geodir_map_options['height'] . 'px'; |
|
132 | + $geodir_map_options['height'] = $geodir_map_options['height'].'px'; |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | if (strpos($geodir_map_options['width'], '%') !== false || strpos($geodir_map_options['width'], 'px') !== false) { |
136 | 136 | } else { |
137 | - $geodir_map_options['width'] = $geodir_map_options['width'] . 'px'; |
|
137 | + $geodir_map_options['width'] = $geodir_map_options['width'].'px'; |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -166,10 +166,10 @@ discard block |
||
166 | 166 | */ |
167 | 167 | $exclude_post_types = apply_filters("geodir_exclude_post_type_on_map_{$map_canvas_name}", get_option('geodir_exclude_post_type_on_map')); |
168 | 168 | |
169 | - if (count((array)$post_types) != count($exclude_post_types) || ($enable_jason_on_load)): |
|
169 | + if (count((array) $post_types) != count($exclude_post_types) || ($enable_jason_on_load)): |
|
170 | 170 | // Set default map options |
171 | 171 | |
172 | - wp_enqueue_script('geodir-map-widget', geodir_plugin_url() . '/geodirectory-functions/map-functions/js/map.min.js',array(),false,true); |
|
172 | + wp_enqueue_script('geodir-map-widget', geodir_plugin_url().'/geodirectory-functions/map-functions/js/map.min.js', array(), false, true); |
|
173 | 173 | |
174 | 174 | wp_localize_script('geodir-map-widget', $map_canvas_name, $geodir_map_options); |
175 | 175 | |
@@ -188,41 +188,41 @@ discard block |
||
188 | 188 | */ |
189 | 189 | $map_width = apply_filters('geodir_change_map_width', $map_width); |
190 | 190 | ?> |
191 | - <div id="catcher_<?php echo $map_canvas_name;?>"></div> |
|
191 | + <div id="catcher_<?php echo $map_canvas_name; ?>"></div> |
|
192 | 192 | <div class="stick_trigger_container"> |
193 | 193 | <div class="trigger_sticky triggeroff_sticky"></div> |
194 | - <div class="top_banner_section geodir_map_container <?php echo $map_class_name;?>" |
|
195 | - id="sticky_map_<?php echo $map_canvas_name;?>" |
|
196 | - style="min-height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;"> |
|
194 | + <div class="top_banner_section geodir_map_container <?php echo $map_class_name; ?>" |
|
195 | + id="sticky_map_<?php echo $map_canvas_name; ?>" |
|
196 | + style="min-height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;"> |
|
197 | 197 | |
198 | 198 | <div class="map_background"> |
199 | 199 | <div class="top_banner_section_in clearfix"> |
200 | - <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> |
|
201 | - <div class="<?php echo $map_canvas_name;?>_TopRight TopRight"></div> |
|
202 | - <div id="<?php echo $map_canvas_name;?>_wrapper" class="main_map_wrapper" |
|
203 | - style="height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;"> |
|
200 | + <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> |
|
201 | + <div class="<?php echo $map_canvas_name; ?>_TopRight TopRight"></div> |
|
202 | + <div id="<?php echo $map_canvas_name; ?>_wrapper" class="main_map_wrapper" |
|
203 | + style="height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;"> |
|
204 | 204 | <!-- new map start --> |
205 | 205 | <div class="iprelative"> |
206 | - <div class="geodir_marker_cluster" id="<?php echo $map_canvas_name;?>" |
|
207 | - style="height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;"></div> |
|
208 | - <div id="<?php echo $map_canvas_name;?>_loading_div" class="loading_div" |
|
209 | - style=" height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;"></div> |
|
206 | + <div class="geodir_marker_cluster" id="<?php echo $map_canvas_name; ?>" |
|
207 | + style="height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;"></div> |
|
208 | + <div id="<?php echo $map_canvas_name; ?>_loading_div" class="loading_div" |
|
209 | + style=" height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;"></div> |
|
210 | 210 | <!--<div id="home_map_counter"></div> --> |
211 | - <div id="<?php echo $map_canvas_name;?>_map_nofound" |
|
211 | + <div id="<?php echo $map_canvas_name; ?>_map_nofound" |
|
212 | 212 | class="advmap_nofound"><?php echo MAP_NO_RESULTS; ?></div> |
213 | - <div id="<?php echo $map_canvas_name;?>_map_notloaded" |
|
213 | + <div id="<?php echo $map_canvas_name; ?>_map_notloaded" |
|
214 | 214 | class="advmap_notloaded"><?php _e('<h3>Google Map Not Loaded</h3><p>Sorry, unable to load Google Maps API.', 'geodirectory'); ?></div> |
215 | 215 | </div> |
216 | 216 | <!-- new map end --> |
217 | 217 | </div> |
218 | - <div class="<?php echo $map_canvas_name;?>_BottomLeft BottomLeft"></div> |
|
218 | + <div class="<?php echo $map_canvas_name; ?>_BottomLeft BottomLeft"></div> |
|
219 | 219 | </div> |
220 | 220 | </div> |
221 | 221 | <?php if ($geodir_map_options['enable_jason_on_load']) { ?> |
222 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="1"/> |
|
222 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_jason_enabled" value="1"/> |
|
223 | 223 | <?php } else { |
224 | 224 | ?> |
225 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="0"/> |
|
225 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_jason_enabled" value="0"/> |
|
226 | 226 | <?php } |
227 | 227 | |
228 | 228 | if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters']) |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | <div class="gd-input-group-addon gd-directions-right gd-mylocation-go"><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; ?>')" /></div> |
243 | 243 | </div> |
244 | 244 | <script> |
245 | - <?php if(geodir_is_page('detail')){?> |
|
245 | + <?php if (geodir_is_page('detail')) {?> |
|
246 | 246 | jQuery(function () { |
247 | 247 | gd_initialize_ac(); |
248 | 248 | }); |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | // Create the autocomplete object, restricting the search |
254 | 254 | // to geographical location types. |
255 | 255 | autocomplete = new google.maps.places.Autocomplete( |
256 | - /** @type {HTMLInputElement} */(document.getElementById('<?php echo $map_canvas_name;?>_fromAddress')), |
|
256 | + /** @type {HTMLInputElement} */(document.getElementById('<?php echo $map_canvas_name; ?>_fromAddress')), |
|
257 | 257 | {types: ['geocode']}); |
258 | 258 | // When the user selects an address from the dropdown, |
259 | 259 | // populate the address fields in the form. |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | |
268 | 268 | if (window.gdMaps == 'osm') { |
269 | 269 | window.setTimeout(function() { |
270 | - calcRoute('<?php echo $map_canvas_name;?>'); |
|
270 | + calcRoute('<?php echo $map_canvas_name; ?>'); |
|
271 | 271 | }, 1000); |
272 | 272 | } |
273 | 273 | } |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | */ |
322 | 322 | $map_search_pt = apply_filters('geodir_default_map_search_pt', $geodir_default_map_search_pt); |
323 | 323 | ?> |
324 | - <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel;?>"> |
|
324 | + <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel; ?>"> |
|
325 | 325 | <?php |
326 | 326 | $exclude_post_types = get_option('geodir_exclude_post_type_on_map'); |
327 | 327 | $geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types); |
@@ -331,12 +331,12 @@ discard block |
||
331 | 331 | } |
332 | 332 | ?> |
333 | 333 | <div |
334 | - class="map-category-listing<?php echo $map_cat_class;?>"> |
|
334 | + class="map-category-listing<?php echo $map_cat_class; ?>"> |
|
335 | 335 | <div class="gd-trigger gd-triggeroff"><i class="fa fa-compress"></i><i class="fa fa-expand"></i></div> |
336 | - <div id="<?php echo $map_canvas_name;?>_cat" |
|
337 | - class="<?php echo $map_canvas_name;?>_map_category map_category" |
|
338 | - <?php if ($child_collapse){ ?>checked="checked" <?php }?> |
|
339 | - style="max-height:<?php echo $geodir_map_options['height'];?>;"> |
|
336 | + <div id="<?php echo $map_canvas_name; ?>_cat" |
|
337 | + class="<?php echo $map_canvas_name; ?>_map_category map_category" |
|
338 | + <?php if ($child_collapse) { ?>checked="checked" <?php }?> |
|
339 | + style="max-height:<?php echo $geodir_map_options['height']; ?>;"> |
|
340 | 340 | <input |
341 | 341 | onkeydown="if(event.keyCode == 13){build_map_ajax_search_param('<?php echo $map_canvas_name; ?>', false)}" |
342 | 342 | type="text" |
@@ -348,11 +348,11 @@ discard block |
||
348 | 348 | <input type="hidden" id="<?php echo $map_canvas_name; ?>_child_collapse" value="1"/> |
349 | 349 | <?php } else {$child_collapse = "0"; |
350 | 350 | ?> |
351 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_child_collapse" value="0"/> |
|
351 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_child_collapse" value="0"/> |
|
352 | 352 | <?php } ?> |
353 | 353 | <input type="hidden" id="<?php echo $map_canvas_name; ?>_cat_enabled" value="1"/> |
354 | 354 | <div class="geodir_toggle"> |
355 | - <?php echo home_map_taxonomy_walker(array($map_search_pt.'category'),0,true,0,$map_canvas_name,$child_collapse,true); ?> |
|
355 | + <?php echo home_map_taxonomy_walker(array($map_search_pt.'category'), 0, true, 0, $map_canvas_name, $child_collapse, true); ?> |
|
356 | 356 | <script>jQuery( document ).ready(function() { |
357 | 357 | geodir_show_sub_cat_collapse_button(); |
358 | 358 | });</script> |
@@ -381,21 +381,21 @@ discard block |
||
381 | 381 | $city = $country != 'me' ? $city : ''; |
382 | 382 | $gd_neighbourhood = $country != 'me' ? $gd_neighbourhood : ''; |
383 | 383 | ?> |
384 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="1"/> |
|
385 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_country" name="gd_country" |
|
386 | - value="<?php echo $country;?>"/> |
|
387 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_region" name="gd_region" |
|
388 | - value="<?php echo $region;?>"/> |
|
389 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_city" name="gd_city" |
|
390 | - value="<?php echo $city;?>"/> |
|
391 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_neighbourhood" name="gd_neighbourhood" |
|
392 | - value="<?php echo $gd_neighbourhood;?>"/> |
|
384 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_location_enabled" value="1"/> |
|
385 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_country" name="gd_country" |
|
386 | + value="<?php echo $country; ?>"/> |
|
387 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_region" name="gd_region" |
|
388 | + value="<?php echo $region; ?>"/> |
|
389 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_city" name="gd_city" |
|
390 | + value="<?php echo $city; ?>"/> |
|
391 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_neighbourhood" name="gd_neighbourhood" |
|
392 | + value="<?php echo $gd_neighbourhood; ?>"/> |
|
393 | 393 | <?php } else { //end of location filter |
394 | 394 | ?> |
395 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="0"/> |
|
395 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_location_enabled" value="0"/> |
|
396 | 396 | <?php }?> |
397 | 397 | |
398 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_posttype" name="gd_posttype" value="<?php echo $map_search_pt;?>"/> |
|
398 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_posttype" name="gd_posttype" value="<?php echo $map_search_pt; ?>"/> |
|
399 | 399 | |
400 | 400 | <input type="hidden" name="limitstart" value=""/> |
401 | 401 | |
@@ -412,8 +412,8 @@ discard block |
||
412 | 412 | } |
413 | 413 | if (count($map_post_types) > 1) { |
414 | 414 | ?> |
415 | - <div class="map-places-listing" id="<?php echo $map_canvas_name;?>_posttype_menu" |
|
416 | - style="max-width:<?php echo $map_width;?>!important;"> |
|
415 | + <div class="map-places-listing" id="<?php echo $map_canvas_name; ?>_posttype_menu" |
|
416 | + style="max-width:<?php echo $map_width; ?>!important;"> |
|
417 | 417 | |
418 | 418 | <?php if (isset($geodir_map_options['is_geodir_home_map_widget']) && $map_args['is_geodir_home_map_widget']) { ?> |
419 | 419 | <div class="geodir-map-posttype-list"><?php } ?> |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | foreach ($post_types as $post_type => $args) { |
425 | 425 | if (!in_array($post_type, $exclude_post_types)) { |
426 | 426 | $class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : ''; |
427 | - 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)">' . __($args->labels->name, 'geodirectory') . '</a></li>'; |
|
427 | + 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)">'.__($args->labels->name, 'geodirectory').'</a></li>'; |
|
428 | 428 | } |
429 | 429 | } |
430 | 430 | ?> |
@@ -449,9 +449,9 @@ discard block |
||
449 | 449 | <script type="text/javascript"> |
450 | 450 | |
451 | 451 | jQuery(document).ready(function () { |
452 | - //initMap('<?php echo $map_canvas_name;?>'); // depreciated, no need to load this twice |
|
453 | - build_map_ajax_search_param('<?php echo $map_canvas_name;?>', false); |
|
454 | - map_sticky('<?php echo $map_canvas_name;?>'); |
|
452 | + //initMap('<?php echo $map_canvas_name; ?>'); // depreciated, no need to load this twice |
|
453 | + build_map_ajax_search_param('<?php echo $map_canvas_name; ?>', false); |
|
454 | + map_sticky('<?php echo $map_canvas_name; ?>'); |
|
455 | 455 | }); |
456 | 456 | |
457 | 457 | </script> |
@@ -462,18 +462,18 @@ discard block |
||
462 | 462 | <script> |
463 | 463 | (function () { |
464 | 464 | var screenH = jQuery(window).height(); |
465 | - var heightVH = "<?php echo str_replace("vh", "", $geodir_map_options['height']);?>"; |
|
465 | + var heightVH = "<?php echo str_replace("vh", "", $geodir_map_options['height']); ?>"; |
|
466 | 466 | |
467 | 467 | var ptypeH = ''; |
468 | - if (jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").length) { |
|
469 | - ptypeH = jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").outerHeight(); |
|
468 | + if (jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").length) { |
|
469 | + ptypeH = jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").outerHeight(); |
|
470 | 470 | } |
471 | 471 | |
472 | - jQuery("#sticky_map_<?php echo $map_canvas_name;?>").css("min-height", screenH * (heightVH / 100) + 'px'); |
|
473 | - jQuery("#<?php echo $map_canvas_name;?>_wrapper").height(screenH * (heightVH / 100) + 'px'); |
|
474 | - jQuery("#<?php echo $map_canvas_name;?>").height(screenH * (heightVH / 100) + 'px'); |
|
475 | - jQuery("#<?php echo $map_canvas_name;?>_loading_div").height(screenH * (heightVH / 100) + 'px'); |
|
476 | - jQuery("#<?php echo $map_canvas_name;?>_cat").css("max-height", (screenH * (heightVH / 100)) - ptypeH + 'px'); |
|
472 | + jQuery("#sticky_map_<?php echo $map_canvas_name; ?>").css("min-height", screenH * (heightVH / 100) + 'px'); |
|
473 | + jQuery("#<?php echo $map_canvas_name; ?>_wrapper").height(screenH * (heightVH / 100) + 'px'); |
|
474 | + jQuery("#<?php echo $map_canvas_name; ?>").height(screenH * (heightVH / 100) + 'px'); |
|
475 | + jQuery("#<?php echo $map_canvas_name; ?>_loading_div").height(screenH * (heightVH / 100) + 'px'); |
|
476 | + jQuery("#<?php echo $map_canvas_name; ?>_cat").css("max-height", (screenH * (heightVH / 100)) - ptypeH + 'px'); |
|
477 | 477 | |
478 | 478 | }()); |
479 | 479 | </script> |
@@ -485,13 +485,13 @@ discard block |
||
485 | 485 | <script> |
486 | 486 | (function () { |
487 | 487 | var screenH = jQuery(window).height(); |
488 | - var heightVH = "<?php echo str_replace("px", "", $geodir_map_options['height']);?>"; |
|
488 | + var heightVH = "<?php echo str_replace("px", "", $geodir_map_options['height']); ?>"; |
|
489 | 489 | var ptypeH = ''; |
490 | - if (jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").length) { |
|
491 | - ptypeH = jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").outerHeight(); |
|
490 | + if (jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").length) { |
|
491 | + ptypeH = jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").outerHeight(); |
|
492 | 492 | } |
493 | 493 | |
494 | - jQuery("#<?php echo $map_canvas_name;?>_cat").css("max-height", heightVH - ptypeH + 'px'); |
|
494 | + jQuery("#<?php echo $map_canvas_name; ?>_cat").css("max-height", heightVH - ptypeH + 'px'); |
|
495 | 495 | |
496 | 496 | }()); |
497 | 497 | </script> |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | * @param array $geodir_map_options Array of map settings. |
507 | 507 | * @param string $map_canvas_name The canvas name and ID for the map. |
508 | 508 | */ |
509 | - do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name); |
|
509 | + do_action('geodir_map_after_render', $geodir_map_options, $map_canvas_name); |
|
510 | 510 | |
511 | 511 | |
512 | 512 | endif; // Exclude posttypes if end |