@@ -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 | /** |
@@ -79,80 +79,80 @@ discard block |
||
79 | 79 | * @return string |
80 | 80 | */ |
81 | 81 | function get_markers() { |
82 | - global $wpdb, $plugin_prefix, $geodir_cat_icons, $gd_marker_sizes; |
|
82 | + global $wpdb, $plugin_prefix, $geodir_cat_icons, $gd_marker_sizes; |
|
83 | 83 | |
84 | - $search = ''; |
|
85 | - $main_query_array; |
|
84 | + $search = ''; |
|
85 | + $main_query_array; |
|
86 | 86 | |
87 | - $srcharr = array("'", "/", "-", '"', '\\', '''); |
|
88 | - $replarr = array("′", "⁄", "–", "“", '', "′"); |
|
87 | + $srcharr = array("'", "/", "-", '"', '\\', '''); |
|
88 | + $replarr = array("′", "⁄", "–", "“", '', "′"); |
|
89 | 89 | |
90 | - $post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place'; |
|
90 | + $post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place'; |
|
91 | 91 | |
92 | - $map_cat_ids_array = array('0'); |
|
93 | - $cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)"); |
|
92 | + $map_cat_ids_array = array('0'); |
|
93 | + $cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)"); |
|
94 | 94 | |
95 | 95 | |
96 | - $field_default_cat = ''; |
|
97 | - if (isset($_REQUEST['cat_id']) && $_REQUEST['cat_id'] != '') { |
|
98 | - $map_cat_arr = trim($_REQUEST['cat_id'], ','); |
|
96 | + $field_default_cat = ''; |
|
97 | + if (isset($_REQUEST['cat_id']) && $_REQUEST['cat_id'] != '') { |
|
98 | + $map_cat_arr = trim($_REQUEST['cat_id'], ','); |
|
99 | 99 | |
100 | - if (!empty($map_cat_arr)) { |
|
101 | - $field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category "; |
|
100 | + if (!empty($map_cat_arr)) { |
|
101 | + $field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category "; |
|
102 | 102 | |
103 | - $map_cat_ids_array = explode(',', $map_cat_arr); |
|
104 | - $cat_find_array = array(); |
|
105 | - foreach ($map_cat_ids_array as $cat_id) { |
|
106 | - $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id "; |
|
107 | - $cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)"; |
|
108 | - $main_query_array[] = $cat_id; |
|
109 | - } |
|
103 | + $map_cat_ids_array = explode(',', $map_cat_arr); |
|
104 | + $cat_find_array = array(); |
|
105 | + foreach ($map_cat_ids_array as $cat_id) { |
|
106 | + $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id "; |
|
107 | + $cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)"; |
|
108 | + $main_query_array[] = $cat_id; |
|
109 | + } |
|
110 | 110 | |
111 | - } |
|
112 | - } |
|
111 | + } |
|
112 | + } |
|
113 | 113 | |
114 | - if (!empty($field_default_cat)) |
|
115 | - $field_default_cat = ''; |
|
114 | + if (!empty($field_default_cat)) |
|
115 | + $field_default_cat = ''; |
|
116 | 116 | |
117 | - if (!empty($cat_find_array)) |
|
118 | - $search .= "AND (" . implode(' OR ', $cat_find_array) . ")"; |
|
117 | + if (!empty($cat_find_array)) |
|
118 | + $search .= "AND (" . implode(' OR ', $cat_find_array) . ")"; |
|
119 | 119 | |
120 | - $main_query_array = $map_cat_ids_array; |
|
120 | + $main_query_array = $map_cat_ids_array; |
|
121 | 121 | |
122 | - if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) { |
|
123 | - $search .= " AND p.post_title LIKE %s"; |
|
124 | - $main_query_array[] = "%" . $_REQUEST['search'] . "%"; |
|
125 | - } |
|
126 | - |
|
127 | - /** |
|
128 | - * Filter the marker query search SQL, values are replaces with %s or %d. |
|
129 | - * |
|
130 | - * @since 1.5.3 |
|
131 | - * |
|
132 | - * @param string $search The SQL query for search/where. |
|
133 | - */ |
|
134 | - $search = apply_filters('geodir_marker_search', $search); |
|
135 | - /** |
|
136 | - * Filter the marker query search SQL values %s and %d, this is an array of values. |
|
137 | - * |
|
138 | - * @since 1.5.3 |
|
139 | - * |
|
140 | - * @param array $main_query_array The SQL query values for search/where. |
|
141 | - */ |
|
142 | - $main_query_array = apply_filters('geodir_marker_main_query_array', $main_query_array); |
|
143 | - |
|
144 | - $gd_posttype = ''; |
|
145 | - if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') { |
|
146 | - $table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail'; |
|
147 | - $gd_posttype = " AND p.post_type = %s"; |
|
148 | - $main_query_array[] = $_REQUEST['gd_posttype']; |
|
149 | - |
|
150 | - } else |
|
151 | - $table = $plugin_prefix . 'gd_place_detail'; |
|
152 | - |
|
153 | - $join = ", " . $table . " AS pd "; |
|
154 | - |
|
155 | - /** |
|
122 | + if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) { |
|
123 | + $search .= " AND p.post_title LIKE %s"; |
|
124 | + $main_query_array[] = "%" . $_REQUEST['search'] . "%"; |
|
125 | + } |
|
126 | + |
|
127 | + /** |
|
128 | + * Filter the marker query search SQL, values are replaces with %s or %d. |
|
129 | + * |
|
130 | + * @since 1.5.3 |
|
131 | + * |
|
132 | + * @param string $search The SQL query for search/where. |
|
133 | + */ |
|
134 | + $search = apply_filters('geodir_marker_search', $search); |
|
135 | + /** |
|
136 | + * Filter the marker query search SQL values %s and %d, this is an array of values. |
|
137 | + * |
|
138 | + * @since 1.5.3 |
|
139 | + * |
|
140 | + * @param array $main_query_array The SQL query values for search/where. |
|
141 | + */ |
|
142 | + $main_query_array = apply_filters('geodir_marker_main_query_array', $main_query_array); |
|
143 | + |
|
144 | + $gd_posttype = ''; |
|
145 | + if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') { |
|
146 | + $table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail'; |
|
147 | + $gd_posttype = " AND p.post_type = %s"; |
|
148 | + $main_query_array[] = $_REQUEST['gd_posttype']; |
|
149 | + |
|
150 | + } else |
|
151 | + $table = $plugin_prefix . 'gd_place_detail'; |
|
152 | + |
|
153 | + $join = ", " . $table . " AS pd "; |
|
154 | + |
|
155 | + /** |
|
156 | 156 | * Filter the SQL JOIN clause for the markers data |
157 | 157 | * |
158 | 158 | * @since 1.0.0 |
@@ -169,16 +169,16 @@ discard block |
||
169 | 169 | * @param string $search Row of searched fields to use in WHERE clause. |
170 | 170 | */ |
171 | 171 | $search = apply_filters('geodir_home_map_listing_where', $search); |
172 | - $search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search); |
|
173 | - $cat_type = $post_type . 'category'; |
|
174 | - if ($post_type == 'gd_event') { |
|
175 | - $event_select = ", pd.recurring_dates, pd.is_recurring"; |
|
176 | - } else { |
|
177 | - $event_select = ""; |
|
178 | - } |
|
179 | - |
|
180 | - $sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select; |
|
181 | - /** |
|
172 | + $search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search); |
|
173 | + $cat_type = $post_type . 'category'; |
|
174 | + if ($post_type == 'gd_event') { |
|
175 | + $event_select = ", pd.recurring_dates, pd.is_recurring"; |
|
176 | + } else { |
|
177 | + $event_select = ""; |
|
178 | + } |
|
179 | + |
|
180 | + $sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select; |
|
181 | + /** |
|
182 | 182 | * Filter the SQL SELECT clause to retrive fields data |
183 | 183 | * |
184 | 184 | * @since 1.0.0 |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | */ |
198 | 198 | $groupby = apply_filters('geodir_home_map_listing_groupby', $groupby); |
199 | 199 | |
200 | - $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); |
|
200 | + $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); |
|
201 | 201 | |
202 | 202 | /** |
203 | 203 | * Filter the SQL query to retrive markers data |
@@ -209,133 +209,133 @@ discard block |
||
209 | 209 | */ |
210 | 210 | $catsql = apply_filters('geodir_home_map_listing_query', $catsql, $search); |
211 | 211 | |
212 | - $catinfo = $wpdb->get_results($catsql); |
|
212 | + $catinfo = $wpdb->get_results($catsql); |
|
213 | 213 | |
214 | - $cat_content_info = array(); |
|
215 | - $content_data = array(); |
|
216 | - $post_ids = array(); |
|
217 | - |
|
218 | - /** |
|
219 | - * Called before marker data is processed into JSON. |
|
220 | - * |
|
221 | - * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
222 | - * |
|
223 | - * @since 1.5.3 |
|
224 | - * @param object $catinfo The posts object containing all marker data. |
|
225 | - * @see 'geodir_after_marker_post_process' |
|
226 | - */ |
|
227 | - $catinfo = apply_filters('geodir_before_marker_post_process', $catinfo); |
|
228 | - |
|
229 | - /** |
|
230 | - * Called before marker data is processed into JSON. |
|
231 | - * |
|
232 | - * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
233 | - * |
|
234 | - * @since 1.4.9 |
|
235 | - * @param object $catinfo The posts object containing all marker data. |
|
236 | - * @see 'geodir_after_marker_post_process' |
|
237 | - */ |
|
238 | - do_action('geodir_before_marker_post_process_action', $catinfo); |
|
239 | - |
|
240 | - // Sort any posts into a ajax array |
|
241 | - if (!empty($catinfo)) { |
|
242 | - $geodir_cat_icons = geodir_get_term_icon(); |
|
243 | - global $geodir_date_format; |
|
244 | - |
|
245 | - $today = strtotime(date_i18n('Y-m-d')); |
|
214 | + $cat_content_info = array(); |
|
215 | + $content_data = array(); |
|
216 | + $post_ids = array(); |
|
217 | + |
|
218 | + /** |
|
219 | + * Called before marker data is processed into JSON. |
|
220 | + * |
|
221 | + * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
222 | + * |
|
223 | + * @since 1.5.3 |
|
224 | + * @param object $catinfo The posts object containing all marker data. |
|
225 | + * @see 'geodir_after_marker_post_process' |
|
226 | + */ |
|
227 | + $catinfo = apply_filters('geodir_before_marker_post_process', $catinfo); |
|
228 | + |
|
229 | + /** |
|
230 | + * Called before marker data is processed into JSON. |
|
231 | + * |
|
232 | + * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
233 | + * |
|
234 | + * @since 1.4.9 |
|
235 | + * @param object $catinfo The posts object containing all marker data. |
|
236 | + * @see 'geodir_after_marker_post_process' |
|
237 | + */ |
|
238 | + do_action('geodir_before_marker_post_process_action', $catinfo); |
|
239 | + |
|
240 | + // Sort any posts into a ajax array |
|
241 | + if (!empty($catinfo)) { |
|
242 | + $geodir_cat_icons = geodir_get_term_icon(); |
|
243 | + global $geodir_date_format; |
|
244 | + |
|
245 | + $today = strtotime(date_i18n('Y-m-d')); |
|
246 | 246 | |
247 | - foreach ($catinfo as $catinfo_obj) { |
|
248 | - $post_title = $catinfo_obj->post_title; |
|
247 | + foreach ($catinfo as $catinfo_obj) { |
|
248 | + $post_title = $catinfo_obj->post_title; |
|
249 | 249 | |
250 | - if ($post_type == 'gd_event' && !empty($catinfo_obj->recurring_dates)) { |
|
251 | - $event_dates = ''; |
|
252 | - $recurring_data = isset($catinfo_obj->recurring_dates) ? maybe_unserialize($catinfo_obj->recurring_dates) : array(); |
|
250 | + if ($post_type == 'gd_event' && !empty($catinfo_obj->recurring_dates)) { |
|
251 | + $event_dates = ''; |
|
252 | + $recurring_data = isset($catinfo_obj->recurring_dates) ? maybe_unserialize($catinfo_obj->recurring_dates) : array(); |
|
253 | 253 | |
254 | - $post_info = geodir_get_post_info($catinfo_obj->post_id); |
|
255 | - if (!empty($catinfo_obj->is_recurring) && !empty($recurring_data) && !empty($recurring_data['is_recurring']) && geodir_event_recurring_pkg($post_info)) { |
|
256 | - $recurring_dates = explode(',', $recurring_data['event_recurring_dates']); |
|
254 | + $post_info = geodir_get_post_info($catinfo_obj->post_id); |
|
255 | + if (!empty($catinfo_obj->is_recurring) && !empty($recurring_data) && !empty($recurring_data['is_recurring']) && geodir_event_recurring_pkg($post_info)) { |
|
256 | + $recurring_dates = explode(',', $recurring_data['event_recurring_dates']); |
|
257 | 257 | |
258 | - if (!empty($recurring_dates)) { |
|
259 | - $e = 0; |
|
260 | - foreach ($recurring_dates as $date) { |
|
261 | - if (strtotime($date) >= $today) { |
|
262 | - $event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($date)); |
|
258 | + if (!empty($recurring_dates)) { |
|
259 | + $e = 0; |
|
260 | + foreach ($recurring_dates as $date) { |
|
261 | + if (strtotime($date) >= $today) { |
|
262 | + $event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($date)); |
|
263 | 263 | |
264 | - $e++; |
|
265 | - if ($e == 3) { // only show 3 event dates |
|
266 | - break; |
|
267 | - } |
|
268 | - } |
|
269 | - } |
|
270 | - } |
|
271 | - } else { |
|
272 | - $start_date = !empty($recurring_data['event_start']) && $recurring_data['event_start'] != '0000-00-00 00:00:00' ? $recurring_data['event_start'] : ''; |
|
273 | - $end_date = !empty($recurring_data['event_end']) && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? $recurring_data['event_end'] : $start_date; |
|
264 | + $e++; |
|
265 | + if ($e == 3) { // only show 3 event dates |
|
266 | + break; |
|
267 | + } |
|
268 | + } |
|
269 | + } |
|
270 | + } |
|
271 | + } else { |
|
272 | + $start_date = !empty($recurring_data['event_start']) && $recurring_data['event_start'] != '0000-00-00 00:00:00' ? $recurring_data['event_start'] : ''; |
|
273 | + $end_date = !empty($recurring_data['event_end']) && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? $recurring_data['event_end'] : $start_date; |
|
274 | 274 | |
275 | - if ($end_date != '' && strtotime($end_date) >= $today) { |
|
276 | - $event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($start_date)) .' -> ' . date_i18n($geodir_date_format, strtotime($end_date)); |
|
277 | - } |
|
278 | - } |
|
279 | - |
|
280 | - if (empty($event_dates)) { |
|
281 | - continue; |
|
282 | - } |
|
275 | + if ($end_date != '' && strtotime($end_date) >= $today) { |
|
276 | + $event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($start_date)) .' -> ' . date_i18n($geodir_date_format, strtotime($end_date)); |
|
277 | + } |
|
278 | + } |
|
279 | + |
|
280 | + if (empty($event_dates)) { |
|
281 | + continue; |
|
282 | + } |
|
283 | 283 | |
284 | - $post_title .= $event_dates; |
|
285 | - } |
|
284 | + $post_title .= $event_dates; |
|
285 | + } |
|
286 | 286 | |
287 | - $map_cat_ids_array; |
|
288 | - $default_cat = isset($catinfo_obj->default_category) ? $catinfo_obj->default_category : ''; |
|
287 | + $map_cat_ids_array; |
|
288 | + $default_cat = isset($catinfo_obj->default_category) ? $catinfo_obj->default_category : ''; |
|
289 | 289 | |
290 | - // if single cat lets just show that icon |
|
291 | - if(is_array($map_cat_ids_array) && count($map_cat_ids_array)==1){ |
|
292 | - $default_cat = (int)$map_cat_ids_array[0]; |
|
293 | - } |
|
290 | + // if single cat lets just show that icon |
|
291 | + if(is_array($map_cat_ids_array) && count($map_cat_ids_array)==1){ |
|
292 | + $default_cat = (int)$map_cat_ids_array[0]; |
|
293 | + } |
|
294 | 294 | |
295 | - $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$default_cat]) ? $geodir_cat_icons[$default_cat] : ''; |
|
296 | - $mark_extra = (isset($catinfo_obj->marker_extra)) ? $catinfo_obj->marker_extra : ''; |
|
297 | - $title = str_replace($srcharr, $replarr, $post_title); |
|
295 | + $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$default_cat]) ? $geodir_cat_icons[$default_cat] : ''; |
|
296 | + $mark_extra = (isset($catinfo_obj->marker_extra)) ? $catinfo_obj->marker_extra : ''; |
|
297 | + $title = str_replace($srcharr, $replarr, $post_title); |
|
298 | 298 | |
299 | - if ($icon != '') { |
|
300 | - $gd_marker_sizes = empty($gd_marker_sizes) ? array() : $gd_marker_sizes; |
|
299 | + if ($icon != '') { |
|
300 | + $gd_marker_sizes = empty($gd_marker_sizes) ? array() : $gd_marker_sizes; |
|
301 | 301 | |
302 | - if (isset($gd_marker_sizes[$icon])) { |
|
303 | - $icon_size = $gd_marker_sizes[$icon]; |
|
304 | - } else { |
|
305 | - $icon_size = geodir_get_marker_size($icon); |
|
306 | - $gd_marker_sizes[$icon] = $icon_size; |
|
307 | - } |
|
308 | - } else { |
|
309 | - $icon_size = array('w' => 36, 'h' => 45); |
|
310 | - } |
|
311 | - |
|
312 | - $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.'}'; |
|
313 | - $post_ids[] = $catinfo_obj->post_id; |
|
314 | - } |
|
315 | - } |
|
316 | - |
|
317 | - /** |
|
318 | - * Called after marker data is processed into JSON. |
|
319 | - * |
|
320 | - * Called after marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
321 | - * |
|
322 | - * @since 1.4.9 |
|
323 | - * @param array $content_data The array containing all markers in JSON format. |
|
324 | - * @param object $catinfo The posts object containing all marker data. |
|
325 | - * @see 'geodir_before_marker_post_process' |
|
326 | - */ |
|
327 | - do_action('geodir_after_marker_post_process', $content_data, $catinfo); |
|
328 | - |
|
329 | - if (!empty($content_data)) { |
|
330 | - $cat_content_info[] = implode(',', $content_data); |
|
331 | - } |
|
332 | - |
|
333 | - $totalcount = count(array_unique($post_ids)); |
|
334 | - |
|
335 | - if (!empty($cat_content_info)) { |
|
336 | - return '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']'; |
|
337 | - } |
|
338 | - else { |
|
339 | - return '[{"totalcount":"0"}]'; |
|
340 | - } |
|
302 | + if (isset($gd_marker_sizes[$icon])) { |
|
303 | + $icon_size = $gd_marker_sizes[$icon]; |
|
304 | + } else { |
|
305 | + $icon_size = geodir_get_marker_size($icon); |
|
306 | + $gd_marker_sizes[$icon] = $icon_size; |
|
307 | + } |
|
308 | + } else { |
|
309 | + $icon_size = array('w' => 36, 'h' => 45); |
|
310 | + } |
|
311 | + |
|
312 | + $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.'}'; |
|
313 | + $post_ids[] = $catinfo_obj->post_id; |
|
314 | + } |
|
315 | + } |
|
316 | + |
|
317 | + /** |
|
318 | + * Called after marker data is processed into JSON. |
|
319 | + * |
|
320 | + * Called after marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
321 | + * |
|
322 | + * @since 1.4.9 |
|
323 | + * @param array $content_data The array containing all markers in JSON format. |
|
324 | + * @param object $catinfo The posts object containing all marker data. |
|
325 | + * @see 'geodir_before_marker_post_process' |
|
326 | + */ |
|
327 | + do_action('geodir_after_marker_post_process', $content_data, $catinfo); |
|
328 | + |
|
329 | + if (!empty($content_data)) { |
|
330 | + $cat_content_info[] = implode(',', $content_data); |
|
331 | + } |
|
332 | + |
|
333 | + $totalcount = count(array_unique($post_ids)); |
|
334 | + |
|
335 | + if (!empty($cat_content_info)) { |
|
336 | + return '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']'; |
|
337 | + } |
|
338 | + else { |
|
339 | + return '[{"totalcount":"0"}]'; |
|
340 | + } |
|
341 | 341 | } |
342 | 342 | \ 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 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place'; |
91 | 91 | |
92 | 92 | $map_cat_ids_array = array('0'); |
93 | - $cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)"); |
|
93 | + $cat_find_array = array(" FIND_IN_SET(%d, pd.".$post_type."category)"); |
|
94 | 94 | |
95 | 95 | |
96 | 96 | $field_default_cat = ''; |
@@ -98,13 +98,13 @@ discard block |
||
98 | 98 | $map_cat_arr = trim($_REQUEST['cat_id'], ','); |
99 | 99 | |
100 | 100 | if (!empty($map_cat_arr)) { |
101 | - $field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category "; |
|
101 | + $field_default_cat .= "WHEN (default_category IN (".$map_cat_arr.")) THEN default_category "; |
|
102 | 102 | |
103 | 103 | $map_cat_ids_array = explode(',', $map_cat_arr); |
104 | 104 | $cat_find_array = array(); |
105 | 105 | foreach ($map_cat_ids_array as $cat_id) { |
106 | - $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id "; |
|
107 | - $cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)"; |
|
106 | + $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `".$post_type."category`) > 0) THEN $cat_id "; |
|
107 | + $cat_find_array[] = " FIND_IN_SET(%d, pd.".$post_type."category)"; |
|
108 | 108 | $main_query_array[] = $cat_id; |
109 | 109 | } |
110 | 110 | |
@@ -115,13 +115,13 @@ discard block |
||
115 | 115 | $field_default_cat = ''; |
116 | 116 | |
117 | 117 | if (!empty($cat_find_array)) |
118 | - $search .= "AND (" . implode(' OR ', $cat_find_array) . ")"; |
|
118 | + $search .= "AND (".implode(' OR ', $cat_find_array).")"; |
|
119 | 119 | |
120 | 120 | $main_query_array = $map_cat_ids_array; |
121 | 121 | |
122 | 122 | if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) { |
123 | 123 | $search .= " AND p.post_title LIKE %s"; |
124 | - $main_query_array[] = "%" . $_REQUEST['search'] . "%"; |
|
124 | + $main_query_array[] = "%".$_REQUEST['search']."%"; |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -143,14 +143,14 @@ discard block |
||
143 | 143 | |
144 | 144 | $gd_posttype = ''; |
145 | 145 | if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') { |
146 | - $table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail'; |
|
146 | + $table = $plugin_prefix.$_REQUEST['gd_posttype'].'_detail'; |
|
147 | 147 | $gd_posttype = " AND p.post_type = %s"; |
148 | 148 | $main_query_array[] = $_REQUEST['gd_posttype']; |
149 | 149 | |
150 | 150 | } else |
151 | - $table = $plugin_prefix . 'gd_place_detail'; |
|
151 | + $table = $plugin_prefix.'gd_place_detail'; |
|
152 | 152 | |
153 | - $join = ", " . $table . " AS pd "; |
|
153 | + $join = ", ".$table." AS pd "; |
|
154 | 154 | |
155 | 155 | /** |
156 | 156 | * Filter the SQL JOIN clause for the markers data |
@@ -170,14 +170,14 @@ discard block |
||
170 | 170 | */ |
171 | 171 | $search = apply_filters('geodir_home_map_listing_where', $search); |
172 | 172 | $search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search); |
173 | - $cat_type = $post_type . 'category'; |
|
173 | + $cat_type = $post_type.'category'; |
|
174 | 174 | if ($post_type == 'gd_event') { |
175 | 175 | $event_select = ", pd.recurring_dates, pd.is_recurring"; |
176 | 176 | } else { |
177 | 177 | $event_select = ""; |
178 | 178 | } |
179 | 179 | |
180 | - $sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select; |
|
180 | + $sql_select = 'SELECT pd.default_category, pd.'.$cat_type.', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude'.$event_select; |
|
181 | 181 | /** |
182 | 182 | * Filter the SQL SELECT clause to retrive fields data |
183 | 183 | * |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | */ |
198 | 198 | $groupby = apply_filters('geodir_home_map_listing_groupby', $groupby); |
199 | 199 | |
200 | - $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); |
|
200 | + $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); |
|
201 | 201 | |
202 | 202 | /** |
203 | 203 | * Filter the SQL query to retrive markers data |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | $e = 0; |
260 | 260 | foreach ($recurring_dates as $date) { |
261 | 261 | if (strtotime($date) >= $today) { |
262 | - $event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($date)); |
|
262 | + $event_dates .= ' :: '.date_i18n($geodir_date_format, strtotime($date)); |
|
263 | 263 | |
264 | 264 | $e++; |
265 | 265 | if ($e == 3) { // only show 3 event dates |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | $end_date = !empty($recurring_data['event_end']) && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? $recurring_data['event_end'] : $start_date; |
274 | 274 | |
275 | 275 | if ($end_date != '' && strtotime($end_date) >= $today) { |
276 | - $event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($start_date)) .' -> ' . date_i18n($geodir_date_format, strtotime($end_date)); |
|
276 | + $event_dates .= ' :: '.date_i18n($geodir_date_format, strtotime($start_date)).' -> '.date_i18n($geodir_date_format, strtotime($end_date)); |
|
277 | 277 | } |
278 | 278 | } |
279 | 279 | |
@@ -288,8 +288,8 @@ discard block |
||
288 | 288 | $default_cat = isset($catinfo_obj->default_category) ? $catinfo_obj->default_category : ''; |
289 | 289 | |
290 | 290 | // if single cat lets just show that icon |
291 | - if(is_array($map_cat_ids_array) && count($map_cat_ids_array)==1){ |
|
292 | - $default_cat = (int)$map_cat_ids_array[0]; |
|
291 | + if (is_array($map_cat_ids_array) && count($map_cat_ids_array) == 1) { |
|
292 | + $default_cat = (int) $map_cat_ids_array[0]; |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$default_cat]) ? $geodir_cat_icons[$default_cat] : ''; |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | $icon_size = array('w' => 36, 'h' => 45); |
310 | 310 | } |
311 | 311 | |
312 | - $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.'}'; |
|
312 | + $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.'}'; |
|
313 | 313 | $post_ids[] = $catinfo_obj->post_id; |
314 | 314 | } |
315 | 315 | } |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | $totalcount = count(array_unique($post_ids)); |
334 | 334 | |
335 | 335 | if (!empty($cat_content_info)) { |
336 | - return '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']'; |
|
336 | + return '[{"totalcount":"'.$totalcount.'",'.substr(implode(',', $cat_content_info), 1).']'; |
|
337 | 337 | } |
338 | 338 | else { |
339 | 339 | return '[{"totalcount":"0"}]'; |