Test Failed
Push — master ( faf44c...4eb591 )
by Stiofan
17:38
created
geodirectory-functions/map-functions/get_markers.php 1 patch
Spacing   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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"}]';
Please login to merge, or discard this patch.
geodirectory-functions/map-functions/map_template_tags.php 1 patch
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -129,12 +129,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.