Test Failed
Pull Request — master (#306)
by Kiran
16:19
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');
41
+	if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) {
42
+		$is_detail_page = true;
43
+	}
49 44
 
50
-    $geodir_vars_data = array(
51
-        'siteurl' => get_option('siteurl'),
52
-        'geodir_plugin_url' => geodir_plugin_url(),
53
-        'geodir_lazy_load' => get_option('geodir_lazy_load',1),
54
-        'geodir_ajax_url' => geodir_get_ajax_url(),
55
-        'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'),
56
-        'is_rtl' => is_rtl() ? 1 : 0 // fix rtl issue
57
-    );
45
+	wp_enqueue_script('jquery');
46
+
47
+	wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js', array(), GEODIRECTORY_VERSION);
48
+	wp_enqueue_script('geodirectory-script');
49
+
50
+	$geodir_vars_data = array(
51
+		'siteurl' => get_option('siteurl'),
52
+		'geodir_plugin_url' => geodir_plugin_url(),
53
+		'geodir_lazy_load' => get_option('geodir_lazy_load',1),
54
+		'geodir_ajax_url' => geodir_get_ajax_url(),
55
+		'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'),
56
+		'is_rtl' => is_rtl() ? 1 : 0 // fix rtl issue
57
+	);
58
+
59
+	/**
60
+	 * Filter the `geodir_var` data array that outputs the  wp_localize_script() translations and variables.
61
+	 *
62
+	 * This is used by addons to add JS translatable variables.
63
+	 *
64
+	 * @since 1.4.4
65
+	 * @param array $geodir_vars_data {
66
+	 *    geodir var data used by addons to add JS translatable variables.
67
+	 *
68
+	 *    @type string $siteurl Site url.
69
+	 *    @type string $geodir_plugin_url Geodirectory core plugin url.
70
+	 *    @type string $geodir_ajax_url Geodirectory plugin ajax url.
71
+	 *    @type int $geodir_gd_modal Disable GD modal that displays slideshow images in popup?.
72
+	 *    @type int $is_rtl Checks if current locale is RTL.
73
+	 *
74
+	 * }
75
+	 */
76
+	$geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data);
77
+
78
+	wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data);
79
+
80
+	wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true);
81
+	if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');}
82
+
83
+	wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true);
84
+	wp_enqueue_script('geodirectory-lightbox-jquery');
85
+
86
+	wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true);
87
+	if ($is_detail_page) {
88
+		wp_enqueue_script('geodirectory-jquery-simplemodal');
89
+	}
58 90
 
59
-    /**
60
-     * Filter the `geodir_var` data array that outputs the  wp_localize_script() translations and variables.
61
-     *
62
-     * This is used by addons to add JS translatable variables.
63
-     *
64
-     * @since 1.4.4
65
-     * @param array $geodir_vars_data {
66
-     *    geodir var data used by addons to add JS translatable variables.
67
-     *
68
-     *    @type string $siteurl Site url.
69
-     *    @type string $geodir_plugin_url Geodirectory core plugin url.
70
-     *    @type string $geodir_ajax_url Geodirectory plugin ajax url.
71
-     *    @type int $geodir_gd_modal Disable GD modal that displays slideshow images in popup?.
72
-     *    @type int $is_rtl Checks if current locale is RTL.
73
-     *
74
-     * }
75
-     */
76
-    $geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data);
77
-
78
-    wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data);
79
-
80
-    wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true);
81
-    if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');}
82
-
83
-    wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true);
84
-    wp_enqueue_script('geodirectory-lightbox-jquery');
85
-
86
-    wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true);
87
-    if ($is_detail_page) {
88
-        wp_enqueue_script('geodirectory-jquery-simplemodal');
89
-    }
90
-
91
-    if (in_array($geodir_map_name, array('auto', 'google'))) {
92
-        $map_lang = "&language=" . geodir_get_map_default_language();
93
-        $map_key = "&key=" . geodir_get_map_api_key();
94
-        /**
95
-         * Filter the variables that are added to the end of the google maps script call.
96
-         *
97
-         * This i used to change things like google maps language etc.
98
-         *
99
-         * @since 1.0.0
100
-         * @param string $var The string to filter, default is empty string.
101
-         */
102
-        $map_extra = apply_filters('geodir_googlemap_script_extra', '');
103
-        wp_enqueue_script('geodirectory-googlemap-script', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra , '', NULL);
104
-    }
91
+	if (in_array($geodir_map_name, array('auto', 'google'))) {
92
+		$map_lang = "&language=" . geodir_get_map_default_language();
93
+		$map_key = "&key=" . geodir_get_map_api_key();
94
+		/**
95
+		 * Filter the variables that are added to the end of the google maps script call.
96
+		 *
97
+		 * This i used to change things like google maps language etc.
98
+		 *
99
+		 * @since 1.0.0
100
+		 * @param string $var The string to filter, default is empty string.
101
+		 */
102
+		$map_extra = apply_filters('geodir_googlemap_script_extra', '');
103
+		wp_enqueue_script('geodirectory-googlemap-script', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra , '', NULL);
104
+	}
105 105
     
106
-    if ($geodir_map_name == 'osm') {
107
-        // Leaflet OpenStreetMap
108
-        wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
109
-        wp_enqueue_style('geodirectory-leaflet-style');
106
+	if ($geodir_map_name == 'osm') {
107
+		// Leaflet OpenStreetMap
108
+		wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
109
+		wp_enqueue_style('geodirectory-leaflet-style');
110 110
             
111
-        wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
112
-        wp_enqueue_script('geodirectory-leaflet-script');
111
+		wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
112
+		wp_enqueue_script('geodirectory-leaflet-script');
113 113
         
114
-        wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.js', array(), GEODIRECTORY_VERSION);
115
-        wp_enqueue_script('geodirectory-leaflet-geo-script');
114
+		wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.js', array(), GEODIRECTORY_VERSION);
115
+		wp_enqueue_script('geodirectory-leaflet-geo-script');
116 116
         
117
-        if ($is_detail_page) {
118
-            wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION);
119
-            wp_enqueue_style('geodirectory-leaflet-routing-style');
117
+		if ($is_detail_page) {
118
+			wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION);
119
+			wp_enqueue_style('geodirectory-leaflet-routing-style');
120 120
                 
121
-            wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.js', array(), GEODIRECTORY_VERSION);
122
-            wp_enqueue_script('geodirectory-leaflet-routing-script');
123
-        }
124
-    }
125
-    wp_enqueue_script( 'jquery-ui-autocomplete' );
121
+			wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.js', array(), GEODIRECTORY_VERSION);
122
+			wp_enqueue_script('geodirectory-leaflet-routing-script');
123
+		}
124
+	}
125
+	wp_enqueue_script( 'jquery-ui-autocomplete' );
126 126
     
127
-    wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true);
128
-    wp_enqueue_script('geodirectory-goMap-script');
129
-
130
-
131
-    wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION);
132
-    wp_enqueue_script('chosen');
133
-
134
-    wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION);
135
-    wp_enqueue_script('geodirectory-choose-ajax');
136
-
137
-    wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.min.js', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true);
138
-
139
-    if (is_page() && geodir_is_page('add-listing')) {
140
-        // SCRIPT FOR UPLOAD
141
-        wp_enqueue_script('plupload-all');
142
-        wp_enqueue_script('jquery-ui-sortable');
143
-
144
-        wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true);
145
-        wp_enqueue_script('geodirectory-plupload-script');
146
-        // SCRIPT FOR UPLOAD END
147
-
148
-        // check_ajax_referer function is used to make sure no files are uplaoded remotly but it will fail if used between https and non https so we do the check below of the urls
149
-        if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
150
-            $ajax_url = admin_url('admin-ajax.php');
151
-        } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
152
-            $ajax_url = admin_url('admin-ajax.php');
153
-        } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
154
-            $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
155
-        } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
156
-            $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
157
-        } else {
158
-            $ajax_url = admin_url('admin-ajax.php');
159
-        }
127
+	wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true);
128
+	wp_enqueue_script('geodirectory-goMap-script');
129
+
130
+
131
+	wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION);
132
+	wp_enqueue_script('chosen');
133
+
134
+	wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION);
135
+	wp_enqueue_script('geodirectory-choose-ajax');
136
+
137
+	wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.min.js', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true);
138
+
139
+	if (is_page() && geodir_is_page('add-listing')) {
140
+		// SCRIPT FOR UPLOAD
141
+		wp_enqueue_script('plupload-all');
142
+		wp_enqueue_script('jquery-ui-sortable');
143
+
144
+		wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true);
145
+		wp_enqueue_script('geodirectory-plupload-script');
146
+		// SCRIPT FOR UPLOAD END
147
+
148
+		// check_ajax_referer function is used to make sure no files are uplaoded remotly but it will fail if used between https and non https so we do the check below of the urls
149
+		if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
150
+			$ajax_url = admin_url('admin-ajax.php');
151
+		} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
152
+			$ajax_url = admin_url('admin-ajax.php');
153
+		} elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
154
+			$ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
155
+		} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
156
+			$ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
157
+		} else {
158
+			$ajax_url = admin_url('admin-ajax.php');
159
+		}
160 160
 
161
-        // place js config array for plupload
162
-        $plupload_init = array(
163
-            'runtimes' => 'html5,silverlight,flash,browserplus,gears,html4',
164
-            'browse_button' => 'plupload-browse-button', // will be adjusted per uploader
165
-            'container' => 'plupload-upload-ui', // will be adjusted per uploader
166
-            'drop_element' => 'dropbox', // will be adjusted per uploader
167
-            'file_data_name' => 'async-upload', // will be adjusted per uploader
168
-            'multiple_queues' => true,
169
-            'max_file_size' => geodir_max_upload_size(),
170
-            'url' => $ajax_url,
171
-            'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
172
-            'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
173
-            'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')),
174
-            'multipart' => true,
175
-            'urlstream_upload' => true,
176
-            'multi_selection' => false, // will be added per uploader
177
-            // additional post data to send to our ajax hook
178
-            'multipart_params' => array(
179
-                '_ajax_nonce' => "", // will be added per uploader
180
-                'action' => 'plupload_action', // the ajax action name
181
-                'imgid' => 0 // will be added per uploader
182
-            )
183
-        );
184
-        $base_plupload_config = json_encode($plupload_init);
185
-
186
-        $gd_plupload_init = array('base_plupload_config' => $base_plupload_config,
187
-            'upload_img_size' => geodir_max_upload_size());
188
-
189
-        wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
190
-
191
-        wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload');
192
-    } // End if for add place page
193
-
194
-    wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
195
-    if ($is_detail_page) {
161
+		// place js config array for plupload
162
+		$plupload_init = array(
163
+			'runtimes' => 'html5,silverlight,flash,browserplus,gears,html4',
164
+			'browse_button' => 'plupload-browse-button', // will be adjusted per uploader
165
+			'container' => 'plupload-upload-ui', // will be adjusted per uploader
166
+			'drop_element' => 'dropbox', // will be adjusted per uploader
167
+			'file_data_name' => 'async-upload', // will be adjusted per uploader
168
+			'multiple_queues' => true,
169
+			'max_file_size' => geodir_max_upload_size(),
170
+			'url' => $ajax_url,
171
+			'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
172
+			'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
173
+			'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')),
174
+			'multipart' => true,
175
+			'urlstream_upload' => true,
176
+			'multi_selection' => false, // will be added per uploader
177
+			// additional post data to send to our ajax hook
178
+			'multipart_params' => array(
179
+				'_ajax_nonce' => "", // will be added per uploader
180
+				'action' => 'plupload_action', // the ajax action name
181
+				'imgid' => 0 // will be added per uploader
182
+			)
183
+		);
184
+		$base_plupload_config = json_encode($plupload_init);
185
+
186
+		$gd_plupload_init = array('base_plupload_config' => $base_plupload_config,
187
+			'upload_img_size' => geodir_max_upload_size());
188
+
189
+		wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
190
+
191
+		wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload');
192
+	} // End if for add place page
193
+
194
+	wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
195
+	if ($is_detail_page) {
196 196
 		wp_enqueue_script('geodirectory-post-custom-js');
197 197
 	}
198 198
 
199
-    // font awesome rating script
199
+	// font awesome rating script
200 200
 	if (get_option('geodir_reviewrating_enable_font_awesome')) {
201 201
 		wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION, true);
202 202
 		wp_enqueue_script('geodir-barrating-js');
@@ -205,11 +205,11 @@  discard block
 block discarded – undo
205 205
 		wp_enqueue_script('geodir-jRating-js');
206 206
 	}
207 207
 
208
-    wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
209
-    wp_enqueue_script('geodir-on-document-load');
208
+	wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
209
+	wp_enqueue_script('geodir-on-document-load');
210 210
 
211
-    wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
212
-    wp_enqueue_script('google-geometa');
211
+	wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
212
+	wp_enqueue_script('google-geometa');
213 213
 }
214 214
 
215 215
 /**
@@ -223,8 +223,8 @@  discard block
 block discarded – undo
223 223
  */
224 224
 function geodir_header_scripts()
225 225
 {
226
-    echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>';
227
-    echo stripslashes(get_option('geodir_header_scripts'));
226
+	echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>';
227
+	echo stripslashes(get_option('geodir_header_scripts'));
228 228
 }
229 229
 
230 230
 
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 function geodir_footer_scripts()
241 241
 {
242 242
 
243
-    if(get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')){?>
243
+	if(get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')){?>
244 244
 
245 245
         <script>
246 246
             (function(i,s,o,g,r,a,m){ i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
@@ -255,20 +255,20 @@  discard block
 block discarded – undo
255 255
         </script>
256 256
 
257 257
 <?php
258
-    }elseif(get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){
259
-        echo stripslashes(get_option('geodir_ga_tracking_code'));
260
-    }
258
+	}elseif(get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){
259
+		echo stripslashes(get_option('geodir_ga_tracking_code'));
260
+	}
261 261
 
262
-    echo stripslashes(get_option('geodir_footer_scripts'));
262
+	echo stripslashes(get_option('geodir_footer_scripts'));
263 263
 
264
-    /*
264
+	/*
265 265
      * Apple suck and can't/won't fix bugs: https://bugs.webkit.org/show_bug.cgi?id=136041
266 266
      *
267 267
      * Flexbox wont wrap on ios for search form items
268 268
      */
269
-    if (preg_match( '/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'] ) ) {
270
-        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>";
271
-    }
269
+	if (preg_match( '/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'] ) ) {
270
+		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>";
271
+	}
272 272
 }
273 273
 
274 274
 
@@ -282,12 +282,12 @@  discard block
 block discarded – undo
282 282
  */
283 283
 function geodir_add_async_forscript($url)
284 284
 {
285
-    if (strpos($url, '#asyncload')===false)
286
-        return $url;
287
-    else if (is_admin())
288
-        return str_replace('#asyncload', '', $url);
289
-    else
290
-        return str_replace('#asyncload', '', $url)."' async='async";
285
+	if (strpos($url, '#asyncload')===false)
286
+		return $url;
287
+	else if (is_admin())
288
+		return str_replace('#asyncload', '', $url);
289
+	else
290
+		return str_replace('#asyncload', '', $url)."' async='async";
291 291
 }
292 292
 add_filter('clean_url', 'geodir_add_async_forscript', 11, 1);
293 293
 
@@ -300,17 +300,17 @@  discard block
 block discarded – undo
300 300
 function geodir_templates_styles()
301 301
 {
302 302
 
303
-    wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION);
304
-    wp_enqueue_style('geodir-core-scss');
305
-    wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION);
303
+	wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION);
304
+	wp_enqueue_style('geodir-core-scss');
305
+	wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION);
306 306
 
307
-    if(is_rtl()){
308
-    wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION);
309
-    wp_enqueue_style('geodirectory-frontend-rtl-style');
310
-    }
307
+	if(is_rtl()){
308
+	wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION);
309
+	wp_enqueue_style('geodirectory-frontend-rtl-style');
310
+	}
311 311
 
312
-    wp_register_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION);
313
-    wp_enqueue_style('font-awesome');
312
+	wp_register_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION);
313
+	wp_enqueue_style('font-awesome');
314 314
 
315 315
 
316 316
 }
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
  */
325 325
 function geodir_get_sidebar()
326 326
 {
327
-    get_sidebar('geodirectory');
327
+	get_sidebar('geodirectory');
328 328
 }
329 329
 
330 330
 /**
@@ -343,122 +343,122 @@  discard block
 block discarded – undo
343 343
  * @param bool $always_show Do you want to show the pagination always? Default: false.
344 344
  */
345 345
 function geodir_pagination($before = '', $after = '', $prelabel = '', $nxtlabel = '', $pages_to_show = 5, $always_show = false) {
346
-    global $wp_query, $posts_per_page, $wpdb, $paged, $blog_id;
346
+	global $wp_query, $posts_per_page, $wpdb, $paged, $blog_id;
347 347
 
348
-    if (empty($prelabel)) {
349
-        $prelabel = '<strong>&laquo;</strong>';
350
-    }
348
+	if (empty($prelabel)) {
349
+		$prelabel = '<strong>&laquo;</strong>';
350
+	}
351 351
 
352
-    if (empty($nxtlabel)) {
353
-        $nxtlabel = '<strong>&raquo;</strong>';
354
-    }
352
+	if (empty($nxtlabel)) {
353
+		$nxtlabel = '<strong>&raquo;</strong>';
354
+	}
355 355
 
356
-    $half_pages_to_show = round($pages_to_show / 2);
356
+	$half_pages_to_show = round($pages_to_show / 2);
357 357
 
358
-    if (geodir_is_page('home')) // dont apply default  pagination for geodirectory home page.
359
-        return;
358
+	if (geodir_is_page('home')) // dont apply default  pagination for geodirectory home page.
359
+		return;
360 360
 
361
-    if (!is_single()) {
362
-        if (function_exists('geodir_location_geo_home_link')) {
363
-            remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
364
-        }
365
-        $numposts = $wp_query->found_posts;
361
+	if (!is_single()) {
362
+		if (function_exists('geodir_location_geo_home_link')) {
363
+			remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
364
+		}
365
+		$numposts = $wp_query->found_posts;
366 366
 
367
-        $max_page = ceil($numposts / $posts_per_page);
367
+		$max_page = ceil($numposts / $posts_per_page);
368 368
 
369
-        if (empty($paged)) {
370
-            $paged = 1;
371
-        }
369
+		if (empty($paged)) {
370
+			$paged = 1;
371
+		}
372 372
         
373
-        $post_type = geodir_get_current_posttype();
374
-        $listing_type_name = get_post_type_plural_label($post_type);
375
-        if (geodir_is_page('listing') || geodir_is_page('search')) {            
376
-            $term = array();
373
+		$post_type = geodir_get_current_posttype();
374
+		$listing_type_name = get_post_type_plural_label($post_type);
375
+		if (geodir_is_page('listing') || geodir_is_page('search')) {            
376
+			$term = array();
377 377
             
378
-            if (is_tax()) {
379
-                $term_id = get_queried_object_id();
380
-                $taxonomy = get_query_var('taxonomy');
378
+			if (is_tax()) {
379
+				$term_id = get_queried_object_id();
380
+				$taxonomy = get_query_var('taxonomy');
381 381
 
382
-                if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) {
383
-                    $term = get_term($term_id, $post_type . 'category');
384
-                }
385
-            }
382
+				if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) {
383
+					$term = get_term($term_id, $post_type . 'category');
384
+				}
385
+			}
386 386
             
387
-            if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) {
388
-                $taxonomy_search = $_REQUEST['s' . $post_type . 'category'];
387
+			if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) {
388
+				$taxonomy_search = $_REQUEST['s' . $post_type . 'category'];
389 389
                 
390
-                if (!is_array($taxonomy_search)) {
391
-                    $term = get_term((int)$taxonomy_search, $post_type . 'category');
392
-                } else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search
393
-                    $term = get_term((int)$taxonomy_search[0], $post_type . 'category');
394
-                }
395
-            }
390
+				if (!is_array($taxonomy_search)) {
391
+					$term = get_term((int)$taxonomy_search, $post_type . 'category');
392
+				} else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search
393
+					$term = get_term((int)$taxonomy_search[0], $post_type . 'category');
394
+				}
395
+			}
396 396
             
397
-            if (!empty($term) && !is_wp_error($term)) {
398
-                $listing_type_name = $term->name;
399
-            }
400
-        }
397
+			if (!empty($term) && !is_wp_error($term)) {
398
+				$listing_type_name = $term->name;
399
+			}
400
+		}
401 401
 
402
-        if ($max_page > 1 || $always_show) {            
403
-            // Extra pagination info
404
-            $geodir_pagination_more_info = get_option('geodir_pagination_advance_info');
405
-            $start_no = ( $paged - 1 ) * $posts_per_page + 1;
406
-            $end_no = min($paged * $posts_per_page, $numposts);
402
+		if ($max_page > 1 || $always_show) {            
403
+			// Extra pagination info
404
+			$geodir_pagination_more_info = get_option('geodir_pagination_advance_info');
405
+			$start_no = ( $paged - 1 ) * $posts_per_page + 1;
406
+			$end_no = min($paged * $posts_per_page, $numposts);
407 407
 
408
-            if ($geodir_pagination_more_info != '') {
409
-                if ($listing_type_name) {
410
-                    $listing_type_name = __($listing_type_name, 'geodirectory');
411
-                    $pegination_desc = wp_sprintf(__('Showing %s %d-%d of %d', 'geodirectory'), $listing_type_name, $start_no, $end_no, $numposts);
412
-                } else {
413
-                    $pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts);
414
-                }
415
-                $pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>';
416
-                /**
417
-                 * Adds an extra pagination info above/under pagination.
418
-                 *
419
-                 * @since 1.5.9
420
-                 *
421
-                 * @param string $pagination_info Extra pagination info content.
422
-                 * @param string $listing_type_name Listing results type.
423
-                 * @param string $start_no First result number.
424
-                 * @param string $end_no Last result number.
425
-                 * @param string $numposts Total number of listings.
426
-                 * @param string $post_type The post type.
427
-                 */
428
-                $pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type);
408
+			if ($geodir_pagination_more_info != '') {
409
+				if ($listing_type_name) {
410
+					$listing_type_name = __($listing_type_name, 'geodirectory');
411
+					$pegination_desc = wp_sprintf(__('Showing %s %d-%d of %d', 'geodirectory'), $listing_type_name, $start_no, $end_no, $numposts);
412
+				} else {
413
+					$pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts);
414
+				}
415
+				$pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>';
416
+				/**
417
+				 * Adds an extra pagination info above/under pagination.
418
+				 *
419
+				 * @since 1.5.9
420
+				 *
421
+				 * @param string $pagination_info Extra pagination info content.
422
+				 * @param string $listing_type_name Listing results type.
423
+				 * @param string $start_no First result number.
424
+				 * @param string $end_no Last result number.
425
+				 * @param string $numposts Total number of listings.
426
+				 * @param string $post_type The post type.
427
+				 */
428
+				$pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type);
429 429
                 
430
-                if ($geodir_pagination_more_info == 'before') {
431
-                    $before = $before . $pagination_info;
432
-                } else if ($geodir_pagination_more_info == 'after') {
433
-                    $after = $pagination_info . $after;
434
-                }
435
-            }
430
+				if ($geodir_pagination_more_info == 'before') {
431
+					$before = $before . $pagination_info;
432
+				} else if ($geodir_pagination_more_info == 'after') {
433
+					$after = $pagination_info . $after;
434
+				}
435
+			}
436 436
             
437
-            echo "$before <div class='Navi gd-navi'>";
438
-            if ($paged >= ($pages_to_show - 1)) {
439
-                echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link()) . '">&laquo;</a>';
440
-            }
441
-            previous_posts_link($prelabel);
442
-            for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) {
443
-                if ($i >= 1 && $i <= $max_page) {
444
-                    if ($i == $paged) {
445
-                        echo "<strong class='on'>$i</strong>";
446
-                    } else {
447
-                        echo ' <a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($i)) . '">' . $i . '</a> ';
448
-                    }
449
-                }
450
-            }
451
-            next_posts_link($nxtlabel, $max_page);
452
-            if (($paged + $half_pages_to_show) < ($max_page)) {
453
-                echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($max_page)) . '">&raquo;</a>';
454
-            }
455
-            echo "</div> $after";
456
-        }
437
+			echo "$before <div class='Navi gd-navi'>";
438
+			if ($paged >= ($pages_to_show - 1)) {
439
+				echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link()) . '">&laquo;</a>';
440
+			}
441
+			previous_posts_link($prelabel);
442
+			for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) {
443
+				if ($i >= 1 && $i <= $max_page) {
444
+					if ($i == $paged) {
445
+						echo "<strong class='on'>$i</strong>";
446
+					} else {
447
+						echo ' <a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($i)) . '">' . $i . '</a> ';
448
+					}
449
+				}
450
+			}
451
+			next_posts_link($nxtlabel, $max_page);
452
+			if (($paged + $half_pages_to_show) < ($max_page)) {
453
+				echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($max_page)) . '">&raquo;</a>';
454
+			}
455
+			echo "</div> $after";
456
+		}
457 457
         
458
-        if (function_exists('geodir_location_geo_home_link')) {
459
-            add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
460
-        }
461
-    }
458
+		if (function_exists('geodir_location_geo_home_link')) {
459
+			add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
460
+		}
461
+	}
462 462
 }
463 463
 
464 464
 /**
@@ -469,20 +469,20 @@  discard block
 block discarded – undo
469 469
  */
470 470
 function geodir_listingsearch_scripts()
471 471
 {
472
-    if (get_option('gd_search_dist') != '') {
473
-        $dist = get_option('gd_search_dist');
474
-    } else {
475
-        $dist = 500;
476
-    }
477
-    $dist_dif = 1000;
478
-
479
-    if ($dist <= 5000) $dist_dif = 500;
480
-    if ($dist <= 1000) $dist_dif = 100;
481
-    if ($dist <= 500) $dist_dif = 50;
482
-    if ($dist <= 100) $dist_dif = 10;
483
-    if ($dist <= 50) $dist_dif = 5;
484
-
485
-    ?>
472
+	if (get_option('gd_search_dist') != '') {
473
+		$dist = get_option('gd_search_dist');
474
+	} else {
475
+		$dist = 500;
476
+	}
477
+	$dist_dif = 1000;
478
+
479
+	if ($dist <= 5000) $dist_dif = 500;
480
+	if ($dist <= 1000) $dist_dif = 100;
481
+	if ($dist <= 500) $dist_dif = 50;
482
+	if ($dist <= 100) $dist_dif = 10;
483
+	if ($dist <= 50) $dist_dif = 5;
484
+
485
+	?>
486 486
     <script type="text/javascript">
487 487
 
488 488
         jQuery(function ($) {
@@ -540,20 +540,20 @@  discard block
 block discarded – undo
540 540
  * @package GeoDirectory
541 541
  */
542 542
 function geodir_add_sharelocation_scripts() {
543
-    $default_search_for_text = SEARCH_FOR_TEXT;
544
-    if (get_option('geodir_search_field_default_text'))
545
-        $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
543
+	$default_search_for_text = SEARCH_FOR_TEXT;
544
+	if (get_option('geodir_search_field_default_text'))
545
+		$default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
546 546
 
547
-    $default_near_text = NEAR_TEXT;
548
-    if (get_option('geodir_near_field_default_text'))
549
-        $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
547
+	$default_near_text = NEAR_TEXT;
548
+	if (get_option('geodir_near_field_default_text'))
549
+		$default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
550 550
     
551
-    $search_location = geodir_get_default_location();
551
+	$search_location = geodir_get_default_location();
552 552
     
553
-    $default_search_for_text = addslashes(stripslashes($default_search_for_text));
554
-    $default_near_text = addslashes(stripslashes($default_near_text));
555
-    $city = !empty($search_location) ? addslashes(stripslashes($search_location->city)) : '';
556
-    ?>
553
+	$default_search_for_text = addslashes(stripslashes($default_search_for_text));
554
+	$default_near_text = addslashes(stripslashes($default_near_text));
555
+	$city = !empty($search_location) ? addslashes(stripslashes($search_location->city)) : '';
556
+	?>
557 557
     <script type="text/javascript">
558 558
         var default_location = '<?php echo $city ;?>';
559 559
         var latlng;
@@ -634,14 +634,14 @@  discard block
 block discarded – undo
634 634
                     initialise2();
635 635
                 } else {
636 636
                     <?php
637
-                    $near_add = get_option('geodir_search_near_addition');
638
-                    /**
639
-                     * Adds any extra info to the near search box query when trying to geolocate it via google api.
640
-                     *
641
-                     * @since 1.0.0
642
-                     */
643
-                    $near_add2 = apply_filters('geodir_search_near_addition', '');
644
-                    ?>
637
+					$near_add = get_option('geodir_search_near_addition');
638
+					/**
639
+					 * Adds any extra info to the near search box query when trying to geolocate it via google api.
640
+					 *
641
+					 * @since 1.0.0
642
+					 */
643
+					$near_add2 = apply_filters('geodir_search_near_addition', '');
644
+					?>
645 645
                     if (window.gdMaps === 'google') {
646 646
                         Sgeocoder.geocode({'address': address<?php echo ($near_add ? '+", ' . $near_add . '"' : '') . $near_add2;?>},
647 647
                             function (results, status) {
@@ -744,30 +744,30 @@  discard block
 block discarded – undo
744 744
  */
745 745
 function geodir_show_badges_on_image($which, $post, $link)
746 746
 {
747
-    $return = '';
748
-    switch ($which) {
749
-        case 'featured':
750
-            /**
751
-             * Filter the featured image badge html that appears in the listings pages over the thumbnail.
752
-             *
753
-             * @since 1.0.0
754
-             * @param object $post The post object.
755
-             * @param string $link The link to the post.
756
-             */
757
-            $return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img">&nbsp;</span></a>',$post,$link);
758
-            break;
759
-        case 'new' :
760
-            /**
761
-             * Filter the new image badge html that appears in the listings pages over the thumbnail.
762
-             *
763
-             * @since 1.0.0
764
-             * @param object $post The post object.
765
-             * @param string $link The link to the post.
766
-             */
767
-            $return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing">&nbsp;</span></a>',$post,$link);
768
-            break;
769
-
770
-    }
747
+	$return = '';
748
+	switch ($which) {
749
+		case 'featured':
750
+			/**
751
+			 * Filter the featured image badge html that appears in the listings pages over the thumbnail.
752
+			 *
753
+			 * @since 1.0.0
754
+			 * @param object $post The post object.
755
+			 * @param string $link The link to the post.
756
+			 */
757
+			$return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img">&nbsp;</span></a>',$post,$link);
758
+			break;
759
+		case 'new' :
760
+			/**
761
+			 * Filter the new image badge html that appears in the listings pages over the thumbnail.
762
+			 *
763
+			 * @since 1.0.0
764
+			 * @param object $post The post object.
765
+			 * @param string $link The link to the post.
766
+			 */
767
+			$return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing">&nbsp;</span></a>',$post,$link);
768
+			break;
769
+
770
+	}
771 771
     
772
-    return $return;
772
+	return $return;
773 773
 }
Please login to merge, or discard this patch.