Test Failed
Push — master ( f6c162...6da0de )
by Stiofan
14:39
created
geodirectory_template_tags.php 2 patches
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.
geodirectory-functions/custom_functions.php 1 patch
Spacing   +668 added lines, -668 removed lines patch added patch discarded remove patch
@@ -52,31 +52,31 @@  discard block
 block discarded – undo
52 52
 				jQuery(listSel).children('li').switchClass('gridview_onehalf gridview_onethird gridview_onefourth', 'gridview_onefifth', 600);
53 53
 			}
54 54
 
55
-			jQuery.post("<?php echo geodir_get_ajax_url();?>&gd_listing_view=" + val, function (data) {
55
+			jQuery.post("<?php echo geodir_get_ajax_url(); ?>&gd_listing_view=" + val, function (data) {
56 56
 				//alert(data );
57 57
 			});
58 58
 		}
59 59
 	</script>
60 60
 	<div class="geodir-list-view-select">
61 61
 		<select name="gd_list_view" id="gd_list_view" onchange="geodir_list_view_select(this);">
62
-			<?php $listing_view = (int) $gd_session->get( 'gd_listing_view' ); ?>
63
-			<option value=""><?php _e( 'View:', 'geodirectory' ); ?></option>
62
+			<?php $listing_view = (int) $gd_session->get('gd_listing_view'); ?>
63
+			<option value=""><?php _e('View:', 'geodirectory'); ?></option>
64 64
 			<option
65
-				value="1" <?php selected( 1, $listing_view ); ?>><?php _e( 'View: List', 'geodirectory' ); ?></option>
65
+				value="1" <?php selected(1, $listing_view); ?>><?php _e('View: List', 'geodirectory'); ?></option>
66 66
 			<option
67
-				value="2" <?php selected( 2, $listing_view ); ?>><?php _e( 'View: Grid 2', 'geodirectory' ); ?></option>
67
+				value="2" <?php selected(2, $listing_view); ?>><?php _e('View: Grid 2', 'geodirectory'); ?></option>
68 68
 			<option
69
-				value="3" <?php selected( 3, $listing_view ); ?>><?php _e( 'View: Grid 3', 'geodirectory' ); ?></option>
69
+				value="3" <?php selected(3, $listing_view); ?>><?php _e('View: Grid 3', 'geodirectory'); ?></option>
70 70
 			<option
71
-				value="4" <?php selected( 4, $listing_view ); ?>><?php _e( 'View: Grid 4', 'geodirectory' ); ?></option>
71
+				value="4" <?php selected(4, $listing_view); ?>><?php _e('View: Grid 4', 'geodirectory'); ?></option>
72 72
 			<option
73
-				value="5" <?php selected( 5, $listing_view ); ?>><?php _e( 'View: Grid 5', 'geodirectory' ); ?></option>
73
+				value="5" <?php selected(5, $listing_view); ?>><?php _e('View: Grid 5', 'geodirectory'); ?></option>
74 74
 		</select>
75 75
 	</div>
76 76
 	<?php
77 77
 }
78 78
 
79
-add_action( 'geodir_before_listing', 'geodir_list_view_select', 100 );
79
+add_action('geodir_before_listing', 'geodir_list_view_select', 100);
80 80
 
81 81
 /**
82 82
  * Limit the listing excerpt.
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
  * @global object $post          The current post object.
92 92
  * @return string The modified excerpt.
93 93
  */
94
-function geodir_max_excerpt( $charlength ) {
94
+function geodir_max_excerpt($charlength) {
95 95
 	global $post;
96
-	if ( $charlength == '0' ) {
96
+	if ($charlength == '0') {
97 97
 		return;
98 98
 	}
99 99
 	$out = '';
@@ -101,46 +101,46 @@  discard block
 block discarded – undo
101 101
 	$temp_post = $post;
102 102
 	$excerpt   = get_the_excerpt();
103 103
 
104
-	$charlength ++;
105
-	$excerpt_more = function_exists( 'geodirf_excerpt_more' ) ? geodirf_excerpt_more( '' ) : geodir_excerpt_more( '' );
106
-	if ( geodir_utf8_strlen( $excerpt ) > $charlength ) {
107
-		if ( geodir_utf8_strlen( $excerpt_more ) > 0 && geodir_utf8_strpos( $excerpt, $excerpt_more ) !== false ) {
108
-			$excut = - ( geodir_utf8_strlen( $excerpt_more ) );
109
-			$subex = geodir_utf8_substr( $excerpt, 0, $excut );
110
-			if ( $charlength > 0 && geodir_utf8_strlen( $subex ) > $charlength ) {
111
-				$subex = geodir_utf8_substr( $subex, 0, $charlength );
104
+	$charlength++;
105
+	$excerpt_more = function_exists('geodirf_excerpt_more') ? geodirf_excerpt_more('') : geodir_excerpt_more('');
106
+	if (geodir_utf8_strlen($excerpt) > $charlength) {
107
+		if (geodir_utf8_strlen($excerpt_more) > 0 && geodir_utf8_strpos($excerpt, $excerpt_more) !== false) {
108
+			$excut = - (geodir_utf8_strlen($excerpt_more));
109
+			$subex = geodir_utf8_substr($excerpt, 0, $excut);
110
+			if ($charlength > 0 && geodir_utf8_strlen($subex) > $charlength) {
111
+				$subex = geodir_utf8_substr($subex, 0, $charlength);
112 112
 			}
113 113
 			$out .= $subex;
114 114
 		} else {
115
-			$subex   = geodir_utf8_substr( $excerpt, 0, $charlength - 5 );
116
-			$exwords = explode( ' ', $subex );
117
-			$excut   = - ( geodir_utf8_strlen( $exwords[ count( $exwords ) - 1 ] ) );
118
-			if ( $excut < 0 ) {
119
-				$out .= geodir_utf8_substr( $subex, 0, $excut );
115
+			$subex   = geodir_utf8_substr($excerpt, 0, $charlength - 5);
116
+			$exwords = explode(' ', $subex);
117
+			$excut   = - (geodir_utf8_strlen($exwords[count($exwords) - 1]));
118
+			if ($excut < 0) {
119
+				$out .= geodir_utf8_substr($subex, 0, $excut);
120 120
 			} else {
121 121
 				$out .= $subex;
122 122
 			}
123 123
 		}
124
-		$out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">';
124
+		$out .= ' <a class="excerpt-read-more" href="'.get_permalink().'" title="'.get_the_title().'">';
125 125
 		/**
126 126
 		 * Filter excerpt read more text.
127 127
 		 *
128 128
 		 * @since 1.0.0
129 129
 		 */
130
-		$out .= apply_filters( 'geodir_max_excerpt_end', __( 'Read more [...]', 'geodirectory' ) );
130
+		$out .= apply_filters('geodir_max_excerpt_end', __('Read more [...]', 'geodirectory'));
131 131
 		$out .= '</a>';
132 132
 
133 133
 	} else {
134
-		if ( geodir_utf8_strlen( $excerpt_more ) > 0 && geodir_utf8_strpos( $excerpt, $excerpt_more ) !== false ) {
135
-			$excut = - ( geodir_utf8_strlen( $excerpt_more ) );
136
-			$out .= geodir_utf8_substr( $excerpt, 0, $excut );
137
-			$out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">';
134
+		if (geodir_utf8_strlen($excerpt_more) > 0 && geodir_utf8_strpos($excerpt, $excerpt_more) !== false) {
135
+			$excut = - (geodir_utf8_strlen($excerpt_more));
136
+			$out .= geodir_utf8_substr($excerpt, 0, $excut);
137
+			$out .= ' <a class="excerpt-read-more" href="'.get_permalink().'" title="'.get_the_title().'">';
138 138
 			/**
139 139
 			 * Filter excerpt read more text.
140 140
 			 *
141 141
 			 * @since 1.0.0
142 142
 			 */
143
-			$out .= apply_filters( 'geodir_max_excerpt_end', __( 'Read more [...]', 'geodirectory' ) );
143
+			$out .= apply_filters('geodir_max_excerpt_end', __('Read more [...]', 'geodirectory'));
144 144
 			$out .= '</a>';
145 145
 		} else {
146 146
 			$out .= $excerpt;
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
  *
164 164
  * @return object Returns filtered package info as an object.
165 165
  */
166
-function geodir_post_package_info( $package_info, $post = '', $post_type = '' ) {
166
+function geodir_post_package_info($package_info, $post = '', $post_type = '') {
167 167
 	$package_info['pid']              = 0;
168 168
 	$package_info['days']             = 0;
169 169
 	$package_info['amount']           = 0;
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	 * @param object|string $post  The post object.
193 193
 	 * @param string $post_type    The post type.
194 194
 	 */
195
-	return (object) apply_filters( 'geodir_post_package_info', $package_info, $post, $post_type );
195
+	return (object) apply_filters('geodir_post_package_info', $package_info, $post, $post_type);
196 196
 
197 197
 }
198 198
 
@@ -220,11 +220,11 @@  discard block
 block discarded – undo
220 220
  *
221 221
  * }
222 222
  */
223
-function geodir_send_inquiry( $request ) {
223
+function geodir_send_inquiry($request) {
224 224
 	global $wpdb;
225 225
 
226 226
 	// strip slashes from text
227
-	$request = ! empty( $request ) ? stripslashes_deep( $request ) : $request;
227
+	$request = !empty($request) ? stripslashes_deep($request) : $request;
228 228
 
229 229
 	$yourname      = $request['inq_name'];
230 230
 	$youremail     = $request['inq_email'];
@@ -235,26 +235,26 @@  discard block
 block discarded – undo
235 235
 	$author_id  = '';
236 236
 	$post_title = '';
237 237
 
238
-	if ( $request['pid'] ) {
238
+	if ($request['pid']) {
239 239
 
240 240
 		$productinfosql = $wpdb->prepare(
241 241
 			"select ID,post_author,post_title from $wpdb->posts where ID =%d",
242
-			array( $request['pid'] )
242
+			array($request['pid'])
243 243
 		);
244
-		$productinfo    = $wpdb->get_row( $productinfosql );
244
+		$productinfo = $wpdb->get_row($productinfosql);
245 245
 
246 246
 		$author_id  = $productinfo->post_author;
247 247
 		$post_title = $productinfo->post_title;
248 248
 	}
249 249
 
250
-	$post_title = '<a href="' . get_permalink( $pid ) . '">' . $post_title . '</a>';
250
+	$post_title = '<a href="'.get_permalink($pid).'">'.$post_title.'</a>';
251 251
 
252
-	$user_info = get_userdata( $author_id );
253
-	$to_email  = geodir_get_post_meta( $pid, 'geodir_email', true );
254
-	$to_name   = geodir_get_client_name( $author_id );
252
+	$user_info = get_userdata($author_id);
253
+	$to_email  = geodir_get_post_meta($pid, 'geodir_email', true);
254
+	$to_name   = geodir_get_client_name($author_id);
255 255
 
256
-	if ( $to_email == '' ) {
257
-		$to_email = get_option( 'admin_email' );
256
+	if ($to_email == '') {
257
+		$to_email = get_option('admin_email');
258 258
 	}
259 259
 
260 260
 	/**
@@ -275,10 +275,10 @@  discard block
 block discarded – undo
275 275
 	 * }
276 276
 	 * @param string $type     The form type, default: `Enquiry`.
277 277
 	 */
278
-	do_action( 'geodir_after_send_enquiry', $request, 'Enquiry' );
278
+	do_action('geodir_after_send_enquiry', $request, 'Enquiry');
279 279
 
280 280
 	$client_message = $frnd_comments;
281
-	$client_message .= '<br>' . __( 'From :', 'geodirectory' ) . ' ' . $yourname . '<br>' . __( 'Phone :', 'geodirectory' ) . ' ' . $inq_phone . '<br>' . __( 'Email :', 'geodirectory' ) . ' ' . $youremail . '<br><br>' . __( 'Sent from', 'geodirectory' ) . ' - <b><a href="' . trailingslashit( home_url() ) . '">' . get_option( 'blogname' ) . '</a></b>.';
281
+	$client_message .= '<br>'.__('From :', 'geodirectory').' '.$yourname.'<br>'.__('Phone :', 'geodirectory').' '.$inq_phone.'<br>'.__('Email :', 'geodirectory').' '.$youremail.'<br><br>'.__('Sent from', 'geodirectory').' - <b><a href="'.trailingslashit(home_url()).'">'.get_option('blogname').'</a></b>.';
282 282
 	/**
283 283
 	 * Filter client message text.
284 284
 	 *
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 	 *
287 287
 	 * @param string $client_message Client message text.
288 288
 	 */
289
-	$client_message = apply_filters( 'geodir_inquiry_email_msg', $client_message );
289
+	$client_message = apply_filters('geodir_inquiry_email_msg', $client_message);
290 290
 
291 291
 	/**
292 292
 	 * Called before the send enquiry email is sent.
@@ -305,12 +305,12 @@  discard block
 block discarded – undo
305 305
 	 *
306 306
 	 * }
307 307
 	 */
308
-	do_action( 'geodir_before_send_enquiry_email', $request );
309
-	if ( $to_email ) {
308
+	do_action('geodir_before_send_enquiry_email', $request);
309
+	if ($to_email) {
310 310
 		// strip slashes message
311
-		$client_message = stripslashes_deep( $client_message );
311
+		$client_message = stripslashes_deep($client_message);
312 312
 
313
-		geodir_sendEmail( $youremail, $yourname, $to_email, $to_name, '', $client_message, $extra = '', 'send_enquiry', $request['pid'] );//To client email
313
+		geodir_sendEmail($youremail, $yourname, $to_email, $to_name, '', $client_message, $extra = '', 'send_enquiry', $request['pid']); //To client email
314 314
 	}
315 315
 
316 316
 	/**
@@ -330,12 +330,12 @@  discard block
 block discarded – undo
330 330
 	 *
331 331
 	 * }
332 332
 	 */
333
-	do_action( 'geodir_after_send_enquiry_email', $request );
334
-	$url = get_permalink( $pid );
335
-	if ( strstr( $url, '?' ) ) {
336
-		$url = $url . "&send_inquiry=success";
333
+	do_action('geodir_after_send_enquiry_email', $request);
334
+	$url = get_permalink($pid);
335
+	if (strstr($url, '?')) {
336
+		$url = $url."&send_inquiry=success";
337 337
 	} else {
338
-		$url = $url . "?send_inquiry=success";
338
+		$url = $url."?send_inquiry=success";
339 339
 	}
340 340
 	/**
341 341
 	 * Filter redirect url after the send enquiry email is sent.
@@ -344,8 +344,8 @@  discard block
 block discarded – undo
344 344
 	 *
345 345
 	 * @param string $url Redirect url.
346 346
 	 */
347
-	$url = apply_filters( 'geodir_send_enquiry_after_submit_redirect', $url );
348
-	wp_redirect( $url );
347
+	$url = apply_filters('geodir_send_enquiry_after_submit_redirect', $url);
348
+	wp_redirect($url);
349 349
 	gd_die();
350 350
 
351 351
 }
@@ -374,11 +374,11 @@  discard block
 block discarded – undo
374 374
  * }
375 375
  * @global object $wpdb        WordPress Database object.
376 376
  */
377
-function geodir_send_friend( $request ) {
377
+function geodir_send_friend($request) {
378 378
 	global $wpdb;
379 379
 
380 380
 	// strip slashes from text
381
-	$request = ! empty( $request ) ? stripslashes_deep( $request ) : $request;
381
+	$request = !empty($request) ? stripslashes_deep($request) : $request;
382 382
 
383 383
 	$yourname      = $request['yourname'];
384 384
 	$youremail     = $request['youremail'];
@@ -387,13 +387,13 @@  discard block
 block discarded – undo
387 387
 	$pid           = $request['pid'];
388 388
 	$to_email      = $request['to_email'];
389 389
 	$to_name       = $request['to_name'];
390
-	if ( $request['pid'] ) {
390
+	if ($request['pid']) {
391 391
 		$productinfosql = $wpdb->prepare(
392 392
 			"select ID,post_title from $wpdb->posts where ID =%d",
393
-			array( $request['pid'] )
393
+			array($request['pid'])
394 394
 		);
395
-		$productinfo    = $wpdb->get_results( $productinfosql );
396
-		foreach ( $productinfo as $productinfoObj ) {
395
+		$productinfo = $wpdb->get_results($productinfosql);
396
+		foreach ($productinfo as $productinfoObj) {
397 397
 			$post_title = $productinfoObj->post_title;
398 398
 		}
399 399
 	}
@@ -417,8 +417,8 @@  discard block
 block discarded – undo
417 417
 	 *
418 418
 	 * }
419 419
 	 */
420
-	do_action( 'geodir_before_send_to_friend_email', $request );
421
-	geodir_sendEmail( $youremail, $yourname, $to_email, $to_name, $frnd_subject, $frnd_comments, $extra = '', 'send_friend', $request['pid'] );//To client email
420
+	do_action('geodir_before_send_to_friend_email', $request);
421
+	geodir_sendEmail($youremail, $yourname, $to_email, $to_name, $frnd_subject, $frnd_comments, $extra = '', 'send_friend', $request['pid']); //To client email
422 422
 
423 423
 	/**
424 424
 	 * Called after the send to friend email is sent.
@@ -439,13 +439,13 @@  discard block
 block discarded – undo
439 439
 	 *
440 440
 	 * }
441 441
 	 */
442
-	do_action( 'geodir_after_send_to_friend_email', $request );
442
+	do_action('geodir_after_send_to_friend_email', $request);
443 443
 
444
-	$url = get_permalink( $pid );
445
-	if ( strstr( $url, '?' ) ) {
446
-		$url = $url . "&sendtofrnd=success";
444
+	$url = get_permalink($pid);
445
+	if (strstr($url, '?')) {
446
+		$url = $url."&sendtofrnd=success";
447 447
 	} else {
448
-		$url = $url . "?sendtofrnd=success";
448
+		$url = $url."?sendtofrnd=success";
449 449
 	}
450 450
 	/**
451 451
 	 * Filter redirect url after the send to friend email is sent.
@@ -454,8 +454,8 @@  discard block
 block discarded – undo
454 454
 	 *
455 455
 	 * @param string $url Redirect url.
456 456
 	 */
457
-	$url = apply_filters( 'geodir_send_to_friend_after_submit_redirect', $url );
458
-	wp_redirect( $url );
457
+	$url = apply_filters('geodir_send_to_friend_after_submit_redirect', $url);
458
+	wp_redirect($url);
459 459
 	gd_die();
460 460
 }
461 461
 
@@ -469,8 +469,8 @@  discard block
 block discarded – undo
469 469
  *
470 470
  * @param string $hash_key
471 471
  */
472
-function geodir_before_tab_content( $hash_key ) {
473
-	switch ( $hash_key ) {
472
+function geodir_before_tab_content($hash_key) {
473
+	switch ($hash_key) {
474 474
 		case 'post_info' :
475 475
 			echo '<div class="geodir-company_info field-group">';
476 476
 			break;
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
 			 *
481 481
 			 * @since 1.0.0
482 482
 			 */
483
-			echo ' <div id="' . apply_filters( 'geodir_post_gallery_id', 'geodir-post-gallery' ) . '" class="clearfix" >';
483
+			echo ' <div id="'.apply_filters('geodir_post_gallery_id', 'geodir-post-gallery').'" class="clearfix" >';
484 484
 			break;
485 485
 		case 'reviews' :
486 486
 			echo '<div id="reviews-wrap" class="clearfix"> ';
@@ -504,8 +504,8 @@  discard block
 block discarded – undo
504 504
  *
505 505
  * @param string $hash_key
506 506
  */
507
-function geodir_after_tab_content( $hash_key ) {
508
-	switch ( $hash_key ) {
507
+function geodir_after_tab_content($hash_key) {
508
+	switch ($hash_key) {
509 509
 		case 'post_info' :
510 510
 			echo '</div>';
511 511
 			break;
@@ -536,25 +536,25 @@  discard block
 block discarded – undo
536 536
  * @global object $wpdb     WordPress Database object.
537 537
  * @return bool|null|string Returns default sort results, when the post type is valid. Otherwise returns false.
538 538
  */
539
-function geodir_get_posts_default_sort( $post_type ) {
539
+function geodir_get_posts_default_sort($post_type) {
540 540
 
541 541
 	global $wpdb;
542 542
 
543
-	if ( $post_type != '' ) {
543
+	if ($post_type != '') {
544 544
 
545 545
 		$all_postypes = geodir_get_posttypes();
546 546
 
547
-		if ( ! in_array( $post_type, $all_postypes ) ) {
547
+		if (!in_array($post_type, $all_postypes)) {
548 548
 			return false;
549 549
 		}
550 550
 
551
-		$sort_field_info = $wpdb->get_var( $wpdb->prepare( "select default_order from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where	post_type= %s and is_active=%d and is_default=%d", array(
551
+		$sort_field_info = $wpdb->get_var($wpdb->prepare("select default_order from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where	post_type= %s and is_active=%d and is_default=%d", array(
552 552
 			$post_type,
553 553
 			1,
554 554
 			1
555
-		) ) );
555
+		)));
556 556
 
557
-		if ( ! empty( $sort_field_info ) ) {
557
+		if (!empty($sort_field_info)) {
558 558
 			return $sort_field_info;
559 559
 		}
560 560
 
@@ -574,20 +574,20 @@  discard block
 block discarded – undo
574 574
  * @global object $wpdb     WordPress Database object.
575 575
  * @return bool|mixed|void Returns sort results, when the post type is valid. Otherwise returns false.
576 576
  */
577
-function geodir_get_sort_options( $post_type ) {
577
+function geodir_get_sort_options($post_type) {
578 578
 	global $wpdb;
579 579
 
580
-	if ( $post_type != '' ) {
580
+	if ($post_type != '') {
581 581
 		$all_postypes = geodir_get_posttypes();
582 582
 
583
-		if ( ! in_array( $post_type, $all_postypes ) ) {
583
+		if (!in_array($post_type, $all_postypes)) {
584 584
 			return false;
585 585
 		}
586 586
 
587
-		$sort_field_info = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE post_type=%s AND is_active=%d AND (sort_asc=1 || sort_desc=1 || field_type='random') AND field_type != 'address' ORDER BY sort_order ASC", array(
587
+		$sort_field_info = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE post_type=%s AND is_active=%d AND (sort_asc=1 || sort_desc=1 || field_type='random') AND field_type != 'address' ORDER BY sort_order ASC", array(
588 588
 			$post_type,
589 589
 			1
590
-		) ) );
590
+		)));
591 591
 
592 592
 		/**
593 593
 		 * Filter post sort options.
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 		 * @param array $sort_field_info Unfiltered sort field array.
598 598
 		 * @param string $post_type      Post type.
599 599
 		 */
600
-		return apply_filters( 'geodir_get_sort_options', $sort_field_info, $post_type );
600
+		return apply_filters('geodir_get_sort_options', $sort_field_info, $post_type);
601 601
 	}
602 602
 
603 603
 }
@@ -618,63 +618,63 @@  discard block
 block discarded – undo
618 618
 	 *
619 619
 	 * @since 1.4.4
620 620
 	 */
621
-	if ( is_search() ) {
621
+	if (is_search()) {
622 622
 		return;
623 623
 	}
624 624
 
625 625
 	$sort_by = '';
626 626
 
627
-	if ( isset( $_REQUEST['sort_by'] ) ) {
627
+	if (isset($_REQUEST['sort_by'])) {
628 628
 		$sort_by = $_REQUEST['sort_by'];
629 629
 	}
630 630
 
631 631
 	$gd_post_type = geodir_get_current_posttype();
632 632
 
633
-	$sort_options = geodir_get_sort_options( $gd_post_type );
633
+	$sort_options = geodir_get_sort_options($gd_post_type);
634 634
 
635 635
 
636 636
 	$sort_field_options = '';
637 637
 
638
-	if ( ! empty( $sort_options ) ) {
639
-		foreach ( $sort_options as $sort ) {
640
-			$sort = stripslashes_deep( $sort ); // strip slashes
638
+	if (!empty($sort_options)) {
639
+		foreach ($sort_options as $sort) {
640
+			$sort = stripslashes_deep($sort); // strip slashes
641 641
 
642
-			$label = __( $sort->site_title, 'geodirectory' );
642
+			$label = __($sort->site_title, 'geodirectory');
643 643
 
644
-			if ( $sort->field_type == 'random' ) {
644
+			if ($sort->field_type == 'random') {
645 645
 				$key = $sort->field_type;
646
-				( $sort_by == $key || ( $sort->is_default == '1' && ! isset( $_REQUEST['sort_by'] ) ) ) ? $selected = 'selected="selected"' : $selected = '';
647
-				$sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg( 'sort_by', $key ) ) . '">' . __( $label, 'geodirectory' ) . '</option>';
646
+				($sort_by == $key || ($sort->is_default == '1' && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
647
+				$sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>';
648 648
 			}
649 649
 
650
-			if ( $sort->htmlvar_name == 'comment_count' ) {
650
+			if ($sort->htmlvar_name == 'comment_count') {
651 651
 				$sort->htmlvar_name = 'rating_count';
652 652
 			}
653 653
 
654
-			if ( $sort->sort_asc ) {
655
-				$key   = $sort->htmlvar_name . '_asc';
654
+			if ($sort->sort_asc) {
655
+				$key   = $sort->htmlvar_name.'_asc';
656 656
 				$label = $sort->site_title;
657
-				if ( $sort->asc_title ) {
657
+				if ($sort->asc_title) {
658 658
 					$label = $sort->asc_title;
659 659
 				}
660
-				( $sort_by == $key || ( $sort->is_default == '1' && $sort->default_order == $key && ! isset( $_REQUEST['sort_by'] ) ) ) ? $selected = 'selected="selected"' : $selected = '';
661
-				$sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg( 'sort_by', $key ) ) . '">' . __( $label, 'geodirectory' ) . '</option>';
660
+				($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
661
+				$sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>';
662 662
 			}
663 663
 
664
-			if ( $sort->sort_desc ) {
665
-				$key   = $sort->htmlvar_name . '_desc';
664
+			if ($sort->sort_desc) {
665
+				$key   = $sort->htmlvar_name.'_desc';
666 666
 				$label = $sort->site_title;
667
-				if ( $sort->desc_title ) {
667
+				if ($sort->desc_title) {
668 668
 					$label = $sort->desc_title;
669 669
 				}
670
-				( $sort_by == $key || ( $sort->is_default == '1' && $sort->default_order == $key && ! isset( $_REQUEST['sort_by'] ) ) ) ? $selected = 'selected="selected"' : $selected = '';
671
-				$sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg( 'sort_by', $key ) ) . '">' . __( $label, 'geodirectory' ) . '</option>';
670
+				($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
671
+				$sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>';
672 672
 			}
673 673
 
674 674
 		}
675 675
 	}
676 676
 
677
-	if ( $sort_field_options != '' ) {
677
+	if ($sort_field_options != '') {
678 678
 
679 679
 		?>
680 680
 
@@ -683,9 +683,9 @@  discard block
 block discarded – undo
683 683
 			<select name="sort_by" id="sort_by" onchange="javascript:window.location=this.value;">
684 684
 
685 685
 				<option
686
-					value="<?php echo esc_url( add_query_arg( 'sort_by', '' ) ); ?>" <?php if ( $sort_by == '' ) {
686
+					value="<?php echo esc_url(add_query_arg('sort_by', '')); ?>" <?php if ($sort_by == '') {
687 687
 					echo 'selected="selected"';
688
-				} ?>><?php _e( 'Sort By', 'geodirectory' ); ?></option><?php
688
+				} ?>><?php _e('Sort By', 'geodirectory'); ?></option><?php
689 689
 
690 690
 				echo $sort_field_options; ?>
691 691
 
@@ -713,9 +713,9 @@  discard block
 block discarded – undo
713 713
  *
714 714
  * @return string Returns the section title.
715 715
  */
716
-function geodir_advance_customfields_heading( $title, $field_type ) {
716
+function geodir_advance_customfields_heading($title, $field_type) {
717 717
 
718
-	if ( in_array( $field_type, array( 'multiselect', 'textarea', 'taxonomy' ) ) ) {
718
+	if (in_array($field_type, array('multiselect', 'textarea', 'taxonomy'))) {
719 719
 		$title = '';
720 720
 	}
721 721
 
@@ -737,19 +737,19 @@  discard block
 block discarded – undo
737 737
  * @global object $gd_session       GeoDirectory Session object.
738 738
  * @return string Returns related posts html.
739 739
  */
740
-function geodir_related_posts_display( $request ) {
741
-	if ( ! empty( $request ) ) {
742
-		$before_title = ( isset( $request['before_title'] ) && ! empty( $request['before_title'] ) ) ? $request['before_title'] : '';
743
-		$after_title  = ( isset( $request['after_title'] ) && ! empty( $request['after_title'] ) ) ? $request['after_title'] : '';
744
-
745
-		$title               = ( isset( $request['title'] ) && ! empty( $request['title'] ) ) ? $request['title'] : __( 'Related Listings', 'geodirectory' );
746
-		$post_number         = ( isset( $request['post_number'] ) && ! empty( $request['post_number'] ) ) ? $request['post_number'] : '5';
747
-		$relate_to           = ( isset( $request['relate_to'] ) && ! empty( $request['relate_to'] ) ) ? $request['relate_to'] : 'category';
748
-		$layout              = ( isset( $request['layout'] ) && ! empty( $request['layout'] ) ) ? $request['layout'] : 'gridview_onehalf';
749
-		$add_location_filter = ( isset( $request['add_location_filter'] ) && ! empty( $request['add_location_filter'] ) ) ? $request['add_location_filter'] : '0';
750
-		$listing_width       = ( isset( $request['listing_width'] ) && ! empty( $request['listing_width'] ) ) ? $request['listing_width'] : '';
751
-		$list_sort           = ( isset( $request['list_sort'] ) && ! empty( $request['list_sort'] ) ) ? $request['list_sort'] : 'latest';
752
-		$character_count     = ( isset( $request['character_count'] ) && ! empty( $request['character_count'] ) ) ? $request['character_count'] : '';
740
+function geodir_related_posts_display($request) {
741
+	if (!empty($request)) {
742
+		$before_title = (isset($request['before_title']) && !empty($request['before_title'])) ? $request['before_title'] : '';
743
+		$after_title  = (isset($request['after_title']) && !empty($request['after_title'])) ? $request['after_title'] : '';
744
+
745
+		$title               = (isset($request['title']) && !empty($request['title'])) ? $request['title'] : __('Related Listings', 'geodirectory');
746
+		$post_number         = (isset($request['post_number']) && !empty($request['post_number'])) ? $request['post_number'] : '5';
747
+		$relate_to           = (isset($request['relate_to']) && !empty($request['relate_to'])) ? $request['relate_to'] : 'category';
748
+		$layout              = (isset($request['layout']) && !empty($request['layout'])) ? $request['layout'] : 'gridview_onehalf';
749
+		$add_location_filter = (isset($request['add_location_filter']) && !empty($request['add_location_filter'])) ? $request['add_location_filter'] : '0';
750
+		$listing_width       = (isset($request['listing_width']) && !empty($request['listing_width'])) ? $request['listing_width'] : '';
751
+		$list_sort           = (isset($request['list_sort']) && !empty($request['list_sort'])) ? $request['list_sort'] : 'latest';
752
+		$character_count     = (isset($request['character_count']) && !empty($request['character_count'])) ? $request['character_count'] : '';
753 753
 
754 754
 		global $wpdb, $post, $gd_session, $related_nearest, $related_parent_lat, $related_parent_lon;
755 755
 		$related_parent_lat   = !empty($post->post_latitude) ? $post->post_latitude : '';
@@ -757,10 +757,10 @@  discard block
 block discarded – undo
757 757
 		$arr_detail_page_tabs = geodir_detail_page_tabs_list();
758 758
 
759 759
 		$related_listing_array = array();
760
-		if ( get_option( 'geodir_add_related_listing_posttypes' ) ) {
761
-			$related_listing_array = get_option( 'geodir_add_related_listing_posttypes' );
760
+		if (get_option('geodir_add_related_listing_posttypes')) {
761
+			$related_listing_array = get_option('geodir_add_related_listing_posttypes');
762 762
 		}
763
-		if ( isset($post->post_type) && in_array( $post->post_type, $related_listing_array ) ) {
763
+		if (isset($post->post_type) && in_array($post->post_type, $related_listing_array)) {
764 764
 			$arr_detail_page_tabs['related_listing']['is_display'] = true;
765 765
 		}
766 766
 
@@ -772,90 +772,90 @@  discard block
 block discarded – undo
772 772
 		$tax_field         = 'id';
773 773
 		$category          = array();
774 774
 
775
-		if ( isset( $_REQUEST['backandedit'] ) ) {
776
-			$post      = (object) $gd_session->get( 'listing' );
775
+		if (isset($_REQUEST['backandedit'])) {
776
+			$post      = (object) $gd_session->get('listing');
777 777
 			$post_type = $post->listing_type;
778
-			if ( isset( $_REQUEST['pid'] ) && $_REQUEST['pid'] != '' ) {
778
+			if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
779 779
 				$post_id = $_REQUEST['pid'];
780 780
 			}
781
-		} elseif ( isset( $_REQUEST['pid'] ) && $_REQUEST['pid'] != '' ) {
782
-			$post      = geodir_get_post_info( $_REQUEST['pid'] );
781
+		} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
782
+			$post      = geodir_get_post_info($_REQUEST['pid']);
783 783
 			$post_type = $post->post_type;
784 784
 			$post_id   = $_REQUEST['pid'];
785
-		} elseif ( isset( $post->post_type ) && $post->post_type != '' ) {
785
+		} elseif (isset($post->post_type) && $post->post_type != '') {
786 786
 			$post_type = $post->post_type;
787 787
 			$post_id   = $post->ID;
788 788
 		}
789 789
 
790
-		if ( $relate_to == 'category' ) {
790
+		if ($relate_to == 'category') {
791 791
 
792
-			$category_taxonomy = $post_type . $relate_to;
793
-			if ( isset( $post->{$category_taxonomy} ) && $post->{$category_taxonomy} != '' ) {
794
-				$category = explode( ',', trim( $post->{$category_taxonomy}, ',' ) );
792
+			$category_taxonomy = $post_type.$relate_to;
793
+			if (isset($post->{$category_taxonomy} ) && $post->{$category_taxonomy} != '') {
794
+				$category = explode(',', trim($post->{$category_taxonomy}, ','));
795 795
 			}
796 796
 
797
-		} elseif ( $relate_to == 'tags' ) {
797
+		} elseif ($relate_to == 'tags') {
798 798
 
799
-			$category_taxonomy = $post_type . '_' . $relate_to;
800
-			if ( $post->post_tags != '' ) {
801
-				$category = explode( ',', trim( $post->post_tags, ',' ) );
799
+			$category_taxonomy = $post_type.'_'.$relate_to;
800
+			if ($post->post_tags != '') {
801
+				$category = explode(',', trim($post->post_tags, ','));
802 802
 			}
803 803
 			$tax_field = 'name';
804 804
 		}
805 805
 
806 806
 		/* --- return false in invalid request --- */
807
-		if ( empty( $category ) ) {
807
+		if (empty($category)) {
808 808
 			return false;
809 809
 		}
810 810
 
811 811
 		$all_postypes = geodir_get_posttypes();
812 812
 
813
-		if ( ! in_array( $post_type, $all_postypes ) ) {
813
+		if (!in_array($post_type, $all_postypes)) {
814 814
 			return false;
815 815
 		}
816 816
 
817 817
 		/* --- return false in invalid request --- */
818 818
 
819 819
 		$location_url = '';
820
-		if ( $add_location_filter != '0' ) {
820
+		if ($add_location_filter != '0') {
821 821
 			$location_url             = array();
822
-			$geodir_show_location_url = get_option( 'geodir_show_location_url' );
822
+			$geodir_show_location_url = get_option('geodir_show_location_url');
823 823
 
824
-			$gd_city = get_query_var( 'gd_city' );
824
+			$gd_city = get_query_var('gd_city');
825 825
 
826
-			if ( $gd_city ) {
827
-				$gd_country = get_query_var( 'gd_country' );
828
-				$gd_region  = get_query_var( 'gd_region' );
826
+			if ($gd_city) {
827
+				$gd_country = get_query_var('gd_country');
828
+				$gd_region  = get_query_var('gd_region');
829 829
 			} else {
830 830
 				$location = geodir_get_default_location();
831 831
 
832
-				$gd_country = isset( $location->country_slug ) ? $location->country_slug : '';
833
-				$gd_region  = isset( $location->region_slug ) ? $location->region_slug : '';
834
-				$gd_city    = isset( $location->city_slug ) ? $location->city_slug : '';
832
+				$gd_country = isset($location->country_slug) ? $location->country_slug : '';
833
+				$gd_region  = isset($location->region_slug) ? $location->region_slug : '';
834
+				$gd_city    = isset($location->city_slug) ? $location->city_slug : '';
835 835
 			}
836 836
 
837
-			if ( $geodir_show_location_url == 'all' ) {
837
+			if ($geodir_show_location_url == 'all') {
838 838
 				$location_url[] = $gd_country;
839 839
 				$location_url[] = $gd_region;
840
-			} else if ( $geodir_show_location_url == 'country_city' ) {
840
+			} else if ($geodir_show_location_url == 'country_city') {
841 841
 				$location_url[] = $gd_country;
842
-			} else if ( $geodir_show_location_url == 'region_city' ) {
842
+			} else if ($geodir_show_location_url == 'region_city') {
843 843
 				$location_url[] = $gd_region;
844 844
 			}
845 845
 
846 846
 			$location_url[] = $gd_city;
847 847
 
848
-			$location_url = implode( '/', $location_url );
848
+			$location_url = implode('/', $location_url);
849 849
 		}
850 850
 
851 851
 
852
-		if ( ! empty( $category ) ) {
852
+		if (!empty($category)) {
853 853
 			global $geodir_add_location_url;
854 854
 			$geodir_add_location_url = '0';
855
-			if ( $add_location_filter != '0' ) {
855
+			if ($add_location_filter != '0') {
856 856
 				$geodir_add_location_url = '1';
857 857
 			}
858
-			$viewall_url             = get_term_link( (int) $category[0], $post_type . $category_taxonomy );
858
+			$viewall_url             = get_term_link((int) $category[0], $post_type.$category_taxonomy);
859 859
 			$geodir_add_location_url = null;
860 860
 		}
861 861
 		ob_start();
@@ -865,24 +865,24 @@  discard block
 block discarded – undo
865 865
 		<div class="geodir_locations geodir_location_listing">
866 866
 
867 867
 			<?php
868
-			if ( isset( $request['is_widget'] ) && $request['is_widget'] == '1' ) {
868
+			if (isset($request['is_widget']) && $request['is_widget'] == '1') {
869 869
 				/** geodir_before_title filter Documented in geodirectory_widgets.php */
870
-				$before_title = isset( $before_title ) ? $before_title : apply_filters( 'geodir_before_title', '<h3 class="widget-title">' );
870
+				$before_title = isset($before_title) ? $before_title : apply_filters('geodir_before_title', '<h3 class="widget-title">');
871 871
 				/** geodir_after_title filter Documented in geodirectory_widgets.php */
872
-				$after_title = isset( $after_title ) ? $after_title : apply_filters( 'geodir_after_title', '</h3>' );
872
+				$after_title = isset($after_title) ? $after_title : apply_filters('geodir_after_title', '</h3>');
873 873
 				?>
874 874
 				<div class="location_list_heading clearfix">
875
-					<?php echo $before_title . $title . $after_title; ?>
875
+					<?php echo $before_title.$title.$after_title; ?>
876 876
 				</div>
877 877
 				<?php
878 878
 			}
879 879
 			$query_args = array(
880 880
 				'posts_per_page'   => $post_number,
881 881
 				'is_geodir_loop'   => true,
882
-				'gd_location'      => ( $add_location_filter ) ? true : false,
882
+				'gd_location'      => ($add_location_filter) ? true : false,
883 883
 				'post_type'        => $post_type,
884 884
 				'order_by'         => $list_sort,
885
-				'post__not_in'     => array( $post_id ),
885
+				'post__not_in'     => array($post_id),
886 886
 				'excerpt_length'   => $character_count,
887 887
 				'related_listings' => $is_display
888 888
 			);
@@ -893,7 +893,7 @@  discard block
 block discarded – undo
893 893
 				'terms'    => $category
894 894
 			);
895 895
 
896
-			$query_args['tax_query'] = array( $tax_query );
896
+			$query_args['tax_query'] = array($tax_query);
897 897
 
898 898
 			global $gridview_columns, $post;
899 899
 
@@ -905,21 +905,21 @@  discard block
 block discarded – undo
905 905
 			 * @param array $query_args The query array.
906 906
 			 * @param array $request Related posts request array.
907 907
 			 */
908
-			$query_args = apply_filters( 'geodir_related_posts_widget_query_args', $query_args, $request );
908
+			$query_args = apply_filters('geodir_related_posts_widget_query_args', $query_args, $request);
909 909
 
910
-			query_posts( $query_args );
910
+			query_posts($query_args);
911 911
 
912
-			if ( strstr( $layout, 'gridview' ) ) {
913
-				$listing_view_exp = explode( '_', $layout );
912
+			if (strstr($layout, 'gridview')) {
913
+				$listing_view_exp = explode('_', $layout);
914 914
 				$gridview_columns = $layout;
915 915
 				$layout           = $listing_view_exp[0];
916
-			} else if ( $layout == 'list' ) {
916
+			} else if ($layout == 'list') {
917 917
 				$gridview_columns = '';
918 918
 			}
919 919
 			$related_posts = true;
920 920
 
921 921
 			$related_nearest = false;
922
-			if ( $list_sort == 'nearest' ) {
922
+			if ($list_sort == 'nearest') {
923 923
 				$related_nearest = true;
924 924
 			}
925 925
 
@@ -929,14 +929,14 @@  discard block
 block discarded – undo
929 929
 			 *
930 930
 			 * @since 1.0.0
931 931
 			 */
932
-			$template = apply_filters( "geodir_template_part-related-listing-listview", geodir_locate_template( 'listing-listview' ) );
932
+			$template = apply_filters("geodir_template_part-related-listing-listview", geodir_locate_template('listing-listview'));
933 933
 
934 934
 			/**
935 935
 			 * Includes related listing listview template.
936 936
 			 *
937 937
 			 * @since 1.0.0
938 938
 			 */
939
-			include( $template );
939
+			include($template);
940 940
 
941 941
 			wp_reset_query();
942 942
 			$post            = $origi_post;
@@ -964,12 +964,12 @@  discard block
 block discarded – undo
964 964
 function geodir_category_count_script() {
965 965
 	global $geodir_post_category_str;
966 966
 
967
-	if ( ! empty( $geodir_post_category_str ) ) {
968
-		$geodir_post_category_str = serialize( $geodir_post_category_str );
967
+	if (!empty($geodir_post_category_str)) {
968
+		$geodir_post_category_str = serialize($geodir_post_category_str);
969 969
 	}
970 970
 
971
-	$all_var['post_category_array'] = html_entity_decode( (string) $geodir_post_category_str, ENT_QUOTES, 'UTF-8' );
972
-	$script                         = "var post_category_array = " . json_encode( $all_var ) . ';';
971
+	$all_var['post_category_array'] = html_entity_decode((string) $geodir_post_category_str, ENT_QUOTES, 'UTF-8');
972
+	$script                         = "var post_category_array = ".json_encode($all_var).';';
973 973
 	echo '<script>';
974 974
 	echo $script;
975 975
 	echo '</script>';
@@ -984,8 +984,8 @@  discard block
 block discarded – undo
984 984
  * @return string Returns the default language.
985 985
  */
986 986
 function geodir_get_map_default_language() {
987
-	$geodir_default_map_language = get_option( 'geodir_default_map_language' );
988
-	if ( empty( $geodir_default_map_language ) ) {
987
+	$geodir_default_map_language = get_option('geodir_default_map_language');
988
+	if (empty($geodir_default_map_language)) {
989 989
 		$geodir_default_map_language = 'en';
990 990
 	}
991 991
 
@@ -996,7 +996,7 @@  discard block
 block discarded – undo
996 996
 	 *
997 997
 	 * @param string $geodir_default_map_language Default map language.
998 998
 	 */
999
-	return apply_filters( 'geodir_default_map_language', $geodir_default_map_language );
999
+	return apply_filters('geodir_default_map_language', $geodir_default_map_language);
1000 1000
 }
1001 1001
 
1002 1002
 /**
@@ -1007,7 +1007,7 @@  discard block
 block discarded – undo
1007 1007
  * @return string Returns the api key.
1008 1008
  */
1009 1009
 function geodir_get_map_api_key() {
1010
-	$key = get_option( 'geodir_google_api_key' );
1010
+	$key = get_option('geodir_google_api_key');
1011 1011
 
1012 1012
 	/**
1013 1013
 	 * Filter Google maps api key.
@@ -1016,7 +1016,7 @@  discard block
 block discarded – undo
1016 1016
 	 *
1017 1017
 	 * @param string $key Google maps api key.
1018 1018
 	 */
1019
-	return apply_filters( 'geodir_google_api_key', $key );
1019
+	return apply_filters('geodir_google_api_key', $key);
1020 1020
 }
1021 1021
 
1022 1022
 
@@ -1035,20 +1035,20 @@  discard block
 block discarded – undo
1035 1035
 	global $wp, $post, $wp_query, $wpdb, $geodir_addon_list;
1036 1036
 
1037 1037
 	$is_geodir_page = geodir_is_geodir_page();
1038
-	if ( ! $is_geodir_page ) {
1038
+	if (!$is_geodir_page) {
1039 1039
 		return;
1040 1040
 	}// if non GD page, bail
1041 1041
 
1042 1042
 	$use_gd_meta = true;
1043
-	if ( class_exists( 'WPSEO_Frontend' ) || class_exists( 'All_in_One_SEO_Pack' ) ) {
1043
+	if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) {
1044 1044
 		$use_gd_meta = false;
1045 1045
 
1046
-		if ( geodir_is_page( 'search' ) ) {
1046
+		if (geodir_is_page('search')) {
1047 1047
 			$use_gd_meta = true;
1048 1048
 		}
1049 1049
 	}
1050 1050
 
1051
-	if ( ! $use_gd_meta ) {
1051
+	if (!$use_gd_meta) {
1052 1052
 		return;
1053 1053
 	}// bail if Yoast Wordpress SEO or All_in_One_SEO_Pack active.
1054 1054
 
@@ -1056,170 +1056,170 @@  discard block
 block discarded – undo
1056 1056
 
1057 1057
 	$all_postypes = geodir_get_posttypes();
1058 1058
 
1059
-	$geodir_taxonomies = geodir_get_taxonomies( '', true );
1059
+	$geodir_taxonomies = geodir_get_taxonomies('', true);
1060 1060
 
1061 1061
 	$meta_desc = '';
1062 1062
 	$meta_key  = '';
1063
-	if ( isset( $current_term->ID ) && $current_term->ID == geodir_location_page_id() ) {
1063
+	if (isset($current_term->ID) && $current_term->ID == geodir_location_page_id()) {
1064 1064
 		/**
1065 1065
 		 * Filter SEO meta location description.
1066 1066
 		 *
1067 1067
 		 * @since 1.0.0
1068 1068
 		 */
1069
-		$meta_desc = apply_filters( 'geodir_seo_meta_location_description', '' );
1069
+		$meta_desc = apply_filters('geodir_seo_meta_location_description', '');
1070 1070
 		$meta_desc .= '';
1071 1071
 	}
1072
-	if ( have_posts() && is_single() OR is_page() ) {
1073
-		while ( have_posts() ) {
1072
+	if (have_posts() && is_single() OR is_page()) {
1073
+		while (have_posts()) {
1074 1074
 			the_post();
1075 1075
 
1076
-			if ( has_excerpt() ) {
1077
-				$out_excerpt = strip_tags( strip_shortcodes( get_the_excerpt() ) );
1078
-				if ( empty( $out_excerpt ) ) {
1079
-					$out_excerpt = strip_tags( do_shortcode( get_the_excerpt() ) );
1076
+			if (has_excerpt()) {
1077
+				$out_excerpt = strip_tags(strip_shortcodes(get_the_excerpt()));
1078
+				if (empty($out_excerpt)) {
1079
+					$out_excerpt = strip_tags(do_shortcode(get_the_excerpt()));
1080 1080
 				}
1081
-				$out_excerpt = str_replace( array( "\r\n", "\r", "\n" ), "", $out_excerpt );
1081
+				$out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $out_excerpt);
1082 1082
 			} else {
1083
-				$out_excerpt = str_replace( array( "\r\n", "\r", "\n" ), "", $post->post_content );
1084
-				$out_excerpt = strip_tags( strip_shortcodes( $out_excerpt ) );
1085
-				if ( empty( $out_excerpt ) ) {
1086
-					$out_excerpt = strip_tags( do_shortcode( $out_excerpt ) ); // parse short code from content
1083
+				$out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $post->post_content);
1084
+				$out_excerpt = strip_tags(strip_shortcodes($out_excerpt));
1085
+				if (empty($out_excerpt)) {
1086
+					$out_excerpt = strip_tags(do_shortcode($out_excerpt)); // parse short code from content
1087 1087
 				}
1088
-				$out_excerpt = trim( wp_trim_words( $out_excerpt, 35, '' ), '.!?,;:-' );
1088
+				$out_excerpt = trim(wp_trim_words($out_excerpt, 35, ''), '.!?,;:-');
1089 1089
 			}
1090 1090
 
1091 1091
 			$meta_desc .= $out_excerpt;
1092 1092
 		}
1093
-	} elseif ( ( is_category() || is_tag() ) && isset( $current_term->taxonomy ) && in_array( $current_term->taxonomy, $geodir_taxonomies ) ) {
1094
-		if ( is_category() ) {
1095
-			$meta_desc .= __( "Posts related to Category:", 'geodirectory' ) . " " . ucfirst( single_cat_title( "", false ) );
1096
-		} elseif ( is_tag() ) {
1097
-			$meta_desc .= __( "Posts related to Tag:", 'geodirectory' ) . " " . ucfirst( single_tag_title( "", false ) );
1093
+	} elseif ((is_category() || is_tag()) && isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
1094
+		if (is_category()) {
1095
+			$meta_desc .= __("Posts related to Category:", 'geodirectory')." ".ucfirst(single_cat_title("", false));
1096
+		} elseif (is_tag()) {
1097
+			$meta_desc .= __("Posts related to Tag:", 'geodirectory')." ".ucfirst(single_tag_title("", false));
1098 1098
 		}
1099
-	} elseif ( isset( $current_term->taxonomy ) && in_array( $current_term->taxonomy, $geodir_taxonomies ) ) {
1100
-		$meta_desc .= isset( $current_term->description ) ? $current_term->description : '';
1099
+	} elseif (isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
1100
+		$meta_desc .= isset($current_term->description) ? $current_term->description : '';
1101 1101
 	}
1102 1102
 
1103 1103
 
1104 1104
 	$geodir_post_type       = geodir_get_current_posttype();
1105
-	$geodir_post_type_info  = get_post_type_object( $geodir_post_type );
1106
-	$geodir_is_page_listing = geodir_is_page( 'listing' ) ? true : false;
1107
-
1108
-	$category_taxonomy = geodir_get_taxonomies( $geodir_post_type );
1109
-	$tag_taxonomy      = geodir_get_taxonomies( $geodir_post_type, true );
1110
-
1111
-	$geodir_is_category = isset( $category_taxonomy[0] ) && get_query_var( $category_taxonomy[0] ) ? get_query_var( $category_taxonomy[0] ) : false;
1112
-	$geodir_is_tag      = isset( $tag_taxonomy[0] ) && get_query_var( $tag_taxonomy[0] ) ? true : false;
1113
-
1114
-	$geodir_is_search        = geodir_is_page( 'search' ) ? true : false;
1115
-	$geodir_is_location      = geodir_is_page( 'location' ) ? true : false;
1116
-	$geodir_location_manager = isset( $geodir_addon_list['geodir_location_manager'] ) && $geodir_addon_list['geodir_location_manager'] = 'yes' ? true : false;
1117
-	$godir_location_terms    = geodir_get_current_location_terms( 'query_vars' );
1118
-	$gd_city                 = $geodir_location_manager && isset( $godir_location_terms['gd_city'] ) ? $godir_location_terms['gd_city'] : null;
1119
-	$gd_region               = $geodir_location_manager && isset( $godir_location_terms['gd_region'] ) ? $godir_location_terms['gd_region'] : null;
1120
-	$gd_country              = $geodir_location_manager && isset( $godir_location_terms['gd_country'] ) ? $godir_location_terms['gd_country'] : null;
1121
-	$replace_location        = __( 'Everywhere', 'geodirectory' );
1105
+	$geodir_post_type_info  = get_post_type_object($geodir_post_type);
1106
+	$geodir_is_page_listing = geodir_is_page('listing') ? true : false;
1107
+
1108
+	$category_taxonomy = geodir_get_taxonomies($geodir_post_type);
1109
+	$tag_taxonomy      = geodir_get_taxonomies($geodir_post_type, true);
1110
+
1111
+	$geodir_is_category = isset($category_taxonomy[0]) && get_query_var($category_taxonomy[0]) ? get_query_var($category_taxonomy[0]) : false;
1112
+	$geodir_is_tag      = isset($tag_taxonomy[0]) && get_query_var($tag_taxonomy[0]) ? true : false;
1113
+
1114
+	$geodir_is_search        = geodir_is_page('search') ? true : false;
1115
+	$geodir_is_location      = geodir_is_page('location') ? true : false;
1116
+	$geodir_location_manager = isset($geodir_addon_list['geodir_location_manager']) && $geodir_addon_list['geodir_location_manager'] = 'yes' ? true : false;
1117
+	$godir_location_terms    = geodir_get_current_location_terms('query_vars');
1118
+	$gd_city                 = $geodir_location_manager && isset($godir_location_terms['gd_city']) ? $godir_location_terms['gd_city'] : null;
1119
+	$gd_region               = $geodir_location_manager && isset($godir_location_terms['gd_region']) ? $godir_location_terms['gd_region'] : null;
1120
+	$gd_country              = $geodir_location_manager && isset($godir_location_terms['gd_country']) ? $godir_location_terms['gd_country'] : null;
1121
+	$replace_location        = __('Everywhere', 'geodirectory');
1122 1122
 	$location_id             = null;
1123
-	if ( $geodir_location_manager ) {
1124
-		$sql           = $wpdb->prepare( "SELECT location_id FROM " . POST_LOCATION_TABLE . " WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array( $gd_city ) );
1125
-		$location_id   = (int) $wpdb->get_var( $sql );
1123
+	if ($geodir_location_manager) {
1124
+		$sql           = $wpdb->prepare("SELECT location_id FROM ".POST_LOCATION_TABLE." WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array($gd_city));
1125
+		$location_id   = (int) $wpdb->get_var($sql);
1126 1126
 		$location_type = geodir_what_is_current_location();
1127
-		if ( $location_type == 'city' ) {
1128
-			$replace_location = geodir_get_current_location( array( 'what' => 'city', 'echo' => false ) );
1129
-		} elseif ( $location_type == 'region' ) {
1130
-			$replace_location = geodir_get_current_location( array( 'what' => 'region', 'echo' => false ) );
1131
-		} elseif ( $location_type == 'country' ) {
1132
-			$replace_location = geodir_get_current_location( array( 'what' => 'country', 'echo' => false ) );
1133
-			$replace_location = __( $replace_location, 'geodirectory' );
1127
+		if ($location_type == 'city') {
1128
+			$replace_location = geodir_get_current_location(array('what' => 'city', 'echo' => false));
1129
+		} elseif ($location_type == 'region') {
1130
+			$replace_location = geodir_get_current_location(array('what' => 'region', 'echo' => false));
1131
+		} elseif ($location_type == 'country') {
1132
+			$replace_location = geodir_get_current_location(array('what' => 'country', 'echo' => false));
1133
+			$replace_location = __($replace_location, 'geodirectory');
1134 1134
 		}
1135
-		$country          = get_query_var( 'gd_country' );
1136
-		$region           = get_query_var( 'gd_region' );
1137
-		$city             = get_query_var( 'gd_city' );
1135
+		$country          = get_query_var('gd_country');
1136
+		$region           = get_query_var('gd_region');
1137
+		$city             = get_query_var('gd_city');
1138 1138
 		$current_location = '';
1139
-		if ( $country != '' ) {
1140
-			$current_location = get_actual_location_name( 'country', $country, true );
1139
+		if ($country != '') {
1140
+			$current_location = get_actual_location_name('country', $country, true);
1141 1141
 		}
1142
-		if ( $region != '' ) {
1143
-			$current_location = get_actual_location_name( 'region', $region );
1142
+		if ($region != '') {
1143
+			$current_location = get_actual_location_name('region', $region);
1144 1144
 		}
1145
-		if ( $city != '' ) {
1146
-			$current_location = get_actual_location_name( 'city', $city );
1145
+		if ($city != '') {
1146
+			$current_location = get_actual_location_name('city', $city);
1147 1147
 		}
1148 1148
 		$replace_location = $current_location != '' ? $current_location : $replace_location;
1149 1149
 	}
1150 1150
 
1151 1151
 	$geodir_meta_keys = '';
1152 1152
 	$geodir_meta_desc = '';
1153
-	if ( $is_geodir_page && ! empty( $geodir_post_type_info ) ) {
1154
-		if ( $geodir_is_page_listing || $geodir_is_search || geodir_is_page( 'add-listing' ) ) {
1155
-			$geodir_meta_keys = isset( $geodir_post_type_info->seo['meta_keyword'] ) && $geodir_post_type_info->seo['meta_keyword'] != '' ? $geodir_post_type_info->seo['meta_keyword'] : $geodir_meta_keys;
1153
+	if ($is_geodir_page && !empty($geodir_post_type_info)) {
1154
+		if ($geodir_is_page_listing || $geodir_is_search || geodir_is_page('add-listing')) {
1155
+			$geodir_meta_keys = isset($geodir_post_type_info->seo['meta_keyword']) && $geodir_post_type_info->seo['meta_keyword'] != '' ? $geodir_post_type_info->seo['meta_keyword'] : $geodir_meta_keys;
1156 1156
 
1157
-			$geodir_meta_desc = isset( $geodir_post_type_info->description ) ? $geodir_post_type_info->description : $geodir_meta_desc;
1158
-			$geodir_meta_desc = isset( $geodir_post_type_info->seo['meta_description'] ) && $geodir_post_type_info->seo['meta_description'] != '' ? $geodir_post_type_info->seo['meta_description'] : $geodir_meta_desc;
1157
+			$geodir_meta_desc = isset($geodir_post_type_info->description) ? $geodir_post_type_info->description : $geodir_meta_desc;
1158
+			$geodir_meta_desc = isset($geodir_post_type_info->seo['meta_description']) && $geodir_post_type_info->seo['meta_description'] != '' ? $geodir_post_type_info->seo['meta_description'] : $geodir_meta_desc;
1159 1159
 
1160
-			if ( $geodir_is_category ) {
1161
-				$category = $geodir_is_category ? get_term_by( 'slug', $geodir_is_category, $category_taxonomy[0] ) : null;
1162
-				if ( isset( $category->term_id ) && ! empty( $category->term_id ) ) {
1160
+			if ($geodir_is_category) {
1161
+				$category = $geodir_is_category ? get_term_by('slug', $geodir_is_category, $category_taxonomy[0]) : null;
1162
+				if (isset($category->term_id) && !empty($category->term_id)) {
1163 1163
 					$category_id   = $category->term_id;
1164
-					$category_desc = trim( $category->description ) != '' ? trim( $category->description ) : get_tax_meta( $category_id, 'ct_cat_top_desc', false, $geodir_post_type );
1165
-					if ( $location_id ) {
1166
-						$option_name    = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id;
1167
-						$cat_loc_option = get_option( $option_name );
1168
-
1169
-						$gd_cat_loc_default = ! empty( $cat_loc_option ) && isset( $cat_loc_option['gd_cat_loc_default'] ) && $cat_loc_option['gd_cat_loc_default'] > 0 ? true : false;
1170
-						if ( ! $gd_cat_loc_default ) {
1171
-							$option_name   = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id . '_' . $location_id;
1172
-							$option        = get_option( $option_name );
1173
-							$category_desc = isset( $option['gd_cat_loc_desc'] ) && trim( $option['gd_cat_loc_desc'] ) != '' ? trim( $option['gd_cat_loc_desc'] ) : $category_desc;
1164
+					$category_desc = trim($category->description) != '' ? trim($category->description) : get_tax_meta($category_id, 'ct_cat_top_desc', false, $geodir_post_type);
1165
+					if ($location_id) {
1166
+						$option_name    = 'geodir_cat_loc_'.$geodir_post_type.'_'.$category_id;
1167
+						$cat_loc_option = get_option($option_name);
1168
+
1169
+						$gd_cat_loc_default = !empty($cat_loc_option) && isset($cat_loc_option['gd_cat_loc_default']) && $cat_loc_option['gd_cat_loc_default'] > 0 ? true : false;
1170
+						if (!$gd_cat_loc_default) {
1171
+							$option_name   = 'geodir_cat_loc_'.$geodir_post_type.'_'.$category_id.'_'.$location_id;
1172
+							$option        = get_option($option_name);
1173
+							$category_desc = isset($option['gd_cat_loc_desc']) && trim($option['gd_cat_loc_desc']) != '' ? trim($option['gd_cat_loc_desc']) : $category_desc;
1174 1174
 						}
1175 1175
 					}
1176
-					$geodir_meta_desc = __( "Posts related to Category:", 'geodirectory' ) . " " . ucfirst( single_cat_title( "", false ) ) . '. ' . $category_desc;
1176
+					$geodir_meta_desc = __("Posts related to Category:", 'geodirectory')." ".ucfirst(single_cat_title("", false)).'. '.$category_desc;
1177 1177
 				}
1178
-			} else if ( $geodir_is_tag ) {
1179
-				$geodir_meta_desc = __( "Posts related to Tag:", 'geodirectory' ) . " " . ucfirst( single_tag_title( "", false ) ) . '. ' . $geodir_meta_desc;
1178
+			} else if ($geodir_is_tag) {
1179
+				$geodir_meta_desc = __("Posts related to Tag:", 'geodirectory')." ".ucfirst(single_tag_title("", false)).'. '.$geodir_meta_desc;
1180 1180
 			}
1181 1181
 		}
1182 1182
 	}
1183 1183
 
1184 1184
 
1185 1185
 	$gd_page = '';
1186
-	if ( geodir_is_page( 'home' ) ) {
1186
+	if (geodir_is_page('home')) {
1187 1187
 		$gd_page   = 'home';
1188
-		$meta_desc = ( get_option( 'geodir_meta_desc_homepage' ) ) ? get_option( 'geodir_meta_desc_homepage' ) : $meta_desc;
1189
-	} elseif ( geodir_is_page( 'detail' ) ) {
1188
+		$meta_desc = (get_option('geodir_meta_desc_homepage')) ? get_option('geodir_meta_desc_homepage') : $meta_desc;
1189
+	} elseif (geodir_is_page('detail')) {
1190 1190
 		$gd_page   = 'detail';
1191
-		$meta_desc = ( get_option( 'geodir_meta_desc_detail' ) ) ? get_option( 'geodir_meta_desc_detail' ) : $meta_desc;
1192
-	} elseif ( geodir_is_page( 'pt' ) ) {
1191
+		$meta_desc = (get_option('geodir_meta_desc_detail')) ? get_option('geodir_meta_desc_detail') : $meta_desc;
1192
+	} elseif (geodir_is_page('pt')) {
1193 1193
 		$gd_page   = 'pt';
1194
-		$meta_desc = ( get_option( 'geodir_meta_desc_pt' ) ) ? get_option( 'geodir_meta_desc_pt' ) : $meta_desc;
1195
-	} elseif ( geodir_is_page( 'listing' ) ) {
1194
+		$meta_desc = (get_option('geodir_meta_desc_pt')) ? get_option('geodir_meta_desc_pt') : $meta_desc;
1195
+	} elseif (geodir_is_page('listing')) {
1196 1196
 		$gd_page   = 'listing';
1197
-		$meta_desc = ( get_option( 'geodir_meta_desc_listing' ) ) ? get_option( 'geodir_meta_desc_listing' ) : $meta_desc;
1198
-	} elseif ( geodir_is_page( 'location' ) ) {
1197
+		$meta_desc = (get_option('geodir_meta_desc_listing')) ? get_option('geodir_meta_desc_listing') : $meta_desc;
1198
+	} elseif (geodir_is_page('location')) {
1199 1199
 		$gd_page   = 'location';
1200
-		$meta_desc = ( get_option( 'geodir_meta_desc_location' ) ) ? get_option( 'geodir_meta_desc_location' ) : $meta_desc;
1201
-		$meta_desc = apply_filters( 'geodir_seo_meta_location_description', $meta_desc );
1200
+		$meta_desc = (get_option('geodir_meta_desc_location')) ? get_option('geodir_meta_desc_location') : $meta_desc;
1201
+		$meta_desc = apply_filters('geodir_seo_meta_location_description', $meta_desc);
1202 1202
 
1203
-	} elseif ( geodir_is_page( 'search' ) ) {
1203
+	} elseif (geodir_is_page('search')) {
1204 1204
 		$gd_page   = 'search';
1205
-		$meta_desc = ( get_option( 'geodir_meta_desc_search' ) ) ? get_option( 'geodir_meta_desc_search' ) : $meta_desc;
1206
-	} elseif ( geodir_is_page( 'add-listing' ) ) {
1205
+		$meta_desc = (get_option('geodir_meta_desc_search')) ? get_option('geodir_meta_desc_search') : $meta_desc;
1206
+	} elseif (geodir_is_page('add-listing')) {
1207 1207
 		$gd_page   = 'add-listing';
1208
-		$meta_desc = ( get_option( 'geodir_meta_desc_add-listing' ) ) ? get_option( 'geodir_meta_desc_add-listing' ) : $meta_desc;
1209
-	} elseif ( geodir_is_page( 'author' ) ) {
1208
+		$meta_desc = (get_option('geodir_meta_desc_add-listing')) ? get_option('geodir_meta_desc_add-listing') : $meta_desc;
1209
+	} elseif (geodir_is_page('author')) {
1210 1210
 		$gd_page   = 'author';
1211
-		$meta_desc = ( get_option( 'geodir_meta_desc_author' ) ) ? get_option( 'geodir_meta_desc_author' ) : $meta_desc;
1212
-	} elseif ( geodir_is_page( 'login' ) ) {
1211
+		$meta_desc = (get_option('geodir_meta_desc_author')) ? get_option('geodir_meta_desc_author') : $meta_desc;
1212
+	} elseif (geodir_is_page('login')) {
1213 1213
 		$gd_page   = 'login';
1214
-		$meta_desc = ( get_option( 'geodir_meta_desc_login' ) ) ? get_option( 'geodir_meta_desc_login' ) : $meta_desc;
1215
-	} elseif ( geodir_is_page( 'listing-success' ) ) {
1214
+		$meta_desc = (get_option('geodir_meta_desc_login')) ? get_option('geodir_meta_desc_login') : $meta_desc;
1215
+	} elseif (geodir_is_page('listing-success')) {
1216 1216
 		$gd_page   = 'listing-success';
1217
-		$meta_desc = ( get_option( 'geodir_meta_desc_listing-success' ) ) ? get_option( 'geodir_meta_desc_listing-success' ) : $meta_desc;
1217
+		$meta_desc = (get_option('geodir_meta_desc_listing-success')) ? get_option('geodir_meta_desc_listing-success') : $meta_desc;
1218 1218
 	}
1219 1219
 
1220 1220
 
1221
-	if ( $meta_desc ) {
1222
-		$meta_desc = stripslashes_deep( $meta_desc );
1221
+	if ($meta_desc) {
1222
+		$meta_desc = stripslashes_deep($meta_desc);
1223 1223
 		/**
1224 1224
 		 * Filter page description to replace variables.
1225 1225
 		 *
@@ -1228,7 +1228,7 @@  discard block
 block discarded – undo
1228 1228
 		 * @param string $title   The page description including variables.
1229 1229
 		 * @param string $gd_page The GeoDirectory page type if any.
1230 1230
 		 */
1231
-		$meta_desc = apply_filters( 'geodir_seo_meta_description_pre', __( $meta_desc, 'geodirectory' ), $gd_page, '' );
1231
+		$meta_desc = apply_filters('geodir_seo_meta_description_pre', __($meta_desc, 'geodirectory'), $gd_page, '');
1232 1232
 
1233 1233
 		/**
1234 1234
 		 * Filter SEO meta description.
@@ -1237,49 +1237,49 @@  discard block
 block discarded – undo
1237 1237
 		 *
1238 1238
 		 * @param string $meta_desc Meta description content.
1239 1239
 		 */
1240
-		echo apply_filters( 'geodir_seo_meta_description', '<meta name="description" content="' . $meta_desc . '" />', $meta_desc );
1240
+		echo apply_filters('geodir_seo_meta_description', '<meta name="description" content="'.$meta_desc.'" />', $meta_desc);
1241 1241
 	}
1242 1242
 
1243 1243
 	// meta keywords
1244
-	if ( isset( $post->post_type ) && in_array( $post->post_type, $all_postypes ) ) {
1245
-		$place_tags = wp_get_post_terms( $post->ID, $post->post_type . '_tags', array( "fields" => "names" ) );
1246
-		$place_cats = wp_get_post_terms( $post->ID, $post->post_type . 'category', array( "fields" => "names" ) );
1244
+	if (isset($post->post_type) && in_array($post->post_type, $all_postypes)) {
1245
+		$place_tags = wp_get_post_terms($post->ID, $post->post_type.'_tags', array("fields" => "names"));
1246
+		$place_cats = wp_get_post_terms($post->ID, $post->post_type.'category', array("fields" => "names"));
1247 1247
 
1248
-		$meta_key .= implode( ", ", array_merge( (array) $place_cats, (array) $place_tags ) );
1248
+		$meta_key .= implode(", ", array_merge((array) $place_cats, (array) $place_tags));
1249 1249
 	} else {
1250 1250
 		$posttags = get_the_tags();
1251
-		if ( $posttags ) {
1252
-			foreach ( $posttags as $tag ) {
1253
-				$meta_key .= $tag->name . ' ';
1251
+		if ($posttags) {
1252
+			foreach ($posttags as $tag) {
1253
+				$meta_key .= $tag->name.' ';
1254 1254
 			}
1255 1255
 		} else {
1256
-			$tags = get_tags( array( 'orderby' => 'count', 'order' => 'DESC' ) );
1256
+			$tags = get_tags(array('orderby' => 'count', 'order' => 'DESC'));
1257 1257
 			$xt   = 1;
1258 1258
 
1259
-			foreach ( $tags as $tag ) {
1260
-				if ( $xt <= 20 ) {
1261
-					$meta_key .= $tag->name . ", ";
1259
+			foreach ($tags as $tag) {
1260
+				if ($xt <= 20) {
1261
+					$meta_key .= $tag->name.", ";
1262 1262
 				}
1263 1263
 
1264
-				$xt ++;
1264
+				$xt++;
1265 1265
 			}
1266 1266
 		}
1267 1267
 	}
1268 1268
 
1269
-	$meta_key         = $meta_key != '' ? rtrim( trim( $meta_key ), "," ) : $meta_key;
1270
-	$geodir_meta_keys = $geodir_meta_keys != '' ? ( $meta_key != '' ? $meta_key . ', ' . $geodir_meta_keys : $geodir_meta_keys ) : $meta_key;
1271
-	if ( $geodir_meta_keys != '' ) {
1272
-		$geodir_meta_keys = strip_tags( $geodir_meta_keys );
1273
-		$geodir_meta_keys = esc_html( $geodir_meta_keys );
1274
-		$geodir_meta_keys = geodir_strtolower( $geodir_meta_keys );
1275
-		$geodir_meta_keys = wp_html_excerpt( $geodir_meta_keys, 1000, '' );
1276
-		$geodir_meta_keys = str_replace( '%location%', $replace_location, $geodir_meta_keys );
1269
+	$meta_key         = $meta_key != '' ? rtrim(trim($meta_key), ",") : $meta_key;
1270
+	$geodir_meta_keys = $geodir_meta_keys != '' ? ($meta_key != '' ? $meta_key.', '.$geodir_meta_keys : $geodir_meta_keys) : $meta_key;
1271
+	if ($geodir_meta_keys != '') {
1272
+		$geodir_meta_keys = strip_tags($geodir_meta_keys);
1273
+		$geodir_meta_keys = esc_html($geodir_meta_keys);
1274
+		$geodir_meta_keys = geodir_strtolower($geodir_meta_keys);
1275
+		$geodir_meta_keys = wp_html_excerpt($geodir_meta_keys, 1000, '');
1276
+		$geodir_meta_keys = str_replace('%location%', $replace_location, $geodir_meta_keys);
1277 1277
 
1278
-		$meta_key = rtrim( trim( $geodir_meta_keys ), "," );
1278
+		$meta_key = rtrim(trim($geodir_meta_keys), ",");
1279 1279
 	}
1280 1280
 
1281
-	if ( $meta_key ) {
1282
-		$meta_key = stripslashes_deep( $meta_key );
1281
+	if ($meta_key) {
1282
+		$meta_key = stripslashes_deep($meta_key);
1283 1283
 		/**
1284 1284
 		 * Filter SEO meta keywords.
1285 1285
 		 *
@@ -1287,7 +1287,7 @@  discard block
 block discarded – undo
1287 1287
 		 *
1288 1288
 		 * @param string $meta_desc Meta keywords.
1289 1289
 		 */
1290
-		echo apply_filters( 'geodir_seo_meta_keywords', '<meta name="keywords" content="' . $meta_key . '" />', $meta_key );
1290
+		echo apply_filters('geodir_seo_meta_keywords', '<meta name="keywords" content="'.$meta_key.'" />', $meta_key);
1291 1291
 	}
1292 1292
 
1293 1293
 }
@@ -1307,8 +1307,8 @@  discard block
 block discarded – undo
1307 1307
 
1308 1308
 	$geodir_detail_page_tabs_array = geodir_detail_page_tabs_array();
1309 1309
 
1310
-	foreach ( $geodir_detail_page_tabs_array as $key => $tabs_obj ) {
1311
-		$geodir_detail_page_tabs_key_value_array[ $key ] = $tabs_obj['heading_text'];
1310
+	foreach ($geodir_detail_page_tabs_array as $key => $tabs_obj) {
1311
+		$geodir_detail_page_tabs_key_value_array[$key] = $tabs_obj['heading_text'];
1312 1312
 	}
1313 1313
 
1314 1314
 	return $geodir_detail_page_tabs_key_value_array;
@@ -1330,57 +1330,57 @@  discard block
 block discarded – undo
1330 1330
 	 * @since 1.0.0
1331 1331
 	 */
1332 1332
 	$arr_tabs['post_profile'] = array(
1333
-		'heading_text'  => __( 'Profile', 'geodirectory' ),
1333
+		'heading_text'  => __('Profile', 'geodirectory'),
1334 1334
 		'is_active_tab' => true,
1335
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_profile' ),
1335
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_profile'),
1336 1336
 		'tab_content'   => ''
1337 1337
 	);
1338
-	$arr_tabs['post_info']    = array(
1339
-		'heading_text'  => __( 'More Info', 'geodirectory' ),
1338
+	$arr_tabs['post_info'] = array(
1339
+		'heading_text'  => __('More Info', 'geodirectory'),
1340 1340
 		'is_active_tab' => false,
1341
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_info' ),
1341
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_info'),
1342 1342
 		'tab_content'   => ''
1343 1343
 	);
1344 1344
 
1345 1345
 	$arr_tabs['post_images'] = array(
1346
-		'heading_text'  => __( 'Photos', 'geodirectory' ),
1346
+		'heading_text'  => __('Photos', 'geodirectory'),
1347 1347
 		'is_active_tab' => false,
1348
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_images' ),
1348
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_images'),
1349 1349
 		'tab_content'   => ''
1350 1350
 	);
1351 1351
 
1352 1352
 	$arr_tabs['post_video'] = array(
1353
-		'heading_text'  => __( 'Video', 'geodirectory' ),
1353
+		'heading_text'  => __('Video', 'geodirectory'),
1354 1354
 		'is_active_tab' => false,
1355
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_video' ),
1355
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_video'),
1356 1356
 		'tab_content'   => ''
1357 1357
 	);
1358 1358
 
1359 1359
 	$arr_tabs['special_offers'] = array(
1360
-		'heading_text'  => __( 'Special Offers', 'geodirectory' ),
1360
+		'heading_text'  => __('Special Offers', 'geodirectory'),
1361 1361
 		'is_active_tab' => false,
1362
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'special_offers' ),
1362
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'special_offers'),
1363 1363
 		'tab_content'   => ''
1364 1364
 	);
1365 1365
 
1366 1366
 	$arr_tabs['post_map'] = array(
1367
-		'heading_text'  => __( 'Map', 'geodirectory' ),
1367
+		'heading_text'  => __('Map', 'geodirectory'),
1368 1368
 		'is_active_tab' => false,
1369
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_map' ),
1369
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_map'),
1370 1370
 		'tab_content'   => ''
1371 1371
 	);
1372 1372
 
1373 1373
 	$arr_tabs['reviews'] = array(
1374
-		'heading_text'  => __( 'Reviews', 'geodirectory' ),
1374
+		'heading_text'  => __('Reviews', 'geodirectory'),
1375 1375
 		'is_active_tab' => false,
1376
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'reviews' ),
1376
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'reviews'),
1377 1377
 		'tab_content'   => 'review display'
1378 1378
 	);
1379 1379
 
1380 1380
 	$arr_tabs['related_listing'] = array(
1381
-		'heading_text'  => __( 'Related Listing', 'geodirectory' ),
1381
+		'heading_text'  => __('Related Listing', 'geodirectory'),
1382 1382
 		'is_active_tab' => false,
1383
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'related_listing' ),
1383
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'related_listing'),
1384 1384
 		'tab_content'   => ''
1385 1385
 	);
1386 1386
 
@@ -1389,7 +1389,7 @@  discard block
 block discarded – undo
1389 1389
 	 *
1390 1390
 	 * @since 1.0.0
1391 1391
 	 */
1392
-	return apply_filters( 'geodir_detail_page_tab_list_extend', $arr_tabs );
1392
+	return apply_filters('geodir_detail_page_tab_list_extend', $arr_tabs);
1393 1393
 
1394 1394
 
1395 1395
 }
@@ -1403,13 +1403,13 @@  discard block
 block discarded – undo
1403 1403
  * @return mixed|array Tabs array.
1404 1404
  */
1405 1405
 function geodir_detail_page_tabs_list() {
1406
-	$tabs_excluded = get_option( 'geodir_detail_page_tabs_excluded' );
1406
+	$tabs_excluded = get_option('geodir_detail_page_tabs_excluded');
1407 1407
 	$tabs_array    = geodir_detail_page_tabs_array();
1408 1408
 
1409
-	if ( ! empty( $tabs_excluded ) ) {
1410
-		foreach ( $tabs_excluded as $tab ) {
1411
-			if ( array_key_exists( $tab, $tabs_array ) ) {
1412
-				unset( $tabs_array[ $tab ] );
1409
+	if (!empty($tabs_excluded)) {
1410
+		foreach ($tabs_excluded as $tab) {
1411
+			if (array_key_exists($tab, $tabs_array)) {
1412
+				unset($tabs_array[$tab]);
1413 1413
 			}
1414 1414
 		}
1415 1415
 	}
@@ -1433,58 +1433,58 @@  discard block
 block discarded – undo
1433 1433
 function geodir_show_detail_page_tabs() {
1434 1434
 	global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields, $preview;
1435 1435
 
1436
-	$post_id            = ! empty( $post ) && isset( $post->ID ) ? (int) $post->ID : 0;
1437
-	$request_post_id    = ! empty( $_REQUEST['p'] ) ? (int) $_REQUEST['p'] : 0;
1438
-	$is_backend_preview = ( is_single() && ! empty( $_REQUEST['post_type'] ) && ! empty( $_REQUEST['preview'] ) && ! empty( $_REQUEST['p'] ) ) && is_super_admin() ? true : false; // skip if preview from backend
1436
+	$post_id            = !empty($post) && isset($post->ID) ? (int) $post->ID : 0;
1437
+	$request_post_id    = !empty($_REQUEST['p']) ? (int) $_REQUEST['p'] : 0;
1438
+	$is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend
1439 1439
 
1440
-	if ( $is_backend_preview && ! $post_id > 0 && $request_post_id > 0 ) {
1441
-		$post = geodir_get_post_info( $request_post_id );
1442
-		setup_postdata( $post );
1440
+	if ($is_backend_preview && !$post_id > 0 && $request_post_id > 0) {
1441
+		$post = geodir_get_post_info($request_post_id);
1442
+		setup_postdata($post);
1443 1443
 	}
1444 1444
 
1445
-	$geodir_post_detail_fields = geodir_show_listing_info( 'moreinfo' );
1445
+	$geodir_post_detail_fields = geodir_show_listing_info('moreinfo');
1446 1446
 
1447 1447
 
1448
-	if ( geodir_is_page( 'detail' ) ) {
1449
-		$video                 = geodir_get_video( $post->ID );
1450
-		$special_offers        = geodir_get_special_offers( $post->ID );
1448
+	if (geodir_is_page('detail')) {
1449
+		$video                 = geodir_get_video($post->ID);
1450
+		$special_offers        = geodir_get_special_offers($post->ID);
1451 1451
 		$related_listing_array = array();
1452
-		if ( get_option( 'geodir_add_related_listing_posttypes' ) ) {
1453
-			$related_listing_array = get_option( 'geodir_add_related_listing_posttypes' );
1452
+		if (get_option('geodir_add_related_listing_posttypes')) {
1453
+			$related_listing_array = get_option('geodir_add_related_listing_posttypes');
1454 1454
 		}
1455 1455
 
1456 1456
 
1457
-		$excluded_tabs = get_option( 'geodir_detail_page_tabs_excluded' );
1458
-		if ( ! $excluded_tabs ) {
1457
+		$excluded_tabs = get_option('geodir_detail_page_tabs_excluded');
1458
+		if (!$excluded_tabs) {
1459 1459
 			$excluded_tabs = array();
1460 1460
 		}
1461 1461
 
1462 1462
 		$related_listing = '';
1463
-		if ( in_array( $post->post_type, $related_listing_array ) && ! in_array( 'related_listing', $excluded_tabs ) ) {
1463
+		if (in_array($post->post_type, $related_listing_array) && !in_array('related_listing', $excluded_tabs)) {
1464 1464
 			$request = array(
1465
-				'post_number'         => get_option( 'geodir_related_post_count' ),
1466
-				'relate_to'           => get_option( 'geodir_related_post_relate_to' ),
1467
-				'layout'              => get_option( 'geodir_related_post_listing_view' ),
1468
-				'add_location_filter' => get_option( 'geodir_related_post_location_filter' ),
1469
-				'list_sort'           => get_option( 'geodir_related_post_sortby' ),
1470
-				'character_count'     => get_option( 'geodir_related_post_excerpt' )
1465
+				'post_number'         => get_option('geodir_related_post_count'),
1466
+				'relate_to'           => get_option('geodir_related_post_relate_to'),
1467
+				'layout'              => get_option('geodir_related_post_listing_view'),
1468
+				'add_location_filter' => get_option('geodir_related_post_location_filter'),
1469
+				'list_sort'           => get_option('geodir_related_post_sortby'),
1470
+				'character_count'     => get_option('geodir_related_post_excerpt')
1471 1471
 			);
1472 1472
 
1473
-			if ( $post->post_type == 'gd_event' && defined( 'GDEVENTS_VERSION' ) ) {
1474
-				$related_listing = geodir_get_detail_page_related_events( $request );
1473
+			if ($post->post_type == 'gd_event' && defined('GDEVENTS_VERSION')) {
1474
+				$related_listing = geodir_get_detail_page_related_events($request);
1475 1475
 			} else {
1476
-				$related_listing = geodir_related_posts_display( $request );
1476
+				$related_listing = geodir_related_posts_display($request);
1477 1477
 			}
1478 1478
 
1479 1479
 		}
1480 1480
 
1481
-		$post_images = geodir_get_images( $post->ID, 'thumbnail' );
1481
+		$post_images = geodir_get_images($post->ID, 'thumbnail');
1482 1482
 		$thumb_image = '';
1483
-		if ( ! empty( $post_images ) ) {
1484
-			foreach ( $post_images as $image ) {
1485
-				$caption = ( ! empty( $image->caption ) ) ? $image->caption : '';
1486
-				$thumb_image .= '<a href="' . $image->src . '" title="' . $caption . '">';
1487
-				$thumb_image .= geodir_show_image( $image, 'thumbnail', true, false );
1483
+		if (!empty($post_images)) {
1484
+			foreach ($post_images as $image) {
1485
+				$caption = (!empty($image->caption)) ? $image->caption : '';
1486
+				$thumb_image .= '<a href="'.$image->src.'" title="'.$caption.'">';
1487
+				$thumb_image .= geodir_show_image($image, 'thumbnail', true, false);
1488 1488
 				$thumb_image .= '</a>';
1489 1489
 			}
1490 1490
 		}
@@ -1493,11 +1493,11 @@  discard block
 block discarded – undo
1493 1493
 		$map_args['map_canvas_name'] = 'detail_page_map_canvas';
1494 1494
 		$map_args['width']           = '600';
1495 1495
 		$map_args['height']          = '300';
1496
-		if ( $post->post_mapzoom ) {
1497
-			$map_args['zoom'] = '' . $post->post_mapzoom . '';
1496
+		if ($post->post_mapzoom) {
1497
+			$map_args['zoom'] = ''.$post->post_mapzoom.'';
1498 1498
 		}
1499 1499
 		$map_args['autozoom']                 = false;
1500
-		$map_args['scrollwheel']              = ( get_option( 'geodir_add_listing_mouse_scroll' ) ) ? 0 : 1;
1500
+		$map_args['scrollwheel']              = (get_option('geodir_add_listing_mouse_scroll')) ? 0 : 1;
1501 1501
 		$map_args['child_collapse']           = '0';
1502 1502
 		$map_args['enable_cat_filters']       = false;
1503 1503
 		$map_args['enable_text_search']       = false;
@@ -1506,43 +1506,43 @@  discard block
 block discarded – undo
1506 1506
 		$map_args['enable_jason_on_load']     = true;
1507 1507
 		$map_args['enable_map_direction']     = true;
1508 1508
 		$map_args['map_class_name']           = 'geodir-map-detail-page';
1509
-		$map_args['maptype']                  = ( ! empty( $post->post_mapview ) ) ? $post->post_mapview : 'ROADMAP';
1510
-	} else if ( geodir_is_page( 'preview' ) ) {
1511
-		$video          = isset( $post->geodir_video ) ? $post->geodir_video : '';
1512
-		$special_offers = isset( $post->geodir_special_offers ) ? $post->geodir_special_offers : '';
1509
+		$map_args['maptype']                  = (!empty($post->post_mapview)) ? $post->post_mapview : 'ROADMAP';
1510
+	} else if (geodir_is_page('preview')) {
1511
+		$video          = isset($post->geodir_video) ? $post->geodir_video : '';
1512
+		$special_offers = isset($post->geodir_special_offers) ? $post->geodir_special_offers : '';
1513 1513
 
1514
-		if ( isset( $post->post_images ) ) {
1515
-			$post->post_images = trim( $post->post_images, "," );
1514
+		if (isset($post->post_images)) {
1515
+			$post->post_images = trim($post->post_images, ",");
1516 1516
 		}
1517 1517
 
1518
-		if ( isset( $post->post_images ) && ! empty( $post->post_images ) ) {
1519
-			$post_images = explode( ",", $post->post_images );
1518
+		if (isset($post->post_images) && !empty($post->post_images)) {
1519
+			$post_images = explode(",", $post->post_images);
1520 1520
 		}
1521 1521
 
1522 1522
 		$thumb_image = '';
1523
-		if ( ! empty( $post_images ) ) {
1524
-			foreach ( $post_images as $image ) {
1525
-				if ( $image != '' ) {
1526
-					$thumb_image .= '<a href="' . $image . '">';
1527
-					$thumb_image .= geodir_show_image( array( 'src' => $image ), 'thumbnail', true, false );
1523
+		if (!empty($post_images)) {
1524
+			foreach ($post_images as $image) {
1525
+				if ($image != '') {
1526
+					$thumb_image .= '<a href="'.$image.'">';
1527
+					$thumb_image .= geodir_show_image(array('src' => $image), 'thumbnail', true, false);
1528 1528
 					$thumb_image .= '</a>';
1529 1529
 				}
1530 1530
 			}
1531 1531
 		}
1532 1532
 
1533 1533
 		global $map_jason;
1534
-		$marker_json      = $post->marker_json != '' ? json_decode( $post->marker_json, true ) : array();
1535
-		$marker_icon      = ( ! empty( $marker_json ) && ! empty( $marker_json['i'] ) ) ? $marker_json['i'] : '';
1536
-		$icon_size        = geodir_get_marker_size( $marker_icon );
1534
+		$marker_json      = $post->marker_json != '' ? json_decode($post->marker_json, true) : array();
1535
+		$marker_icon      = (!empty($marker_json) && !empty($marker_json['i'])) ? $marker_json['i'] : '';
1536
+		$icon_size        = geodir_get_marker_size($marker_icon);
1537 1537
 		$marker_json['w'] = $icon_size['w'];
1538 1538
 		$marker_json['h'] = $icon_size['h'];
1539
-		$map_jason[]      = json_encode( $marker_json );
1539
+		$map_jason[]      = json_encode($marker_json);
1540 1540
 
1541
-		$address_latitude  = isset( $post->post_latitude ) ? $post->post_latitude : '';
1542
-		$address_longitude = isset( $post->post_longitude ) ? $post->post_longitude : '';
1543
-		$mapview           = isset( $post->post_mapview ) ? $post->post_mapview : '';
1544
-		$mapzoom           = isset( $post->post_mapzoom ) ? $post->post_mapzoom : '';
1545
-		if ( ! $mapzoom ) {
1541
+		$address_latitude  = isset($post->post_latitude) ? $post->post_latitude : '';
1542
+		$address_longitude = isset($post->post_longitude) ? $post->post_longitude : '';
1543
+		$mapview           = isset($post->post_mapview) ? $post->post_mapview : '';
1544
+		$mapzoom           = isset($post->post_mapzoom) ? $post->post_mapzoom : '';
1545
+		if (!$mapzoom) {
1546 1546
 			$mapzoom = 12;
1547 1547
 		}
1548 1548
 
@@ -1565,37 +1565,37 @@  discard block
 block discarded – undo
1565 1565
 		$map_args['map_class_name']           = 'geodir-map-preview-page';
1566 1566
 	}
1567 1567
 
1568
-	$arr_detail_page_tabs = geodir_detail_page_tabs_list();// get this sooner so we can get the active tab for the user
1568
+	$arr_detail_page_tabs = geodir_detail_page_tabs_list(); // get this sooner so we can get the active tab for the user
1569 1569
 
1570 1570
 	$active_tab       = '';
1571 1571
 	$active_tab_name  = '';
1572 1572
 	$default_tab      = '';
1573 1573
 	$default_tab_name = '';
1574
-	foreach ( $arr_detail_page_tabs as $tab_index => $tabs ) {
1575
-		if ( isset( $tabs['is_active_tab'] ) && $tabs['is_active_tab'] && ! empty( $tabs['is_display'] ) && isset( $tabs['heading_text'] ) && $tabs['heading_text'] ) {
1574
+	foreach ($arr_detail_page_tabs as $tab_index => $tabs) {
1575
+		if (isset($tabs['is_active_tab']) && $tabs['is_active_tab'] && !empty($tabs['is_display']) && isset($tabs['heading_text']) && $tabs['heading_text']) {
1576 1576
 			$active_tab      = $tab_index;
1577
-			$active_tab_name = __( $tabs['heading_text'], 'geodirectory' );
1577
+			$active_tab_name = __($tabs['heading_text'], 'geodirectory');
1578 1578
 		}
1579 1579
 
1580
-		if ( $default_tab === '' && ! empty( $tabs['is_display'] ) && ! empty( $tabs['heading_text'] ) ) {
1580
+		if ($default_tab === '' && !empty($tabs['is_display']) && !empty($tabs['heading_text'])) {
1581 1581
 			$default_tab      = $tab_index;
1582
-			$default_tab_name = __( $tabs['heading_text'], 'geodirectory' );
1582
+			$default_tab_name = __($tabs['heading_text'], 'geodirectory');
1583 1583
 		}
1584 1584
 	}
1585 1585
 
1586
-	if ( $active_tab === '' && $default_tab !== '' ) { // Make first tab acs a active tab if not any tab is active.
1587
-		if ( isset( $arr_detail_page_tabs[ $active_tab ] ) && isset( $arr_detail_page_tabs[ $active_tab ]['is_active_tab'] ) ) {
1588
-			$arr_detail_page_tabs[ $active_tab ]['is_active_tab'] = false;
1586
+	if ($active_tab === '' && $default_tab !== '') { // Make first tab acs a active tab if not any tab is active.
1587
+		if (isset($arr_detail_page_tabs[$active_tab]) && isset($arr_detail_page_tabs[$active_tab]['is_active_tab'])) {
1588
+			$arr_detail_page_tabs[$active_tab]['is_active_tab'] = false;
1589 1589
 		}
1590 1590
 
1591
-		$arr_detail_page_tabs[ $default_tab ]['is_active_tab'] = true;
1591
+		$arr_detail_page_tabs[$default_tab]['is_active_tab'] = true;
1592 1592
 		$active_tab                                            = $default_tab;
1593 1593
 		$active_tab_name                                       = $default_tab_name;
1594 1594
 	}
1595
-	$tab_list = ( get_option( 'geodir_disable_tabs', false ) ) ? true : false;
1595
+	$tab_list = (get_option('geodir_disable_tabs', false)) ? true : false;
1596 1596
 	?>
1597 1597
 	<div class="geodir-tabs" id="gd-tabs" style="position:relative;">
1598
-		<?php if ( ! $tab_list ){ ?>
1598
+		<?php if (!$tab_list) { ?>
1599 1599
 		<div id="geodir-tab-mobile-menu">
1600 1600
 			<i class="fa fa-bars"></i>
1601 1601
 			<span class="geodir-mobile-active-tab"><?php echo $active_tab_name; ?></span>
@@ -1610,26 +1610,26 @@  discard block
 block discarded – undo
1610 1610
 			 * @since 1.0.0
1611 1611
 			 * @see   'geodir_after_tab_list'
1612 1612
 			 */
1613
-			do_action( 'geodir_before_tab_list' ); ?>
1613
+			do_action('geodir_before_tab_list'); ?>
1614 1614
 			<?php
1615 1615
 
1616
-			foreach ( $arr_detail_page_tabs as $tab_index => $detail_page_tab ) {
1617
-				if ( $detail_page_tab['is_display'] ) {
1616
+			foreach ($arr_detail_page_tabs as $tab_index => $detail_page_tab) {
1617
+				if ($detail_page_tab['is_display']) {
1618 1618
 
1619
-					if ( ! $tab_list ) {
1619
+					if (!$tab_list) {
1620 1620
 						?>
1621 1621
 						<dt></dt> <!-- added to comply with validation -->
1622
-						<dd <?php if ( $detail_page_tab['is_active_tab'] ){ ?>class="geodir-tab-active"<?php } ?> ><a
1622
+						<dd <?php if ($detail_page_tab['is_active_tab']) { ?>class="geodir-tab-active"<?php } ?> ><a
1623 1623
 								data-tab="#<?php echo $tab_index; ?>"
1624
-								data-status="enable"><?php _e( $detail_page_tab['heading_text'], 'geodirectory' ); ?></a>
1624
+								data-status="enable"><?php _e($detail_page_tab['heading_text'], 'geodirectory'); ?></a>
1625 1625
 						</dd>
1626 1626
 						<?php
1627 1627
 					}
1628 1628
 					ob_start() // start tab content buffering
1629 1629
 					?>
1630 1630
 					<li id="<?php echo $tab_index; ?>Tab">
1631
-						<?php if ( $tab_list ) {
1632
-							$tab_title = '<span class="gd-tab-list-title" ><a href="#' . $tab_index . '">' . __( $detail_page_tab['heading_text'], 'geodirectory' ) . '</a></span><hr />';
1631
+						<?php if ($tab_list) {
1632
+							$tab_title = '<span class="gd-tab-list-title" ><a href="#'.$tab_index.'">'.__($detail_page_tab['heading_text'], 'geodirectory').'</a></span><hr />';
1633 1633
 							/**
1634 1634
 							 * Filter the tab list title html.
1635 1635
 							 *
@@ -1639,7 +1639,7 @@  discard block
 block discarded – undo
1639 1639
 							 * @param string $tab_index      The tab index type.
1640 1640
 							 * @param array $detail_page_tab The array of values including title text.
1641 1641
 							 */
1642
-							echo apply_filters( 'geodir_tab_list_title', $tab_title, $tab_index, $detail_page_tab );
1642
+							echo apply_filters('geodir_tab_list_title', $tab_title, $tab_index, $detail_page_tab);
1643 1643
 						} ?>
1644 1644
 						<div id="<?php echo $tab_index; ?>" class="hash-offset"></div>
1645 1645
 						<?php
@@ -1650,7 +1650,7 @@  discard block
 block discarded – undo
1650 1650
 						 *
1651 1651
 						 * @param string $tab_index The tab name ID.
1652 1652
 						 */
1653
-						do_action( 'geodir_before_tab_content', $tab_index );
1653
+						do_action('geodir_before_tab_content', $tab_index);
1654 1654
 
1655 1655
 						/**
1656 1656
 						 * Called before the details tab content is output per tab.
@@ -1660,21 +1660,21 @@  discard block
 block discarded – undo
1660 1660
 						 * @since 1.0.0
1661 1661
 						 * @todo  do we need this if we have the hook above? 'geodir_before_tab_content'
1662 1662
 						 */
1663
-						do_action( 'geodir_before_' . $tab_index . '_tab_content' );
1663
+						do_action('geodir_before_'.$tab_index.'_tab_content');
1664 1664
 						/// write a code to generate content of each tab
1665
-						switch ( $tab_index ) {
1665
+						switch ($tab_index) {
1666 1666
 							case 'post_profile':
1667 1667
 								/**
1668 1668
 								 * Called before the listing description content on the details page tab.
1669 1669
 								 *
1670 1670
 								 * @since 1.0.0
1671 1671
 								 */
1672
-								do_action( 'geodir_before_description_on_listing_detail' );
1673
-								if ( geodir_is_page( 'detail' ) ) {
1672
+								do_action('geodir_before_description_on_listing_detail');
1673
+								if (geodir_is_page('detail')) {
1674 1674
 									the_content();
1675 1675
 								} else {
1676 1676
 									/** This action is documented in geodirectory_template_actions.php */
1677
-									echo apply_filters( 'the_content', stripslashes( $post->post_desc ) );
1677
+									echo apply_filters('the_content', stripslashes($post->post_desc));
1678 1678
 								}
1679 1679
 
1680 1680
 								/**
@@ -1682,7 +1682,7 @@  discard block
 block discarded – undo
1682 1682
 								 *
1683 1683
 								 * @since 1.0.0
1684 1684
 								 */
1685
-								do_action( 'geodir_after_description_on_listing_detail' );
1685
+								do_action('geodir_after_description_on_listing_detail');
1686 1686
 								break;
1687 1687
 							case 'post_info':
1688 1688
 								echo $geodir_post_detail_fields;
@@ -1692,32 +1692,32 @@  discard block
 block discarded – undo
1692 1692
 								break;
1693 1693
 							case 'post_video':
1694 1694
 								// some browsers hide $_POST data if used for embeds so we repalce with a placeholder
1695
-								if ( $preview ) {
1696
-									if ( $video ) {
1697
-										echo "<span class='gd-video-embed-preview' ><p class='gd-video-preview-text'><i class=\"fa fa-video-camera\" aria-hidden=\"true\"></i><br />" . __( 'Video Preview Placeholder', 'geodirectory' ) . "</p></span>";
1695
+								if ($preview) {
1696
+									if ($video) {
1697
+										echo "<span class='gd-video-embed-preview' ><p class='gd-video-preview-text'><i class=\"fa fa-video-camera\" aria-hidden=\"true\"></i><br />".__('Video Preview Placeholder', 'geodirectory')."</p></span>";
1698 1698
 									}
1699 1699
 								} else {
1700 1700
 
1701 1701
 									// stop payment manager filtering content length
1702
-									$filter_priority = has_filter( 'the_content', 'geodir_payments_the_content' );
1703
-									if ( false !== $filter_priority ) {
1704
-										remove_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1702
+									$filter_priority = has_filter('the_content', 'geodir_payments_the_content');
1703
+									if (false !== $filter_priority) {
1704
+										remove_filter('the_content', 'geodir_payments_the_content', $filter_priority);
1705 1705
 									}
1706 1706
 
1707 1707
 									/** This action is documented in geodirectory_template_actions.php */
1708
-									echo apply_filters( 'the_content', stripslashes( $video ) );// we apply the_content filter so oembed works also;
1708
+									echo apply_filters('the_content', stripslashes($video)); // we apply the_content filter so oembed works also;
1709 1709
 
1710
-									if ( false !== $filter_priority ) {
1711
-										add_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1710
+									if (false !== $filter_priority) {
1711
+										add_filter('the_content', 'geodir_payments_the_content', $filter_priority);
1712 1712
 									}
1713 1713
 								}
1714 1714
 								break;
1715 1715
 							case 'special_offers':
1716
-								echo apply_filters( 'gd_special_offers_content', wpautop( stripslashes( $special_offers ) ) );
1716
+								echo apply_filters('gd_special_offers_content', wpautop(stripslashes($special_offers)));
1717 1717
 
1718 1718
 								break;
1719 1719
 							case 'post_map':
1720
-								geodir_draw_map( $map_args );
1720
+								geodir_draw_map($map_args);
1721 1721
 								break;
1722 1722
 							case 'reviews':
1723 1723
 								comments_template();
@@ -1726,7 +1726,7 @@  discard block
 block discarded – undo
1726 1726
 								echo $related_listing;
1727 1727
 								break;
1728 1728
 							default: {
1729
-								if ( ( isset( $post->{$tab_index} ) || ( ! isset( $post->{$tab_index} ) && ( strpos( $tab_index, 'gd_tab_' ) !== false || $tab_index == 'link_business' ) ) ) && ! empty( $detail_page_tab['tab_content'] ) ) {
1729
+								if ((isset($post->{$tab_index} ) || (!isset($post->{$tab_index} ) && (strpos($tab_index, 'gd_tab_') !== false || $tab_index == 'link_business'))) && !empty($detail_page_tab['tab_content'])) {
1730 1730
 									echo $detail_page_tab['tab_content'];
1731 1731
 								}
1732 1732
 							}
@@ -1738,7 +1738,7 @@  discard block
 block discarded – undo
1738 1738
 						 *
1739 1739
 						 * @since 1.0.0
1740 1740
 						 */
1741
-						do_action( 'geodir_after_tab_content', $tab_index );
1741
+						do_action('geodir_after_tab_content', $tab_index);
1742 1742
 
1743 1743
 						/**
1744 1744
 						 * Called after the details tab content is output per tab.
@@ -1748,7 +1748,7 @@  discard block
 block discarded – undo
1748 1748
 						 * @since 1.0.0
1749 1749
 						 * @todo  do we need this if we have the hook above? 'geodir_after_tab_content'
1750 1750
 						 */
1751
-						do_action( 'geodir_after_' . $tab_index . '_tab_content' );
1751
+						do_action('geodir_after_'.$tab_index.'_tab_content');
1752 1752
 						?> </li>
1753 1753
 					<?php
1754 1754
 					/**
@@ -1756,7 +1756,7 @@  discard block
 block discarded – undo
1756 1756
 					 *
1757 1757
 					 * @since 1.0.0
1758 1758
 					 */
1759
-					$arr_detail_page_tabs[ $tab_index ]['tab_content'] = apply_filters( "geodir_modify_" . $detail_page_tab['tab_content'] . "_tab_content", ob_get_clean() );
1759
+					$arr_detail_page_tabs[$tab_index]['tab_content'] = apply_filters("geodir_modify_".$detail_page_tab['tab_content']."_tab_content", ob_get_clean());
1760 1760
 				} // end of if for is_display
1761 1761
 			}// end of foreach
1762 1762
 
@@ -1766,14 +1766,14 @@  discard block
 block discarded – undo
1766 1766
 			 * @since 1.0.0
1767 1767
 			 * @see   'geodir_before_tab_list'
1768 1768
 			 */
1769
-			do_action( 'geodir_after_tab_list' );
1769
+			do_action('geodir_after_tab_list');
1770 1770
 			?>
1771
-			<?php if ( ! $tab_list ){ ?></dl><?php } ?>
1772
-		<ul class="geodir-tabs-content entry-content <?php if ( $tab_list ) { ?>geodir-tabs-list<?php } ?>"
1771
+			<?php if (!$tab_list) { ?></dl><?php } ?>
1772
+		<ul class="geodir-tabs-content entry-content <?php if ($tab_list) { ?>geodir-tabs-list<?php } ?>"
1773 1773
 		    style="position:relative;">
1774 1774
 			<?php
1775
-			foreach ( $arr_detail_page_tabs as $detail_page_tab ) {
1776
-				if ( $detail_page_tab['is_display'] && ! empty( $detail_page_tab['tab_content'] ) ) {
1775
+			foreach ($arr_detail_page_tabs as $detail_page_tab) {
1776
+				if ($detail_page_tab['is_display'] && !empty($detail_page_tab['tab_content'])) {
1777 1777
 					echo $detail_page_tab['tab_content'];
1778 1778
 				}// end of if
1779 1779
 			}// end of foreach
@@ -1783,11 +1783,11 @@  discard block
 block discarded – undo
1783 1783
 			 *
1784 1784
 			 * @since 1.0.0
1785 1785
 			 */
1786
-			do_action( 'geodir_add_tab_content' ); ?>
1786
+			do_action('geodir_add_tab_content'); ?>
1787 1787
 		</ul>
1788 1788
 		<!--gd-tabs-content ul end-->
1789 1789
 	</div>
1790
-	<?php if ( ! $tab_list ) { ?>
1790
+	<?php if (!$tab_list) { ?>
1791 1791
 		<script>
1792 1792
 			if (window.location.hash && window.location.hash.indexOf('&') === -1 && jQuery(window.location.hash + 'Tab').length) {
1793 1793
 				hashVal = window.location.hash;
@@ -1819,31 +1819,31 @@  discard block
 block discarded – undo
1819 1819
  *
1820 1820
  * @return mixed Image file.
1821 1821
  */
1822
-function geodir_exif( $file ) {
1823
-	if ( empty( $file ) || ! is_array( $file ) ) {
1822
+function geodir_exif($file) {
1823
+	if (empty($file) || !is_array($file)) {
1824 1824
 		return $file;
1825 1825
 	}
1826 1826
 
1827
-	$file_path = ! empty( $file['tmp_name'] ) ? sanitize_text_field( $file['tmp_name'] ) : '';
1828
-	if ( ! ( $file_path && file_exists( $file_path ) ) ) {
1827
+	$file_path = !empty($file['tmp_name']) ? sanitize_text_field($file['tmp_name']) : '';
1828
+	if (!($file_path && file_exists($file_path))) {
1829 1829
 		return $file;
1830 1830
 	}
1831 1831
 	$file['file'] = $file_path;
1832 1832
 
1833
-	if ( ! file_is_valid_image( $file_path ) ) {
1833
+	if (!file_is_valid_image($file_path)) {
1834 1834
 		return $file; // Bail if file is not an image.
1835 1835
 	}
1836 1836
 
1837
-	if ( ! function_exists( 'wp_get_image_editor' ) ) {
1837
+	if (!function_exists('wp_get_image_editor')) {
1838 1838
 		return $file;
1839 1839
 	}
1840 1840
 
1841 1841
 	$mime_type = $file['type'];
1842 1842
 	$exif      = array();
1843
-	if ( $mime_type == 'image/jpeg' && function_exists( 'exif_read_data' ) ) {
1843
+	if ($mime_type == 'image/jpeg' && function_exists('exif_read_data')) {
1844 1844
 		try {
1845
-			$exif = exif_read_data( $file_path );
1846
-		} catch ( Exception $e ) {
1845
+			$exif = exif_read_data($file_path);
1846
+		} catch (Exception $e) {
1847 1847
 			$exif = array();
1848 1848
 		}
1849 1849
 	}
@@ -1852,13 +1852,13 @@  discard block
 block discarded – undo
1852 1852
 	$flip        = false;
1853 1853
 	$modify      = false;
1854 1854
 	$orientation = 0;
1855
-	if ( ! empty( $exif ) && isset( $exif['Orientation'] ) ) {
1856
-		switch ( (int) $exif['Orientation'] ) {
1855
+	if (!empty($exif) && isset($exif['Orientation'])) {
1856
+		switch ((int) $exif['Orientation']) {
1857 1857
 			case 1:
1858 1858
 				// do nothing
1859 1859
 				break;
1860 1860
 			case 2:
1861
-				$flip   = array( false, true );
1861
+				$flip   = array(false, true);
1862 1862
 				$modify = true;
1863 1863
 				break;
1864 1864
 			case 3:
@@ -1867,13 +1867,13 @@  discard block
 block discarded – undo
1867 1867
 				$modify      = true;
1868 1868
 				break;
1869 1869
 			case 4:
1870
-				$flip   = array( true, false );
1870
+				$flip   = array(true, false);
1871 1871
 				$modify = true;
1872 1872
 				break;
1873 1873
 			case 5:
1874 1874
 				$orientation = - 90;
1875 1875
 				$rotate      = true;
1876
-				$flip        = array( false, true );
1876
+				$flip        = array(false, true);
1877 1877
 				$modify      = true;
1878 1878
 				break;
1879 1879
 			case 6:
@@ -1884,7 +1884,7 @@  discard block
 block discarded – undo
1884 1884
 			case 7:
1885 1885
 				$orientation = - 270;
1886 1886
 				$rotate      = true;
1887
-				$flip        = array( false, true );
1887
+				$flip        = array(false, true);
1888 1888
 				$modify      = true;
1889 1889
 				break;
1890 1890
 			case 8:
@@ -1910,31 +1910,31 @@  discard block
 block discarded – undo
1910 1910
 	 * @param int|null $quality Image Compression quality between 1-100% scale. Default null.
1911 1911
 	 * @param string $quality   Image mime type.
1912 1912
 	 */
1913
-	$quality = apply_filters( 'geodir_image_upload_set_quality', $quality, $mime_type );
1914
-	if ( $quality !== null ) {
1913
+	$quality = apply_filters('geodir_image_upload_set_quality', $quality, $mime_type);
1914
+	if ($quality !== null) {
1915 1915
 		$modify = true;
1916 1916
 	}
1917 1917
 
1918
-	if ( ! $modify ) {
1918
+	if (!$modify) {
1919 1919
 		return $file; // no change
1920 1920
 	}
1921 1921
 
1922
-	$image = wp_get_image_editor( $file_path );
1923
-	if ( ! is_wp_error( $image ) ) {
1924
-		if ( $rotate ) {
1925
-			$image->rotate( $orientation );
1922
+	$image = wp_get_image_editor($file_path);
1923
+	if (!is_wp_error($image)) {
1924
+		if ($rotate) {
1925
+			$image->rotate($orientation);
1926 1926
 		}
1927 1927
 
1928
-		if ( ! empty( $flip ) ) {
1929
-			$image->flip( $flip[0], $flip[1] );
1928
+		if (!empty($flip)) {
1929
+			$image->flip($flip[0], $flip[1]);
1930 1930
 		}
1931 1931
 
1932
-		if ( $quality !== null ) {
1933
-			$image->set_quality( (int) $quality );
1932
+		if ($quality !== null) {
1933
+			$image->set_quality((int) $quality);
1934 1934
 		}
1935 1935
 
1936
-		$result = $image->save( $file_path );
1937
-		if ( ! is_wp_error( $result ) ) {
1936
+		$result = $image->save($file_path);
1937
+		if (!is_wp_error($result)) {
1938 1938
 			$file['file']     = $result['path'];
1939 1939
 			$file['tmp_name'] = $result['path'];
1940 1940
 		}
@@ -1961,7 +1961,7 @@  discard block
 block discarded – undo
1961 1961
  *
1962 1962
  * @return string Returns the recent reviews html.
1963 1963
  */
1964
-function geodir_get_recent_reviews( $g_size = 60, $no_comments = 10, $comment_lenth = 60, $show_pass_post = false ) {
1964
+function geodir_get_recent_reviews($g_size = 60, $no_comments = 10, $comment_lenth = 60, $show_pass_post = false) {
1965 1965
 	global $wpdb, $tablecomments, $tableposts, $rating_table_name, $gd_session;
1966 1966
 	$tablecomments = $wpdb->comments;
1967 1967
 	$tableposts    = $wpdb->posts;
@@ -1971,28 +1971,28 @@  discard block
 block discarded – undo
1971 1971
 	$region_filter  = '';
1972 1972
 	$country_filter = '';
1973 1973
 
1974
-	if ( $gd_session->get( 'gd_multi_location' ) ) {
1975
-		if ( $gd_ses_country = $gd_session->get( 'gd_country' ) ) {
1976
-			$country_filter = $wpdb->prepare( " AND r.post_country=%s ", str_replace( "-", " ", $gd_ses_country ) );
1974
+	if ($gd_session->get('gd_multi_location')) {
1975
+		if ($gd_ses_country = $gd_session->get('gd_country')) {
1976
+			$country_filter = $wpdb->prepare(" AND r.post_country=%s ", str_replace("-", " ", $gd_ses_country));
1977 1977
 		}
1978 1978
 
1979
-		if ( $gd_ses_region = $gd_session->get( 'gd_region' ) ) {
1980
-			$region_filter = $wpdb->prepare( " AND r.post_region=%s ", str_replace( "-", " ", $gd_ses_region ) );
1979
+		if ($gd_ses_region = $gd_session->get('gd_region')) {
1980
+			$region_filter = $wpdb->prepare(" AND r.post_region=%s ", str_replace("-", " ", $gd_ses_region));
1981 1981
 		}
1982 1982
 
1983
-		if ( $gd_ses_city = $gd_session->get( 'gd_city' ) ) {
1984
-			$city_filter = $wpdb->prepare( " AND r.post_city=%s ", str_replace( "-", " ", $gd_ses_city ) );
1983
+		if ($gd_ses_city = $gd_session->get('gd_city')) {
1984
+			$city_filter = $wpdb->prepare(" AND r.post_city=%s ", str_replace("-", " ", $gd_ses_city));
1985 1985
 		}
1986 1986
 	}
1987 1987
 
1988 1988
 	$review_table = GEODIR_REVIEW_TABLE;
1989 1989
 	$request      = "SELECT r.id as ID, r.post_type, r.comment_id as comment_ID, r.post_date as comment_date,r.overall_rating, r.user_id, r.post_id FROM $review_table as r WHERE r.post_status = 1 AND r.status =1 AND r.overall_rating>=1 $country_filter $region_filter $city_filter ORDER BY r.post_date DESC, r.id DESC LIMIT $no_comments";
1990 1990
 
1991
-	$comments = $wpdb->get_results( $request );
1991
+	$comments = $wpdb->get_results($request);
1992 1992
 
1993
-	foreach ( $comments as $comment ) {
1993
+	foreach ($comments as $comment) {
1994 1994
 		// Set the extra comment info needed.
1995
-		$comment_extra = $wpdb->get_row( "SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID" );
1995
+		$comment_extra = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID");
1996 1996
 		//echo "SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID";
1997 1997
 		$comment->comment_content      = $comment_extra->comment_content;
1998 1998
 		$comment->comment_author       = $comment_extra->comment_author;
@@ -2000,75 +2000,75 @@  discard block
 block discarded – undo
2000 2000
 
2001 2001
 		$comment_id      = '';
2002 2002
 		$comment_id      = $comment->comment_ID;
2003
-		$comment_content = strip_tags( $comment->comment_content );
2003
+		$comment_content = strip_tags($comment->comment_content);
2004 2004
 
2005
-		$comment_content = preg_replace( '#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content );
2005
+		$comment_content = preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content);
2006 2006
 
2007
-		$permalink            = get_permalink( $comment->ID ) . "#comment-" . $comment->comment_ID;
2007
+		$permalink            = get_permalink($comment->ID)."#comment-".$comment->comment_ID;
2008 2008
 		$comment_author_email = $comment->comment_author_email;
2009 2009
 		$comment_post_ID      = $comment->post_id;
2010 2010
 
2011 2011
 		$na = true;
2012
-		if ( function_exists( 'icl_object_id' ) && icl_object_id( $comment_post_ID, $comment->post_type, true ) ) {
2013
-			$comment_post_ID2 = icl_object_id( $comment_post_ID, $comment->post_type, false );
2014
-			if ( $comment_post_ID == $comment_post_ID2 ) {
2012
+		if (function_exists('icl_object_id') && icl_object_id($comment_post_ID, $comment->post_type, true)) {
2013
+			$comment_post_ID2 = icl_object_id($comment_post_ID, $comment->post_type, false);
2014
+			if ($comment_post_ID == $comment_post_ID2) {
2015 2015
 			} else {
2016 2016
 				$na = false;
2017 2017
 			}
2018 2018
 		}
2019 2019
 
2020
-		$post_title        = get_the_title( $comment_post_ID );
2021
-		$permalink         = get_permalink( $comment_post_ID );
2022
-		$comment_permalink = $permalink . "#comment-" . $comment->comment_ID;
2023
-		$read_more         = '<a class="comment_excerpt" href="' . $comment_permalink . '">' . __( 'Read more', 'geodirectory' ) . '</a>';
2020
+		$post_title        = get_the_title($comment_post_ID);
2021
+		$permalink         = get_permalink($comment_post_ID);
2022
+		$comment_permalink = $permalink."#comment-".$comment->comment_ID;
2023
+		$read_more         = '<a class="comment_excerpt" href="'.$comment_permalink.'">'.__('Read more', 'geodirectory').'</a>';
2024 2024
 
2025
-		$comment_content_length = strlen( $comment_content );
2026
-		if ( $comment_content_length > $comment_lenth ) {
2027
-			$comment_excerpt = geodir_utf8_substr( $comment_content, 0, $comment_lenth ) . '... ' . $read_more;
2025
+		$comment_content_length = strlen($comment_content);
2026
+		if ($comment_content_length > $comment_lenth) {
2027
+			$comment_excerpt = geodir_utf8_substr($comment_content, 0, $comment_lenth).'... '.$read_more;
2028 2028
 		} else {
2029 2029
 			$comment_excerpt = $comment_content;
2030 2030
 		}
2031 2031
 
2032
-		if ( $comment->user_id ) {
2033
-			$user_profile_url = get_author_posts_url( $comment->user_id );
2032
+		if ($comment->user_id) {
2033
+			$user_profile_url = get_author_posts_url($comment->user_id);
2034 2034
 		} else {
2035 2035
 			$user_profile_url = '';
2036 2036
 		}
2037 2037
 
2038
-		if ( $comment_id && $na ) {
2038
+		if ($comment_id && $na) {
2039 2039
 			$comments_echo .= '<li class="clearfix">';
2040
-			$comments_echo .= "<span class=\"li" . $comment_id . " geodir_reviewer_image\">";
2041
-			if ( function_exists( 'get_avatar' ) ) {
2042
-				if ( ! isset( $comment->comment_type ) ) {
2043
-					if ( $user_profile_url ) {
2044
-						$comments_echo .= '<a href="' . $user_profile_url . '">';
2040
+			$comments_echo .= "<span class=\"li".$comment_id." geodir_reviewer_image\">";
2041
+			if (function_exists('get_avatar')) {
2042
+				if (!isset($comment->comment_type)) {
2043
+					if ($user_profile_url) {
2044
+						$comments_echo .= '<a href="'.$user_profile_url.'">';
2045 2045
 					}
2046
-					$comments_echo .= get_avatar( $comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' );
2047
-					if ( $user_profile_url ) {
2046
+					$comments_echo .= get_avatar($comment->comment_author_email, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
2047
+					if ($user_profile_url) {
2048 2048
 						$comments_echo .= '</a>';
2049 2049
 					}
2050
-				} elseif ( ( isset( $comment->comment_type ) && $comment->comment_type == 'trackback' ) || ( isset( $comment->comment_type ) && $comment->comment_type == 'pingback' ) ) {
2051
-					if ( $user_profile_url ) {
2052
-						$comments_echo .= '<a href="' . $user_profile_url . '">';
2050
+				} elseif ((isset($comment->comment_type) && $comment->comment_type == 'trackback') || (isset($comment->comment_type) && $comment->comment_type == 'pingback')) {
2051
+					if ($user_profile_url) {
2052
+						$comments_echo .= '<a href="'.$user_profile_url.'">';
2053 2053
 					}
2054
-					$comments_echo .= get_avatar( $comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' );
2054
+					$comments_echo .= get_avatar($comment->comment_author_url, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
2055 2055
 				}
2056
-			} elseif ( function_exists( 'gravatar' ) ) {
2057
-				if ( $user_profile_url ) {
2058
-					$comments_echo .= '<a href="' . $user_profile_url . '">';
2056
+			} elseif (function_exists('gravatar')) {
2057
+				if ($user_profile_url) {
2058
+					$comments_echo .= '<a href="'.$user_profile_url.'">';
2059 2059
 				}
2060 2060
 				$comments_echo .= "<img src=\"";
2061
-				if ( '' == $comment->comment_type ) {
2062
-					$comments_echo .= gravatar( $comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' );
2063
-					if ( $user_profile_url ) {
2061
+				if ('' == $comment->comment_type) {
2062
+					$comments_echo .= gravatar($comment->comment_author_email, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
2063
+					if ($user_profile_url) {
2064 2064
 						$comments_echo .= '</a>';
2065 2065
 					}
2066
-				} elseif ( ( 'trackback' == $comment->comment_type ) || ( 'pingback' == $comment->comment_type ) ) {
2067
-					if ( $user_profile_url ) {
2068
-						$comments_echo .= '<a href="' . $user_profile_url . '">';
2066
+				} elseif (('trackback' == $comment->comment_type) || ('pingback' == $comment->comment_type)) {
2067
+					if ($user_profile_url) {
2068
+						$comments_echo .= '<a href="'.$user_profile_url.'">';
2069 2069
 					}
2070
-					$comments_echo .= gravatar( $comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' );
2071
-					if ( $user_profile_url ) {
2070
+					$comments_echo .= gravatar($comment->comment_author_url, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
2071
+					if ($user_profile_url) {
2072 2072
 						$comments_echo .= '</a>';
2073 2073
 					}
2074 2074
 				}
@@ -2078,17 +2078,17 @@  discard block
 block discarded – undo
2078 2078
 			$comments_echo .= "</span>\n";
2079 2079
 
2080 2080
 			$comments_echo .= '<span class="geodir_reviewer_content">';
2081
-			if ( $comment->user_id ) {
2082
-				$comments_echo .= '<a href="' . get_author_posts_url( $comment->user_id ) . '">';
2081
+			if ($comment->user_id) {
2082
+				$comments_echo .= '<a href="'.get_author_posts_url($comment->user_id).'">';
2083 2083
 			}
2084
-			$comments_echo .= '<span class="geodir_reviewer_author">' . $comment->comment_author . '</span> ';
2085
-			if ( $comment->user_id ) {
2084
+			$comments_echo .= '<span class="geodir_reviewer_author">'.$comment->comment_author.'</span> ';
2085
+			if ($comment->user_id) {
2086 2086
 				$comments_echo .= '</a>';
2087 2087
 			}
2088
-			$comments_echo .= '<span class="geodir_reviewer_reviewed">' . __( 'reviewed', 'geodirectory' ) . '</span> ';
2089
-			$comments_echo .= '<a href="' . $permalink . '" class="geodir_reviewer_title">' . $post_title . '</a>';
2090
-			$comments_echo .= geodir_get_rating_stars( $comment->overall_rating, $comment_post_ID );
2091
-			$comments_echo .= '<p class="geodir_reviewer_text">' . $comment_excerpt . '';
2088
+			$comments_echo .= '<span class="geodir_reviewer_reviewed">'.__('reviewed', 'geodirectory').'</span> ';
2089
+			$comments_echo .= '<a href="'.$permalink.'" class="geodir_reviewer_title">'.$post_title.'</a>';
2090
+			$comments_echo .= geodir_get_rating_stars($comment->overall_rating, $comment_post_ID);
2091
+			$comments_echo .= '<p class="geodir_reviewer_text">'.$comment_excerpt.'';
2092 2092
 			//echo preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_excerpt);
2093 2093
 			$comments_echo .= '</p>';
2094 2094
 
@@ -2108,25 +2108,25 @@  discard block
 block discarded – undo
2108 2108
  * @return array Returns post categories as an array.
2109 2109
  */
2110 2110
 function geodir_home_map_cats_key_value_array() {
2111
-	$post_types = geodir_get_posttypes( 'object' );
2111
+	$post_types = geodir_get_posttypes('object');
2112 2112
 
2113 2113
 	$return = array();
2114
-	if ( ! empty( $post_types ) ) {
2115
-		foreach ( $post_types as $key => $post_type ) {
2116
-			$cpt_name       = __( $post_type->labels->singular_name, 'geodirectory' );
2117
-			$post_type_name = sprintf( __( '%s Categories', 'geodirectory' ), $cpt_name );
2118
-			$taxonomies     = geodir_get_taxonomies( $key );
2119
-			$cat_taxonomy   = ! empty( $taxonomies[0] ) ? $taxonomies[0] : null;
2120
-			$cat_terms      = $cat_taxonomy ? get_terms( $cat_taxonomy ) : null;
2121
-
2122
-			if ( ! empty( $cat_terms ) ) {
2123
-				$return[ 'optgroup_start-' . $key ] = $post_type_name;
2124
-
2125
-				foreach ( $cat_terms as $cat_term ) {
2126
-					$return[ $key . '_' . $cat_term->term_id ] = $cat_term->name;
2114
+	if (!empty($post_types)) {
2115
+		foreach ($post_types as $key => $post_type) {
2116
+			$cpt_name       = __($post_type->labels->singular_name, 'geodirectory');
2117
+			$post_type_name = sprintf(__('%s Categories', 'geodirectory'), $cpt_name);
2118
+			$taxonomies     = geodir_get_taxonomies($key);
2119
+			$cat_taxonomy   = !empty($taxonomies[0]) ? $taxonomies[0] : null;
2120
+			$cat_terms      = $cat_taxonomy ? get_terms($cat_taxonomy) : null;
2121
+
2122
+			if (!empty($cat_terms)) {
2123
+				$return['optgroup_start-'.$key] = $post_type_name;
2124
+
2125
+				foreach ($cat_terms as $cat_term) {
2126
+					$return[$key.'_'.$cat_term->term_id] = $cat_term->name;
2127 2127
 				}
2128 2128
 
2129
-				$return[ 'optgroup_end-' . $key ] = $post_type_name;
2129
+				$return['optgroup_end-'.$key] = $post_type_name;
2130 2130
 			}
2131 2131
 		}
2132 2132
 	}
@@ -2142,14 +2142,14 @@  discard block
 block discarded – undo
2142 2142
  * @package GeoDirectory
2143 2143
  */
2144 2144
 function geodir_twitter_tweet_button() {
2145
-	if ( isset( $_GET['gde'] ) ) {
2146
-		$link = '?url=' . urlencode( geodir_curPageURL() );
2145
+	if (isset($_GET['gde'])) {
2146
+		$link = '?url='.urlencode(geodir_curPageURL());
2147 2147
 	} else {
2148 2148
 		$link = '';
2149 2149
 	}
2150 2150
 	?>
2151 2151
 	<a href="http://twitter.com/share<?php echo $link; ?>"
2152
-	   class="twitter-share-button"><?php _e( 'Tweet', 'geodirectory' ); ?></a>
2152
+	   class="twitter-share-button"><?php _e('Tweet', 'geodirectory'); ?></a>
2153 2153
 	<script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>
2154 2154
 	<?php
2155 2155
 }
@@ -2166,10 +2166,10 @@  discard block
 block discarded – undo
2166 2166
 function geodir_fb_like_button() {
2167 2167
 	global $post;
2168 2168
 	?>
2169
-	<iframe <?php if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE' ) !== false ) ) {
2169
+	<iframe <?php if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) {
2170 2170
 		echo 'allowtransparency="true"';
2171 2171
 	} ?> class="facebook"
2172
-	     src="//www.facebook.com/plugins/like.php?href=<?php echo urlencode( get_permalink( $post->ID ) ); ?>&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light"
2172
+	     src="//www.facebook.com/plugins/like.php?href=<?php echo urlencode(get_permalink($post->ID)); ?>&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light"
2173 2173
 	     style="border:none; overflow:hidden; width:100px; height:20px"></iframe>
2174 2174
 	<?php
2175 2175
 }
@@ -2200,7 +2200,7 @@  discard block
 block discarded – undo
2200 2200
 
2201 2201
 
2202 2202
 function geodir_listing_bounce_map_pin_on_hover() {
2203
-	if ( get_option( 'geodir_listing_hover_bounce_map_pin', true ) ) {
2203
+	if (get_option('geodir_listing_hover_bounce_map_pin', true)) {
2204 2204
 		?>
2205 2205
 		<script>
2206 2206
 			jQuery(function ($) {
@@ -2223,44 +2223,44 @@  discard block
 block discarded – undo
2223 2223
 	}
2224 2224
 }
2225 2225
 
2226
-add_action( 'geodir_after_listing_listview', 'geodir_listing_bounce_map_pin_on_hover', 10 );
2226
+add_action('geodir_after_listing_listview', 'geodir_listing_bounce_map_pin_on_hover', 10);
2227 2227
 
2228
-add_action( 'geodir_after_favorite_html', 'geodir_output_favourite_html_listings', 1, 1 );
2229
-function geodir_output_favourite_html_listings( $post_id ) {
2230
-	geodir_favourite_html( '', $post_id );
2228
+add_action('geodir_after_favorite_html', 'geodir_output_favourite_html_listings', 1, 1);
2229
+function geodir_output_favourite_html_listings($post_id) {
2230
+	geodir_favourite_html('', $post_id);
2231 2231
 }
2232 2232
 
2233
-add_action( 'geodir_listing_after_pinpoint', 'geodir_output_pinpoint_html_listings', 1, 2 );
2234
-function geodir_output_pinpoint_html_listings( $post_id, $post ) {
2233
+add_action('geodir_listing_after_pinpoint', 'geodir_output_pinpoint_html_listings', 1, 2);
2234
+function geodir_output_pinpoint_html_listings($post_id, $post) {
2235 2235
 	global $wp_query;
2236 2236
 
2237 2237
 	$show_pin_point = $wp_query->is_main_query();
2238 2238
 
2239
-	if ( ! empty( $show_pin_point ) && is_active_widget( false, "", "geodir_map_v3_listing_map" ) ) {
2240
-		$term_icon_url = get_tax_meta( $post->default_category, 'ct_cat_icon', false, $post->post_type );
2241
-		$marker_icon   = isset( $term_icon_url['src'] ) ? $term_icon_url['src'] : get_option( 'geodir_default_marker_icon' );
2239
+	if (!empty($show_pin_point) && is_active_widget(false, "", "geodir_map_v3_listing_map")) {
2240
+		$term_icon_url = get_tax_meta($post->default_category, 'ct_cat_icon', false, $post->post_type);
2241
+		$marker_icon   = isset($term_icon_url['src']) ? $term_icon_url['src'] : get_option('geodir_default_marker_icon');
2242 2242
 		?>
2243 2243
 		<span class="geodir-pinpoint"
2244
-		      style="background:url('<?php echo $marker_icon; ?>') no-repeat scroll left top transparent;background-size:auto 100%; -webkit-background-size:auto 100%;-moz-background-size:auto 100%;height:9px;width:14px;"><?php echo apply_filters( 'geodir_listing_listview_pinpoint_inner_content', '', 'listing' ); ?></span>
2244
+		      style="background:url('<?php echo $marker_icon; ?>') no-repeat scroll left top transparent;background-size:auto 100%; -webkit-background-size:auto 100%;-moz-background-size:auto 100%;height:9px;width:14px;"><?php echo apply_filters('geodir_listing_listview_pinpoint_inner_content', '', 'listing'); ?></span>
2245 2245
 		<a class="geodir-pinpoint-link" href="javascript:void(0)"
2246 2246
 		   onclick="openMarker('listing_map_canvas' ,'<?php echo $post->ID; ?>')"
2247 2247
 		   onmouseover="animate_marker('listing_map_canvas' ,'<?php echo $post->ID; ?>')"
2248
-		   onmouseout="stop_marker_animation('listing_map_canvas' ,'<?php echo $post->ID; ?>')"><?php _e( 'Pinpoint', 'geodirectory' ); ?></a>
2248
+		   onmouseout="stop_marker_animation('listing_map_canvas' ,'<?php echo $post->ID; ?>')"><?php _e('Pinpoint', 'geodirectory'); ?></a>
2249 2249
 		<?php
2250 2250
 	}
2251 2251
 }
2252 2252
 
2253 2253
 function geodir_search_form_submit_button() {
2254 2254
 
2255
-	$new_style = get_option( 'geodir_show_search_old_search_from' ) ? false : true;
2255
+	$new_style = get_option('geodir_show_search_old_search_from') ? false : true;
2256 2256
 
2257
-	if ( $new_style ) {
2257
+	if ($new_style) {
2258 2258
 		$default_search_button_label = '<i class="fa fa-search" aria-hidden="true"></i>';
2259
-	}else{
2259
+	} else {
2260 2260
 		$default_search_button_label = 'Search';
2261 2261
 	}
2262
-	if ( get_option( 'geodir_search_button_label' ) && get_option( 'geodir_search_button_label' ) != 'Search' ) {
2263
-		$default_search_button_label = __( get_option( 'geodir_search_button_label' ), 'geodirectory' );
2262
+	if (get_option('geodir_search_button_label') && get_option('geodir_search_button_label') != 'Search') {
2263
+		$default_search_button_label = __(get_option('geodir_search_button_label'), 'geodirectory');
2264 2264
 	}
2265 2265
 
2266 2266
 	/**
@@ -2272,78 +2272,78 @@  discard block
 block discarded – undo
2272 2272
 	 *
2273 2273
 	 * @param string $default_search_button_label The current search button text.
2274 2274
 	 */
2275
-	$default_search_button_label = apply_filters( 'geodir_search_default_search_button_text', $default_search_button_label );
2275
+	$default_search_button_label = apply_filters('geodir_search_default_search_button_text', $default_search_button_label);
2276 2276
 
2277 2277
 	$fa_class = '';
2278
-	if ( strpos( $default_search_button_label, '&#' ) !== false ) {
2278
+	if (strpos($default_search_button_label, '&#') !== false) {
2279 2279
 		$fa_class = 'fa';
2280 2280
 	}
2281 2281
 
2282 2282
 
2283
-	if ( $new_style ) {
2283
+	if ($new_style) {
2284 2284
 	?>
2285
-		<button class="geodir_submit_search <?php echo $fa_class; ?>"><?php _e( $default_search_button_label ,'geodirectory'); ?></button>
2286
-<?php }else{?>
2287
-		<input type="button" value="<?php esc_attr_e( $default_search_button_label ); ?>"
2285
+		<button class="geodir_submit_search <?php echo $fa_class; ?>"><?php _e($default_search_button_label, 'geodirectory'); ?></button>
2286
+<?php } else {?>
2287
+		<input type="button" value="<?php esc_attr_e($default_search_button_label); ?>"
2288 2288
 	       class="geodir_submit_search <?php echo $fa_class; ?>"/>
2289 2289
 	<?php }
2290 2290
 }
2291 2291
 
2292
-add_action( 'geodir_before_search_button', 'geodir_search_form_submit_button', 5000 );
2292
+add_action('geodir_before_search_button', 'geodir_search_form_submit_button', 5000);
2293 2293
 
2294 2294
 function geodir_search_form_post_type_input() {
2295 2295
 	global $geodir_search_post_type;
2296
-	$post_types     = apply_filters( 'geodir_search_form_post_types', geodir_get_posttypes( 'object' ) );
2296
+	$post_types     = apply_filters('geodir_search_form_post_types', geodir_get_posttypes('object'));
2297 2297
 	$curr_post_type = $geodir_search_post_type;
2298 2298
 
2299
-	if ( ! empty( $post_types ) && count( (array) $post_types ) > 1 ) {
2299
+	if (!empty($post_types) && count((array) $post_types) > 1) {
2300 2300
 
2301
-		foreach ( $post_types as $post_type => $info ){
2301
+		foreach ($post_types as $post_type => $info) {
2302 2302
 			global $wpdb;
2303
-			$has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) );
2304
-			if ( ! $has_posts ) {
2303
+			$has_posts = $wpdb->get_row($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type));
2304
+			if (!$has_posts) {
2305 2305
 				unset($post_types->{$post_type});
2306 2306
 			}
2307 2307
 		}
2308 2308
 
2309
-		if ( ! empty( $post_types ) && count( (array) $post_types ) > 1 ) {
2309
+		if (!empty($post_types) && count((array) $post_types) > 1) {
2310 2310
 
2311
-			$new_style = get_option( 'geodir_show_search_old_search_from' ) ? false : true;
2312
-			if ( $new_style ) {
2311
+			$new_style = get_option('geodir_show_search_old_search_from') ? false : true;
2312
+			if ($new_style) {
2313 2313
 				echo "<div class='gd-search-input-wrapper gd-search-field-cpt'>";
2314 2314
 			}
2315 2315
 			?>
2316 2316
 			<select name="stype" class="search_by_post">
2317
-				<?php foreach ( $post_types as $post_type => $info ):
2317
+				<?php foreach ($post_types as $post_type => $info):
2318 2318
 					global $wpdb;
2319 2319
 					?>
2320 2320
 
2321
-					<option data-label="<?php echo get_post_type_archive_link( $post_type ); ?>"
2322
-					        value="<?php echo $post_type; ?>" <?php if ( isset( $_REQUEST['stype'] ) ) {
2323
-						if ( $post_type == $_REQUEST['stype'] ) {
2321
+					<option data-label="<?php echo get_post_type_archive_link($post_type); ?>"
2322
+					        value="<?php echo $post_type; ?>" <?php if (isset($_REQUEST['stype'])) {
2323
+						if ($post_type == $_REQUEST['stype']) {
2324 2324
 							echo 'selected="selected"';
2325 2325
 						}
2326
-					} elseif ( $curr_post_type == $post_type ) {
2326
+					} elseif ($curr_post_type == $post_type) {
2327 2327
 						echo 'selected="selected"';
2328
-					} ?>><?php _e( ucfirst( $info->labels->name ), 'geodirectory' ); ?></option>
2328
+					} ?>><?php _e(ucfirst($info->labels->name), 'geodirectory'); ?></option>
2329 2329
 
2330 2330
 				<?php endforeach; ?>
2331 2331
 			</select>
2332 2332
 			<?php
2333
-			if ( $new_style ) {
2333
+			if ($new_style) {
2334 2334
 				echo "</div>";
2335 2335
 			}
2336
-		}else{
2337
-			if(! empty( $post_types )){
2338
-				$pt_arr = (array)$post_types;
2339
-				echo '<input type="hidden" name="stype" value="' . key( $pt_arr  ) . '"  />';
2340
-			}else{
2336
+		} else {
2337
+			if (!empty($post_types)) {
2338
+				$pt_arr = (array) $post_types;
2339
+				echo '<input type="hidden" name="stype" value="'.key($pt_arr).'"  />';
2340
+			} else {
2341 2341
 				echo '<input type="hidden" name="stype" value="gd_place"  />';
2342 2342
 			}
2343 2343
 
2344 2344
 		}
2345 2345
 
2346
-	}elseif ( ! empty( $post_types ) ) {
2346
+	}elseif (!empty($post_types)) {
2347 2347
 		echo '<input type="hidden" name="stype" value="gd_place"  />';
2348 2348
 	}
2349 2349
 }
@@ -2351,26 +2351,26 @@  discard block
 block discarded – undo
2351 2351
 function geodir_search_form_search_input() {
2352 2352
 
2353 2353
 	$default_search_for_text = SEARCH_FOR_TEXT;
2354
-	if ( get_option( 'geodir_search_field_default_text' ) ) {
2355
-		$default_search_for_text = __( get_option( 'geodir_search_field_default_text' ), 'geodirectory' );
2354
+	if (get_option('geodir_search_field_default_text')) {
2355
+		$default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
2356 2356
 	}
2357 2357
 
2358 2358
 	$new_style = get_option('geodir_show_search_old_search_from') ? false : true;
2359
-	if($new_style){
2359
+	if ($new_style) {
2360 2360
 		echo "<div class='gd-search-input-wrapper gd-search-field-search'>";
2361 2361
 	}
2362 2362
 	?>
2363 2363
 	<input class="search_text" name="s"
2364
-	       value="<?php if ( isset( $_REQUEST['s'] ) && trim( $_REQUEST['s'] ) != '' ) {
2365
-		       echo esc_attr( stripslashes_deep( $_REQUEST['s'] ) );
2364
+	       value="<?php if (isset($_REQUEST['s']) && trim($_REQUEST['s']) != '') {
2365
+		       echo esc_attr(stripslashes_deep($_REQUEST['s']));
2366 2366
 	       } else {
2367 2367
 		       echo $default_search_for_text;
2368 2368
 	       } ?>" type="text"
2369
-	       onblur="if (this.value.trim() == '') {this.value = '<?php echo esc_sql( $default_search_for_text ); ?>';}"
2370
-	       onfocus="if (this.value == '<?php echo esc_sql( $default_search_for_text ); ?>') {this.value = '';}"
2369
+	       onblur="if (this.value.trim() == '') {this.value = '<?php echo esc_sql($default_search_for_text); ?>';}"
2370
+	       onfocus="if (this.value == '<?php echo esc_sql($default_search_for_text); ?>') {this.value = '';}"
2371 2371
 	       onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);">
2372 2372
 	<?php
2373
-	if($new_style){
2373
+	if ($new_style) {
2374 2374
 		echo "</div>";
2375 2375
 	}
2376 2376
 }
@@ -2378,12 +2378,12 @@  discard block
 block discarded – undo
2378 2378
 function geodir_search_form_near_input() {
2379 2379
 
2380 2380
 	$default_near_text = NEAR_TEXT;
2381
-	if ( get_option( 'geodir_near_field_default_text' ) ) {
2382
-		$default_near_text = __( get_option( 'geodir_near_field_default_text' ), 'geodirectory' );
2381
+	if (get_option('geodir_near_field_default_text')) {
2382
+		$default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
2383 2383
 	}
2384 2384
 
2385
-	if ( isset( $_REQUEST['snear'] ) && $_REQUEST['snear'] != '' ) {
2386
-		$near = esc_attr( stripslashes_deep( $_REQUEST['snear'] ) );
2385
+	if (isset($_REQUEST['snear']) && $_REQUEST['snear'] != '') {
2386
+		$near = esc_attr(stripslashes_deep($_REQUEST['snear']));
2387 2387
 	} else {
2388 2388
 		$near = $default_near_text;
2389 2389
 	}
@@ -2397,7 +2397,7 @@  discard block
 block discarded – undo
2397 2397
 	 * @since 1.6.9
2398 2398
 	 * @param string $curr_post_type The current post type.
2399 2399
 	 */
2400
-	$near_input_extra = apply_filters('geodir_near_input_extra','',$curr_post_type);
2400
+	$near_input_extra = apply_filters('geodir_near_input_extra', '', $curr_post_type);
2401 2401
 
2402 2402
 
2403 2403
 	/**
@@ -2410,7 +2410,7 @@  discard block
 block discarded – undo
2410 2410
 	 * @param string $near              The current near value.
2411 2411
 	 * @param string $default_near_text The default near value.
2412 2412
 	 */
2413
-	$near = apply_filters( 'geodir_search_near_text', $near, $default_near_text );
2413
+	$near = apply_filters('geodir_search_near_text', $near, $default_near_text);
2414 2414
 	/**
2415 2415
 	 * Filter the default "Near" text value for the search form.
2416 2416
 	 *
@@ -2421,7 +2421,7 @@  discard block
 block discarded – undo
2421 2421
 	 * @param string $near              The current near value.
2422 2422
 	 * @param string $default_near_text The default near value.
2423 2423
 	 */
2424
-	$default_near_text = apply_filters( 'geodir_search_default_near_text', $default_near_text, $near );
2424
+	$default_near_text = apply_filters('geodir_search_default_near_text', $default_near_text, $near);
2425 2425
 	/**
2426 2426
 	 * Filter the class for the near search input.
2427 2427
 	 *
@@ -2429,10 +2429,10 @@  discard block
 block discarded – undo
2429 2429
 	 *
2430 2430
 	 * @param string $class The class for the HTML near input, default is blank.
2431 2431
 	 */
2432
-	$near_class = apply_filters( 'geodir_search_near_class', '' );
2432
+	$near_class = apply_filters('geodir_search_near_class', '');
2433 2433
 
2434 2434
 	$new_style = get_option('geodir_show_search_old_search_from') ? false : true;
2435
-	if($new_style){
2435
+	if ($new_style) {
2436 2436
 		echo "<div class='gd-search-input-wrapper gd-search-field-near' $near_input_extra>";
2437 2437
 		
2438 2438
 		do_action('geodir_before_near_input');
@@ -2440,30 +2440,30 @@  discard block
 block discarded – undo
2440 2440
 
2441 2441
 	?>
2442 2442
 	<input name="snear" class="snear <?php echo $near_class; ?>" type="text" value="<?php echo $near; ?>"
2443
-	       onblur="if (this.value.trim() == '') {this.value = ('<?php echo esc_sql( $near ); ?>' != '' ? '<?php echo esc_sql( $near ); ?>' : '<?php echo $default_near_text; ?>');}"
2444
-	       onfocus="if (this.value == '<?php echo $default_near_text; ?>' || this.value =='<?php echo esc_sql( $near ); ?>') {this.value = '';}"
2445
-	       onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);" <?php echo $near_input_extra;?>/>
2443
+	       onblur="if (this.value.trim() == '') {this.value = ('<?php echo esc_sql($near); ?>' != '' ? '<?php echo esc_sql($near); ?>' : '<?php echo $default_near_text; ?>');}"
2444
+	       onfocus="if (this.value == '<?php echo $default_near_text; ?>' || this.value =='<?php echo esc_sql($near); ?>') {this.value = '';}"
2445
+	       onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);" <?php echo $near_input_extra; ?>/>
2446 2446
 	<?php
2447
-	if($new_style){
2447
+	if ($new_style) {
2448 2448
 		do_action('geodir_after_near_input');
2449 2449
 
2450 2450
 		echo "</div>";
2451 2451
 	}
2452 2452
 }
2453 2453
 
2454
-add_action( 'geodir_search_form_inputs', 'geodir_search_form_post_type_input', 10 );
2455
-add_action( 'geodir_search_form_inputs', 'geodir_search_form_search_input', 20 );
2456
-add_action( 'geodir_search_form_inputs', 'geodir_search_form_near_input', 30 );
2454
+add_action('geodir_search_form_inputs', 'geodir_search_form_post_type_input', 10);
2455
+add_action('geodir_search_form_inputs', 'geodir_search_form_search_input', 20);
2456
+add_action('geodir_search_form_inputs', 'geodir_search_form_near_input', 30);
2457 2457
 
2458
-function geodir_get_search_post_type($pt=''){
2458
+function geodir_get_search_post_type($pt = '') {
2459 2459
 	global $geodir_search_post_type;
2460 2460
 
2461
-	if($pt!=''){return $geodir_search_post_type = $pt;}
2462
-	if(!empty($geodir_search_post_type)){ return $geodir_search_post_type;}
2461
+	if ($pt != '') {return $geodir_search_post_type = $pt; }
2462
+	if (!empty($geodir_search_post_type)) { return $geodir_search_post_type; }
2463 2463
 
2464 2464
 	$geodir_search_post_type = geodir_get_current_posttype();
2465 2465
 
2466
-	if(!$geodir_search_post_type) {
2466
+	if (!$geodir_search_post_type) {
2467 2467
 		$geodir_search_post_type = geodir_get_default_posttype();
2468 2468
 	}
2469 2469
 
@@ -2471,7 +2471,7 @@  discard block
 block discarded – undo
2471 2471
 	return $geodir_search_post_type;
2472 2472
 }
2473 2473
 
2474
-function geodir_search_form(){
2474
+function geodir_search_form() {
2475 2475
 
2476 2476
 	geodir_get_search_post_type();
2477 2477
 
@@ -2481,8 +2481,8 @@  discard block
 block discarded – undo
2481 2481
 	die();
2482 2482
 }
2483 2483
 
2484
-add_action( 'wp_ajax_geodir_search_form', 'geodir_search_form' );
2485
-add_action( 'wp_ajax_nopriv_geodir_search_form', 'geodir_search_form' );
2484
+add_action('wp_ajax_geodir_search_form', 'geodir_search_form');
2485
+add_action('wp_ajax_nopriv_geodir_search_form', 'geodir_search_form');
2486 2486
 
2487 2487
 /**
2488 2488
  * Check wpml active or not.
@@ -2556,7 +2556,7 @@  discard block
 block discarded – undo
2556 2556
         }
2557 2557
     }
2558 2558
 }
2559
-add_filter( 'icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4 );
2559
+add_filter('icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4);
2560 2560
 
2561 2561
 /**
2562 2562
  * Duplicate post listing manually after listing saved.
@@ -2597,7 +2597,7 @@  discard block
 block discarded – undo
2597 2597
 function geodir_wpml_duplicate_post_reviews($master_post_id, $tr_post_id, $lang) {
2598 2598
     global $wpdb;
2599 2599
 
2600
-    $reviews = $wpdb->get_results($wpdb->prepare("SELECT comment_id FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id=%d ORDER BY id ASC", $master_post_id), ARRAY_A);
2600
+    $reviews = $wpdb->get_results($wpdb->prepare("SELECT comment_id FROM ".GEODIR_REVIEW_TABLE." WHERE post_id=%d ORDER BY id ASC", $master_post_id), ARRAY_A);
2601 2601
 
2602 2602
     if (!empty($reviews)) {
2603 2603
         foreach ($reviews as $review) {
@@ -2625,14 +2625,14 @@  discard block
 block discarded – undo
2625 2625
     global $wpdb, $plugin_prefix;
2626 2626
 
2627 2627
     $post_type = get_post_type($master_post_id);
2628
-    $post_table = $plugin_prefix . $post_type . '_detail';
2628
+    $post_table = $plugin_prefix.$post_type.'_detail';
2629 2629
 
2630
-    $query = $wpdb->prepare("SELECT * FROM " . $post_table . " WHERE post_id = %d", array($master_post_id));
2631
-    $data = (array)$wpdb->get_row($query);
2630
+    $query = $wpdb->prepare("SELECT * FROM ".$post_table." WHERE post_id = %d", array($master_post_id));
2631
+    $data = (array) $wpdb->get_row($query);
2632 2632
 
2633
-    if ( !empty( $data ) ) {
2633
+    if (!empty($data)) {
2634 2634
         $data['post_id'] = $tr_post_id;
2635
-        unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type . 'category']);
2635
+        unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type.'category']);
2636 2636
         $wpdb->update($post_table, $data, array('post_id' => $tr_post_id));
2637 2637
         return true;
2638 2638
     }
@@ -2657,7 +2657,7 @@  discard block
 block discarded – undo
2657 2657
     global $sitepress, $wpdb;
2658 2658
     $post_type = get_post_type($master_post_id);
2659 2659
 
2660
-    remove_filter('get_term', array($sitepress,'get_term_adjust_id')); // AVOID filtering to current language
2660
+    remove_filter('get_term', array($sitepress, 'get_term_adjust_id')); // AVOID filtering to current language
2661 2661
 
2662 2662
     $taxonomies = get_object_taxonomies($post_type);
2663 2663
     foreach ($taxonomies as $taxonomy) {
@@ -2666,9 +2666,9 @@  discard block
 block discarded – undo
2666 2666
         
2667 2667
         if ($terms) {
2668 2668
             foreach ($terms as $term) {
2669
-                $tr_id = apply_filters( 'translate_object_id',$term->term_id, $taxonomy, false, $lang);
2669
+                $tr_id = apply_filters('translate_object_id', $term->term_id, $taxonomy, false, $lang);
2670 2670
                 
2671
-                if (!is_null($tr_id)){
2671
+                if (!is_null($tr_id)) {
2672 2672
                     // not using get_term - unfiltered get_term
2673 2673
                     $translated_term = $wpdb->get_row($wpdb->prepare("
2674 2674
                         SELECT * FROM {$wpdb->terms} t JOIN {$wpdb->term_taxonomy} x ON x.term_id = t.term_id WHERE t.term_id = %d AND x.taxonomy = %s", $tr_id, $taxonomy));
@@ -2677,14 +2677,14 @@  discard block
 block discarded – undo
2677 2677
                 }
2678 2678
             }
2679 2679
 
2680
-            if (!is_taxonomy_hierarchical($taxonomy)){
2681
-                $terms_array = array_unique( array_map( 'intval', $terms_array ) );
2680
+            if (!is_taxonomy_hierarchical($taxonomy)) {
2681
+                $terms_array = array_unique(array_map('intval', $terms_array));
2682 2682
             }
2683 2683
 
2684 2684
             wp_set_post_terms($tr_post_id, $terms_array, $taxonomy);
2685 2685
             
2686
-            if ($taxonomy == $post_type . 'category') {
2687
-                geodir_set_postcat_structure($tr_post_id, $post_type . 'category');
2686
+            if ($taxonomy == $post_type.'category') {
2687
+                geodir_set_postcat_structure($tr_post_id, $post_type.'category');
2688 2688
             }
2689 2689
         }
2690 2690
     }
@@ -2705,15 +2705,15 @@  discard block
 block discarded – undo
2705 2705
 function geodir_icl_duplicate_post_images($master_post_id, $tr_post_id, $lang) {
2706 2706
     global $wpdb;
2707 2707
 
2708
-    $query = $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id));
2708
+    $query = $wpdb->prepare("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id));
2709 2709
     $wpdb->query($query);
2710 2710
 
2711
-    $query = $wpdb->prepare("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id));
2711
+    $query = $wpdb->prepare("SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id));
2712 2712
     $post_images = $wpdb->get_results($query);
2713 2713
 
2714
-    if ( !empty( $post_images ) ) {
2715
-        foreach ( $post_images as $post_image) {
2716
-            $image_data = (array)$post_image;
2714
+    if (!empty($post_images)) {
2715
+        foreach ($post_images as $post_image) {
2716
+            $image_data = (array) $post_image;
2717 2717
             unset($image_data['ID']);
2718 2718
             $image_data['post_id'] = $tr_post_id;
2719 2719
             
@@ -2746,13 +2746,13 @@  discard block
 block discarded – undo
2746 2746
 function geodir_wpml_duplicate_post_review($master_comment_id, $master_post_id, $tr_post_id, $lang) {
2747 2747
     global $wpdb, $plugin_prefix, $sitepress;
2748 2748
 
2749
-    $review = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d ORDER BY id ASC", $master_comment_id), ARRAY_A);
2749
+    $review = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".GEODIR_REVIEW_TABLE." WHERE comment_id=%d ORDER BY id ASC", $master_comment_id), ARRAY_A);
2750 2750
 
2751 2751
     if (empty($review)) {
2752 2752
         return false;
2753 2753
     }
2754 2754
     if ($review['post_id'] != $master_post_id) {
2755
-        $wpdb->query($wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET post_id=%d WHERE comment_id=%d", $master_post_id, $master_comment_id));
2755
+        $wpdb->query($wpdb->prepare("UPDATE ".GEODIR_REVIEW_TABLE." SET post_id=%d WHERE comment_id=%d", $master_post_id, $master_comment_id));
2756 2756
         geodir_update_postrating($master_post_id, $post_type);
2757 2757
     }
2758 2758
 
@@ -2763,9 +2763,9 @@  discard block
 block discarded – undo
2763 2763
     }
2764 2764
 
2765 2765
     $post_type = get_post_type($master_post_id);
2766
-    $post_table = $plugin_prefix . $post_type . '_detail';
2766
+    $post_table = $plugin_prefix.$post_type.'_detail';
2767 2767
 
2768
-    $translated_post = $wpdb->get_row($wpdb->prepare("SELECT post_title, post_latitude, post_longitude, post_city, post_region, post_country FROM " . $post_table . " WHERE post_id = %d", $tr_post_id), ARRAY_A);
2768
+    $translated_post = $wpdb->get_row($wpdb->prepare("SELECT post_title, post_latitude, post_longitude, post_city, post_region, post_country FROM ".$post_table." WHERE post_id = %d", $tr_post_id), ARRAY_A);
2769 2769
     if (empty($translated_post)) {
2770 2770
         return false;
2771 2771
     }
@@ -2783,7 +2783,7 @@  discard block
 block discarded – undo
2783 2783
         unset($review['id']);
2784 2784
     }
2785 2785
 
2786
-    $tr_review_id = $wpdb->get_var($wpdb->prepare("SELECT id FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d AND post_id=%d ORDER BY id ASC", $tr_comment_id, $tr_post_id));
2786
+    $tr_review_id = $wpdb->get_var($wpdb->prepare("SELECT id FROM ".GEODIR_REVIEW_TABLE." WHERE comment_id=%d AND post_id=%d ORDER BY id ASC", $tr_comment_id, $tr_post_id));
2787 2787
 
2788 2788
     if ($tr_review_id) { // update review
2789 2789
         $wpdb->update(GEODIR_REVIEW_TABLE, $review, array('id' => $tr_review_id));
@@ -2796,8 +2796,8 @@  discard block
 block discarded – undo
2796 2796
         geodir_update_postrating($tr_post_id, $post_type);
2797 2797
         
2798 2798
         if (defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_review') && $sitepress->get_setting('sync_comments_on_duplicates')) {
2799
-            $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_COMMENTS_REVIEWS_TABLE . " WHERE comment_id = %d", array($tr_comment_id)));
2800
-            $likes = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_COMMENTS_REVIEWS_TABLE . " WHERE comment_id=%d ORDER BY like_date ASC", $master_comment_id, $tr_post_id), ARRAY_A);
2799
+            $wpdb->query($wpdb->prepare("DELETE FROM ".GEODIR_COMMENTS_REVIEWS_TABLE." WHERE comment_id = %d", array($tr_comment_id)));
2800
+            $likes = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".GEODIR_COMMENTS_REVIEWS_TABLE." WHERE comment_id=%d ORDER BY like_date ASC", $master_comment_id, $tr_post_id), ARRAY_A);
2801 2801
 
2802 2802
             if (!empty($likes)) {
2803 2803
                 foreach ($likes as $like) {
@@ -2899,7 +2899,7 @@  discard block
 block discarded – undo
2899 2899
  * @return bool True if review star disabled, otherwise false.
2900 2900
  */ 
2901 2901
 function geodir_rating_disabled_post_types() {
2902
-	$post_types = get_option( 'geodir_disable_rating_cpt' );
2902
+	$post_types = get_option('geodir_disable_rating_cpt');
2903 2903
 	
2904 2904
 	/**
2905 2905
 	 * Filter the post types array which have rating disabled.
@@ -2908,7 +2908,7 @@  discard block
 block discarded – undo
2908 2908
 	 *
2909 2909
 	 * @param array $post_types Array of post types which have rating starts disabled.
2910 2910
 	 */
2911
-	return apply_filters( 'geodir_rating_disabled_post_types', $post_types );
2911
+	return apply_filters('geodir_rating_disabled_post_types', $post_types);
2912 2912
 }
2913 2913
 
2914 2914
 /**
@@ -2920,30 +2920,30 @@  discard block
 block discarded – undo
2920 2920
  * @param bool $taxonomy Whether $post_type is taxonomy or not.
2921 2921
  * @return bool True if review star disabled, otherwise false.
2922 2922
  */ 
2923
-function geodir_cpt_has_rating_disabled( $post_type = '', $taxonomy = false ) {
2923
+function geodir_cpt_has_rating_disabled($post_type = '', $taxonomy = false) {
2924 2924
 	$post_types = geodir_rating_disabled_post_types();
2925 2925
 	
2926
-	if ( empty( $post_types ) ) {
2926
+	if (empty($post_types)) {
2927 2927
 		return false;
2928 2928
 	}
2929 2929
 	
2930
-	if ( is_int( $post_type ) ) {
2931
-		$post_type = get_post_type( $post_type );
2930
+	if (is_int($post_type)) {
2931
+		$post_type = get_post_type($post_type);
2932 2932
 	}
2933 2933
 	
2934
-	if ( $taxonomy && !empty( $post_types ) ) {
2934
+	if ($taxonomy && !empty($post_types)) {
2935 2935
 		$posttypes = array();
2936 2936
 		
2937
-		foreach ( $post_types as $posttype ) {
2938
-			$posttypes[] = $posttype . 'category';
2939
-			$posttypes[] = $posttype . '_tags';
2937
+		foreach ($post_types as $posttype) {
2938
+			$posttypes[] = $posttype.'category';
2939
+			$posttypes[] = $posttype.'_tags';
2940 2940
 		}
2941 2941
 		
2942 2942
 		$post_types = $posttypes;
2943 2943
 	}
2944 2944
 
2945 2945
 	$return = false;
2946
-	if ( $post_type != '' && !empty( $post_types ) && in_array( $post_type, $post_types ) ) {
2946
+	if ($post_type != '' && !empty($post_types) && in_array($post_type, $post_types)) {
2947 2947
 		$return = true;
2948 2948
 	}
2949 2949
 
Please login to merge, or discard this patch.
geodirectory-functions/listing_filters.php 2 patches
Indentation   +528 added lines, -528 removed lines patch added patch discarded remove patch
@@ -16,10 +16,10 @@  discard block
 block discarded – undo
16 16
  */
17 17
 function geodir_session_start()
18 18
 {
19
-    if (!session_id()) session_start();
20
-    global $geodir_add_location_url;
19
+	if (!session_id()) session_start();
20
+	global $geodir_add_location_url;
21 21
 
22
-    $geodir_add_location_url = NULL;
22
+	$geodir_add_location_url = NULL;
23 23
 }
24 24
 
25 25
 /**
@@ -33,18 +33,18 @@  discard block
 block discarded – undo
33 33
  */
34 34
 function geodir_modified_query($query)
35 35
 {
36
-    if ($query->is_main_query() && (
37
-            (geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
38
-            || geodir_is_page('listing')
39
-            || geodir_is_page('author')
40
-            || geodir_is_page('search')
41
-            || geodir_is_page('detail'))
42
-    ) {
43
-
44
-        $query->set('is_geodir_loop', true);
45
-    }
36
+	if ($query->is_main_query() && (
37
+			(geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
38
+			|| geodir_is_page('listing')
39
+			|| geodir_is_page('author')
40
+			|| geodir_is_page('search')
41
+			|| geodir_is_page('detail'))
42
+	) {
43
+
44
+		$query->set('is_geodir_loop', true);
45
+	}
46 46
 
47
-    return $query;
47
+	return $query;
48 48
 }
49 49
 
50 50
 /**
@@ -67,81 +67,81 @@  discard block
 block discarded – undo
67 67
  */
68 68
 function set_listing_request($query )
69 69
 {
70
-    global $wp_query, $wpdb, $geodir_post_type, $table, $dist, $mylat, $mylon, $s, $snear, $s, $s_A, $s_SA;
70
+	global $wp_query, $wpdb, $geodir_post_type, $table, $dist, $mylat, $mylon, $s, $snear, $s, $s_A, $s_SA;
71 71
 
72 72
 
73
-    // fix woocommerce shop products filtered by language for GD + WPML + Woocommerce
74
-    if (!geodir_is_geodir_page()) {
75
-        return;
76
-    }
73
+	// fix woocommerce shop products filtered by language for GD + WPML + Woocommerce
74
+	if (!geodir_is_geodir_page()) {
75
+		return;
76
+	}
77 77
 
78
-    /* remove all pre filters */
79
-    remove_all_filters('query');
80
-    remove_all_filters('posts_search');
81
-    remove_all_filters('posts_fields');
82
-    remove_all_filters('posts_join');
83
-    remove_all_filters('posts_orderby');
84
-    remove_all_filters('posts_where');
78
+	/* remove all pre filters */
79
+	remove_all_filters('query');
80
+	remove_all_filters('posts_search');
81
+	remove_all_filters('posts_fields');
82
+	remove_all_filters('posts_join');
83
+	remove_all_filters('posts_orderby');
84
+	remove_all_filters('posts_where');
85 85
 
86 86
 
87
-    if ((is_search() && isset($_REQUEST['geodir_search']) && $_REQUEST['geodir_search'] != '')):
87
+	if ((is_search() && isset($_REQUEST['geodir_search']) && $_REQUEST['geodir_search'] != '')):
88 88
 
89
-        if (isset($_REQUEST['scat']) && $_REQUEST['scat'] == 'all') $_REQUEST['scat'] = '';
90
-        //if(isset($_REQUEST['s']) && $_REQUEST['s'] == '+') $_REQUEST['s'] = '';
89
+		if (isset($_REQUEST['scat']) && $_REQUEST['scat'] == 'all') $_REQUEST['scat'] = '';
90
+		//if(isset($_REQUEST['s']) && $_REQUEST['s'] == '+') $_REQUEST['s'] = '';
91 91
 
92
-        if (isset($_REQUEST['sdist'])) {
93
-            ($_REQUEST['sdist'] != '0' && $_REQUEST['sdist'] != '') ? $dist = esc_attr($_REQUEST['sdist']) : $dist = 25000;
94
-        } elseif (get_option('geodir_search_dist') != '') {
95
-            $dist = get_option('geodir_search_dist');
92
+		if (isset($_REQUEST['sdist'])) {
93
+			($_REQUEST['sdist'] != '0' && $_REQUEST['sdist'] != '') ? $dist = esc_attr($_REQUEST['sdist']) : $dist = 25000;
94
+		} elseif (get_option('geodir_search_dist') != '') {
95
+			$dist = get_option('geodir_search_dist');
96 96
 
97
-        } else {
98
-            $dist = 25000;
99
-        } //  Distance
97
+		} else {
98
+			$dist = 25000;
99
+		} //  Distance
100 100
 
101
-        if (isset($_REQUEST['sgeo_lat'])) {
102
-            $mylat = (float)esc_attr($_REQUEST['sgeo_lat']);
103
-        } else {
104
-            $mylat = (float)geodir_get_current_city_lat();
105
-        } //  Latatude
101
+		if (isset($_REQUEST['sgeo_lat'])) {
102
+			$mylat = (float)esc_attr($_REQUEST['sgeo_lat']);
103
+		} else {
104
+			$mylat = (float)geodir_get_current_city_lat();
105
+		} //  Latatude
106 106
 
107
-        if (isset($_REQUEST['sgeo_lon'])) {
108
-            $mylon = (float)esc_attr($_REQUEST['sgeo_lon']);
109
-        } else {
110
-            $mylon = (float)geodir_get_current_city_lng();
111
-        } //  Distance
107
+		if (isset($_REQUEST['sgeo_lon'])) {
108
+			$mylon = (float)esc_attr($_REQUEST['sgeo_lon']);
109
+		} else {
110
+			$mylon = (float)geodir_get_current_city_lng();
111
+		} //  Distance
112 112
 
113
-        if (isset($_REQUEST['snear'])) {
114
-            $snear = trim(esc_attr($_REQUEST['snear']));
115
-        }
113
+		if (isset($_REQUEST['snear'])) {
114
+			$snear = trim(esc_attr($_REQUEST['snear']));
115
+		}
116 116
 
117
-        if (isset($_REQUEST['s'])) {
118
-            $s = trim(esc_attr(wp_strip_all_tags($_REQUEST['s'])));
119
-        }
117
+		if (isset($_REQUEST['s'])) {
118
+			$s = trim(esc_attr(wp_strip_all_tags($_REQUEST['s'])));
119
+		}
120 120
 
121
-        if ($snear == 'NEAR ME') {
122
-            $ip = $_SERVER['REMOTE_ADDR'];
123
-            $addr_details = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=' . $ip));
124
-            $mylat = stripslashes(ucfirst($addr_details[geoplugin_latitude]));
125
-            $mylon = stripslashes(ucfirst($addr_details[geoplugin_longitude]));
126
-        }
121
+		if ($snear == 'NEAR ME') {
122
+			$ip = $_SERVER['REMOTE_ADDR'];
123
+			$addr_details = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=' . $ip));
124
+			$mylat = stripslashes(ucfirst($addr_details[geoplugin_latitude]));
125
+			$mylon = stripslashes(ucfirst($addr_details[geoplugin_longitude]));
126
+		}
127 127
 
128 128
 
129
-        if (strstr($s, ',')) {
130
-            $s_AA = str_replace(" ", "", $s);
131
-            $s_A = explode(",", $s_AA);
132
-            $s_A = implode('","', $s_A);
133
-            $s_A = '"' . $s_A . '"';
134
-        } else {
135
-            $s_A = '"' . $s . '"';
136
-        }
129
+		if (strstr($s, ',')) {
130
+			$s_AA = str_replace(" ", "", $s);
131
+			$s_A = explode(",", $s_AA);
132
+			$s_A = implode('","', $s_A);
133
+			$s_A = '"' . $s_A . '"';
134
+		} else {
135
+			$s_A = '"' . $s . '"';
136
+		}
137 137
 
138
-        if (strstr($s, ' ')) {
139
-            $s_SA = explode(" ", $s);
140
-        } else {
141
-            $s_SA = '';
142
-        }
138
+		if (strstr($s, ' ')) {
139
+			$s_SA = explode(" ", $s);
140
+		} else {
141
+			$s_SA = '';
142
+		}
143 143
 
144
-    endif;
144
+	endif;
145 145
 
146 146
 
147 147
 
@@ -162,56 +162,56 @@  discard block
 block discarded – undo
162 162
  */
163 163
 function geodir_listing_loop_filter($query)
164 164
 {
165
-    global $wp_query, $geodir_post_type, $table, $plugin_prefix, $table, $term;
165
+	global $wp_query, $geodir_post_type, $table, $plugin_prefix, $table, $term;
166 166
 
167
-    // fix wp_reset_query for popular post view widget
168
-    if (!geodir_is_geodir_page()) {
169
-        return;
170
-    }
167
+	// fix wp_reset_query for popular post view widget
168
+	if (!geodir_is_geodir_page()) {
169
+		return;
170
+	}
171 171
 
172
-    $geodir_post_type = geodir_get_current_posttype();
173
-
174
-    if (isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries) {
175
-        $taxonomies = wp_list_pluck($wp_query->tax_query->queries, 'taxonomy');
176
-
177
-        if (isset($wp_query->query[$taxonomies[0]])) {
178
-            $request_term = explode("/", $wp_query->query[$taxonomies[0]]);
179
-            $request_term = end($request_term);
180
-            if (!term_exists($request_term)) {
181
-                $args = array('number' => '1',);
182
-                $terms_arr = get_terms($taxonomies[0], $args);
183
-                foreach ($terms_arr as $location_term) {
184
-                    $term_arr = $location_term;
185
-                    $term_arr->name = geodir_ucwords(str_replace('-', ' ', $request_term));
186
-                }
187
-                $wp_query->queried_object_id = 1;
188
-                $wp_query->queried_object = $term_arr;
189
-                //print_r($wp_query) ;
190
-            }
191
-        }
172
+	$geodir_post_type = geodir_get_current_posttype();
173
+
174
+	if (isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries) {
175
+		$taxonomies = wp_list_pluck($wp_query->tax_query->queries, 'taxonomy');
176
+
177
+		if (isset($wp_query->query[$taxonomies[0]])) {
178
+			$request_term = explode("/", $wp_query->query[$taxonomies[0]]);
179
+			$request_term = end($request_term);
180
+			if (!term_exists($request_term)) {
181
+				$args = array('number' => '1',);
182
+				$terms_arr = get_terms($taxonomies[0], $args);
183
+				foreach ($terms_arr as $location_term) {
184
+					$term_arr = $location_term;
185
+					$term_arr->name = geodir_ucwords(str_replace('-', ' ', $request_term));
186
+				}
187
+				$wp_query->queried_object_id = 1;
188
+				$wp_query->queried_object = $term_arr;
189
+				//print_r($wp_query) ;
190
+			}
191
+		}
192 192
 
193
-    }
194
-    if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) {
195
-
196
-        $table = $plugin_prefix . $geodir_post_type . '_detail';
197
-
198
-        add_filter('posts_fields', 'geodir_posts_fields', 1);
199
-        add_filter('posts_join', 'geodir_posts_join', 1);
200
-        geodir_post_where();
201
-        if (!is_admin())
202
-            add_filter('posts_orderby', 'geodir_posts_orderby', 1);
203
-
204
-        // advanced filter for popular post view widget
205
-        global $wp_query;
206
-        if (!is_admin()) {
207
-            if (!empty($wp_query->query['with_pics_only'])) {
208
-                add_filter('posts_join', 'geodir_filter_widget_join', 1000);
209
-            }
210
-            add_filter('posts_where', 'geodir_filter_widget_where', 1000);
211
-        }
193
+	}
194
+	if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) {
212 195
 
213
-    }
214
-    return $query;
196
+		$table = $plugin_prefix . $geodir_post_type . '_detail';
197
+
198
+		add_filter('posts_fields', 'geodir_posts_fields', 1);
199
+		add_filter('posts_join', 'geodir_posts_join', 1);
200
+		geodir_post_where();
201
+		if (!is_admin())
202
+			add_filter('posts_orderby', 'geodir_posts_orderby', 1);
203
+
204
+		// advanced filter for popular post view widget
205
+		global $wp_query;
206
+		if (!is_admin()) {
207
+			if (!empty($wp_query->query['with_pics_only'])) {
208
+				add_filter('posts_join', 'geodir_filter_widget_join', 1000);
209
+			}
210
+			add_filter('posts_where', 'geodir_filter_widget_where', 1000);
211
+		}
212
+
213
+	}
214
+	return $query;
215 215
 }
216 216
 
217 217
 
@@ -230,67 +230,67 @@  discard block
 block discarded – undo
230 230
  * @return string Modified fields query string.
231 231
  */
232 232
 function geodir_posts_fields($fields) {
233
-    global $wp_query, $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $snear, $gd_session;
233
+	global $wp_query, $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $snear, $gd_session;
234 234
 
235
-    // Filter-Location-Manager to add location table.
236
-    $fields .= ", " . $table . ".* ";
235
+	// Filter-Location-Manager to add location table.
236
+	$fields .= ", " . $table . ".* ";
237 237
 
238 238
 	if ($snear != '' || $gd_session->get('all_near_me')) {
239
-        $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
239
+		$DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
240 240
 
241 241
 		if ($gd_session->get('all_near_me')) {
242
-            $mylat = $gd_session->get('user_lat');
243
-            $mylon = $gd_session->get('user_lon');
244
-        }
245
-
246
-        $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance ";
247
-    }
248
-
249
-    global $s;
250
-    if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
251
-        $keywords = explode(" ", $s);
252
-
253
-        if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
254
-            foreach($keywords as $kkey=>$kword){
255
-                if(geodir_utf8_strlen($kword)<=$klimit){
256
-                    unset($keywords[$kkey]);
257
-                }
258
-            }
259
-        }
242
+			$mylat = $gd_session->get('user_lat');
243
+			$mylon = $gd_session->get('user_lon');
244
+		}
260 245
 
246
+		$fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance ";
247
+	}
261 248
 
262
-        if (count($keywords) > 1) {
263
-            $parts = array(
264
-                'AND' => 'gd_alltitlematch_part',
265
-                'OR' => 'gd_titlematch_part'
266
-            );
267
-            $gd_titlematch_part = "";
268
-            foreach ($parts as $key => $part) {
269
-                $gd_titlematch_part .= " CASE WHEN ";
270
-                $count = 0;
271
-                foreach ($keywords as $keyword) {
272
-                    $keyword = trim($keyword);
273
-                    $keyword  = wp_specialchars_decode($keyword ,ENT_QUOTES);
249
+	global $s;
250
+	if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
251
+		$keywords = explode(" ", $s);
252
+
253
+		if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
254
+			foreach($keywords as $kkey=>$kword){
255
+				if(geodir_utf8_strlen($kword)<=$klimit){
256
+					unset($keywords[$kkey]);
257
+				}
258
+			}
259
+		}
260
+
261
+
262
+		if (count($keywords) > 1) {
263
+			$parts = array(
264
+				'AND' => 'gd_alltitlematch_part',
265
+				'OR' => 'gd_titlematch_part'
266
+			);
267
+			$gd_titlematch_part = "";
268
+			foreach ($parts as $key => $part) {
269
+				$gd_titlematch_part .= " CASE WHEN ";
270
+				$count = 0;
271
+				foreach ($keywords as $keyword) {
272
+					$keyword = trim($keyword);
273
+					$keyword  = wp_specialchars_decode($keyword ,ENT_QUOTES);
274 274
 					$count++;
275
-                    if ($count < count($keywords)) {
276
-                       // $gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' " . $key . " ";
275
+					if ($count < count($keywords)) {
276
+					   // $gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' " . $key . " ";
277 277
 						$gd_titlematch_part .= "( " . $wpdb->posts . ".post_title LIKE '" . $keyword . "' OR " . $wpdb->posts . ".post_title LIKE '" . $keyword . "%%' OR " . $wpdb->posts . ".post_title LIKE '%% " . $keyword . "%%' ) " . $key . " ";
278
-                    } else {
279
-                        //$gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' ";
278
+					} else {
279
+						//$gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' ";
280 280
 						$gd_titlematch_part .= "( " . $wpdb->posts . ".post_title LIKE '" . $keyword . "' OR " . $wpdb->posts . ".post_title LIKE '" . $keyword . "%%' OR " . $wpdb->posts . ".post_title LIKE '%% " . $keyword . "%%' ) ";
281
-                    }
282
-                }
283
-                $gd_titlematch_part .= "THEN 1 ELSE 0 END AS " . $part . ",";
284
-            }
285
-        } else {
286
-            $gd_titlematch_part = "";
287
-        }
288
-        $s = stripslashes_deep( $s );
289
-        $s = wp_specialchars_decode($s,ENT_QUOTES);
281
+					}
282
+				}
283
+				$gd_titlematch_part .= "THEN 1 ELSE 0 END AS " . $part . ",";
284
+			}
285
+		} else {
286
+			$gd_titlematch_part = "";
287
+		}
288
+		$s = stripslashes_deep( $s );
289
+		$s = wp_specialchars_decode($s,ENT_QUOTES);
290 290
 		$fields .= $wpdb->prepare(", CASE WHEN " . $table . ".is_featured='1' THEN 1 ELSE 0 END AS gd_featured, CASE WHEN " . $wpdb->posts . ".post_title LIKE %s THEN 1 ELSE 0 END AS gd_exacttitle," . $gd_titlematch_part . " CASE WHEN ( " . $wpdb->posts . ".post_title LIKE %s OR " . $wpdb->posts . ".post_title LIKE %s OR " . $wpdb->posts . ".post_title LIKE %s ) THEN 1 ELSE 0 END AS gd_titlematch, CASE WHEN ( " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s ) THEN 1 ELSE 0 END AS gd_content", array($s, $s, $s . '%', '% ' . $s . '%', $s, $s . ' %', '% ' . $s . ' %', '% ' . $s));
291
-    }
291
+	}
292 292
 
293
-    return $fields;
293
+	return $fields;
294 294
 }
295 295
 
296 296
 
@@ -307,26 +307,26 @@  discard block
 block discarded – undo
307 307
  */
308 308
 function geodir_posts_join($join)
309 309
 {
310
-    global $wpdb, $geodir_post_type, $table, $table_prefix, $plugin_prefix;
310
+	global $wpdb, $geodir_post_type, $table, $table_prefix, $plugin_prefix;
311 311
 
312
-    ########### WPML ###########
312
+	########### WPML ###########
313 313
 
314
-    if (function_exists('icl_object_id')) {
315
-        global $sitepress;
316
-        $lang_code = ICL_LANGUAGE_CODE;
317
-        $default_lang_code = $sitepress->get_default_language();
318
-        if ($lang_code) {
319
-            $join .= "JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID";
320
-        }
314
+	if (function_exists('icl_object_id')) {
315
+		global $sitepress;
316
+		$lang_code = ICL_LANGUAGE_CODE;
317
+		$default_lang_code = $sitepress->get_default_language();
318
+		if ($lang_code) {
319
+			$join .= "JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID";
320
+		}
321 321
 
322
-    }
323
-    ########### WPML ###########
322
+	}
323
+	########### WPML ###########
324 324
 
325
-    $join .= " INNER JOIN " . $table . " ON (" . $table . ".post_id = $wpdb->posts.ID)  ";
326
-    //===old code start
327
-    //$join .= " INNER JOIN ".POST_LOCATION_TABLE." ON (".$table.".post_location_id = ".POST_LOCATION_TABLE.".location_id)  " ;//===old code end
325
+	$join .= " INNER JOIN " . $table . " ON (" . $table . ".post_id = $wpdb->posts.ID)  ";
326
+	//===old code start
327
+	//$join .= " INNER JOIN ".POST_LOCATION_TABLE." ON (".$table.".post_location_id = ".POST_LOCATION_TABLE.".location_id)  " ;//===old code end
328 328
 
329
-    return $join;
329
+	return $join;
330 330
 }
331 331
 
332 332
 
@@ -344,15 +344,15 @@  discard block
 block discarded – undo
344 344
  */
345 345
 function geodir_posts_orderby($orderby)
346 346
 {
347
-    global $wpdb, $wp_query, $geodir_post_type, $table, $plugin_prefix, $snear, $default_sort;
347
+	global $wpdb, $wp_query, $geodir_post_type, $table, $plugin_prefix, $snear, $default_sort;
348 348
 
349
-    $sort_by = '';
350
-    $orderby = ' ';
349
+	$sort_by = '';
350
+	$orderby = ' ';
351 351
 
352
-    if (get_query_var('order_by'))
353
-        $sort_by = get_query_var('order_by');
352
+	if (get_query_var('order_by'))
353
+		$sort_by = get_query_var('order_by');
354 354
 
355
-    /*if(isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries){
355
+	/*if(isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries){
356 356
         $current_term = $wp_query->get_queried_object();
357 357
     }
358 358
 
@@ -366,133 +366,133 @@  discard block
 block discarded – undo
366 366
     }*/
367 367
 
368 368
 
369
-    if ($snear != '') {
370
-        $orderby .= " distance,";
371
-    }
369
+	if ($snear != '') {
370
+		$orderby .= " distance,";
371
+	}
372 372
 
373
-    if (isset($_REQUEST['sort_by']) && $_REQUEST['sort_by'] != '' && is_main_query())
374
-        $sort_by = esc_attr($_REQUEST['sort_by']);
373
+	if (isset($_REQUEST['sort_by']) && $_REQUEST['sort_by'] != '' && is_main_query())
374
+		$sort_by = esc_attr($_REQUEST['sort_by']);
375 375
 
376 376
 
377
-    if ($sort_by == '') {
378
-        $default_sort = geodir_get_posts_default_sort($geodir_post_type);
379
-        if (!empty($default_sort))
380
-            $sort_by = $default_sort;
381
-    }
377
+	if ($sort_by == '') {
378
+		$default_sort = geodir_get_posts_default_sort($geodir_post_type);
379
+		if (!empty($default_sort))
380
+			$sort_by = $default_sort;
381
+	}
382 382
 
383
-    /*
383
+	/*
384 384
     if search by term & no location then order always "relevance"
385 385
     if search by location then order always "nearest"
386 386
     */
387
-    if (is_main_query() && geodir_is_page('search')) {
388
-        $search_term = get_query_var('s');
387
+	if (is_main_query() && geodir_is_page('search')) {
388
+		$search_term = get_query_var('s');
389 389
 
390
-        if (trim($search_term) != '' && !isset($_REQUEST['sort_by'])) {
391
-            $sort_by = 'az';
392
-        }
390
+		if (trim($search_term) != '' && !isset($_REQUEST['sort_by'])) {
391
+			$sort_by = 'az';
392
+		}
393 393
 
394
-        if ($snear != '' &&  $sort_by!='farthest') {
395
-            $sort_by = 'nearest';
396
-        }
397
-    }
398
-
399
-    switch ($sort_by):
400
-        case 'newest':
401
-            $orderby = "$wpdb->posts.post_date desc, ";
402
-            break;
403
-        case 'oldest':
404
-            $orderby = "$wpdb->posts.post_date asc, ";
405
-            break;
406
-        case 'low_review':
407
-        case 'rating_count_asc':
408
-            $orderby = $table . ".rating_count ASC, " . $table . ".overall_rating ASC, ";
409
-            break;
410
-        case 'high_review':
411
-        case 'rating_count_desc':
412
-            $orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, ";
413
-            break;
414
-        case 'low_rating':
415
-            $orderby = "( " . $table . ".overall_rating  ) ASC, " . $table . ".rating_count ASC,  ";
416
-            break;
417
-        case 'high_rating':
418
-            $orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, ";
419
-            break;
420
-        case 'featured':
421
-            $orderby = $table . ".is_featured asc, ";
422
-            break;
423
-        case 'nearest':
424
-            $orderby = " distance asc, ";
425
-            break;
426
-        case 'farthest':
427
-            $orderby = " distance desc, ";
428
-            break;
429
-        case 'random':
430
-            $orderby = " rand(), ";
431
-            break;
432
-        case 'az':
433
-            $orderby = "$wpdb->posts.post_title asc, ";
434
-            break;
435
-        // sort by rating
436
-        case 'overall_rating_desc':
437
-            $orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, ";
438
-            break;
439
-        case 'overall_rating_asc':
440
-            $orderby = " " . $table . ".overall_rating ASC, " . $table . ".rating_count ASC, ";
441
-            break;
442
-        default:
443
-
444
-            break;
445
-    endswitch;
446
-
447
-    if ($sort_by != '' && geodir_cpt_has_rating_disabled($geodir_post_type)) {
448
-        if (in_array($sort_by, array('high_review', 'rating_count_desc', 'high_rating', 'overall_rating_desc'))) {
449
-            $orderby = "$wpdb->posts.comment_count DESC, ";
450
-            $sort_by = 'comment_count_desc';
451
-        } else if (in_array($sort_by, array('low_review', 'rating_count_asc', 'low_rating', 'overall_rating_asc'))) {
452
-            $orderby = "$wpdb->posts.comment_count ASC, ";
453
-            $sort_by = 'comment_count_asc';
454
-        }
455
-    }
394
+		if ($snear != '' &&  $sort_by!='farthest') {
395
+			$sort_by = 'nearest';
396
+		}
397
+	}
456 398
 
457
-    global $s;
399
+	switch ($sort_by):
400
+		case 'newest':
401
+			$orderby = "$wpdb->posts.post_date desc, ";
402
+			break;
403
+		case 'oldest':
404
+			$orderby = "$wpdb->posts.post_date asc, ";
405
+			break;
406
+		case 'low_review':
407
+		case 'rating_count_asc':
408
+			$orderby = $table . ".rating_count ASC, " . $table . ".overall_rating ASC, ";
409
+			break;
410
+		case 'high_review':
411
+		case 'rating_count_desc':
412
+			$orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, ";
413
+			break;
414
+		case 'low_rating':
415
+			$orderby = "( " . $table . ".overall_rating  ) ASC, " . $table . ".rating_count ASC,  ";
416
+			break;
417
+		case 'high_rating':
418
+			$orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, ";
419
+			break;
420
+		case 'featured':
421
+			$orderby = $table . ".is_featured asc, ";
422
+			break;
423
+		case 'nearest':
424
+			$orderby = " distance asc, ";
425
+			break;
426
+		case 'farthest':
427
+			$orderby = " distance desc, ";
428
+			break;
429
+		case 'random':
430
+			$orderby = " rand(), ";
431
+			break;
432
+		case 'az':
433
+			$orderby = "$wpdb->posts.post_title asc, ";
434
+			break;
435
+		// sort by rating
436
+		case 'overall_rating_desc':
437
+			$orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, ";
438
+			break;
439
+		case 'overall_rating_asc':
440
+			$orderby = " " . $table . ".overall_rating ASC, " . $table . ".rating_count ASC, ";
441
+			break;
442
+		default:
443
+
444
+			break;
445
+	endswitch;
446
+
447
+	if ($sort_by != '' && geodir_cpt_has_rating_disabled($geodir_post_type)) {
448
+		if (in_array($sort_by, array('high_review', 'rating_count_desc', 'high_rating', 'overall_rating_desc'))) {
449
+			$orderby = "$wpdb->posts.comment_count DESC, ";
450
+			$sort_by = 'comment_count_desc';
451
+		} else if (in_array($sort_by, array('low_review', 'rating_count_asc', 'low_rating', 'overall_rating_asc'))) {
452
+			$orderby = "$wpdb->posts.comment_count ASC, ";
453
+			$sort_by = 'comment_count_asc';
454
+		}
455
+	}
458 456
 
459
-    if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
460
-        $keywords = explode(" ", $s);
461
-        if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
462
-            foreach($keywords as $kkey=>$kword){
463
-                if(geodir_utf8_strlen($kword)<=$klimit){
464
-                    unset($keywords[$kkey]);
465
-                }
466
-            }
467
-        }
468
-        if ($sort_by == 'nearest' || $sort_by == 'farthest') {
469
-            if (count($keywords) > 1) {
470
-                $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, ";
471
-            } else {
472
-                $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, ";
473
-            }
474
-        } else {
475
-            if (count($keywords) > 1) {
476
-                $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, " . $orderby;
477
-            } else {
478
-                $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, " . $orderby;
479
-            }
480
-        }
481
-    }
457
+	global $s;
458
+
459
+	if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
460
+		$keywords = explode(" ", $s);
461
+		if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
462
+			foreach($keywords as $kkey=>$kword){
463
+				if(geodir_utf8_strlen($kword)<=$klimit){
464
+					unset($keywords[$kkey]);
465
+				}
466
+			}
467
+		}
468
+		if ($sort_by == 'nearest' || $sort_by == 'farthest') {
469
+			if (count($keywords) > 1) {
470
+				$orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, ";
471
+			} else {
472
+				$orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, ";
473
+			}
474
+		} else {
475
+			if (count($keywords) > 1) {
476
+				$orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, " . $orderby;
477
+			} else {
478
+				$orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, " . $orderby;
479
+			}
480
+		}
481
+	}
482 482
 
483
-    /**
484
-     * Filter order by SQL.
485
-     *
486
-     * @since 1.0.0
487
-     * @param string $orderby The orderby query string.
488
-     * @param string $sort_by Sortby query string.
489
-     * @param string $table Listing table name.
490
-     */
491
-    $orderby = apply_filters('geodir_posts_order_by_sort', $orderby, $sort_by, $table);
483
+	/**
484
+	 * Filter order by SQL.
485
+	 *
486
+	 * @since 1.0.0
487
+	 * @param string $orderby The orderby query string.
488
+	 * @param string $sort_by Sortby query string.
489
+	 * @param string $table Listing table name.
490
+	 */
491
+	$orderby = apply_filters('geodir_posts_order_by_sort', $orderby, $sort_by, $table);
492 492
 
493
-    $orderby .= $table . ".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title ";
493
+	$orderby .= $table . ".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title ";
494 494
 
495
-    return $orderby;
495
+	return $orderby;
496 496
 }
497 497
 
498 498
 
@@ -510,53 +510,53 @@  discard block
 block discarded – undo
510 510
 function geodir_posts_order_by_custom_sort($orderby, $sort_by, $table)
511 511
 {
512 512
 
513
-    global $wpdb;
513
+	global $wpdb;
514 514
 
515
-    if ($sort_by != '' && (!is_search() || ( isset($_REQUEST['s']) && isset($_REQUEST['snear']) && $_REQUEST['snear']=='' && ( $_REQUEST['s']=='' ||  $_REQUEST['s']==' ') ) )) {
515
+	if ($sort_by != '' && (!is_search() || ( isset($_REQUEST['s']) && isset($_REQUEST['snear']) && $_REQUEST['snear']=='' && ( $_REQUEST['s']=='' ||  $_REQUEST['s']==' ') ) )) {
516 516
 
517
-        $sort_array = explode('_', $sort_by);
517
+		$sort_array = explode('_', $sort_by);
518 518
 
519
-        $sort_by_count = count($sort_array);
519
+		$sort_by_count = count($sort_array);
520 520
 
521
-        $order = $sort_array[$sort_by_count - 1];
521
+		$order = $sort_array[$sort_by_count - 1];
522 522
 
523
-        if ($sort_by_count > 1 && ($order == 'asc' || $order == 'desc')) {
523
+		if ($sort_by_count > 1 && ($order == 'asc' || $order == 'desc')) {
524 524
 
525
-            $sort_by = str_replace('_' . $order, '', $sort_by);
525
+			$sort_by = str_replace('_' . $order, '', $sort_by);
526 526
 
527
-            switch ($sort_by):
527
+			switch ($sort_by):
528 528
 
529
-                case 'post_date':
530
-                case 'comment_count':
529
+				case 'post_date':
530
+				case 'comment_count':
531 531
 
532
-                    $orderby = "$wpdb->posts." . $sort_by . " " . $order . ", ".$table . ".overall_rating " . $order . ", ";
533
-                    break;
532
+					$orderby = "$wpdb->posts." . $sort_by . " " . $order . ", ".$table . ".overall_rating " . $order . ", ";
533
+					break;
534 534
 
535
-                case 'distance':
536
-                    $orderby = $sort_by . " " . $order . ", ";
537
-                    break;
535
+				case 'distance':
536
+					$orderby = $sort_by . " " . $order . ", ";
537
+					break;
538 538
 
539 539
 
540
-                // sort by rating
541
-                case 'overall_rating':
542
-                    $orderby = " " . $table . "." . $sort_by . "  " . $order . ", " . $table . ".rating_count " . $order . ", ";
540
+				// sort by rating
541
+				case 'overall_rating':
542
+					$orderby = " " . $table . "." . $sort_by . "  " . $order . ", " . $table . ".rating_count " . $order . ", ";
543 543
 
544
-                    break;
544
+					break;
545 545
 
546 546
 
547
-                default:
548
-                    if (geodir_column_exist($table, $sort_by)) {
547
+				default:
548
+					if (geodir_column_exist($table, $sort_by)) {
549 549
 						$orderby = $table . "." . $sort_by . " " . $order . ", ";
550 550
 					}
551
-                    break;
551
+					break;
552 552
 
553
-            endswitch;
553
+			endswitch;
554 554
 
555
-        }
555
+		}
556 556
 
557
-    }
557
+	}
558 558
 
559
-    return $orderby;
559
+	return $orderby;
560 560
 }
561 561
 
562 562
 /**
@@ -571,34 +571,34 @@  discard block
 block discarded – undo
571 571
 {
572 572
 
573 573
 
574
-    global $wpdb, $geodir_post_type, $table, $s, $snear;
574
+	global $wpdb, $geodir_post_type, $table, $s, $snear;
575 575
 
576
-    if (!is_admin()) {
576
+	if (!is_admin()) {
577 577
 
578
-        if (geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
579
-            add_filter('posts_where', 'geodir_edit_listing_where', 1);
578
+		if (geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
579
+			add_filter('posts_where', 'geodir_edit_listing_where', 1);
580 580
 
581
-        } elseif ((is_search() && $_REQUEST['geodir_search'])) {
581
+		} elseif ((is_search() && $_REQUEST['geodir_search'])) {
582 582
 
583
-            add_filter('posts_where', 'searching_filter_where', 1);
583
+			add_filter('posts_where', 'searching_filter_where', 1);
584 584
 
585
-            if ($snear != '')
586
-                add_filter('posts_where', 'searching_filter_where', 1);
585
+			if ($snear != '')
586
+				add_filter('posts_where', 'searching_filter_where', 1);
587 587
 
588
-            add_filter('posts_orderby', 'geodir_posts_orderby', 1);
588
+			add_filter('posts_orderby', 'geodir_posts_orderby', 1);
589 589
 
590
-        } elseif (geodir_is_page('author')) {
590
+		} elseif (geodir_is_page('author')) {
591 591
 
592
-            add_filter('posts_where', 'author_filter_where', 1);
592
+			add_filter('posts_where', 'author_filter_where', 1);
593 593
 
594
-        }
594
+		}
595 595
 
596
-        //if (!geodir_is_page('detail'))
597
-            add_filter('posts_where', 'geodir_default_where', 1);/**/
596
+		//if (!geodir_is_page('detail'))
597
+			add_filter('posts_where', 'geodir_default_where', 1);/**/
598 598
 
599
-        //add_filter( 'user_has_cap', 'geodir_preview_post_cap', 10, 3 );// let subscribers edit their own posts
599
+		//add_filter( 'user_has_cap', 'geodir_preview_post_cap', 10, 3 );// let subscribers edit their own posts
600 600
 
601
-    }
601
+	}
602 602
 }
603 603
 
604 604
 /**
@@ -613,13 +613,13 @@  discard block
 block discarded – undo
613 613
  */
614 614
 function geodir_preview_post_cap($allcaps, $caps, $args)
615 615
 {
616
-    $user_id = get_current_user_id();
617
-    if ($user_id && isset($_REQUEST['post_type']) && $_REQUEST['post_type'] != '' && isset($_REQUEST['p']) && $_REQUEST['p'] != '' && $args[0] == 'edit_post' && $_REQUEST['p'] == $args[2]) {
616
+	$user_id = get_current_user_id();
617
+	if ($user_id && isset($_REQUEST['post_type']) && $_REQUEST['post_type'] != '' && isset($_REQUEST['p']) && $_REQUEST['p'] != '' && $args[0] == 'edit_post' && $_REQUEST['p'] == $args[2]) {
618 618
 
619
-        $allcaps['edit_posts'] = true;
620
-    }
621
-    //print_r($allcaps);
622
-    return $allcaps;
619
+		$allcaps['edit_posts'] = true;
620
+	}
621
+	//print_r($allcaps);
622
+	return $allcaps;
623 623
 }
624 624
 
625 625
 
@@ -634,9 +634,9 @@  discard block
 block discarded – undo
634 634
  */
635 635
 function geodir_edit_listing_where($where)
636 636
 {
637
-    global $wpdb;
638
-    $where = $wpdb->prepare(" AND $wpdb->posts.ID = %d ", $_REQUEST['pid']);
639
-    return $where;
637
+	global $wpdb;
638
+	$where = $wpdb->prepare(" AND $wpdb->posts.ID = %d ", $_REQUEST['pid']);
639
+	return $where;
640 640
 }
641 641
 
642 642
 
@@ -653,29 +653,29 @@  discard block
 block discarded – undo
653 653
  */
654 654
 function geodir_default_where($where)
655 655
 {
656
-    global $wp_query, $wpdb;
657
-
658
-    //print_r($wp_query);
659
-    ########### WPML ###########
660
-
661
-    if (function_exists('icl_object_id')) {
662
-        global $sitepress, $table_prefix;
663
-        $lang_code = ICL_LANGUAGE_CODE;
664
-        $default_lang_code = $sitepress->get_default_language();
665
-        $q_post_type = isset($wp_query->query['post_type']) ? $wp_query->query['post_type'] : '';
666
-        //echo '##########'.$q_post_type;
667
-        if ($lang_code && $q_post_type) {
668
-            $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_" . $q_post_type . "') ";
669
-            //$where .= " AND icl_t.language_code = '$lang_code' ";
670
-        }
656
+	global $wp_query, $wpdb;
671 657
 
672
-    }
673
-    ########### WPML ###########
658
+	//print_r($wp_query);
659
+	########### WPML ###########
660
+
661
+	if (function_exists('icl_object_id')) {
662
+		global $sitepress, $table_prefix;
663
+		$lang_code = ICL_LANGUAGE_CODE;
664
+		$default_lang_code = $sitepress->get_default_language();
665
+		$q_post_type = isset($wp_query->query['post_type']) ? $wp_query->query['post_type'] : '';
666
+		//echo '##########'.$q_post_type;
667
+		if ($lang_code && $q_post_type) {
668
+			$where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_" . $q_post_type . "') ";
669
+			//$where .= " AND icl_t.language_code = '$lang_code' ";
670
+		}
671
+
672
+	}
673
+	########### WPML ###########
674 674
 
675 675
 
676
-    return $where = str_replace("0 = 1", "1=1", $where);
676
+	return $where = str_replace("0 = 1", "1=1", $where);
677 677
 
678
-    /* ====== old code start ===
678
+	/* ====== old code start ===
679 679
     $where = str_replace("0 = 1", "1=1", $where);
680 680
     $country = get_query_var('gd_country');
681 681
     $region = get_query_var('gd_region');
@@ -716,108 +716,108 @@  discard block
 block discarded – undo
716 716
  * @return string Modified where query string.
717 717
  */
718 718
 function searching_filter_where($where) {
719
-    global $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $s, $snear, $s_A, $s_SA, $search_term, $gd_session;
719
+	global $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $s, $snear, $s_A, $s_SA, $search_term, $gd_session;
720 720
 
721
-    $search_term = 'OR';
722
-    $search_term = 'AND';
723
-    $geodir_custom_search = '';
724
-    $category_search_range = '';
721
+	$search_term = 'OR';
722
+	$search_term = 'AND';
723
+	$geodir_custom_search = '';
724
+	$category_search_range = '';
725 725
 
726
-    if (is_single() && get_query_var('post_type')) {
726
+	if (is_single() && get_query_var('post_type')) {
727 727
 		return $where;
728 728
 	}
729 729
 
730
-    if (is_tax()) {
730
+	if (is_tax()) {
731 731
 		return $where;
732 732
 	}
733 733
 
734 734
 	$s = trim($s);
735
-    $s  = wp_specialchars_decode($s ,ENT_QUOTES);
736
-    $s_A = wp_specialchars_decode($s_A ,ENT_QUOTES);
737
-
738
-    $where = '';
739
-    $better_search_terms = '';
740
-    if (isset($_REQUEST['stype']))
741
-        $post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype']));
742
-    else
743
-        $post_types = 'gd_place';
744
-
745
-    if ($s != '') {
746
-        $keywords = explode(" ", $s);
747
-        if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
748
-            foreach($keywords as $kkey=>$kword){
749
-                if(geodir_utf8_strlen($kword)<=$klimit){
750
-                    unset($keywords[$kkey]);
751
-                }
752
-            }
753
-        }
735
+	$s  = wp_specialchars_decode($s ,ENT_QUOTES);
736
+	$s_A = wp_specialchars_decode($s_A ,ENT_QUOTES);
754 737
 
755
-        if (!empty($keywords)) {
756
-            foreach ($keywords as $keyword) {
757
-                $keyword = trim($keyword);
758
-                $keyword  = wp_specialchars_decode($keyword ,ENT_QUOTES);
759
-                if ($keyword != '') {
760
-                    /**
761
-                     * Filter the search query keywords SQL.
762
-                     *
763
-                     * @since 1.5.9
764
-                     * @package GeoDirectory
765
-                     * @param string $better_search_terms The query values, default: `' OR ( ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '" OR ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '%" OR ' . $wpdb->posts . '.post_title LIKE "% ' . $keyword . '%" )'`.
766
-                     * @param array $keywords The array of keywords for the query.
767
-                     * @param string $keyword The single keyword being searched.
768
-                     */
738
+	$where = '';
739
+	$better_search_terms = '';
740
+	if (isset($_REQUEST['stype']))
741
+		$post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype']));
742
+	else
743
+		$post_types = 'gd_place';
744
+
745
+	if ($s != '') {
746
+		$keywords = explode(" ", $s);
747
+		if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
748
+			foreach($keywords as $kkey=>$kword){
749
+				if(geodir_utf8_strlen($kword)<=$klimit){
750
+					unset($keywords[$kkey]);
751
+				}
752
+			}
753
+		}
754
+
755
+		if (!empty($keywords)) {
756
+			foreach ($keywords as $keyword) {
757
+				$keyword = trim($keyword);
758
+				$keyword  = wp_specialchars_decode($keyword ,ENT_QUOTES);
759
+				if ($keyword != '') {
760
+					/**
761
+					 * Filter the search query keywords SQL.
762
+					 *
763
+					 * @since 1.5.9
764
+					 * @package GeoDirectory
765
+					 * @param string $better_search_terms The query values, default: `' OR ( ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '" OR ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '%" OR ' . $wpdb->posts . '.post_title LIKE "% ' . $keyword . '%" )'`.
766
+					 * @param array $keywords The array of keywords for the query.
767
+					 * @param string $keyword The single keyword being searched.
768
+					 */
769 769
 					$better_search_terms .= apply_filters("geodir_search_better_search_terms",' OR ( ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '" OR ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '%" OR ' . $wpdb->posts . '.post_title LIKE "% ' . $keyword . '%" )',$keywords,$keyword);
770
-                }
771
-            }
772
-        }
773
-    }
770
+				}
771
+			}
772
+		}
773
+	}
774 774
 
775
-    /* get taxonomy */
776
-    $taxonomies = geodir_get_taxonomies($post_types, true);
777
-    if($taxonomies) {
778
-        $taxonomies = implode("','", $taxonomies);
779
-        $taxonomies = "'" . $taxonomies . "'";
780
-    }else{$taxonomies='';}
775
+	/* get taxonomy */
776
+	$taxonomies = geodir_get_taxonomies($post_types, true);
777
+	if($taxonomies) {
778
+		$taxonomies = implode("','", $taxonomies);
779
+		$taxonomies = "'" . $taxonomies . "'";
780
+	}else{$taxonomies='';}
781 781
 
782
-    $content_where = $terms_where = '';
782
+	$content_where = $terms_where = '';
783 783
 	if ($s != '') {
784
-        /**
785
-         * Filter the search query content where values.
786
-         *
787
-         * @since 1.5.0
788
-         * @package GeoDirectory
789
-         * @param string $content_where The query values, default: `" OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ") "`.
790
-         */
784
+		/**
785
+		 * Filter the search query content where values.
786
+		 *
787
+		 * @since 1.5.0
788
+		 * @package GeoDirectory
789
+		 * @param string $content_where The query values, default: `" OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ") "`.
790
+		 */
791 791
 		$content_where = apply_filters("geodir_search_content_where"," OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ");
792
-        /**
793
-         * Filter the search query term values.
794
-         *
795
-         * @since 1.5.0
796
-         * @package GeoDirectory
797
-         * @param string $terms_where The separator, default: `" AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) "`.
798
-         */
799
-        $terms_where = apply_filters("geodir_search_terms_where"," AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) ");
792
+		/**
793
+		 * Filter the search query term values.
794
+		 *
795
+		 * @since 1.5.0
796
+		 * @package GeoDirectory
797
+		 * @param string $terms_where The separator, default: `" AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) "`.
798
+		 */
799
+		$terms_where = apply_filters("geodir_search_terms_where"," AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) ");
800 800
 	}
801 801
 
802
-    if ($snear != '') {
802
+	if ($snear != '') {
803 803
 
804 804
 
805
-        if (is_numeric($gd_session->get('near_me_range')) && !isset($_REQUEST['sdist'])) {
806
-            $dist = $gd_session->get('near_me_range');
807
-        }
808
-        $lon1 = $mylon - $dist / abs(cos(deg2rad($mylat)) * 69);
809
-        $lon2 = $mylon + $dist / abs(cos(deg2rad($mylat)) * 69);
810
-        $lat1 = $mylat - ($dist / 69);
811
-        $lat2 = $mylat + ($dist / 69);
805
+		if (is_numeric($gd_session->get('near_me_range')) && !isset($_REQUEST['sdist'])) {
806
+			$dist = $gd_session->get('near_me_range');
807
+		}
808
+		$lon1 = $mylon - $dist / abs(cos(deg2rad($mylat)) * 69);
809
+		$lon2 = $mylon + $dist / abs(cos(deg2rad($mylat)) * 69);
810
+		$lat1 = $mylat - ($dist / 69);
811
+		$lat2 = $mylat + ($dist / 69);
812 812
 
813
-        $rlon1 = is_numeric(min($lon1, $lon2)) ? min($lon1, $lon2) : '';
814
-        $rlon2 = is_numeric(max($lon1, $lon2)) ? max($lon1, $lon2) : '';
815
-        $rlat1 = is_numeric(min($lat1, $lat2)) ? min($lat1, $lat2) : '';
816
-        $rlat2 = is_numeric(max($lat1, $lat2)) ? max($lat1, $lat2) : '';
813
+		$rlon1 = is_numeric(min($lon1, $lon2)) ? min($lon1, $lon2) : '';
814
+		$rlon2 = is_numeric(max($lon1, $lon2)) ? max($lon1, $lon2) : '';
815
+		$rlat1 = is_numeric(min($lat1, $lat2)) ? min($lat1, $lat2) : '';
816
+		$rlat2 = is_numeric(max($lat1, $lat2)) ? max($lat1, $lat2) : '';
817 817
 
818 818
 
819 819
 
820
-	    $where .= " AND ( ( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms)
820
+		$where .= " AND ( ( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms)
821 821
 			                    $content_where 
822 822
 								OR ($wpdb->posts.ID IN( 
823 823
 										SELECT $wpdb->term_relationships.object_id as post_id 
@@ -834,13 +834,13 @@  discard block
 block discarded – undo
834 834
 						AND ( " . $table . ".post_latitude between $rlat1 and $rlat2 )
835 835
 						AND ( " . $table . ".post_longitude between $rlon1 and $rlon2 ) ";
836 836
 
837
-        if (isset($_REQUEST['sdist']) && $_REQUEST['sdist'] != 'all') {
838
-            $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
839
-            $where .= " AND CONVERT((" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) ))),DECIMAL(64,4)) <= " . $dist;
840
-        }
837
+		if (isset($_REQUEST['sdist']) && $_REQUEST['sdist'] != 'all') {
838
+			$DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
839
+			$where .= " AND CONVERT((" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) ))),DECIMAL(64,4)) <= " . $dist;
840
+		}
841 841
 
842
-    } else {
843
-        $where .= " AND (	( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms)
842
+	} else {
843
+		$where .= " AND (	( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms)
844 844
                             $content_where  
845 845
 							OR ( $wpdb->posts.ID IN(	
846 846
 									SELECT $wpdb->term_relationships.object_id as post_id                     
@@ -854,19 +854,19 @@  discard block
 block discarded – undo
854 854
 					) 
855 855
 				AND $wpdb->posts.post_type in ('$post_types')
856 856
 				AND ($wpdb->posts.post_status = 'publish') ";
857
-    }
857
+	}
858 858
 
859 859
 	########### WPML ###########
860
-    if ( function_exists( 'icl_object_id' ) ) {
860
+	if ( function_exists( 'icl_object_id' ) ) {
861 861
 		$lang_code = ICL_LANGUAGE_CODE;
862 862
 
863 863
 		if ($lang_code && $post_types) {
864
-            $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_" . $post_types . "') ";
865
-        }
866
-    }
867
-    ########### WPML ###########
864
+			$where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_" . $post_types . "') ";
865
+		}
866
+	}
867
+	########### WPML ###########
868 868
 
869
-    return $where;
869
+	return $where;
870 870
 }
871 871
 
872 872
 
@@ -881,45 +881,45 @@  discard block
 block discarded – undo
881 881
  * @return string Modified where query string.
882 882
  */
883 883
 function author_filter_where($where) {
884
-    global $wpdb, $geodir_post_type, $table, $curr;
884
+	global $wpdb, $geodir_post_type, $table, $curr;
885 885
 
886
-    $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
887
-    $user_id = !empty($curauth->ID) ? (int)$curauth->ID : 0;
886
+	$curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
887
+	$user_id = !empty($curauth->ID) ? (int)$curauth->ID : 0;
888 888
 
889
-    if (isset($_REQUEST['stype'])) {
890
-        $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ",$_REQUEST['stype']);
891
-    } else {
892
-        $where = " AND $wpdb->posts.post_type IN ('gd_place') ";
893
-    }
889
+	if (isset($_REQUEST['stype'])) {
890
+		$where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ",$_REQUEST['stype']);
891
+	} else {
892
+		$where = " AND $wpdb->posts.post_type IN ('gd_place') ";
893
+	}
894 894
 
895
-    if ($user_id > 0) {
896
-        if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
897
-            $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true);
898
-            $user_fav_posts = !empty($user_fav_posts) && is_array($user_fav_posts) ? implode("','", $user_fav_posts) : '-1';
899
-            $where .= " AND $wpdb->posts.ID IN ('$user_fav_posts')";
900
-        } else
901
-            $where .= " AND $wpdb->posts.post_author = $user_id";
902
-
903
-        if ($user_id == (int)get_current_user_id()) {
904
-            $where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') ";
905
-        } else {
906
-            $where .= " AND $wpdb->posts.post_status = 'publish' ";
907
-        }
908
-    } else {
909
-        $where .= " AND $wpdb->posts.post_author = '-1' AND $wpdb->posts.post_status = 'publish' ";
910
-    }
895
+	if ($user_id > 0) {
896
+		if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
897
+			$user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true);
898
+			$user_fav_posts = !empty($user_fav_posts) && is_array($user_fav_posts) ? implode("','", $user_fav_posts) : '-1';
899
+			$where .= " AND $wpdb->posts.ID IN ('$user_fav_posts')";
900
+		} else
901
+			$where .= " AND $wpdb->posts.post_author = $user_id";
902
+
903
+		if ($user_id == (int)get_current_user_id()) {
904
+			$where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') ";
905
+		} else {
906
+			$where .= " AND $wpdb->posts.post_status = 'publish' ";
907
+		}
908
+	} else {
909
+		$where .= " AND $wpdb->posts.post_author = '-1' AND $wpdb->posts.post_status = 'publish' ";
910
+	}
911 911
 
912
-    ########### WPML ###########
913
-    if (function_exists('icl_object_id')) {
914
-        $lang_code = ICL_LANGUAGE_CODE;
915
-        if ($lang_code) {
916
-            $where .= " AND icl_t.language_code='" . $lang_code . "' ";
917
-        }
912
+	########### WPML ###########
913
+	if (function_exists('icl_object_id')) {
914
+		$lang_code = ICL_LANGUAGE_CODE;
915
+		if ($lang_code) {
916
+			$where .= " AND icl_t.language_code='" . $lang_code . "' ";
917
+		}
918 918
 
919
-    }
920
-    ########### WPML ###########
919
+	}
920
+	########### WPML ###########
921 921
 
922
-    return $where;
922
+	return $where;
923 923
 }
924 924
 
925 925
 /**
@@ -934,11 +934,11 @@  discard block
 block discarded – undo
934 934
  */
935 935
 function geodir_filter_widget_join($join)
936 936
 {
937
-    global $wp_query, $table;
938
-    if (!empty($wp_query->query['with_pics_only'])) {
939
-        $join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )";
940
-    }
941
-    return $join;
937
+	global $wp_query, $table;
938
+	if (!empty($wp_query->query['with_pics_only'])) {
939
+		$join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )";
940
+	}
941
+	return $join;
942 942
 }
943 943
 
944 944
 /**
@@ -953,42 +953,42 @@  discard block
 block discarded – undo
953 953
  */
954 954
 function geodir_filter_widget_where($where)
955 955
 {
956
-    global $wp_query, $table;
957
-    if (!empty($wp_query->query['show_featured_only'])) {
958
-        $where .= " AND " . $table . ".is_featured = '1'";
959
-    }
960
-    if (!empty($wp_query->query['show_special_only'])) {
961
-        $where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )";
962
-    }
963
-    if (!empty($wp_query->query['with_pics_only'])) {
964
-        $where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL GROUP BY " . $table . ".post_id";
965
-    }
966
-    if (!empty($wp_query->query['with_videos_only'])) {
967
-        $where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )";
968
-    }
969
-    return $where;
956
+	global $wp_query, $table;
957
+	if (!empty($wp_query->query['show_featured_only'])) {
958
+		$where .= " AND " . $table . ".is_featured = '1'";
959
+	}
960
+	if (!empty($wp_query->query['show_special_only'])) {
961
+		$where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )";
962
+	}
963
+	if (!empty($wp_query->query['with_pics_only'])) {
964
+		$where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL GROUP BY " . $table . ".post_id";
965
+	}
966
+	if (!empty($wp_query->query['with_videos_only'])) {
967
+		$where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )";
968
+	}
969
+	return $where;
970 970
 }
971 971
 
972 972
 
973 973
 function geodir_related_posts_fields($fields) {
974
-    global $wp_query, $wpdb, $table, $post;
974
+	global $wp_query, $wpdb, $table, $post;
975 975
 
976
-    $fields .= ", " . $table . ".* ";
976
+	$fields .= ", " . $table . ".* ";
977 977
 
978
-    $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
978
+	$DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
979 979
 
980
-    $mylat = $post->post_latitude;
981
-    $mylon = $post->post_longitude;
980
+	$mylat = $post->post_latitude;
981
+	$mylon = $post->post_longitude;
982 982
 
983
-    $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance ";
984
-    return $fields;
983
+	$fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance ";
984
+	return $fields;
985 985
 }
986 986
 function geodir_related_posts_fields_filter($query) {
987
-    if ( isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']
988
-        && isset($query->query_vars['order_by']) && $query->query_vars['order_by'] == 'nearest'
989
-        && isset($query->query_vars['related_listings']) && $query->query_vars['related_listings']
990
-    ) {
991
-        add_filter('posts_fields', 'geodir_related_posts_fields', 1);
992
-    }
987
+	if ( isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']
988
+		&& isset($query->query_vars['order_by']) && $query->query_vars['order_by'] == 'nearest'
989
+		&& isset($query->query_vars['related_listings']) && $query->query_vars['related_listings']
990
+	) {
991
+		add_filter('posts_fields', 'geodir_related_posts_fields', 1);
992
+	}
993 993
 }
994 994
 add_action('pre_get_posts', 'geodir_related_posts_fields_filter', 1);
995 995
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
  * @global string $s_A Extra parameters.
66 66
  * @global string $s_SA Extra parameters.
67 67
  */
68
-function set_listing_request($query )
68
+function set_listing_request($query)
69 69
 {
70 70
     global $wp_query, $wpdb, $geodir_post_type, $table, $dist, $mylat, $mylon, $s, $snear, $s, $s_A, $s_SA;
71 71
 
@@ -99,15 +99,15 @@  discard block
 block discarded – undo
99 99
         } //  Distance
100 100
 
101 101
         if (isset($_REQUEST['sgeo_lat'])) {
102
-            $mylat = (float)esc_attr($_REQUEST['sgeo_lat']);
102
+            $mylat = (float) esc_attr($_REQUEST['sgeo_lat']);
103 103
         } else {
104
-            $mylat = (float)geodir_get_current_city_lat();
104
+            $mylat = (float) geodir_get_current_city_lat();
105 105
         } //  Latatude
106 106
 
107 107
         if (isset($_REQUEST['sgeo_lon'])) {
108
-            $mylon = (float)esc_attr($_REQUEST['sgeo_lon']);
108
+            $mylon = (float) esc_attr($_REQUEST['sgeo_lon']);
109 109
         } else {
110
-            $mylon = (float)geodir_get_current_city_lng();
110
+            $mylon = (float) geodir_get_current_city_lng();
111 111
         } //  Distance
112 112
 
113 113
         if (isset($_REQUEST['snear'])) {
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 
121 121
         if ($snear == 'NEAR ME') {
122 122
             $ip = $_SERVER['REMOTE_ADDR'];
123
-            $addr_details = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=' . $ip));
123
+            $addr_details = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip='.$ip));
124 124
             $mylat = stripslashes(ucfirst($addr_details[geoplugin_latitude]));
125 125
             $mylon = stripslashes(ucfirst($addr_details[geoplugin_longitude]));
126 126
         }
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
             $s_AA = str_replace(" ", "", $s);
131 131
             $s_A = explode(",", $s_AA);
132 132
             $s_A = implode('","', $s_A);
133
-            $s_A = '"' . $s_A . '"';
133
+            $s_A = '"'.$s_A.'"';
134 134
         } else {
135
-            $s_A = '"' . $s . '"';
135
+            $s_A = '"'.$s.'"';
136 136
         }
137 137
 
138 138
         if (strstr($s, ' ')) {
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
     }
194 194
     if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) {
195 195
 
196
-        $table = $plugin_prefix . $geodir_post_type . '_detail';
196
+        $table = $plugin_prefix.$geodir_post_type.'_detail';
197 197
 
198 198
         add_filter('posts_fields', 'geodir_posts_fields', 1);
199 199
         add_filter('posts_join', 'geodir_posts_join', 1);
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
     global $wp_query, $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $snear, $gd_session;
234 234
 
235 235
     // Filter-Location-Manager to add location table.
236
-    $fields .= ", " . $table . ".* ";
236
+    $fields .= ", ".$table.".* ";
237 237
 
238 238
 	if ($snear != '' || $gd_session->get('all_near_me')) {
239 239
         $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
@@ -243,16 +243,16 @@  discard block
 block discarded – undo
243 243
             $mylon = $gd_session->get('user_lon');
244 244
         }
245 245
 
246
-        $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance ";
246
+        $fields .= " , (".$DistanceRadius." * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(".$table.".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(".$table.".post_latitude) * pi()/180) *POWER(SIN(($mylon - ".$table.".post_longitude) * pi()/180 / 2), 2) )))as distance ";
247 247
     }
248 248
 
249 249
     global $s;
250 250
     if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
251 251
         $keywords = explode(" ", $s);
252 252
 
253
-        if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
254
-            foreach($keywords as $kkey=>$kword){
255
-                if(geodir_utf8_strlen($kword)<=$klimit){
253
+        if (is_array($keywords) && $klimit = get_option('geodir_search_word_limit')) {
254
+            foreach ($keywords as $kkey=>$kword) {
255
+                if (geodir_utf8_strlen($kword) <= $klimit) {
256 256
                     unset($keywords[$kkey]);
257 257
                 }
258 258
             }
@@ -270,24 +270,24 @@  discard block
 block discarded – undo
270 270
                 $count = 0;
271 271
                 foreach ($keywords as $keyword) {
272 272
                     $keyword = trim($keyword);
273
-                    $keyword  = wp_specialchars_decode($keyword ,ENT_QUOTES);
273
+                    $keyword = wp_specialchars_decode($keyword, ENT_QUOTES);
274 274
 					$count++;
275 275
                     if ($count < count($keywords)) {
276 276
                        // $gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' " . $key . " ";
277
-						$gd_titlematch_part .= "( " . $wpdb->posts . ".post_title LIKE '" . $keyword . "' OR " . $wpdb->posts . ".post_title LIKE '" . $keyword . "%%' OR " . $wpdb->posts . ".post_title LIKE '%% " . $keyword . "%%' ) " . $key . " ";
277
+						$gd_titlematch_part .= "( ".$wpdb->posts.".post_title LIKE '".$keyword."' OR ".$wpdb->posts.".post_title LIKE '".$keyword."%%' OR ".$wpdb->posts.".post_title LIKE '%% ".$keyword."%%' ) ".$key." ";
278 278
                     } else {
279 279
                         //$gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' ";
280
-						$gd_titlematch_part .= "( " . $wpdb->posts . ".post_title LIKE '" . $keyword . "' OR " . $wpdb->posts . ".post_title LIKE '" . $keyword . "%%' OR " . $wpdb->posts . ".post_title LIKE '%% " . $keyword . "%%' ) ";
280
+						$gd_titlematch_part .= "( ".$wpdb->posts.".post_title LIKE '".$keyword."' OR ".$wpdb->posts.".post_title LIKE '".$keyword."%%' OR ".$wpdb->posts.".post_title LIKE '%% ".$keyword."%%' ) ";
281 281
                     }
282 282
                 }
283
-                $gd_titlematch_part .= "THEN 1 ELSE 0 END AS " . $part . ",";
283
+                $gd_titlematch_part .= "THEN 1 ELSE 0 END AS ".$part.",";
284 284
             }
285 285
         } else {
286 286
             $gd_titlematch_part = "";
287 287
         }
288
-        $s = stripslashes_deep( $s );
289
-        $s = wp_specialchars_decode($s,ENT_QUOTES);
290
-		$fields .= $wpdb->prepare(", CASE WHEN " . $table . ".is_featured='1' THEN 1 ELSE 0 END AS gd_featured, CASE WHEN " . $wpdb->posts . ".post_title LIKE %s THEN 1 ELSE 0 END AS gd_exacttitle," . $gd_titlematch_part . " CASE WHEN ( " . $wpdb->posts . ".post_title LIKE %s OR " . $wpdb->posts . ".post_title LIKE %s OR " . $wpdb->posts . ".post_title LIKE %s ) THEN 1 ELSE 0 END AS gd_titlematch, CASE WHEN ( " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s ) THEN 1 ELSE 0 END AS gd_content", array($s, $s, $s . '%', '% ' . $s . '%', $s, $s . ' %', '% ' . $s . ' %', '% ' . $s));
288
+        $s = stripslashes_deep($s);
289
+        $s = wp_specialchars_decode($s, ENT_QUOTES);
290
+		$fields .= $wpdb->prepare(", CASE WHEN ".$table.".is_featured='1' THEN 1 ELSE 0 END AS gd_featured, CASE WHEN ".$wpdb->posts.".post_title LIKE %s THEN 1 ELSE 0 END AS gd_exacttitle,".$gd_titlematch_part." CASE WHEN ( ".$wpdb->posts.".post_title LIKE %s OR ".$wpdb->posts.".post_title LIKE %s OR ".$wpdb->posts.".post_title LIKE %s ) THEN 1 ELSE 0 END AS gd_titlematch, CASE WHEN ( ".$wpdb->posts.".post_content LIKE %s OR ".$wpdb->posts.".post_content LIKE %s OR ".$wpdb->posts.".post_content LIKE %s OR ".$wpdb->posts.".post_content LIKE %s ) THEN 1 ELSE 0 END AS gd_content", array($s, $s, $s.'%', '% '.$s.'%', $s, $s.' %', '% '.$s.' %', '% '.$s));
291 291
     }
292 292
 
293 293
     return $fields;
@@ -316,13 +316,13 @@  discard block
 block discarded – undo
316 316
         $lang_code = ICL_LANGUAGE_CODE;
317 317
         $default_lang_code = $sitepress->get_default_language();
318 318
         if ($lang_code) {
319
-            $join .= "JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID";
319
+            $join .= "JOIN ".$table_prefix."icl_translations icl_t ON icl_t.element_id = ".$table_prefix."posts.ID";
320 320
         }
321 321
 
322 322
     }
323 323
     ########### WPML ###########
324 324
 
325
-    $join .= " INNER JOIN " . $table . " ON (" . $table . ".post_id = $wpdb->posts.ID)  ";
325
+    $join .= " INNER JOIN ".$table." ON (".$table.".post_id = $wpdb->posts.ID)  ";
326 326
     //===old code start
327 327
     //$join .= " INNER JOIN ".POST_LOCATION_TABLE." ON (".$table.".post_location_id = ".POST_LOCATION_TABLE.".location_id)  " ;//===old code end
328 328
 
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
             $sort_by = 'az';
392 392
         }
393 393
 
394
-        if ($snear != '' &&  $sort_by!='farthest') {
394
+        if ($snear != '' && $sort_by != 'farthest') {
395 395
             $sort_by = 'nearest';
396 396
         }
397 397
     }
@@ -405,20 +405,20 @@  discard block
 block discarded – undo
405 405
             break;
406 406
         case 'low_review':
407 407
         case 'rating_count_asc':
408
-            $orderby = $table . ".rating_count ASC, " . $table . ".overall_rating ASC, ";
408
+            $orderby = $table.".rating_count ASC, ".$table.".overall_rating ASC, ";
409 409
             break;
410 410
         case 'high_review':
411 411
         case 'rating_count_desc':
412
-            $orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, ";
412
+            $orderby = $table.".rating_count DESC, ".$table.".overall_rating DESC, ";
413 413
             break;
414 414
         case 'low_rating':
415
-            $orderby = "( " . $table . ".overall_rating  ) ASC, " . $table . ".rating_count ASC,  ";
415
+            $orderby = "( ".$table.".overall_rating  ) ASC, ".$table.".rating_count ASC,  ";
416 416
             break;
417 417
         case 'high_rating':
418
-            $orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, ";
418
+            $orderby = " ".$table.".overall_rating DESC, ".$table.".rating_count DESC, ";
419 419
             break;
420 420
         case 'featured':
421
-            $orderby = $table . ".is_featured asc, ";
421
+            $orderby = $table.".is_featured asc, ";
422 422
             break;
423 423
         case 'nearest':
424 424
             $orderby = " distance asc, ";
@@ -434,10 +434,10 @@  discard block
 block discarded – undo
434 434
             break;
435 435
         // sort by rating
436 436
         case 'overall_rating_desc':
437
-            $orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, ";
437
+            $orderby = " ".$table.".overall_rating DESC, ".$table.".rating_count DESC, ";
438 438
             break;
439 439
         case 'overall_rating_asc':
440
-            $orderby = " " . $table . ".overall_rating ASC, " . $table . ".rating_count ASC, ";
440
+            $orderby = " ".$table.".overall_rating ASC, ".$table.".rating_count ASC, ";
441 441
             break;
442 442
         default:
443 443
 
@@ -458,24 +458,24 @@  discard block
 block discarded – undo
458 458
 
459 459
     if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
460 460
         $keywords = explode(" ", $s);
461
-        if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
462
-            foreach($keywords as $kkey=>$kword){
463
-                if(geodir_utf8_strlen($kword)<=$klimit){
461
+        if (is_array($keywords) && $klimit = get_option('geodir_search_word_limit')) {
462
+            foreach ($keywords as $kkey=>$kword) {
463
+                if (geodir_utf8_strlen($kword) <= $klimit) {
464 464
                     unset($keywords[$kkey]);
465 465
                 }
466 466
             }
467 467
         }
468 468
         if ($sort_by == 'nearest' || $sort_by == 'farthest') {
469 469
             if (count($keywords) > 1) {
470
-                $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, ";
470
+                $orderby = $orderby." ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, ";
471 471
             } else {
472
-                $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, ";
472
+                $orderby = $orderby." ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, ";
473 473
             }
474 474
         } else {
475 475
             if (count($keywords) > 1) {
476
-                $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, " . $orderby;
476
+                $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, ".$orderby;
477 477
             } else {
478
-                $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, " . $orderby;
478
+                $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, ".$orderby;
479 479
             }
480 480
         }
481 481
     }
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
      */
491 491
     $orderby = apply_filters('geodir_posts_order_by_sort', $orderby, $sort_by, $table);
492 492
 
493
-    $orderby .= $table . ".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title ";
493
+    $orderby .= $table.".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title ";
494 494
 
495 495
     return $orderby;
496 496
 }
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
 
513 513
     global $wpdb;
514 514
 
515
-    if ($sort_by != '' && (!is_search() || ( isset($_REQUEST['s']) && isset($_REQUEST['snear']) && $_REQUEST['snear']=='' && ( $_REQUEST['s']=='' ||  $_REQUEST['s']==' ') ) )) {
515
+    if ($sort_by != '' && (!is_search() || (isset($_REQUEST['s']) && isset($_REQUEST['snear']) && $_REQUEST['snear'] == '' && ($_REQUEST['s'] == '' || $_REQUEST['s'] == ' ')))) {
516 516
 
517 517
         $sort_array = explode('_', $sort_by);
518 518
 
@@ -522,31 +522,31 @@  discard block
 block discarded – undo
522 522
 
523 523
         if ($sort_by_count > 1 && ($order == 'asc' || $order == 'desc')) {
524 524
 
525
-            $sort_by = str_replace('_' . $order, '', $sort_by);
525
+            $sort_by = str_replace('_'.$order, '', $sort_by);
526 526
 
527 527
             switch ($sort_by):
528 528
 
529 529
                 case 'post_date':
530 530
                 case 'comment_count':
531 531
 
532
-                    $orderby = "$wpdb->posts." . $sort_by . " " . $order . ", ".$table . ".overall_rating " . $order . ", ";
532
+                    $orderby = "$wpdb->posts.".$sort_by." ".$order.", ".$table.".overall_rating ".$order.", ";
533 533
                     break;
534 534
 
535 535
                 case 'distance':
536
-                    $orderby = $sort_by . " " . $order . ", ";
536
+                    $orderby = $sort_by." ".$order.", ";
537 537
                     break;
538 538
 
539 539
 
540 540
                 // sort by rating
541 541
                 case 'overall_rating':
542
-                    $orderby = " " . $table . "." . $sort_by . "  " . $order . ", " . $table . ".rating_count " . $order . ", ";
542
+                    $orderby = " ".$table.".".$sort_by."  ".$order.", ".$table.".rating_count ".$order.", ";
543 543
 
544 544
                     break;
545 545
 
546 546
 
547 547
                 default:
548 548
                     if (geodir_column_exist($table, $sort_by)) {
549
-						$orderby = $table . "." . $sort_by . " " . $order . ", ";
549
+						$orderby = $table.".".$sort_by." ".$order.", ";
550 550
 					}
551 551
                     break;
552 552
 
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
         }
595 595
 
596 596
         //if (!geodir_is_page('detail'))
597
-            add_filter('posts_where', 'geodir_default_where', 1);/**/
597
+            add_filter('posts_where', 'geodir_default_where', 1); /**/
598 598
 
599 599
         //add_filter( 'user_has_cap', 'geodir_preview_post_cap', 10, 3 );// let subscribers edit their own posts
600 600
 
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
         $q_post_type = isset($wp_query->query['post_type']) ? $wp_query->query['post_type'] : '';
666 666
         //echo '##########'.$q_post_type;
667 667
         if ($lang_code && $q_post_type) {
668
-            $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_" . $q_post_type . "') ";
668
+            $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_".$q_post_type."') ";
669 669
             //$where .= " AND icl_t.language_code = '$lang_code' ";
670 670
         }
671 671
 
@@ -732,8 +732,8 @@  discard block
 block discarded – undo
732 732
 	}
733 733
 
734 734
 	$s = trim($s);
735
-    $s  = wp_specialchars_decode($s ,ENT_QUOTES);
736
-    $s_A = wp_specialchars_decode($s_A ,ENT_QUOTES);
735
+    $s = wp_specialchars_decode($s, ENT_QUOTES);
736
+    $s_A = wp_specialchars_decode($s_A, ENT_QUOTES);
737 737
 
738 738
     $where = '';
739 739
     $better_search_terms = '';
@@ -744,9 +744,9 @@  discard block
 block discarded – undo
744 744
 
745 745
     if ($s != '') {
746 746
         $keywords = explode(" ", $s);
747
-        if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
748
-            foreach($keywords as $kkey=>$kword){
749
-                if(geodir_utf8_strlen($kword)<=$klimit){
747
+        if (is_array($keywords) && $klimit = get_option('geodir_search_word_limit')) {
748
+            foreach ($keywords as $kkey=>$kword) {
749
+                if (geodir_utf8_strlen($kword) <= $klimit) {
750 750
                     unset($keywords[$kkey]);
751 751
                 }
752 752
             }
@@ -755,7 +755,7 @@  discard block
 block discarded – undo
755 755
         if (!empty($keywords)) {
756 756
             foreach ($keywords as $keyword) {
757 757
                 $keyword = trim($keyword);
758
-                $keyword  = wp_specialchars_decode($keyword ,ENT_QUOTES);
758
+                $keyword = wp_specialchars_decode($keyword, ENT_QUOTES);
759 759
                 if ($keyword != '') {
760 760
                     /**
761 761
                      * Filter the search query keywords SQL.
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
                      * @param array $keywords The array of keywords for the query.
767 767
                      * @param string $keyword The single keyword being searched.
768 768
                      */
769
-					$better_search_terms .= apply_filters("geodir_search_better_search_terms",' OR ( ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '" OR ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '%" OR ' . $wpdb->posts . '.post_title LIKE "% ' . $keyword . '%" )',$keywords,$keyword);
769
+					$better_search_terms .= apply_filters("geodir_search_better_search_terms", ' OR ( '.$wpdb->posts.'.post_title LIKE "'.$keyword.'" OR '.$wpdb->posts.'.post_title LIKE "'.$keyword.'%" OR '.$wpdb->posts.'.post_title LIKE "% '.$keyword.'%" )', $keywords, $keyword);
770 770
                 }
771 771
             }
772 772
         }
@@ -774,10 +774,10 @@  discard block
 block discarded – undo
774 774
 
775 775
     /* get taxonomy */
776 776
     $taxonomies = geodir_get_taxonomies($post_types, true);
777
-    if($taxonomies) {
777
+    if ($taxonomies) {
778 778
         $taxonomies = implode("','", $taxonomies);
779
-        $taxonomies = "'" . $taxonomies . "'";
780
-    }else{$taxonomies='';}
779
+        $taxonomies = "'".$taxonomies."'";
780
+    } else {$taxonomies = ''; }
781 781
 
782 782
     $content_where = $terms_where = '';
783 783
 	if ($s != '') {
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
          * @package GeoDirectory
789 789
          * @param string $content_where The query values, default: `" OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ") "`.
790 790
          */
791
-		$content_where = apply_filters("geodir_search_content_where"," OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ");
791
+		$content_where = apply_filters("geodir_search_content_where", " OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ");
792 792
         /**
793 793
          * Filter the search query term values.
794 794
          *
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
          * @package GeoDirectory
797 797
          * @param string $terms_where The separator, default: `" AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) "`.
798 798
          */
799
-        $terms_where = apply_filters("geodir_search_terms_where"," AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) ");
799
+        $terms_where = apply_filters("geodir_search_terms_where", " AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) ");
800 800
 	}
801 801
 
802 802
     if ($snear != '') {
@@ -831,12 +831,12 @@  discard block
 block discarded – undo
831 831
 							)
832 832
 						AND $wpdb->posts.post_type in ('{$post_types}')
833 833
 						AND ($wpdb->posts.post_status = 'publish')
834
-						AND ( " . $table . ".post_latitude between $rlat1 and $rlat2 )
835
-						AND ( " . $table . ".post_longitude between $rlon1 and $rlon2 ) ";
834
+						AND ( ".$table.".post_latitude between $rlat1 and $rlat2 )
835
+						AND ( ".$table.".post_longitude between $rlon1 and $rlon2 ) ";
836 836
 
837 837
         if (isset($_REQUEST['sdist']) && $_REQUEST['sdist'] != 'all') {
838 838
             $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
839
-            $where .= " AND CONVERT((" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) ))),DECIMAL(64,4)) <= " . $dist;
839
+            $where .= " AND CONVERT((".$DistanceRadius." * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(".$table.".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(".$table.".post_latitude) * pi()/180) *POWER(SIN(($mylon - ".$table.".post_longitude) * pi()/180 / 2), 2) ))),DECIMAL(64,4)) <= ".$dist;
840 840
         }
841 841
 
842 842
     } else {
@@ -857,11 +857,11 @@  discard block
 block discarded – undo
857 857
     }
858 858
 
859 859
 	########### WPML ###########
860
-    if ( function_exists( 'icl_object_id' ) ) {
860
+    if (function_exists('icl_object_id')) {
861 861
 		$lang_code = ICL_LANGUAGE_CODE;
862 862
 
863 863
 		if ($lang_code && $post_types) {
864
-            $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_" . $post_types . "') ";
864
+            $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_".$post_types."') ";
865 865
         }
866 866
     }
867 867
     ########### WPML ###########
@@ -884,10 +884,10 @@  discard block
 block discarded – undo
884 884
     global $wpdb, $geodir_post_type, $table, $curr;
885 885
 
886 886
     $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
887
-    $user_id = !empty($curauth->ID) ? (int)$curauth->ID : 0;
887
+    $user_id = !empty($curauth->ID) ? (int) $curauth->ID : 0;
888 888
 
889 889
     if (isset($_REQUEST['stype'])) {
890
-        $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ",$_REQUEST['stype']);
890
+        $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ", $_REQUEST['stype']);
891 891
     } else {
892 892
         $where = " AND $wpdb->posts.post_type IN ('gd_place') ";
893 893
     }
@@ -900,7 +900,7 @@  discard block
 block discarded – undo
900 900
         } else
901 901
             $where .= " AND $wpdb->posts.post_author = $user_id";
902 902
 
903
-        if ($user_id == (int)get_current_user_id()) {
903
+        if ($user_id == (int) get_current_user_id()) {
904 904
             $where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') ";
905 905
         } else {
906 906
             $where .= " AND $wpdb->posts.post_status = 'publish' ";
@@ -913,7 +913,7 @@  discard block
 block discarded – undo
913 913
     if (function_exists('icl_object_id')) {
914 914
         $lang_code = ICL_LANGUAGE_CODE;
915 915
         if ($lang_code) {
916
-            $where .= " AND icl_t.language_code='" . $lang_code . "' ";
916
+            $where .= " AND icl_t.language_code='".$lang_code."' ";
917 917
         }
918 918
 
919 919
     }
@@ -936,7 +936,7 @@  discard block
 block discarded – undo
936 936
 {
937 937
     global $wp_query, $table;
938 938
     if (!empty($wp_query->query['with_pics_only'])) {
939
-        $join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )";
939
+        $join .= " LEFT JOIN ".GEODIR_ATTACHMENT_TABLE." ON ( ".GEODIR_ATTACHMENT_TABLE.".post_id=".$table.".post_id AND ".GEODIR_ATTACHMENT_TABLE.".mime_type LIKE '%image%' )";
940 940
     }
941 941
     return $join;
942 942
 }
@@ -955,16 +955,16 @@  discard block
 block discarded – undo
955 955
 {
956 956
     global $wp_query, $table;
957 957
     if (!empty($wp_query->query['show_featured_only'])) {
958
-        $where .= " AND " . $table . ".is_featured = '1'";
958
+        $where .= " AND ".$table.".is_featured = '1'";
959 959
     }
960 960
     if (!empty($wp_query->query['show_special_only'])) {
961
-        $where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )";
961
+        $where .= " AND ( ".$table.".geodir_special_offers != '' AND ".$table.".geodir_special_offers IS NOT NULL )";
962 962
     }
963 963
     if (!empty($wp_query->query['with_pics_only'])) {
964
-        $where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL GROUP BY " . $table . ".post_id";
964
+        $where .= " AND ".GEODIR_ATTACHMENT_TABLE.".ID IS NOT NULL GROUP BY ".$table.".post_id";
965 965
     }
966 966
     if (!empty($wp_query->query['with_videos_only'])) {
967
-        $where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )";
967
+        $where .= " AND ( ".$table.".geodir_video != '' AND ".$table.".geodir_video IS NOT NULL )";
968 968
     }
969 969
     return $where;
970 970
 }
@@ -973,18 +973,18 @@  discard block
 block discarded – undo
973 973
 function geodir_related_posts_fields($fields) {
974 974
     global $wp_query, $wpdb, $table, $post;
975 975
 
976
-    $fields .= ", " . $table . ".* ";
976
+    $fields .= ", ".$table.".* ";
977 977
 
978 978
     $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
979 979
 
980 980
     $mylat = $post->post_latitude;
981 981
     $mylon = $post->post_longitude;
982 982
 
983
-    $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance ";
983
+    $fields .= " , (".$DistanceRadius." * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(".$table.".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(".$table.".post_latitude) * pi()/180) *POWER(SIN(($mylon - ".$table.".post_longitude) * pi()/180 / 2), 2) )))as distance ";
984 984
     return $fields;
985 985
 }
986 986
 function geodir_related_posts_fields_filter($query) {
987
-    if ( isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']
987
+    if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']
988 988
         && isset($query->query_vars['order_by']) && $query->query_vars['order_by'] == 'nearest'
989 989
         && isset($query->query_vars['related_listings']) && $query->query_vars['related_listings']
990 990
     ) {
Please login to merge, or discard this patch.
geodirectory-functions/helper_functions.php 2 patches
Indentation   +383 added lines, -383 removed lines patch added patch discarded remove patch
@@ -14,13 +14,13 @@  discard block
 block discarded – undo
14 14
  * @return int|null Return the page ID if present or null if not.
15 15
  */
16 16
 function geodir_add_listing_page_id(){
17
-    $gd_page_id = get_option('geodir_add_listing_page');
17
+	$gd_page_id = get_option('geodir_add_listing_page');
18 18
 
19
-    if (function_exists('icl_object_id')) {
20
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
21
-    }
19
+	if (function_exists('icl_object_id')) {
20
+		$gd_page_id =  icl_object_id($gd_page_id, 'page', true);
21
+	}
22 22
 
23
-    return $gd_page_id;
23
+	return $gd_page_id;
24 24
 }
25 25
 
26 26
 /**
@@ -31,13 +31,13 @@  discard block
 block discarded – undo
31 31
  * @return int|null Return the page ID if present or null if not.
32 32
  */
33 33
 function geodir_preview_page_id(){
34
-    $gd_page_id = get_option('geodir_preview_page');
34
+	$gd_page_id = get_option('geodir_preview_page');
35 35
 
36
-    if (function_exists('icl_object_id')) {
37
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
38
-    }
36
+	if (function_exists('icl_object_id')) {
37
+		$gd_page_id =  icl_object_id($gd_page_id, 'page', true);
38
+	}
39 39
 
40
-    return $gd_page_id;
40
+	return $gd_page_id;
41 41
 }
42 42
 
43 43
 /**
@@ -48,13 +48,13 @@  discard block
 block discarded – undo
48 48
  * @return int|null Return the page ID if present or null if not.
49 49
  */
50 50
 function geodir_success_page_id(){
51
-    $gd_page_id = get_option('geodir_success_page');
51
+	$gd_page_id = get_option('geodir_success_page');
52 52
 
53
-    if (function_exists('icl_object_id')) {
54
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
55
-    }
53
+	if (function_exists('icl_object_id')) {
54
+		$gd_page_id =  icl_object_id($gd_page_id, 'page', true);
55
+	}
56 56
 
57
-    return $gd_page_id;
57
+	return $gd_page_id;
58 58
 }
59 59
 
60 60
 /**
@@ -65,13 +65,13 @@  discard block
 block discarded – undo
65 65
  * @return int|null Return the page ID if present or null if not.
66 66
  */
67 67
 function geodir_location_page_id(){
68
-    $gd_page_id = get_option('geodir_location_page');
68
+	$gd_page_id = get_option('geodir_location_page');
69 69
 
70
-    if (function_exists('icl_object_id')) {
71
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
72
-    }
70
+	if (function_exists('icl_object_id')) {
71
+		$gd_page_id =  icl_object_id($gd_page_id, 'page', true);
72
+	}
73 73
 
74
-    return $gd_page_id;
74
+	return $gd_page_id;
75 75
 }
76 76
 
77 77
 /**
@@ -82,13 +82,13 @@  discard block
 block discarded – undo
82 82
  * @return int|null Return the page ID if present or null if not.
83 83
  */
84 84
 function geodir_home_page_id(){
85
-    $gd_page_id = get_option('geodir_home_page');
85
+	$gd_page_id = get_option('geodir_home_page');
86 86
 
87
-    if (function_exists('icl_object_id')) {
88
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
89
-    }
87
+	if (function_exists('icl_object_id')) {
88
+		$gd_page_id =  icl_object_id($gd_page_id, 'page', true);
89
+	}
90 90
 
91
-    return $gd_page_id;
91
+	return $gd_page_id;
92 92
 }
93 93
 
94 94
 /**
@@ -99,13 +99,13 @@  discard block
 block discarded – undo
99 99
  * @return int|null Return the page ID if present or null if not.
100 100
  */
101 101
 function geodir_info_page_id(){
102
-    $gd_page_id = get_option('geodir_info_page');
102
+	$gd_page_id = get_option('geodir_info_page');
103 103
 
104
-    if (function_exists('icl_object_id')) {
105
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
106
-    }
104
+	if (function_exists('icl_object_id')) {
105
+		$gd_page_id =  icl_object_id($gd_page_id, 'page', true);
106
+	}
107 107
 
108
-    return $gd_page_id;
108
+	return $gd_page_id;
109 109
 }
110 110
 
111 111
 /**
@@ -116,13 +116,13 @@  discard block
 block discarded – undo
116 116
  * @return int|null Return the page ID if present or null if not.
117 117
  */
118 118
 function geodir_login_page_id(){
119
-    $gd_page_id = get_option('geodir_login_page');
119
+	$gd_page_id = get_option('geodir_login_page');
120 120
 
121
-    if (function_exists('icl_object_id')) {
122
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
123
-    }
121
+	if (function_exists('icl_object_id')) {
122
+		$gd_page_id =  icl_object_id($gd_page_id, 'page', true);
123
+	}
124 124
 
125
-    return $gd_page_id;
125
+	return $gd_page_id;
126 126
 }
127 127
 
128 128
 
@@ -134,51 +134,51 @@  discard block
 block discarded – undo
134 134
  * @return int|null Return the page ID if present or null if not.
135 135
  */
136 136
 function geodir_login_url($args=array()){
137
-    $gd_page_id = get_option('geodir_login_page');
138
-
139
-    if (function_exists('icl_object_id')) {
140
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
141
-    }
142
-
143
-    if (function_exists('geodir_location_geo_home_link')) {
144
-        remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
145
-    }
146
-
147
-    if (geodir_is_wpml()){
148
-        $home_url = icl_get_home_url();
149
-    }else{
150
-        $home_url = home_url();
151
-    }
152
-
153
-    if (function_exists('geodir_location_geo_home_link')) {
154
-        add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
155
-    }
156
-
157
-    if($gd_page_id){
158
-        $post = get_post($gd_page_id);
159
-        $slug = $post->post_name;
160
-        //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
161
-        $login_url = trailingslashit($home_url)."$slug/";
162
-    }else{
163
-        $login_url = trailingslashit($home_url)."?geodir_signup=true";
164
-    }
165
-
166
-    if($args){
167
-        $login_url = add_query_arg($args,$login_url );
168
-    }
169
-
170
-    /**
171
-     * Filter the GeoDirectory login page url.
172
-     *
173
-     * This filter can be used to change the GeoDirectory page url.
174
-     *
175
-     * @since 1.5.3
176
-     * @package GeoDirectory
177
-     * @param string $login_url The url of the login page.
178
-     * @param array $args The array of query args used.
179
-     * @param int $gd_page_id The page id of the GD login page.
180
-     */
181
-    return apply_filters('geodir_login_url',$login_url,$args,$gd_page_id);
137
+	$gd_page_id = get_option('geodir_login_page');
138
+
139
+	if (function_exists('icl_object_id')) {
140
+		$gd_page_id =  icl_object_id($gd_page_id, 'page', true);
141
+	}
142
+
143
+	if (function_exists('geodir_location_geo_home_link')) {
144
+		remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
145
+	}
146
+
147
+	if (geodir_is_wpml()){
148
+		$home_url = icl_get_home_url();
149
+	}else{
150
+		$home_url = home_url();
151
+	}
152
+
153
+	if (function_exists('geodir_location_geo_home_link')) {
154
+		add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
155
+	}
156
+
157
+	if($gd_page_id){
158
+		$post = get_post($gd_page_id);
159
+		$slug = $post->post_name;
160
+		//$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
161
+		$login_url = trailingslashit($home_url)."$slug/";
162
+	}else{
163
+		$login_url = trailingslashit($home_url)."?geodir_signup=true";
164
+	}
165
+
166
+	if($args){
167
+		$login_url = add_query_arg($args,$login_url );
168
+	}
169
+
170
+	/**
171
+	 * Filter the GeoDirectory login page url.
172
+	 *
173
+	 * This filter can be used to change the GeoDirectory page url.
174
+	 *
175
+	 * @since 1.5.3
176
+	 * @package GeoDirectory
177
+	 * @param string $login_url The url of the login page.
178
+	 * @param array $args The array of query args used.
179
+	 * @param int $gd_page_id The page id of the GD login page.
180
+	 */
181
+	return apply_filters('geodir_login_url',$login_url,$args,$gd_page_id);
182 182
 }
183 183
 
184 184
 /**
@@ -190,40 +190,40 @@  discard block
 block discarded – undo
190 190
  * @return string Info page url.
191 191
  */
192 192
 function geodir_info_url($args=array()){
193
-    $gd_page_id = get_option('geodir_info_page');
194
-
195
-    if (function_exists('icl_object_id')) {
196
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
197
-    }
198
-
199
-    if (function_exists('geodir_location_geo_home_link')) {
200
-        remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
201
-    }
202
-
203
-    if (geodir_is_wpml()){
204
-        $home_url = icl_get_home_url();
205
-    }else{
206
-        $home_url = home_url();
207
-    }
208
-
209
-    if (function_exists('geodir_location_geo_home_link')) {
210
-        add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
211
-    }
212
-
213
-    if($gd_page_id){
214
-        $post = get_post($gd_page_id);
215
-        $slug = $post->post_name;
216
-        //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
217
-        $info_url = trailingslashit($home_url)."$slug/";
218
-    }else{
219
-        $info_url = trailingslashit($home_url);
220
-    }
221
-
222
-    if($args){
223
-        $info_url = add_query_arg($args,$info_url );
224
-    }
225
-
226
-    return $info_url;
193
+	$gd_page_id = get_option('geodir_info_page');
194
+
195
+	if (function_exists('icl_object_id')) {
196
+		$gd_page_id =  icl_object_id($gd_page_id, 'page', true);
197
+	}
198
+
199
+	if (function_exists('geodir_location_geo_home_link')) {
200
+		remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
201
+	}
202
+
203
+	if (geodir_is_wpml()){
204
+		$home_url = icl_get_home_url();
205
+	}else{
206
+		$home_url = home_url();
207
+	}
208
+
209
+	if (function_exists('geodir_location_geo_home_link')) {
210
+		add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
211
+	}
212
+
213
+	if($gd_page_id){
214
+		$post = get_post($gd_page_id);
215
+		$slug = $post->post_name;
216
+		//$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
217
+		$info_url = trailingslashit($home_url)."$slug/";
218
+	}else{
219
+		$info_url = trailingslashit($home_url);
220
+	}
221
+
222
+	if($args){
223
+		$info_url = add_query_arg($args,$info_url );
224
+	}
225
+
226
+	return $info_url;
227 227
 }
228 228
 
229 229
 /**
@@ -239,11 +239,11 @@  discard block
 block discarded – undo
239 239
  * @return string Returns converted string.
240 240
  */
241 241
 function geodir_ucwords($string, $charset='UTF-8') {
242
-    if (function_exists('mb_convert_case')) {
243
-        return mb_convert_case($string, MB_CASE_TITLE, $charset);
244
-    } else {
245
-        return ucwords($string);
246
-    }
242
+	if (function_exists('mb_convert_case')) {
243
+		return mb_convert_case($string, MB_CASE_TITLE, $charset);
244
+	} else {
245
+		return ucwords($string);
246
+	}
247 247
 }
248 248
 
249 249
 /**
@@ -259,11 +259,11 @@  discard block
 block discarded – undo
259 259
  * @return string Returns converted string.
260 260
  */
261 261
 function geodir_strtolower($string, $charset='UTF-8') {
262
-    if (function_exists('mb_convert_case')) {
263
-        return mb_convert_case($string, MB_CASE_LOWER, $charset);
264
-    } else {
265
-        return strtolower($string);
266
-    }
262
+	if (function_exists('mb_convert_case')) {
263
+		return mb_convert_case($string, MB_CASE_LOWER, $charset);
264
+	} else {
265
+		return strtolower($string);
266
+	}
267 267
 }
268 268
 
269 269
 /**
@@ -279,11 +279,11 @@  discard block
 block discarded – undo
279 279
  * @return string Returns converted string.
280 280
  */
281 281
 function geodir_strtoupper($string, $charset='UTF-8') {
282
-    if (function_exists('mb_convert_case')) {
283
-        return mb_convert_case($string, MB_CASE_UPPER, $charset);
284
-    } else {
285
-        return strtoupper($string);
286
-    }
282
+	if (function_exists('mb_convert_case')) {
283
+		return mb_convert_case($string, MB_CASE_UPPER, $charset);
284
+	} else {
285
+		return strtoupper($string);
286
+	}
287 287
 }
288 288
 
289 289
 /**
@@ -462,11 +462,11 @@  discard block
 block discarded – undo
462 462
  * @package GeoDirectory
463 463
  */
464 464
 function _gd_die_handler() {
465
-    if ( defined( 'GD_TESTING_MODE' ) ) {
466
-        return '_gd_die_handler';
467
-    } else {
468
-        die();
469
-    }
465
+	if ( defined( 'GD_TESTING_MODE' ) ) {
466
+		return '_gd_die_handler';
467
+	} else {
468
+		die();
469
+	}
470 470
 }
471 471
 
472 472
 /**
@@ -481,9 +481,9 @@  discard block
 block discarded – undo
481 481
  * @param int $status     Optional. Status code.
482 482
  */
483 483
 function gd_die( $message = '', $title = '', $status = 400 ) {
484
-    add_filter( 'wp_die_ajax_handler', '_gd_die_handler', 10, 3 );
485
-    add_filter( 'wp_die_handler', '_gd_die_handler', 10, 3 );
486
-    wp_die( $message, $title, array( 'response' => $status ));
484
+	add_filter( 'wp_die_ajax_handler', '_gd_die_handler', 10, 3 );
485
+	add_filter( 'wp_die_handler', '_gd_die_handler', 10, 3 );
486
+	wp_die( $message, $title, array( 'response' => $status ));
487 487
 }
488 488
 
489 489
 /*
@@ -652,37 +652,37 @@  discard block
 block discarded – undo
652 652
  * @return string The formatted date.
653 653
  */
654 654
 function geodir_date($date_input, $date_to, $date_from = '') {
655
-    if (empty($date_input) || empty($date_to)) {
656
-        return NULL;
657
-    }
655
+	if (empty($date_input) || empty($date_to)) {
656
+		return NULL;
657
+	}
658 658
     
659
-    $date = '';
660
-    if (!empty($date_from)) {
661
-        $datetime = date_create_from_format($date_from, $date_input);
659
+	$date = '';
660
+	if (!empty($date_from)) {
661
+		$datetime = date_create_from_format($date_from, $date_input);
662 662
         
663
-        if (!empty($datetime)) {
664
-            $date = $datetime->format($date_to);
665
-        }
666
-    }
663
+		if (!empty($datetime)) {
664
+			$date = $datetime->format($date_to);
665
+		}
666
+	}
667 667
     
668
-    if (empty($date)) {
669
-        $date = strpos($date_input, '/') !== false ? str_replace('/', '-', $date_input) : $date_input;
670
-        $date = date_i18n($date_to, strtotime($date));
671
-    }
668
+	if (empty($date)) {
669
+		$date = strpos($date_input, '/') !== false ? str_replace('/', '-', $date_input) : $date_input;
670
+		$date = date_i18n($date_to, strtotime($date));
671
+	}
672 672
     
673
-    $date = geodir_maybe_untranslate_date($date);
674
-    /**
675
-     * Filter the the date format conversion.
676
-     *
677
-     * @since 1.6.7
678
-     * @package GeoDirectory
679
-     *
680
-     * @param string $date The date string.
681
-     * @param string $date_input The date input.
682
-     * @param string $date_to The destination date format.
683
-     * @param string $date_from The source date format.
684
-     */
685
-    return apply_filters('geodir_date', $date, $date_input, $date_to, $date_from);
673
+	$date = geodir_maybe_untranslate_date($date);
674
+	/**
675
+	 * Filter the the date format conversion.
676
+	 *
677
+	 * @since 1.6.7
678
+	 * @package GeoDirectory
679
+	 *
680
+	 * @param string $date The date string.
681
+	 * @param string $date_input The date input.
682
+	 * @param string $date_to The destination date format.
683
+	 * @param string $date_from The source date format.
684
+	 */
685
+	return apply_filters('geodir_date', $date, $date_input, $date_to, $date_from);
686 686
 }
687 687
 
688 688
 /**
@@ -707,91 +707,91 @@  discard block
 block discarded – undo
707 707
  * @return string Trimmed string.
708 708
  */
709 709
 function geodir_excerpt($text, $length = 100, $options = array()) {
710
-    if (!(int)$length > 0) {
711
-        return $text;
712
-    }
713
-    $default = array(
714
-        'ellipsis' => '', 'exact' => true, 'html' => true, 'trimWidth' => false,
710
+	if (!(int)$length > 0) {
711
+		return $text;
712
+	}
713
+	$default = array(
714
+		'ellipsis' => '', 'exact' => true, 'html' => true, 'trimWidth' => false,
715 715
 	);
716
-    if (!empty($options['html']) && function_exists('mb_internal_encoding') && strtolower(mb_internal_encoding()) === 'utf-8') {
717
-        $default['ellipsis'] = "";
718
-    }
719
-    $options += $default;
720
-
721
-    $prefix = '';
722
-    $suffix = $options['ellipsis'];
723
-
724
-    if ($options['html']) {
725
-        $ellipsisLength = geodir_strlen(strip_tags($options['ellipsis']), $options);
726
-
727
-        $truncateLength = 0;
728
-        $totalLength = 0;
729
-        $openTags = array();
730
-        $truncate = '';
731
-
732
-        preg_match_all('/(<\/?([\w+]+)[^>]*>)?([^<>]*)/', $text, $tags, PREG_SET_ORDER);
733
-        foreach ($tags as $tag) {
734
-            $contentLength = geodir_strlen($tag[3], $options);
735
-
736
-            if ($truncate === '') {
737
-                if (!preg_match('/img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param/i', $tag[2])) {
738
-                    if (preg_match('/<[\w]+[^>]*>/', $tag[0])) {
739
-                        array_unshift($openTags, $tag[2]);
740
-                    } elseif (preg_match('/<\/([\w]+)[^>]*>/', $tag[0], $closeTag)) {
741
-                        $pos = array_search($closeTag[1], $openTags);
742
-                        if ($pos !== false) {
743
-                            array_splice($openTags, $pos, 1);
744
-                        }
745
-                    }
746
-                }
747
-
748
-                $prefix .= $tag[1];
749
-
750
-                if ($totalLength + $contentLength + $ellipsisLength > $length) {
751
-                    $truncate = $tag[3];
752
-                    $truncateLength = $length - $totalLength;
753
-                } else {
754
-                    $prefix .= $tag[3];
755
-                }
756
-            }
757
-
758
-            $totalLength += $contentLength;
759
-            if ($totalLength > $length) {
760
-                break;
761
-            }
762
-        }
763
-
764
-        if ($totalLength <= $length) {
765
-            return $text;
766
-        }
767
-
768
-        $text = $truncate;
769
-        $length = $truncateLength;
770
-
771
-        foreach ($openTags as $tag) {
772
-            $suffix .= '</' . $tag . '>';
773
-        }
774
-    } else {
775
-        if (geodir_strlen($text, $options) <= $length) {
776
-            return $text;
777
-        }
778
-        $ellipsisLength = geodir_strlen($options['ellipsis'], $options);
779
-    }
780
-
781
-    $result = geodir_substr($text, 0, $length - $ellipsisLength, $options);
782
-
783
-    if (!$options['exact']) {
784
-        if (geodir_substr($text, $length - $ellipsisLength, 1, $options) !== ' ') {
785
-            $result = geodir_remove_last_word($result);
786
-        }
787
-
788
-        // Do not need to count ellipsis in the cut, if result is empty.
789
-        if (!strlen($result)) {
790
-            $result = geodir_substr($text, 0, $length, $options);
791
-        }
792
-    }
793
-
794
-    return $prefix . $result . $suffix;
716
+	if (!empty($options['html']) && function_exists('mb_internal_encoding') && strtolower(mb_internal_encoding()) === 'utf-8') {
717
+		$default['ellipsis'] = "";
718
+	}
719
+	$options += $default;
720
+
721
+	$prefix = '';
722
+	$suffix = $options['ellipsis'];
723
+
724
+	if ($options['html']) {
725
+		$ellipsisLength = geodir_strlen(strip_tags($options['ellipsis']), $options);
726
+
727
+		$truncateLength = 0;
728
+		$totalLength = 0;
729
+		$openTags = array();
730
+		$truncate = '';
731
+
732
+		preg_match_all('/(<\/?([\w+]+)[^>]*>)?([^<>]*)/', $text, $tags, PREG_SET_ORDER);
733
+		foreach ($tags as $tag) {
734
+			$contentLength = geodir_strlen($tag[3], $options);
735
+
736
+			if ($truncate === '') {
737
+				if (!preg_match('/img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param/i', $tag[2])) {
738
+					if (preg_match('/<[\w]+[^>]*>/', $tag[0])) {
739
+						array_unshift($openTags, $tag[2]);
740
+					} elseif (preg_match('/<\/([\w]+)[^>]*>/', $tag[0], $closeTag)) {
741
+						$pos = array_search($closeTag[1], $openTags);
742
+						if ($pos !== false) {
743
+							array_splice($openTags, $pos, 1);
744
+						}
745
+					}
746
+				}
747
+
748
+				$prefix .= $tag[1];
749
+
750
+				if ($totalLength + $contentLength + $ellipsisLength > $length) {
751
+					$truncate = $tag[3];
752
+					$truncateLength = $length - $totalLength;
753
+				} else {
754
+					$prefix .= $tag[3];
755
+				}
756
+			}
757
+
758
+			$totalLength += $contentLength;
759
+			if ($totalLength > $length) {
760
+				break;
761
+			}
762
+		}
763
+
764
+		if ($totalLength <= $length) {
765
+			return $text;
766
+		}
767
+
768
+		$text = $truncate;
769
+		$length = $truncateLength;
770
+
771
+		foreach ($openTags as $tag) {
772
+			$suffix .= '</' . $tag . '>';
773
+		}
774
+	} else {
775
+		if (geodir_strlen($text, $options) <= $length) {
776
+			return $text;
777
+		}
778
+		$ellipsisLength = geodir_strlen($options['ellipsis'], $options);
779
+	}
780
+
781
+	$result = geodir_substr($text, 0, $length - $ellipsisLength, $options);
782
+
783
+	if (!$options['exact']) {
784
+		if (geodir_substr($text, $length - $ellipsisLength, 1, $options) !== ' ') {
785
+			$result = geodir_remove_last_word($result);
786
+		}
787
+
788
+		// Do not need to count ellipsis in the cut, if result is empty.
789
+		if (!strlen($result)) {
790
+			$result = geodir_substr($text, 0, $length, $options);
791
+		}
792
+	}
793
+
794
+	return $prefix . $result . $suffix;
795 795
 }
796 796
 
797 797
 /**
@@ -815,28 +815,28 @@  discard block
 block discarded – undo
815 815
  * @return int
816 816
  */
817 817
 function geodir_strlen($text, array $options) {
818
-    if (empty($options['trimWidth'])) {
819
-        $strlen = 'geodir_utf8_strlen';
820
-    } else {
821
-        $strlen = 'geodir_utf8_strwidth';
822
-    }
823
-
824
-    if (empty($options['html'])) {
825
-        return $strlen($text);
826
-    }
827
-
828
-    $pattern = '/&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};/i';
829
-    $replace = preg_replace_callback(
830
-        $pattern,
831
-        function ($match) use ($strlen) {
832
-            $utf8 = html_entity_decode($match[0], ENT_HTML5 | ENT_QUOTES, 'UTF-8');
833
-
834
-            return str_repeat(' ', $strlen($utf8, 'UTF-8'));
835
-        },
836
-        $text
837
-    );
838
-
839
-    return $strlen($replace);
818
+	if (empty($options['trimWidth'])) {
819
+		$strlen = 'geodir_utf8_strlen';
820
+	} else {
821
+		$strlen = 'geodir_utf8_strwidth';
822
+	}
823
+
824
+	if (empty($options['html'])) {
825
+		return $strlen($text);
826
+	}
827
+
828
+	$pattern = '/&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};/i';
829
+	$replace = preg_replace_callback(
830
+		$pattern,
831
+		function ($match) use ($strlen) {
832
+			$utf8 = html_entity_decode($match[0], ENT_HTML5 | ENT_QUOTES, 'UTF-8');
833
+
834
+			return str_repeat(' ', $strlen($utf8, 'UTF-8'));
835
+		},
836
+		$text
837
+	);
838
+
839
+	return $strlen($replace);
840 840
 }
841 841
 
842 842
 /**
@@ -857,80 +857,80 @@  discard block
 block discarded – undo
857 857
  * @return string
858 858
  */
859 859
 function geodir_substr($text, $start, $length, array $options) {
860
-    if (empty($options['trimWidth'])) {
861
-        $substr = 'geodir_utf8_substr';
862
-    } else {
863
-        $substr = 'geodir_utf8_strimwidth';
864
-    }
865
-
866
-    $maxPosition = geodir_strlen($text, array('trimWidth' => false) + $options);
867
-    if ($start < 0) {
868
-        $start += $maxPosition;
869
-        if ($start < 0) {
870
-            $start = 0;
871
-        }
872
-    }
873
-    if ($start >= $maxPosition) {
874
-        return '';
875
-    }
876
-
877
-    if ($length === null) {
878
-        $length = geodir_strlen($text, $options);
879
-    }
880
-
881
-    if ($length < 0) {
882
-        $text = geodir_substr($text, $start, null, $options);
883
-        $start = 0;
884
-        $length += geodir_strlen($text, $options);
885
-    }
886
-
887
-    if ($length <= 0) {
888
-        return '';
889
-    }
890
-
891
-    if (empty($options['html'])) {
892
-        return (string)$substr($text, $start, $length);
893
-    }
894
-
895
-    $totalOffset = 0;
896
-    $totalLength = 0;
897
-    $result = '';
898
-
899
-    $pattern = '/(&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};)/i';
900
-    $parts = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
901
-    foreach ($parts as $part) {
902
-        $offset = 0;
903
-
904
-        if ($totalOffset < $start) {
905
-            $len = geodir_strlen($part, array('trimWidth' => false) + $options);
906
-            if ($totalOffset + $len <= $start) {
907
-                $totalOffset += $len;
908
-                continue;
909
-            }
910
-
911
-            $offset = $start - $totalOffset;
912
-            $totalOffset = $start;
913
-        }
914
-
915
-        $len = geodir_strlen($part, $options);
916
-        if ($offset !== 0 || $totalLength + $len > $length) {
917
-            if (strpos($part, '&') === 0 && preg_match($pattern, $part) && $part !== html_entity_decode($part, ENT_HTML5 | ENT_QUOTES, 'UTF-8') ) {
918
-                // Entities cannot be passed substr.
919
-                continue;
920
-            }
921
-
922
-            $part = $substr($part, $offset, $length - $totalLength);
923
-            $len = geodir_strlen($part, $options);
924
-        }
925
-
926
-        $result .= $part;
927
-        $totalLength += $len;
928
-        if ($totalLength >= $length) {
929
-            break;
930
-        }
931
-    }
932
-
933
-    return $result;
860
+	if (empty($options['trimWidth'])) {
861
+		$substr = 'geodir_utf8_substr';
862
+	} else {
863
+		$substr = 'geodir_utf8_strimwidth';
864
+	}
865
+
866
+	$maxPosition = geodir_strlen($text, array('trimWidth' => false) + $options);
867
+	if ($start < 0) {
868
+		$start += $maxPosition;
869
+		if ($start < 0) {
870
+			$start = 0;
871
+		}
872
+	}
873
+	if ($start >= $maxPosition) {
874
+		return '';
875
+	}
876
+
877
+	if ($length === null) {
878
+		$length = geodir_strlen($text, $options);
879
+	}
880
+
881
+	if ($length < 0) {
882
+		$text = geodir_substr($text, $start, null, $options);
883
+		$start = 0;
884
+		$length += geodir_strlen($text, $options);
885
+	}
886
+
887
+	if ($length <= 0) {
888
+		return '';
889
+	}
890
+
891
+	if (empty($options['html'])) {
892
+		return (string)$substr($text, $start, $length);
893
+	}
894
+
895
+	$totalOffset = 0;
896
+	$totalLength = 0;
897
+	$result = '';
898
+
899
+	$pattern = '/(&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};)/i';
900
+	$parts = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
901
+	foreach ($parts as $part) {
902
+		$offset = 0;
903
+
904
+		if ($totalOffset < $start) {
905
+			$len = geodir_strlen($part, array('trimWidth' => false) + $options);
906
+			if ($totalOffset + $len <= $start) {
907
+				$totalOffset += $len;
908
+				continue;
909
+			}
910
+
911
+			$offset = $start - $totalOffset;
912
+			$totalOffset = $start;
913
+		}
914
+
915
+		$len = geodir_strlen($part, $options);
916
+		if ($offset !== 0 || $totalLength + $len > $length) {
917
+			if (strpos($part, '&') === 0 && preg_match($pattern, $part) && $part !== html_entity_decode($part, ENT_HTML5 | ENT_QUOTES, 'UTF-8') ) {
918
+				// Entities cannot be passed substr.
919
+				continue;
920
+			}
921
+
922
+			$part = $substr($part, $offset, $length - $totalLength);
923
+			$len = geodir_strlen($part, $options);
924
+		}
925
+
926
+		$result .= $part;
927
+		$totalLength += $len;
928
+		if ($totalLength >= $length) {
929
+			break;
930
+		}
931
+	}
932
+
933
+	return $result;
934 934
 }
935 935
 
936 936
 /**
@@ -943,21 +943,21 @@  discard block
 block discarded – undo
943 943
  * @return string
944 944
  */
945 945
 function geodir_remove_last_word($text) {
946
-    $spacepos = geodir_utf8_strrpos($text, ' ');
946
+	$spacepos = geodir_utf8_strrpos($text, ' ');
947 947
 
948
-    if ($spacepos !== false) {
949
-        $lastWord = geodir_utf8_strrpos($text, $spacepos);
948
+	if ($spacepos !== false) {
949
+		$lastWord = geodir_utf8_strrpos($text, $spacepos);
950 950
 
951
-        // Some languages are written without word separation.
952
-        // We recognize a string as a word if it does not contain any full-width characters.
953
-        if (geodir_utf8_strwidth($lastWord) === geodir_utf8_strlen($lastWord)) {
954
-            $text = geodir_utf8_substr($text, 0, $spacepos);
955
-        }
951
+		// Some languages are written without word separation.
952
+		// We recognize a string as a word if it does not contain any full-width characters.
953
+		if (geodir_utf8_strwidth($lastWord) === geodir_utf8_strlen($lastWord)) {
954
+			$text = geodir_utf8_substr($text, 0, $spacepos);
955
+		}
956 956
 
957
-        return $text;
958
-    }
957
+		return $text;
958
+	}
959 959
 
960
-    return '';
960
+	return '';
961 961
 }
962 962
 
963 963
 function geodir_tool_restore_cpt_from_taxonomies(){
@@ -1075,11 +1075,11 @@  discard block
 block discarded – undo
1075 1075
  * @return string
1076 1076
  */
1077 1077
 function geodir_utf8_strimwidth( $str, $start, $width, $trimmaker = '', $encoding = 'UTF-8' ) {
1078
-    if ( function_exists( 'mb_strimwidth' ) ) {
1079
-        return mb_strimwidth( $str, $start, $width, $trimmaker, $encoding );
1080
-    }
1078
+	if ( function_exists( 'mb_strimwidth' ) ) {
1079
+		return mb_strimwidth( $str, $start, $width, $trimmaker, $encoding );
1080
+	}
1081 1081
     
1082
-    return geodir_utf8_substr( $str, $start, $width, $encoding ) . $trimmaker;
1082
+	return geodir_utf8_substr( $str, $start, $width, $encoding ) . $trimmaker;
1083 1083
 }
1084 1084
 
1085 1085
 /**
@@ -1093,11 +1093,11 @@  discard block
 block discarded – undo
1093 1093
  * @return int Returns the number of characters in string.
1094 1094
  */
1095 1095
 function geodir_utf8_strlen( $str, $encoding = 'UTF-8' ) {
1096
-    if ( function_exists( 'mb_strlen' ) ) {
1097
-        return mb_strlen( $str, $encoding );
1098
-    }
1096
+	if ( function_exists( 'mb_strlen' ) ) {
1097
+		return mb_strlen( $str, $encoding );
1098
+	}
1099 1099
         
1100
-    return strlen( $str );
1100
+	return strlen( $str );
1101 1101
 }
1102 1102
 
1103 1103
 /**
@@ -1113,11 +1113,11 @@  discard block
 block discarded – undo
1113 1113
  * @return int Returns the position of the first occurrence of search in the string.
1114 1114
  */
1115 1115
 function geodir_utf8_strpos( $str, $find, $offset = 0, $encoding = 'UTF-8' ) {
1116
-    if ( function_exists( 'mb_strpos' ) ) {
1117
-        return mb_strpos( $str, $find, $offset, $encoding );
1118
-    }
1116
+	if ( function_exists( 'mb_strpos' ) ) {
1117
+		return mb_strpos( $str, $find, $offset, $encoding );
1118
+	}
1119 1119
         
1120
-    return strpos( $str, $find, $offset );
1120
+	return strpos( $str, $find, $offset );
1121 1121
 }
1122 1122
 
1123 1123
 /**
@@ -1133,11 +1133,11 @@  discard block
 block discarded – undo
1133 1133
  * @return int Returns the position of the last occurrence of search.
1134 1134
  */
1135 1135
 function geodir_utf8_strrpos( $str, $find, $offset = 0, $encoding = 'UTF-8' ) {
1136
-    if ( function_exists( 'mb_strrpos' ) ) {
1137
-        return mb_strrpos( $str, $find, $offset, $encoding );
1138
-    }
1136
+	if ( function_exists( 'mb_strrpos' ) ) {
1137
+		return mb_strrpos( $str, $find, $offset, $encoding );
1138
+	}
1139 1139
         
1140
-    return strrpos( $str, $find, $offset );
1140
+	return strrpos( $str, $find, $offset );
1141 1141
 }
1142 1142
 
1143 1143
 /**
@@ -1154,15 +1154,15 @@  discard block
 block discarded – undo
1154 1154
  * @return string
1155 1155
  */
1156 1156
 function geodir_utf8_substr( $str, $start, $length = null, $encoding = 'UTF-8' ) {
1157
-    if ( function_exists( 'mb_substr' ) ) {
1158
-        if ( $length === null ) {
1159
-            return mb_substr( $str, $start, geodir_utf8_strlen( $str, $encoding ), $encoding );
1160
-        } else {
1161
-            return mb_substr( $str, $start, $length, $encoding );
1162
-        }
1163
-    }
1157
+	if ( function_exists( 'mb_substr' ) ) {
1158
+		if ( $length === null ) {
1159
+			return mb_substr( $str, $start, geodir_utf8_strlen( $str, $encoding ), $encoding );
1160
+		} else {
1161
+			return mb_substr( $str, $start, $length, $encoding );
1162
+		}
1163
+	}
1164 1164
         
1165
-    return substr( $str, $start, $length );
1165
+	return substr( $str, $start, $length );
1166 1166
 }
1167 1167
 
1168 1168
 /**
@@ -1176,11 +1176,11 @@  discard block
 block discarded – undo
1176 1176
  * @return string The width of string.
1177 1177
  */
1178 1178
 function geodir_utf8_strwidth( $str, $encoding = 'UTF-8' ) {
1179
-    if ( function_exists( 'mb_strwidth' ) ) {
1180
-        return mb_strwidth( $str, $encoding );
1181
-    }
1179
+	if ( function_exists( 'mb_strwidth' ) ) {
1180
+		return mb_strwidth( $str, $encoding );
1181
+	}
1182 1182
     
1183
-    return geodir_utf8_strlen( $str, $encoding );
1183
+	return geodir_utf8_strlen( $str, $encoding );
1184 1184
 =======
1185 1185
 
1186 1186
 function geodir_total_listings_count($post_type = false)
Please login to merge, or discard this patch.
Spacing   +116 added lines, -116 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@  discard block
 block discarded – undo
13 13
  * @since 1.4.6
14 14
  * @return int|null Return the page ID if present or null if not.
15 15
  */
16
-function geodir_add_listing_page_id(){
16
+function geodir_add_listing_page_id() {
17 17
     $gd_page_id = get_option('geodir_add_listing_page');
18 18
 
19 19
     if (function_exists('icl_object_id')) {
20
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
20
+        $gd_page_id = icl_object_id($gd_page_id, 'page', true);
21 21
     }
22 22
 
23 23
     return $gd_page_id;
@@ -30,11 +30,11 @@  discard block
 block discarded – undo
30 30
  * @since 1.4.6
31 31
  * @return int|null Return the page ID if present or null if not.
32 32
  */
33
-function geodir_preview_page_id(){
33
+function geodir_preview_page_id() {
34 34
     $gd_page_id = get_option('geodir_preview_page');
35 35
 
36 36
     if (function_exists('icl_object_id')) {
37
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
37
+        $gd_page_id = icl_object_id($gd_page_id, 'page', true);
38 38
     }
39 39
 
40 40
     return $gd_page_id;
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
47 47
  * @since 1.4.6
48 48
  * @return int|null Return the page ID if present or null if not.
49 49
  */
50
-function geodir_success_page_id(){
50
+function geodir_success_page_id() {
51 51
     $gd_page_id = get_option('geodir_success_page');
52 52
 
53 53
     if (function_exists('icl_object_id')) {
54
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
54
+        $gd_page_id = icl_object_id($gd_page_id, 'page', true);
55 55
     }
56 56
 
57 57
     return $gd_page_id;
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
  * @since 1.4.6
65 65
  * @return int|null Return the page ID if present or null if not.
66 66
  */
67
-function geodir_location_page_id(){
67
+function geodir_location_page_id() {
68 68
     $gd_page_id = get_option('geodir_location_page');
69 69
 
70 70
     if (function_exists('icl_object_id')) {
71
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
71
+        $gd_page_id = icl_object_id($gd_page_id, 'page', true);
72 72
     }
73 73
 
74 74
     return $gd_page_id;
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
  * @since 1.5.4
82 82
  * @return int|null Return the page ID if present or null if not.
83 83
  */
84
-function geodir_home_page_id(){
84
+function geodir_home_page_id() {
85 85
     $gd_page_id = get_option('geodir_home_page');
86 86
 
87 87
     if (function_exists('icl_object_id')) {
88
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
88
+        $gd_page_id = icl_object_id($gd_page_id, 'page', true);
89 89
     }
90 90
 
91 91
     return $gd_page_id;
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
  * @since 1.5.3
99 99
  * @return int|null Return the page ID if present or null if not.
100 100
  */
101
-function geodir_info_page_id(){
101
+function geodir_info_page_id() {
102 102
     $gd_page_id = get_option('geodir_info_page');
103 103
 
104 104
     if (function_exists('icl_object_id')) {
105
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
105
+        $gd_page_id = icl_object_id($gd_page_id, 'page', true);
106 106
     }
107 107
 
108 108
     return $gd_page_id;
@@ -115,11 +115,11 @@  discard block
 block discarded – undo
115 115
  * @since 1.5.3
116 116
  * @return int|null Return the page ID if present or null if not.
117 117
  */
118
-function geodir_login_page_id(){
118
+function geodir_login_page_id() {
119 119
     $gd_page_id = get_option('geodir_login_page');
120 120
 
121 121
     if (function_exists('icl_object_id')) {
122
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
122
+        $gd_page_id = icl_object_id($gd_page_id, 'page', true);
123 123
     }
124 124
 
125 125
     return $gd_page_id;
@@ -133,20 +133,20 @@  discard block
 block discarded – undo
133 133
  * @since 1.5.3
134 134
  * @return int|null Return the page ID if present or null if not.
135 135
  */
136
-function geodir_login_url($args=array()){
136
+function geodir_login_url($args = array()) {
137 137
     $gd_page_id = get_option('geodir_login_page');
138 138
 
139 139
     if (function_exists('icl_object_id')) {
140
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
140
+        $gd_page_id = icl_object_id($gd_page_id, 'page', true);
141 141
     }
142 142
 
143 143
     if (function_exists('geodir_location_geo_home_link')) {
144 144
         remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
145 145
     }
146 146
 
147
-    if (geodir_is_wpml()){
147
+    if (geodir_is_wpml()) {
148 148
         $home_url = icl_get_home_url();
149
-    }else{
149
+    } else {
150 150
         $home_url = home_url();
151 151
     }
152 152
 
@@ -154,17 +154,17 @@  discard block
 block discarded – undo
154 154
         add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
155 155
     }
156 156
 
157
-    if($gd_page_id){
157
+    if ($gd_page_id) {
158 158
         $post = get_post($gd_page_id);
159 159
         $slug = $post->post_name;
160 160
         //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
161 161
         $login_url = trailingslashit($home_url)."$slug/";
162
-    }else{
162
+    } else {
163 163
         $login_url = trailingslashit($home_url)."?geodir_signup=true";
164 164
     }
165 165
 
166
-    if($args){
167
-        $login_url = add_query_arg($args,$login_url );
166
+    if ($args) {
167
+        $login_url = add_query_arg($args, $login_url);
168 168
     }
169 169
 
170 170
     /**
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
      * @param array $args The array of query args used.
179 179
      * @param int $gd_page_id The page id of the GD login page.
180 180
      */
181
-    return apply_filters('geodir_login_url',$login_url,$args,$gd_page_id);
181
+    return apply_filters('geodir_login_url', $login_url, $args, $gd_page_id);
182 182
 }
183 183
 
184 184
 /**
@@ -189,20 +189,20 @@  discard block
 block discarded – undo
189 189
  * @since 1.5.16 Added WPML lang code to url.
190 190
  * @return string Info page url.
191 191
  */
192
-function geodir_info_url($args=array()){
192
+function geodir_info_url($args = array()) {
193 193
     $gd_page_id = get_option('geodir_info_page');
194 194
 
195 195
     if (function_exists('icl_object_id')) {
196
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
196
+        $gd_page_id = icl_object_id($gd_page_id, 'page', true);
197 197
     }
198 198
 
199 199
     if (function_exists('geodir_location_geo_home_link')) {
200 200
         remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
201 201
     }
202 202
 
203
-    if (geodir_is_wpml()){
203
+    if (geodir_is_wpml()) {
204 204
         $home_url = icl_get_home_url();
205
-    }else{
205
+    } else {
206 206
         $home_url = home_url();
207 207
     }
208 208
 
@@ -210,17 +210,17 @@  discard block
 block discarded – undo
210 210
         add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
211 211
     }
212 212
 
213
-    if($gd_page_id){
213
+    if ($gd_page_id) {
214 214
         $post = get_post($gd_page_id);
215 215
         $slug = $post->post_name;
216 216
         //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
217 217
         $info_url = trailingslashit($home_url)."$slug/";
218
-    }else{
218
+    } else {
219 219
         $info_url = trailingslashit($home_url);
220 220
     }
221 221
 
222
-    if($args){
223
-        $info_url = add_query_arg($args,$info_url );
222
+    if ($args) {
223
+        $info_url = add_query_arg($args, $info_url);
224 224
     }
225 225
 
226 226
     return $info_url;
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
  * @param string $charset Character set to use for conversion.
239 239
  * @return string Returns converted string.
240 240
  */
241
-function geodir_ucwords($string, $charset='UTF-8') {
241
+function geodir_ucwords($string, $charset = 'UTF-8') {
242 242
     if (function_exists('mb_convert_case')) {
243 243
         return mb_convert_case($string, MB_CASE_TITLE, $charset);
244 244
     } else {
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
  * @param string $charset Character set to use for conversion.
259 259
  * @return string Returns converted string.
260 260
  */
261
-function geodir_strtolower($string, $charset='UTF-8') {
261
+function geodir_strtolower($string, $charset = 'UTF-8') {
262 262
     if (function_exists('mb_convert_case')) {
263 263
         return mb_convert_case($string, MB_CASE_LOWER, $charset);
264 264
     } else {
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
  * @param string $charset Character set to use for conversion.
279 279
  * @return string Returns converted string.
280 280
  */
281
-function geodir_strtoupper($string, $charset='UTF-8') {
281
+function geodir_strtoupper($string, $charset = 'UTF-8') {
282 282
     if (function_exists('mb_convert_case')) {
283 283
         return mb_convert_case($string, MB_CASE_UPPER, $charset);
284 284
     } else {
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 	
310 310
 	$url = trim($parts[0]);
311 311
 	if ($formatted && $url != '') {
312
-		$url = str_replace( ' ', '%20', $url );
312
+		$url = str_replace(' ', '%20', $url);
313 313
 		$url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\[\]\\x80-\\xff]|i', '', $url);
314 314
 		
315 315
 		if (0 !== stripos($url, 'mailto:')) {
@@ -319,8 +319,8 @@  discard block
 block discarded – undo
319 319
 		
320 320
 		$url = str_replace(';//', '://', $url);
321 321
 		
322
-		if (strpos($url, ':') === false && ! in_array($url[0], array('/', '#', '?')) && !preg_match('/^[a-z0-9-]+?\.php/i', $url)) {
323
-			$url = 'http://' . $url;
322
+		if (strpos($url, ':') === false && !in_array($url[0], array('/', '#', '?')) && !preg_match('/^[a-z0-9-]+?\.php/i', $url)) {
323
+			$url = 'http://'.$url;
324 324
 		}
325 325
 		
326 326
 		$url = wp_kses_normalize_entities($url);
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
  * @package GeoDirectory
463 463
  */
464 464
 function _gd_die_handler() {
465
-    if ( defined( 'GD_TESTING_MODE' ) ) {
465
+    if (defined('GD_TESTING_MODE')) {
466 466
         return '_gd_die_handler';
467 467
     } else {
468 468
         die();
@@ -480,10 +480,10 @@  discard block
 block discarded – undo
480 480
  * @param string $title   Optional. Error title.
481 481
  * @param int $status     Optional. Status code.
482 482
  */
483
-function gd_die( $message = '', $title = '', $status = 400 ) {
484
-    add_filter( 'wp_die_ajax_handler', '_gd_die_handler', 10, 3 );
485
-    add_filter( 'wp_die_handler', '_gd_die_handler', 10, 3 );
486
-    wp_die( $message, $title, array( 'response' => $status ));
483
+function gd_die($message = '', $title = '', $status = 400) {
484
+    add_filter('wp_die_ajax_handler', '_gd_die_handler', 10, 3);
485
+    add_filter('wp_die_handler', '_gd_die_handler', 10, 3);
486
+    wp_die($message, $title, array('response' => $status));
487 487
 }
488 488
 
489 489
 /*
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
  * @param string $php_format The PHP date format.
494 494
  * @return string The jQuery format date string.
495 495
  */
496
-function geodir_date_format_php_to_jqueryui( $php_format ) {
496
+function geodir_date_format_php_to_jqueryui($php_format) {
497 497
 	$symbols = array(
498 498
 		// Day
499 499
 		'd' => 'dd',
@@ -533,27 +533,27 @@  discard block
 block discarded – undo
533 533
 	$jqueryui_format = "";
534 534
 	$escaping = false;
535 535
 
536
-	for ( $i = 0; $i < strlen( $php_format ); $i++ ) {
536
+	for ($i = 0; $i < strlen($php_format); $i++) {
537 537
 		$char = $php_format[$i];
538 538
 
539 539
 		// PHP date format escaping character
540
-		if ( $char === '\\' ) {
540
+		if ($char === '\\') {
541 541
 			$i++;
542 542
 
543
-			if ( $escaping ) {
543
+			if ($escaping) {
544 544
 				$jqueryui_format .= $php_format[$i];
545 545
 			} else {
546
-				$jqueryui_format .= '\'' . $php_format[$i];
546
+				$jqueryui_format .= '\''.$php_format[$i];
547 547
 			}
548 548
 
549 549
 			$escaping = true;
550 550
 		} else {
551
-			if ( $escaping ) {
551
+			if ($escaping) {
552 552
 				$jqueryui_format .= "'";
553 553
 				$escaping = false;
554 554
 			}
555 555
 
556
-			if ( isset( $symbols[$char] ) ) {
556
+			if (isset($symbols[$char])) {
557 557
 				$jqueryui_format .= $symbols[$char];
558 558
 			} else {
559 559
 				$jqueryui_format .= $char;
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
  * @return string The untranslated date string.
573 573
  * @since 1.6.5
574 574
  */
575
-function geodir_maybe_untranslate_date($date){
575
+function geodir_maybe_untranslate_date($date) {
576 576
 	$english_long_months = array(
577 577
 		'January',
578 578
 		'February',
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
 		'December',
589 589
 	);
590 590
 
591
-	$non_english_long_months  = array(
591
+	$non_english_long_months = array(
592 592
 		__('January'),
593 593
 		__('February'),
594 594
 		__('March'),
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
 		__('November'),
603 603
 		__('December'),
604 604
 	);
605
-	$date = str_replace($non_english_long_months,$english_long_months,$date);
605
+	$date = str_replace($non_english_long_months, $english_long_months, $date);
606 606
 
607 607
 
608 608
 	$english_short_months = array(
@@ -621,21 +621,21 @@  discard block
 block discarded – undo
621 621
 	);
622 622
 
623 623
 	$non_english_short_months = array(
624
-		' '._x( 'Jan', 'January abbreviation' ).' ',
625
-		' '._x( 'Feb', 'February abbreviation' ).' ',
626
-		' '._x( 'Mar', 'March abbreviation' ).' ',
627
-		' '._x( 'Apr', 'April abbreviation' ).' ',
628
-		' '._x( 'May', 'May abbreviation' ).' ',
629
-		' '._x( 'Jun', 'June abbreviation' ).' ',
630
-		' '._x( 'Jul', 'July abbreviation' ).' ',
631
-		' '._x( 'Aug', 'August abbreviation' ).' ',
632
-		' '._x( 'Sep', 'September abbreviation' ).' ',
633
-		' '._x( 'Oct', 'October abbreviation' ).' ',
634
-		' '._x( 'Nov', 'November abbreviation' ).' ',
635
-		' '._x( 'Dec', 'December abbreviation' ).' ',
624
+		' '._x('Jan', 'January abbreviation').' ',
625
+		' '._x('Feb', 'February abbreviation').' ',
626
+		' '._x('Mar', 'March abbreviation').' ',
627
+		' '._x('Apr', 'April abbreviation').' ',
628
+		' '._x('May', 'May abbreviation').' ',
629
+		' '._x('Jun', 'June abbreviation').' ',
630
+		' '._x('Jul', 'July abbreviation').' ',
631
+		' '._x('Aug', 'August abbreviation').' ',
632
+		' '._x('Sep', 'September abbreviation').' ',
633
+		' '._x('Oct', 'October abbreviation').' ',
634
+		' '._x('Nov', 'November abbreviation').' ',
635
+		' '._x('Dec', 'December abbreviation').' ',
636 636
 	);
637 637
 
638
-	$date = str_replace($non_english_short_months,$english_short_months,$date);
638
+	$date = str_replace($non_english_short_months, $english_short_months, $date);
639 639
 
640 640
 
641 641
 	return $date;
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
  * @return string Trimmed string.
708 708
  */
709 709
 function geodir_excerpt($text, $length = 100, $options = array()) {
710
-    if (!(int)$length > 0) {
710
+    if (!(int) $length > 0) {
711 711
         return $text;
712 712
     }
713 713
     $default = array(
@@ -769,7 +769,7 @@  discard block
 block discarded – undo
769 769
         $length = $truncateLength;
770 770
 
771 771
         foreach ($openTags as $tag) {
772
-            $suffix .= '</' . $tag . '>';
772
+            $suffix .= '</'.$tag.'>';
773 773
         }
774 774
     } else {
775 775
         if (geodir_strlen($text, $options) <= $length) {
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
         }
792 792
     }
793 793
 
794
-    return $prefix . $result . $suffix;
794
+    return $prefix.$result.$suffix;
795 795
 }
796 796
 
797 797
 /**
@@ -828,7 +828,7 @@  discard block
 block discarded – undo
828 828
     $pattern = '/&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};/i';
829 829
     $replace = preg_replace_callback(
830 830
         $pattern,
831
-        function ($match) use ($strlen) {
831
+        function($match) use ($strlen) {
832 832
             $utf8 = html_entity_decode($match[0], ENT_HTML5 | ENT_QUOTES, 'UTF-8');
833 833
 
834 834
             return str_repeat(' ', $strlen($utf8, 'UTF-8'));
@@ -889,7 +889,7 @@  discard block
 block discarded – undo
889 889
     }
890 890
 
891 891
     if (empty($options['html'])) {
892
-        return (string)$substr($text, $start, $length);
892
+        return (string) $substr($text, $start, $length);
893 893
     }
894 894
 
895 895
     $totalOffset = 0;
@@ -914,7 +914,7 @@  discard block
 block discarded – undo
914 914
 
915 915
         $len = geodir_strlen($part, $options);
916 916
         if ($offset !== 0 || $totalLength + $len > $length) {
917
-            if (strpos($part, '&') === 0 && preg_match($pattern, $part) && $part !== html_entity_decode($part, ENT_HTML5 | ENT_QUOTES, 'UTF-8') ) {
917
+            if (strpos($part, '&') === 0 && preg_match($pattern, $part) && $part !== html_entity_decode($part, ENT_HTML5 | ENT_QUOTES, 'UTF-8')) {
918 918
                 // Entities cannot be passed substr.
919 919
                 continue;
920 920
             }
@@ -960,39 +960,39 @@  discard block
 block discarded – undo
960 960
     return '';
961 961
 }
962 962
 
963
-function geodir_tool_restore_cpt_from_taxonomies(){
963
+function geodir_tool_restore_cpt_from_taxonomies() {
964 964
 
965 965
 	$cpts = get_option('geodir_post_types');
966 966
 
967
-	if(!empty($cpts)){return;}
967
+	if (!empty($cpts)) {return; }
968 968
 
969 969
 	$taxonomies = get_option('geodir_taxonomies');
970 970
 
971
-	if(empty($taxonomies)){return;}
971
+	if (empty($taxonomies)) {return; }
972 972
 
973 973
 	$cpts = array();
974 974
 
975
-	foreach($taxonomies as $key => $val){
975
+	foreach ($taxonomies as $key => $val) {
976 976
 
977
-		if(strpos($val['listing_slug'], '/') === false) {
978
-			$cpts[$val['object_type']] = array('cpt'=>$val['object_type'],'slug'=>$val['listing_slug']);
977
+		if (strpos($val['listing_slug'], '/') === false) {
978
+			$cpts[$val['object_type']] = array('cpt'=>$val['object_type'], 'slug'=>$val['listing_slug']);
979 979
 		}
980 980
 
981 981
 	}
982 982
 
983
-	if(empty($cpts)){return;}
983
+	if (empty($cpts)) {return; }
984 984
 
985 985
 
986 986
 	$cpts_restore = $cpts;
987 987
 
988
-	foreach($cpts as $cpt){
988
+	foreach ($cpts as $cpt) {
989 989
 
990 990
 
991
-		$is_custom = $cpt['cpt']=='gd_place' ? 0 : 1;
991
+		$is_custom = $cpt['cpt'] == 'gd_place' ? 0 : 1;
992 992
 
993
-		$cpts_restore[$cpt['cpt']] = array (
993
+		$cpts_restore[$cpt['cpt']] = array(
994 994
 				'labels' =>
995
-					array (
995
+					array(
996 996
 						'name' => $cpt['slug'],
997 997
 						'singular_name' => $cpt['slug'],
998 998
 						'add_new' => 'Add New',
@@ -1020,14 +1020,14 @@  discard block
 block discarded – undo
1020 1020
 				'public' => true,
1021 1021
 				'query_var' => true,
1022 1022
 				'rewrite' =>
1023
-					array (
1023
+					array(
1024 1024
 						'slug' => $cpt['slug'],
1025 1025
 						'with_front' => false,
1026 1026
 						'hierarchical' => true,
1027 1027
 						'feeds' => true,
1028 1028
 					),
1029 1029
 				'supports' =>
1030
-					array (
1030
+					array(
1031 1031
 						0 => 'title',
1032 1032
 						1 => 'editor',
1033 1033
 						2 => 'author',
@@ -1037,14 +1037,14 @@  discard block
 block discarded – undo
1037 1037
 						6 => 'comments',
1038 1038
 					),
1039 1039
 				'taxonomies' =>
1040
-					array (
1040
+					array(
1041 1041
 						0 => $cpt['cpt'].'category',
1042 1042
 						1 => $cpt['cpt'].'_tags',
1043 1043
 					),
1044 1044
 				'is_custom' => $is_custom,
1045 1045
 				'listing_order' => '1',
1046 1046
 				'seo' =>
1047
-					array (
1047
+					array(
1048 1048
 						'meta_keyword' => '',
1049 1049
 						'meta_description' => '',
1050 1050
 					),
@@ -1056,7 +1056,7 @@  discard block
 block discarded – undo
1056 1056
 	}
1057 1057
 
1058 1058
 
1059
-	update_option('geodir_post_types',$cpts_restore);
1059
+	update_option('geodir_post_types', $cpts_restore);
1060 1060
 
1061 1061
 }
1062 1062
 
@@ -1074,12 +1074,12 @@  discard block
 block discarded – undo
1074 1074
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
1075 1075
  * @return string
1076 1076
  */
1077
-function geodir_utf8_strimwidth( $str, $start, $width, $trimmaker = '', $encoding = 'UTF-8' ) {
1078
-    if ( function_exists( 'mb_strimwidth' ) ) {
1079
-        return mb_strimwidth( $str, $start, $width, $trimmaker, $encoding );
1077
+function geodir_utf8_strimwidth($str, $start, $width, $trimmaker = '', $encoding = 'UTF-8') {
1078
+    if (function_exists('mb_strimwidth')) {
1079
+        return mb_strimwidth($str, $start, $width, $trimmaker, $encoding);
1080 1080
     }
1081 1081
     
1082
-    return geodir_utf8_substr( $str, $start, $width, $encoding ) . $trimmaker;
1082
+    return geodir_utf8_substr($str, $start, $width, $encoding).$trimmaker;
1083 1083
 }
1084 1084
 
1085 1085
 /**
@@ -1092,12 +1092,12 @@  discard block
 block discarded – undo
1092 1092
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
1093 1093
  * @return int Returns the number of characters in string.
1094 1094
  */
1095
-function geodir_utf8_strlen( $str, $encoding = 'UTF-8' ) {
1096
-    if ( function_exists( 'mb_strlen' ) ) {
1097
-        return mb_strlen( $str, $encoding );
1095
+function geodir_utf8_strlen($str, $encoding = 'UTF-8') {
1096
+    if (function_exists('mb_strlen')) {
1097
+        return mb_strlen($str, $encoding);
1098 1098
     }
1099 1099
         
1100
-    return strlen( $str );
1100
+    return strlen($str);
1101 1101
 }
1102 1102
 
1103 1103
 /**
@@ -1112,12 +1112,12 @@  discard block
 block discarded – undo
1112 1112
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
1113 1113
  * @return int Returns the position of the first occurrence of search in the string.
1114 1114
  */
1115
-function geodir_utf8_strpos( $str, $find, $offset = 0, $encoding = 'UTF-8' ) {
1116
-    if ( function_exists( 'mb_strpos' ) ) {
1117
-        return mb_strpos( $str, $find, $offset, $encoding );
1115
+function geodir_utf8_strpos($str, $find, $offset = 0, $encoding = 'UTF-8') {
1116
+    if (function_exists('mb_strpos')) {
1117
+        return mb_strpos($str, $find, $offset, $encoding);
1118 1118
     }
1119 1119
         
1120
-    return strpos( $str, $find, $offset );
1120
+    return strpos($str, $find, $offset);
1121 1121
 }
1122 1122
 
1123 1123
 /**
@@ -1132,12 +1132,12 @@  discard block
 block discarded – undo
1132 1132
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
1133 1133
  * @return int Returns the position of the last occurrence of search.
1134 1134
  */
1135
-function geodir_utf8_strrpos( $str, $find, $offset = 0, $encoding = 'UTF-8' ) {
1136
-    if ( function_exists( 'mb_strrpos' ) ) {
1137
-        return mb_strrpos( $str, $find, $offset, $encoding );
1135
+function geodir_utf8_strrpos($str, $find, $offset = 0, $encoding = 'UTF-8') {
1136
+    if (function_exists('mb_strrpos')) {
1137
+        return mb_strrpos($str, $find, $offset, $encoding);
1138 1138
     }
1139 1139
         
1140
-    return strrpos( $str, $find, $offset );
1140
+    return strrpos($str, $find, $offset);
1141 1141
 }
1142 1142
 
1143 1143
 /**
@@ -1153,16 +1153,16 @@  discard block
 block discarded – undo
1153 1153
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
1154 1154
  * @return string
1155 1155
  */
1156
-function geodir_utf8_substr( $str, $start, $length = null, $encoding = 'UTF-8' ) {
1157
-    if ( function_exists( 'mb_substr' ) ) {
1158
-        if ( $length === null ) {
1159
-            return mb_substr( $str, $start, geodir_utf8_strlen( $str, $encoding ), $encoding );
1156
+function geodir_utf8_substr($str, $start, $length = null, $encoding = 'UTF-8') {
1157
+    if (function_exists('mb_substr')) {
1158
+        if ($length === null) {
1159
+            return mb_substr($str, $start, geodir_utf8_strlen($str, $encoding), $encoding);
1160 1160
         } else {
1161
-            return mb_substr( $str, $start, $length, $encoding );
1161
+            return mb_substr($str, $start, $length, $encoding);
1162 1162
         }
1163 1163
     }
1164 1164
         
1165
-    return substr( $str, $start, $length );
1165
+    return substr($str, $start, $length);
1166 1166
 }
1167 1167
 
1168 1168
 /**
@@ -1175,13 +1175,13 @@  discard block
 block discarded – undo
1175 1175
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
1176 1176
  * @return string The width of string.
1177 1177
  */
1178
-function geodir_utf8_strwidth( $str, $encoding = 'UTF-8' ) {
1179
-    if ( function_exists( 'mb_strwidth' ) ) {
1180
-        return mb_strwidth( $str, $encoding );
1178
+function geodir_utf8_strwidth($str, $encoding = 'UTF-8') {
1179
+    if (function_exists('mb_strwidth')) {
1180
+        return mb_strwidth($str, $encoding);
1181 1181
     }
1182 1182
     
1183
-    return geodir_utf8_strlen( $str, $encoding );
1184
-=======
1183
+    return geodir_utf8_strlen($str, $encoding);
1184
+=== === =
1185 1185
 
1186 1186
 function geodir_total_listings_count($post_type = false)
1187 1187
 {
@@ -1190,13 +1190,13 @@  discard block
 block discarded – undo
1190 1190
 	$count = 0;
1191 1191
 	
1192 1192
 	if ($post_type) {
1193
-		$count = $count + $wpdb->get_var("select count(post_id) from " . $wpdb->prefix . "geodir_" . $post_type . "_detail");
1193
+		$count = $count + $wpdb->get_var("select count(post_id) from ".$wpdb->prefix."geodir_".$post_type."_detail");
1194 1194
 	} else {
1195 1195
 		$all_postypes = geodir_get_posttypes();
1196 1196
 
1197 1197
 		if (!empty($all_postypes)) {
1198 1198
 			foreach ($all_postypes as $key) {
1199
-				$count = $count + $wpdb->get_var("select count(post_id) from " . $wpdb->prefix . "geodir_" . $key . "_detail");
1199
+				$count = $count + $wpdb->get_var("select count(post_id) from ".$wpdb->prefix."geodir_".$key."_detail");
1200 1200
 			}
1201 1201
 		}	
1202 1202
 	}
Please login to merge, or discard this patch.