Test Failed
Push — master ( f5f5fe...9630d5 )
by Stiofan
04:13
created
geodirectory-functions/map-functions/map_template_tags.php 3 patches
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -225,10 +225,11 @@  discard block
 block discarded – undo
225 225
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="0"/>
226 226
                 <?php }
227 227
 
228
-                if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters'])
229
-                    $show_entire_cat_panel = "none";
230
-                else
231
-                    $show_entire_cat_panel = "''";
228
+                if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters']) {
229
+                                    $show_entire_cat_panel = "none";
230
+                } else {
231
+                                    $show_entire_cat_panel = "''";
232
+                }
232 233
                 ?>
233 234
 
234 235
                 <?php if ($geodir_map_options['enable_map_direction']) { ?>
@@ -302,8 +303,9 @@  discard block
 block discarded – undo
302 303
 				}
303 304
 				
304 305
 				$geodir_default_map_search_pt = get_option('geodir_default_map_search_pt');
305
-				if (empty($geodir_default_map_search_pt))
306
-					$geodir_default_map_search_pt = 'gd_place';
306
+				if (empty($geodir_default_map_search_pt)) {
307
+									$geodir_default_map_search_pt = 'gd_place';
308
+				}
307 309
 
308 310
                 global $gd_session;
309 311
                 $homemap_catlist_ptype = $gd_session->get('homemap_catlist_ptype');
Please login to merge, or discard this patch.
Indentation   +140 added lines, -140 removed lines patch added patch discarded remove patch
@@ -67,77 +67,77 @@  discard block
 block discarded – undo
67 67
  */
68 68
 function geodir_draw_map($map_args = array())
69 69
 {
70
-    global $map_canvas_arr;
71
-    $map_canvas_name = (!empty($map_args) && $map_args['map_canvas_name'] != '') ? $map_args['map_canvas_name'] : 'home_map_canvas';
72
-    $map_class_name = (!empty($map_args) && isset($map_args['map_class_name'])) ? $map_args['map_class_name'] : '';
73
-
74
-    $default_location = geodir_get_default_location();
75
-
76
-    $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
77
-    $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
78
-    $map_default_zoom = 12;
79
-    // map options default values
80
-    $width = 950;
81
-    $height = 450;
82
-    $child_collapse = '0';
83
-    $sticky = '';
84
-    $enable_cat_filters = false;
85
-    $enable_text_search = false;
86
-    $enable_post_type_filters = false;
87
-    $enable_location_filters = false;
88
-    $enable_jason_on_load = false;
89
-    $enable_map_direction = false;
90
-    $enable_marker_cluster = false;
91
-    $enable_map_resize_button = false;
92
-    $maptype = 'ROADMAP';
93
-
94
-    $geodir_map_options = array(
95
-        'width' => $width,
96
-        'height' => $height,
97
-        'child_collapse' => $child_collapse,
98
-        'sticky' => $sticky,
99
-        'enable_map_resize_button' => $enable_map_resize_button,
100
-        'enable_cat_filters' => $enable_cat_filters,
101
-        'enable_text_search' => $enable_text_search,
102
-        'enable_post_type_filters' => $enable_post_type_filters,
103
-        'enable_location_filters' => $enable_location_filters,
104
-        'enable_jason_on_load' => $enable_jason_on_load,
105
-        'enable_map_direction' => $enable_map_direction,
106
-        'enable_marker_cluster' => $enable_marker_cluster,
107
-        'ajax_url' => geodir_get_ajax_url(),
108
-        'map_canvas_name' => $map_canvas_name,
109
-        'inputText' => __('Title or Keyword', 'geodirectory'),
110
-        'latitude' => $map_default_lat,
111
-        'longitude' => $map_default_lng,
112
-        'zoom' => $map_default_zoom,
113
-        'scrollwheel' => true,
114
-        'streetViewControl' => true,
115
-        'maptype' => $maptype,
116
-        'showPreview' => '0',
117
-        'maxZoom' => 21,
118
-        'autozoom' => true,
119
-        'bubble_size' => 'small',
120
-        'token' => '68f48005e256696074e1da9bf9f67f06',
121
-        'navigationControlOptions' => array('position' => 'TOP_LEFT', 'style' => 'ZOOM_PAN')
122
-    );
123
-
124
-    if (!empty($map_args)) {
125
-        foreach ($map_args as $map_option_key => $map_option_value) {
126
-            $geodir_map_options[$map_option_key] = $map_option_value;
127
-        }
128
-    }
129
-
130
-    if (strpos($geodir_map_options['height'], '%') !== false || strpos($geodir_map_options['height'], 'px') !== false || strpos($geodir_map_options['height'], 'vh') !== false) {
131
-    } else {
132
-        $geodir_map_options['height'] = $geodir_map_options['height'] . 'px';
133
-    }
134
-
135
-    if (strpos($geodir_map_options['width'], '%') !== false || strpos($geodir_map_options['width'], 'px') !== false) {
136
-    } else {
137
-        $geodir_map_options['width'] = $geodir_map_options['width'] . 'px';
138
-    }
139
-
140
-    /**
70
+	global $map_canvas_arr;
71
+	$map_canvas_name = (!empty($map_args) && $map_args['map_canvas_name'] != '') ? $map_args['map_canvas_name'] : 'home_map_canvas';
72
+	$map_class_name = (!empty($map_args) && isset($map_args['map_class_name'])) ? $map_args['map_class_name'] : '';
73
+
74
+	$default_location = geodir_get_default_location();
75
+
76
+	$map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
77
+	$map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
78
+	$map_default_zoom = 12;
79
+	// map options default values
80
+	$width = 950;
81
+	$height = 450;
82
+	$child_collapse = '0';
83
+	$sticky = '';
84
+	$enable_cat_filters = false;
85
+	$enable_text_search = false;
86
+	$enable_post_type_filters = false;
87
+	$enable_location_filters = false;
88
+	$enable_jason_on_load = false;
89
+	$enable_map_direction = false;
90
+	$enable_marker_cluster = false;
91
+	$enable_map_resize_button = false;
92
+	$maptype = 'ROADMAP';
93
+
94
+	$geodir_map_options = array(
95
+		'width' => $width,
96
+		'height' => $height,
97
+		'child_collapse' => $child_collapse,
98
+		'sticky' => $sticky,
99
+		'enable_map_resize_button' => $enable_map_resize_button,
100
+		'enable_cat_filters' => $enable_cat_filters,
101
+		'enable_text_search' => $enable_text_search,
102
+		'enable_post_type_filters' => $enable_post_type_filters,
103
+		'enable_location_filters' => $enable_location_filters,
104
+		'enable_jason_on_load' => $enable_jason_on_load,
105
+		'enable_map_direction' => $enable_map_direction,
106
+		'enable_marker_cluster' => $enable_marker_cluster,
107
+		'ajax_url' => geodir_get_ajax_url(),
108
+		'map_canvas_name' => $map_canvas_name,
109
+		'inputText' => __('Title or Keyword', 'geodirectory'),
110
+		'latitude' => $map_default_lat,
111
+		'longitude' => $map_default_lng,
112
+		'zoom' => $map_default_zoom,
113
+		'scrollwheel' => true,
114
+		'streetViewControl' => true,
115
+		'maptype' => $maptype,
116
+		'showPreview' => '0',
117
+		'maxZoom' => 21,
118
+		'autozoom' => true,
119
+		'bubble_size' => 'small',
120
+		'token' => '68f48005e256696074e1da9bf9f67f06',
121
+		'navigationControlOptions' => array('position' => 'TOP_LEFT', 'style' => 'ZOOM_PAN')
122
+	);
123
+
124
+	if (!empty($map_args)) {
125
+		foreach ($map_args as $map_option_key => $map_option_value) {
126
+			$geodir_map_options[$map_option_key] = $map_option_value;
127
+		}
128
+	}
129
+
130
+	if (strpos($geodir_map_options['height'], '%') !== false || strpos($geodir_map_options['height'], 'px') !== false || strpos($geodir_map_options['height'], 'vh') !== false) {
131
+	} else {
132
+		$geodir_map_options['height'] = $geodir_map_options['height'] . 'px';
133
+	}
134
+
135
+	if (strpos($geodir_map_options['width'], '%') !== false || strpos($geodir_map_options['width'], 'px') !== false) {
136
+	} else {
137
+		$geodir_map_options['width'] = $geodir_map_options['width'] . 'px';
138
+	}
139
+
140
+	/**
141 141
 	 * Filter the options to use in google map.
142 142
 	 *
143 143
 	 * @since 1.0.0
@@ -146,9 +146,9 @@  discard block
 block discarded – undo
146 146
 	 */
147 147
 	$geodir_map_options = apply_filters("geodir_map_options_{$map_canvas_name}", $geodir_map_options);
148 148
 
149
-    $map_canvas_arr[$map_canvas_name] = array();
149
+	$map_canvas_arr[$map_canvas_name] = array();
150 150
 
151
-    /**
151
+	/**
152 152
 	 * Filter the post types to display data on map.
153 153
 	 *
154 154
 	 * @since 1.0.0
@@ -166,20 +166,20 @@  discard block
 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)):
170
-        // Set default map options
169
+	if (count((array)$post_types) != count($exclude_post_types) || ($enable_jason_on_load)):
170
+		// Set default map options
171 171
 
172
-        wp_enqueue_script('geodir-map-widget', geodir_plugin_url() . '/geodirectory-functions/map-functions/js/map.min.js',array(),false,true);
172
+		wp_enqueue_script('geodir-map-widget', geodir_plugin_url() . '/geodirectory-functions/map-functions/js/map.min.js',array(),false,true);
173 173
 
174
-        wp_localize_script('geodir-map-widget', $map_canvas_name, $geodir_map_options);
174
+		wp_localize_script('geodir-map-widget', $map_canvas_name, $geodir_map_options);
175 175
 
176
-        if ($map_canvas_name == 'detail_page_map_canvas' || $map_canvas_name == 'preview_map_canvas') {
177
-            $map_width = '100%';
178
-        } else {
179
-            $map_width = $geodir_map_options['width'];
180
-        }
176
+		if ($map_canvas_name == 'detail_page_map_canvas' || $map_canvas_name == 'preview_map_canvas') {
177
+			$map_width = '100%';
178
+		} else {
179
+			$map_width = $geodir_map_options['width'];
180
+		}
181 181
 
182
-        /**
182
+		/**
183 183
 		 * Filter the width of map.
184 184
 		 *
185 185
 		 * @since 1.0.0
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 		 * @param int $map_width Width of map box, eg: gd_place.
188 188
 		 */
189 189
 		$map_width = apply_filters('geodir_change_map_width', $map_width);
190
-        ?>
190
+		?>
191 191
         <div id="catcher_<?php echo $map_canvas_name;?>"></div>
192 192
         <div class="stick_trigger_container">
193 193
             <div class="trigger_sticky triggeroff_sticky"></div>
@@ -221,15 +221,15 @@  discard block
 block discarded – undo
221 221
                 <?php if ($geodir_map_options['enable_jason_on_load']) { ?>
222 222
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="1"/>
223 223
                 <?php } else {
224
-                    ?>
224
+					?>
225 225
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="0"/>
226 226
                 <?php }
227 227
 
228
-                if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters'])
229
-                    $show_entire_cat_panel = "none";
230
-                else
231
-                    $show_entire_cat_panel = "''";
232
-                ?>
228
+				if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters'])
229
+					$show_entire_cat_panel = "none";
230
+				else
231
+					$show_entire_cat_panel = "''";
232
+				?>
233 233
 
234 234
                 <?php if ($geodir_map_options['enable_map_direction']) { ?>
235 235
                     <div class="gd-input-group gd-get-directions">
@@ -292,8 +292,8 @@  discard block
 block discarded – undo
292 292
                         <select id="travel-units" onchange="calcRoute('<?php echo $map_canvas_name; ?>')">
293 293
                             <option value="miles"><?php _e('Miles', 'geodirectory'); ?></option>
294 294
                             <option <?php if (get_option('geodir_search_dist_1') == 'km') {
295
-                                echo 'selected="selected"';
296
-                            } ?> value="kilometers"><?php _e('Kilometers', 'geodirectory'); ?></option>
295
+								echo 'selected="selected"';
296
+							} ?> value="kilometers"><?php _e('Kilometers', 'geodirectory'); ?></option>
297 297
                         </select>
298 298
                     </div>
299 299
 
@@ -305,12 +305,12 @@  discard block
 block discarded – undo
305 305
 				if (empty($geodir_default_map_search_pt))
306 306
 					$geodir_default_map_search_pt = 'gd_place';
307 307
 
308
-                global $gd_session;
309
-                $homemap_catlist_ptype = $gd_session->get('homemap_catlist_ptype');
308
+				global $gd_session;
309
+				$homemap_catlist_ptype = $gd_session->get('homemap_catlist_ptype');
310 310
 
311
-                if ($homemap_catlist_ptype) {
312
-                    $geodir_default_map_search_pt = $homemap_catlist_ptype;
313
-                }
311
+				if ($homemap_catlist_ptype) {
312
+					$geodir_default_map_search_pt = $homemap_catlist_ptype;
313
+				}
314 314
 
315 315
 				/**
316 316
 				 * Filter the post type to retrieve data for map
@@ -323,13 +323,13 @@  discard block
 block discarded – undo
323 323
 				?>
324 324
                 <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel;?>">
325 325
                     <?php
326
-                    $exclude_post_types = get_option('geodir_exclude_post_type_on_map');
327
-                    $geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types);
326
+					$exclude_post_types = get_option('geodir_exclude_post_type_on_map');
327
+					$geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types);
328 328
 					$map_cat_class = '';
329 329
 					if ($geodir_map_options['enable_post_type_filters']) {
330 330
 						$map_cat_class = $geodir_available_pt_on_map > 1 ? ' map-cat-ptypes' : ' map-cat-floor';
331 331
 					}
332
-                    ?>
332
+					?>
333 333
                     <div
334 334
                         class="map-category-listing<?php echo $map_cat_class;?>">
335 335
                         <div class="gd-trigger gd-triggeroff"><i class="fa fa-compress"></i><i class="fa fa-expand"></i></div>
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
                                 <?php if ($geodir_map_options['child_collapse']) { $child_collapse = "1"; ?>
348 348
                                     <input type="hidden" id="<?php echo $map_canvas_name; ?>_child_collapse" value="1"/>
349 349
                                 <?php } else {$child_collapse = "0";
350
-                                    ?>
350
+									?>
351 351
                                     <input type="hidden" id="<?php echo $map_canvas_name;?>_child_collapse" value="0"/>
352 352
                                 <?php } ?>
353 353
                                 <input type="hidden" id="<?php echo $map_canvas_name; ?>_cat_enabled" value="1"/>
@@ -369,17 +369,17 @@  discard block
 block discarded – undo
369 369
                 <!-- map-category-listings-->
370 370
 
371 371
                 <?php
372
-                if ($geodir_map_options['enable_location_filters']) {
372
+				if ($geodir_map_options['enable_location_filters']) {
373 373
 					$country = get_query_var('gd_country');
374 374
 					$region = get_query_var('gd_region');
375 375
 					$city = get_query_var('gd_city');
376 376
                     
377
-                    //fix for location/me page
378
-                    $country = $country != 'me' ? $country : '';
377
+					//fix for location/me page
378
+					$country = $country != 'me' ? $country : '';
379 379
 					$region = $region != 'me' ? $region : '';
380 380
 					$city = $country != 'me' ? $city : '';
381
-                    $gd_neighbourhood = isset($_REQUEST['gd_neighbourhood']) ? sanitize_text_field($_REQUEST['gd_neighbourhood']) : '';
382
-                    ?>
381
+					$gd_neighbourhood = isset($_REQUEST['gd_neighbourhood']) ? sanitize_text_field($_REQUEST['gd_neighbourhood']) : '';
382
+					?>
383 383
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="1"/>
384 384
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_country" name="gd_country"
385 385
                            value="<?php echo $country;?>"/>
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_neighbourhood" name="gd_neighbourhood"
391 391
                            value="<?php echo $gd_neighbourhood;?>"/>
392 392
                 <?php } else { //end of location filter
393
-                    ?>
393
+					?>
394 394
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="0"/>
395 395
                 <?php }?>
396 396
 
@@ -401,16 +401,16 @@  discard block
 block discarded – undo
401 401
 
402 402
 
403 403
                 <?php if ($geodir_map_options['enable_post_type_filters']) {
404
-                    $post_types = geodir_get_posttypes('object');
405
-                    $all_post_types = geodir_get_posttypes('names');
406
-                    $exclude_post_types = get_option('geodir_exclude_post_type_on_map');
407
-                    if (is_array($exclude_post_types)) {
408
-                        $map_post_types = array_diff($all_post_types, $exclude_post_types);
409
-                    } else {
410
-                        $map_post_types = $all_post_types;
411
-                    }
412
-                    if (count($map_post_types) > 1) {
413
-                        ?>
404
+					$post_types = geodir_get_posttypes('object');
405
+					$all_post_types = geodir_get_posttypes('names');
406
+					$exclude_post_types = get_option('geodir_exclude_post_type_on_map');
407
+					if (is_array($exclude_post_types)) {
408
+						$map_post_types = array_diff($all_post_types, $exclude_post_types);
409
+					} else {
410
+						$map_post_types = $all_post_types;
411
+					}
412
+					if (count($map_post_types) > 1) {
413
+						?>
414 414
                         <div class="map-places-listing" id="<?php echo $map_canvas_name;?>_posttype_menu"
415 415
                              style="max-width:<?php echo $map_width;?>!important;">
416 416
 
@@ -420,13 +420,13 @@  discard block
 block discarded – undo
420 420
                                     <?php
421 421
 
422 422
 
423
-                                    foreach ($post_types as $post_type => $args) {
424
-                                        if (!in_array($post_type, $exclude_post_types)) {
425
-                                            $class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : '';
423
+									foreach ($post_types as $post_type => $args) {
424
+										if (!in_array($post_type, $exclude_post_types)) {
425
+											$class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : '';
426 426
 											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
-                                        }
428
-                                    }
429
-                                    ?>
427
+										}
428
+									}
429
+									?>
430 430
                                 </ul>
431 431
                                 <?php if (isset($geodir_map_options['is_geodir_home_map_widget']) && $map_args['is_geodir_home_map_widget']) { ?>
432 432
                             </div><?php } ?>
@@ -440,8 +440,8 @@  discard block
 block discarded – undo
440 440
 
441 441
                         </div> <!-- map-places-listings-->
442 442
                     <?php }
443
-                } // end of post type filter if
444
-                ?>
443
+				} // end of post type filter if
444
+				?>
445 445
 
446 446
             </div>
447 447
         </div> <!--end of stick trigger container-->
@@ -456,8 +456,8 @@  discard block
 block discarded – undo
456 456
         </script>
457 457
         <?php
458 458
 
459
-        if (strpos($geodir_map_options['height'], 'vh')) {
460
-            ?>
459
+		if (strpos($geodir_map_options['height'], 'vh')) {
460
+			?>
461 461
             <script>
462 462
                 (function () {
463 463
                     var screenH = jQuery(window).height();
@@ -479,8 +479,8 @@  discard block
 block discarded – undo
479 479
 
480 480
         <?php
481 481
 
482
-        } elseif (strpos($geodir_map_options['height'], 'px')) {
483
-            ?>
482
+		} elseif (strpos($geodir_map_options['height'], 'px')) {
483
+			?>
484 484
             <script>
485 485
                 (function () {
486 486
                     var screenH = jQuery(window).height();
@@ -495,20 +495,20 @@  discard block
 block discarded – undo
495 495
                 }());
496 496
             </script>
497 497
         <?php
498
-        }
498
+		}
499 499
 
500
-        /**
501
-         * Action that runs after all the map code has been output;
502
-         *
503
-         * @since 1.5.3
504
-         *
505
-         * @param array $geodir_map_options Array of map settings.
506
-         * @param string $map_canvas_name The canvas name and ID for the map.
507
-         */
508
-        do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name);
500
+		/**
501
+		 * Action that runs after all the map code has been output;
502
+		 *
503
+		 * @since 1.5.3
504
+		 *
505
+		 * @param array $geodir_map_options Array of map settings.
506
+		 * @param string $map_canvas_name The canvas name and ID for the map.
507
+		 */
508
+		do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name);
509 509
 
510 510
 
511
-    endif; // Exclude posttypes if end
511
+	endif; // Exclude posttypes if end
512 512
 }
513 513
 
514 514
 /**
Please login to merge, or discard this 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>
@@ -380,21 +380,21 @@  discard block
 block discarded – undo
380 380
 					$city = $country != 'me' ? $city : '';
381 381
                     $gd_neighbourhood = isset($_REQUEST['gd_neighbourhood']) ? sanitize_text_field($_REQUEST['gd_neighbourhood']) : '';
382 382
                     ?>
383
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="1"/>
384
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_country" name="gd_country"
385
-                           value="<?php echo $country;?>"/>
386
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_region" name="gd_region"
387
-                           value="<?php echo $region;?>"/>
388
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_city" name="gd_city"
389
-                           value="<?php echo $city;?>"/>
390
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_neighbourhood" name="gd_neighbourhood"
391
-                           value="<?php echo $gd_neighbourhood;?>"/>
383
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_location_enabled" value="1"/>
384
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_country" name="gd_country"
385
+                           value="<?php echo $country; ?>"/>
386
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_region" name="gd_region"
387
+                           value="<?php echo $region; ?>"/>
388
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_city" name="gd_city"
389
+                           value="<?php echo $city; ?>"/>
390
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_neighbourhood" name="gd_neighbourhood"
391
+                           value="<?php echo $gd_neighbourhood; ?>"/>
392 392
                 <?php } else { //end of location filter
393 393
                     ?>
394
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="0"/>
394
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_location_enabled" value="0"/>
395 395
                 <?php }?>
396 396
 
397
-                <input type="hidden" id="<?php echo $map_canvas_name;?>_posttype" name="gd_posttype" value="<?php echo $map_search_pt;?>"/>
397
+                <input type="hidden" id="<?php echo $map_canvas_name; ?>_posttype" name="gd_posttype" value="<?php echo $map_search_pt; ?>"/>
398 398
 
399 399
                 <input type="hidden" name="limitstart" value=""/>
400 400
 
@@ -411,8 +411,8 @@  discard block
 block discarded – undo
411 411
                     }
412 412
                     if (count($map_post_types) > 1) {
413 413
                         ?>
414
-                        <div class="map-places-listing" id="<?php echo $map_canvas_name;?>_posttype_menu"
415
-                             style="max-width:<?php echo $map_width;?>!important;">
414
+                        <div class="map-places-listing" id="<?php echo $map_canvas_name; ?>_posttype_menu"
415
+                             style="max-width:<?php echo $map_width; ?>!important;">
416 416
 
417 417
                             <?php if (isset($geodir_map_options['is_geodir_home_map_widget']) && $map_args['is_geodir_home_map_widget']) { ?>
418 418
                             <div class="geodir-map-posttype-list"><?php } ?>
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
                                     foreach ($post_types as $post_type => $args) {
424 424
                                         if (!in_array($post_type, $exclude_post_types)) {
425 425
                                             $class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : '';
426
-											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>';
426
+											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 427
                                         }
428 428
                                     }
429 429
                                     ?>
@@ -448,9 +448,9 @@  discard block
 block discarded – undo
448 448
         <script type="text/javascript">
449 449
 
450 450
             jQuery(document).ready(function () {
451
-                //initMap('<?php echo $map_canvas_name;?>'); // depreciated, no need to load this twice
452
-                build_map_ajax_search_param('<?php echo $map_canvas_name;?>', false);
453
-                map_sticky('<?php echo $map_canvas_name;?>');
451
+                //initMap('<?php echo $map_canvas_name; ?>'); // depreciated, no need to load this twice
452
+                build_map_ajax_search_param('<?php echo $map_canvas_name; ?>', false);
453
+                map_sticky('<?php echo $map_canvas_name; ?>');
454 454
             });
455 455
 
456 456
         </script>
@@ -461,18 +461,18 @@  discard block
 block discarded – undo
461 461
             <script>
462 462
                 (function () {
463 463
                     var screenH = jQuery(window).height();
464
-                    var heightVH = "<?php echo str_replace("vh", "", $geodir_map_options['height']);?>";
464
+                    var heightVH = "<?php echo str_replace("vh", "", $geodir_map_options['height']); ?>";
465 465
 
466 466
                     var ptypeH = '';
467
-                    if (jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").length) {
468
-                        ptypeH = jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").outerHeight();
467
+                    if (jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").length) {
468
+                        ptypeH = jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").outerHeight();
469 469
                     }
470 470
 
471
-                    jQuery("#sticky_map_<?php echo $map_canvas_name;?>").css("min-height", screenH * (heightVH / 100) + 'px');
472
-                    jQuery("#<?php echo $map_canvas_name;?>_wrapper").height(screenH * (heightVH / 100) + 'px');
473
-                    jQuery("#<?php echo $map_canvas_name;?>").height(screenH * (heightVH / 100) + 'px');
474
-                    jQuery("#<?php echo $map_canvas_name;?>_loading_div").height(screenH * (heightVH / 100) + 'px');
475
-                    jQuery("#<?php echo $map_canvas_name;?>_cat").css("max-height", (screenH * (heightVH / 100)) - ptypeH + 'px');
471
+                    jQuery("#sticky_map_<?php echo $map_canvas_name; ?>").css("min-height", screenH * (heightVH / 100) + 'px');
472
+                    jQuery("#<?php echo $map_canvas_name; ?>_wrapper").height(screenH * (heightVH / 100) + 'px');
473
+                    jQuery("#<?php echo $map_canvas_name; ?>").height(screenH * (heightVH / 100) + 'px');
474
+                    jQuery("#<?php echo $map_canvas_name; ?>_loading_div").height(screenH * (heightVH / 100) + 'px');
475
+                    jQuery("#<?php echo $map_canvas_name; ?>_cat").css("max-height", (screenH * (heightVH / 100)) - ptypeH + 'px');
476 476
 
477 477
                 }());
478 478
             </script>
@@ -484,13 +484,13 @@  discard block
 block discarded – undo
484 484
             <script>
485 485
                 (function () {
486 486
                     var screenH = jQuery(window).height();
487
-                    var heightVH = "<?php echo str_replace("px", "", $geodir_map_options['height']);?>";
487
+                    var heightVH = "<?php echo str_replace("px", "", $geodir_map_options['height']); ?>";
488 488
                     var ptypeH = '';
489
-                    if (jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").length) {
490
-                        ptypeH = jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").outerHeight();
489
+                    if (jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").length) {
490
+                        ptypeH = jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").outerHeight();
491 491
                     }
492 492
 
493
-                    jQuery("#<?php echo $map_canvas_name;?>_cat").css("max-height", heightVH - ptypeH + 'px');
493
+                    jQuery("#<?php echo $map_canvas_name; ?>_cat").css("max-height", heightVH - ptypeH + 'px');
494 494
 
495 495
                 }());
496 496
             </script>
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
          * @param array $geodir_map_options Array of map settings.
506 506
          * @param string $map_canvas_name The canvas name and ID for the map.
507 507
          */
508
-        do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name);
508
+        do_action('geodir_map_after_render', $geodir_map_options, $map_canvas_name);
509 509
 
510 510
 
511 511
     endif; // Exclude posttypes if end
Please login to merge, or discard this patch.
geodirectory-functions/map-functions/map_on_add_listing_page.php 3 patches
Braces   +7 added lines, -5 removed lines patch added patch discarded remove patch
@@ -46,9 +46,10 @@  discard block
 block discarded – undo
46 46
 $default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
47 47
 if (is_admin() && isset($_REQUEST['tab']) && $mapzoom == '') {
48 48
     $mapzoom = 4;
49
-    if (isset($_REQUEST['add_hood']))
50
-        $mapzoom = 10;
51
-}
49
+    if (isset($_REQUEST['add_hood'])) {
50
+            $mapzoom = 10;
51
+    }
52
+    }
52 53
 
53 54
 /**
54 55
  * Filter the auto change address fields values
@@ -737,8 +738,9 @@  discard block
 block discarded – undo
737 738
 </script>
738 739
 <?php
739 740
 $set_button_class = 'geodir_button';
740
-if (is_admin())
741
-    $set_button_class = 'button-primary';
741
+if (is_admin()) {
742
+    $set_button_class = 'button-primary';
743
+}
742 744
 ?>
743 745
 <input type="button" id="<?php echo $prefix; ?>set_address_button" class="<?php echo $set_button_class; ?>" value="<?php esc_attr_e($map_title, 'geodirectory'); ?>" style="float:none;"/>
744 746
 <div id="<?php echo $prefix; ?>d_mouseClick"></div>
Please login to merge, or discard this patch.
Indentation   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -35,19 +35,19 @@  discard block
 block discarded – undo
35 35
 $defaultcity = isset($default_location->city) ? $default_location->city : '';
36 36
 $lat_lng_blank = false;
37 37
 if ($lat == '' && $lng == '') {
38
-    $lat_lng_blank = true;
39
-    $city = $defaultcity;
40
-    $region = isset($default_location->region) ? $default_location->region : '';
41
-    $country = isset($default_location->country) ? $default_location->country : '';
42
-    $lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
43
-    $lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
38
+	$lat_lng_blank = true;
39
+	$city = $defaultcity;
40
+	$region = isset($default_location->region) ? $default_location->region : '';
41
+	$country = isset($default_location->country) ? $default_location->country : '';
42
+	$lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
43
+	$lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
44 44
 }
45 45
 $default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
46 46
 $default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
47 47
 if (is_admin() && isset($_REQUEST['tab']) && $mapzoom == '') {
48
-    $mapzoom = 4;
49
-    if (isset($_REQUEST['add_hood']))
50
-        $mapzoom = 10;
48
+	$mapzoom = 4;
49
+	if (isset($_REQUEST['add_hood']))
50
+		$mapzoom = 10;
51 51
 }
52 52
 
53 53
 /**
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 * Fires at the start of the add javascript on the add lsitings map.
69 69
 	 *
70 70
 	 * @since 1.0.0
71
-     * @param string $prefix The prefix for all elements.
71
+	 * @param string $prefix The prefix for all elements.
72 72
 	 */
73 73
 	do_action('geodir_add_listing_js_start', $prefix);
74 74
 	?>
@@ -260,12 +260,12 @@  discard block
 block discarded – undo
260 260
             // fix for regions in GB
261 261
 
262 262
             $country_arr = <?php
263
-            /**
264
-             * Filter the regions array that uses administrative_area_level_2 instead of administrative_area_level_1.
265
-             *
266
-             * @since 1.6.16
267
-             */
268
-            echo apply_filters("geodir_geocode_region_level",'["GB","ES"]');?>;
263
+			/**
264
+			 * Filter the regions array that uses administrative_area_level_2 instead of administrative_area_level_1.
265
+			 *
266
+			 * @since 1.6.16
267
+			 */
268
+			echo apply_filters("geodir_geocode_region_level",'["GB","ES"]');?>;
269 269
             if (jQuery.inArray(rr, $country_arr) !== -1) {
270 270
                 if (administrative_area_level_2.long_name) {
271 271
                     getState = administrative_area_level_2.long_name;
@@ -346,13 +346,13 @@  discard block
 block discarded – undo
346 346
                 getZip = postal_code.long_name;
347 347
             }
348 348
             <?php 
349
-            /**
350
-             * Fires to add javascript variable to use in google map.
351
-             *
352
-             * @since 1.0.0
353
-             */
354
-            do_action('geodir_add_listing_geocode_js_vars');
355
-            ?>
349
+			/**
350
+			 * Fires to add javascript variable to use in google map.
351
+			 *
352
+			 * @since 1.0.0
353
+			 */
354
+			do_action('geodir_add_listing_geocode_js_vars');
355
+			?>
356 356
             <?php if ($is_map_restrict) { ?>
357 357
             if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
358 358
                 alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
@@ -433,15 +433,15 @@  discard block
 block discarded – undo
433 433
             }
434 434
         }
435 435
         <?php
436
-        /**
437
-         * Fires when marker address updated on map.
438
-         *
439
-         * @since 1.0.0
440
-         * @param string $prefix Identifier used as a prefix for field name
441
-         */
442
-        do_action('geodir_update_marker_address', $prefix);
443
-        echo $updateMarkerAddress = ob_get_clean();
444
-        ?>
436
+		/**
437
+		 * Fires when marker address updated on map.
438
+		 *
439
+		 * @since 1.0.0
440
+		 * @param string $prefix Identifier used as a prefix for field name
441
+		 */
442
+		do_action('geodir_update_marker_address', $prefix);
443
+		echo $updateMarkerAddress = ob_get_clean();
444
+		?>
445 445
     }
446 446
     function geodir_codeAddress(set_on_map) {
447 447
         var address = jQuery('#<?php echo $prefix.'address';?>').val();
@@ -456,17 +456,17 @@  discard block
 block discarded – undo
456 456
         }
457 457
         if(!ISO2){
458 458
             <?php
459
-            if(!defined('GEODIRLOCATION_TEXTDOMAIN')){
460
-                global $wpdb;
461
-                $location_result = geodir_get_default_location();
462
-                if(!empty($location_result)){
463
-                    $ISO2 = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country=%s",$location_result->country));
464
-                    echo "ISO2 = '$ISO2';";
465
-                }
466
-            }
459
+			if(!defined('GEODIRLOCATION_TEXTDOMAIN')){
460
+				global $wpdb;
461
+				$location_result = geodir_get_default_location();
462
+				if(!empty($location_result)){
463
+					$ISO2 = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country=%s",$location_result->country));
464
+					echo "ISO2 = '$ISO2';";
465
+				}
466
+			}
467 467
 
468 468
 
469
-            ?>
469
+			?>
470 470
         }
471 471
         if (ISO2 == '--') {
472 472
             ISO2 = '';
@@ -486,9 +486,9 @@  discard block
 block discarded – undo
486 486
         }
487 487
         var is_restrict = '<?php echo $is_map_restrict; ?>';
488 488
         <?php ob_start();
489
-        $defaultregion = isset($default_location->region) ? $default_location->region : '';
490
-        $defaultcountry = isset($default_location->country) ? $default_location->country : '';
491
-        ?>
489
+		$defaultregion = isset($default_location->region) ? $default_location->region : '';
490
+		$defaultcountry = isset($default_location->country) ? $default_location->country : '';
491
+		?>
492 492
         if (set_on_map && is_restrict) {
493 493
             if (zip != '' && address != '') {
494 494
                 address = address + ',' + zip;
@@ -500,12 +500,12 @@  discard block
 block discarded – undo
500 500
             if( address == city || address == region || address == country || address == zip )
501 501
                 address = '';
502 502
             <?php
503
-            if(is_admin() && isset($_REQUEST['tab'])){?>
503
+			if(is_admin() && isset($_REQUEST['tab'])){?>
504 504
             if (jQuery.trim(city) == '' || jQuery.trim(region) == '') {
505 505
                 address = '';
506 506
             }
507 507
             <?php
508
-               }?>
508
+			   }?>
509 509
 
510 510
             if (ISO2 == 'GB') {
511 511
                 address = address + ',' + city + ',' + country; // UK is funny with regions
@@ -521,15 +521,15 @@  discard block
 block discarded – undo
521 521
             address =  address.replace(",null,", ",");
522 522
         }
523 523
         <?php $codeAddress = ob_get_clean();
524
-        /**
525
-         * Filter the address variable
526
-         *
527
-         * @since 1.0.0
528
-         *
529
-         * @param string $codeAddress Row of address to use in google map.
530
-         */
531
-        echo apply_filters('geodir_codeaddress', $codeAddress);
532
-        ?>
524
+		/**
525
+		 * Filter the address variable
526
+		 *
527
+		 * @since 1.0.0
528
+		 *
529
+		 * @param string $codeAddress Row of address to use in google map.
530
+		 */
531
+		echo apply_filters('geodir_codeaddress', $codeAddress);
532
+		?>
533 533
         if (!window.gdMaps) { // No Google Map Loaded
534 534
             return;
535 535
         }
@@ -554,13 +554,13 @@  discard block
 block discarded – undo
554 554
                         updateMarkerPosition(baseMarker.getPosition());
555 555
                         //if(set_on_map && is_restrict) {
556 556
                         <?php 
557
-                        /**
558
-                         * Fires before set geocode position.
559
-                         *
560
-                         * @since 1.0.0
561
-                         */
562
-                        do_action('geodir_add_listing_codeaddress_before_geocode');
563
-                        ?>
557
+						/**
558
+						 * Fires before set geocode position.
559
+						 *
560
+						 * @since 1.0.0
561
+						 */
562
+						do_action('geodir_add_listing_codeaddress_before_geocode');
563
+						?>
564 564
                         geocodePosition(baseMarker.getPosition(), {'address': address, 'country': ISO2});
565 565
                         //}
566 566
                     } else {
@@ -606,13 +606,13 @@  discard block
 block discarded – undo
606 606
                 updateMarkerPositionOSM(baseMarker.getLatLng());
607 607
             }
608 608
             <?php 
609
-            /**
610
-             * Fires to add javascript variable to use in google map.
611
-             *
612
-             * @since 1.0.0
613
-             */
614
-            do_action('geodir_add_listing_geocode_js_vars');
615
-            ?>
609
+			/**
610
+			 * Fires to add javascript variable to use in google map.
611
+			 *
612
+			 * @since 1.0.0
613
+			 */
614
+			do_action('geodir_add_listing_geocode_js_vars');
615
+			?>
616 616
             <?php if ($is_map_restrict) { ?>
617 617
             if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
618 618
                 alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
@@ -761,7 +761,7 @@  discard block
 block discarded – undo
761 761
 <?php
762 762
 $set_button_class = 'geodir_button';
763 763
 if (is_admin())
764
-    $set_button_class = 'button-primary';
764
+	$set_button_class = 'button-primary';
765 765
 ?>
766 766
 <input type="button" id="<?php echo $prefix; ?>set_address_button" class="<?php echo $set_button_class; ?>" value="<?php esc_attr_e($map_title, 'geodirectory'); ?>" style="float:none;"/>
767 767
 <div id="<?php echo $prefix; ?>d_mouseClick"></div>
Please login to merge, or discard this patch.
Spacing   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -82,16 +82,16 @@  discard block
 block discarded – undo
82 82
     window.gdMaps = window.gdMaps || gdMaps;
83 83
     
84 84
     user_address = false;
85
-    jQuery('#<?php echo $prefix.'address';?>').keypress(function () {
85
+    jQuery('#<?php echo $prefix.'address'; ?>').keypress(function () {
86 86
         user_address = true;
87 87
     });
88 88
 
89 89
     baseMarker = '';
90 90
     geocoder = '';
91
-    var <?php echo $prefix;?>CITY_MAP_CENTER_LAT = <?php echo ($lat) ? $lat :  '39.952484'; ?>;
92
-    var <?php echo $prefix;?>CITY_MAP_CENTER_LNG = <?php echo ($lng) ? $lng :  '-75.163786'; ?>;
93
-    <?php if($lat_lng_blank){$lat='';$lng='';}?>
94
-    var <?php echo $prefix;?>CITY_MAP_ZOOMING_FACT = <?php echo ($mapzoom) ? $mapzoom : 12;?>;
91
+    var <?php echo $prefix; ?>CITY_MAP_CENTER_LAT = <?php echo ($lat) ? $lat : '39.952484'; ?>;
92
+    var <?php echo $prefix; ?>CITY_MAP_CENTER_LNG = <?php echo ($lng) ? $lng : '-75.163786'; ?>;
93
+    <?php if ($lat_lng_blank) {$lat = ''; $lng = ''; }?>
94
+    var <?php echo $prefix; ?>CITY_MAP_ZOOMING_FACT = <?php echo ($mapzoom) ? $mapzoom : 12; ?>;
95 95
     var minZoomLevel = <?php echo ($is_map_restrict) ? 5 : 0; ?>;
96 96
     var oldstr_address;
97 97
     var oldstr_zip;
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
              *
266 266
              * @since 1.6.16
267 267
              */
268
-            echo apply_filters("geodir_geocode_region_level",'["GB","ES"]');?>;
268
+            echo apply_filters("geodir_geocode_region_level", '["GB","ES"]'); ?>;
269 269
             if (jQuery.inArray(rr, $country_arr) !== -1) {
270 270
                 if (administrative_area_level_2.long_name) {
271 271
                     getState = administrative_area_level_2.long_name;
@@ -354,9 +354,9 @@  discard block
 block discarded – undo
354 354
             do_action('geodir_add_listing_geocode_js_vars');
355 355
             ?>
356 356
             <?php if ($is_map_restrict) { ?>
357
-            if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
358
-                alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
359
-                jQuery("#<?php echo $prefix.'map';?>").goMap();
357
+            if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city)); ?>') {
358
+                alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.', 'geodirectory'), $city)); ?>');
359
+                jQuery("#<?php echo $prefix.'map'; ?>").goMap();
360 360
                 jQuery.goMap.map.setCenter(new google.maps.LatLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
361 361
                 baseMarker.setPosition(new google.maps.LatLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
362 362
                 updateMarkerPosition(baseMarker.getPosition());
@@ -365,11 +365,11 @@  discard block
 block discarded – undo
365 365
             <?php } ?>
366 366
             updateMarkerAddress(getAddress, getZip, getCity, getState, getCountry);
367 367
         } else {
368
-            updateMarkerAddress('<?php echo addslashes_gpc(__('Cannot determine address at this location.','geodirectory'));?>');
368
+            updateMarkerAddress('<?php echo addslashes_gpc(__('Cannot determine address at this location.', 'geodirectory')); ?>');
369 369
         }
370 370
     }
371 371
     function centerMap(latlng) {
372
-        jQuery("#<?php echo $prefix.'map';?>").goMap();
372
+        jQuery("#<?php echo $prefix.'map'; ?>").goMap();
373 373
         if (window.gdMaps == 'google') {
374 374
             jQuery.goMap.map.panTo(baseMarker.getPosition());
375 375
         } else if (window.gdMaps == 'osm') {
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
         }
379 379
     }
380 380
     function centerMarker() {
381
-        jQuery("#<?php echo $prefix.'map';?>").goMap();
381
+        jQuery("#<?php echo $prefix.'map'; ?>").goMap();
382 382
         var center = jQuery.goMap.map.getCenter();
383 383
         if (window.gdMaps == 'google') {
384 384
             baseMarker.setPosition(center);
@@ -387,48 +387,48 @@  discard block
 block discarded – undo
387 387
         }
388 388
     }
389 389
     function updateMapZoom(zoom) {
390
-        jQuery('#<?php echo $prefix.'mapzoom';?>').val(zoom);
390
+        jQuery('#<?php echo $prefix.'mapzoom'; ?>').val(zoom);
391 391
     }
392 392
     function updateMarkerPosition(markerlatLng) {
393
-        jQuery("#<?php echo $prefix.'map';?>").goMap();
394
-        jQuery('#<?php echo $prefix.'latitude';?>').val(markerlatLng.lat());
395
-        jQuery('#<?php echo $prefix.'longitude';?>').val(markerlatLng.lng());
393
+        jQuery("#<?php echo $prefix.'map'; ?>").goMap();
394
+        jQuery('#<?php echo $prefix.'latitude'; ?>').val(markerlatLng.lat());
395
+        jQuery('#<?php echo $prefix.'longitude'; ?>').val(markerlatLng.lng());
396 396
     }
397 397
     function updateMarkerPositionOSM(markerlatLng) {
398
-        jQuery('#<?php echo $prefix.'latitude';?>').val(markerlatLng.lat);
399
-        jQuery('#<?php echo $prefix.'longitude';?>').val(markerlatLng.lng);
398
+        jQuery('#<?php echo $prefix.'latitude'; ?>').val(markerlatLng.lat);
399
+        jQuery('#<?php echo $prefix.'longitude'; ?>').val(markerlatLng.lng);
400 400
     }
401 401
     function updateMarkerAddress(getAddress, getZip, getCity, getState, getCountry) {
402
-        var set_map_val_in_fields = '<?php echo addslashes_gpc($auto_change_map_fields);?>';
403
-        <?php ob_start();?>
404
-        var old_country = jQuery("#<?php echo $prefix.'country';?>").val();
405
-        var old_region = jQuery("#<?php echo $prefix.'region';?>").val();
402
+        var set_map_val_in_fields = '<?php echo addslashes_gpc($auto_change_map_fields); ?>';
403
+        <?php ob_start(); ?>
404
+        var old_country = jQuery("#<?php echo $prefix.'country'; ?>").val();
405
+        var old_region = jQuery("#<?php echo $prefix.'region'; ?>").val();
406 406
         
407
-        if (user_address == false || jQuery('#<?php echo $prefix.'address';?>').val() == '') {
408
-            jQuery("#<?php echo $prefix.'address';?>").val(getAddress);
407
+        if (user_address == false || jQuery('#<?php echo $prefix.'address'; ?>').val() == '') {
408
+            jQuery("#<?php echo $prefix.'address'; ?>").val(getAddress);
409 409
         }
410 410
         if (getAddress) {
411 411
             oldstr_address = getAddress;
412 412
         }
413 413
 
414
-        jQuery("#<?php echo $prefix.'zip';?>").val(getZip);
414
+        jQuery("#<?php echo $prefix.'zip'; ?>").val(getZip);
415 415
         if (getZip) {
416 416
             oldstr_zip = getZip;
417 417
         }
418 418
         if (set_map_val_in_fields) {
419 419
             if (getCountry) {
420
-                jQuery('#<?php echo $prefix .'country'; ?> option[value=""]').attr("selected",false);
421
-                jQuery('#<?php echo $prefix.'country';?> option[data-country_code="' + getCountryISO + '"]').attr("selected", true);
422
-                jQuery("#<?php echo $prefix.'country';?>").trigger("chosen:updated");
420
+                jQuery('#<?php echo $prefix.'country'; ?> option[value=""]').attr("selected",false);
421
+                jQuery('#<?php echo $prefix.'country'; ?> option[data-country_code="' + getCountryISO + '"]').attr("selected", true);
422
+                jQuery("#<?php echo $prefix.'country'; ?>").trigger("chosen:updated");
423 423
             }
424 424
             if (getState) {
425
-                if (jQuery('input[id="<?php echo $prefix.'region';?>"]').attr('id')) {
426
-                    jQuery("#<?php echo $prefix.'region';?>").val(getState);
425
+                if (jQuery('input[id="<?php echo $prefix.'region'; ?>"]').attr('id')) {
426
+                    jQuery("#<?php echo $prefix.'region'; ?>").val(getState);
427 427
                 }
428 428
             }
429 429
             if (getCity) {
430
-                if (jQuery('input[id="<?php echo $prefix.'city';?>"]').attr('id')) {
431
-                    jQuery("#<?php echo $prefix.'city';?>").val(getCity);
430
+                if (jQuery('input[id="<?php echo $prefix.'city'; ?>"]').attr('id')) {
431
+                    jQuery("#<?php echo $prefix.'city'; ?>").val(getCity);
432 432
                 }
433 433
             }
434 434
         }
@@ -444,23 +444,23 @@  discard block
 block discarded – undo
444 444
         ?>
445 445
     }
446 446
     function geodir_codeAddress(set_on_map) {
447
-        var address = jQuery('#<?php echo $prefix.'address';?>').val();
448
-        var zip = jQuery('#<?php echo $prefix.'zip';?>').val();
449
-        var city = jQuery('#<?php echo $prefix.'city';?>').val();
450
-        var region = jQuery('#<?php echo $prefix.'region';?>').val();
451
-        var country = jQuery('#<?php echo $prefix.'country';?>').val();
452
-        var country_selected = jQuery('#<?php echo $prefix.'country';?>').find('option:selected');
447
+        var address = jQuery('#<?php echo $prefix.'address'; ?>').val();
448
+        var zip = jQuery('#<?php echo $prefix.'zip'; ?>').val();
449
+        var city = jQuery('#<?php echo $prefix.'city'; ?>').val();
450
+        var region = jQuery('#<?php echo $prefix.'region'; ?>').val();
451
+        var country = jQuery('#<?php echo $prefix.'country'; ?>').val();
452
+        var country_selected = jQuery('#<?php echo $prefix.'country'; ?>').find('option:selected');
453 453
         var ISO2 = country_selected.data('country_code');
454
-        if (!ISO2 && jQuery('#<?php echo $prefix.'country';?>').data('country_code')) {
455
-            ISO2 = jQuery('#<?php echo $prefix.'country';?>').data('country_code');
454
+        if (!ISO2 && jQuery('#<?php echo $prefix.'country'; ?>').data('country_code')) {
455
+            ISO2 = jQuery('#<?php echo $prefix.'country'; ?>').data('country_code');
456 456
         }
457 457
         if(!ISO2){
458 458
             <?php
459
-            if(!defined('GEODIRLOCATION_TEXTDOMAIN')){
459
+            if (!defined('GEODIRLOCATION_TEXTDOMAIN')) {
460 460
                 global $wpdb;
461 461
                 $location_result = geodir_get_default_location();
462
-                if(!empty($location_result)){
463
-                    $ISO2 = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country=%s",$location_result->country));
462
+                if (!empty($location_result)) {
463
+                    $ISO2 = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM ".GEODIR_COUNTRIES_TABLE." WHERE Country=%s", $location_result->country));
464 464
                     echo "ISO2 = '$ISO2';";
465 465
                 }
466 466
             }
@@ -476,13 +476,13 @@  discard block
 block discarded – undo
476 476
             zip = '';
477 477
         }
478 478
         if (typeof city == "undefined") {
479
-            city = '<?php echo addslashes_gpc($city);?>';
479
+            city = '<?php echo addslashes_gpc($city); ?>';
480 480
         }
481 481
         if (typeof region == "undefined") {
482
-            region = '<?php echo addslashes_gpc($region);?>';
482
+            region = '<?php echo addslashes_gpc($region); ?>';
483 483
         }
484 484
         if (typeof country == "undefined") {
485
-            country = '<?php echo addslashes_gpc($country);?>';
485
+            country = '<?php echo addslashes_gpc($country); ?>';
486 486
         }
487 487
         var is_restrict = '<?php echo $is_map_restrict; ?>';
488 488
         <?php ob_start();
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
             if( address == city || address == region || address == country || address == zip )
501 501
                 address = '';
502 502
             <?php
503
-            if(is_admin() && isset($_REQUEST['tab'])){?>
503
+            if (is_admin() && isset($_REQUEST['tab'])) {?>
504 504
             if (jQuery.trim(city) == '' || jQuery.trim(region) == '') {
505 505
                 address = '';
506 506
             }
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
             geocoder.geocode({'address': address, 'country': ISO2},
548 548
                 function (results, status) {
549 549
                     console.log(status);
550
-                    jQuery("#<?php echo $prefix.'map';?>").goMap();
550
+                    jQuery("#<?php echo $prefix.'map'; ?>").goMap();
551 551
                     if (status == google.maps.GeocoderStatus.OK) {
552 552
                         baseMarker.setPosition(results[0].geometry.location);
553 553
                         jQuery.goMap.map.setCenter(results[0].geometry.location);
@@ -564,21 +564,21 @@  discard block
 block discarded – undo
564 564
                         geocodePosition(baseMarker.getPosition(), {'address': address, 'country': ISO2});
565 565
                         //}
566 566
                     } else {
567
-                        alert('<?php echo addslashes_gpc(__('Geocode was not successful for the following reason:','geodirectory'));?> ' + status);
567
+                        alert('<?php echo addslashes_gpc(__('Geocode was not successful for the following reason:', 'geodirectory')); ?> ' + status);
568 568
                     }
569 569
                 });
570 570
         }
571 571
     }
572 572
     function gdMaxMap() {
573
-        jQuery("#<?php echo $prefix.'map';?>").goMap();
573
+        jQuery("#<?php echo $prefix.'map'; ?>").goMap();
574 574
 
575
-        jQuery('#<?php echo $prefix.'map';?>').toggleClass('map-fullscreen');
575
+        jQuery('#<?php echo $prefix.'map'; ?>').toggleClass('map-fullscreen');
576 576
         jQuery('.map_category').toggleClass('map_category_fullscreen');
577
-        jQuery('#<?php echo $prefix;?>trigger').toggleClass('map_category_fullscreen');
577
+        jQuery('#<?php echo $prefix; ?>trigger').toggleClass('map_category_fullscreen');
578 578
         jQuery('body').toggleClass('body_fullscreen');
579
-        jQuery('#<?php echo $prefix;?>loading_div').toggleClass('loading_div_fullscreen');
580
-        jQuery('#<?php echo $prefix;?>advmap_nofound').toggleClass('nofound_fullscreen');
581
-        jQuery('#<?php echo $prefix;?>triggermap').toggleClass('triggermap_fullscreen');
579
+        jQuery('#<?php echo $prefix; ?>loading_div').toggleClass('loading_div_fullscreen');
580
+        jQuery('#<?php echo $prefix; ?>advmap_nofound').toggleClass('nofound_fullscreen');
581
+        jQuery('#<?php echo $prefix; ?>triggermap').toggleClass('triggermap_fullscreen');
582 582
         jQuery('.TopLeft').toggleClass('TopLeft_fullscreen');
583 583
         window.setTimeout(function () {
584 584
             if (window.gdMaps == 'google') {
@@ -614,9 +614,9 @@  discard block
 block discarded – undo
614 614
             do_action('geodir_add_listing_geocode_js_vars');
615 615
             ?>
616 616
             <?php if ($is_map_restrict) { ?>
617
-            if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
618
-                alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
619
-                jQuery("#<?php echo $prefix.'map';?>").goMap();
617
+            if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city)); ?>') {
618
+                alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.', 'geodirectory'), $city)); ?>');
619
+                jQuery("#<?php echo $prefix.'map'; ?>").goMap();
620 620
                 centerMap(new L.latLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
621 621
                 baseMarker.setLatLng(new L.latLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
622 622
                 updateMarkerPositionOSM(baseMarker.getLatLng());
@@ -625,39 +625,39 @@  discard block
 block discarded – undo
625 625
             <?php } ?>
626 626
             updateMarkerAddress(getAddress, getZip, getCity, getState, getCountry);
627 627
         } else {
628
-            alert('<?php echo addslashes_gpc(__('Cannot determine address at this location.','geodirectory'));?>');
628
+            alert('<?php echo addslashes_gpc(__('Cannot determine address at this location.', 'geodirectory')); ?>');
629 629
         }
630 630
     }
631 631
     
632 632
     jQuery(function ($) {
633
-        $("#<?php echo $prefix.'map';?>").goMap({
634
-            latitude: <?php echo $prefix;?>CITY_MAP_CENTER_LAT,
635
-            longitude: <?php echo $prefix;?>CITY_MAP_CENTER_LNG,
636
-            zoom: <?php echo $prefix;?>CITY_MAP_ZOOMING_FACT,
633
+        $("#<?php echo $prefix.'map'; ?>").goMap({
634
+            latitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LAT,
635
+            longitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LNG,
636
+            zoom: <?php echo $prefix; ?>CITY_MAP_ZOOMING_FACT,
637 637
             maptype: 'ROADMAP', // Map type - HYBRID, ROADMAP, SATELLITE, TERRAIN
638 638
             streetViewControl: true,
639
-            <?php if(get_option('geodir_add_listing_mouse_scroll')) { echo 'scrollwheel: false,';}?>
639
+            <?php if (get_option('geodir_add_listing_mouse_scroll')) { echo 'scrollwheel: false,'; }?>
640 640
         });
641 641
 
642 642
         if (window.gdMaps) {
643 643
             geocoder = window.gdMaps == 'google' ? new google.maps.Geocoder() : [];
644 644
 
645 645
             baseMarker = $.goMap.createMarker({
646
-                latitude: <?php echo $prefix;?>CITY_MAP_CENTER_LAT,
647
-                longitude: <?php echo $prefix;?>CITY_MAP_CENTER_LNG,
646
+                latitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LAT,
647
+                longitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LNG,
648 648
                 id: 'baseMarker',
649
-                icon: '<?php echo $marker_icon;?>',
649
+                icon: '<?php echo $marker_icon; ?>',
650 650
                 draggable: true,
651 651
                 addToMap: true, // For OSM
652
-                w: parseFloat('<?php echo $icon_size['w'];?>'),
653
-                h: parseFloat('<?php echo $icon_size['h'];?>'),
652
+                w: parseFloat('<?php echo $icon_size['w']; ?>'),
653
+                h: parseFloat('<?php echo $icon_size['h']; ?>'),
654 654
             });
655 655
         } else {
656
-            jQuery('#<?php echo $prefix.'advmap_nofound';?>').hide();
657
-            jQuery('#<?php echo $prefix.'advmap_notloaded';?>').show();
656
+            jQuery('#<?php echo $prefix.'advmap_nofound'; ?>').hide();
657
+            jQuery('#<?php echo $prefix.'advmap_notloaded'; ?>').show();
658 658
         }
659 659
         
660
-        $("#<?php echo $prefix;?>set_address_button").click(function () {
660
+        $("#<?php echo $prefix; ?>set_address_button").click(function () {
661 661
             var set_on_map = true;
662 662
             geodir_codeAddress(set_on_map);
663 663
         });
@@ -692,14 +692,14 @@  discard block
 block discarded – undo
692 692
                 updateMapZoom($.goMap.map.zoom);
693 693
             });
694 694
 
695
-            var maxMap = document.getElementById('<?php echo $prefix;?>triggermap');
695
+            var maxMap = document.getElementById('<?php echo $prefix; ?>triggermap');
696 696
             google.maps.event.addDomListener(maxMap, 'click', gdMaxMap);
697 697
 
698 698
             <?php if ($is_map_restrict) { ?>
699
-            var CITY_ADDRESS = '<?php echo addslashes_gpc($city).','.addslashes_gpc($region).','.addslashes_gpc($country);?>';
699
+            var CITY_ADDRESS = '<?php echo addslashes_gpc($city).','.addslashes_gpc($region).','.addslashes_gpc($country); ?>';
700 700
             geocoder.geocode({'address': CITY_ADDRESS},
701 701
                 function (results, status) {
702
-                    $("#<?php echo $prefix.'map';?>").goMap();
702
+                    $("#<?php echo $prefix.'map'; ?>").goMap();
703 703
                     if (status == google.maps.GeocoderStatus.OK) {
704 704
                         // Bounds for North America
705 705
                         var bound_lat_lng = String(results[0].geometry.bounds);
@@ -710,13 +710,13 @@  discard block
 block discarded – undo
710 710
                             new google.maps.LatLng(bound_lat_lng[2], bound_lat_lng[3])
711 711
                         );
712 712
                     } else {
713
-                        alert("<?php _e('Geocode was not successful for the following reason:','geodirectory');?> " + status);
713
+                        alert("<?php _e('Geocode was not successful for the following reason:', 'geodirectory'); ?> " + status);
714 714
                     }
715 715
                 });
716 716
             <?php } ?>
717 717
             // Limit the zoom level
718 718
             google.maps.event.addListener($.goMap.map, 'zoom_changed', function () {
719
-                $("#<?php echo $prefix.'map';?>").goMap();
719
+                $("#<?php echo $prefix.'map'; ?>").goMap();
720 720
                 if ($.goMap.map.getZoom() < minZoomLevel) $.goMap.map.setZoom(minZoomLevel);
721 721
             });
722 722
         } else if (window.gdMaps == 'osm') {
@@ -742,10 +742,10 @@  discard block
 block discarded – undo
742 742
                 updateMapZoom($.goMap.map.getZoom());
743 743
             });
744 744
 
745
-            L.DomEvent.addListener($('<?php echo $prefix;?>triggermap'), 'click', gdMaxMap);
745
+            L.DomEvent.addListener($('<?php echo $prefix; ?>triggermap'), 'click', gdMaxMap);
746 746
 
747 747
             <?php if ($is_map_restrict) { ?>
748
-            var CITY_ADDRESS = '<?php echo addslashes_gpc($city).', '.addslashes_gpc($region).', '.addslashes_gpc($country);?>';
748
+            var CITY_ADDRESS = '<?php echo addslashes_gpc($city).', '.addslashes_gpc($region).', '.addslashes_gpc($country); ?>';
749 749
             geocodePositionOSM('', CITY_ADDRESS);
750 750
             <?php } ?>
751 751
             // Limit the zoom level
@@ -768,14 +768,14 @@  discard block
 block discarded – undo
768 768
 <div class="top_banner_section_inn geodir_map_container clearfix" style="margin-top:10px;">
769 769
     <div class="TopLeft"><span id="<?php echo $prefix; ?>triggermap" style="margin-top:-11px;margin-left:-12px;"></span></div>
770 770
     <div class="TopRight"></div>
771
-    <div id="<?php echo $prefix . 'map'; ?>" class="geodir_map" style="height:300px">
771
+    <div id="<?php echo $prefix.'map'; ?>" class="geodir_map" style="height:300px">
772 772
         <!-- new map start -->
773 773
         <div class="iprelative">
774
-            <div id="<?php echo $prefix . 'map'; ?>" style="float:right;height:300px;position:relative;" class="form_row clearfix"></div>
774
+            <div id="<?php echo $prefix.'map'; ?>" style="float:right;height:300px;position:relative;" class="form_row clearfix"></div>
775 775
             <div id="<?php echo $prefix; ?>loading_div" style="height:300px"></div>
776 776
             <div id="<?php echo $prefix; ?>advmap_counter"></div>
777 777
             <div id="<?php echo $prefix; ?>advmap_nofound"><?php echo MAP_NO_RESULTS; ?></div>
778
-            <div id="<?php echo $prefix;?>advmap_notloaded" class="advmap_notloaded"><?php _e('<h3>Map Not Loaded</h3><p>Sorry, unable to load Maps API.', 'geodirectory'); ?></div>
778
+            <div id="<?php echo $prefix; ?>advmap_notloaded" class="advmap_notloaded"><?php _e('<h3>Map Not Loaded</h3><p>Sorry, unable to load Maps API.', 'geodirectory'); ?></div>
779 779
         </div>
780 780
         <!-- new map end -->
781 781
     </div>
Please login to merge, or discard this patch.
geodirectory-functions/compatibility/Kleo.php 3 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
 function geodir_kelo_title_translation( $args) {
13 13
     if(function_exists('geodir_is_geodir_page') && geodir_is_page('preview') ){
14 14
         $args['title'] = __(stripslashes_deep(esc_html($_POST['post_title'])),'geodirectory');
15
-    }elseif(function_exists('geodir_is_geodir_page')){
15
+    } elseif(function_exists('geodir_is_geodir_page')){
16 16
         $args['title'] = __($args['title'],'geodirectory');
17 17
     }
18 18
 
Please login to merge, or discard this patch.
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
 
11 11
 // Page titles translatable CPT names
12 12
 function geodir_kelo_title_translation( $args) {
13
-    if(function_exists('geodir_is_geodir_page') && geodir_is_page('preview') ){
14
-        $args['title'] = __(stripslashes_deep(esc_html($_POST['post_title'])),'geodirectory');
15
-    }elseif(function_exists('geodir_is_geodir_page')){
16
-        $args['title'] = __($args['title'],'geodirectory');
17
-    }
13
+	if(function_exists('geodir_is_geodir_page') && geodir_is_page('preview') ){
14
+		$args['title'] = __(stripslashes_deep(esc_html($_POST['post_title'])),'geodirectory');
15
+	}elseif(function_exists('geodir_is_geodir_page')){
16
+		$args['title'] = __($args['title'],'geodirectory');
17
+	}
18 18
 
19
-    return $args;
19
+	return $args;
20 20
 }
21 21
 add_filter( 'kleo_title_args', 'geodir_kelo_title_translation', 10, 1 );
22 22
 
@@ -31,11 +31,11 @@  discard block
 block discarded – undo
31 31
  * @return object Modified query object.
32 32
  */
33 33
 function geodir_kleo_search_filter( $query ) {
34
-    if ( !empty( $query->is_search ) && geodir_is_page('search') && is_search() ) {
35
-        $query->set( 'post_type', 'any' );
36
-    }
37
-    return $query;
34
+	if ( !empty( $query->is_search ) && geodir_is_page('search') && is_search() ) {
35
+		$query->set( 'post_type', 'any' );
36
+	}
37
+	return $query;
38 38
 }
39 39
 if ( !is_admin() ) {
40
-    add_filter( 'pre_get_posts', 'geodir_kleo_search_filter', 11 );
40
+	add_filter( 'pre_get_posts', 'geodir_kleo_search_filter', 11 );
41 41
 }
42 42
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -9,16 +9,16 @@  discard block
 block discarded – undo
9 9
  */
10 10
 
11 11
 // Page titles translatable CPT names
12
-function geodir_kelo_title_translation( $args) {
13
-    if(function_exists('geodir_is_geodir_page') && geodir_is_page('preview') ){
14
-        $args['title'] = __(stripslashes_deep(esc_html($_POST['post_title'])),'geodirectory');
15
-    }elseif(function_exists('geodir_is_geodir_page')){
16
-        $args['title'] = __($args['title'],'geodirectory');
12
+function geodir_kelo_title_translation($args) {
13
+    if (function_exists('geodir_is_geodir_page') && geodir_is_page('preview')) {
14
+        $args['title'] = __(stripslashes_deep(esc_html($_POST['post_title'])), 'geodirectory');
15
+    }elseif (function_exists('geodir_is_geodir_page')) {
16
+        $args['title'] = __($args['title'], 'geodirectory');
17 17
     }
18 18
 
19 19
     return $args;
20 20
 }
21
-add_filter( 'kleo_title_args', 'geodir_kelo_title_translation', 10, 1 );
21
+add_filter('kleo_title_args', 'geodir_kelo_title_translation', 10, 1);
22 22
 
23 23
 /**
24 24
  * Fix search returns all the posts for Kleo theme.
@@ -30,12 +30,12 @@  discard block
 block discarded – undo
30 30
  * @param object $query Current query object.
31 31
  * @return object Modified query object.
32 32
  */
33
-function geodir_kleo_search_filter( $query ) {
34
-    if ( !empty( $query->is_search ) && geodir_is_page('search') && is_search() ) {
35
-        $query->set( 'post_type', 'any' );
33
+function geodir_kleo_search_filter($query) {
34
+    if (!empty($query->is_search) && geodir_is_page('search') && is_search()) {
35
+        $query->set('post_type', 'any');
36 36
     }
37 37
     return $query;
38 38
 }
39
-if ( !is_admin() ) {
40
-    add_filter( 'pre_get_posts', 'geodir_kleo_search_filter', 11 );
39
+if (!is_admin()) {
40
+    add_filter('pre_get_posts', 'geodir_kleo_search_filter', 11);
41 41
 }
42 42
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory_shortcodes.php 3 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -427,7 +427,7 @@
 block discarded – undo
427 427
         }
428 428
 
429 429
         return $output;
430
-    }else{
430
+    } else{
431 431
         ob_start();
432 432
         add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array
433 433
         add_action('the_post', 'create_list_jsondata'); // Add marker in json array
Please login to merge, or discard this patch.
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -197,14 +197,14 @@  discard block
 block discarded – undo
197 197
 	// Add marker cluster
198 198
 	if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) {
199 199
         $map_args['enable_marker_cluster'] = true;
200
-        if(get_option('geodir_marker_cluster_type')) {
200
+        if (get_option('geodir_marker_cluster_type')) {
201 201
             if ($map_args['autozoom']) {
202 202
                 $map_args['enable_marker_cluster_no_reposition'] = false;
203 203
             } else {
204 204
                 $map_args['enable_marker_cluster_no_reposition'] = true;
205 205
             }
206 206
 
207
-            $map_args['enable_marker_cluster_server'] = true ;
207
+            $map_args['enable_marker_cluster_server'] = true;
208 208
 
209 209
         }
210 210
 	} else {
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 	}
213 213
 
214 214
     // if lat and long set in shortcode, hack it so the map is not repositioned
215
-    if(!empty($params['latitude']) && !empty($params['longitude']) ){
215
+    if (!empty($params['latitude']) && !empty($params['longitude'])) {
216 216
         $map_args['enable_marker_cluster_no_reposition'] = true;
217 217
     }
218 218
 
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 function geodir_sc_listing_map($atts) {
266 266
 
267 267
     // if some params are set then we need a new query, if not then we can use the main query
268
-    if( isset($atts['post_type']) || isset($atts['category']) || isset($atts['event_type']) ) {
268
+    if (isset($atts['post_type']) || isset($atts['category']) || isset($atts['event_type'])) {
269 269
 
270 270
         global $add_post_in_marker_array, $gd_sc_map_params;
271 271
         $backup_globals                             = array();
@@ -288,34 +288,34 @@  discard block
 block discarded – undo
288 288
             'event_type'     => 'all'
289 289
         );
290 290
 
291
-        $params = shortcode_atts( $defaults, $atts );
291
+        $params = shortcode_atts($defaults, $atts);
292 292
 
293
-        if ( ! ( gdsc_is_post_type_valid( $params['post_type'] ) ) ) {
293
+        if (!(gdsc_is_post_type_valid($params['post_type']))) {
294 294
             $params['post_type'] = 'gd_place';
295 295
         }
296 296
 
297 297
         // Validate the selected category/ies - Grab the current list based on post_type
298
-        $category_taxonomy = geodir_get_taxonomies( $params['post_type'] );
299
-        $categories        = get_terms( $category_taxonomy, array(
298
+        $category_taxonomy = geodir_get_taxonomies($params['post_type']);
299
+        $categories        = get_terms($category_taxonomy, array(
300 300
             'orderby' => 'count',
301 301
             'order'   => 'DESC',
302 302
             'fields'  => 'ids'
303
-        ) );
303
+        ));
304 304
 
305 305
         // Make sure we have an array
306
-        if ( ! ( is_array( $params['category'] ) ) ) {
307
-            $params['category'] = explode( ',', $params['category'] );
306
+        if (!(is_array($params['category']))) {
307
+            $params['category'] = explode(',', $params['category']);
308 308
         }
309 309
 
310 310
         // Array_intersect returns only the items in $params['category'] that are also in our category list
311 311
         // Otherwise it becomes empty and later on that will mean "All"
312
-        $params['category'] = array_intersect( $params['category'], $categories );
312
+        $params['category'] = array_intersect($params['category'], $categories);
313 313
 
314
-        if ( $params['post_type'] == 'gd_event' ) {
315
-            $params['event_type'] = gdsc_validate_list_filter_choice( $params['event_type'] );
314
+        if ($params['post_type'] == 'gd_event') {
315
+            $params['event_type'] = gdsc_validate_list_filter_choice($params['event_type']);
316 316
         }
317 317
 
318
-        $params = gdsc_validate_map_args( $params );
318
+        $params = gdsc_validate_map_args($params);
319 319
 
320 320
         $gd_sc_map_params = $params;
321 321
 
@@ -326,12 +326,12 @@  discard block
 block discarded – undo
326 326
             'post_type'      => $params['post_type'],
327 327
         );
328 328
 
329
-        if ( ! empty( $params['category'] ) && isset( $params['category'][0] ) && (int) $params['category'][0] != 0 ) {
330
-            $category_taxonomy = geodir_get_taxonomies( $params['post_type'] );
329
+        if (!empty($params['category']) && isset($params['category'][0]) && (int) $params['category'][0] != 0) {
330
+            $category_taxonomy = geodir_get_taxonomies($params['post_type']);
331 331
 
332 332
             ######### WPML #########
333
-            if ( function_exists( 'icl_object_id' ) ) {
334
-                $category = gd_lang_object_ids( $params['category'], $category_taxonomy[0] );
333
+            if (function_exists('icl_object_id')) {
334
+                $category = gd_lang_object_ids($params['category'], $category_taxonomy[0]);
335 335
             }
336 336
             ######### WPML #########
337 337
 
@@ -341,36 +341,36 @@  discard block
 block discarded – undo
341 341
                 'terms'    => $params['category']
342 342
             );
343 343
 
344
-            $query_args['tax_query'] = array( $tax_query );
344
+            $query_args['tax_query'] = array($tax_query);
345 345
         }
346 346
 
347 347
         $add_post_in_marker_array = true;
348 348
 
349
-        if ( $params['post_type'] == 'gd_event' && function_exists( 'geodir_event_get_widget_events' ) ) {
349
+        if ($params['post_type'] == 'gd_event' && function_exists('geodir_event_get_widget_events')) {
350 350
             global $geodir_event_widget_listview;
351 351
             $geodir_event_widget_listview = true;
352 352
 
353 353
             $query_args['geodir_event_type'] = $params['event_type'];
354 354
 
355
-            $listings = geodir_event_get_widget_events( $query_args );
355
+            $listings = geodir_event_get_widget_events($query_args);
356 356
 
357 357
             $geodir_event_widget_listview = false;
358 358
         } else {
359
-            $listings = geodir_get_widget_listings( $query_args );
359
+            $listings = geodir_get_widget_listings($query_args);
360 360
         }
361 361
 
362
-        if ( ! empty( $listings ) ) {
363
-            foreach ( $listings as $listing ) {
364
-                create_marker_jason_of_posts( $listing );
362
+        if (!empty($listings)) {
363
+            foreach ($listings as $listing) {
364
+                create_marker_jason_of_posts($listing);
365 365
             }
366 366
         }
367 367
 
368 368
         ob_start();
369
-        add_action( 'wp_head', 'init_listing_map_script' ); // Initialize the map object and marker array
369
+        add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array
370 370
 
371
-        add_action( 'the_post', 'create_list_jsondata' ); // Add marker in json array
371
+        add_action('the_post', 'create_list_jsondata'); // Add marker in json array
372 372
 
373
-        add_action( 'wp_footer', 'show_listing_widget_map' ); // Show map for listings with markers
373
+        add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers
374 374
 
375 375
         $default_location = geodir_get_default_location();
376 376
 
@@ -391,17 +391,17 @@  discard block
 block discarded – undo
391 391
             'enable_location_filters'  => false,
392 392
             'enable_jason_on_load'     => true,
393 393
             'ajax_url'                 => geodir_get_ajax_url(),
394
-            'latitude'                 => isset( $default_location->city_latitude ) ? $default_location->city_latitude : '',
395
-            'longitude'                => isset( $default_location->city_longitude ) ? $default_location->city_longitude : '',
394
+            'latitude'                 => isset($default_location->city_latitude) ? $default_location->city_latitude : '',
395
+            'longitude'                => isset($default_location->city_longitude) ? $default_location->city_longitude : '',
396 396
             'streetViewControl'        => true,
397 397
             'showPreview'              => '0',
398 398
             'maxZoom'                  => 21,
399 399
             'bubble_size'              => 'small',
400 400
         );
401 401
 
402
-        if ( is_single() ) {
402
+        if (is_single()) {
403 403
             global $post;
404
-            if ( isset( $post->post_latitude ) ) {
404
+            if (isset($post->post_latitude)) {
405 405
                 $map_args['latitude']  = $post->post_latitude;
406 406
                 $map_args['longitude'] = $post->post_longitude;
407 407
             }
@@ -412,24 +412,24 @@  discard block
 block discarded – undo
412 412
         }
413 413
 
414 414
         // Add marker cluster
415
-        if ( isset( $params['marker_cluster'] ) && gdsc_to_bool_val( $params['marker_cluster'] ) && defined( 'GDCLUSTER_VERSION' ) ) {
415
+        if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) {
416 416
             $map_args['enable_marker_cluster'] = true;
417 417
         } else {
418 418
             $map_args['enable_marker_cluster'] = false;
419 419
         }
420 420
 
421
-        geodir_draw_map( $map_args );
421
+        geodir_draw_map($map_args);
422 422
 
423 423
         $output = ob_get_contents();
424 424
 
425 425
         ob_end_clean();
426 426
 
427
-        foreach ( $backup_globals as $global => $value ) {
427
+        foreach ($backup_globals as $global => $value) {
428 428
             ${$global} = $value;
429 429
         }
430 430
 
431 431
         return $output;
432
-    }else{
432
+    } else {
433 433
         ob_start();
434 434
         add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array
435 435
         add_action('the_post', 'create_list_jsondata'); // Add marker in json array
@@ -1047,20 +1047,20 @@  discard block
 block discarded – undo
1047 1047
 	
1048 1048
 	$show_adv_search = isset($params['show_adv_search']) && in_array($params['show_adv_search'], array('default', 'always', 'searched')) ? $params['show_adv_search'] : '';
1049 1049
 	
1050
-	if ($show_adv_search != '' ) {
1051
-		$show_adv_class = 'geodir-advance-search-' . $show_adv_search . ' ';
1050
+	if ($show_adv_search != '') {
1051
+		$show_adv_class = 'geodir-advance-search-'.$show_adv_search.' ';
1052 1052
 		if ($show_adv_search == 'searched' && geodir_is_page('search')) {
1053 1053
 			$show_adv_search = 'search';
1054 1054
 		}
1055
-		$show_adv_attrs = 'data-show-adv="' . $show_adv_search . '"';
1055
+		$show_adv_attrs = 'data-show-adv="'.$show_adv_search.'"';
1056 1056
 		
1057
-		$params['before_widget'] = str_replace('class="', $show_adv_attrs . ' class="' . $show_adv_class, $params['before_widget']);
1057
+		$params['before_widget'] = str_replace('class="', $show_adv_attrs.' class="'.$show_adv_class, $params['before_widget']);
1058 1058
 	}
1059 1059
 	
1060 1060
 	ob_start();
1061 1061
 	
1062 1062
 	//geodir_get_template_part('listing', 'filter-form');
1063
-	the_widget('geodir_advance_search_widget', $params, $params );
1063
+	the_widget('geodir_advance_search_widget', $params, $params);
1064 1064
 	
1065 1065
 	$output = ob_get_contents();
1066 1066
     ob_end_clean();
@@ -1260,7 +1260,7 @@  discard block
 block discarded – undo
1260 1260
 
1261 1261
     // Validate character_count
1262 1262
     //todo: is this necessary?
1263
-    $params['character_count']  = $params['character_count'];
1263
+    $params['character_count'] = $params['character_count'];
1264 1264
 
1265 1265
     // Validate our layout choice
1266 1266
     // Outside of the norm, I added some more simple terms to match the existing
@@ -1272,7 +1272,7 @@  discard block
 block discarded – undo
1272 1272
 
1273 1273
     // Validate Listing width, used in the template widget-listing-listview.php
1274 1274
     // The context is in width=$listing_width% - So we need a positive number between 0 & 100
1275
-    $params['listing_width']    = gdsc_validate_listing_width($params['listing_width']);
1275
+    $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']);
1276 1276
 
1277 1277
     // Validate the checkboxes used on the widget
1278 1278
     $params['add_location_filter']  = gdsc_to_bool_val($params['add_location_filter']);
@@ -1288,7 +1288,7 @@  discard block
 block discarded – undo
1288 1288
     if (!empty($params['tags'])) {
1289 1289
         if (!is_array($params['tags'])) {
1290 1290
             $comma = _x(',', 'tag delimiter');
1291
-            if ( ',' !== $comma ) {
1291
+            if (',' !== $comma) {
1292 1292
                 $params['tags'] = str_replace($comma, ',', $params['tags']);
1293 1293
             }
1294 1294
             $params['tags'] = explode(',', trim($params['tags'], " \n\t\r\0\x0B,"));
@@ -1310,13 +1310,13 @@  discard block
 block discarded – undo
1310 1310
         unset($atts['pageno']);
1311 1311
     }
1312 1312
 
1313
-    if ( !empty($atts['shortcode_content']) ) {
1313
+    if (!empty($atts['shortcode_content'])) {
1314 1314
         $content = $atts['shortcode_content'];
1315 1315
     }
1316 1316
     $params['shortcode_content'] = trim($content);
1317 1317
     $atts['shortcode_content'] = trim($content);
1318 1318
     
1319
-    $params['shortcode_atts']       = $atts;
1319
+    $params['shortcode_atts'] = $atts;
1320 1320
 
1321 1321
     $output = geodir_sc_gd_listings_output($params);
1322 1322
 
@@ -1388,8 +1388,8 @@  discard block
 block discarded – undo
1388 1388
     // Validate the checkboxes used on the widget
1389 1389
     $params['hide_empty'] 	= gdsc_to_bool_val($params['hide_empty']);
1390 1390
     $params['show_count'] 	= gdsc_to_bool_val($params['show_count']);
1391
-    $params['hide_icon'] 	= gdsc_to_bool_val($params['hide_icon']);
1392
-    $params['cpt_left'] 	= gdsc_to_bool_val($params['cpt_left']);
1391
+    $params['hide_icon'] = gdsc_to_bool_val($params['hide_icon']);
1392
+    $params['cpt_left'] = gdsc_to_bool_val($params['cpt_left']);
1393 1393
 
1394 1394
     if ($params['max_count'] != 'all') {
1395 1395
         $params['max_count'] = absint($params['max_count']);
Please login to merge, or discard this patch.
Indentation   +888 added lines, -888 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  */
8 8
 // If this file is called directly, abort.
9 9
 if (!defined('WPINC')) {
10
-    die;
10
+	die;
11 11
 }
12 12
 require_once('geodirectory-functions/shortcode_functions.php');
13 13
 
@@ -32,43 +32,43 @@  discard block
 block discarded – undo
32 32
  */
33 33
 function geodir_sc_add_listing($atts)
34 34
 {
35
-    ob_start();
36
-    $defaults = array(
37
-        'pid' => '',
38
-        'listing_type' => 'gd_place',
39
-        'login_msg' => __('You must login to post.', 'geodirectory'),
40
-        'show_login' => false,
41
-    );
42
-    $params = shortcode_atts($defaults, $atts);
43
-
44
-    foreach ($params as $key => $value) {
45
-        $_REQUEST[$key] = $value;
46
-    }
47
-
48
-    $user_id = get_current_user_id();
49
-    if (!$user_id) {
50
-        echo $params['login_msg'];
51
-        if ($params['show_login']) {
52
-            echo "<br />";
53
-            $defaults = array(
54
-                'before_widget' => '',
55
-                'after_widget' => '',
56
-                'before_title' => '',
57
-                'after_title' => '',
58
-            );
59
-
60
-            geodir_loginwidget_output($defaults, $defaults);
61
-        }
62
-
63
-
64
-    } else {
65
-       // Add listing page will be used if shortcode is detected in page content, no need to call it here
66
-    }
67
-    $output = ob_get_contents();
68
-
69
-    ob_end_clean();
70
-
71
-    return $output;
35
+	ob_start();
36
+	$defaults = array(
37
+		'pid' => '',
38
+		'listing_type' => 'gd_place',
39
+		'login_msg' => __('You must login to post.', 'geodirectory'),
40
+		'show_login' => false,
41
+	);
42
+	$params = shortcode_atts($defaults, $atts);
43
+
44
+	foreach ($params as $key => $value) {
45
+		$_REQUEST[$key] = $value;
46
+	}
47
+
48
+	$user_id = get_current_user_id();
49
+	if (!$user_id) {
50
+		echo $params['login_msg'];
51
+		if ($params['show_login']) {
52
+			echo "<br />";
53
+			$defaults = array(
54
+				'before_widget' => '',
55
+				'after_widget' => '',
56
+				'before_title' => '',
57
+				'after_title' => '',
58
+			);
59
+
60
+			geodir_loginwidget_output($defaults, $defaults);
61
+		}
62
+
63
+
64
+	} else {
65
+	   // Add listing page will be used if shortcode is detected in page content, no need to call it here
66
+	}
67
+	$output = ob_get_contents();
68
+
69
+	ob_end_clean();
70
+
71
+	return $output;
72 72
 }
73 73
 
74 74
 /**
@@ -96,136 +96,136 @@  discard block
 block discarded – undo
96 96
  */
97 97
 function geodir_sc_home_map($atts)
98 98
 {
99
-    ob_start();
100
-    $defaults = array(
101
-        'width' => '960',
102
-        'height' => '425',
103
-        'maptype' => 'ROADMAP',
104
-        'zoom' => '13',
105
-        'autozoom' => '',
106
-        'child_collapse' => '0',
107
-        'scrollwheel' => '0',
99
+	ob_start();
100
+	$defaults = array(
101
+		'width' => '960',
102
+		'height' => '425',
103
+		'maptype' => 'ROADMAP',
104
+		'zoom' => '13',
105
+		'autozoom' => '',
106
+		'child_collapse' => '0',
107
+		'scrollwheel' => '0',
108 108
 		'marker_cluster' => false,
109
-        'latitude' => '',
110
-        'longitude' => ''
111
-    );
112
-
113
-    $params = shortcode_atts($defaults, $atts);
114
-
115
-    $params = gdsc_validate_map_args($params);
116
-
117
-    $map_args = array(
118
-        'map_canvas_name' => 'gd_home_map',
119
-        'latitude' => $params['latitude'],
120
-        'longitude' => $params['longitude'],
121
-
122
-        /**
123
-         * Filter the widget width of the map on home/listings page.
124
-         *
125
-         * @since 1.0.0
126
-         * @param mixed(string|int|float) $params['width'] The map width.
127
-         */
128
-        'width' => apply_filters('widget_width', $params['width']),
129
-        /**
130
-         * Filter the widget height of the map on home/listings page.
131
-         *
132
-         * @since 1.0.0
133
-         * @param mixed(string|int|float) $params['height'] The map height.
134
-         */
135
-        'height' => apply_filters('widget_heigh', $params['height']),
136
-        /**
137
-         * Filter the widget maptype of the map on home/listings page.
138
-         *
139
-         * @since 1.0.0
109
+		'latitude' => '',
110
+		'longitude' => ''
111
+	);
112
+
113
+	$params = shortcode_atts($defaults, $atts);
114
+
115
+	$params = gdsc_validate_map_args($params);
116
+
117
+	$map_args = array(
118
+		'map_canvas_name' => 'gd_home_map',
119
+		'latitude' => $params['latitude'],
120
+		'longitude' => $params['longitude'],
121
+
122
+		/**
123
+		 * Filter the widget width of the map on home/listings page.
124
+		 *
125
+		 * @since 1.0.0
126
+		 * @param mixed(string|int|float) $params['width'] The map width.
127
+		 */
128
+		'width' => apply_filters('widget_width', $params['width']),
129
+		/**
130
+		 * Filter the widget height of the map on home/listings page.
131
+		 *
132
+		 * @since 1.0.0
133
+		 * @param mixed(string|int|float) $params['height'] The map height.
134
+		 */
135
+		'height' => apply_filters('widget_heigh', $params['height']),
136
+		/**
137
+		 * Filter the widget maptype of the map on home/listings page.
138
+		 *
139
+		 * @since 1.0.0
140 140
 		 * @since 1.5.2 Added TERRAIN map type.
141
-         * @param string $params['maptype'] The map type. Can be ROADMAP | SATELLITE | HYBRID | TERRAIN.
142
-         */
143
-        'maptype' => apply_filters('widget_maptype', $params['maptype']),
144
-        /**
145
-         * Filter the widget scrollwheel value of the map on home/listings page.
146
-         *
147
-         * Should the scrollwheel zoom the map or not.
148
-         *
149
-         * @since 1.0.0
150
-         * @param bool $params['scrollwheel'] True to allow scroll wheel to scroll map or false if not.
151
-         */
152
-        'scrollwheel' => apply_filters('widget_scrollwheel', $params['scrollwheel']),
153
-        /**
154
-         * Filter the widget zoom level of the map on home/listings page.
155
-         *
156
-         * @since 1.0.0
157
-         * @param int $params['zoom'] The zoom level of the map. Between 1-19.
158
-         */
159
-        'zoom' => apply_filters('widget_zoom', $params['zoom']),
160
-        /**
161
-         * Filter the widget auto zoom value of the map on home/listings page.
162
-         *
163
-         * If the map should autozoom to fit the markers shown.
164
-         *
165
-         * @since 1.0.0
166
-         * @param bool $params['autozoom'] True if the map should autozoom, false if not.
167
-         */
168
-        'autozoom' => apply_filters('widget_autozoom', $params['autozoom']),
169
-        /**
170
-         * Filter the widget child_collapse value of the map on home/listings page.
171
-         *
172
-         * If the map should auto collapse the child categories if the category bar is present.
173
-         *
174
-         * @since 1.0.0
175
-         * @param bool $params['child_collapse'] True if the map should collapse the categories, false if not.
176
-         */
177
-        'child_collapse' => apply_filters('widget_child_collapse', $params['child_collapse']),
178
-        'enable_cat_filters' => true,
179
-        'enable_text_search' => true,
180
-        'enable_post_type_filters' => true,
181
-        /**
182
-         * Filter the widget enable_location_filters value of the map on home/listings page.
183
-         *
184
-         * This is used when the location addon is used.
185
-         *
186
-         * @since 1.0.0
187
-         * @param bool $val True if location filters should be used, false if not.
188
-         */
189
-        'enable_location_filters' => apply_filters('geodir_home_map_enable_location_filters', false),
190
-        'enable_jason_on_load' => false,
191
-        'enable_marker_cluster' => false,
192
-        'enable_map_resize_button' => true,
193
-        'map_class_name' => 'geodir-map-home-page',
194
-        'is_geodir_home_map_widget' => true,
195
-    );
141
+		 * @param string $params['maptype'] The map type. Can be ROADMAP | SATELLITE | HYBRID | TERRAIN.
142
+		 */
143
+		'maptype' => apply_filters('widget_maptype', $params['maptype']),
144
+		/**
145
+		 * Filter the widget scrollwheel value of the map on home/listings page.
146
+		 *
147
+		 * Should the scrollwheel zoom the map or not.
148
+		 *
149
+		 * @since 1.0.0
150
+		 * @param bool $params['scrollwheel'] True to allow scroll wheel to scroll map or false if not.
151
+		 */
152
+		'scrollwheel' => apply_filters('widget_scrollwheel', $params['scrollwheel']),
153
+		/**
154
+		 * Filter the widget zoom level of the map on home/listings page.
155
+		 *
156
+		 * @since 1.0.0
157
+		 * @param int $params['zoom'] The zoom level of the map. Between 1-19.
158
+		 */
159
+		'zoom' => apply_filters('widget_zoom', $params['zoom']),
160
+		/**
161
+		 * Filter the widget auto zoom value of the map on home/listings page.
162
+		 *
163
+		 * If the map should autozoom to fit the markers shown.
164
+		 *
165
+		 * @since 1.0.0
166
+		 * @param bool $params['autozoom'] True if the map should autozoom, false if not.
167
+		 */
168
+		'autozoom' => apply_filters('widget_autozoom', $params['autozoom']),
169
+		/**
170
+		 * Filter the widget child_collapse value of the map on home/listings page.
171
+		 *
172
+		 * If the map should auto collapse the child categories if the category bar is present.
173
+		 *
174
+		 * @since 1.0.0
175
+		 * @param bool $params['child_collapse'] True if the map should collapse the categories, false if not.
176
+		 */
177
+		'child_collapse' => apply_filters('widget_child_collapse', $params['child_collapse']),
178
+		'enable_cat_filters' => true,
179
+		'enable_text_search' => true,
180
+		'enable_post_type_filters' => true,
181
+		/**
182
+		 * Filter the widget enable_location_filters value of the map on home/listings page.
183
+		 *
184
+		 * This is used when the location addon is used.
185
+		 *
186
+		 * @since 1.0.0
187
+		 * @param bool $val True if location filters should be used, false if not.
188
+		 */
189
+		'enable_location_filters' => apply_filters('geodir_home_map_enable_location_filters', false),
190
+		'enable_jason_on_load' => false,
191
+		'enable_marker_cluster' => false,
192
+		'enable_map_resize_button' => true,
193
+		'map_class_name' => 'geodir-map-home-page',
194
+		'is_geodir_home_map_widget' => true,
195
+	);
196 196
 
197 197
 	// Add marker cluster
198 198
 	if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) {
199
-        $map_args['enable_marker_cluster'] = true;
200
-        if(get_option('geodir_marker_cluster_type')) {
201
-            if ($map_args['autozoom']) {
202
-                $map_args['enable_marker_cluster_no_reposition'] = false;
203
-            } else {
204
-                $map_args['enable_marker_cluster_no_reposition'] = true;
205
-            }
199
+		$map_args['enable_marker_cluster'] = true;
200
+		if(get_option('geodir_marker_cluster_type')) {
201
+			if ($map_args['autozoom']) {
202
+				$map_args['enable_marker_cluster_no_reposition'] = false;
203
+			} else {
204
+				$map_args['enable_marker_cluster_no_reposition'] = true;
205
+			}
206 206
 
207
-            $map_args['enable_marker_cluster_server'] = true ;
207
+			$map_args['enable_marker_cluster_server'] = true ;
208 208
 
209
-        }
209
+		}
210 210
 	} else {
211 211
 		$map_args['enable_marker_cluster'] = false;
212 212
 	}
213 213
 
214
-    // if lat and long set in shortcode, hack it so the map is not repositioned
215
-    if(!empty($params['latitude']) && !empty($params['longitude']) ){
216
-        $map_args['enable_marker_cluster_no_reposition'] = true;
217
-    }
214
+	// if lat and long set in shortcode, hack it so the map is not repositioned
215
+	if(!empty($params['latitude']) && !empty($params['longitude']) ){
216
+		$map_args['enable_marker_cluster_no_reposition'] = true;
217
+	}
218 218
 
219 219
 
220
-    geodir_draw_map($map_args);
220
+	geodir_draw_map($map_args);
221 221
 
222
-    add_action('wp_footer', 'geodir_home_map_add_script', 100);
222
+	add_action('wp_footer', 'geodir_home_map_add_script', 100);
223 223
 
224
-    $output = ob_get_contents();
224
+	$output = ob_get_contents();
225 225
 
226
-    ob_end_clean();
226
+	ob_end_clean();
227 227
 
228
-    return $output;
228
+	return $output;
229 229
 }
230 230
 add_shortcode('gd_homepage_map', 'geodir_sc_home_map');
231 231
 
@@ -264,243 +264,243 @@  discard block
 block discarded – undo
264 264
  */
265 265
 function geodir_sc_listing_map($atts) {
266 266
 
267
-    // if some params are set then we need a new query, if not then we can use the main query
268
-    if( isset($atts['post_type']) || isset($atts['category']) || isset($atts['event_type']) ) {
269
-
270
-        global $add_post_in_marker_array, $gd_sc_map_params;
271
-        $backup_globals                             = array();
272
-        $backup_globals['add_post_in_marker_array'] = $add_post_in_marker_array;
273
-        $backup_globals['gd_sc_map_params']         = $gd_sc_map_params;
274
-
275
-        $defaults = array(
276
-            'width'          => '294',
277
-            'height'         => '370',
278
-            'zoom'           => '13',
279
-            'autozoom'       => '',
280
-            'sticky'         => '',
281
-            'showall'        => '0',
282
-            'scrollwheel'    => '0',
283
-            'maptype'        => 'ROADMAP',
284
-            'child_collapse' => 0,
285
-            'marker_cluster' => false,
286
-            'post_type'      => 'gd_place',
287
-            'category'       => '0',
288
-            'event_type'     => 'all'
289
-        );
290
-
291
-        $params = shortcode_atts( $defaults, $atts );
292
-
293
-        if ( ! ( gdsc_is_post_type_valid( $params['post_type'] ) ) ) {
294
-            $params['post_type'] = 'gd_place';
295
-        }
296
-
297
-        // Validate the selected category/ies - Grab the current list based on post_type
298
-        $category_taxonomy = geodir_get_taxonomies( $params['post_type'] );
299
-        $categories        = get_terms( $category_taxonomy, array(
300
-            'orderby' => 'count',
301
-            'order'   => 'DESC',
302
-            'fields'  => 'ids'
303
-        ) );
304
-
305
-        // Make sure we have an array
306
-        if ( ! ( is_array( $params['category'] ) ) ) {
307
-            $params['category'] = explode( ',', $params['category'] );
308
-        }
309
-
310
-        // Array_intersect returns only the items in $params['category'] that are also in our category list
311
-        // Otherwise it becomes empty and later on that will mean "All"
312
-        $params['category'] = array_intersect( $params['category'], $categories );
313
-
314
-        if ( $params['post_type'] == 'gd_event' ) {
315
-            $params['event_type'] = gdsc_validate_list_filter_choice( $params['event_type'] );
316
-        }
317
-
318
-        $params = gdsc_validate_map_args( $params );
319
-
320
-        $gd_sc_map_params = $params;
321
-
322
-        $query_args = array(
323
-            'posts_per_page' => 1000000, //@todo kiran why was this added? 
324
-            'is_geodir_loop' => true,
325
-            'gd_location'    => false,
326
-            'post_type'      => $params['post_type'],
327
-        );
328
-
329
-        if ( ! empty( $params['category'] ) && isset( $params['category'][0] ) && (int) $params['category'][0] != 0 ) {
330
-            $category_taxonomy = geodir_get_taxonomies( $params['post_type'] );
331
-
332
-            ######### WPML #########
333
-            if ( function_exists( 'icl_object_id' ) ) {
334
-                $category = gd_lang_object_ids( $params['category'], $category_taxonomy[0] );
335
-            }
336
-            ######### WPML #########
337
-
338
-            $tax_query = array(
339
-                'taxonomy' => $category_taxonomy[0],
340
-                'field'    => 'id',
341
-                'terms'    => $params['category']
342
-            );
343
-
344
-            $query_args['tax_query'] = array( $tax_query );
345
-        }
346
-
347
-        $add_post_in_marker_array = true;
348
-
349
-        if ( $params['post_type'] == 'gd_event' && function_exists( 'geodir_event_get_widget_events' ) ) {
350
-            global $geodir_event_widget_listview;
351
-            $geodir_event_widget_listview = true;
352
-
353
-            $query_args['geodir_event_type'] = $params['event_type'];
354
-
355
-            $listings = geodir_event_get_widget_events( $query_args );
356
-
357
-            $geodir_event_widget_listview = false;
358
-        } else {
359
-            $listings = geodir_get_widget_listings( $query_args );
360
-        }
361
-
362
-        if ( ! empty( $listings ) ) {
363
-            foreach ( $listings as $listing ) {
364
-                create_marker_jason_of_posts( $listing );
365
-            }
366
-        }
367
-
368
-        ob_start();
369
-        add_action( 'wp_head', 'init_listing_map_script' ); // Initialize the map object and marker array
370
-
371
-        add_action( 'the_post', 'create_list_jsondata' ); // Add marker in json array
372
-
373
-        add_action( 'wp_footer', 'show_listing_widget_map' ); // Show map for listings with markers
374
-
375
-        $default_location = geodir_get_default_location();
376
-
377
-        $map_args = array(
378
-            'map_canvas_name'          => 'gd_listing_map',
379
-            'width'                    => $params['width'],
380
-            'height'                   => $params['height'],
381
-            'zoom'                     => $params['zoom'],
382
-            'autozoom'                 => $params['autozoom'],
383
-            'sticky'                   => $params['sticky'],
384
-            'showall'                  => $params['showall'],
385
-            'scrollwheel'              => $params['scrollwheel'],
386
-            'maptype'                  => $params['maptype'],
387
-            'child_collapse'           => 0,
388
-            'enable_cat_filters'       => false,
389
-            'enable_text_search'       => false,
390
-            'enable_post_type_filters' => false,
391
-            'enable_location_filters'  => false,
392
-            'enable_jason_on_load'     => true,
393
-            'ajax_url'                 => geodir_get_ajax_url(),
394
-            'latitude'                 => isset( $default_location->city_latitude ) ? $default_location->city_latitude : '',
395
-            'longitude'                => isset( $default_location->city_longitude ) ? $default_location->city_longitude : '',
396
-            'streetViewControl'        => true,
397
-            'showPreview'              => '0',
398
-            'maxZoom'                  => 21,
399
-            'bubble_size'              => 'small',
400
-        );
401
-
402
-        if ( is_single() ) {
403
-            global $post;
404
-            if ( isset( $post->post_latitude ) ) {
405
-                $map_args['latitude']  = $post->post_latitude;
406
-                $map_args['longitude'] = $post->post_longitude;
407
-            }
408
-
409
-            $map_args['map_class_name'] = 'geodir-map-listing-page-single';
410
-        } else {
411
-            $map_args['map_class_name'] = 'geodir-map-listing-page';
412
-        }
413
-
414
-        // Add marker cluster
415
-        if ( isset( $params['marker_cluster'] ) && gdsc_to_bool_val( $params['marker_cluster'] ) && defined( 'GDCLUSTER_VERSION' ) ) {
416
-            $map_args['enable_marker_cluster'] = true;
417
-        } else {
418
-            $map_args['enable_marker_cluster'] = false;
419
-        }
420
-
421
-        geodir_draw_map( $map_args );
422
-
423
-        $output = ob_get_contents();
424
-
425
-        ob_end_clean();
426
-
427
-        foreach ( $backup_globals as $global => $value ) {
428
-            ${$global} = $value;
429
-        }
430
-
431
-        return $output;
432
-    }else{
433
-        ob_start();
434
-        add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array
435
-        add_action('the_post', 'create_list_jsondata'); // Add marker in json array
436
-        add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers
437
-        $defaults = array(
438
-            'width' => '294',
439
-            'height' => '370',
440
-            'zoom' => '13',
441
-            'autozoom' => '',
442
-            'sticky' => '',
443
-            'showall' => '0',
444
-            'scrollwheel' => '0',
445
-            'maptype' => 'ROADMAP',
446
-            'child_collapse' => 0,
447
-            'marker_cluster' => false
448
-        );
449
-        $params = shortcode_atts($defaults, $atts);
450
-        $params = gdsc_validate_map_args($params);
451
-        $map_args = array(
452
-            'map_canvas_name' => 'gd_listing_map',
453
-            'width' => $params['width'],
454
-            'height' => $params['height'],
455
-            'zoom' => $params['zoom'],
456
-            'autozoom' => $params['autozoom'],
457
-            'sticky' => $params['sticky'],
458
-            'showall' => $params['showall'],
459
-            'scrollwheel' => $params['scrollwheel'],
460
-            'child_collapse' => 0,
461
-            'enable_cat_filters' => false,
462
-            'enable_text_search' => false,
463
-            'enable_post_type_filters' => false,
464
-            'enable_location_filters' => false,
465
-            'enable_jason_on_load' => true,
466
-        );
467
-        if (is_single()) {
468
-            global $post;
469
-            $map_default_lat = $address_latitude = $post->post_latitude;
470
-            $map_default_lng = $address_longitude = $post->post_longitude;
471
-            $mapview = $post->post_mapview;
472
-            $map_args['zoom'] = $post->post_mapzoom;
473
-            $map_args['map_class_name'] = 'geodir-map-listing-page-single';
474
-        } else {
475
-            $default_location = geodir_get_default_location();
476
-            $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
477
-            $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
478
-            $map_args['map_class_name'] = 'geodir-map-listing-page';
479
-        }
480
-        if (empty($mapview)) {
481
-            $mapview = 'ROADMAP';
482
-        }
483
-        // Set default map options
484
-        $map_args['ajax_url'] = geodir_get_ajax_url();
485
-        $map_args['latitude'] = $map_default_lat;
486
-        $map_args['longitude'] = $map_default_lng;
487
-        $map_args['streetViewControl'] = true;
488
-        $map_args['maptype'] = $mapview;
489
-        $map_args['showPreview'] = '0';
490
-        $map_args['maxZoom'] = 21;
491
-        $map_args['bubble_size'] = 'small';
492
-
493
-        // Add marker cluster
494
-        if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) {
495
-            $map_args['enable_marker_cluster'] = true;
496
-        } else {
497
-            $map_args['enable_marker_cluster'] = false;
498
-        }
499
-        geodir_draw_map($map_args);
500
-        $output = ob_get_contents();
501
-        ob_end_clean();
502
-        return $output;
503
-    }
267
+	// if some params are set then we need a new query, if not then we can use the main query
268
+	if( isset($atts['post_type']) || isset($atts['category']) || isset($atts['event_type']) ) {
269
+
270
+		global $add_post_in_marker_array, $gd_sc_map_params;
271
+		$backup_globals                             = array();
272
+		$backup_globals['add_post_in_marker_array'] = $add_post_in_marker_array;
273
+		$backup_globals['gd_sc_map_params']         = $gd_sc_map_params;
274
+
275
+		$defaults = array(
276
+			'width'          => '294',
277
+			'height'         => '370',
278
+			'zoom'           => '13',
279
+			'autozoom'       => '',
280
+			'sticky'         => '',
281
+			'showall'        => '0',
282
+			'scrollwheel'    => '0',
283
+			'maptype'        => 'ROADMAP',
284
+			'child_collapse' => 0,
285
+			'marker_cluster' => false,
286
+			'post_type'      => 'gd_place',
287
+			'category'       => '0',
288
+			'event_type'     => 'all'
289
+		);
290
+
291
+		$params = shortcode_atts( $defaults, $atts );
292
+
293
+		if ( ! ( gdsc_is_post_type_valid( $params['post_type'] ) ) ) {
294
+			$params['post_type'] = 'gd_place';
295
+		}
296
+
297
+		// Validate the selected category/ies - Grab the current list based on post_type
298
+		$category_taxonomy = geodir_get_taxonomies( $params['post_type'] );
299
+		$categories        = get_terms( $category_taxonomy, array(
300
+			'orderby' => 'count',
301
+			'order'   => 'DESC',
302
+			'fields'  => 'ids'
303
+		) );
304
+
305
+		// Make sure we have an array
306
+		if ( ! ( is_array( $params['category'] ) ) ) {
307
+			$params['category'] = explode( ',', $params['category'] );
308
+		}
309
+
310
+		// Array_intersect returns only the items in $params['category'] that are also in our category list
311
+		// Otherwise it becomes empty and later on that will mean "All"
312
+		$params['category'] = array_intersect( $params['category'], $categories );
313
+
314
+		if ( $params['post_type'] == 'gd_event' ) {
315
+			$params['event_type'] = gdsc_validate_list_filter_choice( $params['event_type'] );
316
+		}
317
+
318
+		$params = gdsc_validate_map_args( $params );
319
+
320
+		$gd_sc_map_params = $params;
321
+
322
+		$query_args = array(
323
+			'posts_per_page' => 1000000, //@todo kiran why was this added? 
324
+			'is_geodir_loop' => true,
325
+			'gd_location'    => false,
326
+			'post_type'      => $params['post_type'],
327
+		);
328
+
329
+		if ( ! empty( $params['category'] ) && isset( $params['category'][0] ) && (int) $params['category'][0] != 0 ) {
330
+			$category_taxonomy = geodir_get_taxonomies( $params['post_type'] );
331
+
332
+			######### WPML #########
333
+			if ( function_exists( 'icl_object_id' ) ) {
334
+				$category = gd_lang_object_ids( $params['category'], $category_taxonomy[0] );
335
+			}
336
+			######### WPML #########
337
+
338
+			$tax_query = array(
339
+				'taxonomy' => $category_taxonomy[0],
340
+				'field'    => 'id',
341
+				'terms'    => $params['category']
342
+			);
343
+
344
+			$query_args['tax_query'] = array( $tax_query );
345
+		}
346
+
347
+		$add_post_in_marker_array = true;
348
+
349
+		if ( $params['post_type'] == 'gd_event' && function_exists( 'geodir_event_get_widget_events' ) ) {
350
+			global $geodir_event_widget_listview;
351
+			$geodir_event_widget_listview = true;
352
+
353
+			$query_args['geodir_event_type'] = $params['event_type'];
354
+
355
+			$listings = geodir_event_get_widget_events( $query_args );
356
+
357
+			$geodir_event_widget_listview = false;
358
+		} else {
359
+			$listings = geodir_get_widget_listings( $query_args );
360
+		}
361
+
362
+		if ( ! empty( $listings ) ) {
363
+			foreach ( $listings as $listing ) {
364
+				create_marker_jason_of_posts( $listing );
365
+			}
366
+		}
367
+
368
+		ob_start();
369
+		add_action( 'wp_head', 'init_listing_map_script' ); // Initialize the map object and marker array
370
+
371
+		add_action( 'the_post', 'create_list_jsondata' ); // Add marker in json array
372
+
373
+		add_action( 'wp_footer', 'show_listing_widget_map' ); // Show map for listings with markers
374
+
375
+		$default_location = geodir_get_default_location();
376
+
377
+		$map_args = array(
378
+			'map_canvas_name'          => 'gd_listing_map',
379
+			'width'                    => $params['width'],
380
+			'height'                   => $params['height'],
381
+			'zoom'                     => $params['zoom'],
382
+			'autozoom'                 => $params['autozoom'],
383
+			'sticky'                   => $params['sticky'],
384
+			'showall'                  => $params['showall'],
385
+			'scrollwheel'              => $params['scrollwheel'],
386
+			'maptype'                  => $params['maptype'],
387
+			'child_collapse'           => 0,
388
+			'enable_cat_filters'       => false,
389
+			'enable_text_search'       => false,
390
+			'enable_post_type_filters' => false,
391
+			'enable_location_filters'  => false,
392
+			'enable_jason_on_load'     => true,
393
+			'ajax_url'                 => geodir_get_ajax_url(),
394
+			'latitude'                 => isset( $default_location->city_latitude ) ? $default_location->city_latitude : '',
395
+			'longitude'                => isset( $default_location->city_longitude ) ? $default_location->city_longitude : '',
396
+			'streetViewControl'        => true,
397
+			'showPreview'              => '0',
398
+			'maxZoom'                  => 21,
399
+			'bubble_size'              => 'small',
400
+		);
401
+
402
+		if ( is_single() ) {
403
+			global $post;
404
+			if ( isset( $post->post_latitude ) ) {
405
+				$map_args['latitude']  = $post->post_latitude;
406
+				$map_args['longitude'] = $post->post_longitude;
407
+			}
408
+
409
+			$map_args['map_class_name'] = 'geodir-map-listing-page-single';
410
+		} else {
411
+			$map_args['map_class_name'] = 'geodir-map-listing-page';
412
+		}
413
+
414
+		// Add marker cluster
415
+		if ( isset( $params['marker_cluster'] ) && gdsc_to_bool_val( $params['marker_cluster'] ) && defined( 'GDCLUSTER_VERSION' ) ) {
416
+			$map_args['enable_marker_cluster'] = true;
417
+		} else {
418
+			$map_args['enable_marker_cluster'] = false;
419
+		}
420
+
421
+		geodir_draw_map( $map_args );
422
+
423
+		$output = ob_get_contents();
424
+
425
+		ob_end_clean();
426
+
427
+		foreach ( $backup_globals as $global => $value ) {
428
+			${$global} = $value;
429
+		}
430
+
431
+		return $output;
432
+	}else{
433
+		ob_start();
434
+		add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array
435
+		add_action('the_post', 'create_list_jsondata'); // Add marker in json array
436
+		add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers
437
+		$defaults = array(
438
+			'width' => '294',
439
+			'height' => '370',
440
+			'zoom' => '13',
441
+			'autozoom' => '',
442
+			'sticky' => '',
443
+			'showall' => '0',
444
+			'scrollwheel' => '0',
445
+			'maptype' => 'ROADMAP',
446
+			'child_collapse' => 0,
447
+			'marker_cluster' => false
448
+		);
449
+		$params = shortcode_atts($defaults, $atts);
450
+		$params = gdsc_validate_map_args($params);
451
+		$map_args = array(
452
+			'map_canvas_name' => 'gd_listing_map',
453
+			'width' => $params['width'],
454
+			'height' => $params['height'],
455
+			'zoom' => $params['zoom'],
456
+			'autozoom' => $params['autozoom'],
457
+			'sticky' => $params['sticky'],
458
+			'showall' => $params['showall'],
459
+			'scrollwheel' => $params['scrollwheel'],
460
+			'child_collapse' => 0,
461
+			'enable_cat_filters' => false,
462
+			'enable_text_search' => false,
463
+			'enable_post_type_filters' => false,
464
+			'enable_location_filters' => false,
465
+			'enable_jason_on_load' => true,
466
+		);
467
+		if (is_single()) {
468
+			global $post;
469
+			$map_default_lat = $address_latitude = $post->post_latitude;
470
+			$map_default_lng = $address_longitude = $post->post_longitude;
471
+			$mapview = $post->post_mapview;
472
+			$map_args['zoom'] = $post->post_mapzoom;
473
+			$map_args['map_class_name'] = 'geodir-map-listing-page-single';
474
+		} else {
475
+			$default_location = geodir_get_default_location();
476
+			$map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
477
+			$map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
478
+			$map_args['map_class_name'] = 'geodir-map-listing-page';
479
+		}
480
+		if (empty($mapview)) {
481
+			$mapview = 'ROADMAP';
482
+		}
483
+		// Set default map options
484
+		$map_args['ajax_url'] = geodir_get_ajax_url();
485
+		$map_args['latitude'] = $map_default_lat;
486
+		$map_args['longitude'] = $map_default_lng;
487
+		$map_args['streetViewControl'] = true;
488
+		$map_args['maptype'] = $mapview;
489
+		$map_args['showPreview'] = '0';
490
+		$map_args['maxZoom'] = 21;
491
+		$map_args['bubble_size'] = 'small';
492
+
493
+		// Add marker cluster
494
+		if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) {
495
+			$map_args['enable_marker_cluster'] = true;
496
+		} else {
497
+			$map_args['enable_marker_cluster'] = false;
498
+		}
499
+		geodir_draw_map($map_args);
500
+		$output = ob_get_contents();
501
+		ob_end_clean();
502
+		return $output;
503
+	}
504 504
 }
505 505
 
506 506
 add_shortcode('gd_listing_slider', 'geodir_sc_listing_slider');
@@ -533,120 +533,120 @@  discard block
 block discarded – undo
533 533
  */
534 534
 function geodir_sc_listing_slider($atts)
535 535
 {
536
-    ob_start();
537
-    $defaults = array(
538
-        'post_type' => 'gd_place',
539
-        'category' => '0',
540
-        'post_number' => '5',
541
-        'slideshow' => '0',
542
-        'animation_loop' => 0,
543
-        'direction_nav' => 0,
544
-        'slideshow_speed' => 5000,
545
-        'animation_speed' => 600,
546
-        'animation' => 'slide',
547
-        'order_by' => 'latest',
548
-        'show_title' => '',
549
-        'show_featured_only' => '',
550
-        'title' => '',
551
-    );
552
-
553
-    $params = shortcode_atts($defaults, $atts);
554
-
555
-
556
-    /*
536
+	ob_start();
537
+	$defaults = array(
538
+		'post_type' => 'gd_place',
539
+		'category' => '0',
540
+		'post_number' => '5',
541
+		'slideshow' => '0',
542
+		'animation_loop' => 0,
543
+		'direction_nav' => 0,
544
+		'slideshow_speed' => 5000,
545
+		'animation_speed' => 600,
546
+		'animation' => 'slide',
547
+		'order_by' => 'latest',
548
+		'show_title' => '',
549
+		'show_featured_only' => '',
550
+		'title' => '',
551
+	);
552
+
553
+	$params = shortcode_atts($defaults, $atts);
554
+
555
+
556
+	/*
557 557
      *
558 558
      * Now we begin the validation of the attributes.
559 559
      */
560
-    // Check we have a valid post_type
561
-    if (!(gdsc_is_post_type_valid($params['post_type']))) {
562
-        $params['post_type'] = 'gd_place';
563
-    }
564
-
565
-    // Check we have a valid sort_order
566
-    $params['order_by'] = gdsc_validate_sort_choice($params['order_by']);
567
-
568
-    // Match the chosen animation to our options
569
-    $animation_list = array('slide', 'fade');
570
-    if (!(in_array($params['animation'], $animation_list))) {
571
-        $params['animation'] = 'slide';
572
-    }
573
-
574
-    // Post_number needs to be a positive integer
575
-    $params['post_number'] = absint($params['post_number']);
576
-    if (0 == $params['post_number']) {
577
-        $params['post_number'] = 1;
578
-    }
579
-
580
-    // Manage the entered categories
581
-    if (0 != $params['category'] || '' != $params['category']) {
582
-        $params['category'] = gdsc_manage_category_choice($params['post_type'], $params['category']);
583
-    }
584
-    // Convert show_title to a bool
585
-    $params['show_title'] = intval(gdsc_to_bool_val($params['show_title']));
586
-
587
-    // Convert show_featured_only to a bool
588
-    $params['show_featured_only'] = intval(gdsc_to_bool_val($params['show_featured_only']));
589
-
590
-    /*
560
+	// Check we have a valid post_type
561
+	if (!(gdsc_is_post_type_valid($params['post_type']))) {
562
+		$params['post_type'] = 'gd_place';
563
+	}
564
+
565
+	// Check we have a valid sort_order
566
+	$params['order_by'] = gdsc_validate_sort_choice($params['order_by']);
567
+
568
+	// Match the chosen animation to our options
569
+	$animation_list = array('slide', 'fade');
570
+	if (!(in_array($params['animation'], $animation_list))) {
571
+		$params['animation'] = 'slide';
572
+	}
573
+
574
+	// Post_number needs to be a positive integer
575
+	$params['post_number'] = absint($params['post_number']);
576
+	if (0 == $params['post_number']) {
577
+		$params['post_number'] = 1;
578
+	}
579
+
580
+	// Manage the entered categories
581
+	if (0 != $params['category'] || '' != $params['category']) {
582
+		$params['category'] = gdsc_manage_category_choice($params['post_type'], $params['category']);
583
+	}
584
+	// Convert show_title to a bool
585
+	$params['show_title'] = intval(gdsc_to_bool_val($params['show_title']));
586
+
587
+	// Convert show_featured_only to a bool
588
+	$params['show_featured_only'] = intval(gdsc_to_bool_val($params['show_featured_only']));
589
+
590
+	/*
591 591
      * Hopefully all attributes are now valid, and safe to pass forward
592 592
      */
593 593
 
594
-    // redeclare vars after validation
595
-
596
-    if (isset($params['direction_nav'])) {
597
-        $params['directionNav'] = $params['direction_nav'];
598
-    }
599
-    if (isset($params['animation_loop'])) {
600
-        $params['animationLoop'] = $params['animation_loop'];
601
-    }
602
-    if (isset($params['slideshow_speed'])) {
603
-        $params['slideshowSpeed'] = $params['slideshow_speed'];
604
-    }
605
-    if (isset($params['animation_speed'])) {
606
-        $params['animationSpeed'] = $params['animation_speed'];
607
-    }
608
-    if (isset($params['order_by'])) {
609
-        $params['list_sort'] = $params['order_by'];
610
-    }
611
-
612
-    $query_args = array(
613
-        'post_number' => $params['post_number'],
614
-        'is_geodir_loop' => true,
615
-        'post_type' => $params['post_type'],
616
-        'order_by' => $params['order_by']
617
-    );
618
-
619
-    if (1 == $params['show_featured_only']) {
620
-        $query_args['show_featured_only'] = 1;
621
-    }
622
-
623
-    if (0 != $params['category'] && '' != $params['category']) {
624
-        $category_taxonomy = geodir_get_taxonomies($params['post_type']);
625
-        $tax_query = array(
626
-            'taxonomy' => $category_taxonomy[0],
627
-            'field' => 'id',
628
-            'terms' => $params['category'],
629
-        );
630
-
631
-        $query_args['tax_query'] = array($tax_query);
632
-    }
633
-
634
-    $defaults = array(
635
-        'before_widget' => '',
636
-        'after_widget' => '',
637
-        'before_title' => '',
638
-        'after_title' => '',
639
-    );
640
-
641
-    $query_args = array_merge($query_args, $params);
642
-
643
-    geodir_listing_slider_widget_output($defaults, $query_args);
644
-
645
-    $output = ob_get_contents();
646
-
647
-    ob_end_clean();
648
-
649
-    return $output;
594
+	// redeclare vars after validation
595
+
596
+	if (isset($params['direction_nav'])) {
597
+		$params['directionNav'] = $params['direction_nav'];
598
+	}
599
+	if (isset($params['animation_loop'])) {
600
+		$params['animationLoop'] = $params['animation_loop'];
601
+	}
602
+	if (isset($params['slideshow_speed'])) {
603
+		$params['slideshowSpeed'] = $params['slideshow_speed'];
604
+	}
605
+	if (isset($params['animation_speed'])) {
606
+		$params['animationSpeed'] = $params['animation_speed'];
607
+	}
608
+	if (isset($params['order_by'])) {
609
+		$params['list_sort'] = $params['order_by'];
610
+	}
611
+
612
+	$query_args = array(
613
+		'post_number' => $params['post_number'],
614
+		'is_geodir_loop' => true,
615
+		'post_type' => $params['post_type'],
616
+		'order_by' => $params['order_by']
617
+	);
618
+
619
+	if (1 == $params['show_featured_only']) {
620
+		$query_args['show_featured_only'] = 1;
621
+	}
622
+
623
+	if (0 != $params['category'] && '' != $params['category']) {
624
+		$category_taxonomy = geodir_get_taxonomies($params['post_type']);
625
+		$tax_query = array(
626
+			'taxonomy' => $category_taxonomy[0],
627
+			'field' => 'id',
628
+			'terms' => $params['category'],
629
+		);
630
+
631
+		$query_args['tax_query'] = array($tax_query);
632
+	}
633
+
634
+	$defaults = array(
635
+		'before_widget' => '',
636
+		'after_widget' => '',
637
+		'before_title' => '',
638
+		'after_title' => '',
639
+	);
640
+
641
+	$query_args = array_merge($query_args, $params);
642
+
643
+	geodir_listing_slider_widget_output($defaults, $query_args);
644
+
645
+	$output = ob_get_contents();
646
+
647
+	ob_end_clean();
648
+
649
+	return $output;
650 650
 }
651 651
 
652 652
 add_shortcode('gd_login_box', 'geodir_sc_login_box');
@@ -670,22 +670,22 @@  discard block
 block discarded – undo
670 670
  */
671 671
 function geodir_sc_login_box($atts)
672 672
 {
673
-    ob_start();
673
+	ob_start();
674 674
 
675
-    $defaults = array(
676
-        'before_widget' => '',
677
-        'after_widget' => '',
678
-        'before_title' => '',
679
-        'after_title' => '',
680
-    );
675
+	$defaults = array(
676
+		'before_widget' => '',
677
+		'after_widget' => '',
678
+		'before_title' => '',
679
+		'after_title' => '',
680
+	);
681 681
 
682
-    geodir_loginwidget_output($defaults, $defaults);
682
+	geodir_loginwidget_output($defaults, $defaults);
683 683
 
684
-    $output = ob_get_contents();
684
+	$output = ob_get_contents();
685 685
 
686
-    ob_end_clean();
686
+	ob_end_clean();
687 687
 
688
-    return $output;
688
+	return $output;
689 689
 }
690 690
 
691 691
 add_shortcode('gd_popular_post_category', 'geodir_sc_popular_post_category');
@@ -716,31 +716,31 @@  discard block
 block discarded – undo
716 716
  */
717 717
 function geodir_sc_popular_post_category($atts)
718 718
 {
719
-    ob_start();
720
-    global $geodir_post_category_str;
721
-    $defaults = array(
722
-        'category_limit' => 15,
723
-        'category_restrict' => false,
724
-        'before_widget' => '',
725
-        'after_widget' => '',
726
-        'before_title' => '',
727
-        'after_title' => '',
728
-        'title' => '',
729
-        'default_post_type' => '',
730
-        'parent_only' => false,
731
-    );
732
-
733
-    $params = shortcode_atts($defaults, $atts, 'popular_post_category');
734
-    $params['category_limit'] = absint($params['category_limit']);
735
-    $params['default_post_type'] = gdsc_is_post_type_valid($params['default_post_type']) ? $params['default_post_type'] : '';
736
-    $params['parent_only'] = gdsc_to_bool_val($params['parent_only']);
737
-    geodir_popular_post_category_output($params, $params);
738
-
739
-    $output = ob_get_contents();
740
-
741
-    ob_end_clean();
742
-
743
-    return $output;
719
+	ob_start();
720
+	global $geodir_post_category_str;
721
+	$defaults = array(
722
+		'category_limit' => 15,
723
+		'category_restrict' => false,
724
+		'before_widget' => '',
725
+		'after_widget' => '',
726
+		'before_title' => '',
727
+		'after_title' => '',
728
+		'title' => '',
729
+		'default_post_type' => '',
730
+		'parent_only' => false,
731
+	);
732
+
733
+	$params = shortcode_atts($defaults, $atts, 'popular_post_category');
734
+	$params['category_limit'] = absint($params['category_limit']);
735
+	$params['default_post_type'] = gdsc_is_post_type_valid($params['default_post_type']) ? $params['default_post_type'] : '';
736
+	$params['parent_only'] = gdsc_to_bool_val($params['parent_only']);
737
+	geodir_popular_post_category_output($params, $params);
738
+
739
+	$output = ob_get_contents();
740
+
741
+	ob_end_clean();
742
+
743
+	return $output;
744 744
 }
745 745
 
746 746
 add_shortcode('gd_popular_post_view', 'geodir_sc_popular_post_view');
@@ -781,96 +781,96 @@  discard block
 block discarded – undo
781 781
  */
782 782
 function geodir_sc_popular_post_view($atts)
783 783
 {
784
-    ob_start();
785
-    $defaults = array(
786
-        'post_type' => 'gd_place',
787
-        'category' => '0',
788
-        'post_number' => '5',
789
-        'layout' => 'gridview_onehalf',
790
-        'add_location_filter' => '0',
791
-        'list_sort' => 'latest',
792
-        'use_viewing_post_type' => '1',
793
-        'character_count' => '20',
794
-        'listing_width' => '',
795
-        'show_featured_only' => '0',
796
-        'show_special_only' => '0',
797
-        'with_pics_only' => '0',
798
-        'with_videos_only' => '0',
799
-        'before_widget' => '',
800
-        'after_widget' => '',
801
-        'before_title' => '<h3 class="widget-title">',
802
-        'after_title' => '</h3>',
803
-        'title' => '',
804
-        'category_title' => '',
805
-    );
806
-
807
-    $params = shortcode_atts($defaults, $atts);
808
-
809
-    /**
810
-     * Validate our incoming params
811
-     */
784
+	ob_start();
785
+	$defaults = array(
786
+		'post_type' => 'gd_place',
787
+		'category' => '0',
788
+		'post_number' => '5',
789
+		'layout' => 'gridview_onehalf',
790
+		'add_location_filter' => '0',
791
+		'list_sort' => 'latest',
792
+		'use_viewing_post_type' => '1',
793
+		'character_count' => '20',
794
+		'listing_width' => '',
795
+		'show_featured_only' => '0',
796
+		'show_special_only' => '0',
797
+		'with_pics_only' => '0',
798
+		'with_videos_only' => '0',
799
+		'before_widget' => '',
800
+		'after_widget' => '',
801
+		'before_title' => '<h3 class="widget-title">',
802
+		'after_title' => '</h3>',
803
+		'title' => '',
804
+		'category_title' => '',
805
+	);
812 806
 
813
-    // Validate the selected post type, default to gd_place on fail
814
-    if (!(gdsc_is_post_type_valid($params['post_type']))) {
815
-        $params['post_type'] = 'gd_place';
816
-    }
817
-
818
-    // Validate the selected category/ies - Grab the current list based on post_type
819
-    $category_taxonomy = geodir_get_taxonomies($params['post_type']);
820
-    $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids'));
821
-
822
-    // Make sure we have an array
823
-    if (!(is_array($params['category']))) {
824
-        $params['category'] = explode(',', $params['category']);
825
-    }
826
-
827
-    // Array_intersect returns only the items in $params['category'] that are also in our category list
828
-    // Otherwise it becomes empty and later on that will mean "All"
829
-    $params['category'] = array_intersect($params['category'], $categories);
830
-
831
-    // Post_number needs to be a positive integer
832
-    $params['post_number'] = absint($params['post_number']);
833
-    if (0 == $params['post_number']) {
834
-        $params['post_number'] = 1;
835
-    }
836
-
837
-    // Validate our layout choice
838
-    // Outside of the norm, I added some more simple terms to match the existing
839
-    // So now I just run the switch to set it properly.
840
-    $params['layout'] = gdsc_validate_layout_choice($params['layout']);
841
-
842
-    // Validate our sorting choice
843
-    $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort'], $params['post_type']);
844
-
845
-    // Validate character_count
846
-    if ($params['character_count'] !== '') {
847
-        $params['character_count'] = absint($params['character_count']);
848
-    }
849
-
850
-    // Validate Listing width, used in the template widget-listing-listview.php
851
-    // The context is in width=$listing_width% - So we need a positive number between 0 & 100
852
-    $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']);
853
-
854
-    // Validate the checkboxes used on the widget
855
-    $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']);
856
-    $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']);
857
-    $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']);
858
-    $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']);
859
-    $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']);
860
-    $params['use_viewing_post_type'] = gdsc_to_bool_val($params['use_viewing_post_type']);
861
-
862
-    /**
863
-     * End of validation
864
-     */
807
+	$params = shortcode_atts($defaults, $atts);
808
+
809
+	/**
810
+	 * Validate our incoming params
811
+	 */
812
+
813
+	// Validate the selected post type, default to gd_place on fail
814
+	if (!(gdsc_is_post_type_valid($params['post_type']))) {
815
+		$params['post_type'] = 'gd_place';
816
+	}
817
+
818
+	// Validate the selected category/ies - Grab the current list based on post_type
819
+	$category_taxonomy = geodir_get_taxonomies($params['post_type']);
820
+	$categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids'));
821
+
822
+	// Make sure we have an array
823
+	if (!(is_array($params['category']))) {
824
+		$params['category'] = explode(',', $params['category']);
825
+	}
865 826
 
866
-    geodir_popular_postview_output($params, $params);
827
+	// Array_intersect returns only the items in $params['category'] that are also in our category list
828
+	// Otherwise it becomes empty and later on that will mean "All"
829
+	$params['category'] = array_intersect($params['category'], $categories);
867 830
 
831
+	// Post_number needs to be a positive integer
832
+	$params['post_number'] = absint($params['post_number']);
833
+	if (0 == $params['post_number']) {
834
+		$params['post_number'] = 1;
835
+	}
836
+
837
+	// Validate our layout choice
838
+	// Outside of the norm, I added some more simple terms to match the existing
839
+	// So now I just run the switch to set it properly.
840
+	$params['layout'] = gdsc_validate_layout_choice($params['layout']);
841
+
842
+	// Validate our sorting choice
843
+	$params['list_sort'] = gdsc_validate_sort_choice($params['list_sort'], $params['post_type']);
844
+
845
+	// Validate character_count
846
+	if ($params['character_count'] !== '') {
847
+		$params['character_count'] = absint($params['character_count']);
848
+	}
849
+
850
+	// Validate Listing width, used in the template widget-listing-listview.php
851
+	// The context is in width=$listing_width% - So we need a positive number between 0 & 100
852
+	$params['listing_width'] = gdsc_validate_listing_width($params['listing_width']);
868 853
 
869
-    $output = ob_get_contents();
854
+	// Validate the checkboxes used on the widget
855
+	$params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']);
856
+	$params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']);
857
+	$params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']);
858
+	$params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']);
859
+	$params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']);
860
+	$params['use_viewing_post_type'] = gdsc_to_bool_val($params['use_viewing_post_type']);
870 861
 
871
-    ob_end_clean();
862
+	/**
863
+	 * End of validation
864
+	 */
872 865
 
873
-    return $output;
866
+	geodir_popular_postview_output($params, $params);
867
+
868
+
869
+	$output = ob_get_contents();
870
+
871
+	ob_end_clean();
872
+
873
+	return $output;
874 874
 }
875 875
 
876 876
 add_shortcode('gd_recent_reviews', 'geodir_sc_recent_reviews');
@@ -892,37 +892,37 @@  discard block
 block discarded – undo
892 892
  * @return string Recent reviews HTML.
893 893
  */
894 894
 function geodir_sc_recent_reviews($atts) {
895
-    ob_start();
896
-    $defaults = array(
895
+	ob_start();
896
+	$defaults = array(
897 897
 		'title' => '',
898 898
 		'count' => 5,
899
-    );
899
+	);
900 900
 
901
-    $params = shortcode_atts($defaults, $atts);
901
+	$params = shortcode_atts($defaults, $atts);
902 902
 
903
-    $count = absint($params['count']);
904
-    if (0 == $count) {
905
-        $count = 1;
906
-    }
903
+	$count = absint($params['count']);
904
+	if (0 == $count) {
905
+		$count = 1;
906
+	}
907 907
 	
908 908
 	$title = !empty($params['title']) ? __($params['title'], 'geodirectory') : '';
909 909
 
910
-    $comments_li = geodir_get_recent_reviews(30, $count, 100, false);
910
+	$comments_li = geodir_get_recent_reviews(30, $count, 100, false);
911 911
 
912
-    if ($comments_li) {
913
-        if ($title != '') { ?>
912
+	if ($comments_li) {
913
+		if ($title != '') { ?>
914 914
 		<h3 class="geodir-sc-recent-reviews-title widget-title"><?php echo $title; ?></h3>
915 915
 		<?php } ?>
916 916
         <div class="geodir_sc_recent_reviews_section">
917 917
             <ul class="geodir_sc_recent_reviews"><?php echo $comments_li; ?></ul>
918 918
         </div>
919 919
     <?php
920
-    }
921
-    $output = ob_get_contents();
920
+	}
921
+	$output = ob_get_contents();
922 922
 
923
-    ob_end_clean();
923
+	ob_end_clean();
924 924
 
925
-    return $output;
925
+	return $output;
926 926
 }
927 927
 
928 928
 add_shortcode('gd_related_listings', 'geodir_sc_related_listings');
@@ -952,63 +952,63 @@  discard block
 block discarded – undo
952 952
  */
953 953
 function geodir_sc_related_listings($atts)
954 954
 {
955
-    ob_start();
956
-    $defaults = array(
957
-        'post_number' => 5,
958
-        'relate_to' => 'category',
959
-        'layout' => 'gridview_onehalf',
960
-        'add_location_filter' => 0,
961
-        'listing_width' => '',
962
-        'list_sort' => 'latest',
963
-        'character_count' => 20,
964
-        'is_widget' => 1,
965
-        'before_title' => '<style type="text/css">.geodir_category_list_view li{margin:0px!important}</style>',
966
-    );
967
-    // The "before_title" code is an ugly & terrible hack. But it works for now. I should enqueue a new stylesheet.
968
-
969
-    $params = shortcode_atts($defaults, $atts);
970
-
971
-    /**
972
-     * Begin validating parameters
973
-     */
955
+	ob_start();
956
+	$defaults = array(
957
+		'post_number' => 5,
958
+		'relate_to' => 'category',
959
+		'layout' => 'gridview_onehalf',
960
+		'add_location_filter' => 0,
961
+		'listing_width' => '',
962
+		'list_sort' => 'latest',
963
+		'character_count' => 20,
964
+		'is_widget' => 1,
965
+		'before_title' => '<style type="text/css">.geodir_category_list_view li{margin:0px!important}</style>',
966
+	);
967
+	// The "before_title" code is an ugly & terrible hack. But it works for now. I should enqueue a new stylesheet.
974 968
 
975
-    // Validate that post_number is a number and is 1 or higher
976
-    $params['post_number'] = absint($params['post_number']);
977
-    if (0 === $params['post_number']) {
978
-        $params['post_number'] = 1;
979
-    }
969
+	$params = shortcode_atts($defaults, $atts);
980 970
 
981
-    // Validate relate_to - only category or tags
982
-    $params['relate_to'] = geodir_strtolower($params['relate_to']);
983
-    if ('category' != $params['relate_to'] && 'tags' != $params['relate_to']) {
984
-        $params['relate_to'] = 'category';
985
-    }
971
+	/**
972
+	 * Begin validating parameters
973
+	 */
986 974
 
987
-    // Validate layout selection
988
-    $params['layout'] = gdsc_validate_layout_choice($params['layout']);
975
+	// Validate that post_number is a number and is 1 or higher
976
+	$params['post_number'] = absint($params['post_number']);
977
+	if (0 === $params['post_number']) {
978
+		$params['post_number'] = 1;
979
+	}
989 980
 
990
-    // Validate sorting option
991
-    $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']);
981
+	// Validate relate_to - only category or tags
982
+	$params['relate_to'] = geodir_strtolower($params['relate_to']);
983
+	if ('category' != $params['relate_to'] && 'tags' != $params['relate_to']) {
984
+		$params['relate_to'] = 'category';
985
+	}
986
+
987
+	// Validate layout selection
988
+	$params['layout'] = gdsc_validate_layout_choice($params['layout']);
992 989
 
993
-    // Validate add_location_filter
994
-    $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']);
990
+	// Validate sorting option
991
+	$params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']);
995 992
 
996
-    // Validate listing_width
997
-    $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']);
993
+	// Validate add_location_filter
994
+	$params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']);
998 995
 
999
-    // Validate character_count
1000
-    if ($params['character_count'] !== '') {
1001
-        $params['character_count'] = absint($params['character_count']);
1002
-    }
996
+	// Validate listing_width
997
+	$params['listing_width'] = gdsc_validate_listing_width($params['listing_width']);
1003 998
 
1004
-    if ($related_display = geodir_related_posts_display($params)) {
1005
-        echo $related_display;
1006
-    }
1007
-    $output = ob_get_contents();
999
+	// Validate character_count
1000
+	if ($params['character_count'] !== '') {
1001
+		$params['character_count'] = absint($params['character_count']);
1002
+	}
1003
+
1004
+	if ($related_display = geodir_related_posts_display($params)) {
1005
+		echo $related_display;
1006
+	}
1007
+	$output = ob_get_contents();
1008 1008
 
1009
-    ob_end_clean();
1009
+	ob_end_clean();
1010 1010
 
1011
-    return $output;
1011
+	return $output;
1012 1012
 }
1013 1013
 
1014 1014
 /**
@@ -1032,13 +1032,13 @@  discard block
 block discarded – undo
1032 1032
  * @return string Advanced search widget HTML.
1033 1033
  */
1034 1034
 function geodir_sc_advanced_search($atts) {
1035
-    $defaults = array(
1035
+	$defaults = array(
1036 1036
 		'title' => '',
1037 1037
 		'before_widget' => '<section id="geodir_advanced_search-1" class="widget geodir-widget geodir_advance_search_widget">',
1038
-        'after_widget' => '</section>',
1039
-        'before_title' => '<h3 class="widget-title">',
1040
-        'after_title' => '</h3>',
1041
-        'show_adv_search' => 'default',
1038
+		'after_widget' => '</section>',
1039
+		'before_title' => '<h3 class="widget-title">',
1040
+		'after_title' => '</h3>',
1041
+		'show_adv_search' => 'default',
1042 1042
 		'post_type' => ''
1043 1043
 	);
1044 1044
 	
@@ -1062,9 +1062,9 @@  discard block
 block discarded – undo
1062 1062
 	the_widget('geodir_advance_search_widget', $params, $params );
1063 1063
 	
1064 1064
 	$output = ob_get_contents();
1065
-    ob_end_clean();
1065
+	ob_end_clean();
1066 1066
 
1067
-    return $output;
1067
+	return $output;
1068 1068
 }
1069 1069
 add_shortcode('gd_advanced_search', 'geodir_sc_advanced_search');
1070 1070
 
@@ -1110,48 +1110,48 @@  discard block
 block discarded – undo
1110 1110
 		'add_location_filter' => '1',
1111 1111
 		'tab_layout' => 'bestof-tabs-on-top',
1112 1112
 		'before_widget' => '<section id="bestof_widget-1" class="widget geodir-widget geodir_bestof_widget geodir_sc_bestof_widget">',
1113
-        'after_widget' => '</section>',
1114
-        'before_title' => '<h3 class="widget-title">',
1115
-        'after_title' => '</h3>',
1113
+		'after_widget' => '</section>',
1114
+		'before_title' => '<h3 class="widget-title">',
1115
+		'after_title' => '</h3>',
1116 1116
 	);
1117 1117
 	$params = shortcode_atts($defaults, $atts);
1118 1118
 
1119
-    /**
1120
-     * Validate our incoming params
1121
-     */
1119
+	/**
1120
+	 * Validate our incoming params
1121
+	 */
1122 1122
 
1123
-    // Validate the selected post type, default to gd_place on fail
1124
-    if (!(gdsc_is_post_type_valid($params['post_type']))) {
1125
-        $params['post_type'] = 'gd_place';
1126
-    }
1123
+	// Validate the selected post type, default to gd_place on fail
1124
+	if (!(gdsc_is_post_type_valid($params['post_type']))) {
1125
+		$params['post_type'] = 'gd_place';
1126
+	}
1127 1127
 	
1128 1128
 	// Post limit needs to be a positive integer
1129
-    $params['post_limit'] = absint($params['post_limit']);
1130
-    if (0 == $params['post_limit']) {
1131
-        $params['post_limit'] = 5;
1132
-    }
1129
+	$params['post_limit'] = absint($params['post_limit']);
1130
+	if (0 == $params['post_limit']) {
1131
+		$params['post_limit'] = 5;
1132
+	}
1133 1133
 	
1134 1134
 	// Category limit needs to be a positive integer
1135
-    $params['categ_limit'] = absint($params['categ_limit']);
1136
-    if (0 == $params['categ_limit']) {
1137
-        $params['categ_limit'] = 3;
1138
-    }
1135
+	$params['categ_limit'] = absint($params['categ_limit']);
1136
+	if (0 == $params['categ_limit']) {
1137
+		$params['categ_limit'] = 3;
1138
+	}
1139 1139
 	
1140 1140
 	// Tab layout validation
1141
-    $params['tab_layout'] = $params['tab_layout'];
1142
-    if (!in_array($params['tab_layout'], array('bestof-tabs-on-top', 'bestof-tabs-on-left', 'bestof-tabs-as-dropdown'))) {
1143
-        $params['tab_layout'] = 'bestof-tabs-on-top';
1144
-    }
1141
+	$params['tab_layout'] = $params['tab_layout'];
1142
+	if (!in_array($params['tab_layout'], array('bestof-tabs-on-top', 'bestof-tabs-on-left', 'bestof-tabs-as-dropdown'))) {
1143
+		$params['tab_layout'] = 'bestof-tabs-on-top';
1144
+	}
1145 1145
 	
1146 1146
 	// Validate character_count
1147
-    $params['character_count'] = $params['character_count'];
1147
+	$params['character_count'] = $params['character_count'];
1148 1148
 
1149 1149
 	ob_start();
1150 1150
 	the_widget('geodir_bestof_widget', $params, $params);
1151
-    $output = ob_get_contents();
1152
-    ob_end_clean();
1151
+	$output = ob_get_contents();
1152
+	ob_end_clean();
1153 1153
 
1154
-    return $output;
1154
+	return $output;
1155 1155
 }
1156 1156
 add_shortcode('gd_bestof_widget', 'geodir_sc_bestof_widget');
1157 1157
 
@@ -1204,143 +1204,143 @@  discard block
 block discarded – undo
1204 1204
  * @return string HTML content to display geodirectory listings.
1205 1205
  */
1206 1206
 function geodir_sc_gd_listings($atts, $content = '') {
1207
-    global $post;
1208
-    $defaults = array(
1209
-        'title'                 => '',
1210
-        'post_type'             => 'gd_place',
1211
-        'category'              => 0,
1212
-        'list_sort'             => 'latest',
1213
-        'event_type'            => '',
1214
-        'post_number'           => 10,
1215
-        'post_author'           => '',
1216
-        'layout'                => 'gridview_onehalf',
1217
-        'listing_width'         => '',
1218
-        'character_count'       => 20,
1219
-        'add_location_filter'   => 1,
1220
-        'show_featured_only'    => '',
1221
-        'show_special_only'     => '',
1222
-        'with_pics_only'        => '',
1223
-        'with_videos_only'      => '',
1224
-        'with_pagination'       => '1',
1225
-        'top_pagination'        => '0',
1226
-        'bottom_pagination'     => '1',
1227
-        'without_no_results'    => 0,
1228
-        'tags'                  => '',
1229
-        'show_favorites_only'   => '',
1230
-        'favorites_by_user'     => '',
1231
-    );
1232
-    $params = shortcode_atts($defaults, $atts);
1233
-
1234
-    $params['title']        = wp_strip_all_tags($params['title']);
1235
-    $params['post_type']    = gdsc_is_post_type_valid($params['post_type']) ? $params['post_type'] : 'gd_place';
1236
-
1237
-    // Validate the selected category/ies - Grab the current list based on post_type
1238
-    $category_taxonomy      = geodir_get_taxonomies($params['post_type']);
1239
-    $categories             = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids', 'hide_empty' => 0));
1240
-
1241
-    // Make sure we have an array
1242
-    if (!(is_array($params['category']))) {
1243
-        $params['category'] = explode(',', $params['category']);
1244
-    }
1245
-
1246
-    // Array_intersect returns only the items in $params['category'] that are also in our category list
1247
-    // Otherwise it becomes empty and later on that will mean "All"
1248
-    $params['category']     = array_intersect($params['category'], $categories);
1249
-
1250
-    // Post_number needs to be a positive integer
1251
-    $params['post_number']  = absint($params['post_number']);
1252
-    $params['post_number']  = $params['post_number'] > 0 ? $params['post_number'] : 10;
1207
+	global $post;
1208
+	$defaults = array(
1209
+		'title'                 => '',
1210
+		'post_type'             => 'gd_place',
1211
+		'category'              => 0,
1212
+		'list_sort'             => 'latest',
1213
+		'event_type'            => '',
1214
+		'post_number'           => 10,
1215
+		'post_author'           => '',
1216
+		'layout'                => 'gridview_onehalf',
1217
+		'listing_width'         => '',
1218
+		'character_count'       => 20,
1219
+		'add_location_filter'   => 1,
1220
+		'show_featured_only'    => '',
1221
+		'show_special_only'     => '',
1222
+		'with_pics_only'        => '',
1223
+		'with_videos_only'      => '',
1224
+		'with_pagination'       => '1',
1225
+		'top_pagination'        => '0',
1226
+		'bottom_pagination'     => '1',
1227
+		'without_no_results'    => 0,
1228
+		'tags'                  => '',
1229
+		'show_favorites_only'   => '',
1230
+		'favorites_by_user'     => '',
1231
+	);
1232
+	$params = shortcode_atts($defaults, $atts);
1233
+
1234
+	$params['title']        = wp_strip_all_tags($params['title']);
1235
+	$params['post_type']    = gdsc_is_post_type_valid($params['post_type']) ? $params['post_type'] : 'gd_place';
1236
+
1237
+	// Validate the selected category/ies - Grab the current list based on post_type
1238
+	$category_taxonomy      = geodir_get_taxonomies($params['post_type']);
1239
+	$categories             = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids', 'hide_empty' => 0));
1240
+
1241
+	// Make sure we have an array
1242
+	if (!(is_array($params['category']))) {
1243
+		$params['category'] = explode(',', $params['category']);
1244
+	}
1245
+
1246
+	// Array_intersect returns only the items in $params['category'] that are also in our category list
1247
+	// Otherwise it becomes empty and later on that will mean "All"
1248
+	$params['category']     = array_intersect($params['category'], $categories);
1249
+
1250
+	// Post_number needs to be a positive integer
1251
+	$params['post_number']  = absint($params['post_number']);
1252
+	$params['post_number']  = $params['post_number'] > 0 ? $params['post_number'] : 10;
1253 1253
     
1254
-    // Post_number needs to be a positive integer
1255
-    if (!empty($atts['post_author'])) {
1256
-        if ($atts['post_author'] == 'current' && !empty($post) && isset($post->post_author) && $post->post_type != 'page') {
1257
-            $params['post_author'] = $post->post_author;
1258
-        } else if ($atts['post_author'] != 'current' && absint($atts['post_author']) > 0) {
1259
-            $params['post_author'] = absint($atts['post_author']);
1260
-        } else {
1261
-            unset($params['post_author']);
1262
-        }
1263
-    } else {
1264
-        unset($params['post_author']);
1265
-    }
1266
-
1267
-    // Validate character_count
1268
-    //todo: is this necessary?
1269
-    $params['character_count']  = $params['character_count'];
1270
-
1271
-    // Validate our layout choice
1272
-    // Outside of the norm, I added some more simple terms to match the existing
1273
-    // So now I just run the switch to set it properly.
1274
-    $params['layout']           = gdsc_validate_layout_choice($params['layout']);
1275
-
1276
-    // Validate our sorting choice
1277
-    $params['list_sort']        = gdsc_validate_sort_choice($params['list_sort'], $params['post_type']);
1278
-
1279
-    // Validate Listing width, used in the template widget-listing-listview.php
1280
-    // The context is in width=$listing_width% - So we need a positive number between 0 & 100
1281
-    $params['listing_width']    = gdsc_validate_listing_width($params['listing_width']);
1282
-
1283
-    // Validate the checkboxes used on the widget
1284
-    $params['add_location_filter']  = gdsc_to_bool_val($params['add_location_filter']);
1285
-    $params['show_featured_only']   = gdsc_to_bool_val($params['show_featured_only']);
1286
-    $params['show_special_only']    = gdsc_to_bool_val($params['show_special_only']);
1287
-    $params['with_pics_only']       = gdsc_to_bool_val($params['with_pics_only']);
1288
-    $params['with_videos_only']     = gdsc_to_bool_val($params['with_videos_only']);
1289
-    $params['with_pagination']      = gdsc_to_bool_val($params['with_pagination']);
1290
-    $params['top_pagination']       = gdsc_to_bool_val($params['top_pagination']);
1291
-    $params['bottom_pagination']    = gdsc_to_bool_val($params['bottom_pagination']);
1254
+	// Post_number needs to be a positive integer
1255
+	if (!empty($atts['post_author'])) {
1256
+		if ($atts['post_author'] == 'current' && !empty($post) && isset($post->post_author) && $post->post_type != 'page') {
1257
+			$params['post_author'] = $post->post_author;
1258
+		} else if ($atts['post_author'] != 'current' && absint($atts['post_author']) > 0) {
1259
+			$params['post_author'] = absint($atts['post_author']);
1260
+		} else {
1261
+			unset($params['post_author']);
1262
+		}
1263
+	} else {
1264
+		unset($params['post_author']);
1265
+	}
1266
+
1267
+	// Validate character_count
1268
+	//todo: is this necessary?
1269
+	$params['character_count']  = $params['character_count'];
1270
+
1271
+	// Validate our layout choice
1272
+	// Outside of the norm, I added some more simple terms to match the existing
1273
+	// So now I just run the switch to set it properly.
1274
+	$params['layout']           = gdsc_validate_layout_choice($params['layout']);
1275
+
1276
+	// Validate our sorting choice
1277
+	$params['list_sort']        = gdsc_validate_sort_choice($params['list_sort'], $params['post_type']);
1278
+
1279
+	// Validate Listing width, used in the template widget-listing-listview.php
1280
+	// The context is in width=$listing_width% - So we need a positive number between 0 & 100
1281
+	$params['listing_width']    = gdsc_validate_listing_width($params['listing_width']);
1282
+
1283
+	// Validate the checkboxes used on the widget
1284
+	$params['add_location_filter']  = gdsc_to_bool_val($params['add_location_filter']);
1285
+	$params['show_featured_only']   = gdsc_to_bool_val($params['show_featured_only']);
1286
+	$params['show_special_only']    = gdsc_to_bool_val($params['show_special_only']);
1287
+	$params['with_pics_only']       = gdsc_to_bool_val($params['with_pics_only']);
1288
+	$params['with_videos_only']     = gdsc_to_bool_val($params['with_videos_only']);
1289
+	$params['with_pagination']      = gdsc_to_bool_val($params['with_pagination']);
1290
+	$params['top_pagination']       = gdsc_to_bool_val($params['top_pagination']);
1291
+	$params['bottom_pagination']    = gdsc_to_bool_val($params['bottom_pagination']);
1292 1292
     
1293
-    // User favorites
1294
-    $params['show_favorites_only']  = gdsc_to_bool_val($params['show_favorites_only']);
1295
-    if (!empty($params['show_favorites_only'])) {
1296
-        if ($params['favorites_by_user'] == 'current' && !empty($post) && isset($post->post_author) && $post->post_type != 'page') {
1297
-            $params['favorites_by_user'] = $post->post_author;
1298
-        } else if ($params['favorites_by_user'] != 'current' && absint($params['favorites_by_user']) > 0) {
1299
-            $params['favorites_by_user'] = absint($atts['favorites_by_user']);
1300
-        } else if ($params['favorites_by_user'] != 'current' && $current_user_id = get_current_user_id()) {
1301
-            $params['favorites_by_user'] = $current_user_id;
1302
-        } else {
1303
-            $params['favorites_by_user'] = 0;
1304
-        }
1305
-    }
1306
-
1307
-    // Clean tags
1308
-    if (!empty($params['tags'])) {
1309
-        if (!is_array($params['tags'])) {
1310
-            $comma = _x(',', 'tag delimiter');
1311
-            if ( ',' !== $comma ) {
1312
-                $params['tags'] = str_replace($comma, ',', $params['tags']);
1313
-            }
1314
-            $params['tags'] = explode(',', trim($params['tags'], " \n\t\r\0\x0B,"));
1315
-            $params['tags'] = array_map('trim', $params['tags']);
1316
-        }
1317
-    } else {
1318
-        $params['tags'] = array();
1319
-    }
1320
-
1321
-    /**
1322
-     * End of validation
1323
-     */
1324
-    if (isset($atts['geodir_ajax'])) {
1325
-        $params['geodir_ajax'] = $atts['geodir_ajax'];
1326
-        unset($atts['geodir_ajax']);
1327
-    }
1328
-    if (isset($atts['pageno'])) {
1329
-        $params['pageno'] = $atts['pageno'];
1330
-        unset($atts['pageno']);
1331
-    }
1332
-
1333
-    if ( !empty($atts['shortcode_content']) ) {
1334
-        $content = $atts['shortcode_content'];
1335
-    }
1336
-    $params['shortcode_content'] = trim($content);
1337
-    $atts['shortcode_content'] = trim($content);
1293
+	// User favorites
1294
+	$params['show_favorites_only']  = gdsc_to_bool_val($params['show_favorites_only']);
1295
+	if (!empty($params['show_favorites_only'])) {
1296
+		if ($params['favorites_by_user'] == 'current' && !empty($post) && isset($post->post_author) && $post->post_type != 'page') {
1297
+			$params['favorites_by_user'] = $post->post_author;
1298
+		} else if ($params['favorites_by_user'] != 'current' && absint($params['favorites_by_user']) > 0) {
1299
+			$params['favorites_by_user'] = absint($atts['favorites_by_user']);
1300
+		} else if ($params['favorites_by_user'] != 'current' && $current_user_id = get_current_user_id()) {
1301
+			$params['favorites_by_user'] = $current_user_id;
1302
+		} else {
1303
+			$params['favorites_by_user'] = 0;
1304
+		}
1305
+	}
1306
+
1307
+	// Clean tags
1308
+	if (!empty($params['tags'])) {
1309
+		if (!is_array($params['tags'])) {
1310
+			$comma = _x(',', 'tag delimiter');
1311
+			if ( ',' !== $comma ) {
1312
+				$params['tags'] = str_replace($comma, ',', $params['tags']);
1313
+			}
1314
+			$params['tags'] = explode(',', trim($params['tags'], " \n\t\r\0\x0B,"));
1315
+			$params['tags'] = array_map('trim', $params['tags']);
1316
+		}
1317
+	} else {
1318
+		$params['tags'] = array();
1319
+	}
1320
+
1321
+	/**
1322
+	 * End of validation
1323
+	 */
1324
+	if (isset($atts['geodir_ajax'])) {
1325
+		$params['geodir_ajax'] = $atts['geodir_ajax'];
1326
+		unset($atts['geodir_ajax']);
1327
+	}
1328
+	if (isset($atts['pageno'])) {
1329
+		$params['pageno'] = $atts['pageno'];
1330
+		unset($atts['pageno']);
1331
+	}
1332
+
1333
+	if ( !empty($atts['shortcode_content']) ) {
1334
+		$content = $atts['shortcode_content'];
1335
+	}
1336
+	$params['shortcode_content'] = trim($content);
1337
+	$atts['shortcode_content'] = trim($content);
1338 1338
     
1339
-    $params['shortcode_atts']       = $atts;
1339
+	$params['shortcode_atts']       = $atts;
1340 1340
 
1341
-    $output = geodir_sc_gd_listings_output($params);
1341
+	$output = geodir_sc_gd_listings_output($params);
1342 1342
 
1343
-    return $output;
1343
+	return $output;
1344 1344
 }
1345 1345
 add_shortcode('gd_listings', 'geodir_sc_gd_listings');
1346 1346
 
@@ -1380,56 +1380,56 @@  discard block
 block discarded – undo
1380 1380
  * @return string HTML content to display CPT categories.
1381 1381
  */
1382 1382
 function geodir_sc_cpt_categories_widget($atts, $content = '') {
1383
-    $defaults = array(
1384
-        'title' => '',
1385
-        'post_type' => '', // NULL for all
1386
-        'hide_empty' => '',
1387
-        'show_count' => '',
1388
-        'hide_icon' => '',
1389
-        'cpt_left' => '',
1390
-        'sort_by' => 'count',
1391
-        'max_count' => 'all',
1392
-        'max_level' => '1',
1393
-        'no_cpt_filter' => '',
1394
-        'no_cat_filter' => '',
1395
-        'before_widget' => '<section id="geodir_cpt_categories_widget-1" class="widget geodir-widget geodir_cpt_categories_widget geodir_sc_cpt_categories_widget">',
1396
-        'after_widget' => '</section>',
1397
-        'before_title' => '<h3 class="widget-title">',
1398
-        'after_title' => '</h3>',
1399
-    );
1400
-    $params = shortcode_atts($defaults, $atts);
1401
-
1402
-    /**
1403
-     * Validate our incoming params
1404
-     */
1405
-    // Make sure we have an array
1406
-    $params['post_type'] = !is_array($params['post_type']) && trim($params['post_type']) != '' ? explode(',', trim($params['post_type'])) : array();
1407
-     
1408
-    // Validate the checkboxes used on the widget
1409
-    $params['hide_empty'] 	= gdsc_to_bool_val($params['hide_empty']);
1410
-    $params['show_count'] 	= gdsc_to_bool_val($params['show_count']);
1411
-    $params['hide_icon'] 	= gdsc_to_bool_val($params['hide_icon']);
1412
-    $params['cpt_left'] 	= gdsc_to_bool_val($params['cpt_left']);
1383
+	$defaults = array(
1384
+		'title' => '',
1385
+		'post_type' => '', // NULL for all
1386
+		'hide_empty' => '',
1387
+		'show_count' => '',
1388
+		'hide_icon' => '',
1389
+		'cpt_left' => '',
1390
+		'sort_by' => 'count',
1391
+		'max_count' => 'all',
1392
+		'max_level' => '1',
1393
+		'no_cpt_filter' => '',
1394
+		'no_cat_filter' => '',
1395
+		'before_widget' => '<section id="geodir_cpt_categories_widget-1" class="widget geodir-widget geodir_cpt_categories_widget geodir_sc_cpt_categories_widget">',
1396
+		'after_widget' => '</section>',
1397
+		'before_title' => '<h3 class="widget-title">',
1398
+		'after_title' => '</h3>',
1399
+	);
1400
+	$params = shortcode_atts($defaults, $atts);
1413 1401
 
1414
-    if ($params['max_count'] != 'all') {
1415
-        $params['max_count'] = absint($params['max_count']);
1416
-    }
1402
+	/**
1403
+	 * Validate our incoming params
1404
+	 */
1405
+	// Make sure we have an array
1406
+	$params['post_type'] = !is_array($params['post_type']) && trim($params['post_type']) != '' ? explode(',', trim($params['post_type'])) : array();
1407
+     
1408
+	// Validate the checkboxes used on the widget
1409
+	$params['hide_empty'] 	= gdsc_to_bool_val($params['hide_empty']);
1410
+	$params['show_count'] 	= gdsc_to_bool_val($params['show_count']);
1411
+	$params['hide_icon'] 	= gdsc_to_bool_val($params['hide_icon']);
1412
+	$params['cpt_left'] 	= gdsc_to_bool_val($params['cpt_left']);
1413
+
1414
+	if ($params['max_count'] != 'all') {
1415
+		$params['max_count'] = absint($params['max_count']);
1416
+	}
1417 1417
 
1418
-    if ($params['max_level'] != 'all') {
1419
-        $params['max_level'] = absint($params['max_level']);
1420
-    }
1418
+	if ($params['max_level'] != 'all') {
1419
+		$params['max_level'] = absint($params['max_level']);
1420
+	}
1421 1421
 
1422
-    $params['no_cpt_filter'] = gdsc_to_bool_val($params['no_cpt_filter']);
1423
-    $params['no_cat_filter'] = gdsc_to_bool_val($params['no_cat_filter']);
1422
+	$params['no_cpt_filter'] = gdsc_to_bool_val($params['no_cpt_filter']);
1423
+	$params['no_cat_filter'] = gdsc_to_bool_val($params['no_cat_filter']);
1424 1424
 
1425
-    $params['sort_by'] = $params['sort_by'] == 'az' ? 'az' : 'count';
1425
+	$params['sort_by'] = $params['sort_by'] == 'az' ? 'az' : 'count';
1426 1426
 
1427
-    ob_start();
1428
-    the_widget('geodir_cpt_categories_widget', $params, $params);
1429
-    $output = ob_get_contents();
1430
-    ob_end_clean();
1427
+	ob_start();
1428
+	the_widget('geodir_cpt_categories_widget', $params, $params);
1429
+	$output = ob_get_contents();
1430
+	ob_end_clean();
1431 1431
 
1432
-    return $output;
1432
+	return $output;
1433 1433
 }
1434 1434
 add_shortcode('gd_cpt_categories', 'geodir_sc_cpt_categories_widget');
1435 1435
 
@@ -1444,6 +1444,6 @@  discard block
 block discarded – undo
1444 1444
  * @return string HTML code.
1445 1445
  */
1446 1446
 function geodir_sc_responsive_videos($atts, $content) {
1447
-    return '<div class="geodir-video-wrapper">'.$content.'</div>';
1447
+	return '<div class="geodir-video-wrapper">'.$content.'</div>';
1448 1448
 }
1449 1449
 add_shortcode('gd_video', 'geodir_sc_responsive_videos');
1450 1450
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-admin/option-pages/general_settings_array.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@
 block discarded – undo
98 98
     ),
99 99
     array('type' => 'sectionend', 'id' => 'general_options'),
100 100
 
101
-));/* General Options End*/
101
+)); /* General Options End*/
102 102
 
103 103
 /**
104 104
  * Filter GD Google Analytic Settings array.
Please login to merge, or discard this patch.
Indentation   +273 added lines, -273 removed lines patch added patch discarded remove patch
@@ -16,92 +16,92 @@  discard block
 block discarded – undo
16 16
  */
17 17
 $general_options = apply_filters('geodir_general_options', array(
18 18
 
19
-    array('name' => __('General', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'general_options'),
20
-
21
-    array('name' => __('General Options', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'general_options'),
22
-
23
-    array(
24
-        'name' => __('Sender name', 'geodirectory'),
25
-        'desc' => __('(Name that will be shown as email sender when users receive emails from this site)', 'geodirectory'),
26
-        'id' => 'site_email_name',
27
-        'type' => 'text',
28
-        'css' => 'min-width:300px;',
29
-        'std' => get_bloginfo('name') // Default value for the page title - changed in settings
30
-    ),
31
-
32
-    array(
33
-        'name' => __('Email address', 'geodirectory'),
34
-        'desc' => __('(Emails to users will be sent via this mail ID)', 'geodirectory'),
35
-        'id' => 'site_email',
36
-        'type' => 'text',
37
-        'css' => 'min-width:300px;',
38
-        'std' => get_bloginfo('admin_email') // Default value for the page title - changed in settings
39
-    ),
40
-    array(
41
-        'name' => __('Allow user to see wp-admin area', 'geodirectory'),
42
-        'desc' => __('Yes', 'geodirectory'),
43
-        'id' => 'geodir_allow_wpadmin',
44
-        'std' => '1',
45
-        'type' => 'radio',
46
-        'value' => '1',
47
-        'radiogroup' => 'start'
48
-    ),
49
-    array(
50
-        'name' => __('Allow user to see wp-admin area', 'geodirectory'),
51
-        'desc' => __('No', 'geodirectory'),
52
-        'id' => 'geodir_allow_wpadmin',
53
-        'std' => '0',
54
-        'type' => 'radio',
55
-        'value' => '0',
56
-        'radiogroup' => 'end'
57
-    ),
58
-
59
-    array(
60
-        'name' => __('Allow user to choose own password', 'geodirectory'),
61
-        'desc' => __('Yes', 'geodirectory'),
62
-        'id' => 'geodir_allow_cpass',
63
-        'std' => '1',
64
-        'type' => 'radio',
65
-        'value' => '1',
66
-        'radiogroup' => 'start'
67
-    ),
68
-    array(
69
-        'name' => __('Allow user to choose own password', 'geodirectory'),
70
-        'desc' => __('No', 'geodirectory'),
71
-        'id' => 'geodir_allow_cpass',
72
-        'std' => '0',
73
-        'type' => 'radio',
74
-        'value' => '0',
75
-        'radiogroup' => 'end'
76
-    ),
77
-    array(
78
-        'name' => __('Disable review stars for CPT', 'geodirectory'),
79
-        'desc' => __('Disable review stars for certain CPT without disabling comments on listings.', 'geodirectory'),
80
-        'tip' => '',
81
-        'id' => 'geodir_disable_rating_cpt',
82
-        'css' => 'min-width:300px;',
83
-        'std' => '',
84
-        'type' => 'multiselect',
85
-        'placeholder_text' => __('Select post types', 'geodirectory'),
86
-        'class' => 'chosen_select',
87
-        'options' => array_unique(geodir_post_type_setting_fun())
88
-    ),
89
-    array(
90
-        'name' => __('User deleted posts go to trash', 'geodirectory'),
91
-        'desc' => __('If checked a user deleted post will go to trash, otherwise it will be permanently deleted', 'geodirectory'),
92
-        'id' => 'geodir_disable_perm_delete',
93
-        'type' => 'checkbox',
94
-        'std' => '1'
95
-    ),
96
-    array(
97
-        'name' => __('Max upload file size(in mb)', 'geodirectory'),
98
-        'desc' => __('(Maximum upload file size in MB, 1 MB = 1024 KB. Must be greater then 0(ZERO), for ex: 2. This setting will overwrite the max upload file size limit in image/file upload & import listings for entire GeoDirectory core + GeoDirectory plugins.)', 'geodirectory'),
99
-        'id' => 'geodir_upload_max_filesize',
100
-        'type' => 'text',
101
-        'css' => 'min-width:300px;',
102
-        'std' => '2'
103
-    ),
104
-    array('type' => 'sectionend', 'id' => 'general_options'),
19
+	array('name' => __('General', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'general_options'),
20
+
21
+	array('name' => __('General Options', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'general_options'),
22
+
23
+	array(
24
+		'name' => __('Sender name', 'geodirectory'),
25
+		'desc' => __('(Name that will be shown as email sender when users receive emails from this site)', 'geodirectory'),
26
+		'id' => 'site_email_name',
27
+		'type' => 'text',
28
+		'css' => 'min-width:300px;',
29
+		'std' => get_bloginfo('name') // Default value for the page title - changed in settings
30
+	),
31
+
32
+	array(
33
+		'name' => __('Email address', 'geodirectory'),
34
+		'desc' => __('(Emails to users will be sent via this mail ID)', 'geodirectory'),
35
+		'id' => 'site_email',
36
+		'type' => 'text',
37
+		'css' => 'min-width:300px;',
38
+		'std' => get_bloginfo('admin_email') // Default value for the page title - changed in settings
39
+	),
40
+	array(
41
+		'name' => __('Allow user to see wp-admin area', 'geodirectory'),
42
+		'desc' => __('Yes', 'geodirectory'),
43
+		'id' => 'geodir_allow_wpadmin',
44
+		'std' => '1',
45
+		'type' => 'radio',
46
+		'value' => '1',
47
+		'radiogroup' => 'start'
48
+	),
49
+	array(
50
+		'name' => __('Allow user to see wp-admin area', 'geodirectory'),
51
+		'desc' => __('No', 'geodirectory'),
52
+		'id' => 'geodir_allow_wpadmin',
53
+		'std' => '0',
54
+		'type' => 'radio',
55
+		'value' => '0',
56
+		'radiogroup' => 'end'
57
+	),
58
+
59
+	array(
60
+		'name' => __('Allow user to choose own password', 'geodirectory'),
61
+		'desc' => __('Yes', 'geodirectory'),
62
+		'id' => 'geodir_allow_cpass',
63
+		'std' => '1',
64
+		'type' => 'radio',
65
+		'value' => '1',
66
+		'radiogroup' => 'start'
67
+	),
68
+	array(
69
+		'name' => __('Allow user to choose own password', 'geodirectory'),
70
+		'desc' => __('No', 'geodirectory'),
71
+		'id' => 'geodir_allow_cpass',
72
+		'std' => '0',
73
+		'type' => 'radio',
74
+		'value' => '0',
75
+		'radiogroup' => 'end'
76
+	),
77
+	array(
78
+		'name' => __('Disable review stars for CPT', 'geodirectory'),
79
+		'desc' => __('Disable review stars for certain CPT without disabling comments on listings.', 'geodirectory'),
80
+		'tip' => '',
81
+		'id' => 'geodir_disable_rating_cpt',
82
+		'css' => 'min-width:300px;',
83
+		'std' => '',
84
+		'type' => 'multiselect',
85
+		'placeholder_text' => __('Select post types', 'geodirectory'),
86
+		'class' => 'chosen_select',
87
+		'options' => array_unique(geodir_post_type_setting_fun())
88
+	),
89
+	array(
90
+		'name' => __('User deleted posts go to trash', 'geodirectory'),
91
+		'desc' => __('If checked a user deleted post will go to trash, otherwise it will be permanently deleted', 'geodirectory'),
92
+		'id' => 'geodir_disable_perm_delete',
93
+		'type' => 'checkbox',
94
+		'std' => '1'
95
+	),
96
+	array(
97
+		'name' => __('Max upload file size(in mb)', 'geodirectory'),
98
+		'desc' => __('(Maximum upload file size in MB, 1 MB = 1024 KB. Must be greater then 0(ZERO), for ex: 2. This setting will overwrite the max upload file size limit in image/file upload & import listings for entire GeoDirectory core + GeoDirectory plugins.)', 'geodirectory'),
99
+		'id' => 'geodir_upload_max_filesize',
100
+		'type' => 'text',
101
+		'css' => 'min-width:300px;',
102
+		'std' => '2'
103
+	),
104
+	array('type' => 'sectionend', 'id' => 'general_options'),
105 105
 
106 106
 ));/* General Options End*/
107 107
 
@@ -113,104 +113,104 @@  discard block
 block discarded – undo
113 113
  */
114 114
 $google_analytic_settings = apply_filters('geodir_google_analytic_settings', array(
115 115
 
116
-    array('name' => __('Google Analytics', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'google_analytic_settings'),
117
-
118
-    array('name' => __('Google Analytic Settings', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'google_analytic_settings'),
119
-
120
-
121
-
122
-    array(
123
-        'name' => __('Show business owner google analytics stats?', 'geodirectory'),
124
-        'desc' => __('Yes', 'geodirectory'),
125
-        'id' => 'geodir_ga_stats',
126
-        'std' => '0',
127
-        'type' => 'radio',
128
-        'value' => '1',
129
-        'radiogroup' => 'start'
130
-    ),
131
-    array(
132
-        'name' => __('Show business owner Google Analytics stats?', 'geodirectory'),
133
-        'desc' => __('No', 'geodirectory'),
134
-        'id' => 'geodir_ga_stats',
135
-        'std' => '1',
136
-        'type' => 'radio',
137
-        'value' => '0',
138
-        'radiogroup' => 'end'
139
-    ),
140
-
141
-    array(
142
-        'name' => __('Google analytics access', 'geodirectory'),
143
-        'desc' => '',
144
-        'id' => 'geodir_ga_token',
145
-        'type' => 'google_analytics',
146
-        'css' => 'min-width:300px;',
147
-        'std' => '' // Default value for the page title - changed in settings
148
-    ),
149
-
150
-    array(
151
-        'name' => __('Google analytics Auth Code', 'geodirectory'),
152
-        'desc' => __('You must save this setting before accounts will show.', 'geodirectory'),
153
-        'id' => 'geodir_ga_auth_code',
154
-        'type' => 'text',
155
-        'css' => 'min-width:300px;',
156
-        'std' => '' // Default value for the page title - changed in settings
157
-    ),
158
-
159
-    array(
160
-        'name' => __('Analytics Account', 'geodirectory'),
161
-        'desc' => __('Select the account that you setup for this site.', 'geodirectory'),
162
-        'id' => 'geodir_ga_account_id',
163
-        'css' => 'min-width:300px;',
164
-        'std' => 'gridview_onehalf',
165
-        'type' => 'select',
166
-        'class' => 'chosen_select',
167
-        'options' => geodir_gd_accounts()
168
-    ),
169
-
170
-
171
-    array(
172
-        'name' => __('Add Google analytics tracking code to site?', 'geodirectory'),
173
-        'desc' => __('Yes <small>(this will automatically add the correct tracking code to your site)</small>', 'geodirectory'),
174
-        'id' => 'geodir_ga_add_tracking_code',
175
-        'std' => '0',
176
-        'type' => 'radio',
177
-        'value' => '1',
178
-        'radiogroup' => 'start'
179
-    ),
180
-    array(
181
-        'name' => __('Add Google analytics tracking code to site?', 'geodirectory'),
182
-        'desc' => __('No <small>(if you already have tracking code added you should not add it again)</small>', 'geodirectory'),
183
-        'id' => 'geodir_ga_add_tracking_code',
184
-        'std' => '1',
185
-        'type' => 'radio',
186
-        'value' => '0',
187
-        'radiogroup' => 'end'
188
-    ),
189
-
190
-    array(
191
-        'name' => __('Anonymize user IP?', 'geodirectory'),
192
-        'desc' => __('In most cases this is not required, this is to comply with certain country laws such as Germany.', 'geodirectory'),
193
-        'id' => 'geodir_ga_anonymize_ip',
194
-        'type' => 'checkbox',
195
-        'std' => '0'
196
-    ),
197
-
198
-    array(
199
-        'name' => __('Auto refresh active users?', 'geodirectory'),
200
-        'desc' => __('If ticked it uses the auto refresh time below, if not it never refreshes unless the refresh button is clicked.', 'geodirectory'),
201
-        'id' => 'geodir_ga_auto_refresh',
202
-        'type' => 'checkbox',
203
-        'std' => '0'
204
-    ),
205
-    array(
206
-        'name' => __('Time interval for auto refresh active users', 'geodirectory'),
207
-        'desc' => __('Time interval in seconds to auto refresh active users. The active users will be auto refreshed after this time interval. Leave blank or use 0(zero) to disable auto refresh. Default: 5', 'geodirectory'),
208
-        'id' => 'geodir_ga_refresh_time',
209
-        'type' => 'text',
210
-        'std' => '5'
211
-    ),
212
-
213
-    array('type' => 'sectionend', 'id' => 'google_analytic_settings'),
116
+	array('name' => __('Google Analytics', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'google_analytic_settings'),
117
+
118
+	array('name' => __('Google Analytic Settings', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'google_analytic_settings'),
119
+
120
+
121
+
122
+	array(
123
+		'name' => __('Show business owner google analytics stats?', 'geodirectory'),
124
+		'desc' => __('Yes', 'geodirectory'),
125
+		'id' => 'geodir_ga_stats',
126
+		'std' => '0',
127
+		'type' => 'radio',
128
+		'value' => '1',
129
+		'radiogroup' => 'start'
130
+	),
131
+	array(
132
+		'name' => __('Show business owner Google Analytics stats?', 'geodirectory'),
133
+		'desc' => __('No', 'geodirectory'),
134
+		'id' => 'geodir_ga_stats',
135
+		'std' => '1',
136
+		'type' => 'radio',
137
+		'value' => '0',
138
+		'radiogroup' => 'end'
139
+	),
140
+
141
+	array(
142
+		'name' => __('Google analytics access', 'geodirectory'),
143
+		'desc' => '',
144
+		'id' => 'geodir_ga_token',
145
+		'type' => 'google_analytics',
146
+		'css' => 'min-width:300px;',
147
+		'std' => '' // Default value for the page title - changed in settings
148
+	),
149
+
150
+	array(
151
+		'name' => __('Google analytics Auth Code', 'geodirectory'),
152
+		'desc' => __('You must save this setting before accounts will show.', 'geodirectory'),
153
+		'id' => 'geodir_ga_auth_code',
154
+		'type' => 'text',
155
+		'css' => 'min-width:300px;',
156
+		'std' => '' // Default value for the page title - changed in settings
157
+	),
158
+
159
+	array(
160
+		'name' => __('Analytics Account', 'geodirectory'),
161
+		'desc' => __('Select the account that you setup for this site.', 'geodirectory'),
162
+		'id' => 'geodir_ga_account_id',
163
+		'css' => 'min-width:300px;',
164
+		'std' => 'gridview_onehalf',
165
+		'type' => 'select',
166
+		'class' => 'chosen_select',
167
+		'options' => geodir_gd_accounts()
168
+	),
169
+
170
+
171
+	array(
172
+		'name' => __('Add Google analytics tracking code to site?', 'geodirectory'),
173
+		'desc' => __('Yes <small>(this will automatically add the correct tracking code to your site)</small>', 'geodirectory'),
174
+		'id' => 'geodir_ga_add_tracking_code',
175
+		'std' => '0',
176
+		'type' => 'radio',
177
+		'value' => '1',
178
+		'radiogroup' => 'start'
179
+	),
180
+	array(
181
+		'name' => __('Add Google analytics tracking code to site?', 'geodirectory'),
182
+		'desc' => __('No <small>(if you already have tracking code added you should not add it again)</small>', 'geodirectory'),
183
+		'id' => 'geodir_ga_add_tracking_code',
184
+		'std' => '1',
185
+		'type' => 'radio',
186
+		'value' => '0',
187
+		'radiogroup' => 'end'
188
+	),
189
+
190
+	array(
191
+		'name' => __('Anonymize user IP?', 'geodirectory'),
192
+		'desc' => __('In most cases this is not required, this is to comply with certain country laws such as Germany.', 'geodirectory'),
193
+		'id' => 'geodir_ga_anonymize_ip',
194
+		'type' => 'checkbox',
195
+		'std' => '0'
196
+	),
197
+
198
+	array(
199
+		'name' => __('Auto refresh active users?', 'geodirectory'),
200
+		'desc' => __('If ticked it uses the auto refresh time below, if not it never refreshes unless the refresh button is clicked.', 'geodirectory'),
201
+		'id' => 'geodir_ga_auto_refresh',
202
+		'type' => 'checkbox',
203
+		'std' => '0'
204
+	),
205
+	array(
206
+		'name' => __('Time interval for auto refresh active users', 'geodirectory'),
207
+		'desc' => __('Time interval in seconds to auto refresh active users. The active users will be auto refreshed after this time interval. Leave blank or use 0(zero) to disable auto refresh. Default: 5', 'geodirectory'),
208
+		'id' => 'geodir_ga_refresh_time',
209
+		'type' => 'text',
210
+		'std' => '5'
211
+	),
212
+
213
+	array('type' => 'sectionend', 'id' => 'google_analytic_settings'),
214 214
 
215 215
 )); // google_analytic_settings End
216 216
 
@@ -222,84 +222,84 @@  discard block
 block discarded – undo
222 222
  */
223 223
 $search_settings = apply_filters('geodir_search_settings', array(
224 224
 
225
-    array('name' => __('Search', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'search_settings'),
226
-
227
-    array('name' => __('Search Settings', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'search_settings'),
228
-
229
-    array(
230
-        'name' => __('Limit squared distance area to X miles (helps improve search speed)', 'geodirectory'),
231
-        'desc' => __('Enter whole number only ex. 40 (Tokyo is largest city in the world @40 sq miles) LEAVE BLANK FOR NO DISTANCE LIMIT', 'geodirectory'),
232
-        'id' => 'geodir_search_dist',
233
-        'type' => 'text',
234
-        'css' => 'min-width:300px;',
235
-        'std' => '40' // Default value for the page title - changed in settings
236
-    ),
237
-
238
-    array(
239
-        'name' => __('Show search distances in miles or km', 'geodirectory'),
240
-        'desc' => __('Miles', 'geodirectory'),
241
-        'id' => 'geodir_search_dist_1',
242
-        'std' => 'miles',
243
-        'type' => 'radio',
244
-        'value' => 'miles',
245
-        'radiogroup' => 'start'
246
-    ),
247
-    array(
248
-        'name' => __('Show search distances in miles or km', 'geodirectory'),
249
-        'desc' => __('Kilometers', 'geodirectory'),
250
-        'id' => 'geodir_search_dist_1',
251
-        'std' => 'miles',
252
-        'type' => 'radio',
253
-        'value' => 'km',
254
-        'radiogroup' => 'end'
255
-    ),
256
-
257
-    array(
258
-        'name' => __('If distance is less than 0.01 show distance in meters or feet', 'geodirectory'),
259
-        'desc' => __('Meters', 'geodirectory'),
260
-        'id' => 'geodir_search_dist_2',
261
-        'std' => 'meters',
262
-        'type' => 'radio',
263
-        'value' => 'meters',
264
-        'radiogroup' => 'start'
265
-    ),
266
-
267
-    array(
268
-        'name' => __('If distance is less than 0.01 show distance in meters or feet', 'geodirectory'),
269
-        'desc' => __('Feet', 'geodirectory'),
270
-        'id' => 'geodir_search_dist_2',
271
-        'std' => 'meters',
272
-        'type' => 'radio',
273
-        'value' => 'feet',
274
-        'radiogroup' => 'end'
275
-    ),
276
-
277
-    array(
278
-        'name' => __('Add location specific text to (Near) search for Google', 'geodirectory'),
279
-        'desc' => __('This is usefull if your directory is limted to one location such as: New York or Australia (this setting should be blank if using default country, regions etc with multilocation addon as it will automatically add them)', 'geodirectory'),
280
-        'id' => 'geodir_search_near_addition',
281
-        'type' => 'text',
282
-        'css' => 'min-width:300px;',
283
-        'std' => ''
284
-    ),
285
-    array(
286
-        'name' => __('Individual word search limit', 'geodirectory'),
287
-        'desc' => __('With this option you can limit individual words being searched for, for example searching for `Jo Brown` would return results with words like `Jones`, you can exclude these types of small character words if you wish.', 'geodirectory'),
288
-        'id' => 'geodir_search_word_limit',
289
-        'css' => 'min-width:300px;',
290
-        'std' => 'gridview_onehalf',
291
-        'type' => 'select',
292
-        'class' => 'chosen_select',
293
-        'options' => array_unique(array(
294
-            '0' => __('Disabled', 'geodirectory'),
295
-            '1' => __('1 Character words excluded', 'geodirectory'),
296
-            '2' => __('2 Character words and less excluded', 'geodirectory'),
297
-            '3' => __('3 Character words and less excluded', 'geodirectory'),
298
-        ))
299
-    ),
300
-
301
-
302
-    array('type' => 'sectionend', 'id' => 'search_settings'),
225
+	array('name' => __('Search', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'search_settings'),
226
+
227
+	array('name' => __('Search Settings', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'search_settings'),
228
+
229
+	array(
230
+		'name' => __('Limit squared distance area to X miles (helps improve search speed)', 'geodirectory'),
231
+		'desc' => __('Enter whole number only ex. 40 (Tokyo is largest city in the world @40 sq miles) LEAVE BLANK FOR NO DISTANCE LIMIT', 'geodirectory'),
232
+		'id' => 'geodir_search_dist',
233
+		'type' => 'text',
234
+		'css' => 'min-width:300px;',
235
+		'std' => '40' // Default value for the page title - changed in settings
236
+	),
237
+
238
+	array(
239
+		'name' => __('Show search distances in miles or km', 'geodirectory'),
240
+		'desc' => __('Miles', 'geodirectory'),
241
+		'id' => 'geodir_search_dist_1',
242
+		'std' => 'miles',
243
+		'type' => 'radio',
244
+		'value' => 'miles',
245
+		'radiogroup' => 'start'
246
+	),
247
+	array(
248
+		'name' => __('Show search distances in miles or km', 'geodirectory'),
249
+		'desc' => __('Kilometers', 'geodirectory'),
250
+		'id' => 'geodir_search_dist_1',
251
+		'std' => 'miles',
252
+		'type' => 'radio',
253
+		'value' => 'km',
254
+		'radiogroup' => 'end'
255
+	),
256
+
257
+	array(
258
+		'name' => __('If distance is less than 0.01 show distance in meters or feet', 'geodirectory'),
259
+		'desc' => __('Meters', 'geodirectory'),
260
+		'id' => 'geodir_search_dist_2',
261
+		'std' => 'meters',
262
+		'type' => 'radio',
263
+		'value' => 'meters',
264
+		'radiogroup' => 'start'
265
+	),
266
+
267
+	array(
268
+		'name' => __('If distance is less than 0.01 show distance in meters or feet', 'geodirectory'),
269
+		'desc' => __('Feet', 'geodirectory'),
270
+		'id' => 'geodir_search_dist_2',
271
+		'std' => 'meters',
272
+		'type' => 'radio',
273
+		'value' => 'feet',
274
+		'radiogroup' => 'end'
275
+	),
276
+
277
+	array(
278
+		'name' => __('Add location specific text to (Near) search for Google', 'geodirectory'),
279
+		'desc' => __('This is usefull if your directory is limted to one location such as: New York or Australia (this setting should be blank if using default country, regions etc with multilocation addon as it will automatically add them)', 'geodirectory'),
280
+		'id' => 'geodir_search_near_addition',
281
+		'type' => 'text',
282
+		'css' => 'min-width:300px;',
283
+		'std' => ''
284
+	),
285
+	array(
286
+		'name' => __('Individual word search limit', 'geodirectory'),
287
+		'desc' => __('With this option you can limit individual words being searched for, for example searching for `Jo Brown` would return results with words like `Jones`, you can exclude these types of small character words if you wish.', 'geodirectory'),
288
+		'id' => 'geodir_search_word_limit',
289
+		'css' => 'min-width:300px;',
290
+		'std' => 'gridview_onehalf',
291
+		'type' => 'select',
292
+		'class' => 'chosen_select',
293
+		'options' => array_unique(array(
294
+			'0' => __('Disabled', 'geodirectory'),
295
+			'1' => __('1 Character words excluded', 'geodirectory'),
296
+			'2' => __('2 Character words and less excluded', 'geodirectory'),
297
+			'3' => __('3 Character words and less excluded', 'geodirectory'),
298
+		))
299
+	),
300
+
301
+
302
+	array('type' => 'sectionend', 'id' => 'search_settings'),
303 303
 
304 304
 )); //search_settings End
305 305
 
@@ -311,17 +311,17 @@  discard block
 block discarded – undo
311 311
  */
312 312
 $dummy_data_settings = apply_filters('geodir_dummy_data_settings', array(
313 313
 
314
-    array('name' => __('Dummy Data', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'dummy_data_settings'),
315
-
316
-    array(
317
-        'name' => '',
318
-        'desc' => '',
319
-        'id' => 'geodir_dummy_data_installer',
320
-        'type' => 'dummy_installer',
321
-        'css' => 'min-width:300px;',
322
-        'std' => '40' // Default value for the page title - changed in settings
323
-    ),
324
-    array('type' => 'sectionend', 'id' => 'geodir_dummy_data_settings'),
314
+	array('name' => __('Dummy Data', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'dummy_data_settings'),
315
+
316
+	array(
317
+		'name' => '',
318
+		'desc' => '',
319
+		'id' => 'geodir_dummy_data_installer',
320
+		'type' => 'dummy_installer',
321
+		'css' => 'min-width:300px;',
322
+		'std' => '40' // Default value for the page title - changed in settings
323
+	),
324
+	array('type' => 'sectionend', 'id' => 'geodir_dummy_data_settings'),
325 325
 
326 326
 )); //dummy_data_settings End
327 327
 
Please login to merge, or discard this patch.
geodirectory-admin/google-api-php-client/src/Google/Task/Retryable.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
  */
17 17
 
18 18
 if (!class_exists('Google_Client')) {
19
-  require_once dirname(__FILE__) . '/../autoload.php';
19
+  require_once dirname(__FILE__).'/../autoload.php';
20 20
 }
21 21
 
22 22
 /**
Please login to merge, or discard this patch.
geodirectory-admin/google-api-php-client/src/Google/Auth/Abstract.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
  */
17 17
 
18 18
 if (!class_exists('Google_Client')) {
19
-  require_once dirname(__FILE__) . '/../autoload.php';
19
+  require_once dirname(__FILE__).'/../autoload.php';
20 20
 }
21 21
 
22 22
 /**
Please login to merge, or discard this patch.
geodirectory-functions/comments_functions.php 3 patches
Braces   +60 added lines, -48 removed lines patch added patch discarded remove patch
@@ -278,8 +278,9 @@  discard block
 block discarded – undo
278 278
 
279 279
     $post_id = isset($comment_info->comment_post_ID) ? $comment_info->comment_post_ID : '';
280 280
 
281
-    if (!empty($comment_info))
282
-        $status = $comment_info->comment_approved;
281
+    if (!empty($comment_info)) {
282
+            $status = $comment_info->comment_approved;
283
+    }
283 284
 
284 285
     if ($status == 'approve' || $status == 1) {
285 286
         $status = 1;
@@ -418,12 +419,14 @@  discard block
 block discarded – undo
418 419
         }
419 420
     } else {
420 421
         $rating = 0;
421
-        if (!empty($comment))
422
-            $rating = geodir_get_commentoverall($comment->comment_ID);
422
+        if (!empty($comment)) {
423
+                    $rating = geodir_get_commentoverall($comment->comment_ID);
424
+        }
423 425
         if ($rating != 0 && !is_admin()) {
424 426
             return '<div><div class="gd-rating-text">' . __('Overall Rating', 'geodirectory') . ': <div class="rating">' . $rating . '</div></div>' . geodir_get_rating_stars($rating, $comment->comment_ID) . '</div><div class="description">' . $content . '</div>';
425
-        } else
426
-            return $content;
427
+        } else {
428
+                    return $content;
429
+        }
427 430
     }
428 431
 }
429 432
 
@@ -512,11 +515,12 @@  discard block
 block discarded – undo
512 515
         $post_ratings = get_post_meta($post_id, 'overall_rating');
513 516
     }
514 517
 
515
-    if ($post_ratings)
516
-        return $post_ratings;
517
-    else
518
-        return false;
519
-}
518
+    if ($post_ratings) {
519
+            return $post_ratings;
520
+    } else {
521
+            return false;
522
+    }
523
+    }
520 524
 
521 525
 
522 526
 /**
@@ -541,11 +545,12 @@  discard block
 block discarded – undo
541 545
         )
542 546
     );
543 547
 
544
-    if (!empty($reatings))
545
-        return $reatings;
546
-    else
547
-        return false;
548
-}
548
+    if (!empty($reatings)) {
549
+            return $reatings;
550
+    } else {
551
+            return false;
552
+    }
553
+    }
549 554
 
550 555
 /**
551 556
  * Get review total of a Post.
@@ -569,11 +574,12 @@  discard block
 block discarded – undo
569 574
         )
570 575
     );
571 576
 
572
-    if (!empty($results))
573
-        return $results;
574
-    else
575
-        return false;
576
-}
577
+    if (!empty($results)) {
578
+            return $results;
579
+    } else {
580
+            return false;
581
+    }
582
+    }
577 583
 
578 584
 /**
579 585
  * Get review count by user ID.
@@ -596,11 +602,12 @@  discard block
 block discarded – undo
596 602
         )
597 603
     );
598 604
 
599
-    if (!empty($results))
600
-        return $results;
601
-    else
602
-        return false;
603
-}
605
+    if (!empty($results)) {
606
+            return $results;
607
+    } else {
608
+            return false;
609
+    }
610
+    }
604 611
 
605 612
 /**
606 613
  * Get average overall rating of a Post.
@@ -634,11 +641,12 @@  discard block
 block discarded – undo
634 641
         )
635 642
     );
636 643
 
637
-    if (!empty($results))
638
-        return $results;
639
-    else
640
-        return false;
641
-}
644
+    if (!empty($results)) {
645
+            return $results;
646
+    } else {
647
+            return false;
648
+    }
649
+    }
642 650
 
643 651
 /**
644 652
  * Get review count of a Post.
@@ -662,11 +670,12 @@  discard block
 block discarded – undo
662 670
         )
663 671
     );
664 672
 
665
-    if (!empty($results))
666
-        return $results;
667
-    else
668
-        return false;
669
-}
673
+    if (!empty($results)) {
674
+            return $results;
675
+    } else {
676
+            return false;
677
+    }
678
+    }
670 679
 
671 680
 /**
672 681
  * Get comments count of a Post.
@@ -692,11 +701,12 @@  discard block
 block discarded – undo
692 701
     );
693 702
 
694 703
 
695
-    if (!empty($results))
696
-        return $results;
697
-    else
698
-        return false;
699
-}
704
+    if (!empty($results)) {
705
+            return $results;
706
+    } else {
707
+            return false;
708
+    }
709
+    }
700 710
 
701 711
 /**
702 712
  * Get overall rating of a comment.
@@ -720,11 +730,12 @@  discard block
 block discarded – undo
720 730
         )
721 731
     );
722 732
 
723
-    if ($reatings)
724
-        return $reatings;
725
-    else
726
-        return false;
727
-}
733
+    if ($reatings) {
734
+            return $reatings;
735
+    } else {
736
+            return false;
737
+    }
738
+    }
728 739
 
729 740
 /**
730 741
  * Returns average overall rating of a Post. Depreciated since ver 1.3.6.
@@ -970,8 +981,9 @@  discard block
 block discarded – undo
970 981
     $active_tabs = get_option('geodir_detail_page_tabs_excluded');
971 982
 
972 983
     $is_display = true;
973
-    if (!empty($active_tabs) && in_array('reviews', $active_tabs))
974
-        $is_display = false;
984
+    if (!empty($active_tabs) && in_array('reviews', $active_tabs)) {
985
+            $is_display = false;
986
+    }
975 987
 
976 988
     /**
977 989
      * Filter to change display value.
Please login to merge, or discard this patch.
Indentation   +453 added lines, -453 removed lines patch added patch discarded remove patch
@@ -31,13 +31,13 @@  discard block
 block discarded – undo
31 31
  */
32 32
 function geodir_comment_meta_row_action($a)
33 33
 {
34
-    global $comment;
34
+	global $comment;
35 35
 
36
-    $rating = geodir_get_commentoverall($comment->comment_ID);
37
-    if ($rating != 0) {
38
-        echo geodir_get_rating_stars($rating, $comment->comment_ID);
39
-    }
40
-    return $a;
36
+	$rating = geodir_get_commentoverall($comment->comment_ID);
37
+	if ($rating != 0) {
38
+		echo geodir_get_rating_stars($rating, $comment->comment_ID);
39
+	}
40
+	return $a;
41 41
 }
42 42
 
43 43
 add_action('add_meta_boxes_comment', 'geodir_comment_add_meta_box');
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
  */
53 53
 function geodir_comment_add_meta_box($comment)
54 54
 {
55
-    add_meta_box('gd-comment-rating', __('Comment Rating', 'geodirectory'), 'geodir_comment_rating_meta', 'comment', 'normal', 'high');
55
+	add_meta_box('gd-comment-rating', __('Comment Rating', 'geodirectory'), 'geodir_comment_rating_meta', 'comment', 'normal', 'high');
56 56
 }
57 57
 
58 58
 /**
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
  * @param object $comment The comment object.
67 67
  */
68 68
 function geodir_comment_rating_meta($comment) {
69
-    $post_type = get_post_type($comment->comment_post_ID);
69
+	$post_type = get_post_type($comment->comment_post_ID);
70 70
 	if (in_array($post_type, (array)geodir_get_posttypes()) && (int)$comment->comment_parent == 0 && !(!empty($post_type) && geodir_cpt_has_rating_disabled($post_type))) {
71 71
 		$rating = geodir_get_commentoverall($comment->comment_ID);
72 72
 		
@@ -106,24 +106,24 @@  discard block
 block discarded – undo
106 106
  * @global object $post The post object.
107 107
  */
108 108
 function geodir_comment_rating_fields() {
109
-    global $post;
109
+	global $post;
110 110
 
111
-    $post_types = geodir_get_posttypes();
111
+	$post_types = geodir_get_posttypes();
112 112
 
113
-    if (!empty($post->post_type) && in_array($post->post_type, $post_types) && !(!empty($post->post_type) && geodir_cpt_has_rating_disabled($post->post_type))) {
114
-        $star_texts = array();
115
-        $star_texts[] = __('Terrible', 'geodirectory');
116
-        $star_texts[] = __('Poor', 'geodirectory');
117
-        $star_texts[] = __('Average', 'geodirectory');
118
-        $star_texts[] = __('Very Good', 'geodirectory');
119
-        $star_texts[] = __('Excellent', 'geodirectory');
113
+	if (!empty($post->post_type) && in_array($post->post_type, $post_types) && !(!empty($post->post_type) && geodir_cpt_has_rating_disabled($post->post_type))) {
114
+		$star_texts = array();
115
+		$star_texts[] = __('Terrible', 'geodirectory');
116
+		$star_texts[] = __('Poor', 'geodirectory');
117
+		$star_texts[] = __('Average', 'geodirectory');
118
+		$star_texts[] = __('Very Good', 'geodirectory');
119
+		$star_texts[] = __('Excellent', 'geodirectory');
120 120
         
121
-        $gd_rating_html = apply_filters('gd_rating_form_html', '<div class="gd_rating" data-average="0" data-id="5"></div>', $star_texts);
122
-        echo $gd_rating_html;
123
-        ?>
121
+		$gd_rating_html = apply_filters('gd_rating_form_html', '<div class="gd_rating" data-average="0" data-id="5"></div>', $star_texts);
122
+		echo $gd_rating_html;
123
+		?>
124 124
         <input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="0"/>
125 125
         <?php
126
-    }
126
+	}
127 127
 }
128 128
 
129 129
 add_filter('comment_reply_link', 'geodir_comment_replaylink');
@@ -139,12 +139,12 @@  discard block
 block discarded – undo
139 139
 function geodir_comment_replaylink($link)
140 140
 {
141 141
 
142
-    if (strpos($link, 'wp-login.php?') !== false) {
143
-        $link = str_replace(wp_login_url(),geodir_login_url(),$link);
144
-    }
145
-    $link = '<div class="gd_comment_replaylink">' . $link . '</div>';
142
+	if (strpos($link, 'wp-login.php?') !== false) {
143
+		$link = str_replace(wp_login_url(),geodir_login_url(),$link);
144
+	}
145
+	$link = '<div class="gd_comment_replaylink">' . $link . '</div>';
146 146
 
147
-    return $link;
147
+	return $link;
148 148
 }
149 149
 
150 150
 add_filter('cancel_comment_reply_link', 'geodir_cancle_replaylink');
@@ -159,9 +159,9 @@  discard block
 block discarded – undo
159 159
 function geodir_cancle_replaylink($link)
160 160
 {
161 161
 
162
-    $link = '<span class="gd-cancel-replaylink">' . $link . '</span>';
162
+	$link = '<span class="gd-cancel-replaylink">' . $link . '</span>';
163 163
 
164
-    return $link;
164
+	return $link;
165 165
 }
166 166
 
167 167
 add_action('comment_post', 'geodir_save_rating');
@@ -177,32 +177,32 @@  discard block
 block discarded – undo
177 177
  */
178 178
 function geodir_save_rating($comment = 0)
179 179
 {
180
-    global $wpdb, $user_ID, $plugin_prefix;
180
+	global $wpdb, $user_ID, $plugin_prefix;
181 181
 
182
-    $comment_info = get_comment($comment);
182
+	$comment_info = get_comment($comment);
183 183
 
184
-    $post_id = $comment_info->comment_post_ID;
185
-    $status = $comment_info->comment_approved;
186
-    $rating_ip = getenv("REMOTE_ADDR");
184
+	$post_id = $comment_info->comment_post_ID;
185
+	$status = $comment_info->comment_approved;
186
+	$rating_ip = getenv("REMOTE_ADDR");
187 187
 	
188
-    $post = geodir_get_post_info($post_id);
189
-    if (empty($post)) {
190
-        return;
191
-    }
192
-
193
-    if ($post->post_status == 'publish') {
194
-        $post_status = '1';
195
-    } else {
196
-        $post_status = '0';
197
-    }
188
+	$post = geodir_get_post_info($post_id);
189
+	if (empty($post)) {
190
+		return;
191
+	}
192
+
193
+	if ($post->post_status == 'publish') {
194
+		$post_status = '1';
195
+	} else {
196
+		$post_status = '0';
197
+	}
198 198
 	
199
-    if (isset($_REQUEST['geodir_overallrating'])) {
200
-        $overall_rating = $_REQUEST['geodir_overallrating'];
199
+	if (isset($_REQUEST['geodir_overallrating'])) {
200
+		$overall_rating = $_REQUEST['geodir_overallrating'];
201 201
         
202 202
 		if (isset($comment_info->comment_parent) && (int)$comment_info->comment_parent == 0) {
203
-            $overall_rating = $overall_rating > 0 ? $overall_rating : '0';
203
+			$overall_rating = $overall_rating > 0 ? $overall_rating : '0';
204 204
 
205
-            $sqlqry = $wpdb->prepare("INSERT INTO " . GEODIR_REVIEW_TABLE . " SET
205
+			$sqlqry = $wpdb->prepare("INSERT INTO " . GEODIR_REVIEW_TABLE . " SET
206 206
 					post_id		= %d,
207 207
 					post_type = %s,
208 208
 					post_title	= %s,
@@ -220,35 +220,35 @@  discard block
 block discarded – undo
220 220
 					post_latitude	= %s,
221 221
 					comment_content	= %s 
222 222
 					",
223
-                array($post_id, $post->post_type, $post->post_title, $user_ID, $comment, $rating_ip, $overall_rating, $status, $post_status, date_i18n('Y-m-d H:i:s', current_time('timestamp')), $post->post_city, $post->post_region, $post->post_country, $post->post_latitude, $post->post_longitude, $comment_info->comment_content)
224
-            );
225
-
226
-            $wpdb->query($sqlqry);
227
-
228
-            /**
229
-             * Called after saving the comment.
230
-             *
231
-             * @since 1.0.0
232
-             * @package GeoDirectory
233
-             * @param array $_REQUEST {
234
-             *    Attributes of the $_REQUEST variable.
235
-             *
236
-             *    @type string $geodir_overallrating Overall rating.
237
-             *    @type string $comment Comment text.
238
-             *    @type string $submit Submit button text.
239
-             *    @type string $comment_post_ID Comment post ID.
240
-             *    @type string $comment_parent Comment Parent ID.
241
-             *    @type string $_wp_unfiltered_html_comment Unfiltered html comment string.
242
-             *
243
-             * }
244
-             */
245
-            do_action('geodir_after_save_comment', $_REQUEST, 'Comment Your Post');
246
-
247
-            if ($status) {
248
-                geodir_update_postrating($post_id);
249
-            }
250
-        }
251
-    }
223
+				array($post_id, $post->post_type, $post->post_title, $user_ID, $comment, $rating_ip, $overall_rating, $status, $post_status, date_i18n('Y-m-d H:i:s', current_time('timestamp')), $post->post_city, $post->post_region, $post->post_country, $post->post_latitude, $post->post_longitude, $comment_info->comment_content)
224
+			);
225
+
226
+			$wpdb->query($sqlqry);
227
+
228
+			/**
229
+			 * Called after saving the comment.
230
+			 *
231
+			 * @since 1.0.0
232
+			 * @package GeoDirectory
233
+			 * @param array $_REQUEST {
234
+			 *    Attributes of the $_REQUEST variable.
235
+			 *
236
+			 *    @type string $geodir_overallrating Overall rating.
237
+			 *    @type string $comment Comment text.
238
+			 *    @type string $submit Submit button text.
239
+			 *    @type string $comment_post_ID Comment post ID.
240
+			 *    @type string $comment_parent Comment Parent ID.
241
+			 *    @type string $_wp_unfiltered_html_comment Unfiltered html comment string.
242
+			 *
243
+			 * }
244
+			 */
245
+			do_action('geodir_after_save_comment', $_REQUEST, 'Comment Your Post');
246
+
247
+			if ($status) {
248
+				geodir_update_postrating($post_id);
249
+			}
250
+		}
251
+	}
252 252
 }
253 253
 
254 254
 
@@ -266,51 +266,51 @@  discard block
 block discarded – undo
266 266
  */
267 267
 function geodir_update_rating_status_change($comment_id, $status)
268 268
 {
269
-    if ($status == 'delete') {
270
-        return;
271
-    }
272
-    global $wpdb, $plugin_prefix, $user_ID;
269
+	if ($status == 'delete') {
270
+		return;
271
+	}
272
+	global $wpdb, $plugin_prefix, $user_ID;
273 273
 
274
-    $comment_info = get_comment($comment_id);
274
+	$comment_info = get_comment($comment_id);
275 275
 
276
-    $post_id = isset($comment_info->comment_post_ID) ? $comment_info->comment_post_ID : '';
276
+	$post_id = isset($comment_info->comment_post_ID) ? $comment_info->comment_post_ID : '';
277 277
 
278
-    if (!empty($comment_info))
279
-        $status = $comment_info->comment_approved;
278
+	if (!empty($comment_info))
279
+		$status = $comment_info->comment_approved;
280 280
 
281
-    if ($status == 'approve' || $status == 1) {
282
-        $status = 1;
283
-    } else {
284
-        $status = 0;
285
-    }
281
+	if ($status == 'approve' || $status == 1) {
282
+		$status = 1;
283
+	} else {
284
+		$status = 0;
285
+	}
286 286
 
287
-    $comment_info_ID = isset($comment_info->comment_ID) ? $comment_info->comment_ID : '';
288
-    $old_rating = geodir_get_commentoverall($comment_info_ID);
287
+	$comment_info_ID = isset($comment_info->comment_ID) ? $comment_info->comment_ID : '';
288
+	$old_rating = geodir_get_commentoverall($comment_info_ID);
289 289
 
290
-    $post_type = get_post_type($post_id);
290
+	$post_type = get_post_type($post_id);
291 291
 
292
-    $detail_table = $plugin_prefix . $post_type . '_detail';
292
+	$detail_table = $plugin_prefix . $post_type . '_detail';
293 293
 
294
-    if ($comment_id) {
294
+	if ($comment_id) {
295 295
 
296
-        $overall_rating = $old_rating;
296
+		$overall_rating = $old_rating;
297 297
 
298
-        if (isset($old_rating)) {
298
+		if (isset($old_rating)) {
299 299
 
300
-            $sqlqry = $wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET
300
+			$sqlqry = $wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET
301 301
 						overall_rating = %f,
302 302
 						status		= %s,
303 303
 						comment_content = %s 
304 304
 						WHERE comment_id = %d ", array($overall_rating, $status, $comment_info->comment_content, $comment_id));
305 305
 
306
-            $wpdb->query($sqlqry);
306
+			$wpdb->query($sqlqry);
307 307
 
308
-            //update rating
309
-            geodir_update_postrating($post_id, $post_type);
308
+			//update rating
309
+			geodir_update_postrating($post_id, $post_type);
310 310
 
311
-        }
311
+		}
312 312
 
313
-    }
313
+	}
314 314
 
315 315
 }
316 316
 
@@ -329,41 +329,41 @@  discard block
 block discarded – undo
329 329
 function geodir_update_rating($comment_id = 0)
330 330
 {
331 331
 
332
-    global $wpdb, $plugin_prefix, $user_ID;
332
+	global $wpdb, $plugin_prefix, $user_ID;
333 333
 
334
-    $comment_info = get_comment($comment_id);
334
+	$comment_info = get_comment($comment_id);
335 335
 
336
-    $post_id = $comment_info->comment_post_ID;
337
-    $status = $comment_info->comment_approved;
338
-    $old_rating = geodir_get_commentoverall($comment_info->comment_ID);
336
+	$post_id = $comment_info->comment_post_ID;
337
+	$status = $comment_info->comment_approved;
338
+	$old_rating = geodir_get_commentoverall($comment_info->comment_ID);
339 339
 
340
-    $post_type = get_post_type($post_id);
340
+	$post_type = get_post_type($post_id);
341 341
 
342
-    $detail_table = $plugin_prefix . $post_type . '_detail';
342
+	$detail_table = $plugin_prefix . $post_type . '_detail';
343 343
 
344
-    if (isset($_REQUEST['geodir_overallrating'])) {
344
+	if (isset($_REQUEST['geodir_overallrating'])) {
345 345
 
346
-        $overall_rating = $_REQUEST['geodir_overallrating'];
346
+		$overall_rating = $_REQUEST['geodir_overallrating'];
347 347
 
348
-        if (isset($comment_info->comment_parent) && (int)$comment_info->comment_parent == 0) {
349
-            $overall_rating = $overall_rating > 0 ? $overall_rating : '0';
348
+		if (isset($comment_info->comment_parent) && (int)$comment_info->comment_parent == 0) {
349
+			$overall_rating = $overall_rating > 0 ? $overall_rating : '0';
350 350
 
351
-            if (isset($old_rating)) {
351
+			if (isset($old_rating)) {
352 352
 
353
-                $sqlqry = $wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET
353
+				$sqlqry = $wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET
354 354
 						overall_rating = %f,
355 355
 						status		= %s,
356 356
 						comment_content	= %s 
357 357
 						WHERE comment_id = %d ", array($overall_rating, $status, $comment_info->comment_content, $comment_id));
358 358
 
359
-                $wpdb->query($sqlqry);
359
+				$wpdb->query($sqlqry);
360 360
 
361
-                //update rating
362
-                geodir_update_postrating($post_id, $post_type);
361
+				//update rating
362
+				geodir_update_postrating($post_id, $post_type);
363 363
 
364
-            }
365
-        }
366
-    }
364
+			}
365
+		}
366
+	}
367 367
 
368 368
 
369 369
 }
@@ -379,19 +379,19 @@  discard block
 block discarded – undo
379 379
  */
380 380
 function geodir_comment_delete_comment($comment_id)
381 381
 {
382
-    global $wpdb;
382
+	global $wpdb;
383 383
 
384
-    $review_info = geodir_get_review($comment_id);
385
-    if ($review_info) {
386
-        geodir_update_postrating($review_info->post_id);
387
-    }
384
+	$review_info = geodir_get_review($comment_id);
385
+	if ($review_info) {
386
+		geodir_update_postrating($review_info->post_id);
387
+	}
388 388
 
389
-    $wpdb->query(
390
-        $wpdb->prepare(
391
-            "DELETE FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d",
392
-            array($comment_id)
393
-        )
394
-    );
389
+	$wpdb->query(
390
+		$wpdb->prepare(
391
+			"DELETE FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d",
392
+			array($comment_id)
393
+		)
394
+	);
395 395
 
396 396
 }
397 397
 
@@ -407,21 +407,21 @@  discard block
 block discarded – undo
407 407
  * @return string The comment content.
408 408
  */
409 409
 function geodir_wrap_comment_text($content, $comment = '') {
410
-    if (!empty($comment->comment_post_ID) && geodir_cpt_has_rating_disabled((int)$comment->comment_post_ID)) {
411
-        if (!is_admin()) {
412
-            return '<div class="description">' . $content . '</div>';
413
-        } else {
414
-            return $content;
415
-        }
416
-    } else {
417
-        $rating = 0;
418
-        if (!empty($comment))
419
-            $rating = geodir_get_commentoverall($comment->comment_ID);
420
-        if ($rating != 0 && !is_admin()) {
421
-            return '<div><div class="gd-rating-text">' . __('Overall Rating', 'geodirectory') . ': <div class="rating">' . $rating . '</div></div>' . geodir_get_rating_stars($rating, $comment->comment_ID) . '</div><div class="description">' . $content . '</div>';
422
-        } else
423
-            return $content;
424
-    }
410
+	if (!empty($comment->comment_post_ID) && geodir_cpt_has_rating_disabled((int)$comment->comment_post_ID)) {
411
+		if (!is_admin()) {
412
+			return '<div class="description">' . $content . '</div>';
413
+		} else {
414
+			return $content;
415
+		}
416
+	} else {
417
+		$rating = 0;
418
+		if (!empty($comment))
419
+			$rating = geodir_get_commentoverall($comment->comment_ID);
420
+		if ($rating != 0 && !is_admin()) {
421
+			return '<div><div class="gd-rating-text">' . __('Overall Rating', 'geodirectory') . ': <div class="rating">' . $rating . '</div></div>' . geodir_get_rating_stars($rating, $comment->comment_ID) . '</div><div class="description">' . $content . '</div>';
422
+		} else
423
+			return $content;
424
+	}
425 425
 }
426 426
 
427 427
 
@@ -438,41 +438,41 @@  discard block
 block discarded – undo
438 438
  */
439 439
 function geodir_update_postrating($post_id = 0, $post_type = '', $delete = false)
440 440
 {
441
-    global $wpdb, $plugin_prefix, $comment;
442
-    if (!$post_type) {
443
-        $post_type = get_post_type($post_id);
444
-    }
445
-    $detail_table = $plugin_prefix . $post_type . '_detail';
446
-    $post_newrating = geodir_get_post_rating($post_id, 1);
447
-    $post_newrating_count = geodir_get_review_count_total($post_id);
441
+	global $wpdb, $plugin_prefix, $comment;
442
+	if (!$post_type) {
443
+		$post_type = get_post_type($post_id);
444
+	}
445
+	$detail_table = $plugin_prefix . $post_type . '_detail';
446
+	$post_newrating = geodir_get_post_rating($post_id, 1);
447
+	$post_newrating_count = geodir_get_review_count_total($post_id);
448 448
 
449 449
 
450
-    //$post_newrating = ( (float)$post_oldrating - (float)$old_rating ) + (float)$overall_rating ;
450
+	//$post_newrating = ( (float)$post_oldrating - (float)$old_rating ) + (float)$overall_rating ;
451 451
 
452
-    if ($wpdb->get_var("SHOW TABLES LIKE '" . $detail_table . "'") == $detail_table) {
452
+	if ($wpdb->get_var("SHOW TABLES LIKE '" . $detail_table . "'") == $detail_table) {
453 453
 
454
-        $wpdb->query(
455
-            $wpdb->prepare(
456
-                "UPDATE " . $detail_table . " SET
454
+		$wpdb->query(
455
+			$wpdb->prepare(
456
+				"UPDATE " . $detail_table . " SET
457 457
 						overall_rating = %f,
458 458
 						rating_count = %f
459 459
 						where post_id = %d",
460
-                array($post_newrating, $post_newrating_count, $post_id)
461
-            )
462
-        );
463
-
464
-        update_post_meta($post_id, 'overall_rating', $post_newrating);
465
-        update_post_meta($post_id, 'rating_count', $post_newrating_count);
466
-    }
467
-    /**
468
-     * Called after Updating post overall rating and rating count.
469
-     *
470
-     * @since 1.0.0
471
-     * @since 1.4.3 Added `$post_id` param.
472
-     * @package GeoDirectory
473
-     * @param int $post_id The post ID.
474
-     */
475
-    do_action('geodir_update_postrating',$post_id);
460
+				array($post_newrating, $post_newrating_count, $post_id)
461
+			)
462
+		);
463
+
464
+		update_post_meta($post_id, 'overall_rating', $post_newrating);
465
+		update_post_meta($post_id, 'rating_count', $post_newrating_count);
466
+	}
467
+	/**
468
+	 * Called after Updating post overall rating and rating count.
469
+	 *
470
+	 * @since 1.0.0
471
+	 * @since 1.4.3 Added `$post_id` param.
472
+	 * @package GeoDirectory
473
+	 * @param int $post_id The post ID.
474
+	 */
475
+	do_action('geodir_update_postrating',$post_id);
476 476
 
477 477
 }
478 478
 
@@ -490,29 +490,29 @@  discard block
 block discarded – undo
490 490
  */
491 491
 function geodir_get_postoverall($post_id = 0)
492 492
 {
493
-    global $wpdb, $plugin_prefix;
493
+	global $wpdb, $plugin_prefix;
494 494
 
495
-    $post_type = get_post_type($post_id);
496
-    $detail_table = $plugin_prefix . $post_type . '_detail';
495
+	$post_type = get_post_type($post_id);
496
+	$detail_table = $plugin_prefix . $post_type . '_detail';
497 497
 
498
-    if ($wpdb->get_var("SHOW TABLES LIKE '" . $detail_table . "'") == $detail_table) {
498
+	if ($wpdb->get_var("SHOW TABLES LIKE '" . $detail_table . "'") == $detail_table) {
499 499
 
500
-        $post_ratings = $wpdb->get_var(
501
-            $wpdb->prepare(
502
-                "SELECT overall_rating FROM " . $detail_table . " WHERE post_id = %d",
503
-                array($post_id)
504
-            )
505
-        );
500
+		$post_ratings = $wpdb->get_var(
501
+			$wpdb->prepare(
502
+				"SELECT overall_rating FROM " . $detail_table . " WHERE post_id = %d",
503
+				array($post_id)
504
+			)
505
+		);
506 506
 
507 507
 
508
-    } else {
509
-        $post_ratings = get_post_meta($post_id, 'overall_rating');
510
-    }
508
+	} else {
509
+		$post_ratings = get_post_meta($post_id, 'overall_rating');
510
+	}
511 511
 
512
-    if ($post_ratings)
513
-        return $post_ratings;
514
-    else
515
-        return false;
512
+	if ($post_ratings)
513
+		return $post_ratings;
514
+	else
515
+		return false;
516 516
 }
517 517
 
518 518
 
@@ -529,19 +529,19 @@  discard block
 block discarded – undo
529 529
  */
530 530
 function geodir_get_review($comment_id = 0)
531 531
 {
532
-    global $wpdb;
533
-
534
-    $reatings = $wpdb->get_row(
535
-        $wpdb->prepare(
536
-            "SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id = %d",
537
-            array($comment_id)
538
-        )
539
-    );
540
-
541
-    if (!empty($reatings))
542
-        return $reatings;
543
-    else
544
-        return false;
532
+	global $wpdb;
533
+
534
+	$reatings = $wpdb->get_row(
535
+		$wpdb->prepare(
536
+			"SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id = %d",
537
+			array($comment_id)
538
+		)
539
+	);
540
+
541
+	if (!empty($reatings))
542
+		return $reatings;
543
+	else
544
+		return false;
545 545
 }
546 546
 
547 547
 /**
@@ -557,19 +557,19 @@  discard block
 block discarded – undo
557 557
  */
558 558
 function geodir_get_review_total($post_id = 0)
559 559
 {
560
-    global $wpdb;
561
-
562
-    $results = $wpdb->get_var(
563
-        $wpdb->prepare(
564
-            "SELECT SUM(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
565
-            array($post_id)
566
-        )
567
-    );
568
-
569
-    if (!empty($results))
570
-        return $results;
571
-    else
572
-        return false;
560
+	global $wpdb;
561
+
562
+	$results = $wpdb->get_var(
563
+		$wpdb->prepare(
564
+			"SELECT SUM(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
565
+			array($post_id)
566
+		)
567
+	);
568
+
569
+	if (!empty($results))
570
+		return $results;
571
+	else
572
+		return false;
573 573
 }
574 574
 
575 575
 /**
@@ -585,18 +585,18 @@  discard block
 block discarded – undo
585 585
  */
586 586
 function geodir_get_review_count_by_user_id($user_id = 0)
587 587
 {
588
-    global $wpdb;
589
-    $results = $wpdb->get_var(
590
-        $wpdb->prepare(
591
-            "SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE user_id = %d AND status=1 AND overall_rating>0",
592
-            array($user_id)
593
-        )
594
-    );
595
-
596
-    if (!empty($results))
597
-        return $results;
598
-    else
599
-        return false;
588
+	global $wpdb;
589
+	$results = $wpdb->get_var(
590
+		$wpdb->prepare(
591
+			"SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE user_id = %d AND status=1 AND overall_rating>0",
592
+			array($user_id)
593
+		)
594
+	);
595
+
596
+	if (!empty($results))
597
+		return $results;
598
+	else
599
+		return false;
600 600
 }
601 601
 
602 602
 /**
@@ -614,27 +614,27 @@  discard block
 block discarded – undo
614 614
  */
615 615
 function geodir_get_post_rating($post_id = 0, $force_query = 0)
616 616
 {
617
-    global $wpdb, $post;
618
-
619
-    if (isset($post->ID) && $post->ID == $post_id && !$force_query) {
620
-        if (isset($post->rating_count) && $post->rating_count > 0 && isset($post->overall_rating) && $post->overall_rating > 0) {
621
-            return $post->overall_rating;
622
-        } else {
623
-            return 0;
624
-        }
625
-    }
626
-
627
-    $results = $wpdb->get_var(
628
-        $wpdb->prepare(
629
-            "SELECT COALESCE(avg(overall_rating),0) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
630
-            array($post_id)
631
-        )
632
-    );
633
-
634
-    if (!empty($results))
635
-        return $results;
636
-    else
637
-        return false;
617
+	global $wpdb, $post;
618
+
619
+	if (isset($post->ID) && $post->ID == $post_id && !$force_query) {
620
+		if (isset($post->rating_count) && $post->rating_count > 0 && isset($post->overall_rating) && $post->overall_rating > 0) {
621
+			return $post->overall_rating;
622
+		} else {
623
+			return 0;
624
+		}
625
+	}
626
+
627
+	$results = $wpdb->get_var(
628
+		$wpdb->prepare(
629
+			"SELECT COALESCE(avg(overall_rating),0) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
630
+			array($post_id)
631
+		)
632
+	);
633
+
634
+	if (!empty($results))
635
+		return $results;
636
+	else
637
+		return false;
638 638
 }
639 639
 
640 640
 /**
@@ -650,19 +650,19 @@  discard block
 block discarded – undo
650 650
  */
651 651
 function geodir_get_review_count_total($post_id = 0)
652 652
 {
653
-    global $wpdb;
654
-
655
-    $results = $wpdb->get_var(
656
-        $wpdb->prepare(
657
-            "SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
658
-            array($post_id)
659
-        )
660
-    );
661
-
662
-    if (!empty($results))
663
-        return $results;
664
-    else
665
-        return false;
653
+	global $wpdb;
654
+
655
+	$results = $wpdb->get_var(
656
+		$wpdb->prepare(
657
+			"SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
658
+			array($post_id)
659
+		)
660
+	);
661
+
662
+	if (!empty($results))
663
+		return $results;
664
+	else
665
+		return false;
666 666
 }
667 667
 
668 668
 /**
@@ -679,20 +679,20 @@  discard block
 block discarded – undo
679 679
  */
680 680
 function geodir_get_comments_number($post_id = 0)
681 681
 {
682
-    global $wpdb;
682
+	global $wpdb;
683 683
 
684
-    $results = $wpdb->get_var(
685
-        $wpdb->prepare(
686
-            "SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
687
-            array($post_id)
688
-        )
689
-    );
684
+	$results = $wpdb->get_var(
685
+		$wpdb->prepare(
686
+			"SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
687
+			array($post_id)
688
+		)
689
+	);
690 690
 
691 691
 
692
-    if (!empty($results))
693
-        return $results;
694
-    else
695
-        return false;
692
+	if (!empty($results))
693
+		return $results;
694
+	else
695
+		return false;
696 696
 }
697 697
 
698 698
 /**
@@ -708,19 +708,19 @@  discard block
 block discarded – undo
708 708
  */
709 709
 function geodir_get_commentoverall($comment_id = 0)
710 710
 {
711
-    global $wpdb;
712
-
713
-    $reatings = $wpdb->get_var(
714
-        $wpdb->prepare(
715
-            "SELECT overall_rating FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id = %d",
716
-            array($comment_id)
717
-        )
718
-    );
719
-
720
-    if ($reatings)
721
-        return $reatings;
722
-    else
723
-        return false;
711
+	global $wpdb;
712
+
713
+	$reatings = $wpdb->get_var(
714
+		$wpdb->prepare(
715
+			"SELECT overall_rating FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id = %d",
716
+			array($comment_id)
717
+		)
718
+	);
719
+
720
+	if ($reatings)
721
+		return $reatings;
722
+	else
723
+		return false;
724 724
 }
725 725
 
726 726
 /**
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
  */
735 735
 function geodir_get_commentoverall_number($post_id = 0)
736 736
 {
737
-    return geodir_get_post_rating($post_id);
737
+	return geodir_get_post_rating($post_id);
738 738
 }
739 739
 
740 740
 
@@ -752,102 +752,102 @@  discard block
 block discarded – undo
752 752
  */
753 753
 function geodir_comment_template($comment_template)
754 754
 {
755
-    global $post;
755
+	global $post;
756 756
 
757
-    $post_types = geodir_get_posttypes();
757
+	$post_types = geodir_get_posttypes();
758 758
 
759
-    if (!(is_singular() && (have_comments() || (isset($post->comment_status) && 'open' == $post->comment_status)))) {
760
-        return;
761
-    }
762
-    if (in_array($post->post_type, $post_types)) { // assuming there is a post type called business
763
-        if (geodir_cpt_has_rating_disabled($post->post_type)) {
764
-            return $comment_template;
765
-        }
759
+	if (!(is_singular() && (have_comments() || (isset($post->comment_status) && 'open' == $post->comment_status)))) {
760
+		return;
761
+	}
762
+	if (in_array($post->post_type, $post_types)) { // assuming there is a post type called business
763
+		if (geodir_cpt_has_rating_disabled($post->post_type)) {
764
+			return $comment_template;
765
+		}
766 766
         
767
-        $template = locate_template(array("geodirectory/reviews.php")); // Use theme template if available
768
-        if (!$template) {
769
-            $template = dirname(__FILE__) . '/reviews.php';
770
-        }
771
-        return $template;
772
-    }
767
+		$template = locate_template(array("geodirectory/reviews.php")); // Use theme template if available
768
+		if (!$template) {
769
+			$template = dirname(__FILE__) . '/reviews.php';
770
+		}
771
+		return $template;
772
+	}
773 773
 }
774 774
 
775 775
 add_filter("comments_template", "geodir_comment_template");
776 776
 
777 777
 
778 778
 if (!function_exists('geodir_comment')) {
779
-    /**
780
-     * Comment HTML markup.
781
-     *
782
-     * @since 1.0.0
783
-     * @package GeoDirectory
784
-     * @global object $post The current post object.
785
-     * @param object $comment The comment object.
786
-     * @param string|array $args {
787
-     *     Optional. Formatting options.
788
-     *
789
-     *     @type object $walker            Instance of a Walker class to list comments. Default null.
790
-     *     @type int    $max_depth         The maximum comments depth. Default empty.
791
-     *     @type string $style             The style of list ordering. Default 'ul'. Accepts 'ul', 'ol'.
792
-     *     @type string $callback          Callback function to use. Default null.
793
-     *     @type string $end-callback      Callback function to use at the end. Default null.
794
-     *     @type string $type              Type of comments to list.
795
-     *                                     Default 'all'. Accepts 'all', 'comment', 'pingback', 'trackback', 'pings'.
796
-     *     @type int    $page              Page ID to list comments for. Default empty.
797
-     *     @type int    $per_page          Number of comments to list per page. Default empty.
798
-     *     @type int    $avatar_size       Height and width dimensions of the avatar size. Default 32.
799
-     *     @type string $reverse_top_level Ordering of the listed comments. Default null. Accepts 'desc', 'asc'.
800
-     *     @type bool   $reverse_children  Whether to reverse child comments in the list. Default null.
801
-     *     @type string $format            How to format the comments list.
802
-     *                                     Default 'html5' if the theme supports it. Accepts 'html5', 'xhtml'.
803
-     *     @type bool   $short_ping        Whether to output short pings. Default false.
804
-     *     @type bool   $echo              Whether to echo the output or return it. Default true.
805
-     * }
806
-     * @param int $depth Depth of comment.
807
-     */
808
-    function geodir_comment($comment, $args, $depth)
809
-    {
810
-        $GLOBALS['comment'] = $comment;
811
-        switch ($comment->comment_type) :
812
-            case 'pingback' :
813
-            case 'trackback' :
814
-                // Display trackbacks differently than normal comments.
815
-                ?>
779
+	/**
780
+	 * Comment HTML markup.
781
+	 *
782
+	 * @since 1.0.0
783
+	 * @package GeoDirectory
784
+	 * @global object $post The current post object.
785
+	 * @param object $comment The comment object.
786
+	 * @param string|array $args {
787
+	 *     Optional. Formatting options.
788
+	 *
789
+	 *     @type object $walker            Instance of a Walker class to list comments. Default null.
790
+	 *     @type int    $max_depth         The maximum comments depth. Default empty.
791
+	 *     @type string $style             The style of list ordering. Default 'ul'. Accepts 'ul', 'ol'.
792
+	 *     @type string $callback          Callback function to use. Default null.
793
+	 *     @type string $end-callback      Callback function to use at the end. Default null.
794
+	 *     @type string $type              Type of comments to list.
795
+	 *                                     Default 'all'. Accepts 'all', 'comment', 'pingback', 'trackback', 'pings'.
796
+	 *     @type int    $page              Page ID to list comments for. Default empty.
797
+	 *     @type int    $per_page          Number of comments to list per page. Default empty.
798
+	 *     @type int    $avatar_size       Height and width dimensions of the avatar size. Default 32.
799
+	 *     @type string $reverse_top_level Ordering of the listed comments. Default null. Accepts 'desc', 'asc'.
800
+	 *     @type bool   $reverse_children  Whether to reverse child comments in the list. Default null.
801
+	 *     @type string $format            How to format the comments list.
802
+	 *                                     Default 'html5' if the theme supports it. Accepts 'html5', 'xhtml'.
803
+	 *     @type bool   $short_ping        Whether to output short pings. Default false.
804
+	 *     @type bool   $echo              Whether to echo the output or return it. Default true.
805
+	 * }
806
+	 * @param int $depth Depth of comment.
807
+	 */
808
+	function geodir_comment($comment, $args, $depth)
809
+	{
810
+		$GLOBALS['comment'] = $comment;
811
+		switch ($comment->comment_type) :
812
+			case 'pingback' :
813
+			case 'trackback' :
814
+				// Display trackbacks differently than normal comments.
815
+				?>
816 816
                 <li <?php comment_class('geodir-comment'); ?> id="comment-<?php comment_ID(); ?>">
817 817
                 <p><?php _e('Pingback:', 'geodirectory'); ?> <?php comment_author_link(); ?> <?php edit_comment_link(__('(Edit)', 'geodirectory'), '<span class="edit-link">', '</span>'); ?></p>
818 818
                 <?php
819
-                break;
820
-            default :
821
-                // Proceed with normal comments.
822
-                global $post;
823
-                ?>
819
+				break;
820
+			default :
821
+				// Proceed with normal comments.
822
+				global $post;
823
+				?>
824 824
             <li <?php comment_class('geodir-comment'); ?> id="li-comment-<?php comment_ID(); ?>">
825 825
                 <article id="comment-<?php comment_ID(); ?>" class="comment">
826 826
                     <header class="comment-meta comment-author vcard">
827 827
                         <?php
828
-                        /**
829
-                         * Filter to modify comment avatar size
830
-                         *
831
-                         * You can use this filter to change comment avatar size.
832
-                         *
833
-                         * @since 1.0.0
834
-                         * @package GeoDirectory
835
-                         */
836
-                        $avatar_size = apply_filters('geodir_comment_avatar_size', 44);
837
-                        echo get_avatar($comment, $avatar_size);
838
-                        printf('<cite><b class="reviewer">%1$s</b> %2$s</cite>',
839
-                            get_comment_author_link(),
840
-                            // If current post author is also comment author, make it known visually.
841
-                            ($comment->user_id === $post->post_author) ? '<span>' . __('Post author', 'geodirectory') . '</span>' : ''
842
-                        );
843
-                        echo "<span class='item'><small><span class='fn'>$post->post_title</span></small></span>";
844
-                        printf('<a href="%1$s"><time datetime="%2$s" class="dtreviewed">%3$s<span class="value-title" title="%2$s"></span></time></a>',
845
-                            esc_url(get_comment_link($comment->comment_ID)),
846
-                            get_comment_time('c'),
847
-                            /* translators: 1: date, 2: time */
848
-                            sprintf(__('%1$s at %2$s', 'geodirectory'), get_comment_date(), get_comment_time())
849
-                        );
850
-                        ?>
828
+						/**
829
+						 * Filter to modify comment avatar size
830
+						 *
831
+						 * You can use this filter to change comment avatar size.
832
+						 *
833
+						 * @since 1.0.0
834
+						 * @package GeoDirectory
835
+						 */
836
+						$avatar_size = apply_filters('geodir_comment_avatar_size', 44);
837
+						echo get_avatar($comment, $avatar_size);
838
+						printf('<cite><b class="reviewer">%1$s</b> %2$s</cite>',
839
+							get_comment_author_link(),
840
+							// If current post author is also comment author, make it known visually.
841
+							($comment->user_id === $post->post_author) ? '<span>' . __('Post author', 'geodirectory') . '</span>' : ''
842
+						);
843
+						echo "<span class='item'><small><span class='fn'>$post->post_title</span></small></span>";
844
+						printf('<a href="%1$s"><time datetime="%2$s" class="dtreviewed">%3$s<span class="value-title" title="%2$s"></span></time></a>',
845
+							esc_url(get_comment_link($comment->comment_ID)),
846
+							get_comment_time('c'),
847
+							/* translators: 1: date, 2: time */
848
+							sprintf(__('%1$s at %2$s', 'geodirectory'), get_comment_date(), get_comment_time())
849
+						);
850
+						?>
851 851
                     </header>
852 852
                     <!-- .comment-meta -->
853 853
 
@@ -871,47 +871,47 @@  discard block
 block discarded – undo
871 871
                 </article>
872 872
                 <!-- #comment-## -->
873 873
                 <?php
874
-                break;
875
-        endswitch; // end comment_type check
876
-    }
874
+				break;
875
+		endswitch; // end comment_type check
876
+	}
877 877
 }
878 878
 
879 879
 
880 880
 add_filter('get_comments_number', 'geodir_fix_comment_count', 10, 2);
881 881
 if (!function_exists('geodir_fix_comment_count')) {
882
-    /**
883
-     * Fix comment count by not listing replies as reviews
884
-     *
885
-     * @since 1.0.0
886
-     * @package GeoDirectory
887
-     * @global object $post The current post object.
888
-     * @param int $count The comment count.
889
-     * @param int $post_id The post ID.
890
-     * @todo $post is unreachable since the function return the count before that variable.
891
-     * @return bool|null|string The comment count.
892
-     */
893
-    function geodir_fix_comment_count($count, $post_id)
894
-    {
895
-        if (!is_admin() || strpos($_SERVER['REQUEST_URI'], 'admin-ajax.php')) {
896
-            global $post;
897
-            $post_types = geodir_get_posttypes();
898
-
899
-            if (in_array(get_post_type($post_id), $post_types) && !geodir_cpt_has_rating_disabled((int)$post_id)) {
900
-                $review_count = geodir_get_review_count_total($post_id);
901
-                return $review_count;
902
-
903
-                if ($post && isset($post->rating_count)) {
904
-                    return $post->rating_count;
905
-                } else {
906
-                    return geodir_get_comments_number($post_id);
907
-                }
908
-            } else {
909
-                return $count;
910
-            }
911
-        } else {
912
-            return $count;
913
-        }
914
-    }
882
+	/**
883
+	 * Fix comment count by not listing replies as reviews
884
+	 *
885
+	 * @since 1.0.0
886
+	 * @package GeoDirectory
887
+	 * @global object $post The current post object.
888
+	 * @param int $count The comment count.
889
+	 * @param int $post_id The post ID.
890
+	 * @todo $post is unreachable since the function return the count before that variable.
891
+	 * @return bool|null|string The comment count.
892
+	 */
893
+	function geodir_fix_comment_count($count, $post_id)
894
+	{
895
+		if (!is_admin() || strpos($_SERVER['REQUEST_URI'], 'admin-ajax.php')) {
896
+			global $post;
897
+			$post_types = geodir_get_posttypes();
898
+
899
+			if (in_array(get_post_type($post_id), $post_types) && !geodir_cpt_has_rating_disabled((int)$post_id)) {
900
+				$review_count = geodir_get_review_count_total($post_id);
901
+				return $review_count;
902
+
903
+				if ($post && isset($post->rating_count)) {
904
+					return $post->rating_count;
905
+				} else {
906
+					return geodir_get_comments_number($post_id);
907
+				}
908
+			} else {
909
+				return $count;
910
+			}
911
+		} else {
912
+			return $count;
913
+		}
914
+	}
915 915
 }
916 916
 
917 917
 /**
@@ -929,14 +929,14 @@  discard block
 block discarded – undo
929 929
  */
930 930
 function geodir_get_rating_stars($rating, $post_id, $small = false)
931 931
 {
932
-    if (!empty($post_id) && geodir_cpt_has_rating_disabled((int)$post_id)) {
933
-        return NULL;
934
-    }
935
-    $a_rating = $rating / 5 * 100;
936
-
937
-    if ($small) {
938
-        $r_html = '<div class="rating"><div class="gd_rating_map" data-average="' . $rating . '" data-id="' . $post_id . '"><div class="geodir_RatingColor" ></div><div class="geodir_RatingAverage_small" style="width: ' . $a_rating . '%;"></div><div class="geodir_Star_small"></div></div></div>';
939
-    } else {
932
+	if (!empty($post_id) && geodir_cpt_has_rating_disabled((int)$post_id)) {
933
+		return NULL;
934
+	}
935
+	$a_rating = $rating / 5 * 100;
936
+
937
+	if ($small) {
938
+		$r_html = '<div class="rating"><div class="gd_rating_map" data-average="' . $rating . '" data-id="' . $post_id . '"><div class="geodir_RatingColor" ></div><div class="geodir_RatingAverage_small" style="width: ' . $a_rating . '%;"></div><div class="geodir_Star_small"></div></div></div>';
939
+	} else {
940 940
 		if (function_exists('geodir_reviewrating_draw_overall_rating')) {
941 941
 			// Show rating stars from review rating manager
942 942
 			$r_html = geodir_reviewrating_draw_overall_rating($rating);
@@ -953,8 +953,8 @@  discard block
 block discarded – undo
953 953
 			}
954 954
 			$r_html = '<div class="geodir-rating" style="' . $attach_style . '"><div class="gd_rating_show" data-average="' . $rating . '" data-id="' . $post_id . '"><div class="geodir_RatingAverage" style="width: ' . $a_rating . '%;"></div><div class="geodir_Star">' . $rating_img . $rating_img . $rating_img . $rating_img . $rating_img . '</div></div></div>';
955 955
 		}
956
-    }
957
-    return apply_filters('geodir_get_rating_stars_html', $r_html, $rating, 5);
956
+	}
957
+	return apply_filters('geodir_get_rating_stars_html', $r_html, $rating, 5);
958 958
 }
959 959
 
960 960
 /**
@@ -968,23 +968,23 @@  discard block
 block discarded – undo
968 968
 function geodir_is_reviews_show($pageview = '')
969 969
 {
970 970
 
971
-    $active_tabs = get_option('geodir_detail_page_tabs_excluded');
972
-
973
-    $is_display = true;
974
-    if (!empty($active_tabs) && in_array('reviews', $active_tabs))
975
-        $is_display = false;
976
-
977
-    /**
978
-     * Filter to change display value.
979
-     *
980
-     * You can use this filter to change the is_display value.
981
-     *
982
-     * @since 1.0.0
983
-     * @package GeoDirectory
984
-     * @param bool $is_display Display ratings when set to true.
985
-     * @param string $pageview The view template. Ex: listview, gridview etc.
986
-     */
987
-    return apply_filters('geodir_is_reviews_show', $is_display, $pageview);
971
+	$active_tabs = get_option('geodir_detail_page_tabs_excluded');
972
+
973
+	$is_display = true;
974
+	if (!empty($active_tabs) && in_array('reviews', $active_tabs))
975
+		$is_display = false;
976
+
977
+	/**
978
+	 * Filter to change display value.
979
+	 *
980
+	 * You can use this filter to change the is_display value.
981
+	 *
982
+	 * @since 1.0.0
983
+	 * @package GeoDirectory
984
+	 * @param bool $is_display Display ratings when set to true.
985
+	 * @param string $pageview The view template. Ex: listview, gridview etc.
986
+	 */
987
+	return apply_filters('geodir_is_reviews_show', $is_display, $pageview);
988 988
 }
989 989
 
990 990
 
@@ -992,9 +992,9 @@  discard block
 block discarded – undo
992 992
  * If Disqus plugin is active, do some fixes to show on blogs but no on GD post types
993 993
  */
994 994
 if(function_exists('dsq_can_replace')) {
995
-    remove_filter('comments_template', 'dsq_comments_template');
996
-    add_filter('comments_template', 'dsq_comments_template', 100);
997
-    add_filter('pre_option_disqus_active', 'geodir_option_disqus_active',10,1);
995
+	remove_filter('comments_template', 'dsq_comments_template');
996
+	add_filter('comments_template', 'dsq_comments_template', 100);
997
+	add_filter('pre_option_disqus_active', 'geodir_option_disqus_active',10,1);
998 998
 }
999 999
 
1000 1000
 
@@ -1008,14 +1008,14 @@  discard block
 block discarded – undo
1008 1008
  * @return string `1` if active `0` if disabled.
1009 1009
  */
1010 1010
 function geodir_option_disqus_active($disqus_active){
1011
-    global $post;
1012
-    $all_postypes = geodir_get_posttypes();
1011
+	global $post;
1012
+	$all_postypes = geodir_get_posttypes();
1013 1013
 
1014
-    if(isset($post->post_type) && is_array($all_postypes) && in_array($post->post_type,$all_postypes)){
1015
-        $disqus_active = '0';
1016
-    }
1014
+	if(isset($post->post_type) && is_array($all_postypes) && in_array($post->post_type,$all_postypes)){
1015
+		$disqus_active = '0';
1016
+	}
1017 1017
 
1018
-    return $disqus_active;
1018
+	return $disqus_active;
1019 1019
 }
1020 1020
 
1021 1021
 /**
@@ -1029,22 +1029,22 @@  discard block
 block discarded – undo
1029 1029
  * @return array Modified tabs array.
1030 1030
  */
1031 1031
 function geodir_detail_reviews_tab_title($tabs_arr) {
1032
-    $post_type = geodir_get_current_posttype();
1032
+	$post_type = geodir_get_current_posttype();
1033 1033
 
1034
-    if (!empty($tabs_arr) && !empty($tabs_arr['reviews']) && isset($tabs_arr['reviews']['heading_text']) && $post_type != '' && geodir_cpt_has_rating_disabled($post_type)) {
1035
-        $label_reviews = __('Comments', 'geodirectory');
1034
+	if (!empty($tabs_arr) && !empty($tabs_arr['reviews']) && isset($tabs_arr['reviews']['heading_text']) && $post_type != '' && geodir_cpt_has_rating_disabled($post_type)) {
1035
+		$label_reviews = __('Comments', 'geodirectory');
1036 1036
         
1037
-        if (defined('GEODIR_CP_VERSION')) {
1038
-            $post_types = geodir_get_posttypes('array');
1037
+		if (defined('GEODIR_CP_VERSION')) {
1038
+			$post_types = geodir_get_posttypes('array');
1039 1039
             
1040
-            if (!empty($post_types[$post_type]['labels']['label_reviews'])) {
1041
-                $label_reviews = stripslashes(__($post_types[$post_type]['labels']['label_reviews'], 'geodirectory'));
1042
-            }
1043
-        }
1040
+			if (!empty($post_types[$post_type]['labels']['label_reviews'])) {
1041
+				$label_reviews = stripslashes(__($post_types[$post_type]['labels']['label_reviews'], 'geodirectory'));
1042
+			}
1043
+		}
1044 1044
         
1045
-        $tabs_arr['reviews']['heading_text'] = $label_reviews;
1046
-    }
1045
+		$tabs_arr['reviews']['heading_text'] = $label_reviews;
1046
+	}
1047 1047
     
1048
-    return $tabs_arr;
1048
+	return $tabs_arr;
1049 1049
 }
1050 1050
 add_filter('geodir_detail_page_tab_list_extend', 'geodir_detail_reviews_tab_title', 1000, 1);
1051 1051
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
67 67
  */
68 68
 function geodir_comment_rating_meta($comment) {
69 69
     $post_type = get_post_type($comment->comment_post_ID);
70
-	if (in_array($post_type, (array)geodir_get_posttypes()) && (int)$comment->comment_parent == 0 && !(!empty($post_type) && geodir_cpt_has_rating_disabled($post_type))) {
70
+	if (in_array($post_type, (array) geodir_get_posttypes()) && (int) $comment->comment_parent == 0 && !(!empty($post_type) && geodir_cpt_has_rating_disabled($post_type))) {
71 71
 		$rating = geodir_get_commentoverall($comment->comment_ID);
72 72
 		
73
-		if ((int)get_option('geodir_reviewrating_enable_font_awesome') == 1) {
73
+		if ((int) get_option('geodir_reviewrating_enable_font_awesome') == 1) {
74 74
 			$star_texts = array();
75 75
 			$star_texts[] = __('Terrible', 'geodirectory');
76 76
 			$star_texts[] = __('Poor', 'geodirectory');
@@ -81,13 +81,13 @@  discard block
 block discarded – undo
81 81
 			echo geodir_font_awesome_rating_form_html('', $star_texts, $rating);
82 82
 		} else {			
83 83
 			if ($rating) {
84
-				echo '<div class="gd_rating" data-average="' . $rating . '" data-id="5">';
84
+				echo '<div class="gd_rating" data-average="'.$rating.'" data-id="5">';
85 85
 
86 86
 			} else {
87 87
 				echo '<div class="gd_rating" data-average="0" data-id="5"></div>';
88 88
 			}
89 89
 		}
90
-		echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="' . $rating . '"  />';
90
+		echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="'.$rating.'"  />';
91 91
 	}
92 92
 }
93 93
 
@@ -140,9 +140,9 @@  discard block
 block discarded – undo
140 140
 {
141 141
 
142 142
     if (strpos($link, 'wp-login.php?') !== false) {
143
-        $link = str_replace(wp_login_url(),geodir_login_url(),$link);
143
+        $link = str_replace(wp_login_url(), geodir_login_url(), $link);
144 144
     }
145
-    $link = '<div class="gd_comment_replaylink">' . $link . '</div>';
145
+    $link = '<div class="gd_comment_replaylink">'.$link.'</div>';
146 146
 
147 147
     return $link;
148 148
 }
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 function geodir_cancle_replaylink($link)
160 160
 {
161 161
 
162
-    $link = '<span class="gd-cancel-replaylink">' . $link . '</span>';
162
+    $link = '<span class="gd-cancel-replaylink">'.$link.'</span>';
163 163
 
164 164
     return $link;
165 165
 }
@@ -199,10 +199,10 @@  discard block
 block discarded – undo
199 199
     if (isset($_REQUEST['geodir_overallrating'])) {
200 200
         $overall_rating = $_REQUEST['geodir_overallrating'];
201 201
         
202
-		if (isset($comment_info->comment_parent) && (int)$comment_info->comment_parent == 0) {
202
+		if (isset($comment_info->comment_parent) && (int) $comment_info->comment_parent == 0) {
203 203
             $overall_rating = $overall_rating > 0 ? $overall_rating : '0';
204 204
 
205
-            $sqlqry = $wpdb->prepare("INSERT INTO " . GEODIR_REVIEW_TABLE . " SET
205
+            $sqlqry = $wpdb->prepare("INSERT INTO ".GEODIR_REVIEW_TABLE." SET
206 206
 					post_id		= %d,
207 207
 					post_type = %s,
208 208
 					post_title	= %s,
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 
290 290
     $post_type = get_post_type($post_id);
291 291
 
292
-    $detail_table = $plugin_prefix . $post_type . '_detail';
292
+    $detail_table = $plugin_prefix.$post_type.'_detail';
293 293
 
294 294
     if ($comment_id) {
295 295
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 
298 298
         if (isset($old_rating)) {
299 299
 
300
-            $sqlqry = $wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET
300
+            $sqlqry = $wpdb->prepare("UPDATE ".GEODIR_REVIEW_TABLE." SET
301 301
 						overall_rating = %f,
302 302
 						status		= %s,
303 303
 						comment_content = %s 
@@ -339,18 +339,18 @@  discard block
 block discarded – undo
339 339
 
340 340
     $post_type = get_post_type($post_id);
341 341
 
342
-    $detail_table = $plugin_prefix . $post_type . '_detail';
342
+    $detail_table = $plugin_prefix.$post_type.'_detail';
343 343
 
344 344
     if (isset($_REQUEST['geodir_overallrating'])) {
345 345
 
346 346
         $overall_rating = $_REQUEST['geodir_overallrating'];
347 347
 
348
-        if (isset($comment_info->comment_parent) && (int)$comment_info->comment_parent == 0) {
348
+        if (isset($comment_info->comment_parent) && (int) $comment_info->comment_parent == 0) {
349 349
             $overall_rating = $overall_rating > 0 ? $overall_rating : '0';
350 350
 
351 351
             if (isset($old_rating)) {
352 352
 
353
-                $sqlqry = $wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET
353
+                $sqlqry = $wpdb->prepare("UPDATE ".GEODIR_REVIEW_TABLE." SET
354 354
 						overall_rating = %f,
355 355
 						status		= %s,
356 356
 						comment_content	= %s 
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 
389 389
     $wpdb->query(
390 390
         $wpdb->prepare(
391
-            "DELETE FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d",
391
+            "DELETE FROM ".GEODIR_REVIEW_TABLE." WHERE comment_id=%d",
392 392
             array($comment_id)
393 393
         )
394 394
     );
@@ -407,9 +407,9 @@  discard block
 block discarded – undo
407 407
  * @return string The comment content.
408 408
  */
409 409
 function geodir_wrap_comment_text($content, $comment = '') {
410
-    if (!empty($comment->comment_post_ID) && geodir_cpt_has_rating_disabled((int)$comment->comment_post_ID)) {
410
+    if (!empty($comment->comment_post_ID) && geodir_cpt_has_rating_disabled((int) $comment->comment_post_ID)) {
411 411
         if (!is_admin()) {
412
-            return '<div class="description">' . $content . '</div>';
412
+            return '<div class="description">'.$content.'</div>';
413 413
         } else {
414 414
             return $content;
415 415
         }
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
         if (!empty($comment))
419 419
             $rating = geodir_get_commentoverall($comment->comment_ID);
420 420
         if ($rating != 0 && !is_admin()) {
421
-            return '<div><div class="gd-rating-text">' . __('Overall Rating', 'geodirectory') . ': <div class="rating">' . $rating . '</div></div>' . geodir_get_rating_stars($rating, $comment->comment_ID) . '</div><div class="description">' . $content . '</div>';
421
+            return '<div><div class="gd-rating-text">'.__('Overall Rating', 'geodirectory').': <div class="rating">'.$rating.'</div></div>'.geodir_get_rating_stars($rating, $comment->comment_ID).'</div><div class="description">'.$content.'</div>';
422 422
         } else
423 423
             return $content;
424 424
     }
@@ -442,18 +442,18 @@  discard block
 block discarded – undo
442 442
     if (!$post_type) {
443 443
         $post_type = get_post_type($post_id);
444 444
     }
445
-    $detail_table = $plugin_prefix . $post_type . '_detail';
445
+    $detail_table = $plugin_prefix.$post_type.'_detail';
446 446
     $post_newrating = geodir_get_post_rating($post_id, 1);
447 447
     $post_newrating_count = geodir_get_review_count_total($post_id);
448 448
 
449 449
 
450 450
     //$post_newrating = ( (float)$post_oldrating - (float)$old_rating ) + (float)$overall_rating ;
451 451
 
452
-    if ($wpdb->get_var("SHOW TABLES LIKE '" . $detail_table . "'") == $detail_table) {
452
+    if ($wpdb->get_var("SHOW TABLES LIKE '".$detail_table."'") == $detail_table) {
453 453
 
454 454
         $wpdb->query(
455 455
             $wpdb->prepare(
456
-                "UPDATE " . $detail_table . " SET
456
+                "UPDATE ".$detail_table." SET
457 457
 						overall_rating = %f,
458 458
 						rating_count = %f
459 459
 						where post_id = %d",
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
      * @package GeoDirectory
473 473
      * @param int $post_id The post ID.
474 474
      */
475
-    do_action('geodir_update_postrating',$post_id);
475
+    do_action('geodir_update_postrating', $post_id);
476 476
 
477 477
 }
478 478
 
@@ -493,13 +493,13 @@  discard block
 block discarded – undo
493 493
     global $wpdb, $plugin_prefix;
494 494
 
495 495
     $post_type = get_post_type($post_id);
496
-    $detail_table = $plugin_prefix . $post_type . '_detail';
496
+    $detail_table = $plugin_prefix.$post_type.'_detail';
497 497
 
498
-    if ($wpdb->get_var("SHOW TABLES LIKE '" . $detail_table . "'") == $detail_table) {
498
+    if ($wpdb->get_var("SHOW TABLES LIKE '".$detail_table."'") == $detail_table) {
499 499
 
500 500
         $post_ratings = $wpdb->get_var(
501 501
             $wpdb->prepare(
502
-                "SELECT overall_rating FROM " . $detail_table . " WHERE post_id = %d",
502
+                "SELECT overall_rating FROM ".$detail_table." WHERE post_id = %d",
503 503
                 array($post_id)
504 504
             )
505 505
         );
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
 
534 534
     $reatings = $wpdb->get_row(
535 535
         $wpdb->prepare(
536
-            "SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id = %d",
536
+            "SELECT * FROM ".GEODIR_REVIEW_TABLE." WHERE comment_id = %d",
537 537
             array($comment_id)
538 538
         )
539 539
     );
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
 
562 562
     $results = $wpdb->get_var(
563 563
         $wpdb->prepare(
564
-            "SELECT SUM(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
564
+            "SELECT SUM(overall_rating) FROM ".GEODIR_REVIEW_TABLE." WHERE post_id = %d AND status=1 AND overall_rating>0",
565 565
             array($post_id)
566 566
         )
567 567
     );
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
     global $wpdb;
589 589
     $results = $wpdb->get_var(
590 590
         $wpdb->prepare(
591
-            "SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE user_id = %d AND status=1 AND overall_rating>0",
591
+            "SELECT COUNT(overall_rating) FROM ".GEODIR_REVIEW_TABLE." WHERE user_id = %d AND status=1 AND overall_rating>0",
592 592
             array($user_id)
593 593
         )
594 594
     );
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
 
627 627
     $results = $wpdb->get_var(
628 628
         $wpdb->prepare(
629
-            "SELECT COALESCE(avg(overall_rating),0) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
629
+            "SELECT COALESCE(avg(overall_rating),0) FROM ".GEODIR_REVIEW_TABLE." WHERE post_id = %d AND status=1 AND overall_rating>0",
630 630
             array($post_id)
631 631
         )
632 632
     );
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
 
655 655
     $results = $wpdb->get_var(
656 656
         $wpdb->prepare(
657
-            "SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
657
+            "SELECT COUNT(overall_rating) FROM ".GEODIR_REVIEW_TABLE." WHERE post_id = %d AND status=1 AND overall_rating>0",
658 658
             array($post_id)
659 659
         )
660 660
     );
@@ -683,7 +683,7 @@  discard block
 block discarded – undo
683 683
 
684 684
     $results = $wpdb->get_var(
685 685
         $wpdb->prepare(
686
-            "SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
686
+            "SELECT COUNT(overall_rating) FROM ".GEODIR_REVIEW_TABLE." WHERE post_id = %d AND status=1 AND overall_rating>0",
687 687
             array($post_id)
688 688
         )
689 689
     );
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 
713 713
     $reatings = $wpdb->get_var(
714 714
         $wpdb->prepare(
715
-            "SELECT overall_rating FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id = %d",
715
+            "SELECT overall_rating FROM ".GEODIR_REVIEW_TABLE." WHERE comment_id = %d",
716 716
             array($comment_id)
717 717
         )
718 718
     );
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
         
767 767
         $template = locate_template(array("geodirectory/reviews.php")); // Use theme template if available
768 768
         if (!$template) {
769
-            $template = dirname(__FILE__) . '/reviews.php';
769
+            $template = dirname(__FILE__).'/reviews.php';
770 770
         }
771 771
         return $template;
772 772
     }
@@ -838,7 +838,7 @@  discard block
 block discarded – undo
838 838
                         printf('<cite><b class="reviewer">%1$s</b> %2$s</cite>',
839 839
                             get_comment_author_link(),
840 840
                             // If current post author is also comment author, make it known visually.
841
-                            ($comment->user_id === $post->post_author) ? '<span>' . __('Post author', 'geodirectory') . '</span>' : ''
841
+                            ($comment->user_id === $post->post_author) ? '<span>'.__('Post author', 'geodirectory').'</span>' : ''
842 842
                         );
843 843
                         echo "<span class='item'><small><span class='fn'>$post->post_title</span></small></span>";
844 844
                         printf('<a href="%1$s"><time datetime="%2$s" class="dtreviewed">%3$s<span class="value-title" title="%2$s"></span></time></a>',
@@ -896,7 +896,7 @@  discard block
 block discarded – undo
896 896
             global $post;
897 897
             $post_types = geodir_get_posttypes();
898 898
 
899
-            if (in_array(get_post_type($post_id), $post_types) && !geodir_cpt_has_rating_disabled((int)$post_id)) {
899
+            if (in_array(get_post_type($post_id), $post_types) && !geodir_cpt_has_rating_disabled((int) $post_id)) {
900 900
                 $review_count = geodir_get_review_count_total($post_id);
901 901
                 return $review_count;
902 902
 
@@ -929,29 +929,29 @@  discard block
 block discarded – undo
929 929
  */
930 930
 function geodir_get_rating_stars($rating, $post_id, $small = false)
931 931
 {
932
-    if (!empty($post_id) && geodir_cpt_has_rating_disabled((int)$post_id)) {
932
+    if (!empty($post_id) && geodir_cpt_has_rating_disabled((int) $post_id)) {
933 933
         return NULL;
934 934
     }
935 935
     $a_rating = $rating / 5 * 100;
936 936
 
937 937
     if ($small) {
938
-        $r_html = '<div class="rating"><div class="gd_rating_map" data-average="' . $rating . '" data-id="' . $post_id . '"><div class="geodir_RatingColor" ></div><div class="geodir_RatingAverage_small" style="width: ' . $a_rating . '%;"></div><div class="geodir_Star_small"></div></div></div>';
938
+        $r_html = '<div class="rating"><div class="gd_rating_map" data-average="'.$rating.'" data-id="'.$post_id.'"><div class="geodir_RatingColor" ></div><div class="geodir_RatingAverage_small" style="width: '.$a_rating.'%;"></div><div class="geodir_Star_small"></div></div></div>';
939 939
     } else {
940 940
 		if (function_exists('geodir_reviewrating_draw_overall_rating')) {
941 941
 			// Show rating stars from review rating manager
942 942
 			$r_html = geodir_reviewrating_draw_overall_rating($rating);
943 943
 		} else {
944
-			$rating_img = '<img alt="rating icon" src="' . get_option('geodir_default_rating_star_icon') . '" />';
944
+			$rating_img = '<img alt="rating icon" src="'.get_option('geodir_default_rating_star_icon').'" />';
945 945
 			
946 946
 			/* fix rating star for safari */
947 947
 			$star_width = 23 * 5;
948 948
 			
949 949
 			if ($star_width > 0) {
950
-				$attach_style = 'max-width:' . $star_width . 'px';
950
+				$attach_style = 'max-width:'.$star_width.'px';
951 951
 			} else {
952 952
 				$attach_style = '';
953 953
 			}
954
-			$r_html = '<div class="geodir-rating" style="' . $attach_style . '"><div class="gd_rating_show" data-average="' . $rating . '" data-id="' . $post_id . '"><div class="geodir_RatingAverage" style="width: ' . $a_rating . '%;"></div><div class="geodir_Star">' . $rating_img . $rating_img . $rating_img . $rating_img . $rating_img . '</div></div></div>';
954
+			$r_html = '<div class="geodir-rating" style="'.$attach_style.'"><div class="gd_rating_show" data-average="'.$rating.'" data-id="'.$post_id.'"><div class="geodir_RatingAverage" style="width: '.$a_rating.'%;"></div><div class="geodir_Star">'.$rating_img.$rating_img.$rating_img.$rating_img.$rating_img.'</div></div></div>';
955 955
 		}
956 956
     }
957 957
     return apply_filters('geodir_get_rating_stars_html', $r_html, $rating, 5);
@@ -991,10 +991,10 @@  discard block
 block discarded – undo
991 991
 /*
992 992
  * If Disqus plugin is active, do some fixes to show on blogs but no on GD post types
993 993
  */
994
-if(function_exists('dsq_can_replace')) {
994
+if (function_exists('dsq_can_replace')) {
995 995
     remove_filter('comments_template', 'dsq_comments_template');
996 996
     add_filter('comments_template', 'dsq_comments_template', 100);
997
-    add_filter('pre_option_disqus_active', 'geodir_option_disqus_active',10,1);
997
+    add_filter('pre_option_disqus_active', 'geodir_option_disqus_active', 10, 1);
998 998
 }
999 999
 
1000 1000
 
@@ -1007,11 +1007,11 @@  discard block
 block discarded – undo
1007 1007
  * @param string $disqus_active Hook called before DB call for option so this is empty.
1008 1008
  * @return string `1` if active `0` if disabled.
1009 1009
  */
1010
-function geodir_option_disqus_active($disqus_active){
1010
+function geodir_option_disqus_active($disqus_active) {
1011 1011
     global $post;
1012 1012
     $all_postypes = geodir_get_posttypes();
1013 1013
 
1014
-    if(isset($post->post_type) && is_array($all_postypes) && in_array($post->post_type,$all_postypes)){
1014
+    if (isset($post->post_type) && is_array($all_postypes) && in_array($post->post_type, $all_postypes)) {
1015 1015
         $disqus_active = '0';
1016 1016
     }
1017 1017
 
Please login to merge, or discard this patch.
geodirectory_template_tags.php 3 patches
Braces   +34 added lines, -19 removed lines patch added patch discarded remove patch
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
         </script>
253 253
 
254 254
         <?php
255
-    }elseif(get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){
255
+    } elseif(get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){
256 256
         echo stripslashes(get_option('geodir_ga_tracking_code'));
257 257
     }
258 258
 }
@@ -291,13 +291,14 @@  discard block
 block discarded – undo
291 291
  */
292 292
 function geodir_add_async_forscript($url)
293 293
 {
294
-    if (strpos($url, '#asyncload')===false)
295
-        return $url;
296
-    else if (is_admin())
297
-        return str_replace('#asyncload', '', $url);
298
-    else
299
-        return str_replace('#asyncload', '', $url)."' async='async";
300
-}
294
+    if (strpos($url, '#asyncload')===false) {
295
+            return $url;
296
+    } else if (is_admin()) {
297
+            return str_replace('#asyncload', '', $url);
298
+    } else {
299
+            return str_replace('#asyncload', '', $url)."' async='async";
300
+    }
301
+    }
301 302
 add_filter('clean_url', 'geodir_add_async_forscript', 11, 1);
302 303
 
303 304
 /**
@@ -364,8 +365,10 @@  discard block
 block discarded – undo
364 365
 
365 366
     $half_pages_to_show = round($pages_to_show / 2);
366 367
 
367
-    if (geodir_is_page('home')) // dont apply default  pagination for geodirectory home page.
368
-        return;
368
+    if (geodir_is_page('home')) {
369
+    	// dont apply default  pagination for geodirectory home page.
370
+        return;
371
+    }
369 372
 
370 373
     if (!is_single()) {
371 374
         if (function_exists('geodir_location_geo_home_link')) {
@@ -485,11 +488,21 @@  discard block
 block discarded – undo
485 488
     }
486 489
     $dist_dif = 1000;
487 490
 
488
-    if ($dist <= 5000) $dist_dif = 500;
489
-    if ($dist <= 1000) $dist_dif = 100;
490
-    if ($dist <= 500) $dist_dif = 50;
491
-    if ($dist <= 100) $dist_dif = 10;
492
-    if ($dist <= 50) $dist_dif = 5;
491
+    if ($dist <= 5000) {
492
+    	$dist_dif = 500;
493
+    }
494
+    if ($dist <= 1000) {
495
+    	$dist_dif = 100;
496
+    }
497
+    if ($dist <= 500) {
498
+    	$dist_dif = 50;
499
+    }
500
+    if ($dist <= 100) {
501
+    	$dist_dif = 10;
502
+    }
503
+    if ($dist <= 50) {
504
+    	$dist_dif = 5;
505
+    }
493 506
 
494 507
     ?>
495 508
     <script type="text/javascript">
@@ -550,12 +563,14 @@  discard block
 block discarded – undo
550 563
  */
551 564
 function geodir_add_sharelocation_scripts() {
552 565
     $default_search_for_text = SEARCH_FOR_TEXT;
553
-    if (get_option('geodir_search_field_default_text'))
554
-        $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
566
+    if (get_option('geodir_search_field_default_text')) {
567
+            $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
568
+    }
555 569
 
556 570
     $default_near_text = NEAR_TEXT;
557
-    if (get_option('geodir_near_field_default_text'))
558
-        $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
571
+    if (get_option('geodir_near_field_default_text')) {
572
+            $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
573
+    }
559 574
     
560 575
     $search_location = geodir_get_default_location();
561 576
     
Please login to merge, or discard this patch.
Indentation   +337 added lines, -337 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  */
23 23
 function geodir_core_dequeue_script()
24 24
 {
25
-    wp_dequeue_script('flexslider');
25
+	wp_dequeue_script('flexslider');
26 26
 }
27 27
 
28 28
 add_action('wp_print_scripts', 'geodir_core_dequeue_script', 100);
@@ -35,168 +35,168 @@  discard block
 block discarded – undo
35 35
  */
36 36
 function geodir_templates_scripts()
37 37
 {
38
-    $is_detail_page = false;
39
-    $geodir_map_name = geodir_map_name();
38
+	$is_detail_page = false;
39
+	$geodir_map_name = geodir_map_name();
40 40
 
41
-    if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) {
42
-        $is_detail_page = true;
43
-    }
44
-
45
-    wp_enqueue_script('jquery');
46
-
47
-    wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js', array(), GEODIRECTORY_VERSION);
48
-    wp_enqueue_script('geodirectory-script');
41
+	if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) {
42
+		$is_detail_page = true;
43
+	}
49 44
 
50
-    $geodir_vars_data = array(
51
-        'siteurl' => get_option('siteurl'),
52
-        'geodir_plugin_url' => geodir_plugin_url(),
53
-        'geodir_lazy_load' => get_option('geodir_lazy_load',1),
54
-        'geodir_ajax_url' => geodir_get_ajax_url(),
55
-        'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'),
56
-        'is_rtl' => is_rtl() ? 1 : 0 // fix rtl issue
57
-    );
45
+	wp_enqueue_script('jquery');
46
+
47
+	wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js', array(), GEODIRECTORY_VERSION);
48
+	wp_enqueue_script('geodirectory-script');
49
+
50
+	$geodir_vars_data = array(
51
+		'siteurl' => get_option('siteurl'),
52
+		'geodir_plugin_url' => geodir_plugin_url(),
53
+		'geodir_lazy_load' => get_option('geodir_lazy_load',1),
54
+		'geodir_ajax_url' => geodir_get_ajax_url(),
55
+		'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'),
56
+		'is_rtl' => is_rtl() ? 1 : 0 // fix rtl issue
57
+	);
58
+
59
+	/**
60
+	 * Filter the `geodir_var` data array that outputs the  wp_localize_script() translations and variables.
61
+	 *
62
+	 * This is used by addons to add JS translatable variables.
63
+	 *
64
+	 * @since 1.4.4
65
+	 * @param array $geodir_vars_data {
66
+	 *    geodir var data used by addons to add JS translatable variables.
67
+	 *
68
+	 *    @type string $siteurl Site url.
69
+	 *    @type string $geodir_plugin_url Geodirectory core plugin url.
70
+	 *    @type string $geodir_ajax_url Geodirectory plugin ajax url.
71
+	 *    @type int $geodir_gd_modal Disable GD modal that displays slideshow images in popup?.
72
+	 *    @type int $is_rtl Checks if current locale is RTL.
73
+	 *
74
+	 * }
75
+	 */
76
+	$geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data);
77
+
78
+	wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data);
79
+
80
+	wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true);
81
+	if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');}
82
+
83
+	wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true);
84
+	wp_enqueue_script('geodirectory-lightbox-jquery');
85
+
86
+	wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true);
87
+	if ($is_detail_page) {
88
+		wp_enqueue_script('geodirectory-jquery-simplemodal');
89
+	}
58 90
 
59
-    /**
60
-     * Filter the `geodir_var` data array that outputs the  wp_localize_script() translations and variables.
61
-     *
62
-     * This is used by addons to add JS translatable variables.
63
-     *
64
-     * @since 1.4.4
65
-     * @param array $geodir_vars_data {
66
-     *    geodir var data used by addons to add JS translatable variables.
67
-     *
68
-     *    @type string $siteurl Site url.
69
-     *    @type string $geodir_plugin_url Geodirectory core plugin url.
70
-     *    @type string $geodir_ajax_url Geodirectory plugin ajax url.
71
-     *    @type int $geodir_gd_modal Disable GD modal that displays slideshow images in popup?.
72
-     *    @type int $is_rtl Checks if current locale is RTL.
73
-     *
74
-     * }
75
-     */
76
-    $geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data);
77
-
78
-    wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data);
79
-
80
-    wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true);
81
-    if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');}
82
-
83
-    wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true);
84
-    wp_enqueue_script('geodirectory-lightbox-jquery');
85
-
86
-    wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true);
87
-    if ($is_detail_page) {
88
-        wp_enqueue_script('geodirectory-jquery-simplemodal');
89
-    }
90
-
91
-    if (in_array($geodir_map_name, array('auto', 'google'))) {
92
-        $map_lang = "&language=" . geodir_get_map_default_language();
93
-        $map_key = "&key=" . geodir_get_map_api_key();
94
-        /**
95
-         * Filter the variables that are added to the end of the google maps script call.
96
-         *
97
-         * This i used to change things like google maps language etc.
98
-         *
99
-         * @since 1.0.0
100
-         * @param string $var The string to filter, default is empty string.
101
-         */
102
-        $map_extra = apply_filters('geodir_googlemap_script_extra', '');
103
-        wp_enqueue_script('geodirectory-googlemap-script', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra , '', NULL);
104
-    }
91
+	if (in_array($geodir_map_name, array('auto', 'google'))) {
92
+		$map_lang = "&language=" . geodir_get_map_default_language();
93
+		$map_key = "&key=" . geodir_get_map_api_key();
94
+		/**
95
+		 * Filter the variables that are added to the end of the google maps script call.
96
+		 *
97
+		 * This i used to change things like google maps language etc.
98
+		 *
99
+		 * @since 1.0.0
100
+		 * @param string $var The string to filter, default is empty string.
101
+		 */
102
+		$map_extra = apply_filters('geodir_googlemap_script_extra', '');
103
+		wp_enqueue_script('geodirectory-googlemap-script', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra , '', NULL);
104
+	}
105 105
     
106
-    if ($geodir_map_name == 'osm') {
107
-        // Leaflet OpenStreetMap
108
-        wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
109
-        wp_enqueue_style('geodirectory-leaflet-style');
106
+	if ($geodir_map_name == 'osm') {
107
+		// Leaflet OpenStreetMap
108
+		wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
109
+		wp_enqueue_style('geodirectory-leaflet-style');
110 110
             
111
-        wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
112
-        wp_enqueue_script('geodirectory-leaflet-script');
111
+		wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
112
+		wp_enqueue_script('geodirectory-leaflet-script');
113 113
         
114
-        wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.js', array(), GEODIRECTORY_VERSION);
115
-        wp_enqueue_script('geodirectory-leaflet-geo-script');
114
+		wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.js', array(), GEODIRECTORY_VERSION);
115
+		wp_enqueue_script('geodirectory-leaflet-geo-script');
116 116
         
117
-        if ($is_detail_page) {
118
-            wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION);
119
-            wp_enqueue_style('geodirectory-leaflet-routing-style');
117
+		if ($is_detail_page) {
118
+			wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION);
119
+			wp_enqueue_style('geodirectory-leaflet-routing-style');
120 120
                 
121
-            wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.js', array(), GEODIRECTORY_VERSION);
122
-            wp_enqueue_script('geodirectory-leaflet-routing-script');
123
-        }
124
-    }
125
-    wp_enqueue_script( 'jquery-ui-autocomplete' );
121
+			wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.js', array(), GEODIRECTORY_VERSION);
122
+			wp_enqueue_script('geodirectory-leaflet-routing-script');
123
+		}
124
+	}
125
+	wp_enqueue_script( 'jquery-ui-autocomplete' );
126 126
     
127
-    wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true);
128
-    wp_enqueue_script('geodirectory-goMap-script');
129
-
130
-
131
-    wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION);
132
-    wp_enqueue_script('chosen');
133
-
134
-    wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION);
135
-    wp_enqueue_script('geodirectory-choose-ajax');
136
-
137
-    wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.min.js', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true);
138
-
139
-    if (is_page() && geodir_is_page('add-listing')) {
140
-        // SCRIPT FOR UPLOAD
141
-        wp_enqueue_script('plupload-all');
142
-        wp_enqueue_script('jquery-ui-sortable');
143
-
144
-        wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true);
145
-        wp_enqueue_script('geodirectory-plupload-script');
146
-        // SCRIPT FOR UPLOAD END
147
-
148
-        // check_ajax_referer function is used to make sure no files are uplaoded remotly but it will fail if used between https and non https so we do the check below of the urls
149
-        if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
150
-            $ajax_url = admin_url('admin-ajax.php');
151
-        } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
152
-            $ajax_url = admin_url('admin-ajax.php');
153
-        } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
154
-            $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
155
-        } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
156
-            $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
157
-        } else {
158
-            $ajax_url = admin_url('admin-ajax.php');
159
-        }
127
+	wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true);
128
+	wp_enqueue_script('geodirectory-goMap-script');
129
+
130
+
131
+	wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION);
132
+	wp_enqueue_script('chosen');
133
+
134
+	wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION);
135
+	wp_enqueue_script('geodirectory-choose-ajax');
136
+
137
+	wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.min.js', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true);
138
+
139
+	if (is_page() && geodir_is_page('add-listing')) {
140
+		// SCRIPT FOR UPLOAD
141
+		wp_enqueue_script('plupload-all');
142
+		wp_enqueue_script('jquery-ui-sortable');
143
+
144
+		wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true);
145
+		wp_enqueue_script('geodirectory-plupload-script');
146
+		// SCRIPT FOR UPLOAD END
147
+
148
+		// check_ajax_referer function is used to make sure no files are uplaoded remotly but it will fail if used between https and non https so we do the check below of the urls
149
+		if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
150
+			$ajax_url = admin_url('admin-ajax.php');
151
+		} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
152
+			$ajax_url = admin_url('admin-ajax.php');
153
+		} elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
154
+			$ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
155
+		} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
156
+			$ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
157
+		} else {
158
+			$ajax_url = admin_url('admin-ajax.php');
159
+		}
160 160
 
161
-        // place js config array for plupload
162
-        $plupload_init = array(
163
-            'runtimes' => 'html5,silverlight,flash,browserplus,gears,html4',
164
-            'browse_button' => 'plupload-browse-button', // will be adjusted per uploader
165
-            'container' => 'plupload-upload-ui', // will be adjusted per uploader
166
-            'drop_element' => 'dropbox', // will be adjusted per uploader
167
-            'file_data_name' => 'async-upload', // will be adjusted per uploader
168
-            'multiple_queues' => true,
169
-            'max_file_size' => geodir_max_upload_size(),
170
-            'url' => $ajax_url,
171
-            'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
172
-            'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
173
-            'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')),
174
-            'multipart' => true,
175
-            'urlstream_upload' => true,
176
-            'multi_selection' => false, // will be added per uploader
177
-            // additional post data to send to our ajax hook
178
-            'multipart_params' => array(
179
-                '_ajax_nonce' => "", // will be added per uploader
180
-                'action' => 'plupload_action', // the ajax action name
181
-                'imgid' => 0 // will be added per uploader
182
-            )
183
-        );
184
-        $base_plupload_config = json_encode($plupload_init);
185
-
186
-        $gd_plupload_init = array('base_plupload_config' => $base_plupload_config,
187
-            'upload_img_size' => geodir_max_upload_size());
188
-
189
-        wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
190
-
191
-        wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload');
192
-    } // End if for add place page
193
-
194
-    wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
195
-    if ($is_detail_page) {
161
+		// place js config array for plupload
162
+		$plupload_init = array(
163
+			'runtimes' => 'html5,silverlight,flash,browserplus,gears,html4',
164
+			'browse_button' => 'plupload-browse-button', // will be adjusted per uploader
165
+			'container' => 'plupload-upload-ui', // will be adjusted per uploader
166
+			'drop_element' => 'dropbox', // will be adjusted per uploader
167
+			'file_data_name' => 'async-upload', // will be adjusted per uploader
168
+			'multiple_queues' => true,
169
+			'max_file_size' => geodir_max_upload_size(),
170
+			'url' => $ajax_url,
171
+			'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
172
+			'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
173
+			'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')),
174
+			'multipart' => true,
175
+			'urlstream_upload' => true,
176
+			'multi_selection' => false, // will be added per uploader
177
+			// additional post data to send to our ajax hook
178
+			'multipart_params' => array(
179
+				'_ajax_nonce' => "", // will be added per uploader
180
+				'action' => 'plupload_action', // the ajax action name
181
+				'imgid' => 0 // will be added per uploader
182
+			)
183
+		);
184
+		$base_plupload_config = json_encode($plupload_init);
185
+
186
+		$gd_plupload_init = array('base_plupload_config' => $base_plupload_config,
187
+			'upload_img_size' => geodir_max_upload_size());
188
+
189
+		wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
190
+
191
+		wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload');
192
+	} // End if for add place page
193
+
194
+	wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
195
+	if ($is_detail_page) {
196 196
 		wp_enqueue_script('geodirectory-post-custom-js');
197 197
 	}
198 198
 
199
-    // font awesome rating script
199
+	// font awesome rating script
200 200
 	if (get_option('geodir_reviewrating_enable_font_awesome')) {
201 201
 		wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION, true);
202 202
 		wp_enqueue_script('geodir-barrating-js');
@@ -205,11 +205,11 @@  discard block
 block discarded – undo
205 205
 		wp_enqueue_script('geodir-jRating-js');
206 206
 	}
207 207
 
208
-    wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
209
-    wp_enqueue_script('geodir-on-document-load');
208
+	wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
209
+	wp_enqueue_script('geodir-on-document-load');
210 210
 
211
-    wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
212
-    wp_enqueue_script('google-geometa');
211
+	wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
212
+	wp_enqueue_script('google-geometa');
213 213
 }
214 214
 
215 215
 /**
@@ -223,8 +223,8 @@  discard block
 block discarded – undo
223 223
  */
224 224
 function geodir_header_scripts()
225 225
 {
226
-    echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>';
227
-    echo stripslashes(get_option('geodir_header_scripts'));
226
+	echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>';
227
+	echo stripslashes(get_option('geodir_header_scripts'));
228 228
 }
229 229
 
230 230
 /**
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
  */
238 238
 function geodir_google_analytics_tracking_code()
239 239
 {
240
-    if(get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')){?>
240
+	if(get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')){?>
241 241
 
242 242
         <script>
243 243
             (function(i,s,o,g,r,a,m){ i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
@@ -252,9 +252,9 @@  discard block
 block discarded – undo
252 252
         </script>
253 253
 
254 254
         <?php
255
-    }elseif(get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){
256
-        echo stripslashes(get_option('geodir_ga_tracking_code'));
257
-    }
255
+	}elseif(get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){
256
+		echo stripslashes(get_option('geodir_ga_tracking_code'));
257
+	}
258 258
 }
259 259
 
260 260
 /**
@@ -268,16 +268,16 @@  discard block
 block discarded – undo
268 268
 function geodir_footer_scripts()
269 269
 {
270 270
 
271
-    echo stripslashes(get_option('geodir_footer_scripts'));
271
+	echo stripslashes(get_option('geodir_footer_scripts'));
272 272
 
273
-    /*
273
+	/*
274 274
      * Apple suck and can't/won't fix bugs: https://bugs.webkit.org/show_bug.cgi?id=136041
275 275
      *
276 276
      * Flexbox wont wrap on ios for search form items
277 277
      */
278
-    if ( !empty( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'] ) ) {
279
-        echo "<style>body .geodir-listing-search.gd-search-bar-style .geodir-loc-bar .clearfix.geodir-loc-bar-in .geodir-search .gd-search-input-wrapper{flex:50 1 auto !important;min-width: initial !important;width:auto !important;}.geodir-filter-container .geodir-filter-cat{width:auto !important;}</style>";
280
-    }
278
+	if ( !empty( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'] ) ) {
279
+		echo "<style>body .geodir-listing-search.gd-search-bar-style .geodir-loc-bar .clearfix.geodir-loc-bar-in .geodir-search .gd-search-input-wrapper{flex:50 1 auto !important;min-width: initial !important;width:auto !important;}.geodir-filter-container .geodir-filter-cat{width:auto !important;}</style>";
280
+	}
281 281
 }
282 282
 
283 283
 
@@ -291,12 +291,12 @@  discard block
 block discarded – undo
291 291
  */
292 292
 function geodir_add_async_forscript($url)
293 293
 {
294
-    if (strpos($url, '#asyncload')===false)
295
-        return $url;
296
-    else if (is_admin())
297
-        return str_replace('#asyncload', '', $url);
298
-    else
299
-        return str_replace('#asyncload', '', $url)."' async='async";
294
+	if (strpos($url, '#asyncload')===false)
295
+		return $url;
296
+	else if (is_admin())
297
+		return str_replace('#asyncload', '', $url);
298
+	else
299
+		return str_replace('#asyncload', '', $url)."' async='async";
300 300
 }
301 301
 add_filter('clean_url', 'geodir_add_async_forscript', 11, 1);
302 302
 
@@ -309,17 +309,17 @@  discard block
 block discarded – undo
309 309
 function geodir_templates_styles()
310 310
 {
311 311
 
312
-    wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION);
313
-    wp_enqueue_style('geodir-core-scss');
314
-    wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION);
312
+	wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION);
313
+	wp_enqueue_style('geodir-core-scss');
314
+	wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION);
315 315
 
316
-    if(is_rtl()){
317
-    wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION);
318
-    wp_enqueue_style('geodirectory-frontend-rtl-style');
319
-    }
316
+	if(is_rtl()){
317
+	wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION);
318
+	wp_enqueue_style('geodirectory-frontend-rtl-style');
319
+	}
320 320
 
321
-    wp_register_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION);
322
-    wp_enqueue_style('font-awesome');
321
+	wp_register_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION);
322
+	wp_enqueue_style('font-awesome');
323 323
 
324 324
 
325 325
 }
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
  */
334 334
 function geodir_get_sidebar()
335 335
 {
336
-    get_sidebar('geodirectory');
336
+	get_sidebar('geodirectory');
337 337
 }
338 338
 
339 339
 /**
@@ -352,122 +352,122 @@  discard block
 block discarded – undo
352 352
  * @param bool $always_show Do you want to show the pagination always? Default: false.
353 353
  */
354 354
 function geodir_pagination($before = '', $after = '', $prelabel = '', $nxtlabel = '', $pages_to_show = 5, $always_show = false) {
355
-    global $wp_query, $posts_per_page, $wpdb, $paged, $blog_id;
355
+	global $wp_query, $posts_per_page, $wpdb, $paged, $blog_id;
356 356
 
357
-    if (empty($prelabel)) {
358
-        $prelabel = '<strong>&laquo;</strong>';
359
-    }
357
+	if (empty($prelabel)) {
358
+		$prelabel = '<strong>&laquo;</strong>';
359
+	}
360 360
 
361
-    if (empty($nxtlabel)) {
362
-        $nxtlabel = '<strong>&raquo;</strong>';
363
-    }
361
+	if (empty($nxtlabel)) {
362
+		$nxtlabel = '<strong>&raquo;</strong>';
363
+	}
364 364
 
365
-    $half_pages_to_show = round($pages_to_show / 2);
365
+	$half_pages_to_show = round($pages_to_show / 2);
366 366
 
367
-    if (geodir_is_page('home')) // dont apply default  pagination for geodirectory home page.
368
-        return;
367
+	if (geodir_is_page('home')) // dont apply default  pagination for geodirectory home page.
368
+		return;
369 369
 
370
-    if (!is_single()) {
371
-        if (function_exists('geodir_location_geo_home_link')) {
372
-            remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
373
-        }
374
-        $numposts = $wp_query->found_posts;
370
+	if (!is_single()) {
371
+		if (function_exists('geodir_location_geo_home_link')) {
372
+			remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
373
+		}
374
+		$numposts = $wp_query->found_posts;
375 375
 
376
-        $max_page = ceil($numposts / $posts_per_page);
376
+		$max_page = ceil($numposts / $posts_per_page);
377 377
 
378
-        if (empty($paged)) {
379
-            $paged = 1;
380
-        }
378
+		if (empty($paged)) {
379
+			$paged = 1;
380
+		}
381 381
         
382
-        $post_type = geodir_get_current_posttype();
383
-        $listing_type_name = get_post_type_plural_label($post_type);
384
-        if (geodir_is_page('listing') || geodir_is_page('search')) {            
385
-            $term = array();
382
+		$post_type = geodir_get_current_posttype();
383
+		$listing_type_name = get_post_type_plural_label($post_type);
384
+		if (geodir_is_page('listing') || geodir_is_page('search')) {            
385
+			$term = array();
386 386
             
387
-            if (is_tax()) {
388
-                $term_id = get_queried_object_id();
389
-                $taxonomy = get_query_var('taxonomy');
387
+			if (is_tax()) {
388
+				$term_id = get_queried_object_id();
389
+				$taxonomy = get_query_var('taxonomy');
390 390
 
391
-                if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) {
392
-                    $term = get_term($term_id, $post_type . 'category');
393
-                }
394
-            }
391
+				if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) {
392
+					$term = get_term($term_id, $post_type . 'category');
393
+				}
394
+			}
395 395
             
396
-            if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) {
397
-                $taxonomy_search = $_REQUEST['s' . $post_type . 'category'];
396
+			if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) {
397
+				$taxonomy_search = $_REQUEST['s' . $post_type . 'category'];
398 398
                 
399
-                if (!is_array($taxonomy_search)) {
400
-                    $term = get_term((int)$taxonomy_search, $post_type . 'category');
401
-                } else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search
402
-                    $term = get_term((int)$taxonomy_search[0], $post_type . 'category');
403
-                }
404
-            }
399
+				if (!is_array($taxonomy_search)) {
400
+					$term = get_term((int)$taxonomy_search, $post_type . 'category');
401
+				} else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search
402
+					$term = get_term((int)$taxonomy_search[0], $post_type . 'category');
403
+				}
404
+			}
405 405
             
406
-            if (!empty($term) && !is_wp_error($term)) {
407
-                $listing_type_name = $term->name;
408
-            }
409
-        }
406
+			if (!empty($term) && !is_wp_error($term)) {
407
+				$listing_type_name = $term->name;
408
+			}
409
+		}
410 410
 
411
-        if ($max_page > 1 || $always_show) {            
412
-            // Extra pagination info
413
-            $geodir_pagination_more_info = get_option('geodir_pagination_advance_info');
414
-            $start_no = ( $paged - 1 ) * $posts_per_page + 1;
415
-            $end_no = min($paged * $posts_per_page, $numposts);
411
+		if ($max_page > 1 || $always_show) {            
412
+			// Extra pagination info
413
+			$geodir_pagination_more_info = get_option('geodir_pagination_advance_info');
414
+			$start_no = ( $paged - 1 ) * $posts_per_page + 1;
415
+			$end_no = min($paged * $posts_per_page, $numposts);
416 416
 
417
-            if ($geodir_pagination_more_info != '') {
418
-                if ($listing_type_name) {
419
-                    $listing_type_name = __($listing_type_name, 'geodirectory');
420
-                    $pegination_desc = wp_sprintf(__('Showing %s %d-%d of %d', 'geodirectory'), $listing_type_name, $start_no, $end_no, $numposts);
421
-                } else {
422
-                    $pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts);
423
-                }
424
-                $pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>';
425
-                /**
426
-                 * Adds an extra pagination info above/under pagination.
427
-                 *
428
-                 * @since 1.5.9
429
-                 *
430
-                 * @param string $pagination_info Extra pagination info content.
431
-                 * @param string $listing_type_name Listing results type.
432
-                 * @param string $start_no First result number.
433
-                 * @param string $end_no Last result number.
434
-                 * @param string $numposts Total number of listings.
435
-                 * @param string $post_type The post type.
436
-                 */
437
-                $pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type);
417
+			if ($geodir_pagination_more_info != '') {
418
+				if ($listing_type_name) {
419
+					$listing_type_name = __($listing_type_name, 'geodirectory');
420
+					$pegination_desc = wp_sprintf(__('Showing %s %d-%d of %d', 'geodirectory'), $listing_type_name, $start_no, $end_no, $numposts);
421
+				} else {
422
+					$pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts);
423
+				}
424
+				$pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>';
425
+				/**
426
+				 * Adds an extra pagination info above/under pagination.
427
+				 *
428
+				 * @since 1.5.9
429
+				 *
430
+				 * @param string $pagination_info Extra pagination info content.
431
+				 * @param string $listing_type_name Listing results type.
432
+				 * @param string $start_no First result number.
433
+				 * @param string $end_no Last result number.
434
+				 * @param string $numposts Total number of listings.
435
+				 * @param string $post_type The post type.
436
+				 */
437
+				$pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type);
438 438
                 
439
-                if ($geodir_pagination_more_info == 'before') {
440
-                    $before = $before . $pagination_info;
441
-                } else if ($geodir_pagination_more_info == 'after') {
442
-                    $after = $pagination_info . $after;
443
-                }
444
-            }
439
+				if ($geodir_pagination_more_info == 'before') {
440
+					$before = $before . $pagination_info;
441
+				} else if ($geodir_pagination_more_info == 'after') {
442
+					$after = $pagination_info . $after;
443
+				}
444
+			}
445 445
             
446
-            echo "$before <div class='Navi gd-navi'>";
447
-            if ($paged >= ($pages_to_show - 1)) {
448
-                echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link()) . '">&laquo;</a>';
449
-            }
450
-            previous_posts_link($prelabel);
451
-            for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) {
452
-                if ($i >= 1 && $i <= $max_page) {
453
-                    if ($i == $paged) {
454
-                        echo "<strong class='on'>$i</strong>";
455
-                    } else {
456
-                        echo ' <a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($i)) . '">' . $i . '</a> ';
457
-                    }
458
-                }
459
-            }
460
-            next_posts_link($nxtlabel, $max_page);
461
-            if (($paged + $half_pages_to_show) < ($max_page)) {
462
-                echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($max_page)) . '">&raquo;</a>';
463
-            }
464
-            echo "</div> $after";
465
-        }
446
+			echo "$before <div class='Navi gd-navi'>";
447
+			if ($paged >= ($pages_to_show - 1)) {
448
+				echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link()) . '">&laquo;</a>';
449
+			}
450
+			previous_posts_link($prelabel);
451
+			for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) {
452
+				if ($i >= 1 && $i <= $max_page) {
453
+					if ($i == $paged) {
454
+						echo "<strong class='on'>$i</strong>";
455
+					} else {
456
+						echo ' <a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($i)) . '">' . $i . '</a> ';
457
+					}
458
+				}
459
+			}
460
+			next_posts_link($nxtlabel, $max_page);
461
+			if (($paged + $half_pages_to_show) < ($max_page)) {
462
+				echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($max_page)) . '">&raquo;</a>';
463
+			}
464
+			echo "</div> $after";
465
+		}
466 466
         
467
-        if (function_exists('geodir_location_geo_home_link')) {
468
-            add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
469
-        }
470
-    }
467
+		if (function_exists('geodir_location_geo_home_link')) {
468
+			add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
469
+		}
470
+	}
471 471
 }
472 472
 
473 473
 /**
@@ -478,20 +478,20 @@  discard block
 block discarded – undo
478 478
  */
479 479
 function geodir_listingsearch_scripts()
480 480
 {
481
-    if (get_option('gd_search_dist') != '') {
482
-        $dist = get_option('gd_search_dist');
483
-    } else {
484
-        $dist = 500;
485
-    }
486
-    $dist_dif = 1000;
487
-
488
-    if ($dist <= 5000) $dist_dif = 500;
489
-    if ($dist <= 1000) $dist_dif = 100;
490
-    if ($dist <= 500) $dist_dif = 50;
491
-    if ($dist <= 100) $dist_dif = 10;
492
-    if ($dist <= 50) $dist_dif = 5;
493
-
494
-    ?>
481
+	if (get_option('gd_search_dist') != '') {
482
+		$dist = get_option('gd_search_dist');
483
+	} else {
484
+		$dist = 500;
485
+	}
486
+	$dist_dif = 1000;
487
+
488
+	if ($dist <= 5000) $dist_dif = 500;
489
+	if ($dist <= 1000) $dist_dif = 100;
490
+	if ($dist <= 500) $dist_dif = 50;
491
+	if ($dist <= 100) $dist_dif = 10;
492
+	if ($dist <= 50) $dist_dif = 5;
493
+
494
+	?>
495 495
     <script type="text/javascript">
496 496
 
497 497
         jQuery(function ($) {
@@ -549,20 +549,20 @@  discard block
 block discarded – undo
549 549
  * @package GeoDirectory
550 550
  */
551 551
 function geodir_add_sharelocation_scripts() {
552
-    $default_search_for_text = SEARCH_FOR_TEXT;
553
-    if (get_option('geodir_search_field_default_text'))
554
-        $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
552
+	$default_search_for_text = SEARCH_FOR_TEXT;
553
+	if (get_option('geodir_search_field_default_text'))
554
+		$default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
555 555
 
556
-    $default_near_text = NEAR_TEXT;
557
-    if (get_option('geodir_near_field_default_text'))
558
-        $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
556
+	$default_near_text = NEAR_TEXT;
557
+	if (get_option('geodir_near_field_default_text'))
558
+		$default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
559 559
     
560
-    $search_location = geodir_get_default_location();
560
+	$search_location = geodir_get_default_location();
561 561
     
562
-    $default_search_for_text = addslashes(stripslashes($default_search_for_text));
563
-    $default_near_text = addslashes(stripslashes($default_near_text));
564
-    $city = !empty($search_location) ? addslashes(stripslashes($search_location->city)) : '';
565
-    ?>
562
+	$default_search_for_text = addslashes(stripslashes($default_search_for_text));
563
+	$default_near_text = addslashes(stripslashes($default_near_text));
564
+	$city = !empty($search_location) ? addslashes(stripslashes($search_location->city)) : '';
565
+	?>
566 566
     <script type="text/javascript">
567 567
         var default_location = '<?php echo $city ;?>';
568 568
         var latlng;
@@ -643,14 +643,14 @@  discard block
 block discarded – undo
643 643
                     initialise2();
644 644
                 } else {
645 645
                     <?php
646
-                    $near_add = get_option('geodir_search_near_addition');
647
-                    /**
648
-                     * Adds any extra info to the near search box query when trying to geolocate it via google api.
649
-                     *
650
-                     * @since 1.0.0
651
-                     */
652
-                    $near_add2 = apply_filters('geodir_search_near_addition', '');
653
-                    ?>
646
+					$near_add = get_option('geodir_search_near_addition');
647
+					/**
648
+					 * Adds any extra info to the near search box query when trying to geolocate it via google api.
649
+					 *
650
+					 * @since 1.0.0
651
+					 */
652
+					$near_add2 = apply_filters('geodir_search_near_addition', '');
653
+					?>
654 654
                     if (window.gdMaps === 'google') {
655 655
                         Sgeocoder.geocode({'address': address<?php echo ($near_add ? '+", ' . $near_add . '"' : '') . $near_add2;?>},
656 656
                             function (results, status) {
@@ -753,30 +753,30 @@  discard block
 block discarded – undo
753 753
  */
754 754
 function geodir_show_badges_on_image($which, $post, $link)
755 755
 {
756
-    $return = '';
757
-    switch ($which) {
758
-        case 'featured':
759
-            /**
760
-             * Filter the featured image badge html that appears in the listings pages over the thumbnail.
761
-             *
762
-             * @since 1.0.0
763
-             * @param object $post The post object.
764
-             * @param string $link The link to the post.
765
-             */
766
-            $return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img">&nbsp;</span></a>',$post,$link);
767
-            break;
768
-        case 'new' :
769
-            /**
770
-             * Filter the new image badge html that appears in the listings pages over the thumbnail.
771
-             *
772
-             * @since 1.0.0
773
-             * @param object $post The post object.
774
-             * @param string $link The link to the post.
775
-             */
776
-            $return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing">&nbsp;</span></a>',$post,$link);
777
-            break;
778
-
779
-    }
756
+	$return = '';
757
+	switch ($which) {
758
+		case 'featured':
759
+			/**
760
+			 * Filter the featured image badge html that appears in the listings pages over the thumbnail.
761
+			 *
762
+			 * @since 1.0.0
763
+			 * @param object $post The post object.
764
+			 * @param string $link The link to the post.
765
+			 */
766
+			$return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img">&nbsp;</span></a>',$post,$link);
767
+			break;
768
+		case 'new' :
769
+			/**
770
+			 * Filter the new image badge html that appears in the listings pages over the thumbnail.
771
+			 *
772
+			 * @since 1.0.0
773
+			 * @param object $post The post object.
774
+			 * @param string $link The link to the post.
775
+			 */
776
+			$return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing">&nbsp;</span></a>',$post,$link);
777
+			break;
778
+
779
+	}
780 780
     
781
-    return $return;
781
+	return $return;
782 782
 }
Please login to merge, or discard this patch.
Spacing   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -38,21 +38,21 @@  discard block
 block discarded – undo
38 38
     $is_detail_page = false;
39 39
     $geodir_map_name = geodir_map_name();
40 40
 
41
-    if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) {
41
+    if ((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview'))) {
42 42
         $is_detail_page = true;
43 43
     }
44 44
 
45 45
     wp_enqueue_script('jquery');
46 46
 
47
-    wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js', array(), GEODIRECTORY_VERSION);
47
+    wp_register_script('geodirectory-script', geodir_plugin_url().'/geodirectory-assets/js/geodirectory.min.js', array(), GEODIRECTORY_VERSION);
48 48
     wp_enqueue_script('geodirectory-script');
49 49
 
50 50
     $geodir_vars_data = array(
51 51
         'siteurl' => get_option('siteurl'),
52 52
         'geodir_plugin_url' => geodir_plugin_url(),
53
-        'geodir_lazy_load' => get_option('geodir_lazy_load',1),
53
+        'geodir_lazy_load' => get_option('geodir_lazy_load', 1),
54 54
         'geodir_ajax_url' => geodir_get_ajax_url(),
55
-        'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'),
55
+        'geodir_gd_modal' => (int) get_option('geodir_disable_gb_modal'),
56 56
         'is_rtl' => is_rtl() ? 1 : 0 // fix rtl issue
57 57
     );
58 58
 
@@ -73,24 +73,24 @@  discard block
 block discarded – undo
73 73
      *
74 74
      * }
75 75
      */
76
-    $geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data);
76
+    $geodir_vars_data = apply_filters('geodir_vars_data', $geodir_vars_data);
77 77
 
78 78
     wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data);
79 79
 
80
-    wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true);
81
-    if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');}
80
+    wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION, true);
81
+    if ($is_detail_page) {wp_enqueue_script('geodirectory-jquery-flexslider-js'); }
82 82
 
83
-    wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true);
83
+    wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url().'/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION, true);
84 84
     wp_enqueue_script('geodirectory-lightbox-jquery');
85 85
 
86
-    wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true);
86
+    wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url().'/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION, true);
87 87
     if ($is_detail_page) {
88 88
         wp_enqueue_script('geodirectory-jquery-simplemodal');
89 89
     }
90 90
 
91 91
     if (in_array($geodir_map_name, array('auto', 'google'))) {
92
-        $map_lang = "&language=" . geodir_get_map_default_language();
93
-        $map_key = "&key=" . geodir_get_map_api_key();
92
+        $map_lang = "&language=".geodir_get_map_default_language();
93
+        $map_key = "&key=".geodir_get_map_api_key();
94 94
         /**
95 95
          * Filter the variables that are added to the end of the google maps script call.
96 96
          *
@@ -100,48 +100,48 @@  discard block
 block discarded – undo
100 100
          * @param string $var The string to filter, default is empty string.
101 101
          */
102 102
         $map_extra = apply_filters('geodir_googlemap_script_extra', '');
103
-        wp_enqueue_script('geodirectory-googlemap-script', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra , '', NULL);
103
+        wp_enqueue_script('geodirectory-googlemap-script', 'https://maps.google.com/maps/api/js?'.$map_lang.$map_key.$map_extra, '', NULL);
104 104
     }
105 105
     
106 106
     if ($geodir_map_name == 'osm') {
107 107
         // Leaflet OpenStreetMap
108
-        wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
108
+        wp_register_style('geodirectory-leaflet-style', geodir_plugin_url().'/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
109 109
         wp_enqueue_style('geodirectory-leaflet-style');
110 110
             
111
-        wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
111
+        wp_register_script('geodirectory-leaflet-script', geodir_plugin_url().'/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
112 112
         wp_enqueue_script('geodirectory-leaflet-script');
113 113
         
114
-        wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.js', array(), GEODIRECTORY_VERSION);
114
+        wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url().'/geodirectory-assets/leaflet/osm.geocode.js', array(), GEODIRECTORY_VERSION);
115 115
         wp_enqueue_script('geodirectory-leaflet-geo-script');
116 116
         
117 117
         if ($is_detail_page) {
118
-            wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION);
118
+            wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url().'/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION);
119 119
             wp_enqueue_style('geodirectory-leaflet-routing-style');
120 120
                 
121
-            wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.js', array(), GEODIRECTORY_VERSION);
121
+            wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url().'/geodirectory-assets/leaflet/routing/leaflet-routing-machine.js', array(), GEODIRECTORY_VERSION);
122 122
             wp_enqueue_script('geodirectory-leaflet-routing-script');
123 123
         }
124 124
     }
125
-    wp_enqueue_script( 'jquery-ui-autocomplete' );
125
+    wp_enqueue_script('jquery-ui-autocomplete');
126 126
     
127
-    wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true);
127
+    wp_register_script('geodirectory-goMap-script', geodir_plugin_url().'/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true);
128 128
     wp_enqueue_script('geodirectory-goMap-script');
129 129
 
130 130
 
131
-    wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION);
131
+    wp_register_script('chosen', geodir_plugin_url().'/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION);
132 132
     wp_enqueue_script('chosen');
133 133
 
134
-    wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION);
134
+    wp_register_script('geodirectory-choose-ajax', geodir_plugin_url().'/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION);
135 135
     wp_enqueue_script('geodirectory-choose-ajax');
136 136
 
137
-    wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.min.js', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true);
137
+    wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.ui.timepicker.min.js', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true);
138 138
 
139 139
     if (is_page() && geodir_is_page('add-listing')) {
140 140
         // SCRIPT FOR UPLOAD
141 141
         wp_enqueue_script('plupload-all');
142 142
         wp_enqueue_script('jquery-ui-sortable');
143 143
 
144
-        wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true);
144
+        wp_register_script('geodirectory-plupload-script', geodir_plugin_url().'/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
145 145
         wp_enqueue_script('geodirectory-plupload-script');
146 146
         // SCRIPT FOR UPLOAD END
147 147
 
@@ -188,27 +188,27 @@  discard block
 block discarded – undo
188 188
 
189 189
         wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
190 190
 
191
-        wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload');
191
+        wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url().'/geodirectory-assets/js/listing_validation.min.js#asyncload');
192 192
     } // End if for add place page
193 193
 
194
-    wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
194
+    wp_register_script('geodirectory-post-custom-js', geodir_plugin_url().'/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
195 195
     if ($is_detail_page) {
196 196
 		wp_enqueue_script('geodirectory-post-custom-js');
197 197
 	}
198 198
 
199 199
     // font awesome rating script
200 200
 	if (get_option('geodir_reviewrating_enable_font_awesome')) {
201
-		wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION, true);
201
+		wp_register_script('geodir-barrating-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION, true);
202 202
 		wp_enqueue_script('geodir-barrating-js');
203 203
 	} else { // default rating script
204
-		wp_register_script('geodir-jRating-js', geodir_plugin_url() . '/geodirectory-assets/js/jRating.jquery.min.js', array(), GEODIRECTORY_VERSION, true);
204
+		wp_register_script('geodir-jRating-js', geodir_plugin_url().'/geodirectory-assets/js/jRating.jquery.min.js', array(), GEODIRECTORY_VERSION, true);
205 205
 		wp_enqueue_script('geodir-jRating-js');
206 206
 	}
207 207
 
208
-    wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
208
+    wp_register_script('geodir-on-document-load', geodir_plugin_url().'/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
209 209
     wp_enqueue_script('geodir-on-document-load');
210 210
 
211
-    wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
211
+    wp_register_script('google-geometa', geodir_plugin_url().'/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
212 212
     wp_enqueue_script('google-geometa');
213 213
 }
214 214
 
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
  */
224 224
 function geodir_header_scripts()
225 225
 {
226
-    echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>';
226
+    echo '<style>'.stripslashes(get_option('geodir_coustem_css')).'</style>';
227 227
     echo stripslashes(get_option('geodir_header_scripts'));
228 228
 }
229 229
 
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
  */
238 238
 function geodir_google_analytics_tracking_code()
239 239
 {
240
-    if(get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')){?>
240
+    if (get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')) {?>
241 241
 
242 242
         <script>
243 243
             (function(i,s,o,g,r,a,m){ i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
@@ -245,14 +245,14 @@  discard block
 block discarded – undo
245 245
                 m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
246 246
             })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
247 247
 
248
-            ga('create', '<?php echo esc_attr(get_option('geodir_ga_account_id'));?>', 'auto');
249
-            <?php if(get_option('geodir_ga_anonymize_ip')){echo "ga('set', 'anonymizeIP', true);";}?>
248
+            ga('create', '<?php echo esc_attr(get_option('geodir_ga_account_id')); ?>', 'auto');
249
+            <?php if (get_option('geodir_ga_anonymize_ip')) {echo "ga('set', 'anonymizeIP', true);"; }?>
250 250
             ga('send', 'pageview');
251 251
 
252 252
         </script>
253 253
 
254 254
         <?php
255
-    }elseif(get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){
255
+    }elseif (get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')) {
256 256
         echo stripslashes(get_option('geodir_ga_tracking_code'));
257 257
     }
258 258
 }
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
      *
276 276
      * Flexbox wont wrap on ios for search form items
277 277
      */
278
-    if ( !empty( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'] ) ) {
278
+    if (!empty($_SERVER['HTTP_USER_AGENT']) && preg_match('/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'])) {
279 279
         echo "<style>body .geodir-listing-search.gd-search-bar-style .geodir-loc-bar .clearfix.geodir-loc-bar-in .geodir-search .gd-search-input-wrapper{flex:50 1 auto !important;min-width: initial !important;width:auto !important;}.geodir-filter-container .geodir-filter-cat{width:auto !important;}</style>";
280 280
     }
281 281
 }
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
  */
292 292
 function geodir_add_async_forscript($url)
293 293
 {
294
-    if (strpos($url, '#asyncload')===false)
294
+    if (strpos($url, '#asyncload') === false)
295 295
         return $url;
296 296
     else if (is_admin())
297 297
         return str_replace('#asyncload', '', $url);
@@ -309,12 +309,12 @@  discard block
 block discarded – undo
309 309
 function geodir_templates_styles()
310 310
 {
311 311
 
312
-    wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION);
312
+    wp_register_style('geodir-core-scss', geodir_plugin_url().'/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION);
313 313
     wp_enqueue_style('geodir-core-scss');
314
-    wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION);
314
+    wp_register_style('geodir-core-scss-footer', geodir_plugin_url().'/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION);
315 315
 
316
-    if(is_rtl()){
317
-    wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION);
316
+    if (is_rtl()) {
317
+    wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url().'/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION);
318 318
     wp_enqueue_style('geodirectory-frontend-rtl-style');
319 319
     }
320 320
 
@@ -388,18 +388,18 @@  discard block
 block discarded – undo
388 388
                 $term_id = get_queried_object_id();
389 389
                 $taxonomy = get_query_var('taxonomy');
390 390
 
391
-                if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) {
392
-                    $term = get_term($term_id, $post_type . 'category');
391
+                if ($term_id && $post_type && get_query_var('taxonomy') == $post_type.'category') {
392
+                    $term = get_term($term_id, $post_type.'category');
393 393
                 }
394 394
             }
395 395
             
396
-            if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) {
397
-                $taxonomy_search = $_REQUEST['s' . $post_type . 'category'];
396
+            if (geodir_is_page('search') && !empty($_REQUEST['s'.$post_type.'category'])) {
397
+                $taxonomy_search = $_REQUEST['s'.$post_type.'category'];
398 398
                 
399 399
                 if (!is_array($taxonomy_search)) {
400
-                    $term = get_term((int)$taxonomy_search, $post_type . 'category');
401
-                } else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search
402
-                    $term = get_term((int)$taxonomy_search[0], $post_type . 'category');
400
+                    $term = get_term((int) $taxonomy_search, $post_type.'category');
401
+                } else if (is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search
402
+                    $term = get_term((int) $taxonomy_search[0], $post_type.'category');
403 403
                 }
404 404
             }
405 405
             
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
         if ($max_page > 1 || $always_show) {            
412 412
             // Extra pagination info
413 413
             $geodir_pagination_more_info = get_option('geodir_pagination_advance_info');
414
-            $start_no = ( $paged - 1 ) * $posts_per_page + 1;
414
+            $start_no = ($paged - 1) * $posts_per_page + 1;
415 415
             $end_no = min($paged * $posts_per_page, $numposts);
416 416
 
417 417
             if ($geodir_pagination_more_info != '') {
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
                 } else {
422 422
                     $pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts);
423 423
                 }
424
-                $pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>';
424
+                $pagination_info = '<div class="gd-pagination-details">'.$pegination_desc.'</div>';
425 425
                 /**
426 426
                  * Adds an extra pagination info above/under pagination.
427 427
                  *
@@ -437,15 +437,15 @@  discard block
 block discarded – undo
437 437
                 $pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type);
438 438
                 
439 439
                 if ($geodir_pagination_more_info == 'before') {
440
-                    $before = $before . $pagination_info;
440
+                    $before = $before.$pagination_info;
441 441
                 } else if ($geodir_pagination_more_info == 'after') {
442
-                    $after = $pagination_info . $after;
442
+                    $after = $pagination_info.$after;
443 443
                 }
444 444
             }
445 445
             
446 446
             echo "$before <div class='Navi gd-navi'>";
447 447
             if ($paged >= ($pages_to_show - 1)) {
448
-                echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link()) . '">&laquo;</a>';
448
+                echo '<a href="'.str_replace('&paged', '&amp;paged', get_pagenum_link()).'">&laquo;</a>';
449 449
             }
450 450
             previous_posts_link($prelabel);
451 451
             for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) {
@@ -453,13 +453,13 @@  discard block
 block discarded – undo
453 453
                     if ($i == $paged) {
454 454
                         echo "<strong class='on'>$i</strong>";
455 455
                     } else {
456
-                        echo ' <a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($i)) . '">' . $i . '</a> ';
456
+                        echo ' <a href="'.str_replace('&paged', '&amp;paged', get_pagenum_link($i)).'">'.$i.'</a> ';
457 457
                     }
458 458
                 }
459 459
             }
460 460
             next_posts_link($nxtlabel, $max_page);
461 461
             if (($paged + $half_pages_to_show) < ($max_page)) {
462
-                echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($max_page)) . '">&raquo;</a>';
462
+                echo '<a href="'.str_replace('&paged', '&amp;paged', get_pagenum_link($max_page)).'">&raquo;</a>';
463 463
             }
464 464
             echo "</div> $after";
465 465
         }
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
         jQuery(function ($) {
498 498
             $("#distance_slider").slider({
499 499
                 range: true,
500
-                values: [0, <?php echo ($_REQUEST['sdist']!='') ? sanitize_text_field($_REQUEST['sdist']) : "0"; ?>],
500
+                values: [0, <?php echo ($_REQUEST['sdist'] != '') ? sanitize_text_field($_REQUEST['sdist']) : "0"; ?>],
501 501
                 min: 0,
502 502
                 max: <?php echo $dist; ?>,
503 503
                 step: <?php echo $dist_dif; ?>,
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
     $city = !empty($search_location) ? addslashes(stripslashes($search_location->city)) : '';
565 565
     ?>
566 566
     <script type="text/javascript">
567
-        var default_location = '<?php echo $city ;?>';
567
+        var default_location = '<?php echo $city; ?>';
568 568
         var latlng;
569 569
         var address;
570 570
         var dist = 0;
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
 				var $form = jQuery(this).closest('form');
581 581
 
582 582
 				if (jQuery("#sdist input[type='radio']:checked").length != 0) dist = jQuery("#sdist input[type='radio']:checked").val();
583
-				if (jQuery('.search_text', $form).val() == '' || jQuery('.search_text', $form).val() == '<?php echo $default_search_for_text;?>') jQuery('.search_text', $form).val(s);
583
+				if (jQuery('.search_text', $form).val() == '' || jQuery('.search_text', $form).val() == '<?php echo $default_search_for_text; ?>') jQuery('.search_text', $form).val(s);
584 584
 				
585 585
 				// Disable location based search for disabled location post type.
586 586
 				if (jQuery('.search_by_post', $form).val() != '' && typeof gd_cpt_no_location == 'function') {
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
 					}
595 595
 				}
596 596
 				
597
-				if (dist > 0 || (jQuery('select[name="sort_by"]').val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest') || (jQuery(".snear", $form).val() != '' && jQuery(".snear", $form).val() != '<?php echo $default_near_text;?>')) {
597
+				if (dist > 0 || (jQuery('select[name="sort_by"]').val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest') || (jQuery(".snear", $form).val() != '' && jQuery(".snear", $form).val() != '<?php echo $default_near_text; ?>')) {
598 598
 					geodir_setsearch($form);
599 599
 				} else {
600 600
 					jQuery(".snear", $form).val('');
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
         });
613 613
         
614 614
 		function geodir_setsearch($form) {
615
-			if ((dist > 0 || (jQuery('select[name="sort_by"]', $form).val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest')) && (jQuery(".snear", $form).val() == '' || jQuery(".snear", $form).val() == '<?php echo $default_near_text;?>')) jQuery(".snear", $form).val(default_location);
615
+			if ((dist > 0 || (jQuery('select[name="sort_by"]', $form).val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest')) && (jQuery(".snear", $form).val() == '' || jQuery(".snear", $form).val() == '<?php echo $default_near_text; ?>')) jQuery(".snear", $form).val(default_location);
616 616
 			geocodeAddress($form);
617 617
 		}
618 618
 
@@ -631,15 +631,15 @@  discard block
 block discarded – undo
631 631
             // Call the geocode function
632 632
             Sgeocoder = window.gdMaps == 'google' ? new google.maps.Geocoder() : null;
633 633
 
634
-            if (jQuery('.snear', $form).val() == '' || ( jQuery('.sgeo_lat').val() != '' && jQuery('.sgeo_lon').val() != ''  ) || jQuery('.snear', $form).val().match("^<?php _e('In:','geodirectory');?>")) {
635
-                if (jQuery('.snear', $form).val().match("^<?php _e('In:','geodirectory');?>")) {
634
+            if (jQuery('.snear', $form).val() == '' || ( jQuery('.sgeo_lat').val() != '' && jQuery('.sgeo_lon').val() != ''  ) || jQuery('.snear', $form).val().match("^<?php _e('In:', 'geodirectory'); ?>")) {
635
+                if (jQuery('.snear', $form).val().match("^<?php _e('In:', 'geodirectory'); ?>")) {
636 636
                     jQuery(".snear", $form).val('');
637 637
                 }
638 638
                 jQuery($form).submit();
639 639
             } else {
640 640
                 var address = jQuery(".snear", $form).val();
641 641
 
642
-                if (jQuery('.snear', $form).val() == '<?php echo $default_near_text;?>') {
642
+                if (jQuery('.snear', $form).val() == '<?php echo $default_near_text; ?>') {
643 643
                     initialise2();
644 644
                 } else {
645 645
                     <?php
@@ -652,12 +652,12 @@  discard block
 block discarded – undo
652 652
                     $near_add2 = apply_filters('geodir_search_near_addition', '');
653 653
                     ?>
654 654
                     if (window.gdMaps === 'google') {
655
-                        Sgeocoder.geocode({'address': address<?php echo ($near_add ? '+", ' . $near_add . '"' : '') . $near_add2;?>},
655
+                        Sgeocoder.geocode({'address': address<?php echo ($near_add ? '+", '.$near_add.'"' : '').$near_add2; ?>},
656 656
                             function (results, status) {
657 657
                                 if (status == google.maps.GeocoderStatus.OK) {
658 658
                                     updateSearchPosition(results[0].geometry.location, $form);
659 659
                                 } else {
660
-                                    alert("<?php esc_attr_e('Search was not successful for the following reason :', 'geodirectory');?>" + status);
660
+                                    alert("<?php esc_attr_e('Search was not successful for the following reason :', 'geodirectory'); ?>" + status);
661 661
                                 }
662 662
                             });
663 663
                     } else if (window.gdMaps === 'osm') {
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
                                 if (typeof geo !== 'undefined' && geo.lat && geo.lon) {
667 667
                                     updateSearchPosition(geo, $form);
668 668
                                 } else {
669
-                                    alert("<?php esc_attr_e('Search was not successful for the requested address.', 'geodirectory');?>");
669
+                                    alert("<?php esc_attr_e('Search was not successful for the requested address.', 'geodirectory'); ?>");
670 670
                                 }
671 671
                             });
672 672
                     } else {
@@ -712,19 +712,19 @@  discard block
 block discarded – undo
712 712
             var msg;
713 713
             switch (err.code) {
714 714
                 case err.UNKNOWN_ERROR:
715
-                    msg = "<?php _e('Unable to find your location','geodirectory');?>";
715
+                    msg = "<?php _e('Unable to find your location', 'geodirectory'); ?>";
716 716
                     break;
717 717
                 case err.PERMISSION_DENINED:
718
-                    msg = "<?php _e('Permission denied in finding your location','geodirectory');?>";
718
+                    msg = "<?php _e('Permission denied in finding your location', 'geodirectory'); ?>";
719 719
                     break;
720 720
                 case err.POSITION_UNAVAILABLE:
721
-                    msg = "<?php _e('Your location is currently unknown','geodirectory');?>";
721
+                    msg = "<?php _e('Your location is currently unknown', 'geodirectory'); ?>";
722 722
                     break;
723 723
                 case err.BREAK:
724
-                    msg = "<?php _e('Attempt to find location took too long','geodirectory');?>";
724
+                    msg = "<?php _e('Attempt to find location took too long', 'geodirectory'); ?>";
725 725
                     break;
726 726
                 default:
727
-                    msg = "<?php _e('Location detection not supported in browser','geodirectory');?>";
727
+                    msg = "<?php _e('Location detection not supported in browser', 'geodirectory'); ?>";
728 728
             }
729 729
             jQuery('#info').html(msg);
730 730
         }
@@ -763,7 +763,7 @@  discard block
 block discarded – undo
763 763
              * @param object $post The post object.
764 764
              * @param string $link The link to the post.
765 765
              */
766
-            $return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img">&nbsp;</span></a>',$post,$link);
766
+            $return = apply_filters('geodir_featured_badge_on_image', '<a href="'.$link.'"><span class="geodir_featured_img">&nbsp;</span></a>', $post, $link);
767 767
             break;
768 768
         case 'new' :
769 769
             /**
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
              * @param object $post The post object.
774 774
              * @param string $link The link to the post.
775 775
              */
776
-            $return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing">&nbsp;</span></a>',$post,$link);
776
+            $return = apply_filters('geodir_new_badge_on_image', '<a href="'.$link.'"><span class="geodir_new_listing">&nbsp;</span></a>', $post, $link);
777 777
             break;
778 778
 
779 779
     }
Please login to merge, or discard this patch.