@@ -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,80 +80,80 @@ discard block |
||
80 | 80 | */ |
81 | 81 | function get_markers() { |
82 | 82 | |
83 | - global $wpdb, $plugin_prefix, $geodir_cat_icons, $gd_marker_sizes,$gd_session; |
|
83 | + global $wpdb, $plugin_prefix, $geodir_cat_icons, $gd_marker_sizes,$gd_session; |
|
84 | 84 | |
85 | - $search = ''; |
|
86 | - $main_query_array; |
|
85 | + $search = ''; |
|
86 | + $main_query_array; |
|
87 | 87 | |
88 | - $srcharr = array("'", "/", "-", '"', '\\', '''); |
|
89 | - $replarr = array("′", "⁄", "–", "“", '', "′"); |
|
88 | + $srcharr = array("'", "/", "-", '"', '\\', '''); |
|
89 | + $replarr = array("′", "⁄", "–", "“", '', "′"); |
|
90 | 90 | |
91 | - $post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place'; |
|
91 | + $post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place'; |
|
92 | 92 | |
93 | - $map_cat_ids_array = array('0'); |
|
94 | - $cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)"); |
|
93 | + $map_cat_ids_array = array('0'); |
|
94 | + $cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)"); |
|
95 | 95 | |
96 | 96 | |
97 | - $field_default_cat = ''; |
|
98 | - if (isset($_REQUEST['cat_id']) && $_REQUEST['cat_id'] != '') { |
|
99 | - $map_cat_arr = trim($_REQUEST['cat_id'], ','); |
|
97 | + $field_default_cat = ''; |
|
98 | + if (isset($_REQUEST['cat_id']) && $_REQUEST['cat_id'] != '') { |
|
99 | + $map_cat_arr = trim($_REQUEST['cat_id'], ','); |
|
100 | 100 | |
101 | - if (!empty($map_cat_arr)) { |
|
102 | - $field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category "; |
|
101 | + if (!empty($map_cat_arr)) { |
|
102 | + $field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category "; |
|
103 | 103 | |
104 | - $map_cat_ids_array = explode(',', $map_cat_arr); |
|
105 | - $cat_find_array = array(); |
|
106 | - foreach ($map_cat_ids_array as $cat_id) { |
|
107 | - $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id "; |
|
108 | - $cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)"; |
|
109 | - $main_query_array[] = $cat_id; |
|
110 | - } |
|
104 | + $map_cat_ids_array = explode(',', $map_cat_arr); |
|
105 | + $cat_find_array = array(); |
|
106 | + foreach ($map_cat_ids_array as $cat_id) { |
|
107 | + $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id "; |
|
108 | + $cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)"; |
|
109 | + $main_query_array[] = $cat_id; |
|
110 | + } |
|
111 | 111 | |
112 | - } |
|
113 | - } |
|
112 | + } |
|
113 | + } |
|
114 | 114 | |
115 | - if (!empty($field_default_cat)) |
|
116 | - $field_default_cat = ''; |
|
115 | + if (!empty($field_default_cat)) |
|
116 | + $field_default_cat = ''; |
|
117 | 117 | |
118 | - if (!empty($cat_find_array)) |
|
119 | - $search .= "AND (" . implode(' OR ', $cat_find_array) . ")"; |
|
118 | + if (!empty($cat_find_array)) |
|
119 | + $search .= "AND (" . implode(' OR ', $cat_find_array) . ")"; |
|
120 | 120 | |
121 | - $main_query_array = $map_cat_ids_array; |
|
121 | + $main_query_array = $map_cat_ids_array; |
|
122 | 122 | |
123 | - if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) { |
|
124 | - $search .= " AND p.post_title LIKE %s"; |
|
125 | - $main_query_array[] = "%" . $_REQUEST['search'] . "%"; |
|
126 | - } |
|
127 | - |
|
128 | - /** |
|
129 | - * Filter the marker query search SQL, values are replaces with %s or %d. |
|
130 | - * |
|
131 | - * @since 1.5.3 |
|
132 | - * |
|
133 | - * @param string $search The SQL query for search/where. |
|
134 | - */ |
|
135 | - $search = apply_filters('geodir_marker_search', $search); |
|
136 | - /** |
|
137 | - * Filter the marker query search SQL values %s and %d, this is an array of values. |
|
138 | - * |
|
139 | - * @since 1.5.3 |
|
140 | - * |
|
141 | - * @param array $main_query_array The SQL query values for search/where. |
|
142 | - */ |
|
143 | - $main_query_array = apply_filters('geodir_marker_main_query_array', $main_query_array); |
|
144 | - |
|
145 | - $gd_posttype = ''; |
|
146 | - if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') { |
|
147 | - $table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail'; |
|
148 | - $gd_posttype = " AND p.post_type = %s"; |
|
149 | - $main_query_array[] = $_REQUEST['gd_posttype']; |
|
150 | - |
|
151 | - } else |
|
152 | - $table = $plugin_prefix . 'gd_place_detail'; |
|
153 | - |
|
154 | - $join = ", " . $table . " AS pd "; |
|
155 | - |
|
156 | - /** |
|
123 | + if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) { |
|
124 | + $search .= " AND p.post_title LIKE %s"; |
|
125 | + $main_query_array[] = "%" . $_REQUEST['search'] . "%"; |
|
126 | + } |
|
127 | + |
|
128 | + /** |
|
129 | + * Filter the marker query search SQL, values are replaces with %s or %d. |
|
130 | + * |
|
131 | + * @since 1.5.3 |
|
132 | + * |
|
133 | + * @param string $search The SQL query for search/where. |
|
134 | + */ |
|
135 | + $search = apply_filters('geodir_marker_search', $search); |
|
136 | + /** |
|
137 | + * Filter the marker query search SQL values %s and %d, this is an array of values. |
|
138 | + * |
|
139 | + * @since 1.5.3 |
|
140 | + * |
|
141 | + * @param array $main_query_array The SQL query values for search/where. |
|
142 | + */ |
|
143 | + $main_query_array = apply_filters('geodir_marker_main_query_array', $main_query_array); |
|
144 | + |
|
145 | + $gd_posttype = ''; |
|
146 | + if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') { |
|
147 | + $table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail'; |
|
148 | + $gd_posttype = " AND p.post_type = %s"; |
|
149 | + $main_query_array[] = $_REQUEST['gd_posttype']; |
|
150 | + |
|
151 | + } else |
|
152 | + $table = $plugin_prefix . 'gd_place_detail'; |
|
153 | + |
|
154 | + $join = ", " . $table . " AS pd "; |
|
155 | + |
|
156 | + /** |
|
157 | 157 | * Filter the SQL JOIN clause for the markers data |
158 | 158 | * |
159 | 159 | * @since 1.0.0 |
@@ -170,16 +170,16 @@ discard block |
||
170 | 170 | * @param string $search Row of searched fields to use in WHERE clause. |
171 | 171 | */ |
172 | 172 | $search = apply_filters('geodir_home_map_listing_where', $search); |
173 | - $search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search); |
|
174 | - $cat_type = $post_type . 'category'; |
|
175 | - if ($post_type == 'gd_event') { |
|
176 | - $event_select = ", pd.recurring_dates, pd.is_recurring"; |
|
177 | - } else { |
|
178 | - $event_select = ""; |
|
179 | - } |
|
180 | - |
|
181 | - $sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select; |
|
182 | - /** |
|
173 | + $search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search); |
|
174 | + $cat_type = $post_type . 'category'; |
|
175 | + if ($post_type == 'gd_event') { |
|
176 | + $event_select = ", pd.recurring_dates, pd.is_recurring"; |
|
177 | + } else { |
|
178 | + $event_select = ""; |
|
179 | + } |
|
180 | + |
|
181 | + $sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select; |
|
182 | + /** |
|
183 | 183 | * Filter the SQL SELECT clause to retrive fields data |
184 | 184 | * |
185 | 185 | * @since 1.0.0 |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | */ |
199 | 199 | $groupby = apply_filters('geodir_home_map_listing_groupby', $groupby); |
200 | 200 | |
201 | - $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 | + $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); |
|
202 | 202 | |
203 | 203 | /** |
204 | 204 | * Filter the SQL query to retrive markers data |
@@ -214,265 +214,265 @@ discard block |
||
214 | 214 | // print_r($gd_session); |
215 | 215 | // print_r($_SESSION); |
216 | 216 | |
217 | - $catinfo = $wpdb->get_results($catsql); |
|
217 | + $catinfo = $wpdb->get_results($catsql); |
|
218 | 218 | |
219 | - $cat_content_info = array(); |
|
220 | - $content_data = array(); |
|
221 | - $post_ids = array(); |
|
222 | - |
|
223 | - /** |
|
224 | - * Called before marker data is processed into JSON. |
|
225 | - * |
|
226 | - * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
227 | - * |
|
228 | - * @since 1.5.3 |
|
229 | - * @param object $catinfo The posts object containing all marker data. |
|
230 | - * @see 'geodir_after_marker_post_process' |
|
231 | - */ |
|
232 | - $catinfo = apply_filters('geodir_before_marker_post_process', $catinfo); |
|
233 | - |
|
234 | - /** |
|
235 | - * Called before marker data is processed into JSON. |
|
236 | - * |
|
237 | - * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
238 | - * |
|
239 | - * @since 1.4.9 |
|
240 | - * @param object $catinfo The posts object containing all marker data. |
|
241 | - * @see 'geodir_after_marker_post_process' |
|
242 | - */ |
|
243 | - do_action('geodir_before_marker_post_process_action', $catinfo); |
|
244 | - |
|
245 | - // Sort any posts into a ajax array |
|
246 | - if (!empty($catinfo)) { |
|
247 | - $geodir_cat_icons = geodir_get_term_icon(); |
|
248 | - global $geodir_date_time_format, $geodir_date_format, $geodir_time_format; |
|
249 | - |
|
250 | - $today = strtotime(date_i18n('Y-m-d')); |
|
251 | - $show_dates = $post_type == 'gd_event' ? (int)get_option('geodir_event_infowindow_dates_count', 1) : 0; |
|
219 | + $cat_content_info = array(); |
|
220 | + $content_data = array(); |
|
221 | + $post_ids = array(); |
|
222 | + |
|
223 | + /** |
|
224 | + * Called before marker data is processed into JSON. |
|
225 | + * |
|
226 | + * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
227 | + * |
|
228 | + * @since 1.5.3 |
|
229 | + * @param object $catinfo The posts object containing all marker data. |
|
230 | + * @see 'geodir_after_marker_post_process' |
|
231 | + */ |
|
232 | + $catinfo = apply_filters('geodir_before_marker_post_process', $catinfo); |
|
233 | + |
|
234 | + /** |
|
235 | + * Called before marker data is processed into JSON. |
|
236 | + * |
|
237 | + * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
238 | + * |
|
239 | + * @since 1.4.9 |
|
240 | + * @param object $catinfo The posts object containing all marker data. |
|
241 | + * @see 'geodir_after_marker_post_process' |
|
242 | + */ |
|
243 | + do_action('geodir_before_marker_post_process_action', $catinfo); |
|
244 | + |
|
245 | + // Sort any posts into a ajax array |
|
246 | + if (!empty($catinfo)) { |
|
247 | + $geodir_cat_icons = geodir_get_term_icon(); |
|
248 | + global $geodir_date_time_format, $geodir_date_format, $geodir_time_format; |
|
249 | + |
|
250 | + $today = strtotime(date_i18n('Y-m-d')); |
|
251 | + $show_dates = $post_type == 'gd_event' ? (int)get_option('geodir_event_infowindow_dates_count', 1) : 0; |
|
252 | 252 | |
253 | - foreach ($catinfo as $catinfo_obj) { |
|
254 | - $post_title = $catinfo_obj->post_title; |
|
253 | + foreach ($catinfo as $catinfo_obj) { |
|
254 | + $post_title = $catinfo_obj->post_title; |
|
255 | 255 | |
256 | - if ($post_type == 'gd_event' && !empty($catinfo_obj->recurring_dates) && $show_dates > 0) { |
|
257 | - $event_dates = ''; |
|
258 | - $recurring_data = isset($catinfo_obj->recurring_dates) ? maybe_unserialize($catinfo_obj->recurring_dates) : array(); |
|
256 | + if ($post_type == 'gd_event' && !empty($catinfo_obj->recurring_dates) && $show_dates > 0) { |
|
257 | + $event_dates = ''; |
|
258 | + $recurring_data = isset($catinfo_obj->recurring_dates) ? maybe_unserialize($catinfo_obj->recurring_dates) : array(); |
|
259 | 259 | |
260 | - $post_info = geodir_get_post_info($catinfo_obj->post_id); |
|
260 | + $post_info = geodir_get_post_info($catinfo_obj->post_id); |
|
261 | 261 | |
262 | - if (!empty($catinfo_obj->is_recurring) && !empty($recurring_data) && !empty($recurring_data['is_recurring']) && geodir_event_recurring_pkg($post_info)) { |
|
263 | - $starttimes = ''; |
|
264 | - $endtimes = ''; |
|
265 | - $astarttimes = array(); |
|
266 | - $aendtimes = array(); |
|
267 | - if ( !isset( $recurring_data['repeat_type'] ) ) { |
|
268 | - $recurring_data['repeat_type'] = 'custom'; |
|
269 | - } |
|
270 | - $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 |
|
271 | - $different_times = isset( $recurring_data['different_times'] ) && !empty( $recurring_data['different_times'] ) ? true : false; |
|
262 | + if (!empty($catinfo_obj->is_recurring) && !empty($recurring_data) && !empty($recurring_data['is_recurring']) && geodir_event_recurring_pkg($post_info)) { |
|
263 | + $starttimes = ''; |
|
264 | + $endtimes = ''; |
|
265 | + $astarttimes = array(); |
|
266 | + $aendtimes = array(); |
|
267 | + if ( !isset( $recurring_data['repeat_type'] ) ) { |
|
268 | + $recurring_data['repeat_type'] = 'custom'; |
|
269 | + } |
|
270 | + $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 |
|
271 | + $different_times = isset( $recurring_data['different_times'] ) && !empty( $recurring_data['different_times'] ) ? true : false; |
|
272 | 272 | |
273 | - $recurring_dates = explode(',', $recurring_data['event_recurring_dates']); |
|
273 | + $recurring_dates = explode(',', $recurring_data['event_recurring_dates']); |
|
274 | 274 | |
275 | - if ( !empty( $recurring_dates ) ) { |
|
276 | - if ( empty( $recurring_data['all_day'] ) ) { |
|
277 | - if ( $repeat_type == 'custom' && $different_times ) { |
|
278 | - $astarttimes = isset( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array(); |
|
279 | - $aendtimes = isset( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array(); |
|
280 | - } else { |
|
281 | - $starttimes = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : ''; |
|
282 | - $endtimes = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : ''; |
|
283 | - } |
|
284 | - } |
|
275 | + if ( !empty( $recurring_dates ) ) { |
|
276 | + if ( empty( $recurring_data['all_day'] ) ) { |
|
277 | + if ( $repeat_type == 'custom' && $different_times ) { |
|
278 | + $astarttimes = isset( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array(); |
|
279 | + $aendtimes = isset( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array(); |
|
280 | + } else { |
|
281 | + $starttimes = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : ''; |
|
282 | + $endtimes = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : ''; |
|
283 | + } |
|
284 | + } |
|
285 | 285 | |
286 | - $e = 0; |
|
287 | - foreach( $recurring_dates as $key => $date ) { |
|
288 | - if ( $repeat_type == 'custom' && $different_times ) { |
|
289 | - if ( !empty( $astarttimes ) && isset( $astarttimes[$key] ) ) { |
|
290 | - $starttimes = $astarttimes[$key]; |
|
291 | - $endtimes = $aendtimes[$key]; |
|
292 | - } else { |
|
293 | - $starttimes = ''; |
|
294 | - $endtimes = ''; |
|
295 | - } |
|
296 | - } |
|
286 | + $e = 0; |
|
287 | + foreach( $recurring_dates as $key => $date ) { |
|
288 | + if ( $repeat_type == 'custom' && $different_times ) { |
|
289 | + if ( !empty( $astarttimes ) && isset( $astarttimes[$key] ) ) { |
|
290 | + $starttimes = $astarttimes[$key]; |
|
291 | + $endtimes = $aendtimes[$key]; |
|
292 | + } else { |
|
293 | + $starttimes = ''; |
|
294 | + $endtimes = ''; |
|
295 | + } |
|
296 | + } |
|
297 | 297 | |
298 | - $duration = isset( $recurring_data['duration_x'] ) && (int)$recurring_data['duration_x'] > 0 ? (int)$recurring_data['duration_x'] : 1; |
|
299 | - $duration--; |
|
300 | - $enddate = date_i18n( 'Y-m-d', strtotime( $date . ' + ' . $duration . ' day' ) ); |
|
298 | + $duration = isset( $recurring_data['duration_x'] ) && (int)$recurring_data['duration_x'] > 0 ? (int)$recurring_data['duration_x'] : 1; |
|
299 | + $duration--; |
|
300 | + $enddate = date_i18n( 'Y-m-d', strtotime( $date . ' + ' . $duration . ' day' ) ); |
|
301 | 301 | |
302 | - // Hide past dates |
|
303 | - if ( strtotime( $enddate ) < $today ) { |
|
304 | - continue; |
|
305 | - } |
|
302 | + // Hide past dates |
|
303 | + if ( strtotime( $enddate ) < $today ) { |
|
304 | + continue; |
|
305 | + } |
|
306 | 306 | |
307 | - $sdate = strtotime( $date . ' ' . $starttimes ); |
|
308 | - $edate = strtotime( $enddate . ' ' . $endtimes ); |
|
307 | + $sdate = strtotime( $date . ' ' . $starttimes ); |
|
308 | + $edate = strtotime( $enddate . ' ' . $endtimes ); |
|
309 | 309 | |
310 | - $start_date = date_i18n( $geodir_date_time_format, $sdate ); |
|
311 | - $end_date = date_i18n( $geodir_date_time_format, $edate ); |
|
310 | + $start_date = date_i18n( $geodir_date_time_format, $sdate ); |
|
311 | + $end_date = date_i18n( $geodir_date_time_format, $edate ); |
|
312 | 312 | |
313 | - $same_day = false; |
|
314 | - $full_day = false; |
|
315 | - $same_datetime = false; |
|
313 | + $same_day = false; |
|
314 | + $full_day = false; |
|
315 | + $same_datetime = false; |
|
316 | 316 | |
317 | - if ( $starttimes == $endtimes && ( $starttimes == '' || $starttimes == '00:00:00' || $starttimes == '00:00' ) ) { |
|
318 | - $full_day = true; |
|
319 | - } |
|
317 | + if ( $starttimes == $endtimes && ( $starttimes == '' || $starttimes == '00:00:00' || $starttimes == '00:00' ) ) { |
|
318 | + $full_day = true; |
|
319 | + } |
|
320 | 320 | |
321 | - if ( $start_date == $end_date && $full_day ) { |
|
322 | - $same_datetime = true; |
|
323 | - } |
|
324 | - |
|
325 | - $link_date = date_i18n( 'Y-m-d', $sdate ); |
|
326 | - $title_date = date_i18n( $geodir_date_format, $sdate ); |
|
327 | - if ( $full_day ) { |
|
328 | - $start_date = $title_date; |
|
329 | - $end_date = date_i18n( $geodir_date_format, $edate ); |
|
330 | - } |
|
321 | + if ( $start_date == $end_date && $full_day ) { |
|
322 | + $same_datetime = true; |
|
323 | + } |
|
324 | + |
|
325 | + $link_date = date_i18n( 'Y-m-d', $sdate ); |
|
326 | + $title_date = date_i18n( $geodir_date_format, $sdate ); |
|
327 | + if ( $full_day ) { |
|
328 | + $start_date = $title_date; |
|
329 | + $end_date = date_i18n( $geodir_date_format, $edate ); |
|
330 | + } |
|
331 | 331 | |
332 | - if ( !$same_datetime && !$full_day && date_i18n( 'Y-m-d', $sdate ) == date_i18n( 'Y-m-d', $edate ) ) { |
|
333 | - $same_day = true; |
|
332 | + if ( !$same_datetime && !$full_day && date_i18n( 'Y-m-d', $sdate ) == date_i18n( 'Y-m-d', $edate ) ) { |
|
333 | + $same_day = true; |
|
334 | 334 | |
335 | - $start_date .= ' - ' . date_i18n( $geodir_time_format, $edate ); |
|
336 | - } |
|
335 | + $start_date .= ' - ' . date_i18n( $geodir_time_format, $edate ); |
|
336 | + } |
|
337 | 337 | |
338 | - $event_dates .= ' :: ' . $start_date; |
|
338 | + $event_dates .= ' :: ' . $start_date; |
|
339 | 339 | |
340 | - if ( !$same_day && !$same_datetime ) { |
|
341 | - $event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date; |
|
342 | - } |
|
340 | + if ( !$same_day && !$same_datetime ) { |
|
341 | + $event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date; |
|
342 | + } |
|
343 | 343 | |
344 | - $e++; |
|
344 | + $e++; |
|
345 | 345 | |
346 | - if ($show_dates > 0 && $e == $show_dates) { // only show 3 event dates |
|
347 | - break; |
|
348 | - } |
|
349 | - } |
|
350 | - } |
|
351 | - } else { |
|
352 | - $start_date = isset( $recurring_data['event_start'] ) ? $recurring_data['event_start'] : ''; |
|
353 | - $end_date = isset( $recurring_data['event_end'] ) ? $recurring_data['event_end'] : $start_date; |
|
354 | - $all_day = isset( $recurring_data['all_day'] ) && !empty( $recurring_data['all_day'] ) ? true : false; |
|
355 | - $starttime = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : ''; |
|
356 | - $endtime = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : ''; |
|
346 | + if ($show_dates > 0 && $e == $show_dates) { // only show 3 event dates |
|
347 | + break; |
|
348 | + } |
|
349 | + } |
|
350 | + } |
|
351 | + } else { |
|
352 | + $start_date = isset( $recurring_data['event_start'] ) ? $recurring_data['event_start'] : ''; |
|
353 | + $end_date = isset( $recurring_data['event_end'] ) ? $recurring_data['event_end'] : $start_date; |
|
354 | + $all_day = isset( $recurring_data['all_day'] ) && !empty( $recurring_data['all_day'] ) ? true : false; |
|
355 | + $starttime = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : ''; |
|
356 | + $endtime = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : ''; |
|
357 | 357 | |
358 | - $event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] ); |
|
359 | - $starttimes = isset( $recurring_data['starttimes'] ) && !empty( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array(); |
|
360 | - $endtimes = isset( $recurring_data['endtimes'] ) && !empty( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array(); |
|
358 | + $event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] ); |
|
359 | + $starttimes = isset( $recurring_data['starttimes'] ) && !empty( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array(); |
|
360 | + $endtimes = isset( $recurring_data['endtimes'] ) && !empty( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array(); |
|
361 | 361 | |
362 | - if ( !geodir_event_is_date( $start_date ) && !empty( $event_recurring_dates ) ) { |
|
363 | - $start_date = $event_recurring_dates[0]; |
|
364 | - } |
|
362 | + if ( !geodir_event_is_date( $start_date ) && !empty( $event_recurring_dates ) ) { |
|
363 | + $start_date = $event_recurring_dates[0]; |
|
364 | + } |
|
365 | 365 | |
366 | - if ( strtotime( $end_date ) < strtotime( $start_date ) ) { |
|
367 | - $end_date = $start_date; |
|
368 | - } |
|
366 | + if ( strtotime( $end_date ) < strtotime( $start_date ) ) { |
|
367 | + $end_date = $start_date; |
|
368 | + } |
|
369 | 369 | |
370 | - if ($end_date != '' && strtotime($end_date) >= $today) { |
|
371 | - if ( $starttime == '' && !empty( $starttimes ) ) { |
|
372 | - $starttime = $starttimes[0]; |
|
373 | - $endtime = $endtimes[0]; |
|
374 | - } |
|
370 | + if ($end_date != '' && strtotime($end_date) >= $today) { |
|
371 | + if ( $starttime == '' && !empty( $starttimes ) ) { |
|
372 | + $starttime = $starttimes[0]; |
|
373 | + $endtime = $endtimes[0]; |
|
374 | + } |
|
375 | 375 | |
376 | - $same_day = false; |
|
377 | - $one_day = false; |
|
378 | - if ( $start_date == $end_date && $all_day ) { |
|
379 | - $one_day = true; |
|
380 | - } |
|
381 | - |
|
382 | - if ( $all_day ) { |
|
383 | - $start_datetime = strtotime( $start_date ); |
|
384 | - $end_datetime = strtotime( $end_date ); |
|
376 | + $same_day = false; |
|
377 | + $one_day = false; |
|
378 | + if ( $start_date == $end_date && $all_day ) { |
|
379 | + $one_day = true; |
|
380 | + } |
|
381 | + |
|
382 | + if ( $all_day ) { |
|
383 | + $start_datetime = strtotime( $start_date ); |
|
384 | + $end_datetime = strtotime( $end_date ); |
|
385 | 385 | |
386 | - $start_date = date_i18n( $geodir_date_format, $start_datetime ); |
|
387 | - $end_date = date_i18n( $geodir_date_format, $end_datetime ); |
|
388 | - if ( $start_date == $end_date ) { |
|
389 | - $one_day = true; |
|
390 | - } |
|
391 | - } else { |
|
392 | - if ( $start_date == $end_date && $starttime == $endtime ) { |
|
393 | - $end_date = date_i18n( 'Y-m-d', strtotime( $start_date . ' ' . $starttime . ' +1 day' ) ); |
|
394 | - $one_day = false; |
|
395 | - } |
|
396 | - $start_datetime = strtotime( $start_date . ' ' . $starttime ); |
|
397 | - $end_datetime = strtotime( $end_date . ' ' . $endtime ); |
|
386 | + $start_date = date_i18n( $geodir_date_format, $start_datetime ); |
|
387 | + $end_date = date_i18n( $geodir_date_format, $end_datetime ); |
|
388 | + if ( $start_date == $end_date ) { |
|
389 | + $one_day = true; |
|
390 | + } |
|
391 | + } else { |
|
392 | + if ( $start_date == $end_date && $starttime == $endtime ) { |
|
393 | + $end_date = date_i18n( 'Y-m-d', strtotime( $start_date . ' ' . $starttime . ' +1 day' ) ); |
|
394 | + $one_day = false; |
|
395 | + } |
|
396 | + $start_datetime = strtotime( $start_date . ' ' . $starttime ); |
|
397 | + $end_datetime = strtotime( $end_date . ' ' . $endtime ); |
|
398 | 398 | |
399 | - $start_date = date_i18n( $geodir_date_time_format, $start_datetime ); |
|
400 | - $end_date = date_i18n( $geodir_date_time_format, $end_datetime ); |
|
401 | - } |
|
399 | + $start_date = date_i18n( $geodir_date_time_format, $start_datetime ); |
|
400 | + $end_date = date_i18n( $geodir_date_time_format, $end_datetime ); |
|
401 | + } |
|
402 | 402 | |
403 | - if ( !$one_day && date_i18n( 'Y-m-d', $start_datetime ) == date_i18n( 'Y-m-d', $end_datetime ) ) { |
|
404 | - $same_day = true; |
|
403 | + if ( !$one_day && date_i18n( 'Y-m-d', $start_datetime ) == date_i18n( 'Y-m-d', $end_datetime ) ) { |
|
404 | + $same_day = true; |
|
405 | 405 | |
406 | - $start_date .= ' - ' . date_i18n( $geodir_time_format, $end_datetime ); |
|
407 | - } |
|
406 | + $start_date .= ' - ' . date_i18n( $geodir_time_format, $end_datetime ); |
|
407 | + } |
|
408 | 408 | |
409 | - $event_dates .= ' :: ' . $start_date; |
|
409 | + $event_dates .= ' :: ' . $start_date; |
|
410 | 410 | |
411 | - if ( !$same_day && !$one_day ) { |
|
412 | - $event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date; |
|
413 | - } |
|
414 | - } |
|
415 | - } |
|
416 | - |
|
417 | - if (empty($event_dates)) { |
|
418 | - continue; |
|
419 | - } |
|
411 | + if ( !$same_day && !$one_day ) { |
|
412 | + $event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date; |
|
413 | + } |
|
414 | + } |
|
415 | + } |
|
416 | + |
|
417 | + if (empty($event_dates)) { |
|
418 | + continue; |
|
419 | + } |
|
420 | 420 | |
421 | - $post_title .= $event_dates; |
|
422 | - } |
|
421 | + $post_title .= $event_dates; |
|
422 | + } |
|
423 | 423 | |
424 | - $map_cat_ids_array; |
|
425 | - $default_cat = isset($catinfo_obj->default_category) ? $catinfo_obj->default_category : ''; |
|
424 | + $map_cat_ids_array; |
|
425 | + $default_cat = isset($catinfo_obj->default_category) ? $catinfo_obj->default_category : ''; |
|
426 | 426 | |
427 | - // if single cat lets just show that icon |
|
428 | - if(is_array($map_cat_ids_array) && count($map_cat_ids_array)==1){ |
|
429 | - $default_cat = (int)$map_cat_ids_array[0]; |
|
430 | - } |
|
427 | + // if single cat lets just show that icon |
|
428 | + if(is_array($map_cat_ids_array) && count($map_cat_ids_array)==1){ |
|
429 | + $default_cat = (int)$map_cat_ids_array[0]; |
|
430 | + } |
|
431 | 431 | |
432 | - $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$default_cat]) ? $geodir_cat_icons[$default_cat] : ''; |
|
433 | - $mark_extra = (isset($catinfo_obj->marker_extra)) ? $catinfo_obj->marker_extra : ''; |
|
434 | - $title = str_replace($srcharr, $replarr, $post_title); |
|
432 | + $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$default_cat]) ? $geodir_cat_icons[$default_cat] : ''; |
|
433 | + $mark_extra = (isset($catinfo_obj->marker_extra)) ? $catinfo_obj->marker_extra : ''; |
|
434 | + $title = str_replace($srcharr, $replarr, $post_title); |
|
435 | 435 | |
436 | - if ($icon != '') { |
|
437 | - $gd_marker_sizes = empty($gd_marker_sizes) ? array() : $gd_marker_sizes; |
|
436 | + if ($icon != '') { |
|
437 | + $gd_marker_sizes = empty($gd_marker_sizes) ? array() : $gd_marker_sizes; |
|
438 | 438 | |
439 | - if (isset($gd_marker_sizes[$icon])) { |
|
440 | - $icon_size = $gd_marker_sizes[$icon]; |
|
441 | - } else { |
|
442 | - $icon_size = geodir_get_marker_size($icon); |
|
443 | - $gd_marker_sizes[$icon] = $icon_size; |
|
444 | - } |
|
445 | - } else { |
|
446 | - $icon_size = array('w' => 36, 'h' => 45); |
|
447 | - } |
|
448 | - |
|
449 | - $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.'}'; |
|
450 | - $post_ids[] = $catinfo_obj->post_id; |
|
451 | - } |
|
452 | - } |
|
453 | - |
|
454 | - /** |
|
455 | - * Called after marker data is processed into JSON. |
|
456 | - * |
|
457 | - * Called after marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
458 | - * |
|
459 | - * @since 1.4.9 |
|
460 | - * @param array $content_data The array containing all markers in JSON format. |
|
461 | - * @param object $catinfo The posts object containing all marker data. |
|
462 | - * @see 'geodir_before_marker_post_process' |
|
463 | - */ |
|
464 | - do_action('geodir_after_marker_post_process', $content_data, $catinfo); |
|
465 | - |
|
466 | - if (!empty($content_data)) { |
|
467 | - $cat_content_info[] = implode(',', $content_data); |
|
468 | - } |
|
469 | - |
|
470 | - $totalcount = count(array_unique($post_ids)); |
|
471 | - |
|
472 | - if (!empty($cat_content_info)) { |
|
473 | - return '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']'; |
|
474 | - } |
|
475 | - else { |
|
476 | - return '[{"totalcount":"0"}]'; |
|
477 | - } |
|
439 | + if (isset($gd_marker_sizes[$icon])) { |
|
440 | + $icon_size = $gd_marker_sizes[$icon]; |
|
441 | + } else { |
|
442 | + $icon_size = geodir_get_marker_size($icon); |
|
443 | + $gd_marker_sizes[$icon] = $icon_size; |
|
444 | + } |
|
445 | + } else { |
|
446 | + $icon_size = array('w' => 36, 'h' => 45); |
|
447 | + } |
|
448 | + |
|
449 | + $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.'}'; |
|
450 | + $post_ids[] = $catinfo_obj->post_id; |
|
451 | + } |
|
452 | + } |
|
453 | + |
|
454 | + /** |
|
455 | + * Called after marker data is processed into JSON. |
|
456 | + * |
|
457 | + * Called after marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
458 | + * |
|
459 | + * @since 1.4.9 |
|
460 | + * @param array $content_data The array containing all markers in JSON format. |
|
461 | + * @param object $catinfo The posts object containing all marker data. |
|
462 | + * @see 'geodir_before_marker_post_process' |
|
463 | + */ |
|
464 | + do_action('geodir_after_marker_post_process', $content_data, $catinfo); |
|
465 | + |
|
466 | + if (!empty($content_data)) { |
|
467 | + $cat_content_info[] = implode(',', $content_data); |
|
468 | + } |
|
469 | + |
|
470 | + $totalcount = count(array_unique($post_ids)); |
|
471 | + |
|
472 | + if (!empty($cat_content_info)) { |
|
473 | + return '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']'; |
|
474 | + } |
|
475 | + else { |
|
476 | + return '[{"totalcount":"0"}]'; |
|
477 | + } |
|
478 | 478 | } |
479 | 479 | \ 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 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | */ |
81 | 81 | function get_markers() { |
82 | 82 | |
83 | - global $wpdb, $plugin_prefix, $geodir_cat_icons, $gd_marker_sizes,$gd_session; |
|
83 | + global $wpdb, $plugin_prefix, $geodir_cat_icons, $gd_marker_sizes, $gd_session; |
|
84 | 84 | |
85 | 85 | $search = ''; |
86 | 86 | $main_query_array; |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | $post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place'; |
92 | 92 | |
93 | 93 | $map_cat_ids_array = array('0'); |
94 | - $cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)"); |
|
94 | + $cat_find_array = array(" FIND_IN_SET(%d, pd.".$post_type."category)"); |
|
95 | 95 | |
96 | 96 | |
97 | 97 | $field_default_cat = ''; |
@@ -99,13 +99,13 @@ discard block |
||
99 | 99 | $map_cat_arr = trim($_REQUEST['cat_id'], ','); |
100 | 100 | |
101 | 101 | if (!empty($map_cat_arr)) { |
102 | - $field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category "; |
|
102 | + $field_default_cat .= "WHEN (default_category IN (".$map_cat_arr.")) THEN default_category "; |
|
103 | 103 | |
104 | 104 | $map_cat_ids_array = explode(',', $map_cat_arr); |
105 | 105 | $cat_find_array = array(); |
106 | 106 | foreach ($map_cat_ids_array as $cat_id) { |
107 | - $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id "; |
|
108 | - $cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)"; |
|
107 | + $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `".$post_type."category`) > 0) THEN $cat_id "; |
|
108 | + $cat_find_array[] = " FIND_IN_SET(%d, pd.".$post_type."category)"; |
|
109 | 109 | $main_query_array[] = $cat_id; |
110 | 110 | } |
111 | 111 | |
@@ -116,13 +116,13 @@ discard block |
||
116 | 116 | $field_default_cat = ''; |
117 | 117 | |
118 | 118 | if (!empty($cat_find_array)) |
119 | - $search .= "AND (" . implode(' OR ', $cat_find_array) . ")"; |
|
119 | + $search .= "AND (".implode(' OR ', $cat_find_array).")"; |
|
120 | 120 | |
121 | 121 | $main_query_array = $map_cat_ids_array; |
122 | 122 | |
123 | 123 | if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) { |
124 | 124 | $search .= " AND p.post_title LIKE %s"; |
125 | - $main_query_array[] = "%" . $_REQUEST['search'] . "%"; |
|
125 | + $main_query_array[] = "%".$_REQUEST['search']."%"; |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -144,14 +144,14 @@ discard block |
||
144 | 144 | |
145 | 145 | $gd_posttype = ''; |
146 | 146 | if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') { |
147 | - $table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail'; |
|
147 | + $table = $plugin_prefix.$_REQUEST['gd_posttype'].'_detail'; |
|
148 | 148 | $gd_posttype = " AND p.post_type = %s"; |
149 | 149 | $main_query_array[] = $_REQUEST['gd_posttype']; |
150 | 150 | |
151 | 151 | } else |
152 | - $table = $plugin_prefix . 'gd_place_detail'; |
|
152 | + $table = $plugin_prefix.'gd_place_detail'; |
|
153 | 153 | |
154 | - $join = ", " . $table . " AS pd "; |
|
154 | + $join = ", ".$table." AS pd "; |
|
155 | 155 | |
156 | 156 | /** |
157 | 157 | * Filter the SQL JOIN clause for the markers data |
@@ -171,14 +171,14 @@ discard block |
||
171 | 171 | */ |
172 | 172 | $search = apply_filters('geodir_home_map_listing_where', $search); |
173 | 173 | $search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search); |
174 | - $cat_type = $post_type . 'category'; |
|
174 | + $cat_type = $post_type.'category'; |
|
175 | 175 | if ($post_type == 'gd_event') { |
176 | 176 | $event_select = ", pd.recurring_dates, pd.is_recurring"; |
177 | 177 | } else { |
178 | 178 | $event_select = ""; |
179 | 179 | } |
180 | 180 | |
181 | - $sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select; |
|
181 | + $sql_select = 'SELECT pd.default_category, pd.'.$cat_type.', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude'.$event_select; |
|
182 | 182 | /** |
183 | 183 | * Filter the SQL SELECT clause to retrive fields data |
184 | 184 | * |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | */ |
199 | 199 | $groupby = apply_filters('geodir_home_map_listing_groupby', $groupby); |
200 | 200 | |
201 | - $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 | + $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); |
|
202 | 202 | |
203 | 203 | /** |
204 | 204 | * Filter the SQL query to retrive markers data |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | global $geodir_date_time_format, $geodir_date_format, $geodir_time_format; |
249 | 249 | |
250 | 250 | $today = strtotime(date_i18n('Y-m-d')); |
251 | - $show_dates = $post_type == 'gd_event' ? (int)get_option('geodir_event_infowindow_dates_count', 1) : 0; |
|
251 | + $show_dates = $post_type == 'gd_event' ? (int) get_option('geodir_event_infowindow_dates_count', 1) : 0; |
|
252 | 252 | |
253 | 253 | foreach ($catinfo as $catinfo_obj) { |
254 | 254 | $post_title = $catinfo_obj->post_title; |
@@ -264,29 +264,29 @@ discard block |
||
264 | 264 | $endtimes = ''; |
265 | 265 | $astarttimes = array(); |
266 | 266 | $aendtimes = array(); |
267 | - if ( !isset( $recurring_data['repeat_type'] ) ) { |
|
267 | + if (!isset($recurring_data['repeat_type'])) { |
|
268 | 268 | $recurring_data['repeat_type'] = 'custom'; |
269 | 269 | } |
270 | - $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 |
|
271 | - $different_times = isset( $recurring_data['different_times'] ) && !empty( $recurring_data['different_times'] ) ? true : false; |
|
270 | + $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 |
|
271 | + $different_times = isset($recurring_data['different_times']) && !empty($recurring_data['different_times']) ? true : false; |
|
272 | 272 | |
273 | 273 | $recurring_dates = explode(',', $recurring_data['event_recurring_dates']); |
274 | 274 | |
275 | - if ( !empty( $recurring_dates ) ) { |
|
276 | - if ( empty( $recurring_data['all_day'] ) ) { |
|
277 | - if ( $repeat_type == 'custom' && $different_times ) { |
|
278 | - $astarttimes = isset( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array(); |
|
279 | - $aendtimes = isset( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array(); |
|
275 | + if (!empty($recurring_dates)) { |
|
276 | + if (empty($recurring_data['all_day'])) { |
|
277 | + if ($repeat_type == 'custom' && $different_times) { |
|
278 | + $astarttimes = isset($recurring_data['starttimes']) ? $recurring_data['starttimes'] : array(); |
|
279 | + $aendtimes = isset($recurring_data['endtimes']) ? $recurring_data['endtimes'] : array(); |
|
280 | 280 | } else { |
281 | - $starttimes = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : ''; |
|
282 | - $endtimes = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : ''; |
|
281 | + $starttimes = isset($recurring_data['starttime']) ? $recurring_data['starttime'] : ''; |
|
282 | + $endtimes = isset($recurring_data['endtime']) ? $recurring_data['endtime'] : ''; |
|
283 | 283 | } |
284 | 284 | } |
285 | 285 | |
286 | 286 | $e = 0; |
287 | - foreach( $recurring_dates as $key => $date ) { |
|
288 | - if ( $repeat_type == 'custom' && $different_times ) { |
|
289 | - if ( !empty( $astarttimes ) && isset( $astarttimes[$key] ) ) { |
|
287 | + foreach ($recurring_dates as $key => $date) { |
|
288 | + if ($repeat_type == 'custom' && $different_times) { |
|
289 | + if (!empty($astarttimes) && isset($astarttimes[$key])) { |
|
290 | 290 | $starttimes = $astarttimes[$key]; |
291 | 291 | $endtimes = $aendtimes[$key]; |
292 | 292 | } else { |
@@ -295,50 +295,50 @@ discard block |
||
295 | 295 | } |
296 | 296 | } |
297 | 297 | |
298 | - $duration = isset( $recurring_data['duration_x'] ) && (int)$recurring_data['duration_x'] > 0 ? (int)$recurring_data['duration_x'] : 1; |
|
298 | + $duration = isset($recurring_data['duration_x']) && (int) $recurring_data['duration_x'] > 0 ? (int) $recurring_data['duration_x'] : 1; |
|
299 | 299 | $duration--; |
300 | - $enddate = date_i18n( 'Y-m-d', strtotime( $date . ' + ' . $duration . ' day' ) ); |
|
300 | + $enddate = date_i18n('Y-m-d', strtotime($date.' + '.$duration.' day')); |
|
301 | 301 | |
302 | 302 | // Hide past dates |
303 | - if ( strtotime( $enddate ) < $today ) { |
|
303 | + if (strtotime($enddate) < $today) { |
|
304 | 304 | continue; |
305 | 305 | } |
306 | 306 | |
307 | - $sdate = strtotime( $date . ' ' . $starttimes ); |
|
308 | - $edate = strtotime( $enddate . ' ' . $endtimes ); |
|
307 | + $sdate = strtotime($date.' '.$starttimes); |
|
308 | + $edate = strtotime($enddate.' '.$endtimes); |
|
309 | 309 | |
310 | - $start_date = date_i18n( $geodir_date_time_format, $sdate ); |
|
311 | - $end_date = date_i18n( $geodir_date_time_format, $edate ); |
|
310 | + $start_date = date_i18n($geodir_date_time_format, $sdate); |
|
311 | + $end_date = date_i18n($geodir_date_time_format, $edate); |
|
312 | 312 | |
313 | 313 | $same_day = false; |
314 | 314 | $full_day = false; |
315 | 315 | $same_datetime = false; |
316 | 316 | |
317 | - if ( $starttimes == $endtimes && ( $starttimes == '' || $starttimes == '00:00:00' || $starttimes == '00:00' ) ) { |
|
317 | + if ($starttimes == $endtimes && ($starttimes == '' || $starttimes == '00:00:00' || $starttimes == '00:00')) { |
|
318 | 318 | $full_day = true; |
319 | 319 | } |
320 | 320 | |
321 | - if ( $start_date == $end_date && $full_day ) { |
|
321 | + if ($start_date == $end_date && $full_day) { |
|
322 | 322 | $same_datetime = true; |
323 | 323 | } |
324 | 324 | |
325 | - $link_date = date_i18n( 'Y-m-d', $sdate ); |
|
326 | - $title_date = date_i18n( $geodir_date_format, $sdate ); |
|
327 | - if ( $full_day ) { |
|
325 | + $link_date = date_i18n('Y-m-d', $sdate); |
|
326 | + $title_date = date_i18n($geodir_date_format, $sdate); |
|
327 | + if ($full_day) { |
|
328 | 328 | $start_date = $title_date; |
329 | - $end_date = date_i18n( $geodir_date_format, $edate ); |
|
329 | + $end_date = date_i18n($geodir_date_format, $edate); |
|
330 | 330 | } |
331 | 331 | |
332 | - if ( !$same_datetime && !$full_day && date_i18n( 'Y-m-d', $sdate ) == date_i18n( 'Y-m-d', $edate ) ) { |
|
332 | + if (!$same_datetime && !$full_day && date_i18n('Y-m-d', $sdate) == date_i18n('Y-m-d', $edate)) { |
|
333 | 333 | $same_day = true; |
334 | 334 | |
335 | - $start_date .= ' - ' . date_i18n( $geodir_time_format, $edate ); |
|
335 | + $start_date .= ' - '.date_i18n($geodir_time_format, $edate); |
|
336 | 336 | } |
337 | 337 | |
338 | - $event_dates .= ' :: ' . $start_date; |
|
338 | + $event_dates .= ' :: '.$start_date; |
|
339 | 339 | |
340 | - if ( !$same_day && !$same_datetime ) { |
|
341 | - $event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date; |
|
340 | + if (!$same_day && !$same_datetime) { |
|
341 | + $event_dates .= ' '.__('to', 'geodirectory').' '.$end_date; |
|
342 | 342 | } |
343 | 343 | |
344 | 344 | $e++; |
@@ -349,67 +349,67 @@ discard block |
||
349 | 349 | } |
350 | 350 | } |
351 | 351 | } else { |
352 | - $start_date = isset( $recurring_data['event_start'] ) ? $recurring_data['event_start'] : ''; |
|
353 | - $end_date = isset( $recurring_data['event_end'] ) ? $recurring_data['event_end'] : $start_date; |
|
354 | - $all_day = isset( $recurring_data['all_day'] ) && !empty( $recurring_data['all_day'] ) ? true : false; |
|
355 | - $starttime = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : ''; |
|
356 | - $endtime = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : ''; |
|
352 | + $start_date = isset($recurring_data['event_start']) ? $recurring_data['event_start'] : ''; |
|
353 | + $end_date = isset($recurring_data['event_end']) ? $recurring_data['event_end'] : $start_date; |
|
354 | + $all_day = isset($recurring_data['all_day']) && !empty($recurring_data['all_day']) ? true : false; |
|
355 | + $starttime = isset($recurring_data['starttime']) ? $recurring_data['starttime'] : ''; |
|
356 | + $endtime = isset($recurring_data['endtime']) ? $recurring_data['endtime'] : ''; |
|
357 | 357 | |
358 | - $event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] ); |
|
359 | - $starttimes = isset( $recurring_data['starttimes'] ) && !empty( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array(); |
|
360 | - $endtimes = isset( $recurring_data['endtimes'] ) && !empty( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array(); |
|
358 | + $event_recurring_dates = explode(',', $recurring_data['event_recurring_dates']); |
|
359 | + $starttimes = isset($recurring_data['starttimes']) && !empty($recurring_data['starttimes']) ? $recurring_data['starttimes'] : array(); |
|
360 | + $endtimes = isset($recurring_data['endtimes']) && !empty($recurring_data['endtimes']) ? $recurring_data['endtimes'] : array(); |
|
361 | 361 | |
362 | - if ( !geodir_event_is_date( $start_date ) && !empty( $event_recurring_dates ) ) { |
|
362 | + if (!geodir_event_is_date($start_date) && !empty($event_recurring_dates)) { |
|
363 | 363 | $start_date = $event_recurring_dates[0]; |
364 | 364 | } |
365 | 365 | |
366 | - if ( strtotime( $end_date ) < strtotime( $start_date ) ) { |
|
366 | + if (strtotime($end_date) < strtotime($start_date)) { |
|
367 | 367 | $end_date = $start_date; |
368 | 368 | } |
369 | 369 | |
370 | 370 | if ($end_date != '' && strtotime($end_date) >= $today) { |
371 | - if ( $starttime == '' && !empty( $starttimes ) ) { |
|
371 | + if ($starttime == '' && !empty($starttimes)) { |
|
372 | 372 | $starttime = $starttimes[0]; |
373 | 373 | $endtime = $endtimes[0]; |
374 | 374 | } |
375 | 375 | |
376 | 376 | $same_day = false; |
377 | 377 | $one_day = false; |
378 | - if ( $start_date == $end_date && $all_day ) { |
|
378 | + if ($start_date == $end_date && $all_day) { |
|
379 | 379 | $one_day = true; |
380 | 380 | } |
381 | 381 | |
382 | - if ( $all_day ) { |
|
383 | - $start_datetime = strtotime( $start_date ); |
|
384 | - $end_datetime = strtotime( $end_date ); |
|
382 | + if ($all_day) { |
|
383 | + $start_datetime = strtotime($start_date); |
|
384 | + $end_datetime = strtotime($end_date); |
|
385 | 385 | |
386 | - $start_date = date_i18n( $geodir_date_format, $start_datetime ); |
|
387 | - $end_date = date_i18n( $geodir_date_format, $end_datetime ); |
|
388 | - if ( $start_date == $end_date ) { |
|
386 | + $start_date = date_i18n($geodir_date_format, $start_datetime); |
|
387 | + $end_date = date_i18n($geodir_date_format, $end_datetime); |
|
388 | + if ($start_date == $end_date) { |
|
389 | 389 | $one_day = true; |
390 | 390 | } |
391 | 391 | } else { |
392 | - if ( $start_date == $end_date && $starttime == $endtime ) { |
|
393 | - $end_date = date_i18n( 'Y-m-d', strtotime( $start_date . ' ' . $starttime . ' +1 day' ) ); |
|
392 | + if ($start_date == $end_date && $starttime == $endtime) { |
|
393 | + $end_date = date_i18n('Y-m-d', strtotime($start_date.' '.$starttime.' +1 day')); |
|
394 | 394 | $one_day = false; |
395 | 395 | } |
396 | - $start_datetime = strtotime( $start_date . ' ' . $starttime ); |
|
397 | - $end_datetime = strtotime( $end_date . ' ' . $endtime ); |
|
396 | + $start_datetime = strtotime($start_date.' '.$starttime); |
|
397 | + $end_datetime = strtotime($end_date.' '.$endtime); |
|
398 | 398 | |
399 | - $start_date = date_i18n( $geodir_date_time_format, $start_datetime ); |
|
400 | - $end_date = date_i18n( $geodir_date_time_format, $end_datetime ); |
|
399 | + $start_date = date_i18n($geodir_date_time_format, $start_datetime); |
|
400 | + $end_date = date_i18n($geodir_date_time_format, $end_datetime); |
|
401 | 401 | } |
402 | 402 | |
403 | - if ( !$one_day && date_i18n( 'Y-m-d', $start_datetime ) == date_i18n( 'Y-m-d', $end_datetime ) ) { |
|
403 | + if (!$one_day && date_i18n('Y-m-d', $start_datetime) == date_i18n('Y-m-d', $end_datetime)) { |
|
404 | 404 | $same_day = true; |
405 | 405 | |
406 | - $start_date .= ' - ' . date_i18n( $geodir_time_format, $end_datetime ); |
|
406 | + $start_date .= ' - '.date_i18n($geodir_time_format, $end_datetime); |
|
407 | 407 | } |
408 | 408 | |
409 | - $event_dates .= ' :: ' . $start_date; |
|
409 | + $event_dates .= ' :: '.$start_date; |
|
410 | 410 | |
411 | - if ( !$same_day && !$one_day ) { |
|
412 | - $event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date; |
|
411 | + if (!$same_day && !$one_day) { |
|
412 | + $event_dates .= ' '.__('to', 'geodirectory').' '.$end_date; |
|
413 | 413 | } |
414 | 414 | } |
415 | 415 | } |
@@ -425,8 +425,8 @@ discard block |
||
425 | 425 | $default_cat = isset($catinfo_obj->default_category) ? $catinfo_obj->default_category : ''; |
426 | 426 | |
427 | 427 | // if single cat lets just show that icon |
428 | - if(is_array($map_cat_ids_array) && count($map_cat_ids_array)==1){ |
|
429 | - $default_cat = (int)$map_cat_ids_array[0]; |
|
428 | + if (is_array($map_cat_ids_array) && count($map_cat_ids_array) == 1) { |
|
429 | + $default_cat = (int) $map_cat_ids_array[0]; |
|
430 | 430 | } |
431 | 431 | |
432 | 432 | $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$default_cat]) ? $geodir_cat_icons[$default_cat] : ''; |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | $icon_size = array('w' => 36, 'h' => 45); |
447 | 447 | } |
448 | 448 | |
449 | - $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.'}'; |
|
449 | + $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.'}'; |
|
450 | 450 | $post_ids[] = $catinfo_obj->post_id; |
451 | 451 | } |
452 | 452 | } |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | $totalcount = count(array_unique($post_ids)); |
471 | 471 | |
472 | 472 | if (!empty($cat_content_info)) { |
473 | - return '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']'; |
|
473 | + return '[{"totalcount":"'.$totalcount.'",'.substr(implode(',', $cat_content_info), 1).']'; |
|
474 | 474 | } |
475 | 475 | else { |
476 | 476 | return '[{"totalcount":"0"}]'; |