Test Failed
Push — master ( a5d0c4...de3f76 )
by Stiofan
29:27
created
geodirectory_template_tags.php 1 patch
Indentation   +337 added lines, -337 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  */
23 23
 function geodir_core_dequeue_script()
24 24
 {
25
-    wp_dequeue_script('flexslider');
25
+	wp_dequeue_script('flexslider');
26 26
 }
27 27
 
28 28
 add_action('wp_print_scripts', 'geodir_core_dequeue_script', 100);
@@ -35,168 +35,168 @@  discard block
 block discarded – undo
35 35
  */
36 36
 function geodir_templates_scripts()
37 37
 {
38
-    $is_detail_page = false;
39
-    $geodir_map_name = geodir_map_name();
38
+	$is_detail_page = false;
39
+	$geodir_map_name = geodir_map_name();
40 40
 
41
-    if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) {
42
-        $is_detail_page = true;
43
-    }
44
-
45
-    wp_enqueue_script('jquery');
46
-
47
-    wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js', array(), GEODIRECTORY_VERSION);
48
-    wp_enqueue_script('geodirectory-script');
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');
41
+	if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) {
42
+		$is_detail_page = true;
43
+	}
85 44
 
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
-    }
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
+	}
90 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) {
@@ -764,30 +764,30 @@  discard block
 block discarded – undo
764 764
  */
765 765
 function geodir_show_badges_on_image($which, $post, $link)
766 766
 {
767
-    $return = '';
768
-    switch ($which) {
769
-        case 'featured':
770
-            /**
771
-             * Filter the featured image badge html that appears in the listings pages over the thumbnail.
772
-             *
773
-             * @since 1.0.0
774
-             * @param object $post The post object.
775
-             * @param string $link The link to the post.
776
-             */
777
-            $return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img">&nbsp;</span></a>',$post,$link);
778
-            break;
779
-        case 'new' :
780
-            /**
781
-             * Filter the new image badge html that appears in the listings pages over the thumbnail.
782
-             *
783
-             * @since 1.0.0
784
-             * @param object $post The post object.
785
-             * @param string $link The link to the post.
786
-             */
787
-            $return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing">&nbsp;</span></a>',$post,$link);
788
-            break;
789
-
790
-    }
767
+	$return = '';
768
+	switch ($which) {
769
+		case 'featured':
770
+			/**
771
+			 * Filter the featured image badge html that appears in the listings pages over the thumbnail.
772
+			 *
773
+			 * @since 1.0.0
774
+			 * @param object $post The post object.
775
+			 * @param string $link The link to the post.
776
+			 */
777
+			$return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img">&nbsp;</span></a>',$post,$link);
778
+			break;
779
+		case 'new' :
780
+			/**
781
+			 * Filter the new image badge html that appears in the listings pages over the thumbnail.
782
+			 *
783
+			 * @since 1.0.0
784
+			 * @param object $post The post object.
785
+			 * @param string $link The link to the post.
786
+			 */
787
+			$return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing">&nbsp;</span></a>',$post,$link);
788
+			break;
789
+
790
+	}
791 791
     
792
-    return $return;
792
+	return $return;
793 793
 }
Please login to merge, or discard this patch.
geodirectory-functions/user_functions.php 1 patch
Indentation   +119 added lines, -119 removed lines patch added patch discarded remove patch
@@ -13,28 +13,28 @@  discard block
 block discarded – undo
13 13
  */
14 14
 function geodir_user_favourite_listing_count($user_id=false)
15 15
 {
16
-    global $wpdb, $plugin_prefix, $current_user;
16
+	global $wpdb, $plugin_prefix, $current_user;
17 17
 
18
-    if(!$user_id){$user_id = $current_user->ID;}
19
-    if(!$user_id){return array();}
18
+	if(!$user_id){$user_id = $current_user->ID;}
19
+	if(!$user_id){return array();}
20 20
 
21
-    $user_favorites = get_user_meta($user_id, 'gd_user_favourite_post', true);
22
-    $all_posts = get_option('geodir_favorite_link_user_dashboard');
21
+	$user_favorites = get_user_meta($user_id, 'gd_user_favourite_post', true);
22
+	$all_posts = get_option('geodir_favorite_link_user_dashboard');
23 23
 
24
-    $user_listing = array();
25
-    if (is_array($all_posts) && !empty($all_posts) && is_array($user_favorites) && !empty($user_favorites)) {
26
-        $user_favorites = "'" . implode("','", $user_favorites) . "'";
24
+	$user_listing = array();
25
+	if (is_array($all_posts) && !empty($all_posts) && is_array($user_favorites) && !empty($user_favorites)) {
26
+		$user_favorites = "'" . implode("','", $user_favorites) . "'";
27 27
 
28
-        foreach ($all_posts as $ptype) {
29
-            $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE  post_type='" . $ptype . "' AND post_status = 'publish' AND ID IN (" . $user_favorites . ")");
28
+		foreach ($all_posts as $ptype) {
29
+			$total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE  post_type='" . $ptype . "' AND post_status = 'publish' AND ID IN (" . $user_favorites . ")");
30 30
 
31
-            if ($total_posts > 0) {
32
-                $user_listing[$ptype] = $total_posts;
33
-            }
34
-        }
35
-    }
31
+			if ($total_posts > 0) {
32
+				$user_listing[$ptype] = $total_posts;
33
+			}
34
+		}
35
+	}
36 36
 
37
-    return $user_listing;
37
+	return $user_listing;
38 38
 }
39 39
 
40 40
 
@@ -47,51 +47,51 @@  discard block
 block discarded – undo
47 47
  */
48 48
 
49 49
 function geodir_user_show_favourites($user_id='',$output_type='select'){
50
-    // My Favourites in Dashboard
51
-    $show_favorite_link_user_dashboard = get_option('geodir_favorite_link_user_dashboard');
52
-    $user_favourite = geodir_user_favourite_listing_count($user_id);
53
-
54
-    if (!empty($show_favorite_link_user_dashboard) && !empty($user_favourite)) {
55
-        $favourite_links = '';
56
-        $post_types = geodir_get_posttypes('object');
57
-
58
-        $author_link = get_author_posts_url($user_id);
59
-        $author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false);
60
-
61
-        foreach ($post_types as $key => $postobj) {
62
-            if (in_array($key, $show_favorite_link_user_dashboard) && array_key_exists($key, $user_favourite)) {
63
-                $name = $postobj->labels->name;
64
-                $post_type_link = geodir_getlink($author_link, array('stype' => $key, 'list' => 'favourite'), false);
65
-
66
-                $selected = '';
67
-
68
-                if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key && isset($_REQUEST['geodir_dashbord'])) {
69
-                    $selected = 'selected="selected"';
70
-                }
71
-                /**
72
-                 * Filter favorite listing link.
73
-                 *
74
-                 * @since 1.0.0
75
-                 * @param string $post_type_link Favorite listing link.
76
-                 * @param string $key Favorite listing array key.
77
-                 * @param int $current_user->ID Current user ID.
78
-                 */
79
-                $post_type_link = apply_filters('geodir_dashboard_link_favorite_listing', $post_type_link, $key, $user_id);
80
-
81
-                if($output_type=='select'){
82
-                    $favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . __(geodir_utf8_ucfirst($name), 'geodirectory') . '</option>';
83
-                }elseif($output_type=='link'){
84
-                    $favourite_links[] = '<a href="' . $post_type_link . '">' . __(geodir_utf8_ucfirst($name), 'geodirectory') . '</a>';
85
-                }
86
-
87
-
88
-            }
89
-        }
90
-
91
-        if ($favourite_links != '') {
92
-            $user = get_user_by( 'ID', $user_id );
93
-            if($output_type=='select') {
94
-                ?>
50
+	// My Favourites in Dashboard
51
+	$show_favorite_link_user_dashboard = get_option('geodir_favorite_link_user_dashboard');
52
+	$user_favourite = geodir_user_favourite_listing_count($user_id);
53
+
54
+	if (!empty($show_favorite_link_user_dashboard) && !empty($user_favourite)) {
55
+		$favourite_links = '';
56
+		$post_types = geodir_get_posttypes('object');
57
+
58
+		$author_link = get_author_posts_url($user_id);
59
+		$author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false);
60
+
61
+		foreach ($post_types as $key => $postobj) {
62
+			if (in_array($key, $show_favorite_link_user_dashboard) && array_key_exists($key, $user_favourite)) {
63
+				$name = $postobj->labels->name;
64
+				$post_type_link = geodir_getlink($author_link, array('stype' => $key, 'list' => 'favourite'), false);
65
+
66
+				$selected = '';
67
+
68
+				if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key && isset($_REQUEST['geodir_dashbord'])) {
69
+					$selected = 'selected="selected"';
70
+				}
71
+				/**
72
+				 * Filter favorite listing link.
73
+				 *
74
+				 * @since 1.0.0
75
+				 * @param string $post_type_link Favorite listing link.
76
+				 * @param string $key Favorite listing array key.
77
+				 * @param int $current_user->ID Current user ID.
78
+				 */
79
+				$post_type_link = apply_filters('geodir_dashboard_link_favorite_listing', $post_type_link, $key, $user_id);
80
+
81
+				if($output_type=='select'){
82
+					$favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . __(geodir_utf8_ucfirst($name), 'geodirectory') . '</option>';
83
+				}elseif($output_type=='link'){
84
+					$favourite_links[] = '<a href="' . $post_type_link . '">' . __(geodir_utf8_ucfirst($name), 'geodirectory') . '</a>';
85
+				}
86
+
87
+
88
+			}
89
+		}
90
+
91
+		if ($favourite_links != '') {
92
+			$user = get_user_by( 'ID', $user_id );
93
+			if($output_type=='select') {
94
+				?>
95 95
                 <li>
96 96
                     <select id="geodir_my_favourites" class="chosen_select" onchange="window.location.href=this.value"
97 97
                             option-autoredirect="1" name="geodir_my_favourites" option-ajaxchosen="false"
@@ -102,62 +102,62 @@  discard block
 block discarded – undo
102 102
                     </select>
103 103
                 </li>
104 104
             <?php
105
-            }elseif($output_type=='link'){
106
-                if(!empty($favourite_links)){
107
-                    echo implode(" | ",$favourite_links);
108
-                }
109
-
110
-            }
111
-        }
112
-    }
105
+			}elseif($output_type=='link'){
106
+				if(!empty($favourite_links)){
107
+					echo implode(" | ",$favourite_links);
108
+				}
109
+
110
+			}
111
+		}
112
+	}
113 113
 }
114 114
 
115 115
 
116 116
 
117 117
 function geodir_user_show_listings($user_id='',$output_type='select'){
118 118
 
119
-    $show_listing_link_user_dashboard = get_option('geodir_listing_link_user_dashboard');
120
-    $user_listing = geodir_user_post_listing_count($user_id);
121
-
122
-    if (!empty($show_listing_link_user_dashboard) && !empty($user_listing)) {
123
-        $listing_links = array();
124
-
125
-        $post_types = geodir_get_posttypes('object');
126
-
127
-        $author_link = get_author_posts_url($user_id);
128
-        $author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false);
129
-
130
-        foreach ($post_types as $key => $postobj) {
131
-            if (in_array($key, $show_listing_link_user_dashboard) && array_key_exists($key, $user_listing)) {
132
-                $name = $postobj->labels->name;
133
-                $listing_link = geodir_getlink($author_link, array('stype' => $key), false);
134
-
135
-                $selected = '';
136
-                if (!isset($_REQUEST['list']) && isset($_REQUEST['geodir_dashbord']) && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key) {
137
-                    $selected = 'selected="selected"';
138
-                }
139
-
140
-                /**
141
-                 * Filter my listing link.
142
-                 *
143
-                 * @since 1.0.0
144
-                 * @param string $listing_link My listing link.
145
-                 * @param string $key My listing array key.
146
-                 * @param int $current_user->ID Current user ID.
147
-                 */
148
-                $listing_link = apply_filters('geodir_dashboard_link_my_listing', $listing_link, $key, $user_id);
149
-                if($output_type=='select') {
150
-                    $listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . __(geodir_utf8_ucfirst($name), 'geodirectory') . '</option>';
151
-                }elseif($output_type=='link'){
152
-                    $listing_links[] = '<a href="' .$listing_link . '">' . __(geodir_utf8_ucfirst($name), 'geodirectory') . '</a>';
153
-                }
154
-            }
155
-        }
156
-
157
-        if ($listing_links != '') {
158
-            $user = get_user_by( 'ID', $user_id );
159
-            if($output_type=='select') {
160
-                ?>
119
+	$show_listing_link_user_dashboard = get_option('geodir_listing_link_user_dashboard');
120
+	$user_listing = geodir_user_post_listing_count($user_id);
121
+
122
+	if (!empty($show_listing_link_user_dashboard) && !empty($user_listing)) {
123
+		$listing_links = array();
124
+
125
+		$post_types = geodir_get_posttypes('object');
126
+
127
+		$author_link = get_author_posts_url($user_id);
128
+		$author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false);
129
+
130
+		foreach ($post_types as $key => $postobj) {
131
+			if (in_array($key, $show_listing_link_user_dashboard) && array_key_exists($key, $user_listing)) {
132
+				$name = $postobj->labels->name;
133
+				$listing_link = geodir_getlink($author_link, array('stype' => $key), false);
134
+
135
+				$selected = '';
136
+				if (!isset($_REQUEST['list']) && isset($_REQUEST['geodir_dashbord']) && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key) {
137
+					$selected = 'selected="selected"';
138
+				}
139
+
140
+				/**
141
+				 * Filter my listing link.
142
+				 *
143
+				 * @since 1.0.0
144
+				 * @param string $listing_link My listing link.
145
+				 * @param string $key My listing array key.
146
+				 * @param int $current_user->ID Current user ID.
147
+				 */
148
+				$listing_link = apply_filters('geodir_dashboard_link_my_listing', $listing_link, $key, $user_id);
149
+				if($output_type=='select') {
150
+					$listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . __(geodir_utf8_ucfirst($name), 'geodirectory') . '</option>';
151
+				}elseif($output_type=='link'){
152
+					$listing_links[] = '<a href="' .$listing_link . '">' . __(geodir_utf8_ucfirst($name), 'geodirectory') . '</a>';
153
+				}
154
+			}
155
+		}
156
+
157
+		if ($listing_links != '') {
158
+			$user = get_user_by( 'ID', $user_id );
159
+			if($output_type=='select') {
160
+				?>
161 161
                 <li>
162 162
                     <select id="geodir_my_listings" class="chosen_select" onchange="window.location.href=this.value"
163 163
                             option-autoredirect="1" name="geodir_my_listings" option-ajaxchosen="false"
@@ -168,13 +168,13 @@  discard block
 block discarded – undo
168 168
                     </select>
169 169
                 </li>
170 170
             <?php
171
-            }elseif($output_type=='link'){
172
-                if(!empty($listing_links )){
173
-                    echo implode(" | ",$listing_links );
174
-                }
175
-
176
-            }
177
-        }
178
-    }
171
+			}elseif($output_type=='link'){
172
+				if(!empty($listing_links )){
173
+					echo implode(" | ",$listing_links );
174
+				}
175
+
176
+			}
177
+		}
178
+	}
179 179
 
180 180
 }
Please login to merge, or discard this patch.