Test Setup Failed
Pull Request — master (#217)
by Kiran
05:52
created
geodirectory_template_tags.php 2 patches
Indentation   +331 added lines, -331 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,143 +35,143 @@  discard block
 block discarded – undo
35 35
  */
36 36
 function geodir_templates_scripts()
37 37
 {
38
-    $is_detail_page = false;
39
-
40
-    if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) {
41
-        $is_detail_page = true;
42
-    }
43
-
44
-    wp_enqueue_script('jquery');
45
-
46
-    wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js#asyncload', array(), GEODIRECTORY_VERSION);
47
-    wp_enqueue_script('geodirectory-script');
48
-
49
-
50
-    $geodir_vars_data = array(
51
-        'siteurl' => get_option('siteurl'),
52
-        'geodir_plugin_url' => geodir_plugin_url(),
53
-        'geodir_ajax_url' => geodir_get_ajax_url(),
54
-        'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'),
55
-        'is_rtl' => is_rtl() ? 1 : 0 // fix rtl issue
56
-    );
57
-
58
-    /**
59
-     * Filter the `geodir_var` data array that outputs the  wp_localize_script() translations and variables.
60
-     *
61
-     * This is used by addons to add JS translatable variables.
62
-     *
63
-     * @since 1.4.4
64
-     * @param array $geodir_vars_data {
65
-     *    geodir var data used by addons to add JS translatable variables.
66
-     *
67
-     *    @type string $siteurl Site url.
68
-     *    @type string $geodir_plugin_url Geodirectory core plugin url.
69
-     *    @type string $geodir_ajax_url Geodirectory plugin ajax url.
70
-     *    @type int $geodir_gd_modal Disable GD modal that displays slideshow images in popup?.
71
-     *    @type int $is_rtl Checks if current locale is RTL.
72
-     *
73
-     * }
74
-     */
75
-    $geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data);
76
-
77
-    wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data);
78
-
79
-    wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true);
80
-    if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');}
81
-
82
-    wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true);
83
-    wp_enqueue_script('geodirectory-lightbox-jquery');
84
-
85
-    wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true);
86
-    if ($is_detail_page) {
87
-        wp_enqueue_script('geodirectory-jquery-simplemodal');
88
-    }
89
-
90
-    $map_lang = "&language=" . geodir_get_map_default_language();
91
-    /**
92
-     * Filter the variables that are added to the end of the google maps script call.
93
-     *
94
-     * This i used to change things like google maps language etc.
95
-     *
96
-     * @since 1.0.0
97
-     * @param string $var The string to filter, default is empty string.
98
-     */
99
-    $map_extra = apply_filters('geodir_googlemap_script_extra', '');
100
-    wp_enqueue_script('geodirectory-googlemap-script', '//maps.google.com/maps/api/js?' . $map_lang . $map_extra, '', NULL);
38
+	$is_detail_page = false;
39
+
40
+	if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) {
41
+		$is_detail_page = true;
42
+	}
43
+
44
+	wp_enqueue_script('jquery');
45
+
46
+	wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js#asyncload', array(), GEODIRECTORY_VERSION);
47
+	wp_enqueue_script('geodirectory-script');
48
+
49
+
50
+	$geodir_vars_data = array(
51
+		'siteurl' => get_option('siteurl'),
52
+		'geodir_plugin_url' => geodir_plugin_url(),
53
+		'geodir_ajax_url' => geodir_get_ajax_url(),
54
+		'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'),
55
+		'is_rtl' => is_rtl() ? 1 : 0 // fix rtl issue
56
+	);
57
+
58
+	/**
59
+	 * Filter the `geodir_var` data array that outputs the  wp_localize_script() translations and variables.
60
+	 *
61
+	 * This is used by addons to add JS translatable variables.
62
+	 *
63
+	 * @since 1.4.4
64
+	 * @param array $geodir_vars_data {
65
+	 *    geodir var data used by addons to add JS translatable variables.
66
+	 *
67
+	 *    @type string $siteurl Site url.
68
+	 *    @type string $geodir_plugin_url Geodirectory core plugin url.
69
+	 *    @type string $geodir_ajax_url Geodirectory plugin ajax url.
70
+	 *    @type int $geodir_gd_modal Disable GD modal that displays slideshow images in popup?.
71
+	 *    @type int $is_rtl Checks if current locale is RTL.
72
+	 *
73
+	 * }
74
+	 */
75
+	$geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data);
76
+
77
+	wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data);
78
+
79
+	wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true);
80
+	if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');}
81
+
82
+	wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true);
83
+	wp_enqueue_script('geodirectory-lightbox-jquery');
84
+
85
+	wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true);
86
+	if ($is_detail_page) {
87
+		wp_enqueue_script('geodirectory-jquery-simplemodal');
88
+	}
89
+
90
+	$map_lang = "&language=" . geodir_get_map_default_language();
91
+	/**
92
+	 * Filter the variables that are added to the end of the google maps script call.
93
+	 *
94
+	 * This i used to change things like google maps language etc.
95
+	 *
96
+	 * @since 1.0.0
97
+	 * @param string $var The string to filter, default is empty string.
98
+	 */
99
+	$map_extra = apply_filters('geodir_googlemap_script_extra', '');
100
+	wp_enqueue_script('geodirectory-googlemap-script', '//maps.google.com/maps/api/js?' . $map_lang . $map_extra, '', NULL);
101 101
     
102
-    wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true);
103
-    wp_enqueue_script('geodirectory-goMap-script');
104
-
105
-
106
-    wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION);
107
-    wp_enqueue_script('chosen');
108
-
109
-    wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION);
110
-    wp_enqueue_script('geodirectory-choose-ajax');
111
-
112
-    wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.min.js#asyncload', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true);
113
-
114
-    if (is_page() && geodir_is_page('add-listing')) {
115
-        // SCRIPT FOR UPLOAD
116
-        wp_enqueue_script('plupload-all');
117
-        wp_enqueue_script('jquery-ui-sortable');
118
-
119
-        wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true);
120
-        wp_enqueue_script('geodirectory-plupload-script');
121
-        // SCRIPT FOR UPLOAD END
122
-
123
-        // 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
124
-        if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
125
-            $ajax_url = admin_url('admin-ajax.php');
126
-        } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
127
-            $ajax_url = admin_url('admin-ajax.php');
128
-        } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
129
-            $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
130
-        } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
131
-            $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
132
-        } else {
133
-            $ajax_url = admin_url('admin-ajax.php');
134
-        }
102
+	wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true);
103
+	wp_enqueue_script('geodirectory-goMap-script');
104
+
105
+
106
+	wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION);
107
+	wp_enqueue_script('chosen');
108
+
109
+	wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION);
110
+	wp_enqueue_script('geodirectory-choose-ajax');
111
+
112
+	wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.min.js#asyncload', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true);
113
+
114
+	if (is_page() && geodir_is_page('add-listing')) {
115
+		// SCRIPT FOR UPLOAD
116
+		wp_enqueue_script('plupload-all');
117
+		wp_enqueue_script('jquery-ui-sortable');
118
+
119
+		wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true);
120
+		wp_enqueue_script('geodirectory-plupload-script');
121
+		// SCRIPT FOR UPLOAD END
122
+
123
+		// 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
124
+		if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
125
+			$ajax_url = admin_url('admin-ajax.php');
126
+		} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
127
+			$ajax_url = admin_url('admin-ajax.php');
128
+		} elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
129
+			$ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
130
+		} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
131
+			$ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
132
+		} else {
133
+			$ajax_url = admin_url('admin-ajax.php');
134
+		}
135 135
 
136
-        // place js config array for plupload
137
-        $plupload_init = array(
138
-            'runtimes' => 'html5,silverlight,flash,browserplus,gears,html4',
139
-            'browse_button' => 'plupload-browse-button', // will be adjusted per uploader
140
-            'container' => 'plupload-upload-ui', // will be adjusted per uploader
141
-            'drop_element' => 'dropbox', // will be adjusted per uploader
142
-            'file_data_name' => 'async-upload', // will be adjusted per uploader
143
-            'multiple_queues' => true,
144
-            'max_file_size' => geodir_max_upload_size(),
145
-            'url' => $ajax_url,
146
-            'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
147
-            'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
148
-            'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')),
149
-            'multipart' => true,
150
-            'urlstream_upload' => true,
151
-            'multi_selection' => false, // will be added per uploader
152
-            // additional post data to send to our ajax hook
153
-            'multipart_params' => array(
154
-                '_ajax_nonce' => "", // will be added per uploader
155
-                'action' => 'plupload_action', // the ajax action name
156
-                'imgid' => 0 // will be added per uploader
157
-            )
158
-        );
159
-        $base_plupload_config = json_encode($plupload_init);
160
-
161
-        $gd_plupload_init = array('base_plupload_config' => $base_plupload_config,
162
-            'upload_img_size' => geodir_max_upload_size());
163
-
164
-        wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
165
-
166
-        wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload');
167
-    } // End if for add place page
168
-
169
-    wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
170
-    if ($is_detail_page) {
136
+		// place js config array for plupload
137
+		$plupload_init = array(
138
+			'runtimes' => 'html5,silverlight,flash,browserplus,gears,html4',
139
+			'browse_button' => 'plupload-browse-button', // will be adjusted per uploader
140
+			'container' => 'plupload-upload-ui', // will be adjusted per uploader
141
+			'drop_element' => 'dropbox', // will be adjusted per uploader
142
+			'file_data_name' => 'async-upload', // will be adjusted per uploader
143
+			'multiple_queues' => true,
144
+			'max_file_size' => geodir_max_upload_size(),
145
+			'url' => $ajax_url,
146
+			'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
147
+			'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
148
+			'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')),
149
+			'multipart' => true,
150
+			'urlstream_upload' => true,
151
+			'multi_selection' => false, // will be added per uploader
152
+			// additional post data to send to our ajax hook
153
+			'multipart_params' => array(
154
+				'_ajax_nonce' => "", // will be added per uploader
155
+				'action' => 'plupload_action', // the ajax action name
156
+				'imgid' => 0 // will be added per uploader
157
+			)
158
+		);
159
+		$base_plupload_config = json_encode($plupload_init);
160
+
161
+		$gd_plupload_init = array('base_plupload_config' => $base_plupload_config,
162
+			'upload_img_size' => geodir_max_upload_size());
163
+
164
+		wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
165
+
166
+		wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload');
167
+	} // End if for add place page
168
+
169
+	wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
170
+	if ($is_detail_page) {
171 171
 		wp_enqueue_script('geodirectory-post-custom-js');
172 172
 	}
173 173
 
174
-    // font awesome rating script
174
+	// font awesome rating script
175 175
 	if (get_option('geodir_reviewrating_enable_font_awesome')) {
176 176
 		wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION, true);
177 177
 		wp_enqueue_script('geodir-barrating-js');
@@ -180,11 +180,11 @@  discard block
 block discarded – undo
180 180
 		wp_enqueue_script('geodir-jRating-js');
181 181
 	}
182 182
 
183
-    wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.js#asyncload', array(), GEODIRECTORY_VERSION, true);
184
-    wp_enqueue_script('geodir-on-document-load');
183
+	wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.js#asyncload', array(), GEODIRECTORY_VERSION, true);
184
+	wp_enqueue_script('geodir-on-document-load');
185 185
 
186
-    wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
187
-    wp_enqueue_script('google-geometa');
186
+	wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
187
+	wp_enqueue_script('google-geometa');
188 188
 }
189 189
 
190 190
 /**
@@ -198,8 +198,8 @@  discard block
 block discarded – undo
198 198
  */
199 199
 function geodir_header_scripts()
200 200
 {
201
-    echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>';
202
-    echo stripslashes(get_option('geodir_header_scripts'));
201
+	echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>';
202
+	echo stripslashes(get_option('geodir_header_scripts'));
203 203
 }
204 204
 
205 205
 
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 function geodir_footer_scripts()
216 216
 {	
217 217
 	echo stripslashes(get_option('geodir_ga_tracking_code'));
218
-    echo stripslashes(get_option('geodir_footer_scripts'));
218
+	echo stripslashes(get_option('geodir_footer_scripts'));
219 219
 }
220 220
 
221 221
 
@@ -229,12 +229,12 @@  discard block
 block discarded – undo
229 229
  */
230 230
 function geodir_add_async_forscript($url)
231 231
 {
232
-    if (strpos($url, '#asyncload')===false)
233
-        return $url;
234
-    else if (is_admin())
235
-        return str_replace('#asyncload', '', $url);
236
-    else
237
-        return str_replace('#asyncload', '', $url)."' async='async";
232
+	if (strpos($url, '#asyncload')===false)
233
+		return $url;
234
+	else if (is_admin())
235
+		return str_replace('#asyncload', '', $url);
236
+	else
237
+		return str_replace('#asyncload', '', $url)."' async='async";
238 238
 }
239 239
 add_filter('clean_url', 'geodir_add_async_forscript', 11, 1);
240 240
 
@@ -248,55 +248,55 @@  discard block
 block discarded – undo
248 248
 {
249 249
 
250 250
 
251
-    if(get_option('geodir_scss_core')) {
251
+	if(get_option('geodir_scss_core')) {
252 252
 
253 253
 
254
-        wp_register_style('geodirectory-frontend-style', geodir_plugin_url() . '/geodirectory-assets/css/style.css', array(), GEODIRECTORY_VERSION);
255
-        wp_enqueue_style('geodirectory-frontend-style');
254
+		wp_register_style('geodirectory-frontend-style', geodir_plugin_url() . '/geodirectory-assets/css/style.css', array(), GEODIRECTORY_VERSION);
255
+		wp_enqueue_style('geodirectory-frontend-style');
256 256
 
257
-        wp_register_style('geodirectory-media-style', geodir_plugin_url() . '/geodirectory-assets/css/media.css', array(), GEODIRECTORY_VERSION);
258
-        wp_enqueue_style('geodirectory-media-style');
257
+		wp_register_style('geodirectory-media-style', geodir_plugin_url() . '/geodirectory-assets/css/media.css', array(), GEODIRECTORY_VERSION);
258
+		wp_enqueue_style('geodirectory-media-style');
259 259
 
260 260
 
261
-        wp_register_style('geodirectory-jquery-ui-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery-ui.css', array(), GEODIRECTORY_VERSION);
262
-        wp_enqueue_style('geodirectory-jquery-ui-css');
261
+		wp_register_style('geodirectory-jquery-ui-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery-ui.css', array(), GEODIRECTORY_VERSION);
262
+		wp_enqueue_style('geodirectory-jquery-ui-css');
263 263
 
264
-        wp_register_style('geodirectory-jquery-ui-timepicker-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery.ui.timepicker.css', array(), GEODIRECTORY_VERSION);
265
-        wp_enqueue_style('geodirectory-jquery-ui-timepicker-css');
264
+		wp_register_style('geodirectory-jquery-ui-timepicker-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery.ui.timepicker.css', array(), GEODIRECTORY_VERSION);
265
+		wp_enqueue_style('geodirectory-jquery-ui-timepicker-css');
266 266
 
267
-        wp_register_style('geodirectory-flexslider-css', geodir_plugin_url() . '/geodirectory-assets/css/flexslider.css', array(), GEODIRECTORY_VERSION);
268
-        wp_enqueue_style('geodirectory-flexslider-css');
267
+		wp_register_style('geodirectory-flexslider-css', geodir_plugin_url() . '/geodirectory-assets/css/flexslider.css', array(), GEODIRECTORY_VERSION);
268
+		wp_enqueue_style('geodirectory-flexslider-css');
269 269
 
270
-        wp_register_style('geodirectory-thic-box-css', geodir_plugin_url() . '/geodirectory-assets/css/thic-box.css', array(), GEODIRECTORY_VERSION);
271
-        wp_enqueue_style('geodirectory-thic-box-css');
270
+		wp_register_style('geodirectory-thic-box-css', geodir_plugin_url() . '/geodirectory-assets/css/thic-box.css', array(), GEODIRECTORY_VERSION);
271
+		wp_enqueue_style('geodirectory-thic-box-css');
272 272
 
273
-        wp_register_style('geodirectory-pluplodar-css', geodir_plugin_url() . '/geodirectory-assets/css/pluploader.css', array(), GEODIRECTORY_VERSION);
274
-        wp_enqueue_style('geodirectory-pluplodar-css');
273
+		wp_register_style('geodirectory-pluplodar-css', geodir_plugin_url() . '/geodirectory-assets/css/pluploader.css', array(), GEODIRECTORY_VERSION);
274
+		wp_enqueue_style('geodirectory-pluplodar-css');
275 275
 
276
-        wp_register_style('geodirectory-lightbox-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery.lightbox-0.5.css', array(), GEODIRECTORY_VERSION);
277
-        wp_enqueue_style('geodirectory-lightbox-css');
276
+		wp_register_style('geodirectory-lightbox-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery.lightbox-0.5.css', array(), GEODIRECTORY_VERSION);
277
+		wp_enqueue_style('geodirectory-lightbox-css');
278 278
 
279
-        wp_register_style('geodir-rating-style', geodir_plugin_url() . '/geodirectory-assets/css/jRating.jquery.css', array(), GEODIRECTORY_VERSION);
280
-        wp_enqueue_style('geodir-rating-style');
279
+		wp_register_style('geodir-rating-style', geodir_plugin_url() . '/geodirectory-assets/css/jRating.jquery.css', array(), GEODIRECTORY_VERSION);
280
+		wp_enqueue_style('geodir-rating-style');
281 281
 
282
-        wp_register_style('geodir-chosen-style', geodir_plugin_url() . '/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION);
283
-        wp_enqueue_style('geodir-chosen-style');
282
+		wp_register_style('geodir-chosen-style', geodir_plugin_url() . '/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION);
283
+		wp_enqueue_style('geodir-chosen-style');
284 284
 
285
-    }else{
286
-        wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION);
287
-        wp_enqueue_style('geodir-core-scss');
285
+	}else{
286
+		wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION);
287
+		wp_enqueue_style('geodir-core-scss');
288 288
 
289
-        wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION);
289
+		wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION);
290 290
 
291
-    }
291
+	}
292 292
 
293
-    if(is_rtl()){
294
-    wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION);
295
-    wp_enqueue_style('geodirectory-frontend-rtl-style');
296
-    }
293
+	if(is_rtl()){
294
+	wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION);
295
+	wp_enqueue_style('geodirectory-frontend-rtl-style');
296
+	}
297 297
 
298
-    wp_register_style('geodirectory-font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION);
299
-    wp_enqueue_style('geodirectory-font-awesome');
298
+	wp_register_style('geodirectory-font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION);
299
+	wp_enqueue_style('geodirectory-font-awesome');
300 300
 
301 301
 
302 302
 }
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
  */
311 311
 function geodir_get_sidebar()
312 312
 {
313
-    get_sidebar('geodirectory');
313
+	get_sidebar('geodirectory');
314 314
 }
315 315
 
316 316
 /**
@@ -329,122 +329,122 @@  discard block
 block discarded – undo
329 329
  * @param bool $always_show Do you want to show the pagination always? Default: false.
330 330
  */
331 331
 function geodir_pagination($before = '', $after = '', $prelabel = '', $nxtlabel = '', $pages_to_show = 5, $always_show = false) {
332
-    global $wp_query, $posts_per_page, $wpdb, $paged, $blog_id;
332
+	global $wp_query, $posts_per_page, $wpdb, $paged, $blog_id;
333 333
 
334
-    if (empty($prelabel)) {
335
-        $prelabel = '<strong>&laquo;</strong>';
336
-    }
334
+	if (empty($prelabel)) {
335
+		$prelabel = '<strong>&laquo;</strong>';
336
+	}
337 337
 
338
-    if (empty($nxtlabel)) {
339
-        $nxtlabel = '<strong>&raquo;</strong>';
340
-    }
338
+	if (empty($nxtlabel)) {
339
+		$nxtlabel = '<strong>&raquo;</strong>';
340
+	}
341 341
 
342
-    $half_pages_to_show = round($pages_to_show / 2);
342
+	$half_pages_to_show = round($pages_to_show / 2);
343 343
 
344
-    if (geodir_is_page('home') || (get_option('geodir_set_as_home') && is_home())) // dont apply default  pagination for geodirectory home page.
345
-        return;
344
+	if (geodir_is_page('home') || (get_option('geodir_set_as_home') && is_home())) // dont apply default  pagination for geodirectory home page.
345
+		return;
346 346
 
347
-    if (!is_single()) {
348
-        if (function_exists('geodir_location_geo_home_link')) {
349
-            remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
350
-        }
351
-        $numposts = $wp_query->found_posts;
347
+	if (!is_single()) {
348
+		if (function_exists('geodir_location_geo_home_link')) {
349
+			remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
350
+		}
351
+		$numposts = $wp_query->found_posts;
352 352
 
353
-        $max_page = ceil($numposts / $posts_per_page);
353
+		$max_page = ceil($numposts / $posts_per_page);
354 354
 
355
-        if (empty($paged)) {
356
-            $paged = 1;
357
-        }
355
+		if (empty($paged)) {
356
+			$paged = 1;
357
+		}
358 358
         
359
-        $post_type = geodir_get_current_posttype();
360
-        $listing_type_name = get_post_type_plural_label($post_type);
361
-        if (geodir_is_page('listing') || geodir_is_page('search')) {            
362
-            $term = array();
359
+		$post_type = geodir_get_current_posttype();
360
+		$listing_type_name = get_post_type_plural_label($post_type);
361
+		if (geodir_is_page('listing') || geodir_is_page('search')) {            
362
+			$term = array();
363 363
             
364
-            if (is_tax()) {
365
-                $term_id = get_queried_object_id();
366
-                $taxonomy = get_query_var('taxonomy');
364
+			if (is_tax()) {
365
+				$term_id = get_queried_object_id();
366
+				$taxonomy = get_query_var('taxonomy');
367 367
 
368
-                if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) {
369
-                    $term = get_term($term_id, $post_type . 'category');
370
-                }
371
-            }
368
+				if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) {
369
+					$term = get_term($term_id, $post_type . 'category');
370
+				}
371
+			}
372 372
             
373
-            if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) {
374
-                $taxonomy_search = $_REQUEST['s' . $post_type . 'category'];
373
+			if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) {
374
+				$taxonomy_search = $_REQUEST['s' . $post_type . 'category'];
375 375
                 
376
-                if (!is_array($taxonomy_search)) {
377
-                    $term = get_term((int)$taxonomy_search, $post_type . 'category');
378
-                } else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search
379
-                    $term = get_term((int)$taxonomy_search[0], $post_type . 'category');
380
-                }
381
-            }
376
+				if (!is_array($taxonomy_search)) {
377
+					$term = get_term((int)$taxonomy_search, $post_type . 'category');
378
+				} else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search
379
+					$term = get_term((int)$taxonomy_search[0], $post_type . 'category');
380
+				}
381
+			}
382 382
             
383
-            if (!empty($term) && !is_wp_error($term)) {
384
-                $listing_type_name = $term->name;
385
-            }
386
-        }
383
+			if (!empty($term) && !is_wp_error($term)) {
384
+				$listing_type_name = $term->name;
385
+			}
386
+		}
387 387
 
388
-        if ($max_page > 1 || $always_show) {            
389
-            // Extra pagination info
390
-            $geodir_pagination_more_info = get_option('geodir_pagination_advance_info');
391
-            $start_no = ( $paged - 1 ) * $posts_per_page + 1;
392
-            $end_no = min($paged * $posts_per_page, $numposts);
388
+		if ($max_page > 1 || $always_show) {            
389
+			// Extra pagination info
390
+			$geodir_pagination_more_info = get_option('geodir_pagination_advance_info');
391
+			$start_no = ( $paged - 1 ) * $posts_per_page + 1;
392
+			$end_no = min($paged * $posts_per_page, $numposts);
393 393
 
394
-            if ($geodir_pagination_more_info != '') {
395
-                if ($listing_type_name) {
396
-                    $listing_type_name = __($listing_type_name, 'geodirectory');
397
-                    $pegination_desc = wp_sprintf(__('Showing %s %d-%d of %d', 'geodirectory'), $listing_type_name, $start_no, $end_no, $numposts);
398
-                } else {
399
-                    $pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts);
400
-                }
401
-                $pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>';
402
-                /**
403
-                 * Adds an extra pagination info above/under pagination.
404
-                 *
405
-                 * @since 1.5.9
406
-                 *
407
-                 * @param string $pagination_info Extra pagination info content.
408
-                 * @param string $listing_type_name Listing results type.
409
-                 * @param string $start_no First result number.
410
-                 * @param string $end_no Last result number.
411
-                 * @param string $numposts Total number of listings.
412
-                 * @param string $post_type The post type.
413
-                 */
414
-                $pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type);
394
+			if ($geodir_pagination_more_info != '') {
395
+				if ($listing_type_name) {
396
+					$listing_type_name = __($listing_type_name, 'geodirectory');
397
+					$pegination_desc = wp_sprintf(__('Showing %s %d-%d of %d', 'geodirectory'), $listing_type_name, $start_no, $end_no, $numposts);
398
+				} else {
399
+					$pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts);
400
+				}
401
+				$pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>';
402
+				/**
403
+				 * Adds an extra pagination info above/under pagination.
404
+				 *
405
+				 * @since 1.5.9
406
+				 *
407
+				 * @param string $pagination_info Extra pagination info content.
408
+				 * @param string $listing_type_name Listing results type.
409
+				 * @param string $start_no First result number.
410
+				 * @param string $end_no Last result number.
411
+				 * @param string $numposts Total number of listings.
412
+				 * @param string $post_type The post type.
413
+				 */
414
+				$pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type);
415 415
                 
416
-                if ($geodir_pagination_more_info == 'before') {
417
-                    $before = $before . $pagination_info;
418
-                } else if ($geodir_pagination_more_info == 'after') {
419
-                    $after = $pagination_info . $after;
420
-                }
421
-            }
416
+				if ($geodir_pagination_more_info == 'before') {
417
+					$before = $before . $pagination_info;
418
+				} else if ($geodir_pagination_more_info == 'after') {
419
+					$after = $pagination_info . $after;
420
+				}
421
+			}
422 422
             
423
-            echo "$before <div class='Navi'>";
424
-            if ($paged >= ($pages_to_show - 1)) {
425
-                echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link()) . '">&laquo;</a>';
426
-            }
427
-            previous_posts_link($prelabel);
428
-            for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) {
429
-                if ($i >= 1 && $i <= $max_page) {
430
-                    if ($i == $paged) {
431
-                        echo "<strong class='on'>$i</strong>";
432
-                    } else {
433
-                        echo ' <a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($i)) . '">' . $i . '</a> ';
434
-                    }
435
-                }
436
-            }
437
-            next_posts_link($nxtlabel, $max_page);
438
-            if (($paged + $half_pages_to_show) < ($max_page)) {
439
-                echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($max_page)) . '">&raquo;</a>';
440
-            }
441
-            echo "</div> $after";
442
-        }
423
+			echo "$before <div class='Navi'>";
424
+			if ($paged >= ($pages_to_show - 1)) {
425
+				echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link()) . '">&laquo;</a>';
426
+			}
427
+			previous_posts_link($prelabel);
428
+			for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) {
429
+				if ($i >= 1 && $i <= $max_page) {
430
+					if ($i == $paged) {
431
+						echo "<strong class='on'>$i</strong>";
432
+					} else {
433
+						echo ' <a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($i)) . '">' . $i . '</a> ';
434
+					}
435
+				}
436
+			}
437
+			next_posts_link($nxtlabel, $max_page);
438
+			if (($paged + $half_pages_to_show) < ($max_page)) {
439
+				echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($max_page)) . '">&raquo;</a>';
440
+			}
441
+			echo "</div> $after";
442
+		}
443 443
         
444
-        if (function_exists('geodir_location_geo_home_link')) {
445
-            add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
446
-        }
447
-    }
444
+		if (function_exists('geodir_location_geo_home_link')) {
445
+			add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
446
+		}
447
+	}
448 448
 }
449 449
 
450 450
 /**
@@ -455,20 +455,20 @@  discard block
 block discarded – undo
455 455
  */
456 456
 function geodir_listingsearch_scripts()
457 457
 {
458
-    if (get_option('gd_search_dist') != '') {
459
-        $dist = get_option('gd_search_dist');
460
-    } else {
461
-        $dist = 500;
462
-    }
463
-    $dist_dif = 1000;
464
-
465
-    if ($dist <= 5000) $dist_dif = 500;
466
-    if ($dist <= 1000) $dist_dif = 100;
467
-    if ($dist <= 500) $dist_dif = 50;
468
-    if ($dist <= 100) $dist_dif = 10;
469
-    if ($dist <= 50) $dist_dif = 5;
470
-
471
-    ?>
458
+	if (get_option('gd_search_dist') != '') {
459
+		$dist = get_option('gd_search_dist');
460
+	} else {
461
+		$dist = 500;
462
+	}
463
+	$dist_dif = 1000;
464
+
465
+	if ($dist <= 5000) $dist_dif = 500;
466
+	if ($dist <= 1000) $dist_dif = 100;
467
+	if ($dist <= 500) $dist_dif = 50;
468
+	if ($dist <= 100) $dist_dif = 10;
469
+	if ($dist <= 50) $dist_dif = 5;
470
+
471
+	?>
472 472
     <script type="text/javascript">
473 473
 
474 474
         jQuery(function ($) {
@@ -527,15 +527,15 @@  discard block
 block discarded – undo
527 527
 function geodir_add_sharelocation_scripts()
528 528
 {
529 529
 
530
-    $default_search_for_text = SEARCH_FOR_TEXT;
531
-    if (get_option('geodir_search_field_default_text'))
532
-        $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
530
+	$default_search_for_text = SEARCH_FOR_TEXT;
531
+	if (get_option('geodir_search_field_default_text'))
532
+		$default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
533 533
 
534
-    $default_near_text = NEAR_TEXT;
535
-    if (get_option('geodir_near_field_default_text'))
536
-        $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
534
+	$default_near_text = NEAR_TEXT;
535
+	if (get_option('geodir_near_field_default_text'))
536
+		$default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
537 537
 
538
-    ?>
538
+	?>
539 539
 
540 540
 
541 541
     <script type="text/javascript">
@@ -613,14 +613,14 @@  discard block
 block discarded – undo
613 613
                 } else {
614 614
 
615 615
                     Sgeocoder.geocode({'address': address<?php
616
-                    if($near_add = get_option('geodir_search_near_addition')){echo '+", '.$near_add.'"';}
617
-                    if($near_add2 =
618
-                    /**
619
-                     * Adds any extra info to the near search box query when trying to geolocate it via google api.
620
-                     *
621
-                     * @since 1.0.0
622
-                     */
623
-                    apply_filters('geodir_search_near_addition','')){echo $near_add2;}//gt_advanced_near_search();?>},
616
+					if($near_add = get_option('geodir_search_near_addition')){echo '+", '.$near_add.'"';}
617
+					if($near_add2 =
618
+					/**
619
+					 * Adds any extra info to the near search box query when trying to geolocate it via google api.
620
+					 *
621
+					 * @since 1.0.0
622
+					 */
623
+					apply_filters('geodir_search_near_addition','')){echo $near_add2;}//gt_advanced_near_search();?>},
624 624
                         function (results, status) {
625 625
                             if (status == google.maps.GeocoderStatus.OK) {
626 626
                                 updateSearchPosition(results[0].geometry.location, $form);
@@ -699,30 +699,30 @@  discard block
 block discarded – undo
699 699
  */
700 700
 function geodir_show_badges_on_image($which, $post, $link)
701 701
 {
702
-    $return = '';
703
-    switch ($which) {
704
-        case 'featured':
705
-            /**
706
-             * Filter the featured image badge html that appears in the listings pages over the thumbnail.
707
-             *
708
-             * @since 1.0.0
709
-             * @param object $post The post object.
710
-             * @param string $link The link to the post.
711
-             */
712
-            $return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img">&nbsp;</span></a>',$post,$link);
713
-            break;
714
-        case 'new' :
715
-            /**
716
-             * Filter the new image badge html that appears in the listings pages over the thumbnail.
717
-             *
718
-             * @since 1.0.0
719
-             * @param object $post The post object.
720
-             * @param string $link The link to the post.
721
-             */
722
-            $return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing">&nbsp;</span></a>',$post,$link);
723
-            break;
724
-
725
-    }
702
+	$return = '';
703
+	switch ($which) {
704
+		case 'featured':
705
+			/**
706
+			 * Filter the featured image badge html that appears in the listings pages over the thumbnail.
707
+			 *
708
+			 * @since 1.0.0
709
+			 * @param object $post The post object.
710
+			 * @param string $link The link to the post.
711
+			 */
712
+			$return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img">&nbsp;</span></a>',$post,$link);
713
+			break;
714
+		case 'new' :
715
+			/**
716
+			 * Filter the new image badge html that appears in the listings pages over the thumbnail.
717
+			 *
718
+			 * @since 1.0.0
719
+			 * @param object $post The post object.
720
+			 * @param string $link The link to the post.
721
+			 */
722
+			$return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing">&nbsp;</span></a>',$post,$link);
723
+			break;
724
+
725
+	}
726 726
     
727
-    return $return;
727
+	return $return;
728 728
 }
Please login to merge, or discard this patch.
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 {
38 38
     $is_detail_page = false;
39 39
 
40
-    if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) {
40
+    if ((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview'))) {
41 41
         $is_detail_page = true;
42 42
     }
43 43
 
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
         'siteurl' => get_option('siteurl'),
52 52
         'geodir_plugin_url' => geodir_plugin_url(),
53 53
         'geodir_ajax_url' => geodir_get_ajax_url(),
54
-        'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'),
54
+        'geodir_gd_modal' => (int) get_option('geodir_disable_gb_modal'),
55 55
         'is_rtl' => is_rtl() ? 1 : 0 // fix rtl issue
56 56
     );
57 57
 
@@ -72,17 +72,17 @@  discard block
 block discarded – undo
72 72
      *
73 73
      * }
74 74
      */
75
-    $geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data);
75
+    $geodir_vars_data = apply_filters('geodir_vars_data', $geodir_vars_data);
76 76
 
77 77
     wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data);
78 78
 
79
-    wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true);
80
-    if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');}
79
+    wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION, true);
80
+    if ($is_detail_page) {wp_enqueue_script('geodirectory-jquery-flexslider-js'); }
81 81
 
82
-    wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true);
82
+    wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION, true);
83 83
     wp_enqueue_script('geodirectory-lightbox-jquery');
84 84
 
85
-    wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true);
85
+    wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION, true);
86 86
     if ($is_detail_page) {
87 87
         wp_enqueue_script('geodirectory-jquery-simplemodal');
88 88
     }
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     $map_extra = apply_filters('geodir_googlemap_script_extra', '');
100 100
     wp_enqueue_script('geodirectory-googlemap-script', '//maps.google.com/maps/api/js?' . $map_lang . $map_extra, '', NULL);
101 101
     
102
-    wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true);
102
+    wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true);
103 103
     wp_enqueue_script('geodirectory-goMap-script');
104 104
 
105 105
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
         wp_enqueue_script('plupload-all');
117 117
         wp_enqueue_script('jquery-ui-sortable');
118 118
 
119
-        wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true);
119
+        wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
120 120
         wp_enqueue_script('geodirectory-plupload-script');
121 121
         // SCRIPT FOR UPLOAD END
122 122
 
@@ -229,12 +229,12 @@  discard block
 block discarded – undo
229 229
  */
230 230
 function geodir_add_async_forscript($url)
231 231
 {
232
-    if (strpos($url, '#asyncload')===false)
232
+    if (strpos($url, '#asyncload') === false)
233 233
         return $url;
234 234
     else if (is_admin())
235 235
         return str_replace('#asyncload', '', $url);
236 236
     else
237
-        return str_replace('#asyncload', '', $url)."' async='async";
237
+        return str_replace('#asyncload', '', $url) . "' async='async";
238 238
 }
239 239
 add_filter('clean_url', 'geodir_add_async_forscript', 11, 1);
240 240
 
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 {
249 249
 
250 250
 
251
-    if(get_option('geodir_scss_core')) {
251
+    if (get_option('geodir_scss_core')) {
252 252
 
253 253
 
254 254
         wp_register_style('geodirectory-frontend-style', geodir_plugin_url() . '/geodirectory-assets/css/style.css', array(), GEODIRECTORY_VERSION);
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
         wp_register_style('geodir-chosen-style', geodir_plugin_url() . '/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION);
283 283
         wp_enqueue_style('geodir-chosen-style');
284 284
 
285
-    }else{
285
+    } else {
286 286
         wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION);
287 287
         wp_enqueue_style('geodir-core-scss');
288 288
 
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 
291 291
     }
292 292
 
293
-    if(is_rtl()){
293
+    if (is_rtl()) {
294 294
     wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION);
295 295
     wp_enqueue_style('geodirectory-frontend-rtl-style');
296 296
     }
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
                 $term_id = get_queried_object_id();
366 366
                 $taxonomy = get_query_var('taxonomy');
367 367
 
368
-                if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) {
368
+                if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category') {
369 369
                     $term = get_term($term_id, $post_type . 'category');
370 370
                 }
371 371
             }
@@ -374,9 +374,9 @@  discard block
 block discarded – undo
374 374
                 $taxonomy_search = $_REQUEST['s' . $post_type . 'category'];
375 375
                 
376 376
                 if (!is_array($taxonomy_search)) {
377
-                    $term = get_term((int)$taxonomy_search, $post_type . 'category');
378
-                } else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search
379
-                    $term = get_term((int)$taxonomy_search[0], $post_type . 'category');
377
+                    $term = get_term((int) $taxonomy_search, $post_type . 'category');
378
+                } else if (is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search
379
+                    $term = get_term((int) $taxonomy_search[0], $post_type . 'category');
380 380
                 }
381 381
             }
382 382
             
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
         if ($max_page > 1 || $always_show) {            
389 389
             // Extra pagination info
390 390
             $geodir_pagination_more_info = get_option('geodir_pagination_advance_info');
391
-            $start_no = ( $paged - 1 ) * $posts_per_page + 1;
391
+            $start_no = ($paged - 1) * $posts_per_page + 1;
392 392
             $end_no = min($paged * $posts_per_page, $numposts);
393 393
 
394 394
             if ($geodir_pagination_more_info != '') {
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
         jQuery(function ($) {
475 475
             $("#distance_slider").slider({
476 476
                 range: true,
477
-                values: [0, <?php echo ($_REQUEST['sdist']!='') ? sanitize_text_field($_REQUEST['sdist']) : "0"; ?>],
477
+                values: [0, <?php echo ($_REQUEST['sdist'] != '') ? sanitize_text_field($_REQUEST['sdist']) : "0"; ?>],
478 478
                 min: 0,
479 479
                 max: <?php echo $dist; ?>,
480 480
                 step: <?php echo $dist_dif; ?>,
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
 
540 540
 
541 541
     <script type="text/javascript">
542
-        var default_location = '<?php if($search_location = geodir_get_default_location())  echo $search_location->city ;?>';
542
+        var default_location = '<?php if ($search_location = geodir_get_default_location())  echo $search_location->city; ?>';
543 543
         var latlng;
544 544
         var Sgeocoder;
545 545
         var address;
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 				var $form = jQuery(this).closest('form');
553 553
 				
554 554
 				if (jQuery("#sdist input[type='radio']:checked").length != 0) dist = jQuery("#sdist input[type='radio']:checked").val();
555
-				if (jQuery('.search_text', $form).val() == '' || jQuery('.search_text', $form).val() == '<?php echo $default_search_for_text;?>') jQuery('.search_text', $form).val(s);
555
+				if (jQuery('.search_text', $form).val() == '' || jQuery('.search_text', $form).val() == '<?php echo $default_search_for_text; ?>') jQuery('.search_text', $form).val(s);
556 556
 				
557 557
 				// Disable location based search for disabled location post type.
558 558
 				if (jQuery('.search_by_post', $form).val() != '' && typeof gd_cpt_no_location == 'function') {
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
 					}
567 567
 				}
568 568
 				
569
-				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;?>')) {
569
+				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; ?>')) {
570 570
 					geodir_setsearch($form);
571 571
 				} else {
572 572
 					jQuery(".snear", $form).val('');
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
 		});
587 587
         
588 588
 		function geodir_setsearch($form) {
589
-			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);
589
+			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);
590 590
 			geocodeAddress($form);
591 591
 		}
592 592
 
@@ -599,8 +599,8 @@  discard block
 block discarded – undo
599 599
         function geocodeAddress($form) {
600 600
             Sgeocoder = new google.maps.Geocoder(); // Call the geocode function
601 601
 
602
-            if (jQuery('.snear', $form).val() == '' || ( jQuery('.sgeo_lat').val() != '' && jQuery('.sgeo_lon').val() != ''  ) || jQuery('.snear', $form).val().match("^<?php _e('In:','geodirectory');?>")) {
603
-                if (jQuery('.snear', $form).val().match("^<?php _e('In:','geodirectory');?>")) {
602
+            if (jQuery('.snear', $form).val() == '' || ( jQuery('.sgeo_lat').val() != '' && jQuery('.sgeo_lon').val() != ''  ) || jQuery('.snear', $form).val().match("^<?php _e('In:', 'geodirectory'); ?>")) {
603
+                if (jQuery('.snear', $form).val().match("^<?php _e('In:', 'geodirectory'); ?>")) {
604 604
                     jQuery(".snear", $form).val('');
605 605
                 }
606 606
                 jQuery($form).submit();
@@ -608,24 +608,24 @@  discard block
 block discarded – undo
608 608
 
609 609
                 var address = jQuery(".snear", $form).val();
610 610
 
611
-                if (jQuery('.snear', $form).val() == '<?php echo $default_near_text;?>') {
611
+                if (jQuery('.snear', $form).val() == '<?php echo $default_near_text; ?>') {
612 612
                     initialise2();
613 613
                 } else {
614 614
 
615 615
                     Sgeocoder.geocode({'address': address<?php
616
-                    if($near_add = get_option('geodir_search_near_addition')){echo '+", '.$near_add.'"';}
617
-                    if($near_add2 =
616
+                    if ($near_add = get_option('geodir_search_near_addition')) {echo '+", ' . $near_add . '"'; }
617
+                    if ($near_add2 =
618 618
                     /**
619 619
                      * Adds any extra info to the near search box query when trying to geolocate it via google api.
620 620
                      *
621 621
                      * @since 1.0.0
622 622
                      */
623
-                    apply_filters('geodir_search_near_addition','')){echo $near_add2;}//gt_advanced_near_search();?>},
623
+                    apply_filters('geodir_search_near_addition', '')) {echo $near_add2; }//gt_advanced_near_search();?>},
624 624
                         function (results, status) {
625 625
                             if (status == google.maps.GeocoderStatus.OK) {
626 626
                                 updateSearchPosition(results[0].geometry.location, $form);
627 627
                             } else {
628
-                                alert("<?php _e('Search was not successful for the following reason:','geodirectory');?>" + status);
628
+                                alert("<?php _e('Search was not successful for the following reason:', 'geodirectory'); ?>" + status);
629 629
                             }
630 630
                         });
631 631
                 }
@@ -656,19 +656,19 @@  discard block
 block discarded – undo
656 656
             var msg;
657 657
             switch (err.code) {
658 658
                 case err.UNKNOWN_ERROR:
659
-                    msg = "<?php _e('Unable to find your location','geodirectory');?>";
659
+                    msg = "<?php _e('Unable to find your location', 'geodirectory'); ?>";
660 660
                     break;
661 661
                 case err.PERMISSION_DENINED:
662
-                    msg = "<?php _e('Permission denied in finding your location','geodirectory');?>";
662
+                    msg = "<?php _e('Permission denied in finding your location', 'geodirectory'); ?>";
663 663
                     break;
664 664
                 case err.POSITION_UNAVAILABLE:
665
-                    msg = "<?php _e('Your location is currently unknown','geodirectory');?>";
665
+                    msg = "<?php _e('Your location is currently unknown', 'geodirectory'); ?>";
666 666
                     break;
667 667
                 case err.BREAK:
668
-                    msg = "<?php _e('Attempt to find location took too long','geodirectory');?>";
668
+                    msg = "<?php _e('Attempt to find location took too long', 'geodirectory'); ?>";
669 669
                     break;
670 670
                 default:
671
-                    msg = "<?php _e('Location detection not supported in browser','geodirectory');?>";
671
+                    msg = "<?php _e('Location detection not supported in browser', 'geodirectory'); ?>";
672 672
             }
673 673
             jQuery('#info').html(msg);
674 674
         }
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
              * @param object $post The post object.
710 710
              * @param string $link The link to the post.
711 711
              */
712
-            $return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img">&nbsp;</span></a>',$post,$link);
712
+            $return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img">&nbsp;</span></a>', $post, $link);
713 713
             break;
714 714
         case 'new' :
715 715
             /**
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
              * @param object $post The post object.
720 720
              * @param string $link The link to the post.
721 721
              */
722
-            $return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing">&nbsp;</span></a>',$post,$link);
722
+            $return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing">&nbsp;</span></a>', $post, $link);
723 723
             break;
724 724
 
725 725
     }
Please login to merge, or discard this patch.
geodirectory-functions/location_functions.php 2 patches
Indentation   +202 added lines, -202 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Returns current city latitude.
4
- *
5
- * @since 1.0.0
6
- * @package GeoDirectory
7
- * @todo fix location variable
8
- * @return string
9
- */
3
+	 * Returns current city latitude.
4
+	 *
5
+	 * @since 1.0.0
6
+	 * @package GeoDirectory
7
+	 * @todo fix location variable
8
+	 * @return string
9
+	 */
10 10
 function geodir_get_current_city_lat()
11 11
 {
12
-    $location = geodir_get_default_location();
13
-    $lat = isset($location_result->city_latitude) ? $location_result->city_latitude : '39.952484';
12
+	$location = geodir_get_default_location();
13
+	$lat = isset($location_result->city_latitude) ? $location_result->city_latitude : '39.952484';
14 14
 
15
-    return $lat;
15
+	return $lat;
16 16
 }
17 17
 
18 18
 /**
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function geodir_get_current_city_lng()
27 27
 {
28
-    $location = geodir_get_default_location();
29
-    $lng = isset($location_result->city_longitude) ? $location_result->city_longitude : '-75.163786';
30
-    return $lng;
28
+	$location = geodir_get_default_location();
29
+	$lng = isset($location_result->city_longitude) ? $location_result->city_longitude : '-75.163786';
30
+	return $lng;
31 31
 }
32 32
 
33 33
 
@@ -40,15 +40,15 @@  discard block
 block discarded – undo
40 40
  */
41 41
 function geodir_get_default_location()
42 42
 {
43
-    /**
44
-     * Filter the default location.
45
-     *
46
-     * @since 1.0.0
47
-     * @package GeoDirectory
48
-     *
49
-     * @param string $location_result The default location object.
50
-     */
51
-    return $location_result = apply_filters('geodir_get_default_location', get_option('geodir_default_location'));
43
+	/**
44
+	 * Filter the default location.
45
+	 *
46
+	 * @since 1.0.0
47
+	 * @package GeoDirectory
48
+	 *
49
+	 * @param string $location_result The default location object.
50
+	 */
51
+	return $location_result = apply_filters('geodir_get_default_location', get_option('geodir_default_location'));
52 52
 }
53 53
 
54 54
 /**
@@ -60,11 +60,11 @@  discard block
 block discarded – undo
60 60
  */
61 61
 function geodir_is_default_location_set()
62 62
 {
63
-    $default_location = geodir_get_default_location();
64
-    if (!empty($default_location))
65
-        return true;
66
-    else
67
-        return false;
63
+	$default_location = geodir_get_default_location();
64
+	if (!empty($default_location))
65
+		return true;
66
+	else
67
+		return false;
68 68
 }
69 69
 
70 70
 /**
@@ -78,15 +78,15 @@  discard block
 block discarded – undo
78 78
 function create_location_slug($location_string)
79 79
 {
80 80
 
81
-    /**
82
-     * Filter the location slug.
83
-     *
84
-     * @since 1.0.0
85
-     * @package GeoDirectory
86
-     *
87
-     * @param string $location_string Sanitized location string.
88
-     */
89
-    return urldecode(apply_filters('geodir_location_slug_check', sanitize_title($location_string)));
81
+	/**
82
+	 * Filter the location slug.
83
+	 *
84
+	 * @since 1.0.0
85
+	 * @package GeoDirectory
86
+	 *
87
+	 * @param string $location_string Sanitized location string.
88
+	 */
89
+	return urldecode(apply_filters('geodir_location_slug_check', sanitize_title($location_string)));
90 90
 
91 91
 }
92 92
 
@@ -100,15 +100,15 @@  discard block
 block discarded – undo
100 100
  */
101 101
 function geodir_get_location($id = '')
102 102
 {
103
-    /**
104
-     * Filter the location information.
105
-     *
106
-     * @since 1.0.0
107
-     * @package GeoDirectory
108
-     *
109
-     * @param string $id The location ID.
110
-     */
111
-    return $location_result = apply_filters('geodir_get_location_by_id', get_option('geodir_default_location'), $id);
103
+	/**
104
+	 * Filter the location information.
105
+	 *
106
+	 * @since 1.0.0
107
+	 * @package GeoDirectory
108
+	 *
109
+	 * @param string $id The location ID.
110
+	 */
111
+	return $location_result = apply_filters('geodir_get_location_by_id', get_option('geodir_default_location'), $id);
112 112
 }
113 113
 
114 114
 /**
@@ -122,28 +122,28 @@  discard block
 block discarded – undo
122 122
  */
123 123
 function geodir_get_country_dl($post_country = '', $prefix = '')
124 124
 {
125
-    global $wpdb;
125
+	global $wpdb;
126 126
 
127
-    $rows = $wpdb->get_results("SELECT Country,ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " ORDER BY Country ASC");
127
+	$rows = $wpdb->get_results("SELECT Country,ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " ORDER BY Country ASC");
128 128
     
129
-    $ISO2 = array();
130
-    $countries = array();
129
+	$ISO2 = array();
130
+	$countries = array();
131 131
     
132
-    foreach ($rows as $row) {
133
-        $ISO2[$row->Country] = $row->ISO2;
134
-        $countries[$row->Country] = __($row->Country, 'geodirectory');
135
-    }
132
+	foreach ($rows as $row) {
133
+		$ISO2[$row->Country] = $row->ISO2;
134
+		$countries[$row->Country] = __($row->Country, 'geodirectory');
135
+	}
136 136
     
137
-    asort($countries);
137
+	asort($countries);
138 138
     
139
-    $out_put = '<option ' . selected('', $post_country, false) . ' value="">' . __('Select Country', 'geodirectory') . '</option>';
140
-    foreach ($countries as $country => $name) {
141
-        $ccode = $ISO2[$country];
139
+	$out_put = '<option ' . selected('', $post_country, false) . ' value="">' . __('Select Country', 'geodirectory') . '</option>';
140
+	foreach ($countries as $country => $name) {
141
+		$ccode = $ISO2[$country];
142 142
 
143
-        $out_put .= '<option ' . selected($post_country, $country, false) . ' value="' . esc_attr($country) . '" data-country_code="' . $ccode . '">' . $name . '</option>';
144
-    }
143
+		$out_put .= '<option ' . selected($post_country, $country, false) . ' value="' . esc_attr($country) . '" data-country_code="' . $ccode . '">' . $name . '</option>';
144
+	}
145 145
 
146
-    echo $out_put;
146
+	echo $out_put;
147 147
 }
148 148
 
149 149
 
@@ -158,40 +158,40 @@  discard block
 block discarded – undo
158 158
 function geodir_location_form_submit()
159 159
 {
160 160
 
161
-    global $wpdb, $plugin_prefix;
162
-    if (isset($_REQUEST['add_location'])) {
161
+	global $wpdb, $plugin_prefix;
162
+	if (isset($_REQUEST['add_location'])) {
163 163
 
164
-        $location_info = array(
165
-            'city' => $_REQUEST['city'],
166
-            'region' => $_REQUEST['region'],
167
-            'country' => $_REQUEST['country'],
168
-            'geo_lat' => $_REQUEST['latitude'],
169
-            'geo_lng' => $_REQUEST['longitude'],
170
-            'is_default' => $_REQUEST['is_default'],
171
-            'update_city' => $_REQUEST['update_city']
172
-        );
164
+		$location_info = array(
165
+			'city' => $_REQUEST['city'],
166
+			'region' => $_REQUEST['region'],
167
+			'country' => $_REQUEST['country'],
168
+			'geo_lat' => $_REQUEST['latitude'],
169
+			'geo_lng' => $_REQUEST['longitude'],
170
+			'is_default' => $_REQUEST['is_default'],
171
+			'update_city' => $_REQUEST['update_city']
172
+		);
173 173
 
174
-        $old_location = geodir_get_default_location();
174
+		$old_location = geodir_get_default_location();
175 175
 
176
-        $locationid = geodir_add_new_location($location_info);
176
+		$locationid = geodir_add_new_location($location_info);
177 177
 
178
-        $default_location = geodir_get_location($locationid);
178
+		$default_location = geodir_get_location($locationid);
179 179
 
180
-        //UPDATE AND DELETE LISTING
181
-        $posttype = geodir_get_posttypes();
182
-        if (isset($_REQUEST['listing_action']) && $_REQUEST['listing_action'] == 'delete') {
180
+		//UPDATE AND DELETE LISTING
181
+		$posttype = geodir_get_posttypes();
182
+		if (isset($_REQUEST['listing_action']) && $_REQUEST['listing_action'] == 'delete') {
183 183
 
184
-            foreach ($posttype as $posttypeobj) {
185
-                $post_locations = '[' . $default_location->city_slug . '],[' . $default_location->region_slug . '],[' . $default_location->country_slug . ']'; // set all overall post location
184
+			foreach ($posttype as $posttypeobj) {
185
+				$post_locations = '[' . $default_location->city_slug . '],[' . $default_location->region_slug . '],[' . $default_location->country_slug . ']'; // set all overall post location
186 186
 
187
-                $sql = $wpdb->prepare(
188
-                    "UPDATE " . $plugin_prefix . $posttypeobj . "_detail SET post_city=%s, post_region=%s, post_country=%s, post_locations=%s WHERE post_location_id=%d AND ( post_city!=%s OR post_region!=%s OR post_country!=%s OR post_locations!=%s OR post_locations IS NULL)",
189
-                    array($_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations, $locationid, $_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations)
190
-                );
191
-                $wpdb->query($sql);
192
-            }
193
-        }
194
-    }
187
+				$sql = $wpdb->prepare(
188
+					"UPDATE " . $plugin_prefix . $posttypeobj . "_detail SET post_city=%s, post_region=%s, post_country=%s, post_locations=%s WHERE post_location_id=%d AND ( post_city!=%s OR post_region!=%s OR post_country!=%s OR post_locations!=%s OR post_locations IS NULL)",
189
+					array($_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations, $locationid, $_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations)
190
+				);
191
+				$wpdb->query($sql);
192
+			}
193
+		}
194
+	}
195 195
 }
196 196
 
197 197
 /**
@@ -214,58 +214,58 @@  discard block
 block discarded – undo
214 214
  */
215 215
 function geodir_add_new_location($location_info = array())
216 216
 {
217
-    global $wpdb;
217
+	global $wpdb;
218 218
 
219
-    if (!empty($location_info)) {
219
+	if (!empty($location_info)) {
220 220
 
221
-        $location_city = ($location_info['city'] != '') ? $location_info['city'] : 'all';
222
-        $location_region = ($location_info['region'] != '') ? $location_info['region'] : 'all';
223
-        $location_country = ($location_info['country'] != '') ? $location_info['country'] : 'all';
224
-        $location_lat = ($location_info['geo_lat'] != '') ? $location_info['geo_lat'] : '';
225
-        $location_lng = ($location_info['geo_lng'] != '') ? $location_info['geo_lng'] : '';
226
-        $is_default = isset($location_info['is_default']) ? $location_info['is_default'] : '';
227
-        $country_slug = create_location_slug(__($location_country, 'geodirectory'));
228
-        $region_slug = create_location_slug($location_region);
229
-        $city_slug = create_location_slug($location_city);
221
+		$location_city = ($location_info['city'] != '') ? $location_info['city'] : 'all';
222
+		$location_region = ($location_info['region'] != '') ? $location_info['region'] : 'all';
223
+		$location_country = ($location_info['country'] != '') ? $location_info['country'] : 'all';
224
+		$location_lat = ($location_info['geo_lat'] != '') ? $location_info['geo_lat'] : '';
225
+		$location_lng = ($location_info['geo_lng'] != '') ? $location_info['geo_lng'] : '';
226
+		$is_default = isset($location_info['is_default']) ? $location_info['is_default'] : '';
227
+		$country_slug = create_location_slug(__($location_country, 'geodirectory'));
228
+		$region_slug = create_location_slug($location_region);
229
+		$city_slug = create_location_slug($location_city);
230 230
 
231
-        /**
232
-         * Filter add new location data.
233
-         *
234
-         * @since 1.0.0
235
-         */
236
-        $geodir_location = (object)apply_filters('geodir_add_new_location', array('location_id' => 0,
237
-            'country' => $location_country,
238
-            'region' => $location_region,
239
-            'city' => $location_city,
240
-            'country_slug' => $country_slug,
241
-            'region_slug' => $region_slug,
242
-            'city_slug' => $city_slug,
243
-            'city_latitude' => $location_lat,
244
-            'city_longitude' => $location_lng,
245
-            'is_default' => $is_default
246
-        ));
231
+		/**
232
+		 * Filter add new location data.
233
+		 *
234
+		 * @since 1.0.0
235
+		 */
236
+		$geodir_location = (object)apply_filters('geodir_add_new_location', array('location_id' => 0,
237
+			'country' => $location_country,
238
+			'region' => $location_region,
239
+			'city' => $location_city,
240
+			'country_slug' => $country_slug,
241
+			'region_slug' => $region_slug,
242
+			'city_slug' => $city_slug,
243
+			'city_latitude' => $location_lat,
244
+			'city_longitude' => $location_lng,
245
+			'is_default' => $is_default
246
+		));
247 247
 
248 248
 
249
-        if ($geodir_location->country) {
249
+		if ($geodir_location->country) {
250 250
 
251
-            $get_country = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country=%s", array($geodir_location->country)));
251
+			$get_country = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country=%s", array($geodir_location->country)));
252 252
 
253
-            if (empty($get_country)) {
253
+			if (empty($get_country)) {
254 254
 
255
-                $wpdb->query($wpdb->prepare("INSERT INTO " . GEODIR_COUNTRIES_TABLE . " (Country, Title) VALUES (%s,%s)", array($geodir_location->country, $geodir_location->country)));
255
+				$wpdb->query($wpdb->prepare("INSERT INTO " . GEODIR_COUNTRIES_TABLE . " (Country, Title) VALUES (%s,%s)", array($geodir_location->country, $geodir_location->country)));
256 256
 
257
-            }
257
+			}
258 258
 
259
-        }
259
+		}
260 260
 
261
-        if ($geodir_location->is_default)
262
-            update_option('geodir_default_location', $geodir_location);
261
+		if ($geodir_location->is_default)
262
+			update_option('geodir_default_location', $geodir_location);
263 263
 
264
-        return $geodir_location->location_id;
264
+		return $geodir_location->location_id;
265 265
 
266
-    } else {
267
-        return false;
268
-    }
266
+	} else {
267
+		return false;
268
+	}
269 269
 }
270 270
 
271 271
 /**
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
  */
280 280
 function geodir_random_float($min = 0, $max = 1)
281 281
 {
282
-    return $min + mt_rand() / mt_getrandmax() * ($max - $min);
282
+	return $min + mt_rand() / mt_getrandmax() * ($max - $min);
283 283
 }
284 284
 
285 285
 /**
@@ -293,22 +293,22 @@  discard block
 block discarded – undo
293 293
  */
294 294
 function geodir_get_address_by_lat_lan($lat, $lng)
295 295
 {
296
-    $url = 'http://maps.googleapis.com/maps/api/geocode/json?latlng=' . trim($lat) . ',' . trim($lng) ;
297
-
298
-    $ch = curl_init();
299
-    curl_setopt($ch, CURLOPT_URL, $url);
300
-    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
301
-    curl_setopt($ch, CURLOPT_PROXYPORT, 3128);
302
-    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
303
-    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
304
-    $response = curl_exec($ch);
305
-    curl_close($ch);
306
-    $data = json_decode($response);
307
-    $status = $data->status;
308
-    if ($status == "OK") {
309
-        return $data->results[0]->address_components;
310
-    } else
311
-        return false;
296
+	$url = 'http://maps.googleapis.com/maps/api/geocode/json?latlng=' . trim($lat) . ',' . trim($lng) ;
297
+
298
+	$ch = curl_init();
299
+	curl_setopt($ch, CURLOPT_URL, $url);
300
+	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
301
+	curl_setopt($ch, CURLOPT_PROXYPORT, 3128);
302
+	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
303
+	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
304
+	$response = curl_exec($ch);
305
+	curl_close($ch);
306
+	$data = json_decode($response);
307
+	$status = $data->status;
308
+	if ($status == "OK") {
309
+		return $data->results[0]->address_components;
310
+	} else
311
+		return false;
312 312
 }
313 313
 
314 314
 /**
@@ -325,70 +325,70 @@  discard block
 block discarded – undo
325 325
  */
326 326
 function geodir_get_current_location_terms($location_array_from = 'session', $gd_post_type = '')
327 327
 {
328
-    global $wp, $gd_session;
329
-    $location_array = array();
330
-    if ($location_array_from == 'session') {
331
-        if ($gd_session->get('gd_country') == 'me' || $gd_session->get('gd_region') == 'me' || $gd_session->get('gd_city') == 'me') {
332
-            return $location_array;
333
-        }
328
+	global $wp, $gd_session;
329
+	$location_array = array();
330
+	if ($location_array_from == 'session') {
331
+		if ($gd_session->get('gd_country') == 'me' || $gd_session->get('gd_region') == 'me' || $gd_session->get('gd_city') == 'me') {
332
+			return $location_array;
333
+		}
334 334
 
335
-        $country = $gd_session->get('gd_country');
336
-        if ($country != '' && $country)
337
-            $location_array['gd_country'] = urldecode($country);
335
+		$country = $gd_session->get('gd_country');
336
+		if ($country != '' && $country)
337
+			$location_array['gd_country'] = urldecode($country);
338 338
 
339
-        $region = $gd_session->get('gd_region');
340
-        if ($region != '' && $region)
341
-            $location_array['gd_region'] = urldecode($region);
339
+		$region = $gd_session->get('gd_region');
340
+		if ($region != '' && $region)
341
+			$location_array['gd_region'] = urldecode($region);
342 342
 
343
-        $city = $gd_session->get('gd_city');
344
-        if ($city != '' && $city)
345
-            $location_array['gd_city'] = urldecode($city);
346
-    } else {
347
-        if ((isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] == 'me') || (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] == 'me') || (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] == 'me')) {
348
-            return $location_array;
349
-        }
343
+		$city = $gd_session->get('gd_city');
344
+		if ($city != '' && $city)
345
+			$location_array['gd_city'] = urldecode($city);
346
+	} else {
347
+		if ((isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] == 'me') || (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] == 'me') || (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] == 'me')) {
348
+			return $location_array;
349
+		}
350 350
 
351
-        $country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
351
+		$country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
352 352
 
353
-        $region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
353
+		$region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
354 354
 
355
-        $city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
355
+		$city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
356 356
 
357
-        if ($country != '')
358
-            $location_array['gd_country'] = urldecode($country);
357
+		if ($country != '')
358
+			$location_array['gd_country'] = urldecode($country);
359 359
 
360
-        if ($region != '')
361
-            $location_array['gd_region'] = urldecode($region);
360
+		if ($region != '')
361
+			$location_array['gd_region'] = urldecode($region);
362 362
 
363
-        if ($city != '')
364
-            $location_array['gd_city'] = urldecode($city);
363
+		if ($city != '')
364
+			$location_array['gd_city'] = urldecode($city);
365 365
 			
366 366
 		// Fix category link in ajax popular category widget on change post type
367 367
 		if (empty($location_array) && defined('DOING_AJAX') && DOING_AJAX) {
368 368
 			$location_array = geodir_get_current_location_terms('session');
369 369
 		}
370
-    }
370
+	}
371 371
 
372 372
 	/**
373 373
 	 * Filter the location terms.
374 374
 	 *
375 375
 	 * @since 1.4.6
376
-     * @package GeoDirectory
376
+	 * @package GeoDirectory
377 377
 	 *
378
-     * @param array $location_array {
379
-     *    Attributes of the location_array.
380
-     *
381
-     *    @type string $gd_country The country slug.
382
-     *    @type string $gd_region The region slug.
383
-     *    @type string $gd_city The city slug.
384
-     *
385
-     * }
378
+	 * @param array $location_array {
379
+	 *    Attributes of the location_array.
380
+	 *
381
+	 *    @type string $gd_country The country slug.
382
+	 *    @type string $gd_region The region slug.
383
+	 *    @type string $gd_city The city slug.
384
+	 *
385
+	 * }
386 386
 	 * @param string $location_array_from Source type of location terms. Default session.
387 387
 	 * @param string $gd_post_type WP post type.
388 388
 	 */
389 389
 	$location_array = apply_filters( 'geodir_current_location_terms', $location_array, $location_array_from, $gd_post_type );
390 390
 
391
-    return $location_array;
391
+	return $location_array;
392 392
 
393 393
 }
394 394
 
@@ -403,31 +403,31 @@  discard block
 block discarded – undo
403 403
 function geodir_get_location_link($which_location = 'current')
404 404
 {
405 405
 
406
-    $location_link = get_permalink(geodir_location_page_id());
406
+	$location_link = get_permalink(geodir_location_page_id());
407 407
 
408
-    if (get_option('permalink_structure') != '') {
408
+	if (get_option('permalink_structure') != '') {
409 409
 
410
-        //$location_prefix = get_option('geodir_location_prefix');
411
-        //$location_link = substr_replace($location_link, $location_prefix, strpos($location_link, 'location'), strlen('location'));
410
+		//$location_prefix = get_option('geodir_location_prefix');
411
+		//$location_link = substr_replace($location_link, $location_prefix, strpos($location_link, 'location'), strlen('location'));
412 412
 
413
-    }
413
+	}
414 414
 
415
-    if ($which_location == 'base') {
416
-        return $location_link;
417
-    } else {
418
-        $location_terms = geodir_get_current_location_terms();
415
+	if ($which_location == 'base') {
416
+		return $location_link;
417
+	} else {
418
+		$location_terms = geodir_get_current_location_terms();
419 419
 
420
-        if (!empty($location_terms)) {
421
-            if (get_option('permalink_structure') != '') {
422
-                $location_terms = implode("/", $location_terms);
423
-                $location_terms = rtrim($location_terms, '/');
424
-                $location_link .= $location_terms;
425
-            } else {
426
-                $location_link = geodir_getlink($location_link, $location_terms);
427
-            }
428
-        }
429
-    }
430
-    return $location_link;
420
+		if (!empty($location_terms)) {
421
+			if (get_option('permalink_structure') != '') {
422
+				$location_terms = implode("/", $location_terms);
423
+				$location_terms = rtrim($location_terms, '/');
424
+				$location_link .= $location_terms;
425
+			} else {
426
+				$location_link = geodir_getlink($location_link, $location_terms);
427
+			}
428
+		}
429
+	}
430
+	return $location_link;
431 431
 }
432 432
 
433 433
 
Please login to merge, or discard this patch.
Braces   +31 added lines, -22 removed lines patch added patch discarded remove patch
@@ -61,11 +61,12 @@  discard block
 block discarded – undo
61 61
 function geodir_is_default_location_set()
62 62
 {
63 63
     $default_location = geodir_get_default_location();
64
-    if (!empty($default_location))
65
-        return true;
66
-    else
67
-        return false;
68
-}
64
+    if (!empty($default_location)) {
65
+            return true;
66
+    } else {
67
+            return false;
68
+    }
69
+    }
69 70
 
70 71
 /**
71 72
  * Returns location slug using location string.
@@ -258,8 +259,9 @@  discard block
 block discarded – undo
258 259
 
259 260
         }
260 261
 
261
-        if ($geodir_location->is_default)
262
-            update_option('geodir_default_location', $geodir_location);
262
+        if ($geodir_location->is_default) {
263
+                    update_option('geodir_default_location', $geodir_location);
264
+        }
263 265
 
264 266
         return $geodir_location->location_id;
265 267
 
@@ -307,9 +309,10 @@  discard block
 block discarded – undo
307 309
     $status = $data->status;
308 310
     if ($status == "OK") {
309 311
         return $data->results[0]->address_components;
310
-    } else
311
-        return false;
312
-}
312
+    } else {
313
+            return false;
314
+    }
315
+    }
313 316
 
314 317
 /**
315 318
  * Returns current location terms.
@@ -333,16 +336,19 @@  discard block
 block discarded – undo
333 336
         }
334 337
 
335 338
         $country = $gd_session->get('gd_country');
336
-        if ($country != '' && $country)
337
-            $location_array['gd_country'] = urldecode($country);
339
+        if ($country != '' && $country) {
340
+                    $location_array['gd_country'] = urldecode($country);
341
+        }
338 342
 
339 343
         $region = $gd_session->get('gd_region');
340
-        if ($region != '' && $region)
341
-            $location_array['gd_region'] = urldecode($region);
344
+        if ($region != '' && $region) {
345
+                    $location_array['gd_region'] = urldecode($region);
346
+        }
342 347
 
343 348
         $city = $gd_session->get('gd_city');
344
-        if ($city != '' && $city)
345
-            $location_array['gd_city'] = urldecode($city);
349
+        if ($city != '' && $city) {
350
+                    $location_array['gd_city'] = urldecode($city);
351
+        }
346 352
     } else {
347 353
         if ((isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] == 'me') || (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] == 'me') || (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] == 'me')) {
348 354
             return $location_array;
@@ -354,14 +360,17 @@  discard block
 block discarded – undo
354 360
 
355 361
         $city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
356 362
 
357
-        if ($country != '')
358
-            $location_array['gd_country'] = urldecode($country);
363
+        if ($country != '') {
364
+                    $location_array['gd_country'] = urldecode($country);
365
+        }
359 366
 
360
-        if ($region != '')
361
-            $location_array['gd_region'] = urldecode($region);
367
+        if ($region != '') {
368
+                    $location_array['gd_region'] = urldecode($region);
369
+        }
362 370
 
363
-        if ($city != '')
364
-            $location_array['gd_city'] = urldecode($city);
371
+        if ($city != '') {
372
+                    $location_array['gd_city'] = urldecode($city);
373
+        }
365 374
 			
366 375
 		// Fix category link in ajax popular category widget on change post type
367 376
 		if (empty($location_array) && defined('DOING_AJAX') && DOING_AJAX) {
Please login to merge, or discard this patch.